3 var active_feed = false;
4 var active_feed_cat = false;
5 var active_filter = false;
6 var active_label = false;
7 var active_user = false;
8 var active_tab = false;
9 var feed_to_expand = false;
11 var piggie_top = -400;
12 var piggie_fwd = true;
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.
19 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
22 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
29 if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
30 xmlhttp = new XMLHttpRequest();
33 function expand_feed_callback() {
34 if (xmlhttp.readyState == 4) {
36 var container = document.getElementById("BRDET-" + feed_to_expand);
37 container.innerHTML=xmlhttp.responseText;
38 container.style.display = "block";
41 exception_error("expand_feed_callback", e);
46 function feedlist_callback() {
47 if (xmlhttp.readyState == 4) {
49 var container = document.getElementById('prefContent');
50 container.innerHTML=xmlhttp.responseText;
51 selectTab("feedConfig", true);
54 var row = document.getElementById("FEEDR-" + active_feed);
56 if (!row.className.match("Selected")) {
57 row.className = row.className + "Selected";
60 var checkbox = document.getElementById("FRCHK-" + active_feed);
62 checkbox.checked = true;
67 exception_error("feedlist_callback", e);
72 function filterlist_callback() {
73 var container = document.getElementById('prefContent');
74 if (xmlhttp.readyState == 4) {
76 container.innerHTML=xmlhttp.responseText;
79 var row = document.getElementById("FILRR-" + active_filter);
81 if (!row.className.match("Selected")) {
82 row.className = row.className + "Selected";
85 var checkbox = document.getElementById("FICHK-" + active_filter);
88 checkbox.checked = true;
95 function labellist_callback() {
96 var container = document.getElementById('prefContent');
97 if (xmlhttp.readyState == 4) {
98 container.innerHTML=xmlhttp.responseText;
101 var row = document.getElementById("LILRR-" + active_label);
103 if (!row.className.match("Selected")) {
104 row.className = row.className + "Selected";
107 var checkbox = document.getElementById("LICHK-" + active_label);
110 checkbox.checked = true;
117 function feed_browser_callback() {
118 var container = document.getElementById('prefContent');
119 if (xmlhttp.readyState == 4) {
120 container.innerHTML=xmlhttp.responseText;
125 function userlist_callback() {
126 var container = document.getElementById('prefContent');
127 if (xmlhttp.readyState == 4) {
128 container.innerHTML=xmlhttp.responseText;
131 var row = document.getElementById("UMRR-" + active_user);
133 if (!row.className.match("Selected")) {
134 row.className = row.className + "Selected";
137 var checkbox = document.getElementById("UMCHK-" + active_user);
140 checkbox.checked = true;
148 function infobox_callback() {
149 if (xmlhttp.readyState == 4) {
150 var box = document.getElementById('infoBox');
151 var shadow = document.getElementById('infoBoxShadow');
154 box.innerHTML=xmlhttp.responseText;
156 shadow.style.display = "block";
158 box.style.display = "block";
165 function prefslist_callback() {
166 var container = document.getElementById('prefContent');
167 if (xmlhttp.readyState == 4) {
169 container.innerHTML=xmlhttp.responseText;
175 function gethelp_callback() {
176 var container = document.getElementById('prefHelpBox');
177 if (xmlhttp.readyState == 4) {
179 container.innerHTML = xmlhttp.responseText;
180 container.style.display = "block";
186 function notify_callback() {
187 var container = document.getElementById('notify');
188 if (xmlhttp.readyState == 4) {
189 container.innerHTML=xmlhttp.responseText;
193 function updateFeedList(sort_key) {
195 if (!xmlhttp_ready(xmlhttp)) {
200 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
202 p_notify("Loading, please wait...");
204 var feed_search = document.getElementById("feed_search");
206 if (feed_search) { search = feed_search.value; }
208 xmlhttp.open("GET", "backend.php?op=pref-feeds" +
209 "&sort=" + param_escape(sort_key) +
210 "&search=" + param_escape(search), true);
211 xmlhttp.onreadystatechange=feedlist_callback;
216 function updateUsersList() {
218 if (!xmlhttp_ready(xmlhttp)) {
223 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
225 p_notify("Loading, please wait...");
227 xmlhttp.open("GET", "backend.php?op=pref-users", true);
228 xmlhttp.onreadystatechange=userlist_callback;
233 function addLabel() {
235 if (!xmlhttp_ready(xmlhttp)) {
240 var sqlexp = document.getElementById("ladd_expr");
242 if (sqlexp.value.length == 0) {
243 notify("Missing SQL expression.");
245 notify("Adding label...");
247 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
248 param_escape(sqlexp.value), true);
250 xmlhttp.onreadystatechange=labellist_callback;
258 function addFilter() {
260 if (!xmlhttp_ready(xmlhttp)) {
265 var regexp = document.getElementById("fadd_regexp");
266 var match = document.getElementById("fadd_match");
267 var feed = document.getElementById("fadd_feed");
268 var action = document.getElementById("fadd_action");
270 if (regexp.value.length == 0) {
271 notify("Missing filter expression.");
273 notify("Adding filter...");
275 var v_match = match[match.selectedIndex].text;
276 var feed_id = feed[feed.selectedIndex].id;
277 var action_id = action[action.selectedIndex].id;
279 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
280 param_escape(regexp.value) + "&match=" + v_match +
281 "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
283 xmlhttp.onreadystatechange=filterlist_callback;
293 if (!xmlhttp_ready(xmlhttp)) {
298 var link = document.getElementById("fadd_link");
300 if (link.value.length == 0) {
301 notify("Missing feed URL.");
303 notify("Adding feed...");
305 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
306 param_escape(link.value), true);
307 xmlhttp.onreadystatechange=feedlist_callback;
316 function addFeedCat() {
318 if (!xmlhttp_ready(xmlhttp)) {
323 var cat = document.getElementById("fadd_cat");
325 if (cat.value.length == 0) {
326 notify("Missing feed category.");
328 notify("Adding feed category...");
330 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
331 param_escape(cat.value), true);
332 xmlhttp.onreadystatechange=feedlist_callback;
342 if (!xmlhttp_ready(xmlhttp)) {
347 var sqlexp = document.getElementById("uadd_box");
349 if (sqlexp.value.length == 0) {
350 notify("Missing user login.");
352 notify("Adding user...");
354 xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" +
355 param_escape(sqlexp.value), true);
357 xmlhttp.onreadystatechange=userlist_callback;
365 function editLabel(id) {
367 if (!xmlhttp_ready(xmlhttp)) {
374 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
375 param_escape(id), true);
376 xmlhttp.onreadystatechange=labellist_callback;
381 function editUser(id) {
383 if (!xmlhttp_ready(xmlhttp)) {
390 xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
391 param_escape(id), true);
392 xmlhttp.onreadystatechange=userlist_callback;
397 function editFilter(id) {
399 if (!xmlhttp_ready(xmlhttp)) {
406 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
407 param_escape(id), true);
408 xmlhttp.onreadystatechange=filterlist_callback;
413 function editFeed(feed) {
415 // notify("Editing feed...");
417 if (!xmlhttp_ready(xmlhttp)) {
424 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
425 param_escape(feed), true);
426 xmlhttp.onreadystatechange=feedlist_callback;
427 xmlhttp.send(null); */
429 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
430 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
433 selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
435 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
436 param_escape(active_feed), true);
438 xmlhttp.onreadystatechange=infobox_callback;
443 function editFeedCat(cat) {
445 if (!xmlhttp_ready(xmlhttp)) {
450 active_feed_cat = cat;
452 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
453 param_escape(cat), true);
454 xmlhttp.onreadystatechange=feedlist_callback;
459 function getSelectedLabels() {
460 return getSelectedTableRowIds("prefLabelList", "LILRR");
463 function getSelectedUsers() {
464 return getSelectedTableRowIds("prefUserList", "UMRR");
467 function getSelectedFeeds() {
468 return getSelectedTableRowIds("prefFeedList", "FEEDR");
471 function getSelectedFilters() {
472 return getSelectedTableRowIds("prefFilterList", "FILRR");
475 function getSelectedFeedCats() {
476 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
480 function readSelectedFeeds(read) {
482 if (!xmlhttp_ready(xmlhttp)) {
487 var sel_rows = getSelectedFeeds();
489 if (sel_rows.length > 0) {
497 notify("Marking selected feeds as " + op + "...");
499 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
500 param_escape(sel_rows.toString()), true);
501 xmlhttp.onreadystatechange=notify_callback;
506 notify("Please select some feeds first.");
511 function removeSelectedLabels() {
513 if (!xmlhttp_ready(xmlhttp)) {
518 var sel_rows = getSelectedLabels();
520 if (sel_rows.length > 0) {
522 var ok = confirm("Remove selected labels?");
525 notify("Removing selected labels...");
527 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
528 param_escape(sel_rows.toString()), true);
529 xmlhttp.onreadystatechange=labellist_callback;
533 notify("Please select some labels first.");
537 function removeSelectedUsers() {
539 if (!xmlhttp_ready(xmlhttp)) {
544 var sel_rows = getSelectedUsers();
546 if (sel_rows.length > 0) {
548 var ok = confirm("Remove selected users?");
551 notify("Removing selected users...");
553 xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
554 param_escape(sel_rows.toString()), true);
555 xmlhttp.onreadystatechange=userlist_callback;
560 notify("Please select some labels first.");
564 function removeSelectedFilters() {
566 if (!xmlhttp_ready(xmlhttp)) {
571 var sel_rows = getSelectedFilters();
573 if (sel_rows.length > 0) {
575 var ok = confirm("Remove selected filters?");
578 notify("Removing selected filters...");
580 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
581 param_escape(sel_rows.toString()), true);
582 xmlhttp.onreadystatechange=filterlist_callback;
586 notify("Please select some filters first.");
591 function removeSelectedFeeds() {
593 if (!xmlhttp_ready(xmlhttp)) {
598 var sel_rows = getSelectedFeeds();
600 if (sel_rows.length > 0) {
602 var ok = confirm("Remove selected feeds?");
606 notify("Removing selected feeds...");
608 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
609 param_escape(sel_rows.toString()), true);
610 xmlhttp.onreadystatechange=feedlist_callback;
616 notify("Please select some feeds first.");
622 function removeSelectedFeedCats() {
624 if (!xmlhttp_ready(xmlhttp)) {
629 var sel_rows = getSelectedFeedCats();
631 if (sel_rows.length > 0) {
633 var ok = confirm("Remove selected categories?");
636 notify("Removing selected categories...");
638 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
639 param_escape(sel_rows.toString()), true);
640 xmlhttp.onreadystatechange=feedlist_callback;
646 notify("Please select some feeds first.");
652 function feedEditCancel() {
654 if (!xmlhttp_ready(xmlhttp)) {
663 notify("Operation cancelled.");
665 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
666 xmlhttp.onreadystatechange=feedlist_callback;
667 xmlhttp.send(null); */
671 function feedCatEditCancel() {
673 if (!xmlhttp_ready(xmlhttp)) {
678 active_feed_cat = false;
680 notify("Operation cancelled.");
682 xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
683 xmlhttp.onreadystatechange=feedlist_callback;
688 function feedEditSave() {
692 var feed = active_feed;
694 if (!xmlhttp_ready(xmlhttp)) {
699 var link = document.getElementById("iedit_link").value;
700 var title = document.getElementById("iedit_title").value;
701 var upd_intl = document.getElementById("iedit_updintl").value;
702 var purge_intl = document.getElementById("iedit_purgintl").value;
703 var fcat = document.getElementById("iedit_fcat");
705 var is_pvt = document.getElementById("iedit_private");
708 is_pvt = is_pvt.checked;
714 fcat_id = fcat[fcat.selectedIndex].id;
717 var pfeed = document.getElementById("iedit_parent_feed");
718 var parent_feed_id = pfeed[pfeed.selectedIndex].id;
720 if (link.length == 0) {
721 notify("Feed link cannot be blank.");
725 if (title.length == 0) {
726 notify("Feed title cannot be blank.");
730 var auth_login = document.getElementById("iedit_login").value;
731 var auth_pass = document.getElementById("iedit_pass").value;
735 notify("Saving feed...");
737 var query = "op=pref-feeds&subop=editSave&id=" +
738 feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
739 "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
740 "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
741 "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) +
742 "&is_pvt=" + param_escape(is_pvt);
744 xmlhttp.open("POST", "backend.php", true);
745 xmlhttp.onreadystatechange=feedlist_callback;
746 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
750 exception_error("feedEditSave", e);
754 function feedCatEditSave() {
756 if (!xmlhttp_ready(xmlhttp)) {
761 notify("Saving category...");
763 var cat_title = document.getElementById("iedit_title").value;
765 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
766 param_escape(active_feed_cat) + "&title=" + param_escape(cat_title),
768 xmlhttp.onreadystatechange=feedlist_callback;
771 active_feed_cat = false;
776 function labelTest() {
778 var sqlexp = document.getElementById("iedit_expr").value;
779 var descr = document.getElementById("iedit_descr").value;
781 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
782 param_escape(sqlexp) + "&descr=" + param_escape(descr), true);
784 xmlhttp.onreadystatechange=infobox_callback;
789 function displayHelpInfobox(topic_id) {
791 xmlhttp.open("GET", "backend.php?op=help&tid=" +
792 param_escape(topic_id) + "&noheaders=1", true);
794 xmlhttp.onreadystatechange=infobox_callback;
799 function labelEditCancel() {
801 if (!xmlhttp_ready(xmlhttp)) {
806 active_label = false;
808 notify("Operation cancelled.");
810 xmlhttp.open("GET", "backend.php?op=pref-labels", true);
811 xmlhttp.onreadystatechange=labellist_callback;
816 function userEditCancel() {
818 if (!xmlhttp_ready(xmlhttp)) {
825 notify("Operation cancelled.");
827 xmlhttp.open("GET", "backend.php?op=pref-users", true);
828 xmlhttp.onreadystatechange=userlist_callback;
833 function filterEditCancel() {
835 if (!xmlhttp_ready(xmlhttp)) {
840 active_filter = false;
842 notify("Operation cancelled.");
844 xmlhttp.open("GET", "backend.php?op=pref-filters", true);
845 xmlhttp.onreadystatechange=filterlist_callback;
850 function labelEditSave() {
852 var label = active_label;
854 if (!xmlhttp_ready(xmlhttp)) {
859 var sqlexp = document.getElementById("iedit_expr").value;
860 var descr = document.getElementById("iedit_descr").value;
862 // notify("Saving label " + sqlexp + ": " + descr);
864 if (sqlexp.length == 0) {
865 notify("SQL expression cannot be blank.");
869 if (descr.length == 0) {
870 notify("Caption cannot be blank.");
874 notify("Saving label...");
876 active_label = false;
878 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
879 label + "&s=" + param_escape(sqlexp) + "&d=" + param_escape(descr),
882 xmlhttp.onreadystatechange=labellist_callback;
887 function userEditSave() {
889 var user = active_user;
891 if (!xmlhttp_ready(xmlhttp)) {
896 var login = document.getElementById("iedit_ulogin").value;
897 var level = document.getElementById("iedit_ulevel").value;
898 var email = document.getElementById("iedit_email").value;
900 if (login.length == 0) {
901 notify("Login cannot be blank.");
905 if (level.length == 0) {
906 notify("User level cannot be blank.");
912 notify("Saving user...");
914 xmlhttp.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
915 user + "&l=" + param_escape(login) + "&al=" + param_escape(level) +
916 "&e=" + param_escape(email), true);
918 xmlhttp.onreadystatechange=userlist_callback;
924 function filterEditSave() {
926 var filter = active_filter;
928 if (!xmlhttp_ready(xmlhttp)) {
933 var regexp = document.getElementById("iedit_regexp").value;
934 var descr = document.getElementById("iedit_descr").value;
935 var match = document.getElementById("iedit_match");
937 var v_match = match[match.selectedIndex].text;
939 var feed = document.getElementById("iedit_feed");
940 var feed_id = feed[feed.selectedIndex].id;
942 var action = document.getElementById("iedit_filter_action");
943 var action_id = action[action.selectedIndex].id;
945 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
947 if (regexp.length == 0) {
948 notify("Filter expression cannot be blank.");
952 active_filter = false;
954 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
955 filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) +
956 "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id) +
957 "&aid=" + param_escape(action_id), true);
959 notify("Saving filter...");
961 xmlhttp.onreadystatechange=filterlist_callback;
966 function editSelectedLabel() {
967 var rows = getSelectedLabels();
969 if (rows.length == 0) {
970 notify("No labels are selected.");
974 if (rows.length > 1) {
975 notify("Please select one label.");
985 function editSelectedUser() {
986 var rows = getSelectedUsers();
988 if (rows.length == 0) {
989 notify("No users are selected.");
993 if (rows.length > 1) {
994 notify("Please select one user.");
1003 function resetSelectedUserPass() {
1004 var rows = getSelectedUsers();
1006 if (rows.length == 0) {
1007 notify("No users are selected.");
1011 if (rows.length > 1) {
1012 notify("Please select one user.");
1016 var ok = confirm("Reset password of selected user?");
1019 notify("Resetting password for selected user...");
1023 xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1024 param_escape(id), true);
1025 xmlhttp.onreadystatechange=userlist_callback;
1030 function selectedUserDetails() {
1032 if (!xmlhttp_ready(xmlhttp)) {
1033 printLockingError();
1037 var rows = getSelectedUsers();
1039 if (rows.length == 0) {
1040 notify("No users are selected.");
1044 if (rows.length > 1) {
1045 notify("Please select one user.");
1053 xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true);
1054 xmlhttp.onreadystatechange=infobox_callback;
1059 function selectedFeedDetails() {
1061 if (!xmlhttp_ready(xmlhttp)) {
1062 printLockingError();
1066 var rows = getSelectedFeeds();
1068 if (rows.length == 0) {
1069 notify("No feeds are selected.");
1073 // if (rows.length > 1) {
1074 // notify("Please select one feed.");
1078 // var id = rows[0];
1082 xmlhttp.open("GET", "backend.php?op=feed-details&id=" +
1083 param_escape(rows.toString()), true);
1084 xmlhttp.onreadystatechange=infobox_callback;
1089 function editSelectedFilter() {
1090 var rows = getSelectedFilters();
1092 if (rows.length == 0) {
1093 notify("No filters are selected.");
1097 if (rows.length > 1) {
1098 notify("Please select one filter.");
1104 editFilter(rows[0]);
1109 function editSelectedFeed() {
1110 var rows = getSelectedFeeds();
1112 if (rows.length == 0) {
1113 notify("No feeds are selected.");
1117 if (rows.length > 1) {
1118 notify("Please select one feed.");
1128 function editSelectedFeedCat() {
1129 var rows = getSelectedFeedCats();
1131 if (rows.length == 0) {
1132 notify("No categories are selected.");
1136 if (rows.length > 1) {
1137 notify("Please select one category.");
1143 editFeedCat(rows[0]);
1147 function piggie_callback() {
1148 var piggie = document.getElementById("piggie");
1150 piggie.style.top = piggie_top;
1151 piggie.style.backgroundColor = "white";
1152 piggie.style.borderWidth = "1px";
1154 if (piggie_fwd && piggie_top < 0) {
1155 setTimeout("piggie_callback()", 50);
1156 piggie_top = piggie_top + 10;
1157 } else if (piggie_fwd && piggie_top >= 0) {
1159 setTimeout("piggie_callback()", 50);
1160 } else if (!piggie_fwd && piggie_top > -400) {
1161 setTimeout("piggie_callback()", 50);
1162 piggie_top = piggie_top - 10;
1163 } else if (!piggie_fwd && piggie_top <= -400) {
1164 piggie.style.display = "none";
1169 var piggie_opacity = 0;
1171 function piggie2_callback() {
1172 var piggie = document.getElementById("piggie");
1173 piggie.style.top = 0;
1174 piggie.style.opacity = piggie_opacity;
1175 piggie.style.backgroundColor = "transparent";
1176 piggie.style.borderWidth = "0px";
1178 if (piggie_fwd && piggie_opacity < 1) {
1179 setTimeout("piggie2_callback()", 50);
1180 piggie_opacity = piggie_opacity + 0.03;
1181 } else if (piggie_fwd && piggie_opacity >= 1) {
1183 setTimeout("piggie2_callback()", 50);
1184 } else if (!piggie_fwd && piggie_opacity > 0) {
1185 setTimeout("piggie2_callback()", 50);
1186 piggie_opacity = piggie_opacity - 0.03;
1187 } else if (!piggie_fwd && piggie_opacity <= 0) {
1188 piggie.style.display = "none";
1193 function localPiggieFunction(enable) {
1195 var piggie = document.getElementById("piggie");
1196 piggie.style.display = "block";
1198 if (navigator.userAgent.match("Firefox") && Math.random(1) > 0.5) {
1206 function validateOpmlImport() {
1208 var opml_file = document.getElementById("opml_file");
1210 if (opml_file.value.length == 0) {
1211 notify("Please select OPML file to upload.");
1218 function updateFilterList() {
1220 if (!xmlhttp_ready(xmlhttp)) {
1221 printLockingError();
1225 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1227 p_notify("Loading, please wait...");
1229 xmlhttp.open("GET", "backend.php?op=pref-filters", true);
1230 xmlhttp.onreadystatechange=filterlist_callback;
1235 function updateLabelList() {
1237 if (!xmlhttp_ready(xmlhttp)) {
1238 printLockingError();
1242 p_notify("Loading, please wait...");
1244 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1246 xmlhttp.open("GET", "backend.php?op=pref-labels", true);
1247 xmlhttp.onreadystatechange=labellist_callback;
1251 function updatePrefsList() {
1253 if (!xmlhttp_ready(xmlhttp)) {
1254 printLockingError();
1258 p_notify("Loading, please wait...");
1260 xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
1261 xmlhttp.onreadystatechange=prefslist_callback;
1266 function selectTab(id, noupdate) {
1270 if (!xmlhttp_ready(xmlhttp)) {
1271 printLockingError();
1277 if (id == "feedConfig") {
1279 } else if (id == "filterConfig") {
1281 } else if (id == "labelConfig") {
1283 } else if (id == "genConfig") {
1285 } else if (id == "userConfig") {
1287 } else if (id == "feedBrowser") {
1288 updateBigFeedBrowser();
1292 var tab = document.getElementById(active_tab + "Tab");
1295 if (tab.className.match("Selected")) {
1296 tab.className = "prefsTab";
1300 tab = document.getElementById(id + "Tab");
1303 if (!tab.className.match("Selected")) {
1304 tab.className = tab.className + "Selected";
1310 setCookie('ttrss_pref_acttab', active_tab);
1318 if (arguments.callee.done) return;
1319 arguments.callee.done = true;
1323 document.getElementById("prefContent").innerHTML =
1324 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1325 "to function properly. Your browser doesn't seem to support it.";
1329 active_tab = getCookie("ttrss_pref_acttab");
1330 if (!active_tab) active_tab = "genConfig";
1331 selectTab(active_tab);
1333 document.onkeydown = hotkey_handler;
1336 exception_error("init", e);
1340 function closeInfoBox() {
1341 var box = document.getElementById('infoBox');
1342 var shadow = document.getElementById('infoBoxShadow');
1345 shadow.style.display = "none";
1347 box.style.display = "none";
1351 function categorizeSelectedFeeds() {
1353 if (!xmlhttp_ready(xmlhttp)) {
1354 printLockingError();
1358 var sel_rows = getSelectedFeeds();
1360 var cat_sel = document.getElementById("sfeed_set_fcat");
1361 var cat_id = cat_sel[cat_sel.selectedIndex].id;
1363 if (sel_rows.length > 0) {
1365 notify("Changing category of selected feeds...");
1367 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1368 param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);
1369 xmlhttp.onreadystatechange=feedlist_callback;
1374 notify("Please select some feeds first.");
1380 function validatePrefsReset() {
1381 return confirm("Reset to defaults?");
1384 function browseFeeds() {
1386 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1387 xmlhttp.onreadystatechange=infobox_callback;
1392 function feedBrowserSubscribe() {
1394 var list = document.getElementById("browseFeedList");
1396 if (!list) list = document.getElementById("browseBigFeedList");
1398 var selected = new Array();
1400 for (i = 0; i < list.childNodes.length; i++) {
1401 var child = list.childNodes[i];
1402 if (child.id && child.id.match("FBROW-")) {
1403 var id = child.id.replace("FBROW-", "");
1405 var cb = document.getElementById("FBCHK-" + id);
1413 if (selected.length > 0) {
1415 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1416 param_escape(selected.toString()), true);
1417 xmlhttp.onreadystatechange=feedlist_callback;
1420 alert("No feeds are selected.");
1424 exception_error("feedBrowserSubscribe", e);
1428 function updateBigFeedBrowser() {
1430 if (!xmlhttp_ready(xmlhttp)) {
1431 printLockingError();
1435 p_notify("Loading, please wait...");
1437 xmlhttp.open("GET", "backend.php?op=pref-feed-browser", true);
1438 xmlhttp.onreadystatechange=feed_browser_callback;
1443 function browserToggleExpand(id) {
1445 /* if (feed_to_expand && feed_to_expand != id) {
1446 var d = document.getElementById("BRDET-" + feed_to_expand);
1447 d.style.display = "none";
1450 var d = document.getElementById("BRDET-" + id);
1452 if (d.style.display == "block") {
1453 d.style.display = "none";
1457 feed_to_expand = id;
1459 xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1460 + param_escape(id), true);
1461 xmlhttp.onreadystatechange=expand_feed_callback;
1466 exception_error("browserExpand", e);