]>
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
;
42 function updateFeedList() {
44 document
.getElementById("feeds").innerHTML
= "Loading feeds, please wait...";
46 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
47 xmlhttp
.onreadystatechange
=feedlist_callback
;
52 function toggleSelectRow(sender
) {
53 var parent_row
= sender
.parentNode
.parentNode
;
56 if (!parent_row
.className
.match("Selected")) {
57 parent_row
.className
= parent_row
.className
+ "Selected";
60 if (parent_row
.className
.match("Selected")) {
61 parent_row
.className
= parent_row
.className
.replace("Selected", "");
68 var link
= document
.getElementById("fadd_link");
70 if (link
.value
.length
== 0) {
71 notify("Error: Missing feed URL.");
73 notify("Adding feed...");
75 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
76 param_escape(link
.value
), true);
77 xmlhttp
.onreadystatechange
=feedlist_callback
;
86 function editFeed(feed
) {
88 notify("Editing feed...");
90 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
91 param_escape(feed
), true);
92 xmlhttp
.onreadystatechange
=feedlist_callback
;
97 function getSelectedFeeds() {
99 var content
= document
.getElementById("prefFeedList");
101 var sel_rows
= new Array();
103 for (i
= 0; i
< content
.rows
.length
; i
++) {
104 if (content
.rows
[i
].className
.match("Selected")) {
105 var row_id
= content
.rows
[i
].id
.replace("FEEDR-", "");
106 sel_rows
.push(row_id
);
113 function readSelectedFeeds() {
115 var sel_rows
= getSelectedFeeds();
117 if (sel_rows
.length
> 0) {
119 notify("Marking selected feeds as read...");
121 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
122 param_escape(sel_rows
.toString()), true);
123 xmlhttp
.onreadystatechange
=notify_callback
;
128 notify("Error: Please select some feeds first.");
133 function unreadSelectedFeeds() {
135 var sel_rows
= getSelectedFeeds();
137 if (sel_rows
.length
> 0) {
139 notify("Marking selected feeds as unread...");
141 xmlhttp
.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
142 param_escape(sel_rows
.toString()), true);
143 xmlhttp
.onreadystatechange
=notify_callback
;
148 notify("Error: Please select some feeds first.");
153 function removeSelectedFeeds() {
155 var sel_rows
= getSelectedFeeds();
157 if (sel_rows
.length
> 0) {
159 notify("Removing selected feeds...");
161 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
162 param_escape(sel_rows
.toString()), true);
163 xmlhttp
.onreadystatechange
=feedlist_callback
;
168 notify("Error: Please select some feeds first.");