|
3 | 3 | // @name:zh-CN 鼠标手势 |
4 | 4 | // @name:zh-TW 滑鼠手勢 |
5 | 5 | // @namespace hoothin |
6 | | -// @version 0.5 |
| 6 | +// @version 0.6 |
7 | 7 | // @description Just a Mouse Gestures |
8 | 8 | // @description:zh-CN 就是个鼠标手势 |
9 | 9 | // @description:zh-TW 就是個滑鼠手勢 |
|
88 | 88 | {gesture:"←",fun:"back"}, |
89 | 89 | {gesture:"→",fun:"forward"}, |
90 | 90 | {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);}"}, |
92 | 92 | {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);"}, |
93 | 94 | {gesture:"↓↑↓→",fun:"GM_openInTab('http://just998.com/xiu/photo'+unsafeWindow.location.search,false)"} |
94 | 95 | ]; |
95 | 96 | GM_setValue("gestures",gestures); |
96 | 97 | } |
97 | | - function tracer(curX,curY) { |
| 98 | + function tracer(curX,curY,showSign) { |
98 | 99 | let distanceX=curX-lastX,distanceY=curY-lastY; |
99 | 100 | let distance=distanceX*distanceX+distanceY*distanceY; |
100 | 101 | if (distance>minLength) { |
|
118 | 119 | if(lastSign!=direction) { |
119 | 120 | signs+=direction; |
120 | 121 | lastSign=direction; |
121 | | - document.body.appendChild(gesturesContent); |
| 122 | + if(showSign)document.body.appendChild(gesturesContent); |
122 | 123 | } |
123 | 124 | } |
124 | 125 | } |
125 | 126 | function initEventListener(start,move,end,clientX,clientY,startBool){ |
| 127 | + var isMouse=start=="mousedown"; |
126 | 128 | var moveFun=function(e){ |
127 | | - tracer(eval(clientX),eval(clientY)); |
| 129 | + tracer(eval(clientX),eval(clientY),isMouse); |
128 | 130 | gesturesWords.innerHTML=signs; |
129 | 131 | var gesturesWidth=signs.length*51+40; |
130 | 132 | gesturesContent.style.width=gesturesWidth+"px"; |
|
145 | 147 | for(var g of gestures){ |
146 | 148 | var gSign=g.gesture; |
147 | 149 | if(signs==gSign){ |
| 150 | + if(!isMouse)document.body.appendChild(gesturesContent); |
148 | 151 | var fun=defaultFun[g.fun]; |
149 | 152 | if(!fun){ |
150 | 153 | eval(g.fun); |
|
0 commit comments