aboutsummaryrefslogtreecommitdiffstats
path: root/happy_hacking_vimperator.js
diff options
context:
space:
mode:
authoranekos2008-12-07 03:18:13 +0000
committeranekos2008-12-07 03:18:13 +0000
commitae9b086f2abbc9c2226d1c48fd50af7869442689 (patch)
treedd12cda33f1b0e0b4a81d72ed27474f5b8d5fd80 /happy_hacking_vimperator.js
parentd2f784723bf6b473d7931c6f2e6abcf01ca53fc4 (diff)
downloadvimperator-plugins-ae9b086f2abbc9c2226d1c48fd50af7869442689.tar.bz2
煩悩記念リリース
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26032 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'happy_hacking_vimperator.js')
-rw-r--r--happy_hacking_vimperator.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/happy_hacking_vimperator.js b/happy_hacking_vimperator.js
new file mode 100644
index 0000000..46cfae4
--- /dev/null
+++ b/happy_hacking_vimperator.js
@@ -0,0 +1,79 @@
+// ==VimperatorPlugin==
+// @name Happy Hacking Vimperator
+// @description for True Vimperatorer!!
+// @description-ja for True Vimperatorer!!
+// @license Creative Commons Attribution-Share Alike 3.0 Unported
+// @version 1.0
+// @author anekos (anekos@snca.net)
+// @minVersion 2.0pre
+// @maxVersion 2.0pre
+// @requirements Steel Heart
+// ==/VimperatorPlugin==
+//
+// Usage:
+// DON NOT THINK. FEEL!
+//
+// Links:
+// Unbroken keyboard:
+// http://www.pfu.fujitsu.com/hhkeyboard/
+//
+// License:
+// http://creativecommons.org/licenses/by-sa/3.0/
+
+(function () {
+ return;
+
+ let enabled = s2b(liberator.globalVariables.happy_hacking_vimperator_enable, true);
+ let ignore = false;
+
+ function s2b (s, d) (!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<<!s;
+
+ function around (obj, name, func) {
+ let next = obj[name];
+ obj[name] = function ()
+ let (self = this, args = arguments)
+ func.call(self,
+ function () next.apply(self, args),
+ args);
+ };
+
+ function kill (msg) {
+ return function (event) {
+ if (ignore || !enabled)
+ return;
+ event.preventDefault();
+ event.stopPropagation();
+ if (msg)
+ liberator.echoerr('Kill the mouse!')
+ }
+ }
+
+ around(buffer, 'followLink', function (next) {
+ ignore = true;
+ try {
+ next();
+ } finally {
+ ignore = false;
+ }
+ });
+
+ window.addEventListener('keypress', function (event) {
+ let elem = window.document.commandDispatcher.focusedElement;
+ if (events.toString(event) == '<Return>' && elem && elem.form) {
+ ignore = true;
+ setTimeout(function () ignore = false, 200);
+ }
+ }, true);
+
+ [
+ ['mousemove', 'DOMMouseScroll'],
+ ['mousedown', 'mouseup', 'dblclick', 'click']
+ ].forEach(
+ function (names, msg)
+ names.forEach(function (name) window.addEventListener(name, kill(msg), true))
+ );
+
+
+})();
+
+// vim:sw=2 ts=2 et si fdm=marker: