]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
1f74ae83d41bf7a9c83a630fdf908d15d75f4e74
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";
156 center_element(shadow
);
158 box
.style
.display
= "block";
165 function prefslist_callback() {
166 var container
= document
.getElementById('prefContent');
167 if (xmlhttp
.readyState
== 4) {
169 container
.innerHTML
=xmlhttp
.responseText
;
175 function gethelp_callback() {
176 var container
= document
.getElementById('prefHelpBox');
177 if (xmlhttp
.readyState
== 4) {
179 container
.innerHTML
= xmlhttp
.responseText
;
180 container
.style
.display
= "block";
186 function notify_callback() {
187 var container
= document
.getElementById('notify');
188 if (xmlhttp
.readyState
== 4) {
189 container
.innerHTML
=xmlhttp
.responseText
;
193 function updateFeedList(sort_key
) {
195 if (!xmlhttp_ready(xmlhttp
)) {
200 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
202 p_notify("Loading, please wait...");
204 var feed_search
= document
.getElementById("feed_search");
206 if (feed_search
) { search
= feed_search
.value
; }
208 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
209 "&sort=" + param_escape(sort_key
) +
210 "&search=" + param_escape(search
), true);
211 xmlhttp
.onreadystatechange
=feedlist_callback
;
216 function updateUsersList() {
218 if (!xmlhttp_ready(xmlhttp
)) {
223 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
225 p_notify("Loading, please wait...");
227 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
228 xmlhttp
.onreadystatechange
=userlist_callback
;
233 function addLabel() {
235 if (!xmlhttp_ready(xmlhttp
)) {
240 var sqlexp
= document
.getElementById("ladd_expr");
242 if (sqlexp
.value
.length
== 0) {
243 notify("Missing SQL expression.");
245 notify("Adding label...");
247 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
248 param_escape(sqlexp
.value
), true);
250 xmlhttp
.onreadystatechange
=labellist_callback
;
258 function addFilter() {
260 if (!xmlhttp_ready(xmlhttp
)) {
265 var regexp
= document
.getElementById("fadd_regexp");
266 var match
= document
.getElementById("fadd_match");
267 var feed
= document
.getElementById("fadd_feed");
268 var action
= document
.getElementById("fadd_action");
270 if (regexp
.value
.length
== 0) {
271 notify("Missing filter expression.");
273 notify("Adding filter...");
275 var v_match
= match
[match
.selectedIndex
].text
;
276 var feed_id
= feed
[feed
.selectedIndex
].id
;
277 var action_id
= action
[action
.selectedIndex
].id
;
279 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
280 param_escape(regexp
.value
) + "&match=" + v_match
+
281 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
283 xmlhttp
.onreadystatechange
=filterlist_callback
;
293 if (!xmlhttp_ready(xmlhttp
)) {
298 var link
= document
.getElementById("fadd_link");
300 if (link
.value
.length
== 0) {
301 notify("Missing feed URL.");
303 notify("Adding feed...");
305 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
306 param_escape(link
.value
), true);
307 xmlhttp
.onreadystatechange
=feedlist_callback
;
316 function addFeedCat() {
318 if (!xmlhttp_ready(xmlhttp
)) {
323 var cat
= document
.getElementById("fadd_cat");
325 if (cat
.value
.length
== 0) {
326 notify("Missing feed category.");
328 notify("Adding feed category...");
330 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
331 param_escape(cat
.value
), true);
332 xmlhttp
.onreadystatechange
=feedlist_callback
;
342 if (!xmlhttp_ready(xmlhttp
)) {
347 var sqlexp
= document
.getElementById("uadd_box");
349 if (sqlexp
.value
.length
== 0) {
350 notify("Missing user login.");
352 notify("Adding user...");
354 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
355 param_escape(sqlexp
.value
), true);
357 xmlhttp
.onreadystatechange
=userlist_callback
;
365 function editLabel(id
) {
367 if (!xmlhttp_ready(xmlhttp
)) {
374 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
375 param_escape(id
), true);
376 xmlhttp
.onreadystatechange
=labellist_callback
;
381 function editUser(id
) {
383 if (!xmlhttp_ready(xmlhttp
)) {
390 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
391 param_escape(id
), true);
392 xmlhttp
.onreadystatechange
=userlist_callback
;
397 function editFilter(id
) {
399 if (!xmlhttp_ready(xmlhttp
)) {
406 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
407 param_escape(id
), true);
408 xmlhttp
.onreadystatechange
=filterlist_callback
;
413 function editFeed(feed
) {
415 // notify("Editing feed...");
417 if (!xmlhttp_ready(xmlhttp
)) {
424 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
425 param_escape(feed), true);
426 xmlhttp.onreadystatechange=feedlist_callback;
427 xmlhttp.send(null); */
429 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
430 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
433 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
435 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
436 param_escape(active_feed
), true);
438 xmlhttp
.onreadystatechange
=infobox_callback
;
443 function editFeedCat(cat
) {
445 if (!xmlhttp_ready(xmlhttp
)) {
450 active_feed_cat
= cat
;
452 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
453 param_escape(cat
), true);
454 xmlhttp
.onreadystatechange
=feedlist_callback
;
459 function getSelectedLabels() {
460 return getSelectedTableRowIds("prefLabelList", "LILRR");
463 function getSelectedUsers() {
464 return getSelectedTableRowIds("prefUserList", "UMRR");
467 function getSelectedFeeds() {
468 return getSelectedTableRowIds("prefFeedList", "FEEDR");
471 function getSelectedFilters() {
472 return getSelectedTableRowIds("prefFilterList", "FILRR");
475 function getSelectedFeedCats() {
476 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
480 function readSelectedFeeds(read
) {
482 if (!xmlhttp_ready(xmlhttp
)) {
487 var sel_rows
= getSelectedFeeds();
489 if (sel_rows
.length
> 0) {
497 notify("Marking selected feeds as " + op
+ "...");
499 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=" + op
+ "&ids="+
500 param_escape(sel_rows
.toString()), true);
501 xmlhttp
.onreadystatechange
=notify_callback
;
506 notify("Please select some feeds first.");
511 function removeSelectedLabels() {
513 if (!xmlhttp_ready(xmlhttp
)) {
518 var sel_rows
= getSelectedLabels();
520 if (sel_rows
.length
> 0) {
522 var ok
= confirm("Remove selected labels?");
525 notify("Removing selected labels...");
527 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
528 param_escape(sel_rows
.toString()), true);
529 xmlhttp
.onreadystatechange
=labellist_callback
;
533 notify("Please select some labels first.");
537 function removeSelectedUsers() {
539 if (!xmlhttp_ready(xmlhttp
)) {
544 var sel_rows
= getSelectedUsers();
546 if (sel_rows
.length
> 0) {
548 var ok
= confirm("Remove selected users?");
551 notify("Removing selected users...");
553 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
554 param_escape(sel_rows
.toString()), true);
555 xmlhttp
.onreadystatechange
=userlist_callback
;
560 notify("Please select some labels first.");
564 function removeSelectedFilters() {
566 if (!xmlhttp_ready(xmlhttp
)) {
571 var sel_rows
= getSelectedFilters();
573 if (sel_rows
.length
> 0) {
575 var ok
= confirm("Remove selected filters?");
578 notify("Removing selected filters...");
580 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
581 param_escape(sel_rows
.toString()), true);
582 xmlhttp
.onreadystatechange
=filterlist_callback
;
586 notify("Please select some filters first.");
591 function removeSelectedFeeds() {
593 if (!xmlhttp_ready(xmlhttp
)) {
598 var sel_rows
= getSelectedFeeds();
600 if (sel_rows
.length
> 0) {
602 var ok
= confirm("Remove selected feeds?");
606 notify("Removing selected feeds...");
608 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
609 param_escape(sel_rows
.toString()), true);
610 xmlhttp
.onreadystatechange
=feedlist_callback
;
616 notify("Please select some feeds first.");
622 function removeSelectedFeedCats() {
624 if (!xmlhttp_ready(xmlhttp
)) {
629 var sel_rows
= getSelectedFeedCats();
631 if (sel_rows
.length
> 0) {
633 var ok
= confirm("Remove selected categories?");
636 notify("Removing selected categories...");
638 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
639 param_escape(sel_rows
.toString()), true);
640 xmlhttp
.onreadystatechange
=feedlist_callback
;
646 notify("Please select some feeds first.");
652 function feedEditCancel() {
654 if (!xmlhttp_ready(xmlhttp
)) {
663 notify("Operation cancelled.");
665 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
666 xmlhttp.onreadystatechange=feedlist_callback;
667 xmlhttp.send(null); */
671 function feedCatEditCancel() {
673 if (!xmlhttp_ready(xmlhttp
)) {
678 active_feed_cat
= false;
680 notify("Operation cancelled.");
682 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
683 xmlhttp
.onreadystatechange
=feedlist_callback
;
688 function feedEditSave() {
692 var feed
= active_feed
;
694 if (!xmlhttp_ready(xmlhttp
)) {
699 var link
= document
.getElementById("iedit_link").value
;
700 var title
= document
.getElementById("iedit_title").value
;
701 var upd_intl
= document
.getElementById("iedit_updintl").value
;
702 var purge_intl
= document
.getElementById("iedit_purgintl").value
;
703 var fcat
= document
.getElementById("iedit_fcat");
705 var is_pvt
= document
.getElementById("iedit_private");
706 var is_rtl
= document
.getElementById("iedit_rtl");
709 is_pvt
= is_pvt
.checked
;
713 is_rtl
= is_rtl
.checked
;
719 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
722 var pfeed
= document
.getElementById("iedit_parent_feed");
723 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
725 if (link
.length
== 0) {
726 notify("Feed link cannot be blank.");
730 if (title
.length
== 0) {
731 notify("Feed title cannot be blank.");
735 var auth_login
= document
.getElementById("iedit_login").value
;
736 var auth_pass
= document
.getElementById("iedit_pass").value
;
740 notify("Saving feed...");
742 var query
= "op=pref-feeds&subop=editSave&id=" +
743 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
744 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
745 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
746 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
747 "&is_pvt=" + param_escape(is_pvt
) + "&is_rtl=" + param_escape(is_rtl
);
749 xmlhttp
.open("POST", "backend.php", true);
750 xmlhttp
.onreadystatechange
=feedlist_callback
;
751 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
755 exception_error("feedEditSave", e
);
759 function feedCatEditSave() {
761 if (!xmlhttp_ready(xmlhttp
)) {
766 notify("Saving category...");
768 var cat_title
= document
.getElementById("iedit_title").value
;
770 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
771 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
773 xmlhttp
.onreadystatechange
=feedlist_callback
;
776 active_feed_cat
= false;
781 function labelTest() {
783 var sqlexp
= document
.getElementById("iedit_expr").value
;
784 var descr
= document
.getElementById("iedit_descr").value
;
786 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
787 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
789 xmlhttp
.onreadystatechange
=infobox_callback
;
794 function displayHelpInfobox(topic_id
) {
796 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
797 param_escape(topic_id
) + "&noheaders=1", true);
799 xmlhttp
.onreadystatechange
=infobox_callback
;
804 function labelEditCancel() {
806 if (!xmlhttp_ready(xmlhttp
)) {
811 active_label
= false;
813 notify("Operation cancelled.");
815 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
816 xmlhttp
.onreadystatechange
=labellist_callback
;
821 function userEditCancel() {
823 if (!xmlhttp_ready(xmlhttp
)) {
830 notify("Operation cancelled.");
832 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
833 xmlhttp
.onreadystatechange
=userlist_callback
;
838 function filterEditCancel() {
840 if (!xmlhttp_ready(xmlhttp
)) {
845 active_filter
= false;
847 notify("Operation cancelled.");
849 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
850 xmlhttp
.onreadystatechange
=filterlist_callback
;
855 function labelEditSave() {
857 var label
= active_label
;
859 if (!xmlhttp_ready(xmlhttp
)) {
864 var sqlexp
= document
.getElementById("iedit_expr").value
;
865 var descr
= document
.getElementById("iedit_descr").value
;
867 // notify("Saving label " + sqlexp + ": " + descr);
869 if (sqlexp
.length
== 0) {
870 notify("SQL expression cannot be blank.");
874 if (descr
.length
== 0) {
875 notify("Caption cannot be blank.");
879 notify("Saving label...");
881 active_label
= false;
883 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
884 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
887 xmlhttp
.onreadystatechange
=labellist_callback
;
892 function userEditSave() {
894 var user
= active_user
;
896 if (!xmlhttp_ready(xmlhttp
)) {
901 var login
= document
.getElementById("iedit_ulogin").value
;
902 var level
= document
.getElementById("iedit_ulevel").value
;
903 var email
= document
.getElementById("iedit_email").value
;
905 if (login
.length
== 0) {
906 notify("Login cannot be blank.");
910 if (level
.length
== 0) {
911 notify("User level cannot be blank.");
917 notify("Saving user...");
919 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
920 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
921 "&e=" + param_escape(email
), true);
923 xmlhttp
.onreadystatechange
=userlist_callback
;
929 function filterEditSave() {
931 var filter
= active_filter
;
933 if (!xmlhttp_ready(xmlhttp
)) {
938 var regexp
= document
.getElementById("iedit_regexp").value
;
939 var descr
= document
.getElementById("iedit_descr").value
;
940 var match
= document
.getElementById("iedit_match");
942 var v_match
= match
[match
.selectedIndex
].text
;
944 var feed
= document
.getElementById("iedit_feed");
945 var feed_id
= feed
[feed
.selectedIndex
].id
;
947 var action
= document
.getElementById("iedit_filter_action");
948 var action_id
= action
[action
.selectedIndex
].id
;
950 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
952 if (regexp
.length
== 0) {
953 notify("Filter expression cannot be blank.");
957 active_filter
= false;
959 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
960 filter
+ "&r=" + param_escape(regexp
) + "&d=" + param_escape(descr
) +
961 "&m=" + param_escape(v_match
) + "&fid=" + param_escape(feed_id
) +
962 "&aid=" + param_escape(action_id
), true);
964 notify("Saving filter...");
966 xmlhttp
.onreadystatechange
=filterlist_callback
;
971 function editSelectedLabel() {
972 var rows
= getSelectedLabels();
974 if (rows
.length
== 0) {
975 notify("No labels are selected.");
979 if (rows
.length
> 1) {
980 notify("Please select one label.");
990 function editSelectedUser() {
991 var rows
= getSelectedUsers();
993 if (rows
.length
== 0) {
994 notify("No users are selected.");
998 if (rows
.length
> 1) {
999 notify("Please select one user.");
1008 function resetSelectedUserPass() {
1009 var rows
= getSelectedUsers();
1011 if (rows
.length
== 0) {
1012 notify("No users are selected.");
1016 if (rows
.length
> 1) {
1017 notify("Please select one user.");
1021 var ok
= confirm("Reset password of selected user?");
1024 notify("Resetting password for selected user...");
1028 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1029 param_escape(id
), true);
1030 xmlhttp
.onreadystatechange
=userlist_callback
;
1035 function selectedUserDetails() {
1037 if (!xmlhttp_ready(xmlhttp
)) {
1038 printLockingError();
1042 var rows
= getSelectedUsers();
1044 if (rows
.length
== 0) {
1045 notify("No users are selected.");
1049 if (rows
.length
> 1) {
1050 notify("Please select one user.");
1058 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1059 xmlhttp
.onreadystatechange
=infobox_callback
;
1064 function selectedFeedDetails() {
1066 if (!xmlhttp_ready(xmlhttp
)) {
1067 printLockingError();
1071 var rows
= getSelectedFeeds();
1073 if (rows
.length
== 0) {
1074 notify("No feeds are selected.");
1078 // if (rows.length > 1) {
1079 // notify("Please select one feed.");
1083 // var id = rows[0];
1087 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1088 param_escape(rows
.toString()), true);
1089 xmlhttp
.onreadystatechange
=infobox_callback
;
1094 function editSelectedFilter() {
1095 var rows
= getSelectedFilters();
1097 if (rows
.length
== 0) {
1098 notify("No filters are selected.");
1102 if (rows
.length
> 1) {
1103 notify("Please select one filter.");
1109 editFilter(rows
[0]);
1114 function editSelectedFeed() {
1115 var rows
= getSelectedFeeds();
1117 if (rows
.length
== 0) {
1118 notify("No feeds are selected.");
1122 if (rows
.length
> 1) {
1123 notify("Please select one feed.");
1133 function editSelectedFeedCat() {
1134 var rows
= getSelectedFeedCats();
1136 if (rows
.length
== 0) {
1137 notify("No categories are selected.");
1141 if (rows
.length
> 1) {
1142 notify("Please select one category.");
1148 editFeedCat(rows
[0]);
1152 function piggie_callback() {
1153 var piggie
= document
.getElementById("piggie");
1155 piggie
.style
.top
= piggie_top
;
1156 piggie
.style
.backgroundColor
= "white";
1157 piggie
.style
.borderWidth
= "1px";
1159 if (piggie_fwd
&& piggie_top
< 0) {
1160 setTimeout("piggie_callback()", 50);
1161 piggie_top
= piggie_top
+ 10;
1162 } else if (piggie_fwd
&& piggie_top
>= 0) {
1164 setTimeout("piggie_callback()", 50);
1165 } else if (!piggie_fwd
&& piggie_top
> -400) {
1166 setTimeout("piggie_callback()", 50);
1167 piggie_top
= piggie_top
- 10;
1168 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1169 piggie
.style
.display
= "none";
1174 var piggie_opacity
= 0;
1176 function piggie2_callback() {
1177 var piggie
= document
.getElementById("piggie");
1178 piggie
.style
.top
= 0;
1179 piggie
.style
.opacity
= piggie_opacity
;
1180 piggie
.style
.backgroundColor
= "transparent";
1181 piggie
.style
.borderWidth
= "0px";
1183 if (piggie_fwd
&& piggie_opacity
< 1) {
1184 setTimeout("piggie2_callback()", 50);
1185 piggie_opacity
= piggie_opacity
+ 0.03;
1186 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1188 setTimeout("piggie2_callback()", 50);
1189 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1190 setTimeout("piggie2_callback()", 50);
1191 piggie_opacity
= piggie_opacity
- 0.03;
1192 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1193 piggie
.style
.display
= "none";
1198 function localPiggieFunction(enable
) {
1200 var piggie
= document
.getElementById("piggie");
1201 piggie
.style
.display
= "block";
1203 if (navigator
.userAgent
.match("Firefox") && Math
.random(1) > 0.5) {
1211 function validateOpmlImport() {
1213 var opml_file
= document
.getElementById("opml_file");
1215 if (opml_file
.value
.length
== 0) {
1216 notify("Please select OPML file to upload.");
1223 function updateFilterList() {
1225 if (!xmlhttp_ready(xmlhttp
)) {
1226 printLockingError();
1230 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1232 p_notify("Loading, please wait...");
1234 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1235 xmlhttp
.onreadystatechange
=filterlist_callback
;
1240 function updateLabelList() {
1242 if (!xmlhttp_ready(xmlhttp
)) {
1243 printLockingError();
1247 p_notify("Loading, please wait...");
1249 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1251 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1252 xmlhttp
.onreadystatechange
=labellist_callback
;
1256 function updatePrefsList() {
1258 if (!xmlhttp_ready(xmlhttp
)) {
1259 printLockingError();
1263 p_notify("Loading, please wait...");
1265 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1266 xmlhttp
.onreadystatechange
=prefslist_callback
;
1271 function selectTab(id
, noupdate
) {
1275 if (!xmlhttp_ready(xmlhttp
)) {
1276 printLockingError();
1282 if (id
== "feedConfig") {
1284 } else if (id
== "filterConfig") {
1286 } else if (id
== "labelConfig") {
1288 } else if (id
== "genConfig") {
1290 } else if (id
== "userConfig") {
1292 } else if (id
== "feedBrowser") {
1293 updateBigFeedBrowser();
1297 var tab
= document
.getElementById(active_tab
+ "Tab");
1300 if (tab
.className
.match("Selected")) {
1301 tab
.className
= "prefsTab";
1305 tab
= document
.getElementById(id
+ "Tab");
1308 if (!tab
.className
.match("Selected")) {
1309 tab
.className
= tab
.className
+ "Selected";
1315 setCookie('ttrss_pref_acttab', active_tab
);
1323 if (arguments
.callee
.done
) return;
1324 arguments
.callee
.done
= true;
1328 document
.getElementById("prefContent").innerHTML
=
1329 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1330 "to function properly. Your browser doesn't seem to support it.";
1334 active_tab
= getCookie("ttrss_pref_acttab");
1335 if (!active_tab
) active_tab
= "genConfig";
1336 selectTab(active_tab
);
1338 document
.onkeydown
= hotkey_handler
;
1341 exception_error("init", e
);
1345 function closeInfoBox() {
1346 var box
= document
.getElementById('infoBox');
1347 var shadow
= document
.getElementById('infoBoxShadow');
1350 shadow
.style
.display
= "none";
1352 box
.style
.display
= "none";
1356 function categorizeSelectedFeeds() {
1358 if (!xmlhttp_ready(xmlhttp
)) {
1359 printLockingError();
1363 var sel_rows
= getSelectedFeeds();
1365 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1366 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1368 if (sel_rows
.length
> 0) {
1370 notify("Changing category of selected feeds...");
1372 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1373 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1374 xmlhttp
.onreadystatechange
=feedlist_callback
;
1379 notify("Please select some feeds first.");
1385 function validatePrefsReset() {
1386 return confirm("Reset to defaults?");
1389 function browseFeeds() {
1391 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1392 xmlhttp
.onreadystatechange
=infobox_callback
;
1397 function feedBrowserSubscribe() {
1399 var list
= document
.getElementById("browseFeedList");
1401 if (!list
) list
= document
.getElementById("browseBigFeedList");
1403 var selected
= new Array();
1405 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1406 var child
= list
.childNodes
[i
];
1407 if (child
.id
&& child
.id
.match("FBROW-")) {
1408 var id
= child
.id
.replace("FBROW-", "");
1410 var cb
= document
.getElementById("FBCHK-" + id
);
1418 if (selected
.length
> 0) {
1420 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1421 param_escape(selected
.toString()), true);
1422 xmlhttp
.onreadystatechange
=feedlist_callback
;
1425 alert("No feeds are selected.");
1429 exception_error("feedBrowserSubscribe", e
);
1433 function updateBigFeedBrowser() {
1435 if (!xmlhttp_ready(xmlhttp
)) {
1436 printLockingError();
1440 p_notify("Loading, please wait...");
1442 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1443 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1448 function browserToggleExpand(id
) {
1450 /* if (feed_to_expand && feed_to_expand != id) {
1451 var d = document.getElementById("BRDET-" + feed_to_expand);
1452 d.style.display = "none";
1455 var d
= document
.getElementById("BRDET-" + id
);
1457 if (d
.style
.display
== "block") {
1458 d
.style
.display
= "none";
1462 feed_to_expand
= id
;
1464 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1465 + param_escape(id
), true);
1466 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1471 exception_error("browserExpand", e
);