From 2933483393b20882b700811844a5bb538bb69d6c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 19 Jan 2021 11:54:13 +0300 Subject: [PATCH] add a hack (Headlines.unpackVisible) to workaround against unpack observer sometimes missing articles --- js/Headlines.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/Headlines.js b/js/Headlines.js index d0c352aed..3b4498430 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -300,6 +300,16 @@ const Headlines = { } } }, + unpackVisible: function(container) { + const rows = $$("#headlines-frame > div[id*=RROW][data-content].cdm"); + + for (let i = 0; i < rows.length; i++) { + if (App.Scrollable.isChildVisible(rows[i], container)) { + console.log('force unpacking:', rows[i].getAttribute('id')); + Article.unpack(rows[i]); + } + } + }, scrollHandler: function (/*event*/) { try { if (!Feeds.infscroll_disabled && !Feeds.infscroll_in_progress) { @@ -320,6 +330,14 @@ const Headlines = { } } + if (App.isCombinedMode() && App.getInitParam("cdm_expanded")) { + const container = $("headlines-frame") + + /* don't do anything until there was some scrolling */ + if (container.scrollTop > 0) + Headlines.unpackVisible(container); + } + if (App.getInitParam("cdm_auto_catchup")) { const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");