diff options
author | Andrew Dolgov <[email protected]> | 2021-03-10 20:27:20 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-03-10 20:27:20 +0300 |
commit | 3e1b3e8ea8098847d9769b37c340cb3255b5399b (patch) | |
tree | e74e89f2bbc630a4d7bfeb1b185aaa0ee55ab648 /js/Headlines.js | |
parent | 143617afb1cf5f0c1fb5baa3e629b3bc92064eae (diff) |
grid: add workaround for a single loaded headline not spanning all columns
Diffstat (limited to 'js/Headlines.js')
-rwxr-xr-x | js/Headlines.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/Headlines.js b/js/Headlines.js index 08192ea6b..4cedce491 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -379,7 +379,7 @@ const Headlines = { objectById: function (id) { return this.headlines[id]; }, - setCommonClasses: function () { + setCommonClasses: function (headlines_count) { const container = App.byId("headlines-frame"); container.removeClassName("cdm"); @@ -387,6 +387,7 @@ const Headlines = { container.addClassName(App.isCombinedMode() ? "cdm" : "normal"); container.setAttribute("data-enable-grid", App.getInitParam("cdm_enable_grid") ? "true" : "false"); + container.setAttribute("data-headlines-count", parseInt(headlines_count)); // for floating title because it's placed outside of headlines-frame App.byId("main").removeClassName("expandable"); @@ -397,7 +398,7 @@ const Headlines = { }, renderAgain: function () { // TODO: wrap headline elements into a knockoutjs model to prevent all this stuff - Headlines.setCommonClasses(); + Headlines.setCommonClasses(this.headlines.filter((h) => h.id).length); App.findAll("#headlines-frame > div[id*=RROW]").forEach((row) => { const id = row.getAttribute("data-article-id"); @@ -682,7 +683,7 @@ const Headlines = { console.log('infscroll_disabled=', Feeds.infscroll_disabled); // also called in renderAgain() after view mode switch - Headlines.setCommonClasses(); + Headlines.setCommonClasses(headlines_count); /** TODO: remove @deprecated */ App.byId("headlines-frame").setAttribute("is-vfeed", |