1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// ==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/
var PLUGIN_INFO =
<VimperatorPlugin>
<name>Happy Happy Vimperator</name>
<description>This plugin makes you to True Vimperatorer</description>
<version>1.0</version>
<detail><![CDATA[
DON NOT THINK. FEEL!
]]></detail>
</VimperatorPlugin>;
(function () {
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;
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)
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'],
['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
);
})();
// vim:sw=2 ts=2 et si fdm=marker:
|