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