]>
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;
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');
153 box
.innerHTML
=xmlhttp
.responseText
;
155 shadow
.style
.display
= "block";
157 box
.style
.display
= "block";
164 function prefslist_callback() {
165 var container
= document
.getElementById('prefContent');
166 if (xmlhttp
.readyState
== 4) {
168 container
.innerHTML
=xmlhttp
.responseText
;
174 function gethelp_callback() {
175 var container
= document
.getElementById('prefHelpBox');
176 if (xmlhttp
.readyState
== 4) {
178 container
.innerHTML
= xmlhttp
.responseText
;
179 container
.style
.display
= "block";
185 function notify_callback() {
186 var container
= document
.getElementById('notify');
187 if (xmlhttp
.readyState
== 4) {
188 container
.innerHTML
=xmlhttp
.responseText
;
192 function updateFeedList(sort_key
) {
194 if (!xmlhttp_ready(xmlhttp
)) {
199 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
201 p_notify("Loading, please wait...");
203 var feed_search
= document
.getElementById("feed_search");
205 if (feed_search
) { search
= feed_search
.value
; }
207 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
208 "&sort=" + param_escape(sort_key
) +
209 "&search=" + param_escape(search
), true);
210 xmlhttp
.onreadystatechange
=feedlist_callback
;
215 function updateUsersList() {
217 if (!xmlhttp_ready(xmlhttp
)) {
222 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
224 p_notify("Loading, please wait...");
226 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
227 xmlhttp
.onreadystatechange
=userlist_callback
;
232 function addLabel() {
234 if (!xmlhttp_ready(xmlhttp
)) {
239 var sqlexp
= document
.getElementById("ladd_expr");
241 if (sqlexp
.value
.length
== 0) {
242 notify("Missing SQL expression.");
244 notify("Adding label...");
246 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
247 param_escape(sqlexp
.value
), true);
249 xmlhttp
.onreadystatechange
=labellist_callback
;
257 function addFilter() {
259 if (!xmlhttp_ready(xmlhttp
)) {
264 var regexp
= document
.getElementById("fadd_regexp");
265 var match
= document
.getElementById("fadd_match");
266 var feed
= document
.getElementById("fadd_feed");
267 var action
= document
.getElementById("fadd_action");
269 if (regexp
.value
.length
== 0) {
270 notify("Missing filter expression.");
272 notify("Adding filter...");
274 var v_match
= match
[match
.selectedIndex
].text
;
275 var feed_id
= feed
[feed
.selectedIndex
].id
;
276 var action_id
= action
[action
.selectedIndex
].id
;
278 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
279 param_escape(regexp
.value
) + "&match=" + v_match
+
280 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
282 xmlhttp
.onreadystatechange
=filterlist_callback
;
292 if (!xmlhttp_ready(xmlhttp
)) {
297 var link
= document
.getElementById("fadd_link");
299 if (link
.value
.length
== 0) {
300 notify("Missing feed URL.");
302 notify("Adding feed...");
304 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
305 param_escape(link
.value
), true);
306 xmlhttp
.onreadystatechange
=feedlist_callback
;
315 function addFeedCat() {
317 if (!xmlhttp_ready(xmlhttp
)) {
322 var cat
= document
.getElementById("fadd_cat");
324 if (cat
.value
.length
== 0) {
325 notify("Missing feed category.");
327 notify("Adding feed category...");
329 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
330 param_escape(cat
.value
), true);
331 xmlhttp
.onreadystatechange
=feedlist_callback
;
341 if (!xmlhttp_ready(xmlhttp
)) {
346 var sqlexp
= document
.getElementById("uadd_box");
348 if (sqlexp
.value
.length
== 0) {
349 notify("Missing user login.");
351 notify("Adding user...");
353 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
354 param_escape(sqlexp
.value
), true);
356 xmlhttp
.onreadystatechange
=userlist_callback
;
364 function editLabel(id
) {
366 if (!xmlhttp_ready(xmlhttp
)) {
373 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
374 param_escape(id
), true);
375 xmlhttp
.onreadystatechange
=labellist_callback
;
380 function editUser(id
) {
382 if (!xmlhttp_ready(xmlhttp
)) {
389 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
390 param_escape(id
), true);
391 xmlhttp
.onreadystatechange
=userlist_callback
;
396 function editFilter(id
) {
398 if (!xmlhttp_ready(xmlhttp
)) {
405 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
406 param_escape(id
), true);
407 xmlhttp
.onreadystatechange
=filterlist_callback
;
412 function editFeed(feed
) {
414 // notify("Editing feed...");
416 if (!xmlhttp_ready(xmlhttp
)) {
423 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
424 param_escape(feed), true);
425 xmlhttp.onreadystatechange=feedlist_callback;
426 xmlhttp.send(null); */
428 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
429 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
432 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
434 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
435 param_escape(active_feed
), true);
437 xmlhttp
.onreadystatechange
=infobox_callback
;
442 function editFeedCat(cat
) {
444 if (!xmlhttp_ready(xmlhttp
)) {
449 active_feed_cat
= cat
;
451 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
452 param_escape(cat
), true);
453 xmlhttp
.onreadystatechange
=feedlist_callback
;
458 function getSelectedLabels() {
459 return getSelectedTableRowIds("prefLabelList", "LILRR");
462 function getSelectedUsers() {
463 return getSelectedTableRowIds("prefUserList", "UMRR");
466 function getSelectedFeeds() {
467 return getSelectedTableRowIds("prefFeedList", "FEEDR");
470 function getSelectedFilters() {
471 return getSelectedTableRowIds("prefFilterList", "FILRR");
474 function getSelectedFeedCats() {
475 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
479 function readSelectedFeeds(read
) {
481 if (!xmlhttp_ready(xmlhttp
)) {
486 var sel_rows
= getSelectedFeeds();
488 if (sel_rows
.length
> 0) {
496 notify("Marking selected feeds as " + op
+ "...");
498 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=" + op
+ "&ids="+
499 param_escape(sel_rows
.toString()), true);
500 xmlhttp
.onreadystatechange
=notify_callback
;
505 notify("Please select some feeds first.");
510 function removeSelectedLabels() {
512 if (!xmlhttp_ready(xmlhttp
)) {
517 var sel_rows
= getSelectedLabels();
519 if (sel_rows
.length
> 0) {
521 var ok
= confirm("Remove selected labels?");
524 notify("Removing selected labels...");
526 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
527 param_escape(sel_rows
.toString()), true);
528 xmlhttp
.onreadystatechange
=labellist_callback
;
532 notify("Please select some labels first.");
536 function removeSelectedUsers() {
538 if (!xmlhttp_ready(xmlhttp
)) {
543 var sel_rows
= getSelectedUsers();
545 if (sel_rows
.length
> 0) {
547 var ok
= confirm("Remove selected users?");
550 notify("Removing selected users...");
552 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
553 param_escape(sel_rows
.toString()), true);
554 xmlhttp
.onreadystatechange
=userlist_callback
;
559 notify("Please select some labels first.");
563 function removeSelectedFilters() {
565 if (!xmlhttp_ready(xmlhttp
)) {
570 var sel_rows
= getSelectedFilters();
572 if (sel_rows
.length
> 0) {
574 var ok
= confirm("Remove selected filters?");
577 notify("Removing selected filters...");
579 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
580 param_escape(sel_rows
.toString()), true);
581 xmlhttp
.onreadystatechange
=filterlist_callback
;
585 notify("Please select some filters first.");
590 function removeSelectedFeeds() {
592 if (!xmlhttp_ready(xmlhttp
)) {
597 var sel_rows
= getSelectedFeeds();
599 if (sel_rows
.length
> 0) {
601 var ok
= confirm("Remove selected feeds?");
605 notify("Removing selected feeds...");
607 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
608 param_escape(sel_rows
.toString()), true);
609 xmlhttp
.onreadystatechange
=feedlist_callback
;
615 notify("Please select some feeds first.");
621 function removeSelectedFeedCats() {
623 if (!xmlhttp_ready(xmlhttp
)) {
628 var sel_rows
= getSelectedFeedCats();
630 if (sel_rows
.length
> 0) {
632 var ok
= confirm("Remove selected categories?");
635 notify("Removing selected categories...");
637 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
638 param_escape(sel_rows
.toString()), true);
639 xmlhttp
.onreadystatechange
=feedlist_callback
;
645 notify("Please select some feeds first.");
651 function feedEditCancel() {
653 if (!xmlhttp_ready(xmlhttp
)) {
662 notify("Operation cancelled.");
664 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
665 xmlhttp.onreadystatechange=feedlist_callback;
666 xmlhttp.send(null); */
670 function feedCatEditCancel() {
672 if (!xmlhttp_ready(xmlhttp
)) {
677 active_feed_cat
= false;
679 notify("Operation cancelled.");
681 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
682 xmlhttp
.onreadystatechange
=feedlist_callback
;
687 function feedEditSave() {
691 var feed
= active_feed
;
693 if (!xmlhttp_ready(xmlhttp
)) {
698 var link
= document
.getElementById("iedit_link").value
;
699 var title
= document
.getElementById("iedit_title").value
;
700 var upd_intl
= document
.getElementById("iedit_updintl");
702 upd_intl
= upd_intl
[upd_intl
.selectedIndex
].id
;
704 var purge_intl
= document
.getElementById("iedit_purgintl");
706 purge_intl
= purge_intl
[purge_intl
.selectedIndex
].id
;
708 var fcat
= document
.getElementById("iedit_fcat");
710 var is_pvt
= document
.getElementById("iedit_private");
711 var is_rtl
= document
.getElementById("iedit_rtl");
714 is_pvt
= is_pvt
.checked
;
718 is_rtl
= is_rtl
.checked
;
724 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
727 var pfeed
= document
.getElementById("iedit_parent_feed");
728 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
730 if (link
.length
== 0) {
731 notify("Feed link cannot be blank.");
735 if (title
.length
== 0) {
736 notify("Feed title cannot be blank.");
740 var auth_login
= document
.getElementById("iedit_login").value
;
741 var auth_pass
= document
.getElementById("iedit_pass").value
;
745 notify("Saving feed...");
747 var query
= "op=pref-feeds&subop=editSave&id=" +
748 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
749 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
750 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
751 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
752 "&is_pvt=" + param_escape(is_pvt
) + "&is_rtl=" + param_escape(is_rtl
);
754 xmlhttp
.open("POST", "backend.php", true);
755 xmlhttp
.onreadystatechange
=feedlist_callback
;
756 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
760 exception_error("feedEditSave", e
);
764 function feedCatEditSave() {
766 if (!xmlhttp_ready(xmlhttp
)) {
771 notify("Saving category...");
773 var cat_title
= document
.getElementById("iedit_title").value
;
775 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
776 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
778 xmlhttp
.onreadystatechange
=feedlist_callback
;
781 active_feed_cat
= false;
786 function labelTest() {
788 var sqlexp
= document
.getElementById("iedit_expr").value
;
789 var descr
= document
.getElementById("iedit_descr").value
;
791 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
792 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
794 xmlhttp
.onreadystatechange
=infobox_callback
;
799 function displayHelpInfobox(topic_id
) {
801 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
802 param_escape(topic_id
) + "&noheaders=1", true);
804 xmlhttp
.onreadystatechange
=infobox_callback
;
809 function labelEditCancel() {
811 if (!xmlhttp_ready(xmlhttp
)) {
816 active_label
= false;
818 notify("Operation cancelled.");
820 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
821 xmlhttp
.onreadystatechange
=labellist_callback
;
826 function userEditCancel() {
828 if (!xmlhttp_ready(xmlhttp
)) {
835 notify("Operation cancelled.");
837 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
838 xmlhttp
.onreadystatechange
=userlist_callback
;
843 function filterEditCancel() {
845 if (!xmlhttp_ready(xmlhttp
)) {
850 active_filter
= false;
852 notify("Operation cancelled.");
854 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
855 xmlhttp
.onreadystatechange
=filterlist_callback
;
860 function labelEditSave() {
862 var label
= active_label
;
864 if (!xmlhttp_ready(xmlhttp
)) {
869 var sqlexp
= document
.getElementById("iedit_expr").value
;
870 var descr
= document
.getElementById("iedit_descr").value
;
872 // notify("Saving label " + sqlexp + ": " + descr);
874 if (sqlexp
.length
== 0) {
875 notify("SQL expression cannot be blank.");
879 if (descr
.length
== 0) {
880 notify("Caption cannot be blank.");
884 notify("Saving label...");
886 active_label
= false;
888 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
889 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
892 xmlhttp
.onreadystatechange
=labellist_callback
;
897 function userEditSave() {
899 var user
= active_user
;
901 if (!xmlhttp_ready(xmlhttp
)) {
906 var login
= document
.getElementById("iedit_ulogin").value
;
907 var level
= document
.getElementById("iedit_ulevel");
909 level
= level
[level
.selectedIndex
].id
;
911 var email
= document
.getElementById("iedit_email").value
;
913 if (login
.length
== 0) {
914 notify("Login cannot be blank.");
918 if (level
.length
== 0) {
919 notify("User level cannot be blank.");
925 notify("Saving user...");
927 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
928 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
929 "&e=" + param_escape(email
), true);
931 xmlhttp
.onreadystatechange
=userlist_callback
;
937 function filterEditSave() {
939 var filter
= active_filter
;
941 if (!xmlhttp_ready(xmlhttp
)) {
946 var regexp
= document
.getElementById("iedit_regexp").value
;
947 var descr
= document
.getElementById("iedit_descr").value
;
948 var match
= document
.getElementById("iedit_match");
950 var v_match
= match
[match
.selectedIndex
].text
;
952 var feed
= document
.getElementById("iedit_feed");
953 var feed_id
= feed
[feed
.selectedIndex
].id
;
955 var action
= document
.getElementById("iedit_filter_action");
956 var action_id
= action
[action
.selectedIndex
].id
;
958 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
960 if (regexp
.length
== 0) {
961 notify("Filter expression cannot be blank.");
965 active_filter
= false;
967 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
968 filter
+ "&r=" + param_escape(regexp
) + "&d=" + param_escape(descr
) +
969 "&m=" + param_escape(v_match
) + "&fid=" + param_escape(feed_id
) +
970 "&aid=" + param_escape(action_id
), true);
972 notify("Saving filter...");
974 xmlhttp
.onreadystatechange
=filterlist_callback
;
979 function editSelectedLabel() {
980 var rows
= getSelectedLabels();
982 if (rows
.length
== 0) {
983 notify("No labels are selected.");
987 if (rows
.length
> 1) {
988 notify("Please select one label.");
998 function editSelectedUser() {
999 var rows
= getSelectedUsers();
1001 if (rows
.length
== 0) {
1002 notify("No users are selected.");
1006 if (rows
.length
> 1) {
1007 notify("Please select one user.");
1016 function resetSelectedUserPass() {
1017 var rows
= getSelectedUsers();
1019 if (rows
.length
== 0) {
1020 notify("No users are selected.");
1024 if (rows
.length
> 1) {
1025 notify("Please select one user.");
1029 var ok
= confirm("Reset password of selected user?");
1032 notify("Resetting password for selected user...");
1036 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1037 param_escape(id
), true);
1038 xmlhttp
.onreadystatechange
=userlist_callback
;
1043 function selectedUserDetails() {
1045 if (!xmlhttp_ready(xmlhttp
)) {
1046 printLockingError();
1050 var rows
= getSelectedUsers();
1052 if (rows
.length
== 0) {
1053 notify("No users are selected.");
1057 if (rows
.length
> 1) {
1058 notify("Please select one user.");
1066 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1067 xmlhttp
.onreadystatechange
=infobox_callback
;
1072 function selectedFeedDetails() {
1074 if (!xmlhttp_ready(xmlhttp
)) {
1075 printLockingError();
1079 var rows
= getSelectedFeeds();
1081 if (rows
.length
== 0) {
1082 notify("No feeds are selected.");
1086 // if (rows.length > 1) {
1087 // notify("Please select one feed.");
1091 // var id = rows[0];
1095 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1096 param_escape(rows
.toString()), true);
1097 xmlhttp
.onreadystatechange
=infobox_callback
;
1102 function editSelectedFilter() {
1103 var rows
= getSelectedFilters();
1105 if (rows
.length
== 0) {
1106 notify("No filters are selected.");
1110 if (rows
.length
> 1) {
1111 notify("Please select one filter.");
1117 editFilter(rows
[0]);
1122 function editSelectedFeed() {
1123 var rows
= getSelectedFeeds();
1125 if (rows
.length
== 0) {
1126 notify("No feeds are selected.");
1130 if (rows
.length
> 1) {
1131 notify("Please select one feed.");
1141 function editSelectedFeedCat() {
1142 var rows
= getSelectedFeedCats();
1144 if (rows
.length
== 0) {
1145 notify("No categories are selected.");
1149 if (rows
.length
> 1) {
1150 notify("Please select one category.");
1156 editFeedCat(rows
[0]);
1160 function piggie_callback() {
1161 var piggie
= document
.getElementById("piggie");
1163 piggie
.style
.top
= piggie_top
;
1164 piggie
.style
.backgroundColor
= "white";
1165 piggie
.style
.borderWidth
= "1px";
1167 if (piggie_fwd
&& piggie_top
< 0) {
1168 setTimeout("piggie_callback()", 50);
1169 piggie_top
= piggie_top
+ 10;
1170 } else if (piggie_fwd
&& piggie_top
>= 0) {
1172 setTimeout("piggie_callback()", 50);
1173 } else if (!piggie_fwd
&& piggie_top
> -400) {
1174 setTimeout("piggie_callback()", 50);
1175 piggie_top
= piggie_top
- 10;
1176 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1177 piggie
.style
.display
= "none";
1182 var piggie_opacity
= 0;
1184 function piggie2_callback() {
1185 var piggie
= document
.getElementById("piggie");
1186 piggie
.style
.top
= 0;
1187 piggie
.style
.opacity
= piggie_opacity
;
1188 piggie
.style
.backgroundColor
= "transparent";
1189 piggie
.style
.borderWidth
= "0px";
1191 if (piggie_fwd
&& piggie_opacity
< 1) {
1192 setTimeout("piggie2_callback()", 50);
1193 piggie_opacity
= piggie_opacity
+ 0.03;
1194 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1196 setTimeout("piggie2_callback()", 50);
1197 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1198 setTimeout("piggie2_callback()", 50);
1199 piggie_opacity
= piggie_opacity
- 0.03;
1200 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1201 piggie
.style
.display
= "none";
1206 function localPiggieFunction(enable
) {
1208 var piggie
= document
.getElementById("piggie");
1209 piggie
.style
.display
= "block";
1211 if (navigator
.userAgent
.match("Firefox") && Math
.random(1) > 0.5) {
1219 function validateOpmlImport() {
1221 var opml_file
= document
.getElementById("opml_file");
1223 if (opml_file
.value
.length
== 0) {
1224 notify("Please select OPML file to upload.");
1231 function updateFilterList() {
1233 if (!xmlhttp_ready(xmlhttp
)) {
1234 printLockingError();
1238 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1240 p_notify("Loading, please wait...");
1242 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1243 xmlhttp
.onreadystatechange
=filterlist_callback
;
1248 function updateLabelList() {
1250 if (!xmlhttp_ready(xmlhttp
)) {
1251 printLockingError();
1255 p_notify("Loading, please wait...");
1257 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1259 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1260 xmlhttp
.onreadystatechange
=labellist_callback
;
1264 function updatePrefsList() {
1266 if (!xmlhttp_ready(xmlhttp
)) {
1267 printLockingError();
1271 p_notify("Loading, please wait...");
1273 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1274 xmlhttp
.onreadystatechange
=prefslist_callback
;
1279 function selectTab(id
, noupdate
) {
1283 if (!xmlhttp_ready(xmlhttp
)) {
1284 printLockingError();
1290 if (id
== "feedConfig") {
1292 } else if (id
== "filterConfig") {
1294 } else if (id
== "labelConfig") {
1296 } else if (id
== "genConfig") {
1298 } else if (id
== "userConfig") {
1300 } else if (id
== "feedBrowser") {
1301 updateBigFeedBrowser();
1305 var tab
= document
.getElementById(active_tab
+ "Tab");
1308 if (tab
.className
.match("Selected")) {
1309 tab
.className
= "prefsTab";
1313 tab
= document
.getElementById(id
+ "Tab");
1316 if (!tab
.className
.match("Selected")) {
1317 tab
.className
= tab
.className
+ "Selected";
1323 setCookie('ttrss_pref_acttab', active_tab
);
1331 if (arguments
.callee
.done
) return;
1332 arguments
.callee
.done
= true;
1336 document
.getElementById("prefContent").innerHTML
=
1337 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1338 "to function properly. Your browser doesn't seem to support it.";
1342 active_tab
= getCookie("ttrss_pref_acttab");
1343 if (!active_tab
) active_tab
= "genConfig";
1344 selectTab(active_tab
);
1346 document
.onkeydown
= hotkey_handler
;
1349 exception_error("init", e
);
1353 function closeInfoBox() {
1354 var box
= document
.getElementById('infoBox');
1355 var shadow
= document
.getElementById('infoBoxShadow');
1358 shadow
.style
.display
= "none";
1360 box
.style
.display
= "none";
1364 function categorizeSelectedFeeds() {
1366 if (!xmlhttp_ready(xmlhttp
)) {
1367 printLockingError();
1371 var sel_rows
= getSelectedFeeds();
1373 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1374 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1376 if (sel_rows
.length
> 0) {
1378 notify("Changing category of selected feeds...");
1380 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1381 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1382 xmlhttp
.onreadystatechange
=feedlist_callback
;
1387 notify("Please select some feeds first.");
1393 function validatePrefsReset() {
1394 return confirm("Reset to defaults?");
1397 function browseFeeds() {
1399 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1400 xmlhttp
.onreadystatechange
=infobox_callback
;
1405 function feedBrowserSubscribe() {
1407 var list
= document
.getElementById("browseFeedList");
1409 if (!list
) list
= document
.getElementById("browseBigFeedList");
1411 var selected
= new Array();
1413 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1414 var child
= list
.childNodes
[i
];
1415 if (child
.id
&& child
.id
.match("FBROW-")) {
1416 var id
= child
.id
.replace("FBROW-", "");
1418 var cb
= document
.getElementById("FBCHK-" + id
);
1426 if (selected
.length
> 0) {
1428 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1429 param_escape(selected
.toString()), true);
1430 xmlhttp
.onreadystatechange
=feedlist_callback
;
1433 alert("No feeds are selected.");
1437 exception_error("feedBrowserSubscribe", e
);
1441 function updateBigFeedBrowser() {
1443 if (!xmlhttp_ready(xmlhttp
)) {
1444 printLockingError();
1448 p_notify("Loading, please wait...");
1450 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1451 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1456 function browserToggleExpand(id
) {
1458 /* if (feed_to_expand && feed_to_expand != id) {
1459 var d = document.getElementById("BRDET-" + feed_to_expand);
1460 d.style.display = "none";
1463 var d
= document
.getElementById("BRDET-" + id
);
1465 if (d
.style
.display
== "block") {
1466 d
.style
.display
= "none";
1470 feed_to_expand
= id
;
1472 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1473 + param_escape(id
), true);
1474 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1479 exception_error("browserExpand", e
);