diff options
author | Andrew Dolgov <[email protected]> | 2021-03-11 08:35:02 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-03-11 08:35:02 +0300 |
commit | f9a381eccaf4062d2ac3a7a13fe0e8728d46f007 (patch) | |
tree | f72ed0f034837e2a60b9c1c748651604ba848c59 /js | |
parent | 27ab16b6dc649fbda0ee329b42f1882623f9cba6 (diff) |
grid: add a header icon (and a hotkey) to toggle article span entire row
Diffstat (limited to 'js')
-rw-r--r-- | js/App.js | 3 | ||||
-rw-r--r-- | js/Article.js | 21 | ||||
-rwxr-xr-x | js/Headlines.js | 1 |
3 files changed, 22 insertions, 3 deletions
@@ -1204,6 +1204,9 @@ const App = { Headlines.renderAgain(); }); }; + this.hotkey_actions["article_span_grid"] = () => { + Article.cdmToggleGridSpan(Article.getActive()); + }; } }, openPreferences: function(tab) { diff --git a/js/Article.js b/js/Article.js index ed74051a6..5c39240c7 100644 --- a/js/Article.js +++ b/js/Article.js @@ -93,6 +93,19 @@ const Article = { w.opener = null; w.location = url; }, + cdmToggleGridSpan: function(id) { + const row = App.byId(`RROW-${id}`); + + if (row) { + + if (row.style.gridColumn != '1 / -1') + row.style.gridColumn = '1 / -1'; + else + row.style.gridColumn = ''; + + this.cdmMoveToId(id); + } + }, cdmUnsetActive: function (event) { const row = App.byId(`RROW-${Article.getActive()}`); @@ -389,10 +402,12 @@ const Article = { const ctr = App.byId("headlines-frame"); const row = App.byId(`RROW-${id}`); - if (!row || !ctr) return; + if (ctr && row) { + const grid_gap = parseInt(window.getComputedStyle(ctr).gridGap) || 0; - if (force_to_top || !App.Scrollable.fitsInContainer(row, ctr)) { - ctr.scrollTop = row.offsetTop; + if (force_to_top || !App.Scrollable.fitsInContainer(row, ctr)) { + ctr.scrollTop = row.offsetTop - grid_gap; + } } }, setActive: function (id) { diff --git a/js/Headlines.js b/js/Headlines.js index 36cff4bc8..65cd2480c 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -506,6 +506,7 @@ const Headlines = { <span class="updated" title="${hl.imported}">${hl.updated}</span> <div class="right"> + <i class="material-icons icon-grid-span" title="${__("Span all columns")}" onclick="Article.cdmToggleGridSpan(${hl.id})">fullscreen</i> <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <span style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}" onclick="Feeds.open({feed:${hl.feed_id}})"> |