|
78 | 78 | // @include http*://sleazyfork.org/*/scripts/* |
79 | 79 | // @include http*://greasyfork.org/*/scripts/* |
80 | 80 | // @include http*://*yfork.org/*/forum/*discussion* |
81 | | -// @version 3.22.05 |
| 81 | +// @version 3.22.06 |
82 | 82 | // @grant GM_notification |
83 | 83 | // @grant GM_xmlhttpRequest |
84 | 84 | // @grant GM_setClipboard |
|
1422 | 1422 | } |
1423 | 1423 | }); |
1424 | 1424 | }); |
1425 | | - if(!GM_getValue("hazukashii")){ |
1426 | | - p.then(playSound, function(e) { |
1427 | | - console.error(e); |
1428 | | - }); |
1429 | | - } |
1430 | 1425 | var command=[72,65,90,85,75,65,83,72,73,73],index=0;//"hazukashii" |
1431 | 1426 | document.addEventListener("keydown", function(e) { |
1432 | | - if(e.keyCode == command[index]) { |
| 1427 | + if(e.keyCode==command[index]) { |
1433 | 1428 | if(index==command.length-1){ |
1434 | 1429 | index=0; |
1435 | 1430 | var nowValue=GM_getValue("hazukashii"); |
|
1446 | 1441 | index=0; |
1447 | 1442 | } |
1448 | 1443 | }); |
1449 | | - GM_notification(notificationDetails); |
| 1444 | + |
| 1445 | + const minLength=256,tg=0.5; |
| 1446 | + var lastX, lastY, signs, lastSign; |
| 1447 | + function tracer(e) { |
| 1448 | + let curX=e.clientX,curY=e.clientY; |
| 1449 | + let distanceX=curX-lastX,distanceY=curY-lastY; |
| 1450 | + let distance=distanceX*distanceX+distanceY*distanceY; |
| 1451 | + if (distance>minLength) { |
| 1452 | + lastX=curX; |
| 1453 | + lastY=curY; |
| 1454 | + let direction=""; |
| 1455 | + let slope=Math.abs(distanceY/distanceX); |
| 1456 | + if(slope>tg){ |
| 1457 | + if(distanceY>0) { |
| 1458 | + direction="↓"; |
| 1459 | + }else{ |
| 1460 | + direction="↑"; |
| 1461 | + } |
| 1462 | + }else if(slope<=1/tg) { |
| 1463 | + if(distanceX>0) { |
| 1464 | + direction="→"; |
| 1465 | + }else{ |
| 1466 | + direction="←"; |
| 1467 | + } |
| 1468 | + } |
| 1469 | + if(lastSign!=direction) { |
| 1470 | + signs+=direction; |
| 1471 | + lastSign=direction; |
| 1472 | + } |
| 1473 | + } |
| 1474 | + }; |
| 1475 | + document.addEventListener("mousedown", function(e) { |
| 1476 | + lastX=e.clientX; |
| 1477 | + lastY=e.clientY; |
| 1478 | + lastSign=signs=""; |
| 1479 | + document.addEventListener("mousemove", tracer, false); |
| 1480 | + }, false); |
| 1481 | + document.addEventListener("mouseup", function(e) { |
| 1482 | + document.removeEventListener("mousemove", tracer, false); |
| 1483 | + if(signs=="↓→↑←"){ |
| 1484 | + e.stopPropagation(); |
| 1485 | + e.preventDefault(); |
| 1486 | + if(window.confirm("\u662f\u5426\u7981\u7528\u7f9e\u803b\u0070\u006c\u0061\u0079\u8bed\u97f3\uff1f")){ |
| 1487 | + GM_setValue("hazukashii", true); |
| 1488 | + }else{ |
| 1489 | + GM_setValue("hazukashii", false); |
| 1490 | + } |
| 1491 | + } |
| 1492 | + }, false); |
| 1493 | + if(!GM_getValue("hazukashii")){ |
| 1494 | + p.then(playSound, function(e) { |
| 1495 | + console.error(e); |
| 1496 | + }); |
| 1497 | + GM_notification(notificationDetails); |
| 1498 | + } |
1450 | 1499 | } |
1451 | 1500 | })(); |
0 commit comments