diff --git a/www/js/app.js b/www/js/app.js
index a97c6ef3..5a42855b 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1549,6 +1549,13 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
settingsStore.setItem('removePageMaxWidth', params.removePageMaxWidth, Infinity);
removePageMaxWidth();
});
+ document.getElementById('displayHiddenBlockElementsCheck').addEventListener('click', function () {
+ params.displayHiddenBlockElements = this.checked;
+ settingsStore.setItem('displayHiddenBlockElements', params.displayHiddenBlockElements, Infinity);
+ if (this.checked) displayHiddenBlockElements();
+ // Forces page reload if user no longer wants to display these elements
+ else params.themeChanged = true;
+ });
/**
* Removes the WikiMedia max-page-width restrictions either by operating on an HTML string, or by using
@@ -4104,6 +4111,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
if (!('MSBlobBuilder' in window)) htmlArticle = htmlArticle.replace(/(]*)/i, '$1 hidden');
}
+ // Display any hidden block elements, with a timeout, so as not to interfere with image loading
+ setTimeout(function() {
+ if (params.displayHiddenBlockElements) displayHiddenBlockElements();
+ }, 800);
+
// Calculate the current article's encoded ZIM baseUrl to use when processing relative links (also needed for SW mode when params.windowOpener is set)
params.baseURL = (dirEntry.namespace + '/' + dirEntry.url.replace(/[^/]+$/, ''))
// URI-encode anything that is not a '/'
@@ -4504,6 +4516,18 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
});
}
+ /**
+ * Unhides all hidden divs or tables, for use in Wikimedia mobile display style, which hides some crucial
+ * elements that users want optionally to be able to access
+ */
+ function displayHiddenBlockElements() {
+ Array.prototype.slice.call(articleDocument.querySelectorAll('table, div')).forEach(function (element) {
+ if (articleWindow.getComputedStyle(element).display === 'none') {
+ element.style.setProperty('display', 'block', 'important');
+ }
+ });
+ }
+
function setupTableOfContents() {
//var iframe = window.frames[0].frameElement;
var iframe = document.getElementById('articleContent');
diff --git a/www/js/init.js b/www/js/init.js
index 2d880b8e..5470de0e 100644
--- a/www/js/init.js
+++ b/www/js/init.js
@@ -74,6 +74,7 @@ params['relativeFontSize'] = ~~(getSetting('relativeFontSize') || 100); //Sets t
params['relativeUIFontSize'] = ~~(getSetting('relativeUIFontSize') || 100); //Sets the initial font size for UI (as a percentage) - user can adjust using slider in Config
params['cssSource'] = getSetting('cssSource') || "auto"; //Set default to "auto", "desktop" or "mobile"
params['removePageMaxWidth'] = getSetting('removePageMaxWidth') != null ? getSetting('removePageMaxWidth') : "auto"; //Set default for removing max-width restriction on Wikimedia pages ("auto" = removed in desktop, not in mobile; true = always remove; false = never remove)
+params['displayHiddenBlockElements'] = getSetting('displayHiddenBlockElements') !== null ? getSetting('displayHiddenBlockElements') : false; //Set default for displaying hidden block elements
params['openAllSections'] = getSetting('openAllSections') != null ? getSetting('openAllSections') : true; //Set default for opening all sections in ZIMs that have collapsible sections and headings ("auto" = let CSS decide according to screen width; true = always open until clicked by user; false = always closed until clicked by user)
params['cssCache'] = getSetting('cssCache') != null ? getSetting('cssCache') : true; //Set default to true to use cached CSS, false to use Zim only
params['cssTheme'] = getSetting('cssTheme') || 'light'; //Set default to 'auto', 'light', 'dark' or 'invert' to use respective themes for articles
@@ -206,6 +207,7 @@ document.getElementById('removePageMaxWidthCheck').checked = params.removePageMa
document.getElementById('removePageMaxWidthCheck').indeterminate = params.removePageMaxWidth == "auto";
document.getElementById('removePageMaxWidthCheck').readOnly = params.removePageMaxWidth == "auto";
document.getElementById('pageMaxWidthState').innerHTML = (params.removePageMaxWidth == "auto" ? "auto" : params.removePageMaxWidth ? "always" : "never");
+document.getElementById('displayHiddenBlockElementsCheck').checked = params.displayHiddenBlockElements;
document.getElementById('openAllSectionsCheck').checked = params.openAllSections;
document.getElementById('useOSMCheck').checked = /openstreetmap/.test(params.mapsURI);
document.getElementById('cssUIDarkThemeCheck').checked = params.cssUITheme == "dark"; // Will be true, or false if light or auto