summaryrefslogtreecommitdiff
path: root/feedlist.js
diff options
context:
space:
mode:
Diffstat (limited to 'feedlist.js')
-rw-r--r--feedlist.js71
1 files changed, 65 insertions, 6 deletions
diff --git a/feedlist.js b/feedlist.js
index 8f1b5efec..034900619 100644
--- a/feedlist.js
+++ b/feedlist.js
@@ -30,13 +30,59 @@ function viewCategory(cat) {
return false;
}
+function printFeedEntry(id, title, row_class, unread, icon) {
+
+ var tmp = "";
+ var fctr_class = "";
+ var feed_icon = "";
+
+ if (unread > 0) {
+ row_class += "Unread";
+ fctr_class = "feedCtrHasUnread";
+ } else {
+ fctr_class = "feedCtrNoUnread";
+ }
+
+ if (icon) {
+ feed_icon = "<img id='FIMG-"+id+"' src='" + icon + "'>";
+ } else {
+ feed_icon = "<img id='FIMG-"+id+"' src='images/blank_icon.gif'>";
+ }
+
+ var link = "<a title=\"FIXME\" id=\"FEEDL-"+id+"\""+
+ "href=\"javascript:viewfeed('"+id+"', '', false, '', false, 0);\">"+
+ title + "</a>";
+
+ tmp += "<li id='FEEDR-"+id+"' class="+row_class+">" + feed_icon +
+ "<span id=\"FEEDN-"+id+"\">" + link + "</span>";
+
+ tmp += " <span class='"+fctr_class+"' id=\"FEEDCTR-"+id+"\">" +
+ "(<span id=\"FEEDU-"+id+"\">"+unread+"</span>)</span>";
+
+ tmp += "</li>";
+
+ return tmp;
+}
+
+function render_feedlist(data) {
+ try {
+
+ var f = document.getElementById("feeds-frame");
+ f.innerHTML = data;
+// cache_invalidate("FEEDLIST");
+// cache_inject("FEEDLIST", data, getInitParam("num_feeds"));
+ feedlist_init();
+
+ } catch (e) {
+ exception_error("render_feedlist", e);
+ }
+}
+
function feedlist_callback2(transport) {
try {
debug("feedlist_callback2");
if (!transport_error_check(transport)) return;
- var f = document.getElementById("feeds-frame");
- f.innerHTML = transport.responseText;
- feedlist_init();
+ render_feedlist(transport.responseText);
} catch (e) {
exception_error("feedlist_callback2", e);
}
@@ -46,19 +92,23 @@ function viewNextFeedPage() {
try {
//if (!getActiveFeedId()) return;
- debug("viewNextFeedPage: calling viewfeed(), p: " + _feed_cur_page+1);
+ debug("viewNextFeedPage: calling viewfeed(), p: " + parseInt(_feed_cur_page+1));
viewfeed(getActiveFeedId(), undefined, activeFeedIsCat(), undefined,
- undefined, _feed_cur_page+1);
+ undefined, parseInt(_feed_cur_page+1));
} catch (e) {
exception_error("viewNextFeedPage", e);
}
}
+
function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
try {
+ if (offline_mode) return viewfeed_offline(feed, subop, is_cat, subop_param,
+ skip_history, offset);
+
// if (!offset) page_offset = 0;
last_requested_article = 0;
@@ -136,6 +186,8 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
if (subop == "MarkAllRead") {
+ catchup_local_feed(feed, is_cat);
+
var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
if (show_next_feed) {
@@ -257,6 +309,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
request_counters();
+ remove_splash();
} else {
@@ -349,6 +402,8 @@ function toggleCollapseCat(cat) {
new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat));
+ local_collapse_cat(cat);
+
} catch (e) {
exception_error("toggleCollapseCat", e);
}
@@ -397,7 +452,7 @@ function feedlist_init() {
document.onmousedown = mouse_down_handler;
document.onmouseup = mouse_up_handler;
- setTimeout("timeout()", 1);
+ if (!offline_mode) setTimeout("timeout()", 1);
if (typeof correctPNG != 'undefined') {
correctPNG();
@@ -605,6 +660,8 @@ function request_counters_real() {
try {
+ if (offline_mode) return;
+
debug("requesting counters...");
var query = "backend.php?op=rpc&subop=getAllCounters";
@@ -654,3 +711,5 @@ function request_counters() {
exception_error("request_counters", e);
}
}
+
+