]>
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");
465 function getSelectedFeedsFromBrowser() {
467 var list
= document
.getElementById("browseFeedList");
468 if (!list
) list
= document
.getElementById("browseBigFeedList");
470 var selected
= new Array();
472 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
473 var child
= list
.childNodes
[i
];
474 if (child
.id
&& child
.id
.match("FBROW-")) {
475 var id
= child
.id
.replace("FBROW-", "");
477 var cb
= document
.getElementById("FBCHK-" + id
);
489 /*function readSelectedFeeds(read) {
491 if (!xmlhttp_ready(xmlhttp)) {
496 var sel_rows = getSelectedFeeds();
498 if (sel_rows.length > 0) {
506 notify("Marking selected feeds as " + op + "...");
508 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
509 param_escape(sel_rows.toString()), true);
510 xmlhttp.onreadystatechange=notify_callback;
515 alert("No feeds are selected.");
520 function removeSelectedLabels() {
522 if (!xmlhttp_ready(xmlhttp
)) {
527 var sel_rows
= getSelectedLabels();
529 if (sel_rows
.length
> 0) {
531 var ok
= confirm("Remove selected labels?");
534 notify("Removing selected labels...");
536 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
537 param_escape(sel_rows
.toString()), true);
538 xmlhttp
.onreadystatechange
=labellist_callback
;
542 alert("No labels are selected.");
546 function removeSelectedUsers() {
548 if (!xmlhttp_ready(xmlhttp
)) {
553 var sel_rows
= getSelectedUsers();
555 if (sel_rows
.length
> 0) {
557 var ok
= confirm("Remove selected users?");
560 notify("Removing selected users...");
562 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
563 param_escape(sel_rows
.toString()), true);
564 xmlhttp
.onreadystatechange
=userlist_callback
;
569 alert("No users are selected.");
573 function removeSelectedFilters() {
575 if (!xmlhttp_ready(xmlhttp
)) {
580 var sel_rows
= getSelectedFilters();
582 if (sel_rows
.length
> 0) {
584 var ok
= confirm("Remove selected filters?");
587 notify("Removing selected filters...");
589 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
590 param_escape(sel_rows
.toString()), true);
591 xmlhttp
.onreadystatechange
=filterlist_callback
;
595 alert("No filters are selected.");
600 function removeSelectedFeeds() {
602 if (!xmlhttp_ready(xmlhttp
)) {
607 var sel_rows
= getSelectedFeeds();
609 if (sel_rows
.length
> 0) {
611 var ok
= confirm("Unsubscribe from selected feeds?");
615 notify("Unsubscribing from selected feeds...");
617 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
618 param_escape(sel_rows
.toString()), true);
619 xmlhttp
.onreadystatechange
=feedlist_callback
;
625 alert("No feeds are selected.");
631 function removeSelectedFeedCats() {
633 if (!xmlhttp_ready(xmlhttp
)) {
638 var sel_rows
= getSelectedFeedCats();
640 if (sel_rows
.length
> 0) {
642 var ok
= confirm("Remove selected categories?");
645 notify("Removing selected categories...");
647 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
648 param_escape(sel_rows
.toString()), true);
649 xmlhttp
.onreadystatechange
=feedlist_callback
;
655 alert("No categories are selected.");
661 function feedEditCancel() {
663 if (!xmlhttp_ready(xmlhttp
)) {
672 // notify("Operation cancelled.");
674 /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
675 xmlhttp.onreadystatechange=feedlist_callback;
676 xmlhttp.send(null); */
680 function feedCatEditCancel() {
682 if (!xmlhttp_ready(xmlhttp
)) {
687 active_feed_cat
= false;
689 // notify("Operation cancelled.");
691 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
692 xmlhttp
.onreadystatechange
=feedlist_callback
;
697 function feedEditSave() {
701 var feed
= active_feed
;
703 if (!xmlhttp_ready(xmlhttp
)) {
708 var link
= document
.getElementById("iedit_link").value
;
709 var title
= document
.getElementById("iedit_title").value
;
710 var upd_intl
= document
.getElementById("iedit_updintl");
712 upd_intl
= upd_intl
[upd_intl
.selectedIndex
].id
;
714 var purge_intl
= document
.getElementById("iedit_purgintl");
716 purge_intl
= purge_intl
[purge_intl
.selectedIndex
].id
;
718 var fcat
= document
.getElementById("iedit_fcat");
720 var is_pvt
= document
.getElementById("iedit_private");
721 var is_rtl
= document
.getElementById("iedit_rtl");
724 is_pvt
= is_pvt
.checked
;
728 is_rtl
= is_rtl
.checked
;
734 fcat_id
= fcat
[fcat
.selectedIndex
].id
;
737 var pfeed
= document
.getElementById("iedit_parent_feed");
738 var parent_feed_id
= pfeed
[pfeed
.selectedIndex
].id
;
740 if (link
.length
== 0) {
741 notify("Feed link cannot be blank.");
745 if (title
.length
== 0) {
746 notify("Feed title cannot be blank.");
750 var auth_login
= document
.getElementById("iedit_login").value
;
751 var auth_pass
= document
.getElementById("iedit_pass").value
;
755 notify("Saving feed...");
757 var query
= "op=pref-feeds&subop=editSave&id=" +
758 feed
+ "&l=" + param_escape(link
) + "&t=" + param_escape(title
) +
759 "&ui=" + param_escape(upd_intl
) + "&pi=" + param_escape(purge_intl
) +
760 "&catid=" + param_escape(fcat_id
) + "&login=" + param_escape(auth_login
) +
761 "&pfeed=" + param_escape(parent_feed_id
) + "&pass=" + param_escape(auth_pass
) +
762 "&is_pvt=" + param_escape(is_pvt
) + "&is_rtl=" + param_escape(is_rtl
);
764 xmlhttp
.open("POST", "backend.php", true);
765 xmlhttp
.onreadystatechange
=feedlist_callback
;
766 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
770 exception_error("feedEditSave", e
);
774 function feedCatEditSave() {
776 if (!xmlhttp_ready(xmlhttp
)) {
781 notify("Saving category...");
783 var cat_title
= document
.getElementById("iedit_title").value
;
785 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
786 param_escape(active_feed_cat
) + "&title=" + param_escape(cat_title
),
788 xmlhttp
.onreadystatechange
=feedlist_callback
;
791 active_feed_cat
= false;
796 function labelTest() {
798 var sqlexp
= document
.getElementById("iedit_expr").value
;
799 var descr
= document
.getElementById("iedit_descr").value
;
801 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
802 param_escape(sqlexp
) + "&descr=" + param_escape(descr
), true);
804 xmlhttp
.onreadystatechange
=infobox_callback
;
809 function displayHelpInfobox(topic_id
) {
811 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
812 param_escape(topic_id
) + "&noheaders=1", true);
814 xmlhttp
.onreadystatechange
=infobox_callback
;
819 function labelEditCancel() {
821 if (!xmlhttp_ready(xmlhttp
)) {
826 active_label
= false;
828 // notify("Operation cancelled.");
830 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
831 xmlhttp
.onreadystatechange
=labellist_callback
;
836 function userEditCancel() {
838 if (!xmlhttp_ready(xmlhttp
)) {
845 // notify("Operation cancelled.");
847 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
848 xmlhttp
.onreadystatechange
=userlist_callback
;
853 function filterEditCancel() {
855 if (!xmlhttp_ready(xmlhttp
)) {
860 active_filter
= false;
862 // notify("Operation cancelled.");
864 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
865 xmlhttp
.onreadystatechange
=filterlist_callback
;
870 function labelEditSave() {
872 var label
= active_label
;
874 if (!xmlhttp_ready(xmlhttp
)) {
879 var sqlexp
= document
.getElementById("iedit_expr").value
;
880 var descr
= document
.getElementById("iedit_descr").value
;
882 // notify("Saving label " + sqlexp + ": " + descr);
884 if (sqlexp
.length
== 0) {
885 notify("SQL expression cannot be blank.");
889 if (descr
.length
== 0) {
890 notify("Caption cannot be blank.");
894 notify("Saving label...");
896 active_label
= false;
898 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
899 label
+ "&s=" + param_escape(sqlexp
) + "&d=" + param_escape(descr
),
902 xmlhttp
.onreadystatechange
=labellist_callback
;
907 function userEditSave() {
909 var user
= active_user
;
911 if (!xmlhttp_ready(xmlhttp
)) {
916 var login
= document
.getElementById("iedit_ulogin").value
;
917 var level
= document
.getElementById("iedit_ulevel");
919 level
= level
[level
.selectedIndex
].id
;
921 var email
= document
.getElementById("iedit_email").value
;
923 if (login
.length
== 0) {
924 notify("Login cannot be blank.");
928 if (level
.length
== 0) {
929 notify("User level cannot be blank.");
935 notify("Saving user...");
937 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
938 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
939 "&e=" + param_escape(email
), true);
941 xmlhttp
.onreadystatechange
=userlist_callback
;
947 function filterEditSave() {
949 var filter
= active_filter
;
951 if (!xmlhttp_ready(xmlhttp
)) {
956 var regexp
= document
.getElementById("iedit_regexp").value
;
957 var match
= document
.getElementById("iedit_match");
959 var v_match
= match
[match
.selectedIndex
].text
;
961 var feed
= document
.getElementById("iedit_feed");
962 var feed_id
= feed
[feed
.selectedIndex
].id
;
964 var action
= document
.getElementById("iedit_filter_action");
965 var action_id
= action
[action
.selectedIndex
].id
;
967 if (regexp
.length
== 0) {
968 alert("Can't save filter: match expression is blank.");
972 active_filter
= false;
974 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
975 filter
+ "&r=" + param_escape(regexp
) + "&m=" + param_escape(v_match
) +
976 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
978 notify("Saving filter...");
980 xmlhttp
.onreadystatechange
=filterlist_callback
;
985 function editSelectedLabel() {
986 var rows
= getSelectedLabels();
988 if (rows
.length
== 0) {
989 alert("No labels are selected.");
993 if (rows
.length
> 1) {
994 alert("Please select only one label.");
1004 function editSelectedUser() {
1005 var rows
= getSelectedUsers();
1007 if (rows
.length
== 0) {
1008 alert("No users are selected.");
1012 if (rows
.length
> 1) {
1013 alert("Please select only one user.");
1022 function resetSelectedUserPass() {
1023 var rows
= getSelectedUsers();
1025 if (rows
.length
== 0) {
1026 alert("No users are selected.");
1030 if (rows
.length
> 1) {
1031 alert("Please select only one user.");
1035 var ok
= confirm("Reset password of selected user?");
1038 notify("Resetting password for selected user...");
1042 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
1043 param_escape(id
), true);
1044 xmlhttp
.onreadystatechange
=userlist_callback
;
1049 function selectedUserDetails() {
1051 if (!xmlhttp_ready(xmlhttp
)) {
1052 printLockingError();
1056 var rows
= getSelectedUsers();
1058 if (rows
.length
== 0) {
1059 alert("No users are selected.");
1063 if (rows
.length
> 1) {
1064 alert("Please select only one user.");
1072 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
1073 xmlhttp
.onreadystatechange
=infobox_callback
;
1078 function selectedFeedDetails() {
1080 if (!xmlhttp_ready(xmlhttp
)) {
1081 printLockingError();
1085 var rows
= getSelectedFeeds();
1087 if (rows
.length
== 0) {
1088 alert("No feeds are selected.");
1092 if (rows
.length
> 1) {
1093 notify("Please select only one feed.");
1097 // var id = rows[0];
1101 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1102 param_escape(rows
.toString()), true);
1103 xmlhttp
.onreadystatechange
=infobox_callback
;
1108 function editSelectedFilter() {
1109 var rows
= getSelectedFilters();
1111 if (rows
.length
== 0) {
1112 alert("No filters are selected.");
1116 if (rows
.length
> 1) {
1117 alert("Please select only one filter.");
1123 editFilter(rows
[0]);
1128 function editSelectedFeed() {
1129 var rows
= getSelectedFeeds();
1131 if (rows
.length
== 0) {
1132 notify("No feeds are selected.");
1136 if (rows
.length
> 1) {
1137 notify("Please select one feed.");
1147 function editSelectedFeedCat() {
1148 var rows
= getSelectedFeedCats();
1150 if (rows
.length
== 0) {
1151 alert("No categories are selected.");
1155 if (rows
.length
> 1) {
1156 alert("Please select only one category.");
1162 editFeedCat(rows
[0]);
1166 function piggie_callback() {
1167 var piggie
= document
.getElementById("piggie");
1169 piggie
.style
.top
= piggie_top
;
1170 piggie
.style
.backgroundColor
= "white";
1171 piggie
.style
.borderWidth
= "1px";
1173 if (piggie_fwd
&& piggie_top
< 0) {
1174 setTimeout("piggie_callback()", 50);
1175 piggie_top
= piggie_top
+ 10;
1176 } else if (piggie_fwd
&& piggie_top
>= 0) {
1178 setTimeout("piggie_callback()", 50);
1179 } else if (!piggie_fwd
&& piggie_top
> -400) {
1180 setTimeout("piggie_callback()", 50);
1181 piggie_top
= piggie_top
- 10;
1182 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1183 piggie
.style
.display
= "none";
1188 var piggie_opacity
= 0;
1190 function piggie2_callback() {
1191 var piggie
= document
.getElementById("piggie");
1192 piggie
.style
.top
= 0;
1193 piggie
.style
.opacity
= piggie_opacity
;
1194 piggie
.style
.backgroundColor
= "transparent";
1195 piggie
.style
.borderWidth
= "0px";
1197 if (piggie_fwd
&& piggie_opacity
< 1) {
1198 setTimeout("piggie2_callback()", 50);
1199 piggie_opacity
= piggie_opacity
+ 0.03;
1200 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1202 setTimeout("piggie2_callback()", 50);
1203 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1204 setTimeout("piggie2_callback()", 50);
1205 piggie_opacity
= piggie_opacity
- 0.03;
1206 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1207 piggie
.style
.display
= "none";
1212 function localPiggieFunction(enable
) {
1214 var piggie
= document
.getElementById("piggie");
1215 piggie
.style
.display
= "block";
1217 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1225 function validateOpmlImport() {
1227 var opml_file
= document
.getElementById("opml_file");
1229 if (opml_file
.value
.length
== 0) {
1230 alert("No OPML file to upload.");
1237 function updateFilterList() {
1239 if (!xmlhttp_ready(xmlhttp
)) {
1240 printLockingError();
1244 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1246 // p_notify("Loading, please wait...");
1248 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1249 xmlhttp
.onreadystatechange
=filterlist_callback
;
1254 function updateLabelList() {
1256 if (!xmlhttp_ready(xmlhttp
)) {
1257 printLockingError();
1261 // p_notify("Loading, please wait...");
1263 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1265 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1266 xmlhttp
.onreadystatechange
=labellist_callback
;
1270 function updatePrefsList() {
1272 if (!xmlhttp_ready(xmlhttp
)) {
1273 printLockingError();
1277 // p_notify("Loading, please wait...");
1279 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1280 xmlhttp
.onreadystatechange
=prefslist_callback
;
1285 function selectTab(id
, noupdate
) {
1289 if (!xmlhttp_ready(xmlhttp
)) {
1290 printLockingError();
1296 if (id
== "feedConfig") {
1298 } else if (id
== "filterConfig") {
1300 } else if (id
== "labelConfig") {
1302 } else if (id
== "genConfig") {
1304 } else if (id
== "userConfig") {
1306 } else if (id
== "feedBrowser") {
1307 updateBigFeedBrowser();
1311 var tab
= document
.getElementById(active_tab
+ "Tab");
1314 if (tab
.className
.match("Selected")) {
1315 tab
.className
= "prefsTab";
1319 tab
= document
.getElementById(id
+ "Tab");
1322 if (!tab
.className
.match("Selected")) {
1323 tab
.className
= tab
.className
+ "Selected";
1329 setCookie('ttrss_pref_acttab', active_tab
);
1337 if (arguments
.callee
.done
) return;
1338 arguments
.callee
.done
= true;
1342 document
.getElementById("prefContent").innerHTML
=
1343 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1344 "to function properly. Your browser doesn't seem to support it.";
1348 active_tab
= getCookie("ttrss_pref_acttab");
1349 if (!active_tab
) active_tab
= "genConfig";
1350 selectTab(active_tab
);
1352 document
.onkeydown
= hotkey_handler
;
1355 exception_error("init", e
);
1359 function categorizeSelectedFeeds() {
1361 if (!xmlhttp_ready(xmlhttp
)) {
1362 printLockingError();
1366 var sel_rows
= getSelectedFeeds();
1368 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1369 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].id
;
1371 if (sel_rows
.length
> 0) {
1373 notify("Changing category of selected feeds...");
1375 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1376 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1377 xmlhttp
.onreadystatechange
=feedlist_callback
;
1382 alert("No feeds are selected.");
1388 function validatePrefsReset() {
1389 return confirm("Reset to defaults?");
1392 function browseFeeds(limit
) {
1394 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1395 xmlhttp
.onreadystatechange
=infobox_callback
;
1400 function feedBrowserSubscribe() {
1403 var selected
= getSelectedFeedsFromBrowser();
1405 if (selected
.length
> 0) {
1407 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1408 param_escape(selected
.toString()), true);
1409 xmlhttp
.onreadystatechange
=feedlist_callback
;
1412 alert("No feeds are selected.");
1416 exception_error("feedBrowserSubscribe", e
);
1420 function updateBigFeedBrowser(limit
) {
1422 if (!xmlhttp_ready(xmlhttp
)) {
1423 printLockingError();
1427 // p_notify("Loading, please wait...");
1429 var query
= "backend.php?op=pref-feed-browser";
1431 var limit_sel
= document
.getElementById("feedBrowserLimit");
1434 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1435 query
= query
+ "&limit=" + param_escape(limit
);
1438 xmlhttp
.open("GET", query
, true);
1439 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1443 function browserToggleExpand(id
) {
1445 /* if (feed_to_expand && feed_to_expand != id) {
1446 var d = document.getElementById("BRDET-" + feed_to_expand);
1447 d.style.display = "none";
1450 var d
= document
.getElementById("BRDET-" + id
);
1452 if (d
.style
.display
== "block") {
1453 d
.style
.display
= "none";
1457 feed_to_expand
= id
;
1459 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1460 + param_escape(id
), true);
1461 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1466 exception_error("browserExpand", e
);
1470 function validateNewPassword(form
) {
1471 if (form
.OLD_PASSWORD
.value
== "") {
1472 alert("Current password cannot be blank");
1475 if (form
.NEW_PASSWORD
.value
== "") {
1476 alert("New password cannot be blank");
1482 function selectPrefRows(kind
, select
) {
1485 var opbarid
= false;
1490 if (kind
== "feed") {
1491 opbarid
= "feedOpToolbar";
1494 lname
= "prefFeedList";
1495 } else if (kind
== "fcat") {
1496 opbarid
= "catOpToolbar";
1499 lname
= "prefFeedCatList";
1500 } else if (kind
== "filter") {
1501 opbarid
= "filterOpToolbar";
1504 lname
= "prefFilterList";
1505 } else if (kind
== "label") {
1506 opbarid
= "labelOpToolbar";
1509 lname
= "prefLabelList";
1510 } else if (kind
== "user") {
1511 opbarid
= "userOpToolbar";
1514 lname
= "prefUserList";
1518 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1519 disableContainerChildren(opbarid
, !select
);
1526 function toggleSelectPrefRow(sender
, kind
) {
1528 toggleSelectRow(sender
);
1531 var opbarid
= false;
1534 if (kind
== "feed") {
1535 opbarid
= "feedOpToolbar";
1536 nsel
= getSelectedFeeds();
1537 } else if (kind
== "fcat") {
1538 opbarid
= "catOpToolbar";
1539 nsel
= getSelectedFeedCats();
1540 } else if (kind
== "filter") {
1541 opbarid
= "filterOpToolbar";
1542 nsel
= getSelectedFilters();
1543 } else if (kind
== "label") {
1544 opbarid
= "labelOpToolbar";
1545 nsel
= getSelectedLabels();
1546 } else if (kind
== "user") {
1547 opbarid
= "userOpToolbar";
1548 nsel
= getSelectedUsers();
1551 if (opbarid
&& nsel
!= -1) {
1552 disableContainerChildren(opbarid
, nsel
== false);
1558 function toggleSelectFBListRow(sender
) {
1559 toggleSelectListRow(sender
);
1560 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);