Skip to content

Commit c36e0a5

Browse files
committed
fix
1 parent 66efe43 commit c36e0a5

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Mouse Gestures/Mouse Gestures.user.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 鼠标手势
44
// @name:zh-TW 滑鼠手勢
55
// @namespace hoothin
6-
// @version 0.5
6+
// @version 0.6
77
// @description Just a Mouse Gestures
88
// @description:zh-CN 就是个鼠标手势
99
// @description:zh-TW 就是個滑鼠手勢
@@ -88,13 +88,14 @@
8888
{gesture:"←",fun:"back"},
8989
{gesture:"→",fun:"forward"},
9090
{gesture:"↑↓",fun:"reload"},
91-
{gesture:"↓↑↓",fun:"var element = document.createElement('script');element.id='outfox_seed_js';element.charset='utf-8',element.setAttribute('src','http://fanyi.youdao.com/web2/seed.js?'+Date.parse(new Date()));document.body.appendChild(element);"},
91+
{gesture:"↓↑↓",fun:"var t=((unsafeWindow.getSelection&&unsafeWindow.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){GM_openInTab('http://translate.google.cn/?text='+t+'&hl=zh-CN&langpair=auto|zh-CN&tbb=1&ie='+e,false);}else{GM_openInTab('http://translate.google.cn/translate?u='+encodeURIComponent(location.href)+'&hl=zh-CN&langpair=auto|zh-CN&tbb=1&ie='+e,false);}"},
9292
{gesture:"↓↑↓←",fun:'function R(a){ona = "on"+a; if(unsafeWindow.addEventListener) unsafeWindow.addEventListener(a, function (e) { for(var n=e.originalTarget; n; n=n.parentNode) n[ona]=null; }, true); unsafeWindow[ona]=null; document[ona]=null; if(document.body) document.body[ona]=null; } R("contextmenu"); R("click"); R("mousedown"); R("mouseup"); R("selectstart");'},
93+
{gesture:"↓↑↓↑",fun:"var d = document, e = d.getElementById('wappalyzer-container') ; if ( e !== null ) { d.body.removeChild(e); } var u = 'https://wappalyzer.com/bookmarklet/', t = new Date().getTime(), c = d.createElement('div'), p = d.createElement('div'), l = d.createElement('link'), s = d.createElement('script') ; c.setAttribute('id', 'wappalyzer-container'); l.setAttribute('rel', 'stylesheet'); l.setAttribute('href', u + 'css/wappalyzer.css'); d.head.appendChild(l); p.setAttribute('id', 'wappalyzer-pending'); p.setAttribute('style', 'background-image: url(' + u + 'images/pending.gif) !important'); c.appendChild(p); s.setAttribute('src', u + 'js/wappalyzer.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/apps.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/driver.js?' + t); c.appendChild(s); }; c.appendChild(s); }; c.appendChild(s); d.body.appendChild(c);"},
9394
{gesture:"↓↑↓→",fun:"GM_openInTab('http://just998.com/xiu/photo'+unsafeWindow.location.search,false)"}
9495
];
9596
GM_setValue("gestures",gestures);
9697
}
97-
function tracer(curX,curY) {
98+
function tracer(curX,curY,showSign) {
9899
let distanceX=curX-lastX,distanceY=curY-lastY;
99100
let distance=distanceX*distanceX+distanceY*distanceY;
100101
if (distance>minLength) {
@@ -118,13 +119,14 @@
118119
if(lastSign!=direction) {
119120
signs+=direction;
120121
lastSign=direction;
121-
document.body.appendChild(gesturesContent);
122+
if(showSign)document.body.appendChild(gesturesContent);
122123
}
123124
}
124125
}
125126
function initEventListener(start,move,end,clientX,clientY,startBool){
127+
var isMouse=start=="mousedown";
126128
var moveFun=function(e){
127-
tracer(eval(clientX),eval(clientY));
129+
tracer(eval(clientX),eval(clientY),isMouse);
128130
gesturesWords.innerHTML=signs;
129131
var gesturesWidth=signs.length*51+40;
130132
gesturesContent.style.width=gesturesWidth+"px";
@@ -145,6 +147,7 @@
145147
for(var g of gestures){
146148
var gSign=g.gesture;
147149
if(signs==gSign){
150+
if(!isMouse)document.body.appendChild(gesturesContent);
148151
var fun=defaultFun[g.fun];
149152
if(!fun){
150153
eval(g.fun);

0 commit comments

Comments
 (0)