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/Article.js | |
parent | 27ab16b6dc649fbda0ee329b42f1882623f9cba6 (diff) |
grid: add a header icon (and a hotkey) to toggle article span entire row
Diffstat (limited to 'js/Article.js')
-rw-r--r-- | js/Article.js | 21 |
1 files changed, 18 insertions, 3 deletions
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) { |