var cids_requested = [];
var loaded_article_ids = [];
var _last_headlines_update = 0;
+var current_top_article_id = false;
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
if (infscroll_req == false) {
$("headlines-frame").scrollTop = 0;
- Element.hide("floatingTitle");
+ $("floatingTitle").style.visibility = "hidden";
$("floatingTitle").setAttribute("rowid", 0);
$("floatingTitle").innerHTML = "";
}
if (infscroll_req == false) {
loaded_article_ids = [];
+ current_top_article_id = false;
dijit.byId("headlines-frame").attr('content',
reply['headlines']['content']);
- dijit.byId("headlines-toolbar").attr('content',
- reply['headlines']['toolbar']);
+ //dijit.byId("headlines-toolbar").attr('content',
+ // reply['headlines']['toolbar']);
+
+ dojo.html.set($("headlines-toolbar"),
+ reply['headlines']['toolbar'],
+ {parseContent: true});
$$("#headlines-frame > div[id*=RROW]").each(function(row) {
if (loaded_article_ids.indexOf(row.id) != -1) {
}
});
+ if (loaded_article_ids.size() > 0) {
+ current_top_article_id = parseInt(loaded_article_ids[0].replace("RROW-", ""));
+ }
+
var hsp = $("headlines-spacer");
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
dijit.byId('headlines-frame').domNode.appendChild(hsp);
initHeadlinesMenu();
+ if (_infscroll_disable)
+ hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
+ __("Click to open next unread feed.") + "</a>";
+
if (_search_query) {
$("feed_title").innerHTML += "<span id='cancel_search'>" +
" (<a href='#' onclick='cancelSearch()'>" + __("Cancel search") + "</a>)" +
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
- if (getInitParam("cdm_auto_catchup") == 1) {
+// if (getInitParam("cdm_auto_catchup") == 1) {
c.domNode.appendChild(hsp);
- }
+// }
console.log("added " + new_elems.size() + " headlines");
var hsp = $("headlines-spacer");
- if (hsp) hsp.innerHTML = "";
+ if (hsp) hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
+ __("Click to open next unread feed.") + "</a>";
}
}
else
request_counters(true);
- } else if (transport.responseText) {
+ } else {
console.error("Invalid object received: " + transport.responseText);
dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
__('Could not update headlines (invalid object received - see error console for details)') +
"</div>");
- } else {
- //notify_error("Error communicating with server.");
- Element.show(dijit.byId("net-alert").domNode);
}
_infscroll_request_sent = 0;
// return;
// }
- } else if (transport.responseText) {
+ } else {
console.error("Invalid object received: " + transport.responseText);
render_article("<div class='whiteBox'>" +
__('Could not display article (invalid object received - see error console for details)') + "</div>");
- } else {
- Element.show(dijit.byId("net-alert").domNode);
}
var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
function unpackVisibleHeadlines() {
try {
- if (!isCdmMode()) return;
+ if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
$$("#headlines-frame > div[id*=RROW]").each(
function(child) {
((e.scrollTop + e.offsetHeight) / e.scrollHeight >= 0.7))) {
if (hsp)
- hsp.innerHTML = "<img src='images/indicator_tiny.gif'> " +
- __("Loading, please wait...");
+ hsp.innerHTML = "<span class='loading'><img src='images/indicator_tiny.gif'> " +
+ __("Loading, please wait...") + "</span>";
loadMoreHeadlines();
return;
}
} else {
- if (hsp) hsp.innerHTML = "";
+ if (hsp)
+ if (_infscroll_disable)
+ hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
+ __("Click to open next unread feed.") + "</a>";
+ else
+ hsp.innerHTML = "";
}
if (isCdmMode()) {
500);
}
}
+
+ if (_infscroll_disable) {
+ var child = $$("#headlines-frame div[id*=RROW]").last();
+
+ if (child && $("headlines-frame").scrollTop >
+ (child.offsetTop + child.offsetHeight - 50)) {
+
+ console.log("we seem to be at an end");
+
+ if (getInitParam("on_catchup_show_next_feed") == "1") {
+ openNextUnreadFeed();
+ }
+ }
+ }
}
} catch (e) {
}
}
+function openNextUnreadFeed() {
+ try {
+ var is_cat = activeFeedIsCat();
+ var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
+ if (nuf) viewfeed(nuf, '', is_cat);
+ } catch (e) {
+ exception_error("openNextUnreadFeed", e);
+ }
+}
+
function catchupBatchedArticles() {
try {
if (catchup_id_batch.length > 0 && !_infscroll_request_sent) {
if (row.offsetTop < $("headlines-frame").scrollTop)
scrollToRowId(row.id);
- Element.hide("floatingTitle");
+ $("floatingTitle").style.visibility = "hidden";
$("floatingTitle").setAttribute("rowid", false);
}
return !event.shiftKey;
}
- } else {
+ } else if (event.target.parents(".cdmHeader").length > 0) {
+
toggleSelected(id, true);
var elem = $("RROW-" + id);
}
}
+function updateScore(id) {
+ try {
+ var pic = $$("#RROW-" + id + " .hlScorePic")[0];
+
+ if (pic) {
+
+ var query = "op=article&method=getScore&id=" + param_escape(id);
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ console.log(transport.responseText);
+
+ var reply = JSON.parse(transport.responseText);
+
+ if (reply) {
+ pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
+ pic.setAttribute("score", reply["score"]);
+ pic.setAttribute("title", reply["score"]);
+ }
+ } });
+ }
+
+ } catch (e) {
+ exception_error("updateScore", e);
+ }
+}
+
function changeScore(id, pic) {
try {
var score = pic.getAttribute("score");
if (reply) {
pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
pic.setAttribute("score", new_score);
+ pic.setAttribute("title", new_score);
}
} });
}
var row = $(id);
if (row)
- $("headlines-frame").scrollTop = row.offsetTop;
+ $("headlines-frame").scrollTop = row.offsetTop - 4;
} catch (e) {
exception_error("scrollToRowId", e);
PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child);
}
- if (child.offsetTop < hf.scrollTop - header.offsetHeight &&
- child.offsetTop + child.offsetHeight - hf.scrollTop > header.offsetHeight)
- Element.show("floatingTitle");
+ $("floatingTitle").style.marginRight = hf.offsetWidth - child.offsetWidth + "px";
+ if (header.offsetTop + header.offsetHeight < hf.scrollTop + $("floatingTitle").offsetHeight - 5 &&
+ child.offsetTop + child.offsetHeight >= hf.scrollTop + $("floatingTitle").offsetHeight - 5)
+ $("floatingTitle").style.visibility = "visible";
else
- Element.hide("floatingTitle");
+ $("floatingTitle").style.visibility = "hidden";
return;
exception_error("updateFloatingTitle", e);
}
}
+
+function cdmFooterClick(event) {
+ event.stopPropagation();
+}
\ No newline at end of file