]>
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
;
49 var row
= document
.getElementById("FEEDR-" + active_feed
);
51 if (!row
.className
.match("Selected")) {
52 row
.className
= row
.className
+ "Selected";
55 var checkbox
= document
.getElementById("FRCHK-" + active_feed
);
57 checkbox
.checked
= true;
62 exception_error("feedlist_callback", e
);
67 function filterlist_callback() {
68 var container
= document
.getElementById('prefContent');
69 if (xmlhttp
.readyState
== 4) {
71 container
.innerHTML
=xmlhttp
.responseText
;
74 var row
= document
.getElementById("FILRR-" + active_filter
);
76 if (!row
.className
.match("Selected")) {
77 row
.className
= row
.className
+ "Selected";
80 var checkbox
= document
.getElementById("FICHK-" + active_filter
);
83 checkbox
.checked
= true;
90 function labellist_callback() {
91 var container
= document
.getElementById('prefContent');
92 if (xmlhttp
.readyState
== 4) {
93 container
.innerHTML
=xmlhttp
.responseText
;
96 var row
= document
.getElementById("LILRR-" + active_label
);
98 if (!row
.className
.match("Selected")) {
99 row
.className
= row
.className
+ "Selected";
102 var checkbox
= document
.getElementById("LICHK-" + active_label
);
105 checkbox
.checked
= true;
112 function feed_browser_callback() {
113 var container
= document
.getElementById('prefContent');
114 if (xmlhttp
.readyState
== 4) {
115 container
.innerHTML
=xmlhttp
.responseText
;
120 function userlist_callback() {
121 var container
= document
.getElementById('prefContent');
122 if (xmlhttp
.readyState
== 4) {
123 container
.innerHTML
=xmlhttp
.responseText
;
126 var row
= document
.getElementById("UMRR-" + active_user
);
128 if (!row
.className
.match("Selected")) {
129 row
.className
= row
.className
+ "Selected";
132 var checkbox
= document
.getElementById("UMCHK-" + active_user
);
135 checkbox
.checked
= true;
143 function infobox_callback() {
144 if (xmlhttp
.readyState
== 4) {
145 var box
= document
.getElementById('infoBox');
146 var shadow
= document
.getElementById('infoBoxShadow');
149 box
.innerHTML
=xmlhttp
.responseText
;
151 shadow
.style
.display
= "block";
153 box
.style
.display
= "block";
160 function prefslist_callback() {
161 var container
= document
.getElementById('prefContent');
162 if (xmlhttp
.readyState
== 4) {
164 container
.innerHTML
=xmlhttp
.responseText
;
170 function gethelp_callback() {
171 var container
= document
.getElementById('prefHelpBox');
172 if (xmlhttp
.readyState
== 4) {
174 container
.innerHTML
= xmlhttp
.responseText
;
175 container
.style
.display
= "block";
181 function notify_callback() {
182 var container
= document
.getElementById('notify');
183 if (xmlhttp
.readyState
== 4) {
184 container
.innerHTML
=xmlhttp
.responseText
;
188 function updateFeedList(sort_key
) {
190 if (!xmlhttp_ready(xmlhttp
)) {
195 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
197 p_notify("Loading, please wait...");
199 var feed_search
= document
.getElementById("feed_search");
201 if (feed_search
) { search
= feed_search
.value
; }
203 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
204 "&sort=" + param_escape(sort_key
) +
205 "&search=" + param_escape(search
), true);
206 xmlhttp
.onreadystatechange
=feedlist_callback
;
211 function updateUsersList() {
213 if (!xmlhttp_ready(xmlhttp
)) {
218 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
220 p_notify("Loading, please wait...");
222 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
223 xmlhttp
.onreadystatechange
=userlist_callback
;
228 function addLabel() {
230 if (!xmlhttp_ready(xmlhttp
)) {
235 var sqlexp
= document
.getElementById("ladd_expr");
237 if (sqlexp
.value
.length
== 0) {
238 notify("Missing SQL expression.");
240 notify("Adding label...");
242 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
243 param_escape(sqlexp
.value
), true);
245 xmlhttp
.onreadystatechange
=labellist_callback
;
253 function addFilter() {
255 if (!xmlhttp_ready(xmlhttp
)) {
260 var regexp
= document
.getElementById("fadd_regexp");
261 var match
= document
.getElementById("fadd_match");
262 var feed
= document
.getElementById("fadd_feed");
263 var action
= document
.getElementById("fadd_action");
265 if (regexp
.value
.length
== 0) {
266 notify("Missing filter expression.");
268 notify("Adding filter...");
270 var v_match
= match
[match
.selectedIndex
].text
;
271 var feed_id
= feed
[feed
.selectedIndex
].id
;
272 var action_id
= action
[action
.selectedIndex
].id
;
274 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
275 param_escape(regexp
.value
) + "&match=" + v_match
+
276 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
278 xmlhttp
.onreadystatechange
=filterlist_callback
;
288 if (!xmlhttp_ready(xmlhttp
)) {
293 var link
= document
.getElementById("fadd_link");
295 if (link
.value
.length
== 0) {
296 notify("Missing feed URL.");
298 notify("Adding feed...");
300 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
301 param_escape(link
.value
), true);
302 xmlhttp
.onreadystatechange
=feedlist_callback
;
311 function addFeedCat() {
313 if (!xmlhttp_ready(xmlhttp
)) {
318 var cat
= document
.getElementById("fadd_cat");
320 if (cat
.value
.length
== 0) {
321 notify("Missing feed category.");
323 notify("Adding feed category...");
325 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
326 param_escape(cat
.value
), true);
327 xmlhttp
.onreadystatechange
=feedlist_callback
;
337 if (!xmlhttp_ready(xmlhttp
)) {
342 var sqlexp
= document
.getElementById("uadd_box");
344 if (sqlexp
.value
.length
== 0) {
345 notify("Missing user login.");
347 notify("Adding user...");
349 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
350 param_escape(sqlexp
.value
), true);
352 xmlhttp
.onreadystatechange
=userlist_callback
;
360 function editLabel(id
) {
362 if (!xmlhttp_ready(xmlhttp
)) {
369 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
370 param_escape(id
), true);
371 xmlhttp
.onreadystatechange
=labellist_callback
;
376 function editUser(id
) {
378 if (!xmlhttp_ready(xmlhttp
)) {
385 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
386 param_escape(id
), true);
387 xmlhttp
.onreadystatechange
=userlist_callback
;
392 function editFilter(id
) {
394 if (!xmlhttp_ready(xmlhttp
)) {
401 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
402 param_escape(id
), true);
403 xmlhttp
.onreadystatechange
=filterlist_callback
;
408 function editFeed(feed
) {
410 // notify("Editing feed...");
412 if (!xmlhttp_ready(xmlhttp
)) {
419 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
420 param_escape(feed), true);
421 xmlhttp.onreadystatechange=feedlist_callback;
422 xmlhttp.send(null); */
424 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
425 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
428 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
430 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
431 param_escape(active_feed
), true);
433 xmlhttp
.onreadystatechange
=infobox_callback
;
438 function editFeedCat(cat
) {
440 if (!xmlhttp_ready(xmlhttp
)) {
445 active_feed_cat
= cat
;
447 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
448 param_escape(cat
), true);
449 xmlhttp
.onreadystatechange
=feedlist_callback
;
454 function getSelectedLabels() {
455 return getSelectedTableRowIds("prefLabelList", "LILRR");
458 function getSelectedUsers() {
459 return getSelectedTableRowIds("prefUserList", "UMRR");
462 function getSelectedFeeds() {
463 return getSelectedTableRowIds("prefFeedList", "FEEDR");
466 function getSelectedFilters() {
467 return getSelectedTableRowIds("prefFilterList", "FILRR");
470 function getSelectedFeedCats() {
471 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
475 function readSelectedFeeds(read
) {
477 if (!xmlhttp_ready(xmlhttp
)) {
482 var sel_rows
= getSelectedFeeds();
484 if (sel_rows
.length
> 0) {
492 notify("Marking selected feeds as " + op
+ "...");
494 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=" + op
+ "&ids="+
495 param_escape(sel_rows
.toString()), true);
496 xmlhttp
.onreadystatechange
=notify_callback
;
501 notify("Please select some feeds first.");
506 function removeSelectedLabels() {
508 if (!xmlhttp_ready(xmlhttp
)) {
513 var sel_rows
= getSelectedLabels();
515 if (sel_rows
.length
> 0) {
517 var ok
= confirm("Remove selected labels?");
520 notify("Removing selected labels...");
522 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
523 param_escape(sel_rows
.toString()), true);
524 xmlhttp
.onreadystatechange
=labellist_callback
;
528 notify("Please select some labels first.");
532 function removeSelectedUsers() {
534 if (!xmlhttp_ready(xmlhttp
)) {
539 var sel_rows
= getSelectedUsers();
541 if (sel_rows
.length
> 0) {
543 var ok
= confirm("Remove selected users?");
546 notify("Removing selected users...");
548 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
549 param_escape(sel_rows
.toString()), true);
550 xmlhttp
.onreadystatechange
=userlist_callback
;
555 notify("Please select some labels first.");
559 function removeSelectedFilters() {
561 if (!xmlhttp_ready(xmlhttp
)) {
566 var sel_rows
= getSelectedFilters();
568 if (sel_rows
.length
> 0) {
570 var ok
= confirm("Remove selected filters?");
573 notify("Removing selected filters...");
575 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
576 param_escape(sel_rows
.toString()), true);
577 xmlhttp
.onreadystatechange
=filterlist_callback
;
581 notify("Please select some filters first.");
586 function removeSelectedFeeds() {
588 if (!xmlhttp_ready(xmlhttp
)) {
593 var sel_rows
= getSelectedFeeds();
595 if (sel_rows
.length
> 0) {
597 var ok
= confirm("Remove selected feeds?");
601 notify("Removing selected feeds...");
603 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
604 param_escape(sel_rows
.toString()), true);
605 xmlhttp
.onreadystatechange
=feedlist_callback
;
611 notify("Please select some feeds first.");
617 function removeSelectedFeedCats() {
619 if (!xmlhttp_ready(xmlhttp
)) {
624 var sel_rows
= getSelectedFeedCats();
626 if (sel_rows
.length
> 0) {
628 var ok
= confirm("Remove selected categories?");
631 notify("Removing selected categories...");
633 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
634 param_escape(sel_rows
.toString()), true);
635 xmlhttp
.onreadystatechange
=feedlist_callback
;
641 notify("Please select some feeds first.");
647 function feedEditCancel() {
649 if (!xmlhttp_ready(xmlhttp
)) {
658 notify("Operation cancelled.");
660 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
661 xmlhttp.onreadystatechange=feedlist_callback;
662 xmlhttp.send(null); */
666 function feedCatEditCancel() {
668 if (!xmlhttp_ready(xmlhttp
)) {
673 active_feed_cat
= false;
675 notify("Operation cancelled.");
677 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
678 xmlhttp
.onreadystatechange
=feedlist_callback
;
683 function feedEditSave() {
687 var feed
= active_feed
;
689 if (!xmlhttp_ready(xmlhttp
)) {
694 var link
= document
.getElementById("iedit_link").value
;
695 var title
= document
.getElementById("iedit_title").value
;
696 var upd_intl
= document
.getElementById("iedit_updintl").value
;
697 var purge_intl
= document
.getElementById("iedit_purgintl").value
;
698 var fcat
= document
.getElementById("iedit_fcat");
700 var private = document
.getElementById("iedit_private").checked
;
705 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
708 var pfeed
= document
.getElementById("iedit_parent_feed");
709 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
711 if (link
.length
== 0) {
712 notify("Feed link cannot be blank.");
716 if (title
.length
== 0) {
717 notify("Feed title cannot be blank.");
721 var auth_login
= document
.getElementById("iedit_login").value
;
722 var auth_pass
= document
.getElementById("iedit_pass").value
;
726 notify("Saving feed...");
728 var query
= "op=pref-feeds&subop=editSave&id=" +
729 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
730 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
731 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
732 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
733 "&private=" + param_escape(private);
735 xmlhttp
.open("POST", "backend.php", true);
736 xmlhttp
.onreadystatechange
=feedlist_callback
;
737 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
741 exception_error("feedEditSave", e
);
745 function feedCatEditSave() {
747 if (!xmlhttp_ready(xmlhttp
)) {
752 notify("Saving category...");
754 var cat_title
= document
.getElementById("iedit_title").value
;
756 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
757 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
759 xmlhttp
.onreadystatechange
=feedlist_callback
;
762 active_feed_cat
= false;
767 function labelTest() {
769 var sqlexp
= document
.getElementById("iedit_expr").value
;
770 var descr
= document
.getElementById("iedit_descr").value
;
772 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
773 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
775 xmlhttp
.onreadystatechange
=infobox_callback
;
780 function displayHelpInfobox(topic_id
) {
782 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
783 param_escape(topic_id
) + "&noheaders=1", true);
785 xmlhttp
.onreadystatechange
=infobox_callback
;
790 function labelEditCancel() {
792 if (!xmlhttp_ready(xmlhttp
)) {
797 active_label
= false;
799 notify("Operation cancelled.");
801 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
802 xmlhttp
.onreadystatechange
=labellist_callback
;
807 function userEditCancel() {
809 if (!xmlhttp_ready(xmlhttp
)) {
816 notify("Operation cancelled.");
818 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
819 xmlhttp
.onreadystatechange
=userlist_callback
;
824 function filterEditCancel() {
826 if (!xmlhttp_ready(xmlhttp
)) {
831 active_filter
= false;
833 notify("Operation cancelled.");
835 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
836 xmlhttp
.onreadystatechange
=filterlist_callback
;
841 function labelEditSave() {
843 var label
= active_label
;
845 if (!xmlhttp_ready(xmlhttp
)) {
850 var sqlexp
= document
.getElementById("iedit_expr").value
;
851 var descr
= document
.getElementById("iedit_descr").value
;
853 // notify("Saving label " + sqlexp + ": " + descr);
855 if (sqlexp
.length
== 0) {
856 notify("SQL expression cannot be blank.");
860 if (descr
.length
== 0) {
861 notify("Caption cannot be blank.");
865 notify("Saving label...");
867 active_label
= false;
869 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
870 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
873 xmlhttp
.onreadystatechange
=labellist_callback
;
878 function userEditSave() {
880 var user
= active_user
;
882 if (!xmlhttp_ready(xmlhttp
)) {
887 var login
= document
.getElementById("iedit_ulogin").value
;
888 var level
= document
.getElementById("iedit_ulevel").value
;
889 var email
= document
.getElementById("iedit_email").value
;
891 if (login
.length
== 0) {
892 notify("Login cannot be blank.");
896 if (level
.length
== 0) {
897 notify("User level cannot be blank.");
903 notify("Saving user...");
905 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
906 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
907 "&e=" + param_escape(email
), true);
909 xmlhttp
.onreadystatechange
=userlist_callback
;
915 function filterEditSave() {
917 var filter
= active_filter
;
919 if (!xmlhttp_ready(xmlhttp
)) {
924 var regexp
= document
.getElementById("iedit_regexp").value
;
925 var descr
= document
.getElementById("iedit_descr").value
;
926 var match
= document
.getElementById("iedit_match");
928 var v_match
= match
[match
.selectedIndex
].text
;
930 var feed
= document
.getElementById("iedit_feed");
931 var feed_id
= feed
[feed
.selectedIndex
].id
;
933 var action
= document
.getElementById("iedit_filter_action");
934 var action_id
= action
[action
.selectedIndex
].id
;
936 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
938 if (regexp
.length
== 0) {
939 notify("Filter expression cannot be blank.");
943 active_filter
= false;
945 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
946 filter
+ "&r=" + param_escape(regexp
) + "&d=" + param_escape(descr
) +
947 "&m=" + param_escape(v_match
) + "&fid=" + param_escape(feed_id
) +
948 "&aid=" + param_escape(action_id
), true);
950 notify("Saving filter...");
952 xmlhttp
.onreadystatechange
=filterlist_callback
;
957 function editSelectedLabel() {
958 var rows
= getSelectedLabels();
960 if (rows
.length
== 0) {
961 notify("No labels are selected.");
965 if (rows
.length
> 1) {
966 notify("Please select one label.");
976 function editSelectedUser() {
977 var rows
= getSelectedUsers();
979 if (rows
.length
== 0) {
980 notify("No users are selected.");
984 if (rows
.length
> 1) {
985 notify("Please select one user.");
994 function resetSelectedUserPass() {
995 var rows
= getSelectedUsers();
997 if (rows
.length
== 0) {
998 notify("No users are selected.");
1002 if (rows
.length
> 1) {
1003 notify("Please select one user.");
1007 var ok
= confirm("Reset password of selected user?");
1010 notify("Resetting password for selected user...");
1014 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1015 param_escape(id
), true);
1016 xmlhttp
.onreadystatechange
=userlist_callback
;
1021 function selectedUserDetails() {
1023 if (!xmlhttp_ready(xmlhttp
)) {
1024 printLockingError();
1028 var rows
= getSelectedUsers();
1030 if (rows
.length
== 0) {
1031 notify("No users are selected.");
1035 if (rows
.length
> 1) {
1036 notify("Please select one user.");
1044 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1045 xmlhttp
.onreadystatechange
=infobox_callback
;
1050 function selectedFeedDetails() {
1052 if (!xmlhttp_ready(xmlhttp
)) {
1053 printLockingError();
1057 var rows
= getSelectedFeeds();
1059 if (rows
.length
== 0) {
1060 notify("No feeds are selected.");
1064 // if (rows.length > 1) {
1065 // notify("Please select one feed.");
1069 // var id = rows[0];
1073 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1074 param_escape(rows
.toString()), true);
1075 xmlhttp
.onreadystatechange
=infobox_callback
;
1080 function editSelectedFilter() {
1081 var rows
= getSelectedFilters();
1083 if (rows
.length
== 0) {
1084 notify("No filters are selected.");
1088 if (rows
.length
> 1) {
1089 notify("Please select one filter.");
1095 editFilter(rows
[0]);
1100 function editSelectedFeed() {
1101 var rows
= getSelectedFeeds();
1103 if (rows
.length
== 0) {
1104 notify("No feeds are selected.");
1108 if (rows
.length
> 1) {
1109 notify("Please select one feed.");
1119 function editSelectedFeedCat() {
1120 var rows
= getSelectedFeedCats();
1122 if (rows
.length
== 0) {
1123 notify("No categories are selected.");
1127 if (rows
.length
> 1) {
1128 notify("Please select one category.");
1134 editFeedCat(rows
[0]);
1138 function localPiggieFunction(enable
) {
1140 piggie
.style
.display
= "block";
1142 notify("I loveded it!!!");
1144 piggie
.style
.display
= "none";
1149 function validateOpmlImport() {
1151 var opml_file
= document
.getElementById("opml_file");
1153 if (opml_file
.value
.length
== 0) {
1154 notify("Please select OPML file to upload.");
1161 function updateFilterList() {
1163 if (!xmlhttp_ready(xmlhttp
)) {
1164 printLockingError();
1168 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1170 p_notify("Loading, please wait...");
1172 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1173 xmlhttp
.onreadystatechange
=filterlist_callback
;
1178 function updateLabelList() {
1180 if (!xmlhttp_ready(xmlhttp
)) {
1181 printLockingError();
1185 p_notify("Loading, please wait...");
1187 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1189 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1190 xmlhttp
.onreadystatechange
=labellist_callback
;
1194 function updatePrefsList() {
1196 if (!xmlhttp_ready(xmlhttp
)) {
1197 printLockingError();
1201 p_notify("Loading, please wait...");
1203 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1204 xmlhttp
.onreadystatechange
=prefslist_callback
;
1209 function selectTab(id
) {
1211 if (!xmlhttp_ready(xmlhttp
)) {
1212 printLockingError();
1216 if (id
== "feedConfig") {
1218 } else if (id
== "filterConfig") {
1220 } else if (id
== "labelConfig") {
1222 } else if (id
== "genConfig") {
1224 } else if (id
== "userConfig") {
1226 } else if (id
== "feedBrowser") {
1227 updateBigFeedBrowser();
1230 var tab
= document
.getElementById(active_tab
+ "Tab");
1233 if (tab
.className
.match("Selected")) {
1234 tab
.className
= "prefsTab";
1238 tab
= document
.getElementById(id
+ "Tab");
1241 if (!tab
.className
.match("Selected")) {
1242 tab
.className
= tab
.className
+ "Selected";
1248 setCookie('ttrss_pref_acttab', active_tab
);
1258 document
.getElementById("prefContent").innerHTML
=
1259 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1260 "to function properly. Your browser doesn't seem to support it.";
1264 active_tab
= getCookie("ttrss_pref_acttab");
1265 if (!active_tab
) active_tab
= "genConfig";
1266 selectTab(active_tab
);
1268 document
.onkeydown
= hotkey_handler
;
1271 exception_error("init", e
);
1275 function closeInfoBox() {
1276 var box
= document
.getElementById('infoBox');
1277 var shadow
= document
.getElementById('infoBoxShadow');
1280 shadow
.style
.display
= "none";
1282 box
.style
.display
= "none";
1286 function categorizeSelectedFeeds() {
1288 if (!xmlhttp_ready(xmlhttp
)) {
1289 printLockingError();
1293 var sel_rows
= getSelectedFeeds();
1295 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1296 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1298 if (sel_rows
.length
> 0) {
1300 notify("Changing category of selected feeds...");
1302 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1303 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1304 xmlhttp
.onreadystatechange
=feedlist_callback
;
1309 notify("Please select some feeds first.");
1315 function validatePrefsReset() {
1316 return confirm("Reset to defaults?");
1319 function browseFeeds() {
1321 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1322 xmlhttp
.onreadystatechange
=infobox_callback
;
1327 function feedBrowserSubscribe() {
1329 var list
= document
.getElementById("browseFeedList");
1331 var selected
= new Array();
1333 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1334 var child
= list
.childNodes
[i
];
1335 if (child
.id
&& child
.id
.match("FBROW-")) {
1336 var id
= child
.id
.replace("FBROW-", "");
1338 var cb
= document
.getElementById("FBCHK-" + id
);
1346 if (selected
.length
> 0) {
1348 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1349 param_escape(selected
.toString()), true);
1350 xmlhttp
.onreadystatechange
=feedlist_callback
;
1353 alert("No feeds are selected.");
1357 exception_error("feedBrowserSubscribe", e
);
1361 function updateBigFeedBrowser() {
1363 if (!xmlhttp_ready(xmlhttp
)) {
1364 printLockingError();
1368 p_notify("Loading, please wait...");
1370 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1371 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1376 function browserExpand(id
) {
1378 /* if (feed_to_expand && feed_to_expand != id) {
1379 var d = document.getElementById("BRDET-" + feed_to_expand);
1380 d.style.display = "none";
1383 feed_to_expand
= id
;
1385 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1386 + param_escape(id
), true);
1387 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1391 exception_error("browserExpand", e
);