var last_feeds = [];
+var init_params = {};
+
+var db = false;
+var store = false;
var _active_feed_id = false;
var _active_feed_offset = false;
}
}
-function catchup_visible_articles(callback) {
+function get_visible_article_ids() {
try {
-
var elems = $("headlines-content").getElementsByTagName("LI");
var ids = [];
}
}
+ return ids;
+
+ } catch (e) {
+ exception_error("get_visible_article_ids", e);
+ }
+}
+
+function catchup_visible_articles(callback) {
+ try {
+
+ var ids = get_visible_article_ids();
+
if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) {
var query = "?op=rpc&subop=catchupSelected" +
console.log(query);
- var img = $("F-" + feed_id).getElementsByTagName("IMG")[0];
+ if ($("F-" + feed_id)) {
+ var img = $("F-" + feed_id).getElementsByTagName("IMG")[0];
- if (img && !no_indicator) {
- img.setAttribute("orig_src", img.src);
- img.src = 'images/indicator_tiny.gif';
+ if (img && !no_indicator) {
+ img.setAttribute("orig_src", img.src);
+ img.src = 'images/indicator_tiny.gif';
+ }
}
new Ajax.Request("backend.php", {
function get_feed_icon(feed) {
try {
if (feed.has_icon)
- return 'icons/' + feed.id + '.ico';
+ return getInitParam('icons_location') + "/" + feed.id + '.ico';
if (feed.id == -1)
return 'images/mark_set.png';
if (article.excerpt.trim() == "")
article.excerpt = __("Click to expand article.");
- var tmp_html = "<li id=\"A-"+article.id+"\" "+style+" class=\"unread\">" +
+ var li_class = "unread";
+
+ var fresh_max = getInitParam("fresh_article_max_age") * 60 * 60;
+ var d = new Date();
+
+ if (d.getTime() / 1000 - article.updated < fresh_max)
+ li_class = "fresh";
+
+ var tmp_html = "<li id=\"A-"+article.id+"\" "+style+" class=\""+li_class+"\">" +
icon_part +
"<div class='digest-check'>" +
}
}
- if (pr) {
- $('headlines-content').appendChild(pr);
- if (!no_effects) new Effect.ScrollTo(inserted);
- } else {
- $('headlines-content').innerHTML += "<li id='H-MORE-PROMPT'>" +
- "<div class='body'>" +
- "<a href=\"javascript:catchup_visible_articles()\">" +
- __("Mark as read") + "</a> | " +
- "<a href=\"javascript:load_more()\">" +
- __("Load more...") + "</a>" +
- "<img style=\"display : none\" "+
+ var ids = get_visible_article_ids();
+
+ if (ids.length > 0) {
+ if (pr) {
+ $('headlines-content').appendChild(pr);
+ if (!no_effects) new Effect.ScrollTo(inserted);
+ } else {
+ $('headlines-content').innerHTML += "<li id='H-MORE-PROMPT'>" +
+ "<div class='body'>" +
+ "<a href=\"javascript:catchup_visible_articles()\">" +
+ __("Mark as read") + "</a> | " +
+ "<a href=\"javascript:load_more()\">" +
+ __("Load more...") + "</a>" +
+ "<img style=\"display : none\" "+
"id=\"H-LOADING-IMG\" src='images/indicator_tiny.gif'>" +
- "</div></li>";
+ "</div></li>";
+ }
+ } else {
+ // FIXME : display some kind of "nothing to see here" prompt here
}
if (replace && !no_effects)
}
}
-function sanity_check(transport) {
- try {
-
-
- } catch (e) {
- exception_error("sanity_check", e);
- }
-}
-
function init() {
try {
new Ajax.Request("backend.php", {
parameters: "?op=rpc&subop=sanityCheck",
onComplete: function(transport) {
- sanity_check(transport);
+ backend_sanity_check_callback(transport);
} });
} catch (e) {