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