]> git.wh0rd.org - tt-rss.git/blame - prefs.js
notice/warning style updates
[tt-rss.git] / prefs.js
CommitLineData
007bda35
AD
1var xmlhttp = false;
2
91ff844a 3var active_feed_cat = false;
48f0adb0 4var active_label = false;
f5a50b25 5var active_tab = false;
c6232e43 6var feed_to_expand = false;
f5a50b25 7
1cac3c31
AD
8var piggie_top = -400;
9var piggie_fwd = true;
10
a58069db 11var xmlhttp = Ajax.getTransport();
007bda35 12
a7565293
AD
13var init_params = new Array();
14
c6232e43
AD
15function expand_feed_callback() {
16 if (xmlhttp.readyState == 4) {
17 try {
18 var container = document.getElementById("BRDET-" + feed_to_expand);
19 container.innerHTML=xmlhttp.responseText;
20 container.style.display = "block";
4d4200a8 21// p_notify("");
c6232e43
AD
22 } catch (e) {
23 exception_error("expand_feed_callback", e);
24 }
25 }
26}
27
007bda35 28function feedlist_callback() {
007bda35 29 if (xmlhttp.readyState == 4) {
47c6c988
AD
30 try {
31 var container = document.getElementById('prefContent');
32 container.innerHTML=xmlhttp.responseText;
a7f22b70
AD
33 selectTab("feedConfig", true);
34
3c5783b7
AD
35 if (active_feed_cat) {
36 var row = document.getElementById("FCATR-" + active_feed_cat);
47c6c988
AD
37 if (row) {
38 if (!row.className.match("Selected")) {
39 row.className = row.className + "Selected";
40 }
41 }
3c5783b7 42 var checkbox = document.getElementById("FCCHK-" + active_feed_cat);
47c6c988
AD
43 if (checkbox) {
44 checkbox.checked = true;
45 }
961513a3 46 }
3c5783b7 47
7f74a9da 48 notify("");
47c6c988
AD
49 } catch (e) {
50 exception_error("feedlist_callback", e);
961513a3 51 }
007bda35
AD
52 }
53}
54
a0d53889 55function filterlist_callback() {
f5a50b25 56 var container = document.getElementById('prefContent');
a0d53889
AD
57 if (xmlhttp.readyState == 4) {
58 container.innerHTML=xmlhttp.responseText;
7f74a9da 59 notify("");
a0d53889
AD
60 }
61}
62
48f0adb0 63function labellist_callback() {
f5a50b25 64 var container = document.getElementById('prefContent');
48f0adb0 65 if (xmlhttp.readyState == 4) {
f156fd00 66 closeInfoBox();
48f0adb0 67 container.innerHTML=xmlhttp.responseText;
967955b7 68 if (active_label) {
48f0adb0
AD
69 var row = document.getElementById("LILRR-" + active_label);
70 if (row) {
71 if (!row.className.match("Selected")) {
72 row.className = row.className + "Selected";
73 }
74 }
75 var checkbox = document.getElementById("LICHK-" + active_label);
76
77 if (checkbox) {
78 checkbox.checked = true;
79 }
80 }
7f74a9da 81 notify("");
48f0adb0
AD
82 }
83}
4255b24c 84
a4dbc524
AD
85function labeltest_callback() {
86 var container = document.getElementById('label_test_result');
87 if (xmlhttp.readyState == 4) {
88 container.innerHTML=xmlhttp.responseText;
89 notify("");
90 }
91}
92
c6232e43
AD
93function feed_browser_callback() {
94 var container = document.getElementById('prefContent');
95 if (xmlhttp.readyState == 4) {
96 container.innerHTML=xmlhttp.responseText;
7f74a9da 97 notify("");
c6232e43
AD
98 }
99}
100
e6cb77a0
AD
101function userlist_callback() {
102 var container = document.getElementById('prefContent');
103 if (xmlhttp.readyState == 4) {
104 container.innerHTML=xmlhttp.responseText;
7f74a9da 105 notify("");
e6cb77a0
AD
106 }
107}
108
4255b24c
AD
109function prefslist_callback() {
110 var container = document.getElementById('prefContent');
111 if (xmlhttp.readyState == 4) {
112
113 container.innerHTML=xmlhttp.responseText;
7f74a9da
AD
114
115 notify("");
4255b24c
AD
116 }
117}
118
b1895692
AD
119function gethelp_callback() {
120 var container = document.getElementById('prefHelpBox');
121 if (xmlhttp.readyState == 4) {
122
123 container.innerHTML = xmlhttp.responseText;
124 container.style.display = "block";
125
126 }
127}
4255b24c
AD
128
129
0e091d38
AD
130function notify_callback() {
131 var container = document.getElementById('notify');
132 if (xmlhttp.readyState == 4) {
133 container.innerHTML=xmlhttp.responseText;
134 }
135}
136
b83c7545 137function updateFeedList(sort_key) {
007bda35 138
c0e5a40e 139 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
140 printLockingError();
141 return
142 }
143
f5a50b25
AD
144// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
145
ce3bf408 146// p_notify("Loading, please wait...");
007bda35 147
f932bc9f
AD
148 var feed_search = document.getElementById("feed_search");
149 var search = "";
150 if (feed_search) { search = feed_search.value; }
151
b83c7545 152 xmlhttp.open("GET", "backend.php?op=pref-feeds" +
f932bc9f
AD
153 "&sort=" + param_escape(sort_key) +
154 "&search=" + param_escape(search), true);
007bda35
AD
155 xmlhttp.onreadystatechange=feedlist_callback;
156 xmlhttp.send(null);
157
158}
159
79ec0f2f 160function updateUsersList(sort_key) {
e6cb77a0
AD
161
162 if (!xmlhttp_ready(xmlhttp)) {
163 printLockingError();
164 return
165 }
166
167// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
168
ce3bf408 169// p_notify("Loading, please wait...");
e6cb77a0 170
79ec0f2f
AD
171 xmlhttp.open("GET", "backend.php?op=pref-users&sort="
172 + param_escape(sort_key), true);
e6cb77a0
AD
173 xmlhttp.onreadystatechange=userlist_callback;
174 xmlhttp.send(null);
175
176}
177
48f0adb0
AD
178function addLabel() {
179
180 if (!xmlhttp_ready(xmlhttp)) {
181 printLockingError();
182 return
183 }
184
f156fd00 185 var form = document.forms['label_edit_form'];
48f0adb0 186
f156fd00
AD
187 var sql_exp = form.sql_exp.value;
188 var description = form.description.value;
48f0adb0 189
f156fd00
AD
190 if (sql_exp == "") {
191 alert("Can't create label: missing SQL expression.");
192 return false;
48f0adb0
AD
193 }
194
f156fd00
AD
195 if (description == "") {
196 alert("Can't create label: missing caption.");
197 return false;
de435974
AD
198 }
199
f156fd00 200 var query = Form.serialize("label_edit_form");
de435974 201
f156fd00
AD
202 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);
203 xmlhttp.onreadystatechange=infobox_submit_callback;
204 xmlhttp.send(null);
de435974 205}
48f0adb0 206
71ad3959
AD
207function addFeed() {
208
c0e5a40e 209 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
210 printLockingError();
211 return
212 }
213
331900c6
AD
214 var link = document.getElementById("fadd_link");
215
83fe4d6d 216 if (link.value.length == 0) {
0ceded7a 217 alert("Error: No feed URL given.");
605f7d46 218 } else if (!isValidURL(link.value)) {
2371c520 219 alert("Error: Invalid feed URL.");
331900c6
AD
220 } else {
221 notify("Adding feed...");
222
07eb9178 223 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&feed_url=" +
331900c6
AD
224 param_escape(link.value), true);
225 xmlhttp.onreadystatechange=feedlist_callback;
226 xmlhttp.send(null);
227
228 link.value = "";
229
230 }
231
232}
233
91ff844a
AD
234function addFeedCat() {
235
236 if (!xmlhttp_ready(xmlhttp)) {
237 printLockingError();
238 return
239 }
240
241 var cat = document.getElementById("fadd_cat");
242
243 if (cat.value.length == 0) {
01b3e191 244 alert("Can't add category: no name specified.");
91ff844a
AD
245 } else {
246 notify("Adding feed category...");
247
248 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
249 param_escape(cat.value), true);
250 xmlhttp.onreadystatechange=feedlist_callback;
251 xmlhttp.send(null);
252
253 link.value = "";
254
255 }
256
257}
e6cb77a0
AD
258function addUser() {
259
260 if (!xmlhttp_ready(xmlhttp)) {
261 printLockingError();
262 return
263 }
264
265 var sqlexp = document.getElementById("uadd_box");
266
267 if (sqlexp.value.length == 0) {
01b3e191 268 alert("Can't add user: no login specified.");
e6cb77a0
AD
269 } else {
270 notify("Adding user...");
271
272 xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" +
273 param_escape(sqlexp.value), true);
274
275 xmlhttp.onreadystatechange=userlist_callback;
276 xmlhttp.send(null);
277
278 sqlexp.value = "";
279 }
280
281}
282
48f0adb0
AD
283function editLabel(id) {
284
285 if (!xmlhttp_ready(xmlhttp)) {
286 printLockingError();
287 return
288 }
289
f156fd00
AD
290 document.getElementById("label_create_btn").disabled = true;
291
48f0adb0
AD
292 active_label = id;
293
a4dbc524
AD
294 selectTableRowsByIdPrefix('prefLabelList', 'LILRR-', 'LICHK-', false);
295 selectTableRowById('LILRR-'+id, 'LICHK-'+id, true);
296
48f0adb0
AD
297 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
298 param_escape(id), true);
a4dbc524 299 xmlhttp.onreadystatechange=infobox_callback;
48f0adb0
AD
300 xmlhttp.send(null);
301
302}
303
e6cb77a0
AD
304function editUser(id) {
305
306 if (!xmlhttp_ready(xmlhttp)) {
307 printLockingError();
308 return
309 }
310
3c5783b7
AD
311 selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
312 selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true);
e6cb77a0
AD
313
314 xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
315 param_escape(id), true);
3c5783b7 316 xmlhttp.onreadystatechange=infobox_callback;
e6cb77a0
AD
317 xmlhttp.send(null);
318
319}
320
a0d53889
AD
321function editFilter(id) {
322
323 if (!xmlhttp_ready(xmlhttp)) {
324 printLockingError();
325 return
326 }
327
4220b0bd
AD
328 document.getElementById("create_filter_btn").disabled = true;
329
07164479
AD
330 selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
331 selectTableRowById('FILRR-'+id, 'FICHK-'+id, true);
a0d53889 332
07164479
AD
333 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id), true);
334 xmlhttp.onreadystatechange=infobox_callback;
a0d53889 335 xmlhttp.send(null);
a0d53889
AD
336}
337
331900c6
AD
338function editFeed(feed) {
339
508a81e1
AD
340// notify("Editing feed...");
341
c0e5a40e 342 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
343 printLockingError();
344 return
345 }
331900c6 346
673d54ca 347 // clean selection from all rows & select row being edited
0ea4fb50 348 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
6c12c809 349 selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
0ea4fb50
AD
350
351 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
3c5783b7 352 param_escape(feed), true);
0ea4fb50
AD
353
354 xmlhttp.onreadystatechange=infobox_callback;
331900c6
AD
355 xmlhttp.send(null);
356
357}
358
91ff844a 359function editFeedCat(cat) {
48f0adb0 360
91ff844a
AD
361 if (!xmlhttp_ready(xmlhttp)) {
362 printLockingError();
363 return
48f0adb0
AD
364 }
365
91ff844a 366 active_feed_cat = cat;
e6cb77a0 367
91ff844a
AD
368 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
369 param_escape(cat), true);
370 xmlhttp.onreadystatechange=feedlist_callback;
371 xmlhttp.send(null);
e6cb77a0 372
e6cb77a0
AD
373}
374
91ff844a
AD
375function getSelectedLabels() {
376 return getSelectedTableRowIds("prefLabelList", "LILRR");
377}
48f0adb0 378
91ff844a
AD
379function getSelectedUsers() {
380 return getSelectedTableRowIds("prefUserList", "UMRR");
a0d53889
AD
381}
382
83fe4d6d 383function getSelectedFeeds() {
91ff844a
AD
384 return getSelectedTableRowIds("prefFeedList", "FEEDR");
385}
331900c6 386
91ff844a
AD
387function getSelectedFilters() {
388 return getSelectedTableRowIds("prefFilterList", "FILRR");
389}
331900c6 390
91ff844a
AD
391function getSelectedFeedCats() {
392 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
83fe4d6d
AD
393}
394
c0ae0fdb
AD
395function getSelectedFeedsFromBrowser() {
396
397 var list = document.getElementById("browseFeedList");
398 if (!list) list = document.getElementById("browseBigFeedList");
399
400 var selected = new Array();
401
402 for (i = 0; i < list.childNodes.length; i++) {
403 var child = list.childNodes[i];
404 if (child.id && child.id.match("FBROW-")) {
405 var id = child.id.replace("FBROW-", "");
406
407 var cb = document.getElementById("FBCHK-" + id);
408
409 if (cb.checked) {
410 selected.push(id);
411 }
412 }
413 }
414
415 return selected;
416}
417
48f0adb0
AD
418function removeSelectedLabels() {
419
420 if (!xmlhttp_ready(xmlhttp)) {
421 printLockingError();
422 return
423 }
424
425 var sel_rows = getSelectedLabels();
426
427 if (sel_rows.length > 0) {
428
69668465 429 var ok = confirm("Remove selected labels?");
48f0adb0 430
69668465
AD
431 if (ok) {
432 notify("Removing selected labels...");
433
434 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
435 param_escape(sel_rows.toString()), true);
436 xmlhttp.onreadystatechange=labellist_callback;
437 xmlhttp.send(null);
438 }
48f0adb0 439 } else {
01b3e191 440 alert("No labels are selected.");
48f0adb0 441 }
90ac84df
AD
442
443 return false;
48f0adb0
AD
444}
445
e6cb77a0
AD
446function removeSelectedUsers() {
447
448 if (!xmlhttp_ready(xmlhttp)) {
449 printLockingError();
450 return
451 }
452
453 var sel_rows = getSelectedUsers();
454
455 if (sel_rows.length > 0) {
456
69668465 457 var ok = confirm("Remove selected users?");
e6cb77a0 458
69668465
AD
459 if (ok) {
460 notify("Removing selected users...");
461
462 xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
463 param_escape(sel_rows.toString()), true);
464 xmlhttp.onreadystatechange=userlist_callback;
465 xmlhttp.send(null);
466 }
e6cb77a0
AD
467
468 } else {
01b3e191 469 alert("No users are selected.");
e6cb77a0 470 }
90ac84df
AD
471
472 return false;
e6cb77a0
AD
473}
474
48f0adb0
AD
475function removeSelectedFilters() {
476
477 if (!xmlhttp_ready(xmlhttp)) {
478 printLockingError();
479 return
480 }
481
482 var sel_rows = getSelectedFilters();
483
484 if (sel_rows.length > 0) {
485
69668465 486 var ok = confirm("Remove selected filters?");
48f0adb0 487
69668465
AD
488 if (ok) {
489 notify("Removing selected filters...");
490
491 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
492 param_escape(sel_rows.toString()), true);
493 xmlhttp.onreadystatechange=filterlist_callback;
494 xmlhttp.send(null);
495 }
48f0adb0 496 } else {
01b3e191 497 alert("No filters are selected.");
48f0adb0 498 }
90ac84df
AD
499
500 return false;
48f0adb0
AD
501}
502
503
83fe4d6d
AD
504function removeSelectedFeeds() {
505
c0e5a40e 506 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
507 printLockingError();
508 return
509 }
510
83fe4d6d
AD
511 var sel_rows = getSelectedFeeds();
512
331900c6
AD
513 if (sel_rows.length > 0) {
514
1d7bf5a0 515 var ok = confirm("Unsubscribe from selected feeds?");
331900c6 516
69668465
AD
517 if (ok) {
518
1d7bf5a0 519 notify("Unsubscribing from selected feeds...");
69668465
AD
520
521 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
522 param_escape(sel_rows.toString()), true);
523 xmlhttp.onreadystatechange=feedlist_callback;
524 xmlhttp.send(null);
525 }
71ad3959 526
71ad3959 527 } else {
331900c6 528
01b3e191 529 alert("No feeds are selected.");
331900c6 530
71ad3959 531 }
90ac84df
AD
532
533 return false;
71ad3959 534}
007bda35 535
91ff844a
AD
536function removeSelectedFeedCats() {
537
538 if (!xmlhttp_ready(xmlhttp)) {
539 printLockingError();
540 return
541 }
542
543 var sel_rows = getSelectedFeedCats();
544
545 if (sel_rows.length > 0) {
546
69668465 547 var ok = confirm("Remove selected categories?");
91ff844a 548
69668465
AD
549 if (ok) {
550 notify("Removing selected categories...");
551
552 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
553 param_escape(sel_rows.toString()), true);
554 xmlhttp.onreadystatechange=feedlist_callback;
555 xmlhttp.send(null);
556 }
91ff844a
AD
557
558 } else {
559
01b3e191 560 alert("No categories are selected.");
91ff844a
AD
561
562 }
563
90ac84df 564 return false;
91ff844a
AD
565}
566
508a81e1
AD
567function feedEditCancel() {
568
c0e5a40e 569 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
570 printLockingError();
571 return
572 }
573
327a3bbe
AD
574 closeInfoBox();
575
673d54ca 576 selectPrefRows('feed', false); // cleanup feed selection
508a81e1 577
90ac84df 578 return false;
508a81e1
AD
579}
580
91ff844a
AD
581function feedCatEditCancel() {
582
583 if (!xmlhttp_ready(xmlhttp)) {
584 printLockingError();
585 return
586 }
587
588 active_feed_cat = false;
589
0ceded7a 590// notify("Operation cancelled.");
91ff844a
AD
591
592 xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
593 xmlhttp.onreadystatechange=feedlist_callback;
594 xmlhttp.send(null);
595
90ac84df 596 return false;
91ff844a
AD
597}
598
603c27f8
AD
599function feedEditSave() {
600
47c6c988 601 try {
47c6c988
AD
602
603 if (!xmlhttp_ready(xmlhttp)) {
604 printLockingError();
605 return
606 }
ad815c71 607
14f69488 608 // FIXME: add parameter validation
e3c99f3b 609
14f69488 610 var query = Form.serialize("edit_feed_form");
b0da3a7b 611
14f69488 612 notify("Saving feed...");
673d54ca 613
47c6c988
AD
614 xmlhttp.open("POST", "backend.php", true);
615 xmlhttp.onreadystatechange=feedlist_callback;
616 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
14f69488
AD
617 xmlhttp.send(query);
618
59a543f0
AD
619 closeInfoBox();
620
c14b5566
AD
621 return false;
622
47c6c988
AD
623 } catch (e) {
624 exception_error("feedEditSave", e);
b0da3a7b 625 }
508a81e1
AD
626}
627
5ddadb4c
AD
628function feedCatEditSave() {
629
630 if (!xmlhttp_ready(xmlhttp)) {
631 printLockingError();
632 return
633 }
634
f0e81ffe 635 notify("Saving category...");
5ddadb4c 636
0666e120
AD
637 var query = Form.serialize("feed_cat_edit_form");
638
639 xmlhttp.open("GET", "backend.php?" + query, true);
5ddadb4c
AD
640 xmlhttp.onreadystatechange=feedlist_callback;
641 xmlhttp.send(null);
642
643 active_feed_cat = false;
644
90ac84df 645 return false;
5ddadb4c
AD
646}
647
648
d9dde1d6
AD
649function labelTest() {
650
a4dbc524
AD
651 var container = document.getElementById('label_test_result');
652 container.style.display = "block";
653 container.innerHTML = "<p>Loading, please wait...</p>";
654
f3120e5a
AD
655 var form = document.forms['label_edit_form'];
656
657 var sql_exp = form.sql_exp.value;
658 var description = form.description.value;
d9dde1d6
AD
659
660 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
f3120e5a 661 param_escape(sql_exp) + "&descr=" + param_escape(description), true);
d9dde1d6 662
a4dbc524 663 xmlhttp.onreadystatechange=labeltest_callback;
d9dde1d6
AD
664 xmlhttp.send(null);
665
90ac84df 666 return false;
d9dde1d6
AD
667}
668
01c9c74a
AD
669function displayHelpInfobox(topic_id) {
670
671 xmlhttp.open("GET", "backend.php?op=help&tid=" +
672 param_escape(topic_id) + "&noheaders=1", true);
673
674 xmlhttp.onreadystatechange=infobox_callback;
675 xmlhttp.send(null);
676
677}
678
48f0adb0
AD
679function labelEditCancel() {
680
681 if (!xmlhttp_ready(xmlhttp)) {
682 printLockingError();
683 return
684 }
685
f156fd00
AD
686 document.getElementById("label_create_btn").disabled = false;
687
48f0adb0
AD
688 active_label = false;
689
a4dbc524 690 selectPrefRows('label', false); // cleanup feed selection
50bad812
AD
691 closeInfoBox();
692
90ac84df 693 return false;
48f0adb0
AD
694}
695
e6cb77a0
AD
696function userEditCancel() {
697
698 if (!xmlhttp_ready(xmlhttp)) {
699 printLockingError();
700 return
701 }
702
3c5783b7 703 selectPrefRows('user', false); // cleanup feed selection
3c5783b7 704 closeInfoBox();
90ac84df
AD
705
706 return false;
e6cb77a0 707}
48f0adb0 708
a0d53889
AD
709function filterEditCancel() {
710
711 if (!xmlhttp_ready(xmlhttp)) {
712 printLockingError();
713 return
714 }
4220b0bd
AD
715
716 document.getElementById("create_filter_btn").disabled = false;
07164479
AD
717
718 selectPrefRows('filter', false); // cleanup feed selection
719 closeInfoBox();
90ac84df
AD
720
721 return false;
a0d53889
AD
722}
723
48f0adb0
AD
724function labelEditSave() {
725
726 var label = active_label;
727
728 if (!xmlhttp_ready(xmlhttp)) {
729 printLockingError();
730 return
731 }
732
9ee3ac59 733/* if (!is_opera()) {
48f0adb0 734
7c620da8
AD
735 var sql_exp = document.forms["label_edit_form"].sql_exp.value;
736 var description = document.forms["label_edit_form"].description.value;
737
738 if (sql_exp.length == 0) {
739 alert("SQL Expression cannot be blank.");
740 return false;
741 }
742
743 if (description.length == 0) {
744 alert("Caption field cannot be blank.");
745 return false;
746 }
9ee3ac59 747 } */
48f0adb0 748
50bad812
AD
749 closeInfoBox();
750
f0e81ffe 751 notify("Saving label...");
dbd9e2f1 752
48f0adb0
AD
753 active_label = false;
754
f3120e5a
AD
755 query = Form.serialize("label_edit_form");
756
50bad812 757 xmlhttp.open("GET", "backend.php?" + query, true);
48f0adb0
AD
758 xmlhttp.onreadystatechange=labellist_callback;
759 xmlhttp.send(null);
760
90ac84df 761 return false;
48f0adb0
AD
762}
763
e6cb77a0
AD
764function userEditSave() {
765
e6cb77a0
AD
766 if (!xmlhttp_ready(xmlhttp)) {
767 printLockingError();
768 return
769 }
770
3c5783b7 771 var login = document.forms["user_edit_form"].login.value;
e6cb77a0
AD
772
773 if (login.length == 0) {
3c5783b7 774 alert("Login field cannot be blank.");
e6cb77a0
AD
775 return;
776 }
3c5783b7 777
f0e81ffe 778 notify("Saving user...");
4220b0bd
AD
779
780 closeInfoBox();
781
3c5783b7
AD
782 var query = Form.serialize("user_edit_form");
783
784 xmlhttp.open("GET", "backend.php?" + query, true);
dbd9e2f1 785 xmlhttp.onreadystatechange=userlist_callback;
e6cb77a0 786 xmlhttp.send(null);
90ac84df
AD
787
788 return false;
e6cb77a0
AD
789}
790
791
a0d53889
AD
792function filterEditSave() {
793
a0d53889
AD
794 if (!xmlhttp_ready(xmlhttp)) {
795 printLockingError();
796 return
797 }
798
9ee3ac59 799/* if (!is_opera()) {
7c620da8
AD
800 var reg_exp = document.forms["filter_edit_form"].reg_exp.value;
801
802 if (reg_exp.length == 0) {
803 alert("Filter expression field cannot be blank.");
804 return;
805 }
9ee3ac59 806 } */
a0d53889 807
7e939457 808 notify("Saving filter...");
a0d53889 809
7e939457 810 var query = Form.serialize("filter_edit_form");
dbd9e2f1 811
07164479
AD
812 closeInfoBox();
813
4220b0bd
AD
814 document.getElementById("create_filter_btn").disabled = false;
815
7e939457 816 xmlhttp.open("GET", "backend.php?" + query, true);
a0d53889 817 xmlhttp.onreadystatechange=filterlist_callback;
7e939457 818 xmlhttp.send(null);
a0d53889 819
90ac84df 820 return false;
a0d53889
AD
821}
822
48f0adb0
AD
823function editSelectedLabel() {
824 var rows = getSelectedLabels();
a0d53889 825
48f0adb0 826 if (rows.length == 0) {
01b3e191 827 alert("No labels are selected.");
48f0adb0 828 return;
a0d53889
AD
829 }
830
48f0adb0 831 if (rows.length > 1) {
01b3e191 832 alert("Please select only one label.");
48f0adb0
AD
833 return;
834 }
a0d53889 835
dbd9e2f1
AD
836 notify("");
837
48f0adb0 838 editLabel(rows[0]);
a0d53889 839
a0d53889
AD
840}
841
e6cb77a0
AD
842function editSelectedUser() {
843 var rows = getSelectedUsers();
844
845 if (rows.length == 0) {
01b3e191 846 alert("No users are selected.");
e6cb77a0
AD
847 return;
848 }
849
850 if (rows.length > 1) {
01b3e191 851 alert("Please select only one user.");
e6cb77a0
AD
852 return;
853 }
854
dbd9e2f1
AD
855 notify("");
856
e6cb77a0
AD
857 editUser(rows[0]);
858}
859
860function resetSelectedUserPass() {
861 var rows = getSelectedUsers();
862
863 if (rows.length == 0) {
01b3e191 864 alert("No users are selected.");
e6cb77a0
AD
865 return;
866 }
867
868 if (rows.length > 1) {
01b3e191 869 alert("Please select only one user.");
e6cb77a0
AD
870 return;
871 }
872
69668465 873 var ok = confirm("Reset password of selected user?");
e6cb77a0 874
69668465
AD
875 if (ok) {
876 notify("Resetting password for selected user...");
877
878 var id = rows[0];
879
880 xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
881 param_escape(id), true);
882 xmlhttp.onreadystatechange=userlist_callback;
883 xmlhttp.send(null);
884 }
e6cb77a0
AD
885}
886
717f5e64 887function selectedUserDetails() {
e6cb77a0 888
1a7572cb
AD
889 if (!xmlhttp_ready(xmlhttp)) {
890 printLockingError();
891 return
892 }
893
717f5e64
AD
894 var rows = getSelectedUsers();
895
896 if (rows.length == 0) {
01b3e191 897 alert("No users are selected.");
717f5e64
AD
898 return;
899 }
900
901 if (rows.length > 1) {
01b3e191 902 alert("Please select only one user.");
717f5e64
AD
903 return;
904 }
905
906 var id = rows[0];
907
dbd9e2f1
AD
908 notify("");
909
1a7572cb 910 xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true);
c6c3a07f
AD
911 xmlhttp.onreadystatechange=infobox_callback;
912 xmlhttp.send(null);
913
914}
915
916function selectedFeedDetails() {
917
918 if (!xmlhttp_ready(xmlhttp)) {
919 printLockingError();
920 return
921 }
922
923 var rows = getSelectedFeeds();
924
925 if (rows.length == 0) {
01b3e191 926 alert("No feeds are selected.");
c6c3a07f
AD
927 return;
928 }
929
01b3e191
AD
930 if (rows.length > 1) {
931 notify("Please select only one feed.");
932 return;
933 }
c6c3a07f 934
df268d47 935// var id = rows[0];
c6c3a07f 936
dbd9e2f1
AD
937 notify("");
938
df268d47
AD
939 xmlhttp.open("GET", "backend.php?op=feed-details&id=" +
940 param_escape(rows.toString()), true);
c6c3a07f 941 xmlhttp.onreadystatechange=infobox_callback;
1a7572cb 942 xmlhttp.send(null);
717f5e64
AD
943
944}
a0d53889
AD
945
946function editSelectedFilter() {
947 var rows = getSelectedFilters();
948
949 if (rows.length == 0) {
01b3e191 950 alert("No filters are selected.");
a0d53889
AD
951 return;
952 }
953
954 if (rows.length > 1) {
01b3e191 955 alert("Please select only one filter.");
a0d53889
AD
956 return;
957 }
958
dbd9e2f1
AD
959 notify("");
960
a0d53889
AD
961 editFilter(rows[0]);
962
963}
964
965
508a81e1
AD
966function editSelectedFeed() {
967 var rows = getSelectedFeeds();
968
969 if (rows.length == 0) {
970 notify("No feeds are selected.");
971 return;
972 }
973
974 if (rows.length > 1) {
975 notify("Please select one feed.");
976 return;
977 }
978
dbd9e2f1
AD
979 notify("");
980
508a81e1 981 editFeed(rows[0]);
91ff844a
AD
982
983}
984
985function editSelectedFeedCat() {
986 var rows = getSelectedFeedCats();
987
988 if (rows.length == 0) {
01b3e191 989 alert("No categories are selected.");
91ff844a
AD
990 return;
991 }
992
993 if (rows.length > 1) {
01b3e191 994 alert("Please select only one category.");
91ff844a
AD
995 return;
996 }
997
998 notify("");
999
1000 editFeedCat(rows[0]);
508a81e1
AD
1001
1002}
1003
1cac3c31
AD
1004function piggie_callback() {
1005 var piggie = document.getElementById("piggie");
1006
1007 piggie.style.top = piggie_top;
e0b6a737
AD
1008 piggie.style.backgroundColor = "white";
1009 piggie.style.borderWidth = "1px";
1cac3c31
AD
1010
1011 if (piggie_fwd && piggie_top < 0) {
1012 setTimeout("piggie_callback()", 50);
1013 piggie_top = piggie_top + 10;
1014 } else if (piggie_fwd && piggie_top >= 0) {
1015 piggie_fwd = false;
1016 setTimeout("piggie_callback()", 50);
1017 } else if (!piggie_fwd && piggie_top > -400) {
1018 setTimeout("piggie_callback()", 50);
1019 piggie_top = piggie_top - 10;
1020 } else if (!piggie_fwd && piggie_top <= -400) {
1021 piggie.style.display = "none";
1022 piggie_fwd = true;
1023 }
1024}
1025
33377ef3
AD
1026var piggie_opacity = 0;
1027
1028function piggie2_callback() {
1029 var piggie = document.getElementById("piggie");
1030 piggie.style.top = 0;
1031 piggie.style.opacity = piggie_opacity;
e0b6a737
AD
1032 piggie.style.backgroundColor = "transparent";
1033 piggie.style.borderWidth = "0px";
33377ef3
AD
1034
1035 if (piggie_fwd && piggie_opacity < 1) {
1036 setTimeout("piggie2_callback()", 50);
1037 piggie_opacity = piggie_opacity + 0.03;
1038 } else if (piggie_fwd && piggie_opacity >= 1) {
1039 piggie_fwd = false;
1040 setTimeout("piggie2_callback()", 50);
1041 } else if (!piggie_fwd && piggie_opacity > 0) {
1042 setTimeout("piggie2_callback()", 50);
1043 piggie_opacity = piggie_opacity - 0.03;
1044 } else if (!piggie_fwd && piggie_opacity <= 0) {
1045 piggie.style.display = "none";
1046 piggie_fwd = true;
1047 }
1048}
1049
13ad9102
AD
1050function localPiggieFunction(enable) {
1051 if (enable) {
d437c8cf 1052 debug("I LOVEDED IT!");
1cac3c31 1053 var piggie = document.getElementById("piggie");
508a81e1 1054 piggie.style.display = "block";
33377ef3 1055
292a8a12 1056 if (navigator.userAgent.match("Gecko") && Math.random(1) > 0.5) {
33377ef3
AD
1057 piggie2_callback();
1058 } else {
1059 piggie_callback();
1060 }
508a81e1 1061 }
508a81e1
AD
1062}
1063
9f311df6
AD
1064function validateOpmlImport() {
1065
1066 var opml_file = document.getElementById("opml_file");
1067
1068 if (opml_file.value.length == 0) {
01b3e191 1069 alert("No OPML file to upload.");
9f311df6
AD
1070 return false;
1071 } else {
1072 return true;
1073 }
1074}
1075
0e317f9d 1076function updateFilterList(sort_key) {
a0d53889
AD
1077
1078 if (!xmlhttp_ready(xmlhttp)) {
1079 printLockingError();
1080 return
1081 }
1082
f5a50b25
AD
1083// document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1084
ce3bf408 1085// p_notify("Loading, please wait...");
a0d53889 1086
e161a2cc
AD
1087 xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" +
1088 param_escape(sort_key), true);
a0d53889
AD
1089 xmlhttp.onreadystatechange=filterlist_callback;
1090 xmlhttp.send(null);
1091
1092}
1093
e161a2cc 1094function updateLabelList(sort_key) {
48f0adb0
AD
1095
1096 if (!xmlhttp_ready(xmlhttp)) {
1097 printLockingError();
1098 return
1099 }
1100
ce3bf408 1101// p_notify("Loading, please wait...");
f5a50b25
AD
1102
1103// document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
48f0adb0 1104
e161a2cc
AD
1105 xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" +
1106 param_escape(sort_key), true);
48f0adb0
AD
1107 xmlhttp.onreadystatechange=labellist_callback;
1108 xmlhttp.send(null);
48f0adb0
AD
1109}
1110
4255b24c
AD
1111function updatePrefsList() {
1112
1113 if (!xmlhttp_ready(xmlhttp)) {
1114 printLockingError();
1115 return
1116 }
1117
ce3bf408 1118// p_notify("Loading, please wait...");
4255b24c
AD
1119
1120 xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
1121 xmlhttp.onreadystatechange=prefslist_callback;
1122 xmlhttp.send(null);
1123
1124}
1125
a7f22b70
AD
1126function selectTab(id, noupdate) {
1127
1128// alert(id);
48f0adb0 1129
b2caf812 1130 if (!id) id = active_tab;
7f74a9da 1131
b2caf812 1132 try {
59a543f0 1133
b2caf812
AD
1134 if (!xmlhttp_ready(xmlhttp)) {
1135 printLockingError();
1136 return
a7f22b70 1137 }
f5a50b25 1138
b2caf812 1139 if (!noupdate) {
f5a50b25 1140
b2caf812
AD
1141 debug("selectTab: " + id + "(NU: " + noupdate + ")");
1142
95322e12 1143// notify("Loading, please wait...", true);
b2caf812
AD
1144
1145 // close active infobox if needed
1146 closeInfoBox();
1147
1148 // clean up all current selections, just in case
1149 active_feed_cat = false;
1150 active_label = false;
1151
1152 if (id == "feedConfig") {
1153 updateFeedList();
1154 } else if (id == "filterConfig") {
1155 updateFilterList();
1156 } else if (id == "labelConfig") {
1157 updateLabelList();
1158 } else if (id == "genConfig") {
1159 updatePrefsList();
1160 } else if (id == "userConfig") {
1161 updateUsersList();
1162 } else if (id == "feedBrowser") {
1163 updateBigFeedBrowser();
1164 }
f5a50b25 1165 }
b2caf812
AD
1166
1167 var tab = document.getElementById(active_tab + "Tab");
1168
1169 if (tab) {
1170 if (tab.className.match("Selected")) {
1171 tab.className = "prefsTab";
1172 }
f5a50b25 1173 }
b2caf812
AD
1174
1175 tab = document.getElementById(id + "Tab");
1176
1177 if (tab) {
1178 if (!tab.className.match("Selected")) {
1179 tab.className = tab.className + "Selected";
1180 }
1181 }
1182
1183 if (active_tab != id) {
1184 storeInitParam("prefs_active_tab", id);
1185 }
1186
1187 active_tab = id;
f5a50b25 1188
b2caf812
AD
1189 } catch (e) {
1190 exception_error("selectTab", e);
a7565293 1191 }
a7565293
AD
1192}
1193
1194function backend_sanity_check_callback() {
f5a50b25 1195
a7565293
AD
1196 if (xmlhttp.readyState == 4) {
1197
1198 try {
1199
1200 if (!xmlhttp.responseXML) {
1201 fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText);
1202 return;
1203 }
1204
1205 var reply = xmlhttp.responseXML.firstChild.firstChild;
1206
1207 if (!reply) {
1208 fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText);
1209 return;
1210 }
1211
1212 var error_code = reply.getAttribute("error-code");
1213
1214 if (error_code && error_code != 0) {
1215 return fatalError(error_code, reply.getAttribute("error-msg"));
1216 }
1217
1218 debug("sanity check ok");
1219
1220 var params = reply.nextSibling;
1221
1222 if (params) {
1223 debug('reading init-params...');
1224 var param = params.firstChild;
1225
1226 while (param) {
1227 var k = param.getAttribute("key");
1228 var v = param.getAttribute("value");
1229 debug(k + " => " + v);
1230 init_params[k] = v;
1231 param = param.nextSibling;
1232 }
1233 }
1234
1235 init_second_stage();
1236
1237 } catch (e) {
1238 exception_error("backend_sanity_check_callback", e);
1239 }
1240 }
1241}
1242
1243function init_second_stage() {
1244
b2caf812
AD
1245 try {
1246 active_tab = getInitParam("prefs_active_tab");
1247 if (!active_tab) active_tab = "genConfig";
4da47970 1248
d437c8cf
AD
1249 document.onkeydown = pref_hotkey_handler;
1250
b2caf812
AD
1251 if (navigator.userAgent.match("Opera")) {
1252 setTimeout("selectTab()", 500);
1253 } else {
1254 selectTab(active_tab);
1255 }
1256 notify("");
1257 } catch (e) {
1258 exception_error("init_second_stage", e);
1259 }
a0d53889
AD
1260}
1261
007bda35 1262function init() {
e2ec66a8 1263
7719618b
AD
1264 try {
1265
97dcd654
AD
1266 if (arguments.callee.done) return;
1267 arguments.callee.done = true;
1268
a7565293
AD
1269 if (getURLParam('debug')) {
1270 document.getElementById('debug_output').style.display = 'block';
1271 debug('debug mode activated');
1272 }
1273
7719618b
AD
1274 // IE kludge
1275 if (!xmlhttp) {
1276 document.getElementById("prefContent").innerHTML =
1277 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1278 "to function properly. Your browser doesn't seem to support it.";
1279 return;
1280 }
4da47970 1281
a7565293
AD
1282 xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck", true);
1283 xmlhttp.onreadystatechange=backend_sanity_check_callback;
1284 xmlhttp.send(null);
1285
7719618b
AD
1286 } catch (e) {
1287 exception_error("init", e);
e2ec66a8 1288 }
007bda35 1289}
b1895692 1290
f932bc9f
AD
1291function categorizeSelectedFeeds() {
1292
1293 if (!xmlhttp_ready(xmlhttp)) {
1294 printLockingError();
1295 return
1296 }
1297
1298 var sel_rows = getSelectedFeeds();
1299
1300 var cat_sel = document.getElementById("sfeed_set_fcat");
79f3553b 1301 var cat_id = cat_sel[cat_sel.selectedIndex].value;
f932bc9f
AD
1302
1303 if (sel_rows.length > 0) {
1304
1305 notify("Changing category of selected feeds...");
1306
1307 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1308 param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);
1309 xmlhttp.onreadystatechange=feedlist_callback;
1310 xmlhttp.send(null);
1311
1312 } else {
1313
01b3e191 1314 alert("No feeds are selected.");
f932bc9f
AD
1315
1316 }
1317
1318}
69668465
AD
1319
1320function validatePrefsReset() {
1321 return confirm("Reset to defaults?");
1322}
f9cb39ac 1323
6311acbe 1324function browseFeeds(limit) {
f9cb39ac
AD
1325
1326 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1327 xmlhttp.onreadystatechange=infobox_callback;
1328 xmlhttp.send(null);
1329
1330}
a0476535
AD
1331
1332function feedBrowserSubscribe() {
1333 try {
a0476535 1334
c0ae0fdb 1335 var selected = getSelectedFeedsFromBrowser();
a0476535
AD
1336
1337 if (selected.length > 0) {
1338 closeInfoBox();
1339 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1340 param_escape(selected.toString()), true);
1341 xmlhttp.onreadystatechange=feedlist_callback;
1342 xmlhttp.send(null);
1343 } else {
1344 alert("No feeds are selected.");
1345 }
1346
1347 } catch (e) {
1348 exception_error("feedBrowserSubscribe", e);
1349 }
1350}
c6232e43 1351
6311acbe 1352function updateBigFeedBrowser(limit) {
c6232e43
AD
1353
1354 if (!xmlhttp_ready(xmlhttp)) {
1355 printLockingError();
1356 return
1357 }
1358
ce3bf408 1359// p_notify("Loading, please wait...");
c6232e43 1360
6311acbe
AD
1361 var query = "backend.php?op=pref-feed-browser";
1362
1363 var limit_sel = document.getElementById("feedBrowserLimit");
1364
1365 if (limit_sel) {
1366 var limit = limit_sel[limit_sel.selectedIndex].value;
1367 query = query + "&limit=" + param_escape(limit);
1368 }
1369
1370 xmlhttp.open("GET", query, true);
c6232e43
AD
1371 xmlhttp.onreadystatechange=feed_browser_callback;
1372 xmlhttp.send(null);
c6232e43
AD
1373}
1374
c2b2aee0 1375function browserToggleExpand(id) {
c6232e43
AD
1376 try {
1377/* if (feed_to_expand && feed_to_expand != id) {
1378 var d = document.getElementById("BRDET-" + feed_to_expand);
1379 d.style.display = "none";
1380 } */
c2b2aee0 1381
ff725e9b
AD
1382 if (!xmlhttp_ready(xmlhttp)) {
1383 printLockingError();
1384 return
1385 }
1386
c2b2aee0
AD
1387 var d = document.getElementById("BRDET-" + id);
1388
1389 if (d.style.display == "block") {
1390 d.style.display = "none";
1391
1392 } else {
c6232e43 1393
c2b2aee0 1394 feed_to_expand = id;
c6232e43 1395
ff725e9b
AD
1396 d.style.display = "block";
1397 d.innerHTML = "Loading, please wait...";
1398
c2b2aee0
AD
1399 xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1400 + param_escape(id), true);
1401 xmlhttp.onreadystatechange=expand_feed_callback;
1402 xmlhttp.send(null);
1403 }
c6232e43
AD
1404
1405 } catch (e) {
1406 exception_error("browserExpand", e);
1407 }
1408}
64dc5976
AD
1409
1410function validateNewPassword(form) {
1411 if (form.OLD_PASSWORD.value == "") {
88103301 1412 alert("Old password cannot be blank");
64dc5976
AD
1413 return false;
1414 }
1415 if (form.NEW_PASSWORD.value == "") {
1416 alert("New password cannot be blank");
1417 return false;
1418 }
1419 return true;
1420}
ce3bf408
AD
1421
1422function selectPrefRows(kind, select) {
1423
1424 if (kind) {
1425 var opbarid = false;
1426 var nchk = false;
1427 var nrow = false;
1428 var lname = false;
1429
1430 if (kind == "feed") {
1431 opbarid = "feedOpToolbar";
1432 nrow = "FEEDR-";
1433 nchk = "FRCHK-";
1434 lname = "prefFeedList";
1435 } else if (kind == "fcat") {
1436 opbarid = "catOpToolbar";
1437 nrow = "FCATR-";
1438 nchk = "FCHK-";
1439 lname = "prefFeedCatList";
1440 } else if (kind == "filter") {
1441 opbarid = "filterOpToolbar";
1442 nrow = "FILRR-";
1443 nchk = "FICHK-";
1444 lname = "prefFilterList";
1445 } else if (kind == "label") {
1446 opbarid = "labelOpToolbar";
1447 nrow = "LILRR-";
a4dbc524 1448 nchk = "LICHK-";
ce3bf408
AD
1449 lname = "prefLabelList";
1450 } else if (kind == "user") {
1451 opbarid = "userOpToolbar";
1452 nrow = "UMRR-";
1453 nchk = "UMCHK-";
1454 lname = "prefUserList";
1455 }
1456
1457 if (opbarid) {
1458 selectTableRowsByIdPrefix(lname, nrow, nchk, select);
1459 disableContainerChildren(opbarid, !select);
1460 }
1461
1462 }
1463}
1464
1465
1466function toggleSelectPrefRow(sender, kind) {
1467
1468 toggleSelectRow(sender);
1469
1470 if (kind) {
1471 var opbarid = false;
1472 var nsel = -1;
1473
1474 if (kind == "feed") {
1475 opbarid = "feedOpToolbar";
1476 nsel = getSelectedFeeds();
1477 } else if (kind == "fcat") {
1478 opbarid = "catOpToolbar";
1479 nsel = getSelectedFeedCats();
1480 } else if (kind == "filter") {
1481 opbarid = "filterOpToolbar";
1482 nsel = getSelectedFilters();
1483 } else if (kind == "label") {
1484 opbarid = "labelOpToolbar";
1485 nsel = getSelectedLabels();
1486 } else if (kind == "user") {
1487 opbarid = "userOpToolbar";
1488 nsel = getSelectedUsers();
1489 }
1490
1491 if (opbarid && nsel != -1) {
1492 disableContainerChildren(opbarid, nsel == false);
1493 }
1494
1495 }
1496}
1497
c0ae0fdb
AD
1498function toggleSelectFBListRow(sender) {
1499 toggleSelectListRow(sender);
1500 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);
1501}
d437c8cf
AD
1502
1503var seq = "";
1504
1505function pref_hotkey_handler(e) {
1506 try {
1507
1508 var keycode;
1509
1510 if (!hotkeys_enabled) return;
1511
1512 if (window.event) {
1513 keycode = window.event.keyCode;
1514 } else if (e) {
1515 keycode = e.which;
1516 }
1517
1518 if (keycode == 13 || keycode == 27) {
1519 seq = "";
1520 } else {
1521 seq = seq + "" + keycode;
1522 }
1523
1524
1525 if (document.getElementById("piggie")) {
1526
1527 if (seq.match("807371717369")) {
1528 seq = "";
1529 localPiggieFunction(true);
1530 } else {
1531 localPiggieFunction(false);
1532 }
1533 }
1534
1535 } catch (e) {
1536 exception_error("pref_hotkey_handler", e);
1537 }
1538}
1539
23c2a4e7
AD
1540function userSwitch() {
1541 var chooser = document.getElementById("userSwitch");
1542 var user = chooser[chooser.selectedIndex].value;
1543 window.location = "prefs.php?swu=" + user;
1544}