]>
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 is_pvt
= document
.getElementById("iedit_private");
705 is_pvt
= is_pvt
.checked
;
711 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
714 var pfeed
= document
.getElementById("iedit_parent_feed");
715 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
717 if (link
.length
== 0) {
718 notify("Feed link cannot be blank.");
722 if (title
.length
== 0) {
723 notify("Feed title cannot be blank.");
727 var auth_login
= document
.getElementById("iedit_login").value
;
728 var auth_pass
= document
.getElementById("iedit_pass").value
;
732 notify("Saving feed...");
734 var query
= "op=pref-feeds&subop=editSave&id=" +
735 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
736 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
737 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
738 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
739 "&is_pvt=" + param_escape(is_pvt
);
741 xmlhttp
.open("POST", "backend.php", true);
742 xmlhttp
.onreadystatechange
=feedlist_callback
;
743 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
747 exception_error("feedEditSave", e
);
751 function feedCatEditSave() {
753 if (!xmlhttp_ready(xmlhttp
)) {
758 notify("Saving category...");
760 var cat_title
= document
.getElementById("iedit_title").value
;
762 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
763 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
765 xmlhttp
.onreadystatechange
=feedlist_callback
;
768 active_feed_cat
= false;
773 function labelTest() {
775 var sqlexp
= document
.getElementById("iedit_expr").value
;
776 var descr
= document
.getElementById("iedit_descr").value
;
778 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
779 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
781 xmlhttp
.onreadystatechange
=infobox_callback
;
786 function displayHelpInfobox(topic_id
) {
788 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
789 param_escape(topic_id
) + "&noheaders=1", true);
791 xmlhttp
.onreadystatechange
=infobox_callback
;
796 function labelEditCancel() {
798 if (!xmlhttp_ready(xmlhttp
)) {
803 active_label
= false;
805 notify("Operation cancelled.");
807 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
808 xmlhttp
.onreadystatechange
=labellist_callback
;
813 function userEditCancel() {
815 if (!xmlhttp_ready(xmlhttp
)) {
822 notify("Operation cancelled.");
824 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
825 xmlhttp
.onreadystatechange
=userlist_callback
;
830 function filterEditCancel() {
832 if (!xmlhttp_ready(xmlhttp
)) {
837 active_filter
= false;
839 notify("Operation cancelled.");
841 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
842 xmlhttp
.onreadystatechange
=filterlist_callback
;
847 function labelEditSave() {
849 var label
= active_label
;
851 if (!xmlhttp_ready(xmlhttp
)) {
856 var sqlexp
= document
.getElementById("iedit_expr").value
;
857 var descr
= document
.getElementById("iedit_descr").value
;
859 // notify("Saving label " + sqlexp + ": " + descr);
861 if (sqlexp
.length
== 0) {
862 notify("SQL expression cannot be blank.");
866 if (descr
.length
== 0) {
867 notify("Caption cannot be blank.");
871 notify("Saving label...");
873 active_label
= false;
875 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
876 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
879 xmlhttp
.onreadystatechange
=labellist_callback
;
884 function userEditSave() {
886 var user
= active_user
;
888 if (!xmlhttp_ready(xmlhttp
)) {
893 var login
= document
.getElementById("iedit_ulogin").value
;
894 var level
= document
.getElementById("iedit_ulevel").value
;
895 var email
= document
.getElementById("iedit_email").value
;
897 if (login
.length
== 0) {
898 notify("Login cannot be blank.");
902 if (level
.length
== 0) {
903 notify("User level cannot be blank.");
909 notify("Saving user...");
911 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
912 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
913 "&e=" + param_escape(email
), true);
915 xmlhttp
.onreadystatechange
=userlist_callback
;
921 function filterEditSave() {
923 var filter
= active_filter
;
925 if (!xmlhttp_ready(xmlhttp
)) {
930 var regexp
= document
.getElementById("iedit_regexp").value
;
931 var descr
= document
.getElementById("iedit_descr").value
;
932 var match
= document
.getElementById("iedit_match");
934 var v_match
= match
[match
.selectedIndex
].text
;
936 var feed
= document
.getElementById("iedit_feed");
937 var feed_id
= feed
[feed
.selectedIndex
].id
;
939 var action
= document
.getElementById("iedit_filter_action");
940 var action_id
= action
[action
.selectedIndex
].id
;
942 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
944 if (regexp
.length
== 0) {
945 notify("Filter expression cannot be blank.");
949 active_filter
= false;
951 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
952 filter
+ "&r=" + param_escape(regexp
) + "&d=" + param_escape(descr
) +
953 "&m=" + param_escape(v_match
) + "&fid=" + param_escape(feed_id
) +
954 "&aid=" + param_escape(action_id
), true);
956 notify("Saving filter...");
958 xmlhttp
.onreadystatechange
=filterlist_callback
;
963 function editSelectedLabel() {
964 var rows
= getSelectedLabels();
966 if (rows
.length
== 0) {
967 notify("No labels are selected.");
971 if (rows
.length
> 1) {
972 notify("Please select one label.");
982 function editSelectedUser() {
983 var rows
= getSelectedUsers();
985 if (rows
.length
== 0) {
986 notify("No users are selected.");
990 if (rows
.length
> 1) {
991 notify("Please select one user.");
1000 function resetSelectedUserPass() {
1001 var rows
= getSelectedUsers();
1003 if (rows
.length
== 0) {
1004 notify("No users are selected.");
1008 if (rows
.length
> 1) {
1009 notify("Please select one user.");
1013 var ok
= confirm("Reset password of selected user?");
1016 notify("Resetting password for selected user...");
1020 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1021 param_escape(id
), true);
1022 xmlhttp
.onreadystatechange
=userlist_callback
;
1027 function selectedUserDetails() {
1029 if (!xmlhttp_ready(xmlhttp
)) {
1030 printLockingError();
1034 var rows
= getSelectedUsers();
1036 if (rows
.length
== 0) {
1037 notify("No users are selected.");
1041 if (rows
.length
> 1) {
1042 notify("Please select one user.");
1050 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1051 xmlhttp
.onreadystatechange
=infobox_callback
;
1056 function selectedFeedDetails() {
1058 if (!xmlhttp_ready(xmlhttp
)) {
1059 printLockingError();
1063 var rows
= getSelectedFeeds();
1065 if (rows
.length
== 0) {
1066 notify("No feeds are selected.");
1070 // if (rows.length > 1) {
1071 // notify("Please select one feed.");
1075 // var id = rows[0];
1079 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1080 param_escape(rows
.toString()), true);
1081 xmlhttp
.onreadystatechange
=infobox_callback
;
1086 function editSelectedFilter() {
1087 var rows
= getSelectedFilters();
1089 if (rows
.length
== 0) {
1090 notify("No filters are selected.");
1094 if (rows
.length
> 1) {
1095 notify("Please select one filter.");
1101 editFilter(rows
[0]);
1106 function editSelectedFeed() {
1107 var rows
= getSelectedFeeds();
1109 if (rows
.length
== 0) {
1110 notify("No feeds are selected.");
1114 if (rows
.length
> 1) {
1115 notify("Please select one feed.");
1125 function editSelectedFeedCat() {
1126 var rows
= getSelectedFeedCats();
1128 if (rows
.length
== 0) {
1129 notify("No categories are selected.");
1133 if (rows
.length
> 1) {
1134 notify("Please select one category.");
1140 editFeedCat(rows
[0]);
1144 function localPiggieFunction(enable
) {
1146 piggie
.style
.display
= "block";
1148 notify("I loveded it!!!");
1150 piggie
.style
.display
= "none";
1155 function validateOpmlImport() {
1157 var opml_file
= document
.getElementById("opml_file");
1159 if (opml_file
.value
.length
== 0) {
1160 notify("Please select OPML file to upload.");
1167 function updateFilterList() {
1169 if (!xmlhttp_ready(xmlhttp
)) {
1170 printLockingError();
1174 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1176 p_notify("Loading, please wait...");
1178 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1179 xmlhttp
.onreadystatechange
=filterlist_callback
;
1184 function updateLabelList() {
1186 if (!xmlhttp_ready(xmlhttp
)) {
1187 printLockingError();
1191 p_notify("Loading, please wait...");
1193 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1195 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1196 xmlhttp
.onreadystatechange
=labellist_callback
;
1200 function updatePrefsList() {
1202 if (!xmlhttp_ready(xmlhttp
)) {
1203 printLockingError();
1207 p_notify("Loading, please wait...");
1209 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1210 xmlhttp
.onreadystatechange
=prefslist_callback
;
1215 function selectTab(id
, noupdate
) {
1219 if (!xmlhttp_ready(xmlhttp
)) {
1220 printLockingError();
1226 if (id
== "feedConfig") {
1228 } else if (id
== "filterConfig") {
1230 } else if (id
== "labelConfig") {
1232 } else if (id
== "genConfig") {
1234 } else if (id
== "userConfig") {
1236 } else if (id
== "feedBrowser") {
1237 updateBigFeedBrowser();
1241 var tab
= document
.getElementById(active_tab
+ "Tab");
1244 if (tab
.className
.match("Selected")) {
1245 tab
.className
= "prefsTab";
1249 tab
= document
.getElementById(id
+ "Tab");
1252 if (!tab
.className
.match("Selected")) {
1253 tab
.className
= tab
.className
+ "Selected";
1259 setCookie('ttrss_pref_acttab', active_tab
);
1269 document
.getElementById("prefContent").innerHTML
=
1270 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1271 "to function properly. Your browser doesn't seem to support it.";
1275 active_tab
= getCookie("ttrss_pref_acttab");
1276 if (!active_tab
) active_tab
= "genConfig";
1277 selectTab(active_tab
);
1279 document
.onkeydown
= hotkey_handler
;
1282 exception_error("init", e
);
1286 function closeInfoBox() {
1287 var box
= document
.getElementById('infoBox');
1288 var shadow
= document
.getElementById('infoBoxShadow');
1291 shadow
.style
.display
= "none";
1293 box
.style
.display
= "none";
1297 function categorizeSelectedFeeds() {
1299 if (!xmlhttp_ready(xmlhttp
)) {
1300 printLockingError();
1304 var sel_rows
= getSelectedFeeds();
1306 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1307 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1309 if (sel_rows
.length
> 0) {
1311 notify("Changing category of selected feeds...");
1313 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1314 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1315 xmlhttp
.onreadystatechange
=feedlist_callback
;
1320 notify("Please select some feeds first.");
1326 function validatePrefsReset() {
1327 return confirm("Reset to defaults?");
1330 function browseFeeds() {
1332 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1333 xmlhttp
.onreadystatechange
=infobox_callback
;
1338 function feedBrowserSubscribe() {
1340 var list
= document
.getElementById("browseFeedList");
1342 if (!list
) list
= document
.getElementById("browseBigFeedList");
1344 var selected
= new Array();
1346 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1347 var child
= list
.childNodes
[i
];
1348 if (child
.id
&& child
.id
.match("FBROW-")) {
1349 var id
= child
.id
.replace("FBROW-", "");
1351 var cb
= document
.getElementById("FBCHK-" + id
);
1359 if (selected
.length
> 0) {
1361 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1362 param_escape(selected
.toString()), true);
1363 xmlhttp
.onreadystatechange
=feedlist_callback
;
1366 alert("No feeds are selected.");
1370 exception_error("feedBrowserSubscribe", e
);
1374 function updateBigFeedBrowser() {
1376 if (!xmlhttp_ready(xmlhttp
)) {
1377 printLockingError();
1381 p_notify("Loading, please wait...");
1383 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1384 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1389 function browserToggleExpand(id
) {
1391 /* if (feed_to_expand && feed_to_expand != id) {
1392 var d = document.getElementById("BRDET-" + feed_to_expand);
1393 d.style.display = "none";
1396 var d
= document
.getElementById("BRDET-" + id
);
1398 if (d
.style
.display
== "block") {
1399 d
.style
.display
= "none";
1403 feed_to_expand
= id
;
1405 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1406 + param_escape(id
), true);
1407 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1412 exception_error("browserExpand", e
);