]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
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;
12 /*@if (@_jscript_version >= 5)
13 // JScript gives us Conditional compilation, we can cope with old IE versions.
14 // and security blocked creation of the objects.
16 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
19 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
26 if (!xmlhttp
&& typeof XMLHttpRequest
!='undefined') {
27 xmlhttp
= new XMLHttpRequest();
30 function expand_feed_callback() {
31 if (xmlhttp
.readyState
== 4) {
33 var container
= document
.getElementById("BRDET-" + feed_to_expand
);
34 container
.innerHTML
=xmlhttp
.responseText
;
35 container
.style
.display
= "block";
38 exception_error("expand_feed_callback", e
);
43 function feedlist_callback() {
44 if (xmlhttp
.readyState
== 4) {
46 var container
= document
.getElementById('prefContent');
47 container
.innerHTML
=xmlhttp
.responseText
;
48 selectTab("feedConfig", true);
51 var row
= document
.getElementById("FEEDR-" + active_feed
);
53 if (!row
.className
.match("Selected")) {
54 row
.className
= row
.className
+ "Selected";
57 var checkbox
= document
.getElementById("FRCHK-" + active_feed
);
59 checkbox
.checked
= true;
64 exception_error("feedlist_callback", e
);
69 function filterlist_callback() {
70 var container
= document
.getElementById('prefContent');
71 if (xmlhttp
.readyState
== 4) {
73 container
.innerHTML
=xmlhttp
.responseText
;
76 var row
= document
.getElementById("FILRR-" + active_filter
);
78 if (!row
.className
.match("Selected")) {
79 row
.className
= row
.className
+ "Selected";
82 var checkbox
= document
.getElementById("FICHK-" + active_filter
);
85 checkbox
.checked
= true;
92 function labellist_callback() {
93 var container
= document
.getElementById('prefContent');
94 if (xmlhttp
.readyState
== 4) {
95 container
.innerHTML
=xmlhttp
.responseText
;
98 var row
= document
.getElementById("LILRR-" + active_label
);
100 if (!row
.className
.match("Selected")) {
101 row
.className
= row
.className
+ "Selected";
104 var checkbox
= document
.getElementById("LICHK-" + active_label
);
107 checkbox
.checked
= true;
114 function feed_browser_callback() {
115 var container
= document
.getElementById('prefContent');
116 if (xmlhttp
.readyState
== 4) {
117 container
.innerHTML
=xmlhttp
.responseText
;
122 function userlist_callback() {
123 var container
= document
.getElementById('prefContent');
124 if (xmlhttp
.readyState
== 4) {
125 container
.innerHTML
=xmlhttp
.responseText
;
128 var row
= document
.getElementById("UMRR-" + active_user
);
130 if (!row
.className
.match("Selected")) {
131 row
.className
= row
.className
+ "Selected";
134 var checkbox
= document
.getElementById("UMCHK-" + active_user
);
137 checkbox
.checked
= true;
145 function infobox_callback() {
146 if (xmlhttp
.readyState
== 4) {
147 var box
= document
.getElementById('infoBox');
148 var shadow
= document
.getElementById('infoBoxShadow');
151 box
.innerHTML
=xmlhttp
.responseText
;
153 shadow
.style
.display
= "block";
155 box
.style
.display
= "block";
162 function prefslist_callback() {
163 var container
= document
.getElementById('prefContent');
164 if (xmlhttp
.readyState
== 4) {
166 container
.innerHTML
=xmlhttp
.responseText
;
172 function gethelp_callback() {
173 var container
= document
.getElementById('prefHelpBox');
174 if (xmlhttp
.readyState
== 4) {
176 container
.innerHTML
= xmlhttp
.responseText
;
177 container
.style
.display
= "block";
183 function notify_callback() {
184 var container
= document
.getElementById('notify');
185 if (xmlhttp
.readyState
== 4) {
186 container
.innerHTML
=xmlhttp
.responseText
;
190 function updateFeedList(sort_key
) {
192 if (!xmlhttp_ready(xmlhttp
)) {
197 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
199 p_notify("Loading, please wait...");
201 var feed_search
= document
.getElementById("feed_search");
203 if (feed_search
) { search
= feed_search
.value
; }
205 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
206 "&sort=" + param_escape(sort_key
) +
207 "&search=" + param_escape(search
), true);
208 xmlhttp
.onreadystatechange
=feedlist_callback
;
213 function updateUsersList() {
215 if (!xmlhttp_ready(xmlhttp
)) {
220 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
222 p_notify("Loading, please wait...");
224 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
225 xmlhttp
.onreadystatechange
=userlist_callback
;
230 function addLabel() {
232 if (!xmlhttp_ready(xmlhttp
)) {
237 var sqlexp
= document
.getElementById("ladd_expr");
239 if (sqlexp
.value
.length
== 0) {
240 notify("Missing SQL expression.");
242 notify("Adding label...");
244 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
245 param_escape(sqlexp
.value
), true);
247 xmlhttp
.onreadystatechange
=labellist_callback
;
255 function addFilter() {
257 if (!xmlhttp_ready(xmlhttp
)) {
262 var regexp
= document
.getElementById("fadd_regexp");
263 var match
= document
.getElementById("fadd_match");
264 var feed
= document
.getElementById("fadd_feed");
265 var action
= document
.getElementById("fadd_action");
267 if (regexp
.value
.length
== 0) {
268 notify("Missing filter expression.");
270 notify("Adding filter...");
272 var v_match
= match
[match
.selectedIndex
].text
;
273 var feed_id
= feed
[feed
.selectedIndex
].id
;
274 var action_id
= action
[action
.selectedIndex
].id
;
276 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
277 param_escape(regexp
.value
) + "&match=" + v_match
+
278 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
280 xmlhttp
.onreadystatechange
=filterlist_callback
;
290 if (!xmlhttp_ready(xmlhttp
)) {
295 var link
= document
.getElementById("fadd_link");
297 if (link
.value
.length
== 0) {
298 notify("Missing feed URL.");
300 notify("Adding feed...");
302 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
303 param_escape(link
.value
), true);
304 xmlhttp
.onreadystatechange
=feedlist_callback
;
313 function addFeedCat() {
315 if (!xmlhttp_ready(xmlhttp
)) {
320 var cat
= document
.getElementById("fadd_cat");
322 if (cat
.value
.length
== 0) {
323 notify("Missing feed category.");
325 notify("Adding feed category...");
327 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
328 param_escape(cat
.value
), true);
329 xmlhttp
.onreadystatechange
=feedlist_callback
;
339 if (!xmlhttp_ready(xmlhttp
)) {
344 var sqlexp
= document
.getElementById("uadd_box");
346 if (sqlexp
.value
.length
== 0) {
347 notify("Missing user login.");
349 notify("Adding user...");
351 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
352 param_escape(sqlexp
.value
), true);
354 xmlhttp
.onreadystatechange
=userlist_callback
;
362 function editLabel(id
) {
364 if (!xmlhttp_ready(xmlhttp
)) {
371 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
372 param_escape(id
), true);
373 xmlhttp
.onreadystatechange
=labellist_callback
;
378 function editUser(id
) {
380 if (!xmlhttp_ready(xmlhttp
)) {
387 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
388 param_escape(id
), true);
389 xmlhttp
.onreadystatechange
=userlist_callback
;
394 function editFilter(id
) {
396 if (!xmlhttp_ready(xmlhttp
)) {
403 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
404 param_escape(id
), true);
405 xmlhttp
.onreadystatechange
=filterlist_callback
;
410 function editFeed(feed
) {
412 // notify("Editing feed...");
414 if (!xmlhttp_ready(xmlhttp
)) {
421 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
422 param_escape(feed), true);
423 xmlhttp.onreadystatechange=feedlist_callback;
424 xmlhttp.send(null); */
426 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
427 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
430 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
432 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
433 param_escape(active_feed
), true);
435 xmlhttp
.onreadystatechange
=infobox_callback
;
440 function editFeedCat(cat
) {
442 if (!xmlhttp_ready(xmlhttp
)) {
447 active_feed_cat
= cat
;
449 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
450 param_escape(cat
), true);
451 xmlhttp
.onreadystatechange
=feedlist_callback
;
456 function getSelectedLabels() {
457 return getSelectedTableRowIds("prefLabelList", "LILRR");
460 function getSelectedUsers() {
461 return getSelectedTableRowIds("prefUserList", "UMRR");
464 function getSelectedFeeds() {
465 return getSelectedTableRowIds("prefFeedList", "FEEDR");
468 function getSelectedFilters() {
469 return getSelectedTableRowIds("prefFilterList", "FILRR");
472 function getSelectedFeedCats() {
473 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
477 function readSelectedFeeds(read
) {
479 if (!xmlhttp_ready(xmlhttp
)) {
484 var sel_rows
= getSelectedFeeds();
486 if (sel_rows
.length
> 0) {
494 notify("Marking selected feeds as " + op
+ "...");
496 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=" + op
+ "&ids="+
497 param_escape(sel_rows
.toString()), true);
498 xmlhttp
.onreadystatechange
=notify_callback
;
503 notify("Please select some feeds first.");
508 function removeSelectedLabels() {
510 if (!xmlhttp_ready(xmlhttp
)) {
515 var sel_rows
= getSelectedLabels();
517 if (sel_rows
.length
> 0) {
519 var ok
= confirm("Remove selected labels?");
522 notify("Removing selected labels...");
524 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
525 param_escape(sel_rows
.toString()), true);
526 xmlhttp
.onreadystatechange
=labellist_callback
;
530 notify("Please select some labels first.");
534 function removeSelectedUsers() {
536 if (!xmlhttp_ready(xmlhttp
)) {
541 var sel_rows
= getSelectedUsers();
543 if (sel_rows
.length
> 0) {
545 var ok
= confirm("Remove selected users?");
548 notify("Removing selected users...");
550 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
551 param_escape(sel_rows
.toString()), true);
552 xmlhttp
.onreadystatechange
=userlist_callback
;
557 notify("Please select some labels first.");
561 function removeSelectedFilters() {
563 if (!xmlhttp_ready(xmlhttp
)) {
568 var sel_rows
= getSelectedFilters();
570 if (sel_rows
.length
> 0) {
572 var ok
= confirm("Remove selected filters?");
575 notify("Removing selected filters...");
577 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
578 param_escape(sel_rows
.toString()), true);
579 xmlhttp
.onreadystatechange
=filterlist_callback
;
583 notify("Please select some filters first.");
588 function removeSelectedFeeds() {
590 if (!xmlhttp_ready(xmlhttp
)) {
595 var sel_rows
= getSelectedFeeds();
597 if (sel_rows
.length
> 0) {
599 var ok
= confirm("Remove selected feeds?");
603 notify("Removing selected feeds...");
605 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
606 param_escape(sel_rows
.toString()), true);
607 xmlhttp
.onreadystatechange
=feedlist_callback
;
613 notify("Please select some feeds first.");
619 function removeSelectedFeedCats() {
621 if (!xmlhttp_ready(xmlhttp
)) {
626 var sel_rows
= getSelectedFeedCats();
628 if (sel_rows
.length
> 0) {
630 var ok
= confirm("Remove selected categories?");
633 notify("Removing selected categories...");
635 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
636 param_escape(sel_rows
.toString()), true);
637 xmlhttp
.onreadystatechange
=feedlist_callback
;
643 notify("Please select some feeds first.");
649 function feedEditCancel() {
651 if (!xmlhttp_ready(xmlhttp
)) {
660 notify("Operation cancelled.");
662 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
663 xmlhttp.onreadystatechange=feedlist_callback;
664 xmlhttp.send(null); */
668 function feedCatEditCancel() {
670 if (!xmlhttp_ready(xmlhttp
)) {
675 active_feed_cat
= false;
677 notify("Operation cancelled.");
679 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
680 xmlhttp
.onreadystatechange
=feedlist_callback
;
685 function feedEditSave() {
689 var feed
= active_feed
;
691 if (!xmlhttp_ready(xmlhttp
)) {
696 var link
= document
.getElementById("iedit_link").value
;
697 var title
= document
.getElementById("iedit_title").value
;
698 var upd_intl
= document
.getElementById("iedit_updintl").value
;
699 var purge_intl
= document
.getElementById("iedit_purgintl").value
;
700 var fcat
= document
.getElementById("iedit_fcat");
702 var private = document
.getElementById("iedit_private").checked
;
707 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
710 var pfeed
= document
.getElementById("iedit_parent_feed");
711 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
713 if (link
.length
== 0) {
714 notify("Feed link cannot be blank.");
718 if (title
.length
== 0) {
719 notify("Feed title cannot be blank.");
723 var auth_login
= document
.getElementById("iedit_login").value
;
724 var auth_pass
= document
.getElementById("iedit_pass").value
;
728 notify("Saving feed...");
730 var query
= "op=pref-feeds&subop=editSave&id=" +
731 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
732 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
733 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
734 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
735 "&private=" + param_escape(private);
737 xmlhttp
.open("POST", "backend.php", true);
738 xmlhttp
.onreadystatechange
=feedlist_callback
;
739 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
743 exception_error("feedEditSave", e
);
747 function feedCatEditSave() {
749 if (!xmlhttp_ready(xmlhttp
)) {
754 notify("Saving category...");
756 var cat_title
= document
.getElementById("iedit_title").value
;
758 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
759 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
761 xmlhttp
.onreadystatechange
=feedlist_callback
;
764 active_feed_cat
= false;
769 function labelTest() {
771 var sqlexp
= document
.getElementById("iedit_expr").value
;
772 var descr
= document
.getElementById("iedit_descr").value
;
774 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
775 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
777 xmlhttp
.onreadystatechange
=infobox_callback
;
782 function displayHelpInfobox(topic_id
) {
784 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
785 param_escape(topic_id
) + "&noheaders=1", true);
787 xmlhttp
.onreadystatechange
=infobox_callback
;
792 function labelEditCancel() {
794 if (!xmlhttp_ready(xmlhttp
)) {
799 active_label
= false;
801 notify("Operation cancelled.");
803 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
804 xmlhttp
.onreadystatechange
=labellist_callback
;
809 function userEditCancel() {
811 if (!xmlhttp_ready(xmlhttp
)) {
818 notify("Operation cancelled.");
820 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
821 xmlhttp
.onreadystatechange
=userlist_callback
;
826 function filterEditCancel() {
828 if (!xmlhttp_ready(xmlhttp
)) {
833 active_filter
= false;
835 notify("Operation cancelled.");
837 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
838 xmlhttp
.onreadystatechange
=filterlist_callback
;
843 function labelEditSave() {
845 var label
= active_label
;
847 if (!xmlhttp_ready(xmlhttp
)) {
852 var sqlexp
= document
.getElementById("iedit_expr").value
;
853 var descr
= document
.getElementById("iedit_descr").value
;
855 // notify("Saving label " + sqlexp + ": " + descr);
857 if (sqlexp
.length
== 0) {
858 notify("SQL expression cannot be blank.");
862 if (descr
.length
== 0) {
863 notify("Caption cannot be blank.");
867 notify("Saving label...");
869 active_label
= false;
871 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
872 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
875 xmlhttp
.onreadystatechange
=labellist_callback
;
880 function userEditSave() {
882 var user
= active_user
;
884 if (!xmlhttp_ready(xmlhttp
)) {
889 var login
= document
.getElementById("iedit_ulogin").value
;
890 var level
= document
.getElementById("iedit_ulevel").value
;
891 var email
= document
.getElementById("iedit_email").value
;
893 if (login
.length
== 0) {
894 notify("Login cannot be blank.");
898 if (level
.length
== 0) {
899 notify("User level cannot be blank.");
905 notify("Saving user...");
907 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
908 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
909 "&e=" + param_escape(email
), true);
911 xmlhttp
.onreadystatechange
=userlist_callback
;
917 function filterEditSave() {
919 var filter
= active_filter
;
921 if (!xmlhttp_ready(xmlhttp
)) {
926 var regexp
= document
.getElementById("iedit_regexp").value
;
927 var descr
= document
.getElementById("iedit_descr").value
;
928 var match
= document
.getElementById("iedit_match");
930 var v_match
= match
[match
.selectedIndex
].text
;
932 var feed
= document
.getElementById("iedit_feed");
933 var feed_id
= feed
[feed
.selectedIndex
].id
;
935 var action
= document
.getElementById("iedit_filter_action");
936 var action_id
= action
[action
.selectedIndex
].id
;
938 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
940 if (regexp
.length
== 0) {
941 notify("Filter expression cannot be blank.");
945 active_filter
= false;
947 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
948 filter
+ "&r=" + param_escape(regexp
) + "&d=" + param_escape(descr
) +
949 "&m=" + param_escape(v_match
) + "&fid=" + param_escape(feed_id
) +
950 "&aid=" + param_escape(action_id
), true);
952 notify("Saving filter...");
954 xmlhttp
.onreadystatechange
=filterlist_callback
;
959 function editSelectedLabel() {
960 var rows
= getSelectedLabels();
962 if (rows
.length
== 0) {
963 notify("No labels are selected.");
967 if (rows
.length
> 1) {
968 notify("Please select one label.");
978 function editSelectedUser() {
979 var rows
= getSelectedUsers();
981 if (rows
.length
== 0) {
982 notify("No users are selected.");
986 if (rows
.length
> 1) {
987 notify("Please select one user.");
996 function resetSelectedUserPass() {
997 var rows
= getSelectedUsers();
999 if (rows
.length
== 0) {
1000 notify("No users are selected.");
1004 if (rows
.length
> 1) {
1005 notify("Please select one user.");
1009 var ok
= confirm("Reset password of selected user?");
1012 notify("Resetting password for selected user...");
1016 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1017 param_escape(id
), true);
1018 xmlhttp
.onreadystatechange
=userlist_callback
;
1023 function selectedUserDetails() {
1025 if (!xmlhttp_ready(xmlhttp
)) {
1026 printLockingError();
1030 var rows
= getSelectedUsers();
1032 if (rows
.length
== 0) {
1033 notify("No users are selected.");
1037 if (rows
.length
> 1) {
1038 notify("Please select one user.");
1046 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1047 xmlhttp
.onreadystatechange
=infobox_callback
;
1052 function selectedFeedDetails() {
1054 if (!xmlhttp_ready(xmlhttp
)) {
1055 printLockingError();
1059 var rows
= getSelectedFeeds();
1061 if (rows
.length
== 0) {
1062 notify("No feeds are selected.");
1066 // if (rows.length > 1) {
1067 // notify("Please select one feed.");
1071 // var id = rows[0];
1075 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1076 param_escape(rows
.toString()), true);
1077 xmlhttp
.onreadystatechange
=infobox_callback
;
1082 function editSelectedFilter() {
1083 var rows
= getSelectedFilters();
1085 if (rows
.length
== 0) {
1086 notify("No filters are selected.");
1090 if (rows
.length
> 1) {
1091 notify("Please select one filter.");
1097 editFilter(rows
[0]);
1102 function editSelectedFeed() {
1103 var rows
= getSelectedFeeds();
1105 if (rows
.length
== 0) {
1106 notify("No feeds are selected.");
1110 if (rows
.length
> 1) {
1111 notify("Please select one feed.");
1121 function editSelectedFeedCat() {
1122 var rows
= getSelectedFeedCats();
1124 if (rows
.length
== 0) {
1125 notify("No categories are selected.");
1129 if (rows
.length
> 1) {
1130 notify("Please select one category.");
1136 editFeedCat(rows
[0]);
1140 function localPiggieFunction(enable
) {
1142 piggie
.style
.display
= "block";
1144 notify("I loveded it!!!");
1146 piggie
.style
.display
= "none";
1151 function validateOpmlImport() {
1153 var opml_file
= document
.getElementById("opml_file");
1155 if (opml_file
.value
.length
== 0) {
1156 notify("Please select OPML file to upload.");
1163 function updateFilterList() {
1165 if (!xmlhttp_ready(xmlhttp
)) {
1166 printLockingError();
1170 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1172 p_notify("Loading, please wait...");
1174 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1175 xmlhttp
.onreadystatechange
=filterlist_callback
;
1180 function updateLabelList() {
1182 if (!xmlhttp_ready(xmlhttp
)) {
1183 printLockingError();
1187 p_notify("Loading, please wait...");
1189 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1191 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1192 xmlhttp
.onreadystatechange
=labellist_callback
;
1196 function updatePrefsList() {
1198 if (!xmlhttp_ready(xmlhttp
)) {
1199 printLockingError();
1203 p_notify("Loading, please wait...");
1205 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1206 xmlhttp
.onreadystatechange
=prefslist_callback
;
1211 function selectTab(id
, noupdate
) {
1215 if (!xmlhttp_ready(xmlhttp
)) {
1216 printLockingError();
1222 if (id
== "feedConfig") {
1224 } else if (id
== "filterConfig") {
1226 } else if (id
== "labelConfig") {
1228 } else if (id
== "genConfig") {
1230 } else if (id
== "userConfig") {
1232 } else if (id
== "feedBrowser") {
1233 updateBigFeedBrowser();
1237 var tab
= document
.getElementById(active_tab
+ "Tab");
1240 if (tab
.className
.match("Selected")) {
1241 tab
.className
= "prefsTab";
1245 tab
= document
.getElementById(id
+ "Tab");
1248 if (!tab
.className
.match("Selected")) {
1249 tab
.className
= tab
.className
+ "Selected";
1255 setCookie('ttrss_pref_acttab', active_tab
);
1265 document
.getElementById("prefContent").innerHTML
=
1266 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1267 "to function properly. Your browser doesn't seem to support it.";
1271 active_tab
= getCookie("ttrss_pref_acttab");
1272 if (!active_tab
) active_tab
= "genConfig";
1273 selectTab(active_tab
);
1275 document
.onkeydown
= hotkey_handler
;
1278 exception_error("init", e
);
1282 function closeInfoBox() {
1283 var box
= document
.getElementById('infoBox');
1284 var shadow
= document
.getElementById('infoBoxShadow');
1287 shadow
.style
.display
= "none";
1289 box
.style
.display
= "none";
1293 function categorizeSelectedFeeds() {
1295 if (!xmlhttp_ready(xmlhttp
)) {
1296 printLockingError();
1300 var sel_rows
= getSelectedFeeds();
1302 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1303 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1305 if (sel_rows
.length
> 0) {
1307 notify("Changing category of selected feeds...");
1309 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1310 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1311 xmlhttp
.onreadystatechange
=feedlist_callback
;
1316 notify("Please select some feeds first.");
1322 function validatePrefsReset() {
1323 return confirm("Reset to defaults?");
1326 function browseFeeds() {
1328 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1329 xmlhttp
.onreadystatechange
=infobox_callback
;
1334 function feedBrowserSubscribe() {
1336 var list
= document
.getElementById("browseFeedList");
1338 if (!list
) list
= document
.getElementById("browseBigFeedList");
1340 var selected
= new Array();
1342 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1343 var child
= list
.childNodes
[i
];
1344 if (child
.id
&& child
.id
.match("FBROW-")) {
1345 var id
= child
.id
.replace("FBROW-", "");
1347 var cb
= document
.getElementById("FBCHK-" + id
);
1355 if (selected
.length
> 0) {
1357 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1358 param_escape(selected
.toString()), true);
1359 xmlhttp
.onreadystatechange
=feedlist_callback
;
1362 alert("No feeds are selected.");
1366 exception_error("feedBrowserSubscribe", e
);
1370 function updateBigFeedBrowser() {
1372 if (!xmlhttp_ready(xmlhttp
)) {
1373 printLockingError();
1377 p_notify("Loading, please wait...");
1379 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1380 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1385 function browserToggleExpand(id
) {
1387 /* if (feed_to_expand && feed_to_expand != id) {
1388 var d = document.getElementById("BRDET-" + feed_to_expand);
1389 d.style.display = "none";
1392 var d
= document
.getElementById("BRDET-" + id
);
1394 if (d
.style
.display
== "block") {
1395 d
.style
.display
= "none";
1399 feed_to_expand
= id
;
1401 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1402 + param_escape(id
), true);
1403 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1408 exception_error("browserExpand", e
);