From 4ca34175067cf4fd087c5c94bbaea77fa38830dd Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 9 Mar 2010 14:18:21 +0000 Subject: コードにより生成されたっぽいマウスイベントを許してやる方向 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36971 d0d07461-0603-4401-acd4-de1884942a52 --- happy_hacking_vimperator.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'happy_hacking_vimperator.js') diff --git a/happy_hacking_vimperator.js b/happy_hacking_vimperator.js index 9f0cb35..4c0fd32 100644 --- a/happy_hacking_vimperator.js +++ b/happy_hacking_vimperator.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2009, anekos. +Copyright (c) 2008-2010, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -36,10 +36,10 @@ let PLUGIN_INFO = Happy Happy Vimperator This plugin makes you to True Vimperatorer - 2.4.1 + 2.4.2 anekos 2.0pre - 2.2pre + 2.3 http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/happy_hacking_vimperator.js new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -203,6 +203,10 @@ let PLUGIN_INFO = } } + function shumagorasu (func) + function (event) + ('screenX screenY'.split(/\s+/).some(function (name) event[name]) && func(event)); + function damn (event) !/^(script|embed)$/i.test(event.target.tagName); @@ -236,24 +240,18 @@ let PLUGIN_INFO = }, true); ['mousemove', 'DOMMouseScroll', 'mouseup', 'dblclick'].forEach( - function (name) window.addEventListener(name, kill(false), true) + function (name) window.addEventListener(name, shumagorasu(kill(false)), true) ); window.addEventListener( 'mousedown', - function (event) { - mousedownTime = new Date().getTime(); - kill(false)(event); - }, + shumagorasu(function (event) (mousedownTime = new Date().getTime(), kill(false)(event))), true ); window.addEventListener( 'click', - function (event) { - if ((new Date().getTime() - mousedownTime) < 500) - kill('mickey')(event); - }, + shumagorasu(function (event) (((new Date().getTime() - mousedownTime) < 500) && kill('mickey')(event))), true ); -- cgit v1.2.3