From abba5dd4d4bffc530c9b76a2b88c79857b8ee6a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Tolar Date: Fri, 21 Jun 2013 23:30:55 -0500 Subject: Remove content when an article is dismissed --- js/viewfeed.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index b7e321d73..6d0941181 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1611,6 +1611,10 @@ function dismissArticle(id) { new Effect.Fade(elem, {duration : 0.5}); + // Remove the content, too + var elem_content = $("CICD-" + id); + Element.remove(elem_content); + if (id == getActiveArticleId()) { setActiveArticleId(0); } @@ -1634,6 +1638,10 @@ function dismissSelectedArticles() { ids[i] != getActiveArticleId()) { new Effect.Fade(elem, {duration : 0.5}); sel.push(ids[i]); + + // Remove the content, too + var elem_content = $("CICD-" + ids[i]); + Element.remove(elem_content); } else { tmp.push(ids[i]); } @@ -1661,6 +1669,10 @@ function dismissReadArticles() { !elem.hasClassName("Selected")) { new Effect.Fade(elem, {duration : 0.5}); + + // Remove the content, too + var elem_content = $("CICD-" + ids[i]); + Element.remove(elem_content); } else { tmp.push(ids[i]); } -- cgit v1.2.3-54-g00ecf From 055a37e083c9b18bf027cafa724478acd01cae41 Mon Sep 17 00:00:00 2001 From: Jeffrey Tolar Date: Fri, 21 Jun 2013 23:31:59 -0500 Subject: Fix incorrect function name in exception handling --- js/viewfeed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 6d0941181..7182ec084 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1679,7 +1679,7 @@ function dismissReadArticles() { } } catch (e) { - exception_error("dismissSelectedArticles", e); + exception_error("dismissReadArticles", e); } } -- cgit v1.2.3-54-g00ecf From 3b2605a02e63b20d5b0d2bc388daba9a22b68422 Mon Sep 17 00:00:00 2001 From: Jeffrey Tolar Date: Fri, 21 Jun 2013 23:49:35 -0500 Subject: Add some checks to see if the content element exists This *might* help dismissal not break when not using combined mode. --- js/viewfeed.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 7182ec084..84230f61a 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1613,7 +1613,9 @@ function dismissArticle(id) { // Remove the content, too var elem_content = $("CICD-" + id); - Element.remove(elem_content); + if (elem_content) { + Element.remove(elem_content); + } if (id == getActiveArticleId()) { setActiveArticleId(0); @@ -1641,7 +1643,9 @@ function dismissSelectedArticles() { // Remove the content, too var elem_content = $("CICD-" + ids[i]); - Element.remove(elem_content); + if (elem_content) { + Element.remove(elem_content); + } } else { tmp.push(ids[i]); } @@ -1672,7 +1676,9 @@ function dismissReadArticles() { // Remove the content, too var elem_content = $("CICD-" + ids[i]); - Element.remove(elem_content); + if (elem_content) { + Element.remove(elem_content); + } } else { tmp.push(ids[i]); } -- cgit v1.2.3-54-g00ecf From d1343b844d96e808620a230ee8f39764acedb581 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 25 Jun 2013 01:35:07 +0400 Subject: make floating title less cpu intensive --- js/viewfeed.js | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 84230f61a..9c48fbcdb 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2216,30 +2216,24 @@ function openSelectedAttachment(elem) { function updateFloatingTitle() { try { var hf = $("headlines-frame"); + var child = $("RROW-" + _active_article_id); - var elems = $$("#headlines-frame > div[id*=RROW]"); + if (child && child.offsetTop + child.offsetHeight > hf.scrollTop) { - for (var i = 0; i < elems.length; i++) { - var child = elems[i]; + var header = child.getElementsByClassName("cdmHeader")[0]; - if (child.offsetTop + child.offsetHeight > hf.scrollTop) { - - var header = child.getElementsByClassName("cdmHeader")[0]; - - if (child.id != $("floatingTitle").getAttribute("rowid")) { - $("floatingTitle").setAttribute("rowid", child.id); - $("floatingTitle").innerHTML = header.innerHTML; - } - - if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 && - child.offsetTop + child.offsetHeight - hf.scrollTop > 100) - Element.show("floatingTitle"); - else - Element.hide("floatingTitle"); - - break; + if (child.id != $("floatingTitle").getAttribute("rowid")) { + $("floatingTitle").setAttribute("rowid", child.id); + $("floatingTitle").innerHTML = header.innerHTML; } + + if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 && + child.offsetTop + child.offsetHeight - hf.scrollTop > 100) + Element.show("floatingTitle"); + else + Element.hide("floatingTitle"); } + } catch (e) { exception_error("updateFloatingTitle", e); } -- cgit v1.2.3-54-g00ecf From d1754390cc1c45eb469daf0221e235ca1a02d555 Mon Sep 17 00:00:00 2001 From: Veit Lehmann Date: Tue, 25 Jun 2013 06:08:44 +0300 Subject: only do article update operations once when scrolling I discovered that DOM operations and function calls were done several times inside the 100px mirror when scrolling through articles. Especially painful on seamless scrolling systems like Mac OS, where dozens of updates would slow down this part dramatically. This change fixes it. --- js/viewfeed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 9c48fbcdb..1c5811fe7 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1281,7 +1281,8 @@ function headlines_scroll_handler(e) { var child = rows[i]; if ($("headlines-frame").scrollTop < child.offsetTop && - child.offsetTop - $("headlines-frame").scrollTop < 100) { + child.offsetTop - $("headlines-frame").scrollTop < 100 && + child.id.replace("RROW-", "") != _active_article_id) { if (_active_article_id) { var row = $("RROW-" + _active_article_id); -- cgit v1.2.3-54-g00ecf From 4f62f8f6dc950499698e06b9a56025c28f9a331e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Jun 2013 08:30:35 +0400 Subject: add js hook for floating title --- js/PluginHost.js | 1 + js/viewfeed.js | 2 ++ 2 files changed, 3 insertions(+) (limited to 'js/viewfeed.js') diff --git a/js/PluginHost.js b/js/PluginHost.js index 668d215f9..ae89ba481 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -10,6 +10,7 @@ var PluginHost = { HOOK_ARTICLE_COLLAPSED: 7, HOOK_PARAMS_LOADED: 8, HOOK_RUNTIME_INFO_LOADED: 9, + HOOK_FLOATING_TITLE: 10, hooks: [], register: function (name, callback) { if (typeof(this.hooks[name]) == 'undefined') diff --git a/js/viewfeed.js b/js/viewfeed.js index 1c5811fe7..5875a9e48 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2226,6 +2226,8 @@ function updateFloatingTitle() { if (child.id != $("floatingTitle").getAttribute("rowid")) { $("floatingTitle").setAttribute("rowid", child.id); $("floatingTitle").innerHTML = header.innerHTML; + + PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 && -- cgit v1.2.3-54-g00ecf From 03304fda542518936f1056700cdf4f23d1953ddb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 9 Jul 2013 12:34:57 +0400 Subject: if multiple articles are selected, do not reset active article / selection on scroll if auto catchup is enabled --- js/viewfeed.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 5875a9e48..0cdb09425 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]"); -- cgit v1.2.3-54-g00ecf From 8ee5e9e5e69e9a54dabad9abc580cc2391198464 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 10 Jul 2013 22:11:24 +0400 Subject: rework floatingtitle --- css/cdm.css | 72 ++++++++++++++++++++++++++++++++++------------- images/page_white_go.png | Bin 0 -> 612 bytes js/viewfeed.js | 51 +++++++++++++++++++++++++-------- 3 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 images/page_white_go.png (limited to 'js/viewfeed.js') diff --git a/css/cdm.css b/css/cdm.css index 7e85cbfff..2d0797db3 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -230,39 +230,71 @@ div.cdmHeader span.author { div#floatingTitle { position : absolute; z-index : 5; - top : 30px; - right : 20px; - border : 1px solid #ccc; - background : white; - border-radius : 3px; - box-shadow : 0px 0px 3px 0px rgba(0,0,0,0.1); + top : 26px; + right : 0px; + left : 0px; + border-color : #ccc; + border-width : 0px 0px 1px 0px; + border-style : solid; + background : #fcfcfc; color : #555; - font-size : 10px; - padding : 3px; + box-shadow : 0px 1px 1px 0px rgba(0,0,0,0.1); } div#floatingTitle > * { display : table-cell; white-space : nowrap; vertical-align : middle; + padding : 9px 5px; } -div#floatingTitle span.titleWrap { - max-width : 200px; - overflow : hidden; - text-overflow : ellipsis; +div#floatingTitle img { + margin-right : 4px; + margin-left : 4px; } -div#floatingTitle img { - padding-right : 3px; +div#floatingTitle span.author { + color : #555; + font-size : 11px; + font-weight : normal; +} + +div#floatingTitle a.title { + font-size : 14px; + color : #999; + font-weight : bold; +} +div#floatingTitle img.anchor { + margin-right : 1px; + margin-left : 0px; +} + +div#floatingTitle div.hlFeed { + padding-right : 10px; + color : #555; + font-weight : normal; + font-style : italic; + font-size : 11px; + white-space : nowrap; +} + +div#floatingTitle span.updated { + padding-right : 10px; + white-space : nowrap; + color : #555; + font-size : 11px; +} + +div#floatingTitle div.hlFeed a { + color : #555; +} + +div#floatingTitle span.titleWrap { + width : 100%; } -div#floatingTitle .dijit, -div#floatingTitle span.updated, -div#floatingTitle div.scoreWrap, -div#floatingTitle div.hlFeed, -div#floatingTitle span.author, -div#floatingTitle img.tinyFeedIcon { +div#floatingTitle .dijit, +div#floatingTitle img.hlScorePic { display : none; } diff --git a/images/page_white_go.png b/images/page_white_go.png new file mode 100644 index 000000000..7e62a924b Binary files /dev/null and b/images/page_white_go.png differ diff --git a/js/viewfeed.js b/js/viewfeed.js index 0cdb09425..ec7706547 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2215,27 +2215,54 @@ 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; - var header = child.getElementsByClassName("cdmHeader")[0]; + if (getInitParam("cdm_auto_catchup")) + elems = [$$("RROW-" + _active_article_id)]; + else + elems = $$("#headlines-frame > div[id*=RROW]"); - if (child.id != $("floatingTitle").getAttribute("rowid")) { - $("floatingTitle").setAttribute("rowid", child.id); - $("floatingTitle").innerHTML = header.innerHTML; + for (var i = 0; i < elems.length; i++) { - PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); - } + var child = elems[i]; - if (child.offsetTop < hf.scrollTop - header.offsetHeight - 100 && - child.offsetTop + child.offsetHeight - hf.scrollTop > 100) - Element.show("floatingTitle"); - else - Element.hide("floatingTitle"); + if (child && child.offsetTop + child.offsetHeight > hf.scrollTop) { + + var header = child.getElementsByClassName("cdmHeader")[0]; + + if (child.id != $("floatingTitle").getAttribute("rowid")) { + $("floatingTitle").setAttribute("rowid", child.id); + $("floatingTitle").innerHTML = header.innerHTML; + $("floatingTitle").firstChild.innerHTML = "" + $("floatingTitle").firstChild.innerHTML; + + PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); + } + + if (child.offsetTop < hf.scrollTop - header.offsetHeight) + Element.show("floatingTitle"); + else + Element.hide("floatingTitle"); + + return; + + } } } catch (e) { -- cgit v1.2.3-54-g00ecf From d095f42fa479aba61f23eb2f7520b2bdab8f0020 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 10 Jul 2013 22:16:10 +0400 Subject: floating title: remove cdm auto catchup id hack for the time being --- js/viewfeed.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index ec7706547..0b6cb1fff 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2232,12 +2232,7 @@ function updateFloatingTitle() { var hf = $("headlines-frame"); var child = $("RROW-" + _active_article_id); - var elems; - - if (getInitParam("cdm_auto_catchup")) - elems = [$$("RROW-" + _active_article_id)]; - else - elems = $$("#headlines-frame > div[id*=RROW]"); + var elems = $$("#headlines-frame > div[id*=RROW]"); for (var i = 0; i < elems.length; i++) { -- cgit v1.2.3-54-g00ecf From 301a09dc5591e6f4022bec9611d6f5979d645d0b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Jul 2013 08:35:12 +0400 Subject: fix floating title sometimes obscuring next article title --- js/viewfeed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 0b6cb1fff..e23db86bd 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2230,7 +2230,6 @@ function scrollToRowId(id) { function updateFloatingTitle() { try { var hf = $("headlines-frame"); - var child = $("RROW-" + _active_article_id); var elems = $$("#headlines-frame > div[id*=RROW]"); @@ -2250,7 +2249,8 @@ function updateFloatingTitle() { PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } - if (child.offsetTop < hf.scrollTop - header.offsetHeight) + if (child.offsetTop < hf.scrollTop - header.offsetHeight && + child.offsetTop + child.offsetHeight - hf.scrollTop > header.offsetHeight) Element.show("floatingTitle"); else Element.hide("floatingTitle"); -- cgit v1.2.3-54-g00ecf From 7415fcf2129c4ac0cfd814b0beb917e2372447f1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Jul 2013 12:28:24 +0400 Subject: enable floating title for expandable combined mode, minor expandable mode fixes --- css/cdm.css | 4 ++++ js/viewfeed.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'js/viewfeed.js') diff --git a/css/cdm.css b/css/cdm.css index c16cf28f1..98fd4edf6 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -110,6 +110,10 @@ div.cdm.expandable div.cdmHeader span.titleWrap { max-width : 500px; } +div.cdm.expandable.active div.cdmHeader span.titleWrap { + white-space : normal; +} + div.cdm.expandable div.cdmHeader a.title { font-weight : bold; color : #555; diff --git a/js/viewfeed.js b/js/viewfeed.js index e23db86bd..1785fe3f5 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1315,7 +1315,7 @@ function headlines_scroll_handler(e) { if (hsp) hsp.innerHTML = ""; } - if (getInitParam("cdm_expanded") && isCdmMode()) { + if (isCdmMode()) { updateFloatingTitle(); } @@ -1489,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) { -- cgit v1.2.3-54-g00ecf From 65f0eb01aae3ae01b0f8a3b4e33683b717d8d3e5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Jul 2013 16:49:25 +0400 Subject: support headlines context menu in floating title --- classes/feeds.php | 2 +- js/viewfeed.js | 120 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 48 deletions(-) (limited to 'js/viewfeed.js') diff --git a/classes/feeds.php b/classes/feeds.php index c57328fe7..e71be4e55 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -316,7 +316,7 @@ class Feeds extends Handler_Protected { if (!is_array($labels)) $labels = get_article_labels($id); - $labels_str = ""; + $labels_str = ""; $labels_str .= format_article_labels($labels, $id); $labels_str .= ""; diff --git a/js/viewfeed.js b/js/viewfeed.js index 1785fe3f5..57989eed3 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1599,9 +1599,9 @@ function show_labels_in_headlines(transport) { if (data) { data['info-for-headlines'].each(function(elem) { - var ctr = $("HLLCTR-" + elem.id); - - if (ctr) ctr.innerHTML = elem.labels; + $$(".HLLCTR-" + elem.id).each(function(ctr) { + ctr.innerHTML = elem.labels; + }); }); } } catch (e) { @@ -1916,58 +1916,39 @@ function closeArticlePanel() { dijit.byId("content-insert")); } -function initHeadlinesMenu() { +function initFloatingMenu() { try { - if (dijit.byId("headlinesMenu")) - dijit.byId("headlinesMenu").destroyRecursive(); - - var ids = []; - - if (!isCdmMode()) { - nodes = $$("#headlines-frame > div[id*=RROW]"); - } else { - nodes = $$("#headlines-frame span[id*=RTITLE]"); - } - - nodes.each(function(node) { - ids.push(node.id); - }); + if (dijit.byId("floatingMenu")) + dijit.byId("floatingMenu").destroyRecursive(); - var menu = new dijit.Menu({ - id: "headlinesMenu", - targetNodeIds: ids, - }); + var menu = new dijit.Menu({ + id: "floatingMenu", + targetNodeIds: ["floatingTitle"] + }); - var tmph = dojo.connect(menu, '_openMyself', function (event) { - var callerNode = event.target, match = null, tries = 0; + var id = $("floatingTitle").getAttribute("rowid").replace("RROW-", ""); - while (match == null && callerNode && tries <= 3) { - match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$"); - callerNode = callerNode.parentNode; - ++tries; - } + headlinesMenuCommon(menu, id); - if (match) this.callerRowId = parseInt(match[1]); - - }); + menu.startup(); + } catch (e) { + exception_error("initFloatingMenu", e); + } +} -/* if (!isCdmMode()) - menu.addChild(new dijit.MenuItem({ - label: __("View article"), - onClick: function(event) { - view(this.getParent().callerRowId); - }})); */ +function headlinesMenuCommon(menu, base_id) { + try { menu.addChild(new dijit.MenuItem({ label: __("Open original article"), onClick: function(event) { - openArticleInNewWindow(this.getParent().callerRowId); + openArticleInNewWindow(base_id ? base_id : this.getParent().callerRowId); }})); menu.addChild(new dijit.MenuItem({ label: __("Display article URL"), onClick: function(event) { - displayArticleUrl(this.getParent().callerRowId); + displayArticleUrl(base_id ? base_id : this.getParent().callerRowId); }})); menu.addChild(new dijit.MenuSeparator()); @@ -1977,7 +1958,7 @@ function initHeadlinesMenu() { onClick: function(event) { var ids = getSelectedArticleIds2(); // cast to string - var id = this.getParent().callerRowId + ""; + var id = (base_id ? base_id : this.getParent().callerRowId) + ""; ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id]; selectionToggleUnread(undefined, false, true, ids); @@ -1988,7 +1969,7 @@ function initHeadlinesMenu() { onClick: function(event) { var ids = getSelectedArticleIds2(); // cast to string - var id = this.getParent().callerRowId + ""; + var id = (base_id ? base_id : this.getParent().callerRowId) + ""; ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id]; selectionToggleMarked(undefined, false, true, ids); @@ -1999,7 +1980,7 @@ function initHeadlinesMenu() { onClick: function(event) { var ids = getSelectedArticleIds2(); // cast to string - var id = this.getParent().callerRowId + ""; + var id = (base_id ? base_id : this.getParent().callerRowId) + ""; ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id]; selectionTogglePublished(undefined, false, true, ids); @@ -2010,13 +1991,13 @@ function initHeadlinesMenu() { menu.addChild(new dijit.MenuItem({ label: __("Mark above as read"), onClick: function(event) { - catchupRelativeToArticle(0, this.getParent().callerRowId); + catchupRelativeToArticle(0, base_id ? base_id : this.getParent().callerRowId); }})); menu.addChild(new dijit.MenuItem({ label: __("Mark below as read"), onClick: function(event) { - catchupRelativeToArticle(1, this.getParent().callerRowId); + catchupRelativeToArticle(1, base_id ? base_id : this.getParent().callerRowId); }})); @@ -2042,7 +2023,7 @@ function initHeadlinesMenu() { onClick: function(event) { var ids = getSelectedArticleIds2(); // cast to string - var id = this.getParent().ownerMenu.callerRowId + ""; + var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + ""; ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id]; @@ -2055,7 +2036,7 @@ function initHeadlinesMenu() { onClick: function(event) { var ids = getSelectedArticleIds2(); // cast to string - var id = this.getParent().ownerMenu.callerRowId + ""; + var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + ""; ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id]; @@ -2076,6 +2057,49 @@ function initHeadlinesMenu() { } + + } catch (e) { + exception_error("headlinesMenuCommon", e); + } +} + +function initHeadlinesMenu() { + try { + if (dijit.byId("headlinesMenu")) + dijit.byId("headlinesMenu").destroyRecursive(); + + var ids = []; + + if (!isCdmMode()) { + nodes = $$("#headlines-frame > div[id*=RROW]"); + } else { + nodes = $$("#headlines-frame span[id*=RTITLE]"); + } + + nodes.each(function(node) { + ids.push(node.id); + }); + + var menu = new dijit.Menu({ + id: "headlinesMenu", + targetNodeIds: ids, + }); + + var tmph = dojo.connect(menu, '_openMyself', function (event) { + var callerNode = event.target, match = null, tries = 0; + + while (match == null && callerNode && tries <= 3) { + match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$"); + callerNode = callerNode.parentNode; + ++tries; + } + + if (match) this.callerRowId = parseInt(match[1]); + + }); + + headlinesMenuCommon(menu, false); + menu.startup(); } catch (e) { @@ -2252,6 +2276,8 @@ function updateFloatingTitle() { $("floatingTitle").innerHTML = header.innerHTML; $("floatingTitle").firstChild.innerHTML = "" + $("floatingTitle").firstChild.innerHTML; + initFloatingMenu(); + PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } -- cgit v1.2.3-54-g00ecf From 0971cc619d302bad27fcd540fe59426299710ceb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Jul 2013 09:15:07 +0400 Subject: remove dijit checkbox element from floatingTitle --- js/viewfeed.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 57989eed3..9a13f8c05 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2278,6 +2278,11 @@ function updateFloatingTitle() { initFloatingMenu(); + var cb = $$("#floatingTitle .dijitCheckBox")[0]; + + if (cb) + cb.parentNode.removeChild(cb); + PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } -- cgit v1.2.3-54-g00ecf From 41d37fb2c39b2b270981dac423e3d6c55293048d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Jul 2013 09:59:14 +0400 Subject: add experimental hack to show row unread status in floating title --- css/cdm.css | 5 +++++ js/viewfeed.js | 30 +++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) (limited to 'js/viewfeed.js') diff --git a/css/cdm.css b/css/cdm.css index 98fd4edf6..23b8c7767 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -268,6 +268,11 @@ div#floatingTitle a.title { color : #999; font-weight : bold; } + +div#floatingTitle.Unread a.title { + color : black; +} + div#floatingTitle img.anchor { margin-right : 1px; margin-left : 0px; diff --git a/js/viewfeed.js b/js/viewfeed.js index 9a13f8c05..0a20cabcf 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -835,6 +835,8 @@ function selectionToggleUnread(set_state, callback, no_error, ids) { } } + updateFloatingTitle(true); + if (rows.length > 0) { var cmode = ""; @@ -1742,6 +1744,7 @@ function cdmClicked(event, id) { if (article_is_unread) { decrementFeedCounter(getActiveFeedId(), activeFeedIsCat()); + updateFloatingTitle(true); } var query = "?op=rpc&method=catchupSelected" + @@ -2257,8 +2260,10 @@ function scrollToRowId(id) { } } -function updateFloatingTitle() { +function updateFloatingTitle(unread_only) { try { + if (!isCdmMode()) return; + var hf = $("headlines-frame"); var elems = $$("#headlines-frame > div[id*=RROW]"); @@ -2271,17 +2276,24 @@ function updateFloatingTitle() { var header = child.getElementsByClassName("cdmHeader")[0]; - if (child.id != $("floatingTitle").getAttribute("rowid")) { - $("floatingTitle").setAttribute("rowid", child.id); - $("floatingTitle").innerHTML = header.innerHTML; - $("floatingTitle").firstChild.innerHTML = "" + $("floatingTitle").firstChild.innerHTML; + if (unread_only || child.id != $("floatingTitle").getAttribute("rowid")) { + if (child.id != $("floatingTitle").getAttribute("rowid")) { + $("floatingTitle").setAttribute("rowid", child.id); + $("floatingTitle").innerHTML = header.innerHTML; + $("floatingTitle").firstChild.innerHTML = "" + $("floatingTitle").firstChild.innerHTML; - initFloatingMenu(); + initFloatingMenu(); - var cb = $$("#floatingTitle .dijitCheckBox")[0]; + var cb = $$("#floatingTitle .dijitCheckBox")[0]; + + if (cb) + cb.parentNode.removeChild(cb); + } - if (cb) - cb.parentNode.removeChild(cb); + if (child.hasClassName("Unread")) + $("floatingTitle").addClassName("Unread"); + else + $("floatingTitle").removeClassName("Unread"); PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } -- cgit v1.2.3-54-g00ecf From 00fe7886b6984c78820b39bee520e51f5a6fe0ed Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Jul 2013 10:05:48 +0400 Subject: update floating title unread status when auto catching up --- js/viewfeed.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 0a20cabcf..dd1c64326 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1383,6 +1383,8 @@ function catchupBatchedArticles() { catchup_id_batch.remove(id); }); + updateFloatingTitle(true); + } }); } -- cgit v1.2.3-54-g00ecf From 95be6e0c89e4fcbd04cb59e599caef2685dd5ded Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Jul 2013 12:16:54 +0400 Subject: fix second row being selected on viewfeed (closes #748) --- js/viewfeed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index dd1c64326..b62058ca8 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1283,7 +1283,7 @@ function headlines_scroll_handler(e) { for (var i = 0; i < rows.length; i++) { var child = rows[i]; - if ($("headlines-frame").scrollTop < child.offsetTop && + if ($("headlines-frame").scrollTop <= child.offsetTop && child.offsetTop - $("headlines-frame").scrollTop < 100 && child.id.replace("RROW-", "") != _active_article_id) { -- cgit v1.2.3-54-g00ecf From 2e35b3bd6bb54da3284b8a06b025b39972a756a0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 9 Sep 2013 14:38:28 +0400 Subject: prevent automatic selection of headlines row first child when scrolling in 3panel mode because it screws with keyboard navigation (closes #752) --- js/viewfeed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index b62058ca8..cb9a3c646 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1275,9 +1275,9 @@ function headlines_scroll_handler(e) { unpackVisibleHeadlines(); // set topmost child in the buffer as active - if (getInitParam("cdm_auto_catchup") == 1 && + if (isCdmMode() && getInitParam("cdm_auto_catchup") == 1 && getSelectedArticleIds2().length <= 1 && - (!isCdmMode() || getInitParam("cdm_expanded"))) { + getInitParam("cdm_expanded")) { var rows = $$("#headlines-frame > div[id*=RROW]"); for (var i = 0; i < rows.length; i++) { -- cgit v1.2.3-54-g00ecf From 87065739cdc569bbcfe92ad6f0b6ebef3c72f3ec Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 17 Oct 2013 13:38:48 +0400 Subject: add context menu for cdmFeedTitle; change mark as read prompt for grouped headlines more clear --- classes/feeds.php | 18 +++++++------- css/cdm.css | 20 ++++++++++++++++ js/viewfeed.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 98 insertions(+), 11 deletions(-) (limited to 'js/viewfeed.js') diff --git a/classes/feeds.php b/classes/feeds.php index e26318e7e..7f5fd10af 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -430,12 +430,12 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('Mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; - $reply['content'] .= "
". - "
$feed_icon_img
". - "". - $line["feed_title"]." $vf_catchup_link
"; + $reply['content'] .= "
". + "
$feed_icon_img
". + "". $line["feed_title"]." + $vf_catchup_link
"; } } @@ -443,7 +443,7 @@ class Feeds extends Handler_Protected { $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; - $reply['content'] .= "
"; + $reply['content'] .= "
"; $reply['content'] .= "
"; @@ -524,7 +524,7 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; $has_feed_icon = feed_has_icon($feed_id); @@ -534,7 +534,7 @@ class Feeds extends Handler_Protected { //$feed_icon_img = "\"\""; } - $reply['content'] .= "
". + $reply['content'] .= "
". "
$feed_icon_img
". "". $line["feed_title"]." $vf_catchup_link
"; @@ -547,7 +547,7 @@ class Feeds extends Handler_Protected { $expanded_class = $expand_cdm ? "expanded" : "expandable"; $reply['content'] .= "
"; + id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>"; $reply['content'] .= "
"; $reply['content'] .= "
"; diff --git a/css/cdm.css b/css/cdm.css index c91f09927..dd4346e4c 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -341,4 +341,24 @@ div#floatingTitle img.hlScorePic { text-decoration : line-through; } +div.cdmFeedTitle > * { + display : table-cell; + vertical-align : middle; +} + +div.cdmFeedTitle a.title { + width : 100%; +} + +div.cdmFeedTitle a.catchup { + text-align : right; + color : #555; + padding-right : 10px; + font-size : 11px; + white-space : nowrap; +} + +div.cdmFeedTitle a.catchup:hover { + color : #4684ff; +} diff --git a/js/viewfeed.js b/js/viewfeed.js index cb9a3c646..3c02d4626 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -961,10 +961,12 @@ function getLoadedArticleIds() { } // mode = all,none,unread,invert,marked,published -function selectArticles(mode) { +function selectArticles(mode, query) { try { - var children = $$("#headlines-frame > div[id*=RROW]"); + if (!query) query = "#headlines-frame > div[id*=RROW]"; + + var children = $$(query); children.each(function(child) { var id = child.id.replace("RROW-", ""); @@ -2107,6 +2109,71 @@ function initHeadlinesMenu() { menu.startup(); + /* vgroup feed title menu */ + + var nodes = $$("#headlines-frame > div[class='cdmFeedTitle']"); + var ids = []; + + nodes.each(function(node) { + ids.push(node.id); + }); + + if (ids.length > 0) { + if (dijit.byId("headlinesFeedTitleMenu")) + dijit.byId("headlinesFeedTitleMenu").destroyRecursive(); + + var menu = new dijit.Menu({ + id: "headlinesFeedTitleMenu", + targetNodeIds: ids, + }); + + var tmph = dojo.connect(menu, '_openMyself', function (event) { + 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]+)$"); + callerNode = callerNode.parentNode; + ++tries; + + console.log(match[1]); + } + + if (match) this.callerRowId = parseInt(match[1]); + + }); + + menu.addChild(new dijit.MenuItem({ + label: __("Select articles in group"), + onClick: function(event) { + selectArticles("all", + "#headlines-frame > div[id*=RROW]"+ + "[orig-feed-id='"+menu.callerRowId+"']"); + + }})); + + menu.addChild(new dijit.MenuItem({ + label: __("Mark group as read"), + onClick: function(event) { + selectArticles("all", + "#headlines-frame > div[id*=RROW]"+ + "[orig-feed-id='"+menu.callerRowId+"']"); + + catchupSelection(); + }})); + + + menu.addChild(new dijit.MenuItem({ + label: __("Mark feed as read"), + onClick: function(event) { + catchupFeedInGroup(menu.callerRowId); + }})); + + menu.startup(); + + } + } catch (e) { exception_error("initHeadlinesMenu", e); } -- cgit v1.2.3-54-g00ecf From 24940c3dc9279a2cf18495b19d6c9a2efa299cd8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 Oct 2013 18:45:24 +0400 Subject: catchup group: deselect everything before processing --- js/viewfeed.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 3c02d4626..301260f13 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -2156,6 +2156,7 @@ function initHeadlinesMenu() { menu.addChild(new dijit.MenuItem({ label: __("Mark group as read"), onClick: function(event) { + selectArticles("none"); selectArticles("all", "#headlines-frame > div[id*=RROW]"+ "[orig-feed-id='"+menu.callerRowId+"']"); -- cgit v1.2.3-54-g00ecf From b8fd08d6dbc32e892f19830c25abfc416e14fa75 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 21 Oct 2013 16:55:36 +0400 Subject: do not unpack all visible headlines in collapsed mode because those are unpacked on expand --- js/viewfeed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/viewfeed.js') diff --git a/js/viewfeed.js b/js/viewfeed.js index 301260f13..3295182fc 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1245,7 +1245,7 @@ function postMouseOut(id) { function unpackVisibleHeadlines() { try { - if (!isCdmMode()) return; + if (!isCdmMode() || !getInitParam("cdm_expanded")) return; $$("#headlines-frame > div[id*=RROW]").each( function(child) { -- cgit v1.2.3-54-g00ecf From 1bffd1068faee6c33ea86dcec188679d5f1ea4c8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 27 Jan 2014 22:03:42 +0400 Subject: unify main and headlines toolbar --- classes/feeds.php | 31 ++++++++++++++---------- css/cdm.css | 2 +- css/tt-rss.css | 71 +++++++++++++++++++++---------------------------------- index.php | 7 +++--- js/viewfeed.js | 8 +++++-- 5 files changed, 57 insertions(+), 62 deletions(-) (limited to 'js/viewfeed.js') diff --git a/classes/feeds.php b/classes/feeds.php index 536f1b793..c0f5bcf93 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -43,6 +43,8 @@ class Feeds extends Handler_Protected { $search_q = ""; } + $reply .= ""; + $rss_link = htmlspecialchars(get_self_url_prefix() . "/public.php?op=rss&id=$feed_id$cat_q$search_q"); @@ -50,10 +52,18 @@ class Feeds extends Handler_Protected { $error_class = $error ? "error" : ""; - $reply .= ""; - $reply .= ""; + $reply .= " + + "; + + +# $reply .= ""; $reply .= ""; + $reply .= ""; + if ($feed_site_url) { $last_updated = T_sprintf("Last updated: %s", $feed_last_updated); @@ -72,18 +82,15 @@ class Feeds extends Handler_Protected { } $reply .= ""; + $reply .= ""; - $reply .= " - - "; - - $reply .= ""; +# $reply .= ""; // left part - $reply .= __('Select:')." + $reply .= ""; + + $reply .= " ".__('All').", ".__('Unread').", ".__('Invert').", @@ -132,14 +139,14 @@ class Feeds extends Handler_Protected { $reply .= ""; - //$reply .= "
"; - //$reply .= "get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) { echo $p->hook_headline_toolbar_button($feed_id, $is_cat); } + $reply .= ""; + return $reply; } diff --git a/css/cdm.css b/css/cdm.css index 5b004fccf..ef3ef52d6 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -247,7 +247,7 @@ div.cdmHeader span.author { div#floatingTitle { position : absolute; z-index : 5; - top : 25px; + top : 0px; right : 0px; left : 0px; border-color : #ccc; diff --git a/css/tt-rss.css b/css/tt-rss.css index 96e9fb00d..ee921716a 100644 --- a/css/tt-rss.css +++ b/css/tt-rss.css @@ -203,14 +203,6 @@ a:hover { color : #909090; } -/* #headlines-frame div.hl:nth-child(even) { - background : #fafafa; -} */ - -#headlines-frame.normal { - -} - .hl { border-width : 0px 0px 1px 0px; border-style : solid; @@ -321,39 +313,44 @@ div.prefHelp { color : #555; } -div#headlines-toolbar { - border-width : 0px; - font-size : 12px; +#main-toolbar > * { + white-space : nowrap; + display : table-cell; + color : #999; font-family : "Segoe UI", Tahoma, sans-serif; - color : #555; - padding : 0px; - margin : 0px; - overflow : hidden; - height : 25px; - line-height : 25px; - padding-left : 4px; - background : white; } -div#headlines-toolbar .dijitSelect { - font-size : 11px; - position : relative; - top : -2px; +#main-toolbar #headlines-toolbar { + padding-right : 4px; + width : 100%; +} + +#main-toolbar #headlines-toolbar span.holder { + display : table; + width : 100%; } -div#headlines-toolbar span.r { - float: right; - position: relative; - padding : 0 4px 0px 4px; +#main-toolbar #headlines-toolbar span.holder > * { + display : table-cell; +} + +#main-toolbar #headlines-toolbar .main { text-align : right; -} +} + +#headlines-toolbar span.r img { + margin-right : 4px; + position : relative; + top : 3px; +} #headlines-toolbar span.r .error a { color : red; } -div#headlines-toolbar span.r a { - color : #555; +#main-toolbar #selected_prompt { + font-style : italic; + text-align : center; } span.contentPreview { @@ -524,14 +521,6 @@ form { padding : 0px; } -#main_toolbar_form { - margin : 0px; - padding : 0px; - display : table-cell; - white-space : nowrap; - width : 100%; -} - div.loadingPrompt { padding : 1em; text-align : center; @@ -551,12 +540,6 @@ div.whiteBox { margin: 0; } */ -#toolbar div.actionChooser { - display : table-cell; - text-align : right; - padding-right : 3px; -} - div.autocomplete { position : absolute; width : 250px; diff --git a/index.php b/index.php index d0369e808..303eacda0 100644 --- a/index.php +++ b/index.php @@ -153,6 +153,10 @@
+
+ +
+