1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 01:35:54 +00:00

code cleanups, start work on sepUpdateFeed mechanism

This commit is contained in:
Andrew Dolgov
2005-08-28 06:48:32 +01:00
parent 7fdd55fb41
commit caa4e57f27
3 changed files with 76 additions and 22 deletions

View File

@@ -19,6 +19,9 @@ var total_feed_entries = false;
var _viewfeed_autoselect_first = false;
var _viewfeed_autoselect_last = false;
var _update_ids;
var _update_num_ids;
var search_query = "";
/*@cc_on @*/
@@ -60,6 +63,14 @@ function feedlist_callback() {
}
}
function feed_update_callback() {
if (xmlhttp_rpc.readyState == 4) {
var result = xmlhttp_rpc.responseText;
notify(_update_ids);
updateFeed(_update_ids.shift());
}
}
function viewfeed_callback() {
var container = document.getElementById('headlines');
if (xmlhttp.readyState == 4) {
@@ -130,6 +141,30 @@ function refetch_callback() {
}
}
function updateFeed(feed_id) {
var query_str = "backend.php?op=rpc&subop=updateFeed&feed=" + feed_id;
if (xmlhttp_ready(xmlhttp_rpc)) {
xmlhttp_rpc.open("GET", query_str, true);
xmlhttp_rpc.onreadystatechange=feed_update_callback;
xmlhttp_rpc.send(null);
} else {
printLockingError();
}
}
function scheduleSepFeedUpdate(force) {
notify("Updating feeds in background (M2)...");
_update_ids = getFeedIds();
_update_num_ids = _update_ids.length;
updateFeed(_update_ids.pop());
}
function scheduleFeedUpdate(force) {
notify("Updating feeds in background...");
@@ -297,6 +332,21 @@ function markHeadline(id) {
}
}
function getFeedIds() {
var content = document.getElementById("feedsList");
var rows = new Array();
for (i = 0; i < content.rows.length; i++) {
var id = content.rows[i].id.replace("FEEDR-", "");
if (id.length > 0) {
rows.push(id);
}
}
return rows;
}
function cleanSelected(element) {
var content = document.getElementById(element);