diff options
| author | anekos | 2008-12-07 09:55:18 +0000 | 
|---|---|---|
| committer | anekos | 2008-12-07 09:55:18 +0000 | 
| commit | 7db3c7e6c82bf5f76942e43d2180127579706f32 (patch) | |
| tree | 7b6691415cd48b1008ae3306576eb2c3e1234e81 | |
| parent | b4815b5cda8a37424864b8be90c3012f6c4b4747 (diff) | |
| download | vimperator-plugins-7db3c7e6c82bf5f76942e43d2180127579706f32.tar.bz2 | |
判定をアホな方法で賢くした。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26047 d0d07461-0603-4401-acd4-de1884942a52
| -rw-r--r-- | happy_hacking_vimperator.js | 21 | 
1 files changed, 20 insertions, 1 deletions
diff --git a/happy_hacking_vimperator.js b/happy_hacking_vimperator.js index 4419ff1..3b9d67e 100644 --- a/happy_hacking_vimperator.js +++ b/happy_hacking_vimperator.js @@ -24,6 +24,7 @@    let enabled = s2b(liberator.globalVariables.happy_hacking_vimperator_enable, true);    let ignore = false; +  let mousedownTime = new Date();    function s2b (s, d) (!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<<!s; @@ -66,12 +67,30 @@    [      ['mousemove', 'DOMMouseScroll'], -    ['mousedown', 'mouseup', 'dblclick', 'click'] +    ['mouseup', 'dblclick']    ].forEach(      function (names, msg)        names.forEach(function (name) window.addEventListener(name, kill(msg), true))    ); +  window.addEventListener( +    'mousedown', +    function (event) { +      mousedownTime = new Date().getTime(); +      kill(true)(event); +    }, +    true +  ); + +  window.addEventListener( +    'click', +    function (event) { +      if ((new Date().getTime() - mousedownTime) < 500) +        kill(true)(event); +    }, +    true +  ); +  })();  | 
