From 829e67568a2a5169244b395b95d215af6e81d9e4 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Wed, 6 Mar 2019 21:55:35 +0000 Subject: [PATCH] Correct selector display logic Former-commit-id: 7ac882f8e997ad6db11bb0e90292de905d0e6a03 [formerly 2ad0a83fbaa1d1e0c348f25ccb1e65a6cfb1cdd3] Former-commit-id: 7b601b680ee840dab75946af634e8b2ecc1bbb83 --- www/index.html | 5 ++--- www/js/app.js | 12 ++++++++++++ www/js/init.js | 9 +-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/www/index.html b/www/index.html index b4066a69..e765f389 100644 --- a/www/index.html +++ b/www/index.html @@ -253,7 +253,7 @@ in the Windows Settings for Offline Maps.

-

Usage

+

Usage

Step 1: download some content

You can browse the Kiwix repository on the Configuration page, and it will provide instructions according to the type of file you download. @@ -386,9 +386,8 @@

Configuration

-

This application needs a ZIM archive to work. You can get one from the download links panel.

-

Get more archives (in other languages)

+

This application needs a ZIM archive to work. Download one from the Archive Library.

For more information see About tab (top right)

diff --git a/www/js/app.js b/www/js/app.js index 877a60d6..f2bd0503 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -525,6 +525,17 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' } document.getElementById('libraryArea').style.borderColor = ''; document.getElementById('libraryArea').style.borderStyle = ''; + var currentArchive = document.getElementById('currentArchive'); + if (params.packagedFile && params.storedFile && params.storedFile != params.packagedFile) { + currentArchive.innerHTML = "Currently loaded archive: " + params.storedFile.replace(/\.zim$/i, "") + ""; + currentArchive.style.display = "block"; + document.getElementById('downloadLinksText').style.display = "none"; + document.getElementById('moreInfo').style.display = "none"; + } + if (params.storedFile && params.storedFile == params.packagedFile) { + document.getElementById('downloadLinksText').style.display = "block"; + currentArchive.style.display = "none"; + } //else { // document.getElementById('rescanStorage').style.display = "none"; //} @@ -891,6 +902,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' var currentArchive = document.getElementById('currentArchive'); currentArchive.innerHTML = "Currently loaded archive: " + params.storedFile.replace(/\.zim$/i, "") + ""; currentArchive.style.display = params.showFileSelectors ? "none" : "block"; + document.getElementById('downloadLinksText').style.display = params.showFileSelectors ? "none" : "block"; } cookies.setItem('showFileSelectors', params.showFileSelectors, Infinity); if (params.showFileSelectors) document.getElementById('configuration').scrollIntoView(); diff --git a/www/js/init.js b/www/js/init.js index fb760027..478649a4 100644 --- a/www/js/init.js +++ b/www/js/init.js @@ -50,7 +50,7 @@ params['hideToolbar'] = getCookie('hideToolbar') != null ? getCookie('hideToolba params['rememberLastPage'] = getCookie('rememberLastPage') != null ? getCookie('rememberLastPage') : true; //Set default option to remember the last visited page between sessions params['useMathJax'] = getCookie('useMathJax') != null ? getCookie('useMathJax') : true; //Set default to true to display math formulae with MathJax, false to use fallback SVG images only //params['showFileSelectors'] = getCookie('showFileSelectors') != null ? getCookie('showFileSelectors') : false; //Set to true to display hidden file selectors in packaged apps -params['showFileSelectors'] = false; //This will cause file selectors to be hidden on each load of the app (by ignoring cookie) +params['showFileSelectors'] = true; //False will cause file selectors to be hidden on each load of the app (by ignoring cookie) params['hideActiveContentWarning'] = getCookie('hideActiveContentWarning') != null ? getCookie('hideActiveContentWarning') : false; params['alphaChar'] = getCookie('alphaChar') || 'A'; //Set default start of alphabet string (used by the Archive Index) params['omegaChar'] = getCookie('omegaChar') || 'Z'; //Set default end of alphabet string @@ -104,13 +104,6 @@ var fileVersionDivs = document.getElementsByClassName('fileVersion'); for (i = 0; i < fileVersionDivs.length; i++) { fileVersionDivs[i].innerHTML = i ? params.fileVersion.replace(/\s+.+$/, "") : params.fileVersion; } -if (!params.showFileSelectors && params.packagedFile && params.storedFile && params.storedFile != params.packagedFile) { - var currentArchive = document.getElementById('currentArchive'); - if (currentArchive) { - currentArchive.innerHTML = "Currently loaded archive: " + params.storedFile.replace(/\.zim$/i, "") + ""; - currentArchive.style.display = "block"; - } -} document.getElementById('logUpdate').innerHTML = document.getElementById('update').innerHTML.match(/]*>[\s\S]+/i); document.getElementById('logFeatures').innerHTML = document.getElementById('features').innerHTML;