$("headlines-frame").scrollTop = 0;
$("floatingTitle").style.visibility = "hidden";
- $("floatingTitle").setAttribute("rowid", 0);
+ $("floatingTitle").setAttribute("data-article-id", 0);
$("floatingTitle").innerHTML = "";
}
} catch (e) { };
function showArticleInHeadlines(id, noexpand) {
try {
- selectArticles("none");
-
- var crow = $("RROW-" + id);
-
- if (!crow) return;
-
- var article_is_unread = crow.hasClassName("Unread");
+ var row = $("RROW-" + id);
+ if (!row) return;
if (!noexpand)
- crow.removeClassName("Unread");
- crow.addClassName("active");
+ row.removeClassName("Unread");
- selectArticles('none');
-
- var view_mode = false;
+ row.addClassName("active");
- try {
- view_mode = document.forms['main_toolbar_form'].view_mode;
- view_mode = view_mode[view_mode.selectedIndex].value;
- } catch (e) {
- //
- }
+ selectArticles('none');
markHeadline(id);
- if (article_is_unread && !noexpand)
- _force_scheduled_update = true;
-
} catch (e) {
exception_error("showArticleInHeadlines", e);
}
var ft = $("floatingTitle");
- if (ft && ft.getAttribute("rowid") == "RROW-" + id) {
+ if (ft && ft.getAttribute("data-article-id") == id) {
var fte = ft.getElementsByClassName("markedPic");
for (var i = 0; i < fte.length; i++)
var ft = $("floatingTitle");
- if (ft && ft.getAttribute("rowid") == "RROW-" + id) {
+ if (ft && ft.getAttribute("data-article-id") == id) {
var fte = ft.getElementsByClassName("pubPic");
for (var i = 0; i < fte.length; i++)
$$("#headlines-frame > div[id*=RROW][class*=Selected]").each(
function(child) {
- rv.push(child.id.replace("RROW-", ""));
+ rv.push(child.getAttribute("data-article-id"));
});
return rv;
var children = $$("#headlines-frame > div[id*=RROW-]");
children.each(function(child) {
- rv.push(child.id.replace("RROW-", ""));
- });
+ if (Element.visible(child)) {
+ rv.push(child.getAttribute("data-article-id"));
+ }
+ });
return rv;
var children = $$(query);
children.each(function(child) {
- var id = child.id.replace("RROW-", "");
+ var id = child.getAttribute("data-article-id");
var cb = dijit.getEnclosingWidget(
child.getElementsByClassName("rchk")[0]);
});
var tmph = dojo.connect(dialog, 'onLoad', function() {
- dojo.disconnect(tmph);
+ dojo.disconnect(tmph);
new Ajax.Autocompleter('tags_str', 'tags_choices',
"backend.php?op=article&method=completeTags",
if (child.offsetTop <= $("headlines-frame").scrollTop +
$("headlines-frame").offsetHeight) {
- var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
+ var cencw = $("CENCW-" + child.getAttribute("data-article-id"));
if (cencw) {
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
try {
// rate-limit in case of smooth scrolling and similar abominations
- if (e.scrollTop - _headlines_scroll_offset < 10) {
+ if (Math.max(e.scrollTop, _headlines_scroll_offset) - Math.min(e.scrollTop, _headlines_scroll_offset) < 25) {
return;
}
if ($("headlines-frame").scrollTop <= child.offsetTop &&
child.offsetTop - $("headlines-frame").scrollTop < 100 &&
- child.id.replace("RROW-", "") != _active_article_id) {
+ child.getAttribute("data-article-id") != _active_article_id) {
if (_active_article_id) {
var row = $("RROW-" + _active_article_id);
if (row) row.removeClassName("active");
}
- _active_article_id = child.id.replace("RROW-", "");
+ _active_article_id = child.getAttribute("data-article-id");
showArticleInHeadlines(_active_article_id, true);
updateSelectedPrompt();
break;
if (child.hasClassName("Unread") && $("headlines-frame").scrollTop >
(child.offsetTop + child.offsetHeight/2)) {
- var id = child.id.replace("RROW-", "");
+ var id = child.getAttribute("data-article-id")
if (catchup_id_batch.indexOf(id) == -1)
catchup_id_batch.push(id);
scrollToRowId(row.id);
$("floatingTitle").style.visibility = "hidden";
- $("floatingTitle").setAttribute("rowid", false);
+ $("floatingTitle").setAttribute("data-article-id", 0);
}
} catch (e) {
function initFloatingMenu() {
try {
- if (dijit.byId("floatingMenu"))
- dijit.byId("floatingMenu").destroyRecursive();
+ if (!dijit.byId("floatingMenu")) {
var menu = new dijit.Menu({
id: "floatingMenu",
targetNodeIds: ["floatingTitle"]
});
- var id = $("floatingTitle").getAttribute("rowid").replace("RROW-", "");
+ var tmph = dojo.connect(menu, '_openMyself', function (event) {
+ var callerNode = event.target, match = null, tries = 0;
- headlinesMenuCommon(menu, id);
+ while (match == null && callerNode && tries <= 3) {
+ match = callerNode.getAttribute("data-article-id");
+ callerNode = callerNode.parentNode;
+ ++tries;
+ }
+
+ if (match) this.callerRowId = match;
+
+ });
+
+ headlinesMenuCommon(menu);
menu.startup();
+ }
+
} catch (e) {
exception_error("initFloatingMenu", e);
}
}
-function headlinesMenuCommon(menu, base_id) {
+function headlinesMenuCommon(menu) {
try {
menu.addChild(new dijit.MenuItem({
label: __("Open original article"),
onClick: function(event) {
- openArticleInNewWindow(base_id ? base_id : this.getParent().callerRowId);
+ openArticleInNewWindow(this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Display article URL"),
onClick: function(event) {
- displayArticleUrl(base_id ? base_id : this.getParent().callerRowId);
+ displayArticleUrl(this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuSeparator());
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = (base_id ? base_id : this.getParent().callerRowId) + "";
+ var id = (this.getParent().callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleUnread(undefined, false, true, ids);
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = (base_id ? base_id : this.getParent().callerRowId) + "";
+ var id = (this.getParent().callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleMarked(undefined, false, true, ids);
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = (base_id ? base_id : this.getParent().callerRowId) + "";
+ var id = (this.getParent().callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionTogglePublished(undefined, false, true, ids);
menu.addChild(new dijit.MenuItem({
label: __("Mark above as read"),
onClick: function(event) {
- catchupRelativeToArticle(0, base_id ? base_id : this.getParent().callerRowId);
+ catchupRelativeToArticle(0, this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Mark below as read"),
onClick: function(event) {
- catchupRelativeToArticle(1, base_id ? base_id : this.getParent().callerRowId);
+ catchupRelativeToArticle(1, this.getParent().callerRowId);
}}));
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
+ var id = (this.getParent().ownerMenu.callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
+ var id = (this.getParent().ownerMenu.callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
var callerNode = event.target, match = null, tries = 0;
while (match == null && callerNode && tries <= 3) {
- match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$");
+
+ match = callerNode.getAttribute("data-article-id")
callerNode = callerNode.parentNode;
++tries;
}
- if (match) this.callerRowId = parseInt(match[1]);
+ if (match) this.callerRowId = match;
});
- headlinesMenuCommon(menu, false);
+ headlinesMenuCommon(menu);
menu.startup();
var callerNode = event.target, match = null, tries = 0;
while (match == null && callerNode && tries <= 3) {
- console.log(callerNode.id);
-
- match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$");
+ match = callerNode.getAttribute("data-feed-id")
callerNode = callerNode.parentNode;
++tries;
-
- console.log(match[1]);
}
- if (match) this.callerRowId = parseInt(match[1]);
+ if (match) this.callerRowId = match;
});
onClick: function(event) {
selectArticles("all",
"#headlines-frame > div[id*=RROW]"+
- "[orig-feed-id='"+menu.callerRowId+"']");
+ "[data-orig-feed-id='"+menu.callerRowId+"']");
}}));
selectArticles("none");
selectArticles("all",
"#headlines-frame > div[id*=RROW]"+
- "[orig-feed-id='"+menu.callerRowId+"']");
+ "[data-orig-feed-id='"+menu.callerRowId+"']");
catchupSelection();
}}));
var header = child.getElementsByClassName("cdmHeader")[0];
- if (unread_only || child.id != $("floatingTitle").getAttribute("rowid")) {
- if (child.id != $("floatingTitle").getAttribute("rowid")) {
- $("floatingTitle").setAttribute("rowid", child.id);
+ if (unread_only || child.getAttribute("data-article-id") != $("floatingTitle").getAttribute("data-article-id")) {
+ if (child.getAttribute("data-article-id") != $("floatingTitle").getAttribute("data-article-id")) {
+
+ $("floatingTitle").setAttribute("data-article-id", child.getAttribute("data-article-id"));
$("floatingTitle").innerHTML = header.innerHTML;
$("floatingTitle").firstChild.innerHTML = "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('"+child.id+"')\">" + $("floatingTitle").firstChild.innerHTML;
function catchupCurrentBatchIfNeeded() {
if (catchup_id_batch.length > 0) {
window.clearTimeout(catchup_timeout_id);
- catchup_timeout_id = window.setTimeout('catchupBatchedArticles()', 1000);
+ catchup_timeout_id = window.setTimeout(catchupBatchedArticles, 1000);
if (catchup_id_batch.length >= 10) {
catchupBatchedArticles();