From f9a381eccaf4062d2ac3a7a13fe0e8728d46f007 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Mar 2021 08:35:02 +0300 Subject: grid: add a header icon (and a hotkey) to toggle article span entire row --- js/Article.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'js/Article.js') 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) { -- cgit v1.2.3