]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
bc6e8667ff0a7b6bcc9bf765e06184c0b7c3a27a
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("Can't add feed: missing feed URL.");
286 notify("Adding feed...");
288 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
289 param_escape(link
.value
), true);
290 xmlhttp
.onreadystatechange
=feedlist_callback
;
299 function addFeedCat() {
301 if (!xmlhttp_ready(xmlhttp
)) {
306 var cat
= document
.getElementById("fadd_cat");
308 if (cat
.value
.length
== 0) {
309 alert("Can't add category: no name specified.");
311 notify("Adding feed category...");
313 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
314 param_escape(cat
.value
), true);
315 xmlhttp
.onreadystatechange
=feedlist_callback
;
325 if (!xmlhttp_ready(xmlhttp
)) {
330 var sqlexp
= document
.getElementById("uadd_box");
332 if (sqlexp
.value
.length
== 0) {
333 alert("Can't add user: no login specified.");
335 notify("Adding user...");
337 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
338 param_escape(sqlexp
.value
), true);
340 xmlhttp
.onreadystatechange
=userlist_callback
;
348 function editLabel(id
) {
350 if (!xmlhttp_ready(xmlhttp
)) {
357 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
358 param_escape(id
), true);
359 xmlhttp
.onreadystatechange
=labellist_callback
;
364 function editUser(id
) {
366 if (!xmlhttp_ready(xmlhttp
)) {
373 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
374 param_escape(id
), true);
375 xmlhttp
.onreadystatechange
=userlist_callback
;
380 function editFilter(id
) {
382 if (!xmlhttp_ready(xmlhttp
)) {
389 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
390 param_escape(id
), true);
391 xmlhttp
.onreadystatechange
=filterlist_callback
;
396 function editFeed(feed
) {
398 // notify("Editing feed...");
400 if (!xmlhttp_ready(xmlhttp
)) {
407 /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
408 param_escape(feed), true);
409 xmlhttp.onreadystatechange=feedlist_callback;
410 xmlhttp.send(null); */
412 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
413 // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed,
416 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
418 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
419 param_escape(active_feed
), true);
421 xmlhttp
.onreadystatechange
=infobox_callback
;
426 function editFeedCat(cat
) {
428 if (!xmlhttp_ready(xmlhttp
)) {
433 active_feed_cat
= cat
;
435 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
436 param_escape(cat
), true);
437 xmlhttp
.onreadystatechange
=feedlist_callback
;
442 function getSelectedLabels() {
443 return getSelectedTableRowIds("prefLabelList", "LILRR");
446 function getSelectedUsers() {
447 return getSelectedTableRowIds("prefUserList", "UMRR");
450 function getSelectedFeeds() {
451 return getSelectedTableRowIds("prefFeedList", "FEEDR");
454 function getSelectedFilters() {
455 return getSelectedTableRowIds("prefFilterList", "FILRR");
458 function getSelectedFeedCats() {
459 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
463 /*function readSelectedFeeds(read) {
465 if (!xmlhttp_ready(xmlhttp)) {
470 var sel_rows = getSelectedFeeds();
472 if (sel_rows.length > 0) {
480 notify("Marking selected feeds as " + op + "...");
482 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
483 param_escape(sel_rows.toString()), true);
484 xmlhttp.onreadystatechange=notify_callback;
489 alert("No feeds are selected.");
494 function removeSelectedLabels() {
496 if (!xmlhttp_ready(xmlhttp
)) {
501 var sel_rows
= getSelectedLabels();
503 if (sel_rows
.length
> 0) {
505 var ok
= confirm("Remove selected labels?");
508 notify("Removing selected labels...");
510 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
511 param_escape(sel_rows
.toString()), true);
512 xmlhttp
.onreadystatechange
=labellist_callback
;
516 alert("No labels are selected.");
520 function removeSelectedUsers() {
522 if (!xmlhttp_ready(xmlhttp
)) {
527 var sel_rows
= getSelectedUsers();
529 if (sel_rows
.length
> 0) {
531 var ok
= confirm("Remove selected users?");
534 notify("Removing selected users...");
536 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
537 param_escape(sel_rows
.toString()), true);
538 xmlhttp
.onreadystatechange
=userlist_callback
;
543 alert("No users are selected.");
547 function removeSelectedFilters() {
549 if (!xmlhttp_ready(xmlhttp
)) {
554 var sel_rows
= getSelectedFilters();
556 if (sel_rows
.length
> 0) {
558 var ok
= confirm("Remove selected filters?");
561 notify("Removing selected filters...");
563 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
564 param_escape(sel_rows
.toString()), true);
565 xmlhttp
.onreadystatechange
=filterlist_callback
;
569 alert("No filters are selected.");
574 function removeSelectedFeeds() {
576 if (!xmlhttp_ready(xmlhttp
)) {
581 var sel_rows
= getSelectedFeeds();
583 if (sel_rows
.length
> 0) {
585 var ok
= confirm("Remove selected feeds?");
589 notify("Removing selected feeds...");
591 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
592 param_escape(sel_rows
.toString()), true);
593 xmlhttp
.onreadystatechange
=feedlist_callback
;
599 alert("No feeds are selected.");
605 function removeSelectedFeedCats() {
607 if (!xmlhttp_ready(xmlhttp
)) {
612 var sel_rows
= getSelectedFeedCats();
614 if (sel_rows
.length
> 0) {
616 var ok
= confirm("Remove selected categories?");
619 notify("Removing selected categories...");
621 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
622 param_escape(sel_rows
.toString()), true);
623 xmlhttp
.onreadystatechange
=feedlist_callback
;
629 alert("No categories are selected.");
635 function feedEditCancel() {
637 if (!xmlhttp_ready(xmlhttp
)) {
646 notify("Operation cancelled.");
648 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
649 xmlhttp.onreadystatechange=feedlist_callback;
650 xmlhttp.send(null); */
654 function feedCatEditCancel() {
656 if (!xmlhttp_ready(xmlhttp
)) {
661 active_feed_cat
= false;
663 notify("Operation cancelled.");
665 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
666 xmlhttp
.onreadystatechange
=feedlist_callback
;
671 function feedEditSave() {
675 var feed
= active_feed
;
677 if (!xmlhttp_ready(xmlhttp
)) {
682 var link
= document
.getElementById("iedit_link").value
;
683 var title
= document
.getElementById("iedit_title").value
;
684 var upd_intl
= document
.getElementById("iedit_updintl");
686 upd_intl
= upd_intl
[upd_intl
.selectedIndex
].id
;
688 var purge_intl
= document
.getElementById("iedit_purgintl");
690 purge_intl
= purge_intl
[purge_intl
.selectedIndex
].id
;
692 var fcat
= document
.getElementById("iedit_fcat");
694 var is_pvt
= document
.getElementById("iedit_private");
695 var is_rtl
= document
.getElementById("iedit_rtl");
698 is_pvt
= is_pvt
.checked
;
702 is_rtl
= is_rtl
.checked
;
708 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
711 var pfeed
= document
.getElementById("iedit_parent_feed");
712 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
714 if (link
.length
== 0) {
715 notify("Feed link cannot be blank.");
719 if (title
.length
== 0) {
720 notify("Feed title cannot be blank.");
724 var auth_login
= document
.getElementById("iedit_login").value
;
725 var auth_pass
= document
.getElementById("iedit_pass").value
;
729 notify("Saving feed...");
731 var query
= "op=pref-feeds&subop=editSave&id=" +
732 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
733 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
734 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
735 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
736 "&is_pvt=" + param_escape(is_pvt
) + "&is_rtl=" + param_escape(is_rtl
);
738 xmlhttp
.open("POST", "backend.php", true);
739 xmlhttp
.onreadystatechange
=feedlist_callback
;
740 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
744 exception_error("feedEditSave", e
);
748 function feedCatEditSave() {
750 if (!xmlhttp_ready(xmlhttp
)) {
755 notify("Saving category...");
757 var cat_title
= document
.getElementById("iedit_title").value
;
759 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
760 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
762 xmlhttp
.onreadystatechange
=feedlist_callback
;
765 active_feed_cat
= false;
770 function labelTest() {
772 var sqlexp
= document
.getElementById("iedit_expr").value
;
773 var descr
= document
.getElementById("iedit_descr").value
;
775 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
776 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
778 xmlhttp
.onreadystatechange
=infobox_callback
;
783 function displayHelpInfobox(topic_id
) {
785 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
786 param_escape(topic_id
) + "&noheaders=1", true);
788 xmlhttp
.onreadystatechange
=infobox_callback
;
793 function labelEditCancel() {
795 if (!xmlhttp_ready(xmlhttp
)) {
800 active_label
= false;
802 notify("Operation cancelled.");
804 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
805 xmlhttp
.onreadystatechange
=labellist_callback
;
810 function userEditCancel() {
812 if (!xmlhttp_ready(xmlhttp
)) {
819 notify("Operation cancelled.");
821 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
822 xmlhttp
.onreadystatechange
=userlist_callback
;
827 function filterEditCancel() {
829 if (!xmlhttp_ready(xmlhttp
)) {
834 active_filter
= false;
836 notify("Operation cancelled.");
838 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
839 xmlhttp
.onreadystatechange
=filterlist_callback
;
844 function labelEditSave() {
846 var label
= active_label
;
848 if (!xmlhttp_ready(xmlhttp
)) {
853 var sqlexp
= document
.getElementById("iedit_expr").value
;
854 var descr
= document
.getElementById("iedit_descr").value
;
856 // notify("Saving label " + sqlexp + ": " + descr);
858 if (sqlexp
.length
== 0) {
859 notify("SQL expression cannot be blank.");
863 if (descr
.length
== 0) {
864 notify("Caption cannot be blank.");
868 notify("Saving label...");
870 active_label
= false;
872 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
873 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
876 xmlhttp
.onreadystatechange
=labellist_callback
;
881 function userEditSave() {
883 var user
= active_user
;
885 if (!xmlhttp_ready(xmlhttp
)) {
890 var login
= document
.getElementById("iedit_ulogin").value
;
891 var level
= document
.getElementById("iedit_ulevel");
893 level
= level
[level
.selectedIndex
].id
;
895 var email
= document
.getElementById("iedit_email").value
;
897 if (login
.length
== 0) {
898 notify("Login cannot be blank.");
902 if (level
.length
== 0) {
903 notify("User level cannot be blank.");
909 notify("Saving user...");
911 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
912 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
913 "&e=" + param_escape(email
), true);
915 xmlhttp
.onreadystatechange
=userlist_callback
;
921 function filterEditSave() {
923 var filter
= active_filter
;
925 if (!xmlhttp_ready(xmlhttp
)) {
930 var regexp
= document
.getElementById("iedit_regexp").value
;
931 var match
= document
.getElementById("iedit_match");
933 var v_match
= match
[match
.selectedIndex
].text
;
935 var feed
= document
.getElementById("iedit_feed");
936 var feed_id
= feed
[feed
.selectedIndex
].id
;
938 var action
= document
.getElementById("iedit_filter_action");
939 var action_id
= action
[action
.selectedIndex
].id
;
941 if (regexp
.length
== 0) {
942 alert("Can't save filter: match expression is blank.");
946 active_filter
= false;
948 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
949 filter
+ "&r=" + param_escape(regexp
) + "&m=" + param_escape(v_match
) +
950 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
952 notify("Saving filter...");
954 xmlhttp
.onreadystatechange
=filterlist_callback
;
959 function editSelectedLabel() {
960 var rows
= getSelectedLabels();
962 if (rows
.length
== 0) {
963 alert("No labels are selected.");
967 if (rows
.length
> 1) {
968 alert("Please select only one label.");
978 function editSelectedUser() {
979 var rows
= getSelectedUsers();
981 if (rows
.length
== 0) {
982 alert("No users are selected.");
986 if (rows
.length
> 1) {
987 alert("Please select only one user.");
996 function resetSelectedUserPass() {
997 var rows
= getSelectedUsers();
999 if (rows
.length
== 0) {
1000 alert("No users are selected.");
1004 if (rows
.length
> 1) {
1005 alert("Please select only one user.");
1009 var ok
= confirm("Reset password of selected user?");
1012 notify("Resetting password for selected user...");
1016 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1017 param_escape(id
), true);
1018 xmlhttp
.onreadystatechange
=userlist_callback
;
1023 function selectedUserDetails() {
1025 if (!xmlhttp_ready(xmlhttp
)) {
1026 printLockingError();
1030 var rows
= getSelectedUsers();
1032 if (rows
.length
== 0) {
1033 alert("No users are selected.");
1037 if (rows
.length
> 1) {
1038 alert("Please select only one user.");
1046 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1047 xmlhttp
.onreadystatechange
=infobox_callback
;
1052 function selectedFeedDetails() {
1054 if (!xmlhttp_ready(xmlhttp
)) {
1055 printLockingError();
1059 var rows
= getSelectedFeeds();
1061 if (rows
.length
== 0) {
1062 alert("No feeds are selected.");
1066 if (rows
.length
> 1) {
1067 notify("Please select only one feed.");
1071 // var id = rows[0];
1075 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1076 param_escape(rows
.toString()), true);
1077 xmlhttp
.onreadystatechange
=infobox_callback
;
1082 function editSelectedFilter() {
1083 var rows
= getSelectedFilters();
1085 if (rows
.length
== 0) {
1086 alert("No filters are selected.");
1090 if (rows
.length
> 1) {
1091 alert("Please select only one filter.");
1097 editFilter(rows
[0]);
1102 function editSelectedFeed() {
1103 var rows
= getSelectedFeeds();
1105 if (rows
.length
== 0) {
1106 notify("No feeds are selected.");
1110 if (rows
.length
> 1) {
1111 notify("Please select one feed.");
1121 function editSelectedFeedCat() {
1122 var rows
= getSelectedFeedCats();
1124 if (rows
.length
== 0) {
1125 alert("No categories are selected.");
1129 if (rows
.length
> 1) {
1130 alert("Please select only one category.");
1136 editFeedCat(rows
[0]);
1140 function piggie_callback() {
1141 var piggie
= document
.getElementById("piggie");
1143 piggie
.style
.top
= piggie_top
;
1144 piggie
.style
.backgroundColor
= "white";
1145 piggie
.style
.borderWidth
= "1px";
1147 if (piggie_fwd
&& piggie_top
< 0) {
1148 setTimeout("piggie_callback()", 50);
1149 piggie_top
= piggie_top
+ 10;
1150 } else if (piggie_fwd
&& piggie_top
>= 0) {
1152 setTimeout("piggie_callback()", 50);
1153 } else if (!piggie_fwd
&& piggie_top
> -400) {
1154 setTimeout("piggie_callback()", 50);
1155 piggie_top
= piggie_top
- 10;
1156 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1157 piggie
.style
.display
= "none";
1162 var piggie_opacity
= 0;
1164 function piggie2_callback() {
1165 var piggie
= document
.getElementById("piggie");
1166 piggie
.style
.top
= 0;
1167 piggie
.style
.opacity
= piggie_opacity
;
1168 piggie
.style
.backgroundColor
= "transparent";
1169 piggie
.style
.borderWidth
= "0px";
1171 if (piggie_fwd
&& piggie_opacity
< 1) {
1172 setTimeout("piggie2_callback()", 50);
1173 piggie_opacity
= piggie_opacity
+ 0.03;
1174 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1176 setTimeout("piggie2_callback()", 50);
1177 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1178 setTimeout("piggie2_callback()", 50);
1179 piggie_opacity
= piggie_opacity
- 0.03;
1180 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1181 piggie
.style
.display
= "none";
1186 function localPiggieFunction(enable
) {
1188 var piggie
= document
.getElementById("piggie");
1189 piggie
.style
.display
= "block";
1191 if (navigator
.userAgent
.match("Firefox") && Math
.random(1) > 0.5) {
1199 function validateOpmlImport() {
1201 var opml_file
= document
.getElementById("opml_file");
1203 if (opml_file
.value
.length
== 0) {
1204 alert("No OPML file to upload.");
1211 function updateFilterList() {
1213 if (!xmlhttp_ready(xmlhttp
)) {
1214 printLockingError();
1218 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1220 p_notify("Loading, please wait...");
1222 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1223 xmlhttp
.onreadystatechange
=filterlist_callback
;
1228 function updateLabelList() {
1230 if (!xmlhttp_ready(xmlhttp
)) {
1231 printLockingError();
1235 p_notify("Loading, please wait...");
1237 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1239 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1240 xmlhttp
.onreadystatechange
=labellist_callback
;
1244 function updatePrefsList() {
1246 if (!xmlhttp_ready(xmlhttp
)) {
1247 printLockingError();
1251 p_notify("Loading, please wait...");
1253 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1254 xmlhttp
.onreadystatechange
=prefslist_callback
;
1259 function selectTab(id
, noupdate
) {
1263 if (!xmlhttp_ready(xmlhttp
)) {
1264 printLockingError();
1270 if (id
== "feedConfig") {
1272 } else if (id
== "filterConfig") {
1274 } else if (id
== "labelConfig") {
1276 } else if (id
== "genConfig") {
1278 } else if (id
== "userConfig") {
1280 } else if (id
== "feedBrowser") {
1281 updateBigFeedBrowser();
1285 var tab
= document
.getElementById(active_tab
+ "Tab");
1288 if (tab
.className
.match("Selected")) {
1289 tab
.className
= "prefsTab";
1293 tab
= document
.getElementById(id
+ "Tab");
1296 if (!tab
.className
.match("Selected")) {
1297 tab
.className
= tab
.className
+ "Selected";
1303 setCookie('ttrss_pref_acttab', active_tab
);
1311 if (arguments
.callee
.done
) return;
1312 arguments
.callee
.done
= true;
1316 document
.getElementById("prefContent").innerHTML
=
1317 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1318 "to function properly. Your browser doesn't seem to support it.";
1322 active_tab
= getCookie("ttrss_pref_acttab");
1323 if (!active_tab
) active_tab
= "genConfig";
1324 selectTab(active_tab
);
1326 document
.onkeydown
= hotkey_handler
;
1329 exception_error("init", e
);
1333 function categorizeSelectedFeeds() {
1335 if (!xmlhttp_ready(xmlhttp
)) {
1336 printLockingError();
1340 var sel_rows
= getSelectedFeeds();
1342 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1343 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1345 if (sel_rows
.length
> 0) {
1347 notify("Changing category of selected feeds...");
1349 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1350 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1351 xmlhttp
.onreadystatechange
=feedlist_callback
;
1356 alert("No feeds are selected.");
1362 function validatePrefsReset() {
1363 return confirm("Reset to defaults?");
1366 function browseFeeds() {
1368 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1369 xmlhttp
.onreadystatechange
=infobox_callback
;
1374 function feedBrowserSubscribe() {
1376 var list
= document
.getElementById("browseFeedList");
1378 if (!list
) list
= document
.getElementById("browseBigFeedList");
1380 var selected
= new Array();
1382 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1383 var child
= list
.childNodes
[i
];
1384 if (child
.id
&& child
.id
.match("FBROW-")) {
1385 var id
= child
.id
.replace("FBROW-", "");
1387 var cb
= document
.getElementById("FBCHK-" + id
);
1395 if (selected
.length
> 0) {
1397 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1398 param_escape(selected
.toString()), true);
1399 xmlhttp
.onreadystatechange
=feedlist_callback
;
1402 alert("No feeds are selected.");
1406 exception_error("feedBrowserSubscribe", e
);
1410 function updateBigFeedBrowser() {
1412 if (!xmlhttp_ready(xmlhttp
)) {
1413 printLockingError();
1417 p_notify("Loading, please wait...");
1419 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser", true);
1420 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1425 function browserToggleExpand(id
) {
1427 /* if (feed_to_expand && feed_to_expand != id) {
1428 var d = document.getElementById("BRDET-" + feed_to_expand);
1429 d.style.display = "none";
1432 var d
= document
.getElementById("BRDET-" + id
);
1434 if (d
.style
.display
== "block") {
1435 d
.style
.display
= "none";
1439 feed_to_expand
= id
;
1441 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1442 + param_escape(id
), true);
1443 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1448 exception_error("browserExpand", e
);