]>
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 alert("Can't add label: 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 alert("Can't add filter: 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 alert("Can't add feed: 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 alert("Can't add category: no name specified.");
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 alert("Can't add user: no login specified.");
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 alert("No feeds are selected.");
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 alert("No labels are selected.");
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 alert("No users are selected.");
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 alert("No filters are selected.");
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 alert("No feeds are selected.");
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 alert("No categories are selected.");
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 match
= document
.getElementById("iedit_match");
949 var v_match
= match
[match
.selectedIndex
].text
;
951 var feed
= document
.getElementById("iedit_feed");
952 var feed_id
= feed
[feed
.selectedIndex
].id
;
954 var action
= document
.getElementById("iedit_filter_action");
955 var action_id
= action
[action
.selectedIndex
].id
;
957 if (regexp
.length
== 0) {
958 alert("Can't save filter: match expression is blank.");
962 active_filter
= false;
964 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
965 filter
+ "&r=" + param_escape(regexp
) + "&m=" + param_escape(v_match
) +
966 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
968 notify("Saving filter...");
970 xmlhttp
.onreadystatechange
=filterlist_callback
;
975 function editSelectedLabel() {
976 var rows
= getSelectedLabels();
978 if (rows
.length
== 0) {
979 alert("No labels are selected.");
983 if (rows
.length
> 1) {
984 alert("Please select only one label.");
994 function editSelectedUser() {
995 var rows
= getSelectedUsers();
997 if (rows
.length
== 0) {
998 alert("No users are selected.");
1002 if (rows
.length
> 1) {
1003 alert("Please select only one user.");
1012 function resetSelectedUserPass() {
1013 var rows
= getSelectedUsers();
1015 if (rows
.length
== 0) {
1016 alert("No users are selected.");
1020 if (rows
.length
> 1) {
1021 alert("Please select only one user.");
1025 var ok
= confirm("Reset password of selected user?");
1028 notify("Resetting password for selected user...");
1032 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1033 param_escape(id
), true);
1034 xmlhttp
.onreadystatechange
=userlist_callback
;
1039 function selectedUserDetails() {
1041 if (!xmlhttp_ready(xmlhttp
)) {
1042 printLockingError();
1046 var rows
= getSelectedUsers();
1048 if (rows
.length
== 0) {
1049 alert("No users are selected.");
1053 if (rows
.length
> 1) {
1054 alert("Please select only one user.");
1062 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1063 xmlhttp
.onreadystatechange
=infobox_callback
;
1068 function selectedFeedDetails() {
1070 if (!xmlhttp_ready(xmlhttp
)) {
1071 printLockingError();
1075 var rows
= getSelectedFeeds();
1077 if (rows
.length
== 0) {
1078 alert("No feeds are selected.");
1082 if (rows
.length
> 1) {
1083 notify("Please select only one feed.");
1087 // var id = rows[0];
1091 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1092 param_escape(rows
.toString()), true);
1093 xmlhttp
.onreadystatechange
=infobox_callback
;
1098 function editSelectedFilter() {
1099 var rows
= getSelectedFilters();
1101 if (rows
.length
== 0) {
1102 alert("No filters are selected.");
1106 if (rows
.length
> 1) {
1107 alert("Please select only one filter.");
1113 editFilter(rows
[0]);
1118 function editSelectedFeed() {
1119 var rows
= getSelectedFeeds();
1121 if (rows
.length
== 0) {
1122 notify("No feeds are selected.");
1126 if (rows
.length
> 1) {
1127 notify("Please select one feed.");
1137 function editSelectedFeedCat() {
1138 var rows
= getSelectedFeedCats();
1140 if (rows
.length
== 0) {
1141 alert("No categories are selected.");
1145 if (rows
.length
> 1) {
1146 alert("Please select only one category.");
1152 editFeedCat(rows
[0]);
1156 function piggie_callback() {
1157 var piggie
= document
.getElementById("piggie");
1159 piggie
.style
.top
= piggie_top
;
1160 piggie
.style
.backgroundColor
= "white";
1161 piggie
.style
.borderWidth
= "1px";
1163 if (piggie_fwd
&& piggie_top
< 0) {
1164 setTimeout("piggie_callback()", 50);
1165 piggie_top
= piggie_top
+ 10;
1166 } else if (piggie_fwd
&& piggie_top
>= 0) {
1168 setTimeout("piggie_callback()", 50);
1169 } else if (!piggie_fwd
&& piggie_top
> -400) {
1170 setTimeout("piggie_callback()", 50);
1171 piggie_top
= piggie_top
- 10;
1172 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1173 piggie
.style
.display
= "none";
1178 var piggie_opacity
= 0;
1180 function piggie2_callback() {
1181 var piggie
= document
.getElementById("piggie");
1182 piggie
.style
.top
= 0;
1183 piggie
.style
.opacity
= piggie_opacity
;
1184 piggie
.style
.backgroundColor
= "transparent";
1185 piggie
.style
.borderWidth
= "0px";
1187 if (piggie_fwd
&& piggie_opacity
< 1) {
1188 setTimeout("piggie2_callback()", 50);
1189 piggie_opacity
= piggie_opacity
+ 0.03;
1190 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1192 setTimeout("piggie2_callback()", 50);
1193 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1194 setTimeout("piggie2_callback()", 50);
1195 piggie_opacity
= piggie_opacity
- 0.03;
1196 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1197 piggie
.style
.display
= "none";
1202 function localPiggieFunction(enable
) {
1204 var piggie
= document
.getElementById("piggie");
1205 piggie
.style
.display
= "block";
1207 if (navigator
.userAgent
.match("Firefox") && Math
.random(1) > 0.5) {
1215 function validateOpmlImport() {
1217 var opml_file
= document
.getElementById("opml_file");
1219 if (opml_file
.value
.length
== 0) {
1220 alert("No OPML file to upload.");
1227 function updateFilterList() {
1229 if (!xmlhttp_ready(xmlhttp
)) {
1230 printLockingError();
1234 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1236 p_notify("Loading, please wait...");
1238 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1239 xmlhttp
.onreadystatechange
=filterlist_callback
;
1244 function updateLabelList() {
1246 if (!xmlhttp_ready(xmlhttp
)) {
1247 printLockingError();
1251 p_notify("Loading, please wait...");
1253 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1255 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1256 xmlhttp
.onreadystatechange
=labellist_callback
;
1260 function updatePrefsList() {
1262 if (!xmlhttp_ready(xmlhttp
)) {
1263 printLockingError();
1267 p_notify("Loading, please wait...");
1269 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1270 xmlhttp
.onreadystatechange
=prefslist_callback
;
1275 function selectTab(id
, noupdate
) {
1279 if (!xmlhttp_ready(xmlhttp
)) {
1280 printLockingError();
1286 if (id
== "feedConfig") {
1288 } else if (id
== "filterConfig") {
1290 } else if (id
== "labelConfig") {
1292 } else if (id
== "genConfig") {
1294 } else if (id
== "userConfig") {
1296 } else if (id
== "feedBrowser") {
1297 updateBigFeedBrowser();
1301 var tab
= document
.getElementById(active_tab
+ "Tab");
1304 if (tab
.className
.match("Selected")) {
1305 tab
.className
= "prefsTab";
1309 tab
= document
.getElementById(id
+ "Tab");
1312 if (!tab
.className
.match("Selected")) {
1313 tab
.className
= tab
.className
+ "Selected";
1319 setCookie('ttrss_pref_acttab', active_tab
);
1327 if (arguments
.callee
.done
) return;
1328 arguments
.callee
.done
= true;
1332 document
.getElementById("prefContent").innerHTML
=
1333 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1334 "to function properly. Your browser doesn't seem to support it.";
1338 active_tab
= getCookie("ttrss_pref_acttab");
1339 if (!active_tab
) active_tab
= "genConfig";
1340 selectTab(active_tab
);
1342 document
.onkeydown
= hotkey_handler
;
1345 exception_error("init", e
);
1349 function closeInfoBox() {
1350 var box
= document
.getElementById('infoBox');
1351 var shadow
= document
.getElementById('infoBoxShadow');
1354 shadow
.style
.display
= "none";
1356 box
.style
.display
= "none";
1360 function categorizeSelectedFeeds() {
1362 if (!xmlhttp_ready(xmlhttp
)) {
1363 printLockingError();
1367 var sel_rows
= getSelectedFeeds();
1369 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1370 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1372 if (sel_rows
.length
> 0) {
1374 notify("Changing category of selected feeds...");
1376 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1377 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1378 xmlhttp
.onreadystatechange
=feedlist_callback
;
1383 alert("No feeds are selected.");
1389 function validatePrefsReset() {
1390 return confirm("Reset to defaults?");
1393 function browseFeeds() {
1395 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1396 xmlhttp
.onreadystatechange
=infobox_callback
;
1401 function feedBrowserSubscribe() {
1403 var list
= document
.getElementById("browseFeedList");
1405 if (!list
) list
= document
.getElementById("browseBigFeedList");
1407 var selected
= new Array();
1409 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1410 var child
= list
.childNodes
[i
];
1411 if (child
.id
&& child
.id
.match("FBROW-")) {
1412 var id
= child
.id
.replace("FBROW-", "");
1414 var cb
= document
.getElementById("FBCHK-" + id
);
1422 if (selected
.length
> 0) {
1424 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1425 param_escape(selected
.toString()), true);
1426 xmlhttp
.onreadystatechange
=feedlist_callback
;
1429 alert("No feeds are selected.");
1433 exception_error("feedBrowserSubscribe", e
);
1437 function updateBigFeedBrowser() {
1439 if (!xmlhttp_ready(xmlhttp
)) {
1440 printLockingError();
1444 p_notify("Loading, please wait...");
1446 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1447 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1452 function browserToggleExpand(id
) {
1454 /* if (feed_to_expand && feed_to_expand != id) {
1455 var d = document.getElementById("BRDET-" + feed_to_expand);
1456 d.style.display = "none";
1459 var d
= document
.getElementById("BRDET-" + id
);
1461 if (d
.style
.display
== "block") {
1462 d
.style
.display
= "none";
1466 feed_to_expand
= id
;
1468 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1469 + param_escape(id
), true);
1470 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1475 exception_error("browserExpand", e
);