]>
Commit | Line | Data |
---|---|---|
007bda35 AD |
1 | /* |
2 | This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com> | |
3 | Licensed under GPL v.2 or (at your preference) any later version. | |
4 | */ | |
5 | ||
6 | var xmlhttp = false; | |
7 | ||
961513a3 | 8 | var active_feed = false; |
a0d53889 | 9 | var active_filter = false; |
48f0adb0 | 10 | var active_label = false; |
961513a3 | 11 | |
f5a50b25 AD |
12 | var active_tab = false; |
13 | ||
007bda35 AD |
14 | /*@cc_on @*/ |
15 | /*@if (@_jscript_version >= 5) | |
16 | // JScript gives us Conditional compilation, we can cope with old IE versions. | |
17 | // and security blocked creation of the objects. | |
18 | try { | |
19 | xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); | |
20 | } catch (e) { | |
21 | try { | |
22 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
23 | } catch (E) { | |
24 | xmlhttp = false; | |
25 | } | |
26 | } | |
27 | @end @*/ | |
28 | ||
29 | if (!xmlhttp && typeof XMLHttpRequest!='undefined') { | |
30 | xmlhttp = new XMLHttpRequest(); | |
31 | } | |
32 | ||
007bda35 | 33 | function feedlist_callback() { |
f5a50b25 | 34 | var container = document.getElementById('prefContent'); |
007bda35 AD |
35 | if (xmlhttp.readyState == 4) { |
36 | container.innerHTML=xmlhttp.responseText; | |
961513a3 AD |
37 | if (active_feed) { |
38 | var row = document.getElementById("FEEDR-" + active_feed); | |
39 | if (row) { | |
40 | if (!row.className.match("Selected")) { | |
41 | row.className = row.className + "Selected"; | |
42 | } | |
43 | } | |
44 | var checkbox = document.getElementById("FRCHK-" + active_feed); | |
45 | if (checkbox) { | |
46 | checkbox.checked = true; | |
47 | } | |
48 | } | |
f5a50b25 | 49 | p_notify(""); |
007bda35 AD |
50 | } |
51 | } | |
52 | ||
a0d53889 | 53 | function filterlist_callback() { |
f5a50b25 | 54 | var container = document.getElementById('prefContent'); |
a0d53889 | 55 | if (xmlhttp.readyState == 4) { |
f5a50b25 | 56 | |
a0d53889 AD |
57 | container.innerHTML=xmlhttp.responseText; |
58 | ||
59 | if (active_filter) { | |
60 | var row = document.getElementById("FILRR-" + active_filter); | |
61 | if (row) { | |
62 | if (!row.className.match("Selected")) { | |
63 | row.className = row.className + "Selected"; | |
64 | } | |
65 | } | |
66 | var checkbox = document.getElementById("FICHK-" + active_filter); | |
67 | ||
68 | if (checkbox) { | |
69 | checkbox.checked = true; | |
70 | } | |
71 | } | |
f5a50b25 | 72 | p_notify(""); |
a0d53889 AD |
73 | } |
74 | } | |
75 | ||
48f0adb0 | 76 | function labellist_callback() { |
f5a50b25 | 77 | var container = document.getElementById('prefContent'); |
48f0adb0 AD |
78 | if (xmlhttp.readyState == 4) { |
79 | container.innerHTML=xmlhttp.responseText; | |
80 | ||
81 | if (active_filter) { | |
82 | var row = document.getElementById("LILRR-" + active_label); | |
83 | if (row) { | |
84 | if (!row.className.match("Selected")) { | |
85 | row.className = row.className + "Selected"; | |
86 | } | |
87 | } | |
88 | var checkbox = document.getElementById("LICHK-" + active_label); | |
89 | ||
90 | if (checkbox) { | |
91 | checkbox.checked = true; | |
92 | } | |
93 | } | |
f5a50b25 | 94 | p_notify(""); |
48f0adb0 AD |
95 | } |
96 | } | |
0e091d38 AD |
97 | function notify_callback() { |
98 | var container = document.getElementById('notify'); | |
99 | if (xmlhttp.readyState == 4) { | |
100 | container.innerHTML=xmlhttp.responseText; | |
101 | } | |
102 | } | |
103 | ||
175847de | 104 | |
0e091d38 | 105 | function updateFeedList() { |
007bda35 | 106 | |
c0e5a40e | 107 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
108 | printLockingError(); |
109 | return | |
110 | } | |
111 | ||
f5a50b25 AD |
112 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; |
113 | ||
114 | p_notify("Loading, please wait..."); | |
007bda35 AD |
115 | |
116 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
117 | xmlhttp.onreadystatechange=feedlist_callback; | |
118 | xmlhttp.send(null); | |
119 | ||
120 | } | |
121 | ||
122 | function toggleSelectRow(sender) { | |
123 | var parent_row = sender.parentNode.parentNode; | |
124 | ||
125 | if (sender.checked) { | |
126 | if (!parent_row.className.match("Selected")) { | |
127 | parent_row.className = parent_row.className + "Selected"; | |
128 | } | |
129 | } else { | |
130 | if (parent_row.className.match("Selected")) { | |
131 | parent_row.className = parent_row.className.replace("Selected", ""); | |
132 | } | |
133 | } | |
134 | } | |
135 | ||
48f0adb0 AD |
136 | function addLabel() { |
137 | ||
138 | if (!xmlhttp_ready(xmlhttp)) { | |
139 | printLockingError(); | |
140 | return | |
141 | } | |
142 | ||
143 | var sqlexp = document.getElementById("ladd_expr"); | |
144 | ||
145 | if (sqlexp.value.length == 0) { | |
146 | notify("Missing SQL expression."); | |
147 | } else { | |
148 | notify("Adding label..."); | |
149 | ||
150 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" + | |
151 | param_escape(sqlexp.value), true); | |
152 | ||
153 | xmlhttp.onreadystatechange=labellist_callback; | |
154 | xmlhttp.send(null); | |
155 | ||
156 | sqlexp.value = ""; | |
157 | } | |
158 | ||
159 | } | |
160 | ||
de435974 AD |
161 | function addFilter() { |
162 | ||
163 | if (!xmlhttp_ready(xmlhttp)) { | |
164 | printLockingError(); | |
165 | return | |
166 | } | |
167 | ||
168 | var regexp = document.getElementById("fadd_regexp"); | |
169 | var match = document.getElementById("fadd_match"); | |
170 | ||
171 | if (regexp.value.length == 0) { | |
172 | notify("Missing filter expression."); | |
173 | } else { | |
174 | notify("Adding filter..."); | |
175 | ||
25cb5736 AD |
176 | var v_match = match[match.selectedIndex].text; |
177 | ||
de435974 | 178 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add®exp=" + |
25cb5736 | 179 | param_escape(regexp.value) + "&match=" + v_match, true); |
de435974 AD |
180 | |
181 | xmlhttp.onreadystatechange=filterlist_callback; | |
182 | xmlhttp.send(null); | |
183 | ||
184 | regexp.value = ""; | |
185 | } | |
186 | ||
187 | } | |
48f0adb0 | 188 | |
71ad3959 AD |
189 | function addFeed() { |
190 | ||
c0e5a40e | 191 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
192 | printLockingError(); |
193 | return | |
194 | } | |
195 | ||
331900c6 AD |
196 | var link = document.getElementById("fadd_link"); |
197 | ||
83fe4d6d | 198 | if (link.value.length == 0) { |
c753cd32 | 199 | notify("Missing feed URL."); |
331900c6 AD |
200 | } else { |
201 | notify("Adding feed..."); | |
202 | ||
203 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" + | |
204 | param_escape(link.value), true); | |
205 | xmlhttp.onreadystatechange=feedlist_callback; | |
206 | xmlhttp.send(null); | |
207 | ||
208 | link.value = ""; | |
209 | ||
210 | } | |
211 | ||
212 | } | |
213 | ||
48f0adb0 AD |
214 | function editLabel(id) { |
215 | ||
216 | if (!xmlhttp_ready(xmlhttp)) { | |
217 | printLockingError(); | |
218 | return | |
219 | } | |
220 | ||
221 | active_label = id; | |
222 | ||
223 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" + | |
224 | param_escape(id), true); | |
225 | xmlhttp.onreadystatechange=labellist_callback; | |
226 | xmlhttp.send(null); | |
227 | ||
228 | } | |
229 | ||
a0d53889 AD |
230 | function editFilter(id) { |
231 | ||
232 | if (!xmlhttp_ready(xmlhttp)) { | |
233 | printLockingError(); | |
234 | return | |
235 | } | |
236 | ||
237 | active_filter = id; | |
238 | ||
239 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + | |
240 | param_escape(id), true); | |
241 | xmlhttp.onreadystatechange=filterlist_callback; | |
242 | xmlhttp.send(null); | |
243 | ||
244 | } | |
245 | ||
331900c6 AD |
246 | function editFeed(feed) { |
247 | ||
508a81e1 AD |
248 | // notify("Editing feed..."); |
249 | ||
c0e5a40e | 250 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
251 | printLockingError(); |
252 | return | |
253 | } | |
331900c6 | 254 | |
961513a3 AD |
255 | active_feed = feed; |
256 | ||
331900c6 AD |
257 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" + |
258 | param_escape(feed), true); | |
259 | xmlhttp.onreadystatechange=feedlist_callback; | |
260 | xmlhttp.send(null); | |
261 | ||
262 | } | |
263 | ||
48f0adb0 AD |
264 | function getSelectedLabels() { |
265 | ||
266 | var content = document.getElementById("prefLabelList"); | |
267 | ||
268 | var sel_rows = new Array(); | |
269 | ||
270 | for (i = 0; i < content.rows.length; i++) { | |
271 | if (content.rows[i].className.match("Selected")) { | |
272 | var row_id = content.rows[i].id.replace("LILRR-", ""); | |
273 | sel_rows.push(row_id); | |
274 | } | |
275 | } | |
276 | ||
277 | return sel_rows; | |
278 | } | |
279 | ||
280 | ||
a0d53889 AD |
281 | function getSelectedFilters() { |
282 | ||
283 | var content = document.getElementById("prefFilterList"); | |
284 | ||
285 | var sel_rows = new Array(); | |
286 | ||
287 | for (i = 0; i < content.rows.length; i++) { | |
288 | if (content.rows[i].className.match("Selected")) { | |
289 | var row_id = content.rows[i].id.replace("FILRR-", ""); | |
290 | sel_rows.push(row_id); | |
291 | } | |
292 | } | |
293 | ||
294 | return sel_rows; | |
295 | } | |
296 | ||
83fe4d6d | 297 | function getSelectedFeeds() { |
331900c6 AD |
298 | |
299 | var content = document.getElementById("prefFeedList"); | |
300 | ||
301 | var sel_rows = new Array(); | |
302 | ||
303 | for (i = 0; i < content.rows.length; i++) { | |
304 | if (content.rows[i].className.match("Selected")) { | |
305 | var row_id = content.rows[i].id.replace("FEEDR-", ""); | |
306 | sel_rows.push(row_id); | |
307 | } | |
308 | } | |
309 | ||
83fe4d6d AD |
310 | return sel_rows; |
311 | } | |
312 | ||
313 | function readSelectedFeeds() { | |
314 | ||
c0e5a40e | 315 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
316 | printLockingError(); |
317 | return | |
318 | } | |
319 | ||
83fe4d6d AD |
320 | var sel_rows = getSelectedFeeds(); |
321 | ||
322 | if (sel_rows.length > 0) { | |
323 | ||
324 | notify("Marking selected feeds as read..."); | |
325 | ||
0e091d38 | 326 | xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ |
83fe4d6d | 327 | param_escape(sel_rows.toString()), true); |
0e091d38 | 328 | xmlhttp.onreadystatechange=notify_callback; |
83fe4d6d AD |
329 | xmlhttp.send(null); |
330 | ||
331 | } else { | |
332 | ||
c753cd32 | 333 | notify("Please select some feeds first."); |
83fe4d6d AD |
334 | |
335 | } | |
336 | } | |
337 | ||
338 | function unreadSelectedFeeds() { | |
339 | ||
c0e5a40e | 340 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
341 | printLockingError(); |
342 | return | |
343 | } | |
344 | ||
83fe4d6d AD |
345 | var sel_rows = getSelectedFeeds(); |
346 | ||
347 | if (sel_rows.length > 0) { | |
348 | ||
349 | notify("Marking selected feeds as unread..."); | |
350 | ||
0e091d38 | 351 | xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ |
83fe4d6d | 352 | param_escape(sel_rows.toString()), true); |
0e091d38 | 353 | xmlhttp.onreadystatechange=notify_callback; |
83fe4d6d AD |
354 | xmlhttp.send(null); |
355 | ||
356 | } else { | |
357 | ||
c753cd32 | 358 | notify("Please select some feeds first."); |
83fe4d6d AD |
359 | |
360 | } | |
361 | } | |
362 | ||
48f0adb0 AD |
363 | function removeSelectedLabels() { |
364 | ||
365 | if (!xmlhttp_ready(xmlhttp)) { | |
366 | printLockingError(); | |
367 | return | |
368 | } | |
369 | ||
370 | var sel_rows = getSelectedLabels(); | |
371 | ||
372 | if (sel_rows.length > 0) { | |
373 | ||
374 | notify("Removing selected labels..."); | |
375 | ||
376 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ | |
377 | param_escape(sel_rows.toString()), true); | |
378 | xmlhttp.onreadystatechange=labellist_callback; | |
379 | xmlhttp.send(null); | |
380 | ||
381 | } else { | |
382 | notify("Please select some labels first."); | |
383 | } | |
384 | } | |
385 | ||
386 | function removeSelectedFilters() { | |
387 | ||
388 | if (!xmlhttp_ready(xmlhttp)) { | |
389 | printLockingError(); | |
390 | return | |
391 | } | |
392 | ||
393 | var sel_rows = getSelectedFilters(); | |
394 | ||
395 | if (sel_rows.length > 0) { | |
396 | ||
397 | notify("Removing selected filters..."); | |
398 | ||
399 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ | |
400 | param_escape(sel_rows.toString()), true); | |
401 | xmlhttp.onreadystatechange=filterlist_callback; | |
402 | xmlhttp.send(null); | |
403 | ||
404 | } else { | |
405 | notify("Please select some filters first."); | |
406 | } | |
407 | } | |
408 | ||
409 | ||
83fe4d6d AD |
410 | function removeSelectedFeeds() { |
411 | ||
c0e5a40e | 412 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
413 | printLockingError(); |
414 | return | |
415 | } | |
416 | ||
83fe4d6d AD |
417 | var sel_rows = getSelectedFeeds(); |
418 | ||
331900c6 AD |
419 | if (sel_rows.length > 0) { |
420 | ||
421 | notify("Removing selected feeds..."); | |
422 | ||
423 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ | |
424 | param_escape(sel_rows.toString()), true); | |
425 | xmlhttp.onreadystatechange=feedlist_callback; | |
426 | xmlhttp.send(null); | |
71ad3959 | 427 | |
71ad3959 | 428 | } else { |
331900c6 | 429 | |
c753cd32 | 430 | notify("Please select some feeds first."); |
331900c6 | 431 | |
71ad3959 AD |
432 | } |
433 | ||
434 | } | |
007bda35 | 435 | |
508a81e1 AD |
436 | function feedEditCancel() { |
437 | ||
c0e5a40e | 438 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
439 | printLockingError(); |
440 | return | |
441 | } | |
442 | ||
961513a3 AD |
443 | active_feed = false; |
444 | ||
508a81e1 AD |
445 | notify("Operation cancelled."); |
446 | ||
447 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
448 | xmlhttp.onreadystatechange=feedlist_callback; | |
449 | xmlhttp.send(null); | |
450 | ||
451 | } | |
452 | ||
603c27f8 AD |
453 | function feedEditSave() { |
454 | ||
455 | var feed = active_feed; | |
508a81e1 | 456 | |
c0e5a40e | 457 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
458 | printLockingError(); |
459 | return | |
460 | } | |
461 | ||
603c27f8 AD |
462 | var link = document.getElementById("iedit_link").value; |
463 | var title = document.getElementById("iedit_title").value; | |
d148926e | 464 | var upd_intl = document.getElementById("iedit_updintl").value; |
5d73494a | 465 | var purge_intl = document.getElementById("iedit_purgintl").value; |
508a81e1 | 466 | |
603c27f8 | 467 | // notify("Saving feed."); |
508a81e1 | 468 | |
140aae81 | 469 | /* if (upd_intl < 0) { |
d148926e AD |
470 | notify("Update interval must be >= 0 (0 = default)"); |
471 | return; | |
472 | } | |
473 | ||
5d73494a AD |
474 | if (purge_intl < 0) { |
475 | notify("Purge days must be >= 0 (0 = default)"); | |
476 | return; | |
140aae81 | 477 | } */ |
d148926e | 478 | |
508a81e1 AD |
479 | if (link.length == 0) { |
480 | notify("Feed link cannot be blank."); | |
481 | return; | |
482 | } | |
483 | ||
484 | if (title.length == 0) { | |
485 | notify("Feed title cannot be blank."); | |
486 | return; | |
487 | } | |
488 | ||
603c27f8 AD |
489 | active_feed = false; |
490 | ||
508a81e1 | 491 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" + |
d148926e | 492 | feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) + |
5d73494a | 493 | "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl), true); |
508a81e1 AD |
494 | xmlhttp.onreadystatechange=feedlist_callback; |
495 | xmlhttp.send(null); | |
496 | ||
497 | } | |
498 | ||
48f0adb0 AD |
499 | function labelEditCancel() { |
500 | ||
501 | if (!xmlhttp_ready(xmlhttp)) { | |
502 | printLockingError(); | |
503 | return | |
504 | } | |
505 | ||
506 | active_label = false; | |
507 | ||
508 | notify("Operation cancelled."); | |
509 | ||
510 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
511 | xmlhttp.onreadystatechange=labellist_callback; | |
512 | xmlhttp.send(null); | |
513 | ||
514 | } | |
515 | ||
516 | ||
a0d53889 AD |
517 | function filterEditCancel() { |
518 | ||
519 | if (!xmlhttp_ready(xmlhttp)) { | |
520 | printLockingError(); | |
521 | return | |
522 | } | |
523 | ||
524 | active_filter = false; | |
525 | ||
526 | notify("Operation cancelled."); | |
527 | ||
528 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
529 | xmlhttp.onreadystatechange=filterlist_callback; | |
530 | xmlhttp.send(null); | |
531 | ||
532 | } | |
533 | ||
48f0adb0 AD |
534 | function labelEditSave() { |
535 | ||
536 | var label = active_label; | |
537 | ||
538 | if (!xmlhttp_ready(xmlhttp)) { | |
539 | printLockingError(); | |
540 | return | |
541 | } | |
542 | ||
543 | var sqlexp = document.getElementById("iedit_expr").value; | |
544 | var descr = document.getElementById("iedit_descr").value; | |
545 | ||
546 | // notify("Saving label " + sqlexp + ": " + descr); | |
547 | ||
548 | if (sqlexp.length == 0) { | |
549 | notify("SQL expression cannot be blank."); | |
550 | return; | |
551 | } | |
552 | ||
553 | if (descr.length == 0) { | |
554 | notify("Caption cannot be blank."); | |
555 | return; | |
556 | } | |
557 | ||
558 | active_label = false; | |
559 | ||
560 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" + | |
561 | label + "&s=" + param_escape(sqlexp) + "&d=" + param_escape(descr), | |
562 | true); | |
563 | ||
564 | xmlhttp.onreadystatechange=labellist_callback; | |
565 | xmlhttp.send(null); | |
566 | ||
567 | } | |
568 | ||
a0d53889 AD |
569 | function filterEditSave() { |
570 | ||
571 | var filter = active_filter; | |
572 | ||
573 | if (!xmlhttp_ready(xmlhttp)) { | |
574 | printLockingError(); | |
575 | return | |
576 | } | |
577 | ||
578 | var regexp = document.getElementById("iedit_regexp").value; | |
579 | var descr = document.getElementById("iedit_descr").value; | |
25cb5736 AD |
580 | var match = document.getElementById("iedit_match"); |
581 | ||
582 | var v_match = match[match.selectedIndex].text; | |
a0d53889 AD |
583 | |
584 | // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match); | |
585 | ||
586 | if (regexp.length == 0) { | |
587 | notify("Filter expression cannot be blank."); | |
588 | return; | |
589 | } | |
590 | ||
591 | active_filter = false; | |
592 | ||
593 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" + | |
594 | filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) + | |
25cb5736 | 595 | "&m=" + param_escape(v_match), true); |
a0d53889 AD |
596 | |
597 | xmlhttp.onreadystatechange=filterlist_callback; | |
598 | xmlhttp.send(null); | |
599 | ||
600 | } | |
601 | ||
48f0adb0 AD |
602 | function editSelectedLabel() { |
603 | var rows = getSelectedLabels(); | |
a0d53889 | 604 | |
48f0adb0 AD |
605 | if (rows.length == 0) { |
606 | notify("No labels are selected."); | |
607 | return; | |
a0d53889 AD |
608 | } |
609 | ||
48f0adb0 AD |
610 | if (rows.length > 1) { |
611 | notify("Please select one label."); | |
612 | return; | |
613 | } | |
a0d53889 | 614 | |
48f0adb0 | 615 | editLabel(rows[0]); |
a0d53889 | 616 | |
a0d53889 AD |
617 | } |
618 | ||
619 | ||
620 | function editSelectedFilter() { | |
621 | var rows = getSelectedFilters(); | |
622 | ||
623 | if (rows.length == 0) { | |
624 | notify("No filters are selected."); | |
625 | return; | |
626 | } | |
627 | ||
628 | if (rows.length > 1) { | |
629 | notify("Please select one filter."); | |
630 | return; | |
631 | } | |
632 | ||
633 | editFilter(rows[0]); | |
634 | ||
635 | } | |
636 | ||
637 | ||
508a81e1 AD |
638 | function editSelectedFeed() { |
639 | var rows = getSelectedFeeds(); | |
640 | ||
641 | if (rows.length == 0) { | |
642 | notify("No feeds are selected."); | |
643 | return; | |
644 | } | |
645 | ||
646 | if (rows.length > 1) { | |
647 | notify("Please select one feed."); | |
648 | return; | |
649 | } | |
650 | ||
651 | editFeed(rows[0]); | |
652 | ||
653 | } | |
654 | ||
13ad9102 AD |
655 | function localPiggieFunction(enable) { |
656 | if (enable) { | |
508a81e1 AD |
657 | piggie.style.display = "block"; |
658 | seq = ""; | |
659 | notify("I loveded it!!!"); | |
660 | } else { | |
661 | piggie.style.display = "none"; | |
662 | notify(""); | |
663 | } | |
508a81e1 AD |
664 | } |
665 | ||
9f311df6 AD |
666 | function validateOpmlImport() { |
667 | ||
668 | var opml_file = document.getElementById("opml_file"); | |
669 | ||
670 | if (opml_file.value.length == 0) { | |
671 | notify("Please select OPML file to upload."); | |
672 | return false; | |
673 | } else { | |
674 | return true; | |
675 | } | |
676 | } | |
677 | ||
a0d53889 AD |
678 | function updateFilterList() { |
679 | ||
680 | if (!xmlhttp_ready(xmlhttp)) { | |
681 | printLockingError(); | |
682 | return | |
683 | } | |
684 | ||
f5a50b25 AD |
685 | // document.getElementById("prefContent").innerHTML = "Loading filters, please wait..."; |
686 | ||
687 | p_notify("Loading, please wait..."); | |
a0d53889 AD |
688 | |
689 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
690 | xmlhttp.onreadystatechange=filterlist_callback; | |
691 | xmlhttp.send(null); | |
692 | ||
693 | } | |
694 | ||
48f0adb0 AD |
695 | function updateLabelList() { |
696 | ||
697 | if (!xmlhttp_ready(xmlhttp)) { | |
698 | printLockingError(); | |
699 | return | |
700 | } | |
701 | ||
f5a50b25 AD |
702 | p_notify("Loading, please wait..."); |
703 | ||
704 | // document.getElementById("prefContent").innerHTML = "Loading labels, please wait..."; | |
48f0adb0 AD |
705 | |
706 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
707 | xmlhttp.onreadystatechange=labellist_callback; | |
708 | xmlhttp.send(null); | |
48f0adb0 AD |
709 | } |
710 | ||
f5a50b25 | 711 | function selectTab(id) { |
48f0adb0 | 712 | |
f5a50b25 | 713 | if (id == "feedConfig") { |
a0d53889 | 714 | updateFeedList(); |
f5a50b25 | 715 | } else if (id == "filterConfig") { |
a0d53889 | 716 | updateFilterList(); |
f5a50b25 | 717 | } else if (id == "labelConfig") { |
48f0adb0 | 718 | updateLabelList(); |
a0d53889 | 719 | } |
f5a50b25 AD |
720 | |
721 | var tab = document.getElementById(active_tab + "Tab"); | |
722 | ||
723 | if (tab) { | |
724 | if (tab.className.match("Selected")) { | |
725 | tab.className = "prefsTab"; | |
726 | } | |
727 | } | |
728 | ||
729 | tab = document.getElementById(id + "Tab"); | |
730 | ||
731 | if (tab) { | |
732 | if (!tab.className.match("Selected")) { | |
733 | tab.className = tab.className + "Selected"; | |
734 | } | |
735 | } | |
736 | ||
737 | active_tab = id; | |
738 | ||
a0d53889 AD |
739 | } |
740 | ||
007bda35 | 741 | function init() { |
e2ec66a8 AD |
742 | |
743 | // IE kludge | |
744 | ||
ad095c16 | 745 | if (!xmlhttp) { |
e2ec66a8 AD |
746 | document.getElementById("prefContent").innerHTML = |
747 | "<b>Fatal error:</b> This program needs XmlHttpRequest " + | |
748 | "to function properly. Your browser doesn't seem to support it."; | |
749 | return; | |
750 | } | |
751 | ||
f5a50b25 AD |
752 | selectTab("feedConfig"); |
753 | ||
508a81e1 | 754 | document.onkeydown = hotkey_handler; |
857a9270 AD |
755 | notify(""); |
756 | ||
007bda35 | 757 | } |