summaryrefslogtreecommitdiff
path: root/js/viewfeed.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/viewfeed.js')
-rw-r--r--js/viewfeed.js57
1 files changed, 43 insertions, 14 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index 5875a9e48..1785fe3f5 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -1274,6 +1274,7 @@ function headlines_scroll_handler(e) {
// set topmost child in the buffer as active
if (getInitParam("cdm_auto_catchup") == 1 &&
+ getSelectedArticleIds2().length <= 1 &&
(!isCdmMode() || getInitParam("cdm_expanded"))) {
var rows = $$("#headlines-frame > div[id*=RROW]");
@@ -1314,7 +1315,7 @@ function headlines_scroll_handler(e) {
if (hsp) hsp.innerHTML = "";
}
- if (getInitParam("cdm_expanded") && isCdmMode()) {
+ if (isCdmMode()) {
updateFloatingTitle();
}
@@ -1488,6 +1489,12 @@ function cdmCollapseArticle(event, id, unmark) {
if (event) Event.stop(event);
PluginHost.run(PluginHost.HOOK_ARTICLE_COLLAPSED, id);
+
+ if (row.offsetTop < $("headlines-frame").scrollTop)
+ scrollToRowId(row.id);
+
+ Element.hide("floatingTitle");
+ $("floatingTitle").setAttribute("rowid", false);
}
} catch (e) {
@@ -2214,27 +2221,49 @@ function openSelectedAttachment(elem) {
}
}
+function scrollToRowId(id) {
+ try {
+ var row = $(id);
+
+ if (row)
+ $("headlines-frame").scrollTop = row.offsetTop;
+
+ } catch (e) {
+ exception_error("scrollToRowId", e);
+ }
+}
+
function updateFloatingTitle() {
try {
var hf = $("headlines-frame");
- var child = $("RROW-" + _active_article_id);
- if (child && child.offsetTop + child.offsetHeight > hf.scrollTop) {
+ var elems = $$("#headlines-frame > div[id*=RROW]");
- var header = child.getElementsByClassName("cdmHeader")[0];
+ for (var i = 0; i < elems.length; i++) {
- if (child.id != $("floatingTitle").getAttribute("rowid")) {
- $("floatingTitle").setAttribute("rowid", child.id);
- $("floatingTitle").innerHTML = header.innerHTML;
+ var child = elems[i];
- PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child);
- }
+ if (child && child.offsetTop + child.offsetHeight > hf.scrollTop) {
- if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 &&
- child.offsetTop + child.offsetHeight - hf.scrollTop > 100)
- Element.show("floatingTitle");
- else
- Element.hide("floatingTitle");
+ var header = child.getElementsByClassName("cdmHeader")[0];
+
+ if (child.id != $("floatingTitle").getAttribute("rowid")) {
+ $("floatingTitle").setAttribute("rowid", child.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;
+
+ 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");
+ else
+ Element.hide("floatingTitle");
+
+ return;
+
+ }
}
} catch (e) {