]>
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 | 52 | |
c05608c2 AD |
53 | function p_notify(msg) { |
54 | ||
55 | var n = parent.document.getElementById("notify"); | |
56 | var nb = parent.document.getElementById("notify_body"); | |
57 | ||
58 | if (!n || !nb) return; | |
59 | ||
60 | nb.innerHTML = msg; | |
61 | ||
62 | if (msg.length == 0) { | |
63 | n.style.display = "none"; | |
64 | } else { | |
65 | n.style.display = "block"; | |
66 | } | |
67 | ||
68 | } | |
69 | ||
7726fa02 AD |
70 | function notify(msg) { |
71 | ||
72 | var n = document.getElementById("notify"); | |
c05608c2 | 73 | var nb = document.getElementById("notify_body"); |
7726fa02 | 74 | |
c05608c2 | 75 | if (!n || !nb) return; |
f0601b87 | 76 | |
c05608c2 | 77 | nb.innerHTML = msg; |
7726fa02 AD |
78 | |
79 | if (msg.length == 0) { | |
80 | n.style.display = "none"; | |
81 | } else { | |
82 | n.style.display = "block"; | |
83 | } | |
84 | ||
85 | } | |
86 | ||
508a81e1 | 87 | function printLockingError() { |
f0601b87 | 88 | notify("Please wait until operation finishes");} |
508a81e1 | 89 | |
13ad9102 AD |
90 | var seq = ""; |
91 | ||
92 | function hotkey_handler(e) { | |
760966c1 | 93 | |
13ad9102 AD |
94 | var keycode; |
95 | ||
760966c1 AD |
96 | if (!hotkeys_enabled) return; |
97 | ||
13ad9102 AD |
98 | if (window.event) { |
99 | keycode = window.event.keyCode; | |
100 | } else if (e) { | |
101 | keycode = e.which; | |
102 | } | |
103 | ||
104 | if (keycode == 13 || keycode == 27) { | |
105 | seq = ""; | |
106 | } else { | |
107 | seq = seq + "" + keycode; | |
108 | } | |
109 | ||
110 | var piggie = document.getElementById("piggie"); | |
111 | ||
bb7cface | 112 | if (piggie) { |
13ad9102 | 113 | |
bb7cface AD |
114 | if (seq.match("807371717369")) { |
115 | localPiggieFunction(true); | |
116 | } else { | |
117 | localPiggieFunction(false); | |
118 | } | |
119 | } | |
120 | ||
9cfc649a AD |
121 | if (typeof localHotkeyHandler != 'undefined') { |
122 | localHotkeyHandler(keycode); | |
123 | } | |
124 | ||
13ad9102 AD |
125 | } |
126 | ||
f0601b87 AD |
127 | function cleanSelected(element) { |
128 | var content = document.getElementById(element); | |
129 | ||
130 | var rows = new Array(); | |
131 | ||
132 | for (i = 0; i < content.rows.length; i++) { | |
133 | content.rows[i].className = content.rows[i].className.replace("Selected", ""); | |
134 | } | |
135 | ||
136 | } | |
137 | ||
138 | function getVisibleUnreadHeadlines() { | |
139 | var content = document.getElementById("headlinesList"); | |
140 | ||
141 | var rows = new Array(); | |
142 | ||
143 | for (i = 0; i < content.rows.length; i++) { | |
144 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
145 | if (row_id.length > 0 && content.rows[i].className.match("Unread")) { | |
146 | rows.push(row_id); | |
147 | } | |
148 | } | |
149 | return rows; | |
150 | } | |
151 | ||
152 | function getVisibleHeadlineIds() { | |
153 | ||
154 | var content = document.getElementById("headlinesList"); | |
155 | ||
156 | var rows = new Array(); | |
157 | ||
158 | for (i = 0; i < content.rows.length; i++) { | |
159 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
160 | if (row_id.length > 0) { | |
161 | rows.push(row_id); | |
162 | } | |
163 | } | |
164 | return rows; | |
165 | } | |
166 | ||
167 | function getFirstVisibleHeadlineId() { | |
168 | var rows = getVisibleHeadlineIds(); | |
169 | return rows[0]; | |
170 | } | |
171 | ||
172 | function getLastVisibleHeadlineId() { | |
173 | var rows = getVisibleHeadlineIds(); | |
174 | return rows[rows.length-1]; | |
175 | } | |
176 | ||
177 | function markHeadline(id) { | |
178 | var row = document.getElementById("RROW-" + id); | |
179 | if (row) { | |
180 | row.className = row.className + "Selected"; | |
181 | } | |
182 | } | |
183 | ||
184 | function getFeedIds() { | |
185 | var content = document.getElementById("feedsList"); | |
186 | ||
187 | var rows = new Array(); | |
188 | ||
189 | for (i = 0; i < content.rows.length; i++) { | |
190 | var id = content.rows[i].id.replace("FEEDR-", ""); | |
191 | if (id.length > 0) { | |
192 | rows.push(id); | |
193 | } | |
194 | } | |
195 | ||
196 | return rows; | |
197 | } | |
13ad9102 | 198 | |
7726fa02 | 199 |