]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
2 This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com>
3 Licensed under GPL v.2 or (at your preference) any later version.
9 /*@if (@_jscript_version >= 5)
10 // JScript gives us Conditional compilation, we can cope with old IE versions.
11 // and security blocked creation of the objects.
13 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
16 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
23 if (!xmlhttp
&& typeof XMLHttpRequest
!='undefined') {
24 xmlhttp
= new XMLHttpRequest();
28 function feedlist_callback() {
29 var container
= document
.getElementById('feeds');
30 if (xmlhttp
.readyState
== 4) {
31 container
.innerHTML
=xmlhttp
.responseText
;
35 function notify_callback() {
36 var container
= document
.getElementById('notify');
37 if (xmlhttp
.readyState
== 4) {
38 container
.innerHTML
=xmlhttp
.responseText
;
43 function updateFeedList() {
45 document
.getElementById("feeds").innerHTML
= "Loading feeds, please wait...";
47 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
48 xmlhttp
.onreadystatechange
=feedlist_callback
;
53 function toggleSelectRow(sender
) {
54 var parent_row
= sender
.parentNode
.parentNode
;
57 if (!parent_row
.className
.match("Selected")) {
58 parent_row
.className
= parent_row
.className
+ "Selected";
61 if (parent_row
.className
.match("Selected")) {
62 parent_row
.className
= parent_row
.className
.replace("Selected", "");
69 var link
= document
.getElementById("fadd_link");
71 if (link
.value
.length
== 0) {
72 notify("Error: Missing feed URL.");
74 notify("Adding feed...");
76 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
77 param_escape(link
.value
), true);
78 xmlhttp
.onreadystatechange
=feedlist_callback
;
87 function editFeed(feed
) {
89 notify("Editing feed...");
91 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
92 param_escape(feed
), true);
93 xmlhttp
.onreadystatechange
=feedlist_callback
;
98 function getSelectedFeeds() {
100 var content
= document
.getElementById("prefFeedList");
102 var sel_rows
= new Array();
104 for (i
= 0; i
< content
.rows
.length
; i
++) {
105 if (content
.rows
[i
].className
.match("Selected")) {
106 var row_id
= content
.rows
[i
].id
.replace("FEEDR-", "");
107 sel_rows
.push(row_id
);
114 function readSelectedFeeds() {
116 var sel_rows
= getSelectedFeeds();
118 if (sel_rows
.length
> 0) {
120 notify("Marking selected feeds as read...");
122 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
123 param_escape(sel_rows
.toString()), true);
124 xmlhttp
.onreadystatechange
=notify_callback
;
129 notify("Error: Please select some feeds first.");
134 function unreadSelectedFeeds() {
136 var sel_rows
= getSelectedFeeds();
138 if (sel_rows
.length
> 0) {
140 notify("Marking selected feeds as unread...");
142 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
143 param_escape(sel_rows
.toString()), true);
144 xmlhttp
.onreadystatechange
=notify_callback
;
149 notify("Error: Please select some feeds first.");
154 function removeSelectedFeeds() {
156 var sel_rows
= getSelectedFeeds();
158 if (sel_rows
.length
> 0) {
160 notify("Removing selected feeds...");
162 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
163 param_escape(sel_rows
.toString()), true);
164 xmlhttp
.onreadystatechange
=feedlist_callback
;
169 notify("Error: Please select some feeds first.");