try {
handle_rpc_json(transport);
- loading_set_progress(25);
-
console.log("headlines_callback2 [offset=" + offset + "] B:" + background + " I:" + infscroll_req);
var is_cat = false;
if (background) {
var content = reply['headlines']['content'];
- if (getInitParam("cdm_auto_catchup") == 1) {
- content = content + "<div id='headlines-spacer'></div>";
- }
+ content = content + "<div id='headlines-spacer'></div>";
return;
}
}
});
- if (getInitParam("cdm_auto_catchup") == 1) {
- var hsp = $("headlines-spacer");
- if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
- dijit.byId('headlines-frame').domNode.appendChild(hsp);
- }
+ var hsp = $("headlines-spacer");
+ if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
+ dijit.byId('headlines-frame').domNode.appendChild(hsp);
initHeadlinesMenu();
c.domNode.scrollTop = 0;
} catch (e) { };
+ PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, article);
+
c.attr('content', article);
correctHeadlinesOffset(getActiveArticleId());
try {
var query = "?op=rpc&id=" + id + "&method=mark";
- var img = $("FMPIC-" + id);
+ var row = $("RROW-" + id);
+ if (!row) return;
- if (!img) return;
+ var imgs = row.getElementsByClassName("markedPic");
- if (img.src.match("mark_unset")) {
- img.src = img.src.replace("mark_unset", "mark_set");
- img.alt = __("Unstar article");
- query = query + "&mark=1";
+ for (i = 0; i < imgs.length; i++) {
+ var img = imgs[i];
- } else {
- img.src = img.src.replace("mark_set", "mark_unset");
- img.alt = __("Star article");
- query = query + "&mark=0";
+ if (!row.hasClassName("marked")) {
+ img.src = img.src.replace("mark_unset", "mark_set");
+ img.alt = __("Unstar article");
+ query = query + "&mark=1";
+ } else {
+ img.src = img.src.replace("mark_set", "mark_unset");
+ img.alt = __("Star article");
+ query = query + "&mark=0";
+ }
}
+ row.toggleClassName("marked");
+
if (!client_only) {
new Ajax.Request("backend.php", {
parameters: query,
query = query + "¬e=undefined";
}
- var img = $("FPPIC-" + id);
-
- if (!img) return;
+ var row = $("RROW-" + id);
+ if (!row) return;
- if (img.src.match("pub_unset") || note != undefined) {
- img.src = img.src.replace("pub_unset", "pub_set");
- img.alt = __("Unpublish article");
- query = query + "&pub=1";
+ var imgs = row.getElementsByClassName("pubPic");
- } else {
- img.src = img.src.replace("pub_set", "pub_unset");
- img.alt = __("Publish article");
+ for (i = 0; i < imgs.length; i++) {
+ var img = imgs[i];
- query = query + "&pub=0";
+ if (!row.hasClassName("published") || note != undefined) {
+ img.src = img.src.replace("pub_unset", "pub_set");
+ img.alt = __("Unpublish article");
+ query = query + "&pub=1";
+ } else {
+ img.src = img.src.replace("pub_set", "pub_unset");
+ img.alt = __("Publish article");
+ query = query + "&pub=0";
+ }
}
+ if (note != undefined)
+ row.addClassName("published");
+ else
+ row.toggleClassName("published");
+
if (!client_only) {
new Ajax.Request("backend.php", {
parameters: query,
if (cb) cb.attr("checked", true);
}
}
+
+ updateSelectedPrompt();
} catch (e) {
exception_error("toggleSelected", e);
}
}
+function updateSelectedPrompt() {
+ try {
+ var count = getSelectedArticleIds2().size();
+ var elem = $("selected_prompt");
+
+ if (elem) {
+ elem.innerHTML = ngettext("%d article selected",
+ "%d articles selected", count).replace("%d", count);
+
+ if (count > 0)
+ Element.show(elem);
+ else
+ Element.hide(elem);
+ }
+
+ } catch (e) {
+ exception_error("updateSelectedPrompt", e);
+ }
+}
+
function toggleUnread_afh(effect) {
try {
if (cb) cb.attr("checked", false);
}
} else if (mode == "marked") {
- var img = $("FMPIC-" + child.id.replace("RROW-", ""));
-
- if (img && img.src.match("mark_set")) {
+ if (child.hasClassName("marked")) {
child.addClassName("Selected");
if (cb) cb.attr("checked", true);
} else {
if (cb) cb.attr("checked", false);
}
} else if (mode == "published") {
- var img = $("FPPIC-" + child.id.replace("RROW-", ""));
-
- if (img && img.src.match("pub_set")) {
+ if (child.hasClassName("published")) {
child.addClassName("Selected");
if (cb) cb.attr("checked", true);
} else {
}
});
+ updateSelectedPrompt();
+
} catch (e) {
exception_error("selectArticles", e);
}
function setActiveArticleId(id) {
_active_article_id = id;
+ PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, _active_article_id);
}
function getActiveArticleId() {
var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
if (cencw) {
+ PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
+
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
cencw.setAttribute('id', '');
Element.show(cencw);
}
}
-function cdmCollapseArticle(event, id) {
+function cdmCollapseArticle(event, id, unmark) {
try {
+ if (unmark == undefined) unmark = true;
+
var row = $("RROW-" + id);
var elem = $("CICD-" + id);
Element.hide(elem);
Element.show("CEXC-" + id);
Element.hide(collapse);
- row.removeClassName("active");
- markHeadline(id, false);
+ if (unmark) {
+ row.removeClassName("active");
+
+ markHeadline(id, false);
- if (id == getActiveArticleId()) {
- setActiveArticleId(0);
+ if (id == getActiveArticleId()) {
+ setActiveArticleId(0);
+ }
}
if (event) Event.stop(event);
- }
-
- } catch (e) {
- exception_error("cdmCollapseArticle", e);
- }
-}
-
-function cdmUnexpandArticle(event, id) {
- try {
- var row = $("RROW-" + id);
- var elem = $("CICD-" + id);
-
- if (elem && row) {
- var collapse = $$("div#RROW-" + id +
- " span[class='collapseBtn']")[0];
- Element.hide(elem);
- Element.show("CEXC-" + id);
- Element.hide(collapse);
-
- if (event) Event.stop(event);
+ PluginHost.run(PluginHost.HOOK_ARTICLE_COLLAPSED, id);
}
} catch (e) {
- exception_error("cdmUnexpandArticle", e);
+ exception_error("cdmCollapseArticle", e);
}
}
toggleSelected(id);
$("RROW-" + id).addClassName("active");
+ PluginHost.run(PluginHost.HOOK_ARTICLE_EXPANDED, id);
+
} catch (e) {
exception_error("cdmExpandArticle", e);
}
}
}
-
-function player(elem) {
- var aid = elem.getAttribute("audio-id");
- var status = elem.getAttribute("status");
-
- var audio = $(aid);
-
- if (audio) {
- if (status == 0) {
- audio.play();
- status = 1;
- elem.innerHTML = __("Playing...");
- elem.title = __("Click to pause");
- elem.addClassName("playing");
- } else {
- audio.pause();
- status = 0;
- elem.innerHTML = __("Play");
- elem.title = __("Click to play");
- elem.removeClassName("playing");
- }
-
- elem.setAttribute("status", status);
- } else {
- alert("Your browser doesn't seem to support HTML5 audio.");
- }
-}
-
function cache_set(id, obj) {
//console.log("cache_set: " + id);
if (has_storage)