]>
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 prefslist_callback() {
149 var container
= document
.getElementById('prefContent');
150 if (xmlhttp
.readyState
== 4) {
152 container
.innerHTML
=xmlhttp
.responseText
;
158 function gethelp_callback() {
159 var container
= document
.getElementById('prefHelpBox');
160 if (xmlhttp
.readyState
== 4) {
162 container
.innerHTML
= xmlhttp
.responseText
;
163 container
.style
.display
= "block";
169 function notify_callback() {
170 var container
= document
.getElementById('notify');
171 if (xmlhttp
.readyState
== 4) {
172 container
.innerHTML
=xmlhttp
.responseText
;
176 function updateFeedList(sort_key
) {
178 if (!xmlhttp_ready(xmlhttp
)) {
183 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
185 p_notify("Loading, please wait...");
187 var feed_search
= document
.getElementById("feed_search");
189 if (feed_search
) { search
= feed_search
.value
; }
191 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
192 "&sort=" + param_escape(sort_key
) +
193 "&search=" + param_escape(search
), true);
194 xmlhttp
.onreadystatechange
=feedlist_callback
;
199 function updateUsersList() {
201 if (!xmlhttp_ready(xmlhttp
)) {
206 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
208 p_notify("Loading, please wait...");
210 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
211 xmlhttp
.onreadystatechange
=userlist_callback
;
216 function addLabel() {
218 if (!xmlhttp_ready(xmlhttp
)) {
223 var sqlexp
= document
.getElementById("ladd_expr");
225 if (sqlexp
.value
.length
== 0) {
226 alert("Can't add label: missing SQL expression.");
228 notify("Adding label...");
230 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
231 param_escape(sqlexp
.value
), true);
233 xmlhttp
.onreadystatechange
=labellist_callback
;
241 function addFilter() {
243 if (!xmlhttp_ready(xmlhttp
)) {
248 var regexp
= document
.getElementById("fadd_regexp");
249 var match
= document
.getElementById("fadd_match");
250 var feed
= document
.getElementById("fadd_feed");
251 var action
= document
.getElementById("fadd_action");
253 if (regexp
.value
.length
== 0) {
254 alert("Can't add filter: missing filter expression.");
256 notify("Adding filter...");
258 var v_match
= match
[match
.selectedIndex
].text
;
259 var feed_id
= feed
[feed
.selectedIndex
].id
;
260 var action_id
= action
[action
.selectedIndex
].id
;
262 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
263 param_escape(regexp
.value
) + "&match=" + v_match
+
264 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
266 xmlhttp
.onreadystatechange
=filterlist_callback
;
276 if (!xmlhttp_ready(xmlhttp
)) {
281 var link
= document
.getElementById("fadd_link");
283 if (link
.value
.length
== 0) {
284 alert("Error: No feed URL given.");
285 } else if (link
.value
.match("http://") == null &&
286 link
.value
.match("https://") == null) {
287 alert("Error: Invalid feed URL.");
289 notify("Adding feed...");
291 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
292 param_escape(link
.value
), true);
293 xmlhttp
.onreadystatechange
=feedlist_callback
;
302 function addFeedCat() {
304 if (!xmlhttp_ready(xmlhttp
)) {
309 var cat
= document
.getElementById("fadd_cat");
311 if (cat
.value
.length
== 0) {
312 alert("Can't add category: no name specified.");
314 notify("Adding feed category...");
316 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
317 param_escape(cat
.value
), true);
318 xmlhttp
.onreadystatechange
=feedlist_callback
;
328 if (!xmlhttp_ready(xmlhttp
)) {
333 var sqlexp
= document
.getElementById("uadd_box");
335 if (sqlexp
.value
.length
== 0) {
336 alert("Can't add user: no login specified.");
338 notify("Adding user...");
340 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
341 param_escape(sqlexp
.value
), true);
343 xmlhttp
.onreadystatechange
=userlist_callback
;
351 function editLabel(id
) {
353 if (!xmlhttp_ready(xmlhttp
)) {
360 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
361 param_escape(id
), true);
362 xmlhttp
.onreadystatechange
=labellist_callback
;
367 function editUser(id
) {
369 if (!xmlhttp_ready(xmlhttp
)) {
376 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
377 param_escape(id
), true);
378 xmlhttp
.onreadystatechange
=userlist_callback
;
383 function editFilter(id
) {
385 if (!xmlhttp_ready(xmlhttp
)) {
392 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
393 param_escape(id
), true);
394 xmlhttp
.onreadystatechange
=filterlist_callback
;
399 function editFeed(feed
) {
401 // notify("Editing feed...");
403 if (!xmlhttp_ready(xmlhttp
)) {
410 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
411 param_escape(feed), true);
412 xmlhttp.onreadystatechange=feedlist_callback;
413 xmlhttp.send(null); */
415 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
416 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
419 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
421 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
422 param_escape(active_feed
), true);
424 xmlhttp
.onreadystatechange
=infobox_callback
;
429 function editFeedCat(cat
) {
431 if (!xmlhttp_ready(xmlhttp
)) {
436 active_feed_cat
= cat
;
438 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
439 param_escape(cat
), true);
440 xmlhttp
.onreadystatechange
=feedlist_callback
;
445 function getSelectedLabels() {
446 return getSelectedTableRowIds("prefLabelList", "LILRR");
449 function getSelectedUsers() {
450 return getSelectedTableRowIds("prefUserList", "UMRR");
453 function getSelectedFeeds() {
454 return getSelectedTableRowIds("prefFeedList", "FEEDR");
457 function getSelectedFilters() {
458 return getSelectedTableRowIds("prefFilterList", "FILRR");
461 function getSelectedFeedCats() {
462 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
466 /*function readSelectedFeeds(read) {
468 if (!xmlhttp_ready(xmlhttp)) {
473 var sel_rows = getSelectedFeeds();
475 if (sel_rows.length > 0) {
483 notify("Marking selected feeds as " + op + "...");
485 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
486 param_escape(sel_rows.toString()), true);
487 xmlhttp.onreadystatechange=notify_callback;
492 alert("No feeds are selected.");
497 function removeSelectedLabels() {
499 if (!xmlhttp_ready(xmlhttp
)) {
504 var sel_rows
= getSelectedLabels();
506 if (sel_rows
.length
> 0) {
508 var ok
= confirm("Remove selected labels?");
511 notify("Removing selected labels...");
513 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
514 param_escape(sel_rows
.toString()), true);
515 xmlhttp
.onreadystatechange
=labellist_callback
;
519 alert("No labels are selected.");
523 function removeSelectedUsers() {
525 if (!xmlhttp_ready(xmlhttp
)) {
530 var sel_rows
= getSelectedUsers();
532 if (sel_rows
.length
> 0) {
534 var ok
= confirm("Remove selected users?");
537 notify("Removing selected users...");
539 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
540 param_escape(sel_rows
.toString()), true);
541 xmlhttp
.onreadystatechange
=userlist_callback
;
546 alert("No users are selected.");
550 function removeSelectedFilters() {
552 if (!xmlhttp_ready(xmlhttp
)) {
557 var sel_rows
= getSelectedFilters();
559 if (sel_rows
.length
> 0) {
561 var ok
= confirm("Remove selected filters?");
564 notify("Removing selected filters...");
566 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
567 param_escape(sel_rows
.toString()), true);
568 xmlhttp
.onreadystatechange
=filterlist_callback
;
572 alert("No filters are selected.");
577 function removeSelectedFeeds() {
579 if (!xmlhttp_ready(xmlhttp
)) {
584 var sel_rows
= getSelectedFeeds();
586 if (sel_rows
.length
> 0) {
588 var ok
= confirm("Remove selected feeds?");
592 notify("Removing selected feeds...");
594 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
595 param_escape(sel_rows
.toString()), true);
596 xmlhttp
.onreadystatechange
=feedlist_callback
;
602 alert("No feeds are selected.");
608 function removeSelectedFeedCats() {
610 if (!xmlhttp_ready(xmlhttp
)) {
615 var sel_rows
= getSelectedFeedCats();
617 if (sel_rows
.length
> 0) {
619 var ok
= confirm("Remove selected categories?");
622 notify("Removing selected categories...");
624 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
625 param_escape(sel_rows
.toString()), true);
626 xmlhttp
.onreadystatechange
=feedlist_callback
;
632 alert("No categories are selected.");
638 function feedEditCancel() {
640 if (!xmlhttp_ready(xmlhttp
)) {
649 // notify("Operation cancelled.");
651 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
652 xmlhttp.onreadystatechange=feedlist_callback;
653 xmlhttp.send(null); */
657 function feedCatEditCancel() {
659 if (!xmlhttp_ready(xmlhttp
)) {
664 active_feed_cat
= false;
666 // notify("Operation cancelled.");
668 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
669 xmlhttp
.onreadystatechange
=feedlist_callback
;
674 function feedEditSave() {
678 var feed
= active_feed
;
680 if (!xmlhttp_ready(xmlhttp
)) {
685 var link
= document
.getElementById("iedit_link").value
;
686 var title
= document
.getElementById("iedit_title").value
;
687 var upd_intl
= document
.getElementById("iedit_updintl");
689 upd_intl
= upd_intl
[upd_intl
.selectedIndex
].id
;
691 var purge_intl
= document
.getElementById("iedit_purgintl");
693 purge_intl
= purge_intl
[purge_intl
.selectedIndex
].id
;
695 var fcat
= document
.getElementById("iedit_fcat");
697 var is_pvt
= document
.getElementById("iedit_private");
698 var is_rtl
= document
.getElementById("iedit_rtl");
701 is_pvt
= is_pvt
.checked
;
705 is_rtl
= is_rtl
.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
) + "&is_rtl=" + param_escape(is_rtl
);
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");
896 level
= level
[level
.selectedIndex
].id
;
898 var email
= document
.getElementById("iedit_email").value
;
900 if (login
.length
== 0) {
901 notify("Login cannot be blank.");
905 if (level
.length
== 0) {
906 notify("User level cannot be blank.");
912 notify("Saving user...");
914 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
915 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
916 "&e=" + param_escape(email
), true);
918 xmlhttp
.onreadystatechange
=userlist_callback
;
924 function filterEditSave() {
926 var filter
= active_filter
;
928 if (!xmlhttp_ready(xmlhttp
)) {
933 var regexp
= document
.getElementById("iedit_regexp").value
;
934 var match
= document
.getElementById("iedit_match");
936 var v_match
= match
[match
.selectedIndex
].text
;
938 var feed
= document
.getElementById("iedit_feed");
939 var feed_id
= feed
[feed
.selectedIndex
].id
;
941 var action
= document
.getElementById("iedit_filter_action");
942 var action_id
= action
[action
.selectedIndex
].id
;
944 if (regexp
.length
== 0) {
945 alert("Can't save filter: match expression is blank.");
949 active_filter
= false;
951 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
952 filter
+ "&r=" + param_escape(regexp
) + "&m=" + param_escape(v_match
) +
953 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
955 notify("Saving filter...");
957 xmlhttp
.onreadystatechange
=filterlist_callback
;
962 function editSelectedLabel() {
963 var rows
= getSelectedLabels();
965 if (rows
.length
== 0) {
966 alert("No labels are selected.");
970 if (rows
.length
> 1) {
971 alert("Please select only one label.");
981 function editSelectedUser() {
982 var rows
= getSelectedUsers();
984 if (rows
.length
== 0) {
985 alert("No users are selected.");
989 if (rows
.length
> 1) {
990 alert("Please select only one user.");
999 function resetSelectedUserPass() {
1000 var rows
= getSelectedUsers();
1002 if (rows
.length
== 0) {
1003 alert("No users are selected.");
1007 if (rows
.length
> 1) {
1008 alert("Please select only one user.");
1012 var ok
= confirm("Reset password of selected user?");
1015 notify("Resetting password for selected user...");
1019 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1020 param_escape(id
), true);
1021 xmlhttp
.onreadystatechange
=userlist_callback
;
1026 function selectedUserDetails() {
1028 if (!xmlhttp_ready(xmlhttp
)) {
1029 printLockingError();
1033 var rows
= getSelectedUsers();
1035 if (rows
.length
== 0) {
1036 alert("No users are selected.");
1040 if (rows
.length
> 1) {
1041 alert("Please select only one user.");
1049 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1050 xmlhttp
.onreadystatechange
=infobox_callback
;
1055 function selectedFeedDetails() {
1057 if (!xmlhttp_ready(xmlhttp
)) {
1058 printLockingError();
1062 var rows
= getSelectedFeeds();
1064 if (rows
.length
== 0) {
1065 alert("No feeds are selected.");
1069 if (rows
.length
> 1) {
1070 notify("Please select only one feed.");
1074 // var id = rows[0];
1078 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1079 param_escape(rows
.toString()), true);
1080 xmlhttp
.onreadystatechange
=infobox_callback
;
1085 function editSelectedFilter() {
1086 var rows
= getSelectedFilters();
1088 if (rows
.length
== 0) {
1089 alert("No filters are selected.");
1093 if (rows
.length
> 1) {
1094 alert("Please select only one filter.");
1100 editFilter(rows
[0]);
1105 function editSelectedFeed() {
1106 var rows
= getSelectedFeeds();
1108 if (rows
.length
== 0) {
1109 notify("No feeds are selected.");
1113 if (rows
.length
> 1) {
1114 notify("Please select one feed.");
1124 function editSelectedFeedCat() {
1125 var rows
= getSelectedFeedCats();
1127 if (rows
.length
== 0) {
1128 alert("No categories are selected.");
1132 if (rows
.length
> 1) {
1133 alert("Please select only one category.");
1139 editFeedCat(rows
[0]);
1143 function piggie_callback() {
1144 var piggie
= document
.getElementById("piggie");
1146 piggie
.style
.top
= piggie_top
;
1147 piggie
.style
.backgroundColor
= "white";
1148 piggie
.style
.borderWidth
= "1px";
1150 if (piggie_fwd
&& piggie_top
< 0) {
1151 setTimeout("piggie_callback()", 50);
1152 piggie_top
= piggie_top
+ 10;
1153 } else if (piggie_fwd
&& piggie_top
>= 0) {
1155 setTimeout("piggie_callback()", 50);
1156 } else if (!piggie_fwd
&& piggie_top
> -400) {
1157 setTimeout("piggie_callback()", 50);
1158 piggie_top
= piggie_top
- 10;
1159 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1160 piggie
.style
.display
= "none";
1165 var piggie_opacity
= 0;
1167 function piggie2_callback() {
1168 var piggie
= document
.getElementById("piggie");
1169 piggie
.style
.top
= 0;
1170 piggie
.style
.opacity
= piggie_opacity
;
1171 piggie
.style
.backgroundColor
= "transparent";
1172 piggie
.style
.borderWidth
= "0px";
1174 if (piggie_fwd
&& piggie_opacity
< 1) {
1175 setTimeout("piggie2_callback()", 50);
1176 piggie_opacity
= piggie_opacity
+ 0.03;
1177 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1179 setTimeout("piggie2_callback()", 50);
1180 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1181 setTimeout("piggie2_callback()", 50);
1182 piggie_opacity
= piggie_opacity
- 0.03;
1183 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1184 piggie
.style
.display
= "none";
1189 function localPiggieFunction(enable
) {
1191 var piggie
= document
.getElementById("piggie");
1192 piggie
.style
.display
= "block";
1194 if (navigator
.userAgent
.match("Firefox") && Math
.random(1) > 0.5) {
1202 function validateOpmlImport() {
1204 var opml_file
= document
.getElementById("opml_file");
1206 if (opml_file
.value
.length
== 0) {
1207 alert("No OPML file to upload.");
1214 function updateFilterList() {
1216 if (!xmlhttp_ready(xmlhttp
)) {
1217 printLockingError();
1221 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1223 p_notify("Loading, please wait...");
1225 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1226 xmlhttp
.onreadystatechange
=filterlist_callback
;
1231 function updateLabelList() {
1233 if (!xmlhttp_ready(xmlhttp
)) {
1234 printLockingError();
1238 p_notify("Loading, please wait...");
1240 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1242 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1243 xmlhttp
.onreadystatechange
=labellist_callback
;
1247 function updatePrefsList() {
1249 if (!xmlhttp_ready(xmlhttp
)) {
1250 printLockingError();
1254 p_notify("Loading, please wait...");
1256 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1257 xmlhttp
.onreadystatechange
=prefslist_callback
;
1262 function selectTab(id
, noupdate
) {
1266 if (!xmlhttp_ready(xmlhttp
)) {
1267 printLockingError();
1273 if (id
== "feedConfig") {
1275 } else if (id
== "filterConfig") {
1277 } else if (id
== "labelConfig") {
1279 } else if (id
== "genConfig") {
1281 } else if (id
== "userConfig") {
1283 } else if (id
== "feedBrowser") {
1284 updateBigFeedBrowser();
1288 var tab
= document
.getElementById(active_tab
+ "Tab");
1291 if (tab
.className
.match("Selected")) {
1292 tab
.className
= "prefsTab";
1296 tab
= document
.getElementById(id
+ "Tab");
1299 if (!tab
.className
.match("Selected")) {
1300 tab
.className
= tab
.className
+ "Selected";
1306 setCookie('ttrss_pref_acttab', active_tab
);
1314 if (arguments
.callee
.done
) return;
1315 arguments
.callee
.done
= true;
1319 document
.getElementById("prefContent").innerHTML
=
1320 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1321 "to function properly. Your browser doesn't seem to support it.";
1325 active_tab
= getCookie("ttrss_pref_acttab");
1326 if (!active_tab
) active_tab
= "genConfig";
1327 selectTab(active_tab
);
1329 document
.onkeydown
= hotkey_handler
;
1332 exception_error("init", e
);
1336 function categorizeSelectedFeeds() {
1338 if (!xmlhttp_ready(xmlhttp
)) {
1339 printLockingError();
1343 var sel_rows
= getSelectedFeeds();
1345 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1346 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1348 if (sel_rows
.length
> 0) {
1350 notify("Changing category of selected feeds...");
1352 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1353 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1354 xmlhttp
.onreadystatechange
=feedlist_callback
;
1359 alert("No feeds are selected.");
1365 function validatePrefsReset() {
1366 return confirm("Reset to defaults?");
1369 function browseFeeds(limit
) {
1371 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1372 xmlhttp
.onreadystatechange
=infobox_callback
;
1377 function feedBrowserSubscribe() {
1379 var list
= document
.getElementById("browseFeedList");
1381 if (!list
) list
= document
.getElementById("browseBigFeedList");
1383 var selected
= new Array();
1385 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1386 var child
= list
.childNodes
[i
];
1387 if (child
.id
&& child
.id
.match("FBROW-")) {
1388 var id
= child
.id
.replace("FBROW-", "");
1390 var cb
= document
.getElementById("FBCHK-" + id
);
1398 if (selected
.length
> 0) {
1400 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1401 param_escape(selected
.toString()), true);
1402 xmlhttp
.onreadystatechange
=feedlist_callback
;
1405 alert("No feeds are selected.");
1409 exception_error("feedBrowserSubscribe", e
);
1413 function updateBigFeedBrowser(limit
) {
1415 if (!xmlhttp_ready(xmlhttp
)) {
1416 printLockingError();
1420 p_notify("Loading, please wait...");
1422 var query
= "backend.php?op=pref-feed-browser";
1424 var limit_sel
= document
.getElementById("feedBrowserLimit");
1427 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1428 query
= query
+ "&limit=" + param_escape(limit
);
1431 xmlhttp
.open("GET", query
, true);
1432 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1436 function browserToggleExpand(id
) {
1438 /* if (feed_to_expand && feed_to_expand != id) {
1439 var d = document.getElementById("BRDET-" + feed_to_expand);
1440 d.style.display = "none";
1443 var d
= document
.getElementById("BRDET-" + id
);
1445 if (d
.style
.display
== "block") {
1446 d
.style
.display
= "none";
1450 feed_to_expand
= id
;
1452 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1453 + param_escape(id
), true);
1454 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1459 exception_error("browserExpand", e
);
1463 function validateNewPassword(form
) {
1464 if (form
.OLD_PASSWORD
.value
== "") {
1465 alert("Current password cannot be blank");
1468 if (form
.NEW_PASSWORD
.value
== "") {
1469 alert("New password cannot be blank");