diff options
author | Andrew Dolgov <[email protected]> | 2018-12-05 21:44:26 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-05 21:44:26 +0300 |
commit | f905c2a9436581f74355815a0ba0e2fad56d6c34 (patch) | |
tree | 5c00e2b1378e4f5f4b30a8aa5463dc286ee547e7 /js | |
parent | 1d334b9762249c78461b3ef5d496a060d1ded78e (diff) | |
parent | a0b1664620abb096ac21de8f2e680e383c34a0e1 (diff) |
Merge branch 'material-icons' into weblate-integration
Diffstat (limited to 'js')
-rw-r--r-- | js/Article.js | 1 | ||||
-rwxr-xr-x | js/FeedTree.js | 31 | ||||
-rw-r--r-- | js/Feeds.js | 6 | ||||
-rwxr-xr-x | js/Headlines.js | 44 | ||||
-rw-r--r-- | js/PrefFeedTree.js | 4 | ||||
-rw-r--r-- | js/PrefFilterTree.js | 12 | ||||
-rw-r--r-- | js/tt-rss.js | 2 |
7 files changed, 45 insertions, 55 deletions
diff --git a/js/Article.js b/js/Article.js index f2c4007f5..507560ee4 100644 --- a/js/Article.js +++ b/js/Article.js @@ -233,7 +233,6 @@ define(["dojo/_base/declare"], function (declare) { if (force || e.offsetTop + e.offsetHeight > (ctr.scrollTop + ctr.offsetHeight) || e.offsetTop < ctr.scrollTop) { - // expanded cdm has a 4px margin now ctr.scrollTop = e.offsetTop; Element.hide("floatingTitle"); diff --git a/js/FeedTree.js b/js/FeedTree.js index 75d1c901b..812b9dd08 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -8,14 +8,27 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], _createTreeNode: function(args) { const tnode = new dijit._TreeNode(args); - const icon = dojo.doc.createElement('img'); - if (args.item.icon && args.item.icon[0]) { - icon.src = args.item.icon[0]; - } else { - icon.src = 'images/blank_icon.gif'; + const iconName = args.item.icon ? String(args.item.icon[0]) : null; + let iconNode; + + if (iconName) { + if (iconName.indexOf("/") == -1) { + iconNode = dojo.doc.createElement("i"); + iconNode.className = "material-icons icon icon-" + iconName; + iconNode.innerHTML = iconName; + } else { + iconNode = dojo.doc.createElement('img'); + if (args.item.icon && args.item.icon[0]) { + iconNode.src = args.item.icon[0]; + } else { + iconNode.src = 'images/blank_icon.gif'; + } + iconNode.className = 'icon'; + } } - icon.className = 'tinyFeedIcon'; - domConstruct.place(icon, tnode.iconNode, 'only'); + + if (iconNode) + domConstruct.place(iconNode, tnode.iconNode, 'only'); const id = args.item.id[0]; const bare_id = parseInt(id.substr(id.indexOf(':')+1)); @@ -161,7 +174,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], return ""; }, getIconClass: function (item, opened) { - return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon"; + return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon"; }, getLabelClass: function (item, opened) { return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; @@ -275,7 +288,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], treeNode = treeNode[0]; const icon = dojo.doc.createElement('img'); icon.src = src; - icon.className = 'tinyFeedIcon'; + icon.className = 'icon'; domConstruct.place(icon, treeNode.iconNode, 'only'); return true; } diff --git a/js/Feeds.js b/js/Feeds.js index 07bc37192..70b5176f4 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -319,10 +319,10 @@ define(["dojo/_base/declare"], function (declare) { }, 10 * 1000); } - Form.enable("main_toolbar_form"); + Form.enable("toolbar-main"); let query = Object.assign({op: "feeds", method: "view", feed: feed}, - dojo.formToObject("main_toolbar_form")); + dojo.formToObject("toolbar-main")); if (method) query.m = method; @@ -347,7 +347,7 @@ define(["dojo/_base/declare"], function (declare) { query.m = "ForceUpdate"; } - Form.enable("main_toolbar_form"); + Form.enable("toolbar-main"); if (!delayed) if (!this.setExpando(feed, is_cat, diff --git a/js/Headlines.js b/js/Headlines.js index c16b070be..e0caddc2a 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -14,6 +14,8 @@ define(["dojo/_base/declare"], function (declare) { if (!in_body && (event.ctrlKey || id == Article.getActive() || App.getInitParam("cdm_expanded"))) { Article.openInNewWindow(id); + Headlines.toggleUnread(id, 0); + return false; } if (Article.getActive() != id) { @@ -28,7 +30,7 @@ define(["dojo/_base/declare"], function (declare) { } else { if (event.ctrlKey) { Article.openInNewWindow(id); - Article.setActive(id); + Headlines.toggleUnread(id, 0); } else { Article.view(id); } @@ -46,7 +48,7 @@ define(["dojo/_base/declare"], function (declare) { } }, loadMore: function () { - const view_mode = document.forms["main_toolbar_form"].view_mode.value; + const view_mode = document.forms["toolbar-main"].view_mode.value; const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length; const num_all = $$("#headlines-frame > div[id*=RROW]").length; const num_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat()); @@ -171,15 +173,11 @@ define(["dojo/_base/declare"], function (declare) { ft.setAttribute("data-article-id", id); ft.innerHTML = header.innerHTML; - ft.firstChild.innerHTML = "<img class='anchor marked-pic' src='images/page_white_go.png' " + - "onclick=\"Article.cdmScrollToId(" + id + ", true)\">" + ft.firstChild.innerHTML; - this.initFloatingMenu(); + ft.select(".dijitCheckBox")[0].outerHTML = "<i class=\"material-icons anchor\" onclick=\"Article.cdmScrollToId(" + id + ", true)\">expand_more</i>"; - const cb = ft.select(".rchk")[0]; + this.initFloatingMenu(); - if (cb) - cb.parentNode.removeChild(cb); } if (row.hasClassName("Unread")) @@ -270,7 +268,7 @@ define(["dojo/_base/declare"], function (declare) { if (offset == 0) { this.loaded_article_ids = []; - dojo.html.set($("headlines-toolbar"), + dojo.html.set($("toolbar-headlines"), reply['headlines']['toolbar'], {parseContent: true}); @@ -389,7 +387,7 @@ define(["dojo/_base/declare"], function (declare) { Notify.close(); }, reverse: function () { - const toolbar = document.forms["main_toolbar_form"]; + const toolbar = document.forms["toolbar-main"]; const order_by = dijit.getEnclosingWidget(toolbar.order_by); let value = order_by.attr('value'); @@ -496,19 +494,9 @@ define(["dojo/_base/declare"], function (declare) { const row = $("RROW-" + id); if (row) { - const imgs = $$("img[class*=marked-pic][class*=marked-" + id + "]"); - - imgs.each((img) => { - if (!row.hasClassName("marked")) { - img.src = img.src.replace("mark_unset", "mark_set"); - query.mark = 1; - } else { - img.src = img.src.replace("mark_set", "mark_unset"); - query.mark = 0; - } - }); row.toggleClassName("marked"); + query.mark = row.hasClassName("marked") ? 1 : 0; if (!client_only) xhrPost("backend.php", query, (transport) => { @@ -522,19 +510,8 @@ define(["dojo/_base/declare"], function (declare) { if (row) { const query = {op: "rpc", id: id, method: "publ"}; - const imgs = $$("img[class*=pub-pic][class*=pub-" + id + "]"); - - imgs.each((img) => { - if (!row.hasClassName("published")) { - img.src = img.src.replace("pub_unset", "pub_set"); - query.pub = 1; - } else { - img.src = img.src.replace("pub_set", "pub_unset"); - query.pub = 0; - } - }); - row.toggleClassName("published"); + query.pub = row.hasClassName("published") ? 1 : 0; if (!client_only) xhrPost("backend.php", query, (transport) => { @@ -1024,6 +1001,7 @@ define(["dojo/_base/declare"], function (declare) { const menu = new dijit.Menu({ id: "floatingMenu", + selector: ".hlMenuAttach", targetNodeIds: ["floatingTitle"] }); diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index accc4f0e5..44791ba46 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -11,7 +11,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio } else { icon.src = 'images/blank_icon.gif'; } - icon.className = 'tinyFeedIcon'; + icon.className = 'icon'; domConstruct.place(icon, tnode.iconNode, 'only'); let param = this.model.store.getValue(args.item, 'param'); @@ -80,7 +80,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio "dijitTreeRow Error"; }, getIconClass: function (item, opened) { - return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon"; + return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon"; }, reload: function() { const searchElem = $("feed_search"); diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index be321fd21..f4fc8ecf2 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -23,13 +23,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio domConstruct.place(param, tnode.rowNode, 'next'); } - if (this.model.store.getValue(args.item, 'id') != 'root') { - const img = dojo.doc.createElement('img'); - img.src ='images/filter.png'; - img.className = 'marked-pic'; - tnode._filterIconNode = img; + /* if (this.model.store.getValue(args.item, 'id') != 'root') { + const i = dojo.doc.createElement('i'); + i.className = 'material-icons filter'; + i.innerHTML = 'label'; + tnode._filterIconNode = i; domConstruct.place(tnode._filterIconNode, tnode.labelNode, 'before'); - } + } */ return tnode; }, diff --git a/js/tt-rss.js b/js/tt-rss.js index 461adc147..8e5dac811 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -121,7 +121,7 @@ require(["dojo/_base/kernel", Cookie.delete("ttrss_test"); - const toolbar = document.forms["main_toolbar_form"]; + const toolbar = document.forms["toolbar-main"]; dijit.getEnclosingWidget(toolbar.view_mode).attr('value', App.getInitParam("default_view_mode")); |