Skip to content

Commit a070802

Browse files
committed
fix for mobile
1 parent a236c10 commit a070802

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

HacgGodTurn/HacgGodTurn.user.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
// @include http*://sleazyfork.org/*/scripts/*
7979
// @include http*://greasyfork.org/*/scripts/*
8080
// @include http*://*yfork.org/*/forum/*discussion*
81-
// @version 3.22.06
81+
// @version 3.22.07
8282
// @grant GM_notification
8383
// @grant GM_xmlhttpRequest
8484
// @grant GM_setClipboard
@@ -1445,7 +1445,7 @@
14451445
const minLength=256,tg=0.5;
14461446
var lastX, lastY, signs, lastSign;
14471447
function tracer(e) {
1448-
let curX=e.clientX,curY=e.clientY;
1448+
let curX=e.changedTouches[0].clientX,curY=e.changedTouches[0].clientY;
14491449
let distanceX=curX-lastX,distanceY=curY-lastY;
14501450
let distance=distanceX*distanceX+distanceY*distanceY;
14511451
if (distance>minLength) {
@@ -1472,14 +1472,14 @@
14721472
}
14731473
}
14741474
};
1475-
document.addEventListener("mousedown", function(e) {
1476-
lastX=e.clientX;
1477-
lastY=e.clientY;
1475+
document.addEventListener("touchstart", function(e) {
1476+
lastX=e.changedTouches[0].clientX;
1477+
lastY=e.changedTouches[0].clientY;
14781478
lastSign=signs="";
1479-
document.addEventListener("mousemove", tracer, false);
1479+
document.addEventListener("touchmove", tracer, false);
14801480
}, false);
1481-
document.addEventListener("mouseup", function(e) {
1482-
document.removeEventListener("mousemove", tracer, false);
1481+
document.addEventListener("touchend", function(e) {
1482+
document.removeEventListener("touchmove", tracer, false);
14831483
if(signs=="↓→↑←"){
14841484
e.stopPropagation();
14851485
e.preventDefault();

0 commit comments

Comments
 (0)