From c982785eaa53c53d87d60e6e1229cbc80f024f22 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 1 Jan 2021 18:28:55 +0000 Subject: [PATCH] Fix load of masonry-style images in SW mode Former-commit-id: db684283c87fa2e948fc84782ffcec387389f1f1 [formerly f9adb872a9280a98e0221c3a738fdec5a63cac77] [formerly 96b4d17f20d6a2786f53b70bf250c4f7bd8b57a4] [formerly e4703568bf7362a0fa4bfd6b5df51321fe3a1f47 [formerly 47d30e59bdf0c86659516da06b78d9ac445a0524 [formerly 2f9bb8b502bfb85791951f430537c5faef0ff473]]] Former-commit-id: 3955c365e501233b27db72153abd6dc808e12a8d [formerly 595152e26df7d3bf7b54633b138ae7081660c3d3 [formerly 15d54e0c0ed497add50134775d554cb9a100e775]] Former-commit-id: d78835935660d70d053a218de9835008ced6dc60 [formerly 6c6721b3a27a68dbd06961ee8e40c4d2b72f2320] Former-commit-id: 9ace04baeb04d6fe63bd880791c85ffa4434e815 --- www/-/s/css_modules/newstyle_main_page.css | 1 + www/js/app.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/www/-/s/css_modules/newstyle_main_page.css b/www/-/s/css_modules/newstyle_main_page.css index 36abe674..02c56ed3 100644 --- a/www/-/s/css_modules/newstyle_main_page.css +++ b/www/-/s/css_modules/newstyle_main_page.css @@ -1,5 +1,6 @@ html { box-sizing: border-box; + height: 100%; } /* *, diff --git a/www/js/app.js b/www/js/app.js index c5309dae..c36bc770 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1408,7 +1408,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett var tmpMessageChannel = new MessageChannel(); tmpMessageChannel.port1.onmessage = handleMessageChannelMessage; // Send the init message to the ServiceWorker, with this MessageChannel as a parameter - navigator.serviceWorker.controller.postMessage({ + if (navigator.serviceWorker.controller) navigator.serviceWorker.controller.postMessage({ 'action': 'init' }, [tmpMessageChannel.port2]); messageChannel = tmpMessageChannel; @@ -3085,7 +3085,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett // htmlArticle = htmlArticle.replace(/(]+\sopen)[^>]+)>/ig, '$1 open>'); // Remove the script.js that closes top-level sections if user requested this if (params.openAllSections) htmlArticle = htmlArticle.replace(/]+-\/j\/js_modules\/script\.js"[^<]*<\/script>/i, ""); - + // Remove landing page scripts that don't work + htmlArticle = htmlArticle.replace(/]+-\/j\/js_modules\/((?:images_loaded|masonry)\.min|article_list_home)\.js"[^<]*<\/script>/gi, ""); //Remove empty div that causes layout issues in desktop style htmlArticle = htmlArticle.replace(/]*?>\s*<\/div>\s*/, '');