]>
Commit | Line | Data |
---|---|---|
760966c1 AD |
1 | var hotkeys_enabled = true; |
2 | ||
3 | function disableHotkeys() { | |
4 | hotkeys_enabled = false; | |
5 | } | |
6 | ||
7 | function enableHotkeys() { | |
8 | hotkeys_enabled = true; | |
9 | } | |
10 | ||
c0e5a40e AD |
11 | function xmlhttp_ready(obj) { |
12 | return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState; | |
13 | } | |
14 | ||
15 | ||
9cfc649a AD |
16 | function notify_callback() { |
17 | var container = document.getElementById('notify'); | |
18 | if (xmlhttp.readyState == 4) { | |
19 | container.innerHTML=xmlhttp.responseText; | |
20 | } | |
21 | } | |
22 | ||
23 | function rpc_notify_callback() { | |
24 | var container = document.getElementById('notify'); | |
25 | if (xmlhttp_rpc.readyState == 4) { | |
26 | container.innerHTML=xmlhttp_rpc.responseText; | |
27 | } | |
28 | } | |
29 | ||
7726fa02 AD |
30 | function param_escape(arg) { |
31 | if (typeof encodeURIComponent != 'undefined') | |
32 | return encodeURIComponent(arg); | |
33 | else | |
34 | return escape(arg); | |
35 | } | |
36 | ||
37 | function param_unescape(arg) { | |
38 | if (typeof decodeURIComponent != 'undefined') | |
39 | return decodeURIComponent(arg); | |
40 | else | |
41 | return unescape(arg); | |
42 | } | |
43 | ||
508a81e1 AD |
44 | function delay(gap) { |
45 | var then,now; | |
46 | then=new Date().getTime(); | |
47 | now=then; | |
48 | while((now-then)<gap) { | |
49 | now=new Date().getTime(); | |
50 | } | |
51 | } | |
7726fa02 AD |
52 | |
53 | function notify(msg) { | |
54 | ||
55 | var n = document.getElementById("notify"); | |
56 | ||
57 | n.innerHTML = msg; | |
58 | ||
59 | if (msg.length == 0) { | |
60 | n.style.display = "none"; | |
61 | } else { | |
62 | n.style.display = "block"; | |
63 | } | |
64 | ||
65 | } | |
66 | ||
508a81e1 AD |
67 | function printLockingError() { |
68 | notify("Please wait until operation finishes"); | |
69 | } | |
70 | ||
13ad9102 AD |
71 | var seq = ""; |
72 | ||
73 | function hotkey_handler(e) { | |
760966c1 | 74 | |
13ad9102 AD |
75 | var keycode; |
76 | ||
760966c1 AD |
77 | if (!hotkeys_enabled) return; |
78 | ||
13ad9102 AD |
79 | if (window.event) { |
80 | keycode = window.event.keyCode; | |
81 | } else if (e) { | |
82 | keycode = e.which; | |
83 | } | |
84 | ||
85 | if (keycode == 13 || keycode == 27) { | |
86 | seq = ""; | |
87 | } else { | |
88 | seq = seq + "" + keycode; | |
89 | } | |
90 | ||
91 | var piggie = document.getElementById("piggie"); | |
92 | ||
93 | if (seq.match("807371717369")) { | |
94 | localPiggieFunction(true); | |
95 | } else { | |
96 | localPiggieFunction(false); | |
97 | } | |
98 | ||
9cfc649a AD |
99 | if (typeof localHotkeyHandler != 'undefined') { |
100 | localHotkeyHandler(keycode); | |
101 | } | |
102 | ||
13ad9102 AD |
103 | } |
104 | ||
105 | ||
7726fa02 | 106 |