Alternate icon support

Former-commit-id: e5cb015fbe04f82fec27736a8c810bc215e4901b [formerly 9b84972b9025a3335a606d3bc7d82723ab0e1b3c]
Former-commit-id: e48ba161e919b922326632a661d0c7dc175634fa
This commit is contained in:
Jaifroid 2017-12-14 10:07:46 +00:00
parent 604058b1d8
commit 81a86d75e6
4 changed files with 14 additions and 9 deletions

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -571,7 +571,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
document.getElementById('prefix').classList.add("dark");
var elements = document.querySelectorAll(".settings");
for (var i = 0; i < elements.length; i++) { elements[i].style.border = "1px solid darkgray"; }
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(cookies.getItem('lastSelectedArchive')) ? "./img/icons/wikivoyage-trans-32.png" : "./img/icons/kiwix-32.png";
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(cookies.getItem('lastSelectedArchive')) ? "./img/icons/wikivoyage-white-32.png" : "./img/icons/kiwix-32.png";
}
if (value == 'light') {
document.getElementsByTagName('body')[0].classList.remove("dark");
@ -587,7 +587,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
document.getElementById('prefix').classList.remove("dark");
var elements = document.querySelectorAll(".settings");
for (var i = 0; i < elements.length; i++) { elements[i].style.border = "1px solid black"; }
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(cookies.getItem('lastSelectedArchive')) ? "./img/icons/wikivoyage-trans-32.png" : "./img/icons/kiwix-blue-32.png";
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(cookies.getItem('lastSelectedArchive')) ? "./img/icons/wikivoyage-black-32.png" : "./img/icons/kiwix-blue-32.png";
}
}
@ -1017,7 +1017,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
*/
function setLocalArchiveFromArchiveList() {
var archiveDirectory = $('#archiveList').val();
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(archiveDirectory) ? "./img/icons/wikivoyage-trans-32.png" : params.cssUITheme == "light" ? "./img/icons/kiwix-blue-32.png" : "./img/icons/kiwix-32.png";
document.getElementById('kiwixIcon').src = /wikivoyage/i.test(archiveDirectory) ? params.cssUITheme == "light" ? "./img/icons/wikivoyage-black-32.png" : "./img/icons/wikivoyage-white-32.png" : params.cssUITheme == "light" ? "./img/icons/kiwix-blue-32.png" : "./img/icons/kiwix-32.png";
if (archiveDirectory && archiveDirectory.length > 0) {
// Now, try to find which DeviceStorage has been selected by the user
// It is the prefix of the archive directory
@ -1785,13 +1785,11 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
//Get rid of any absolute or relative prefixes (../, ./../, /../.., etc.)
url = url.replace(/^[.\/]*([\S\s]+)$/, "$1");
//Some Stackexchange links (e.g. "duplicate" and "related" questions) are missing the "question" path, so add it back
//Regex matches a pattern that looks like: 1234/what-is-mathematics.html and changes to: question/1234/what-is-mathematics.html
url = url.replace(/^(\d+\/[\s\S]+\.html?)$/ig, "question/$1");
$(this).on('click', function (e) {
clearFindInArticle();
//Re-enable top-level scrolling
document.getElementById('top').style.position = "relative";
document.getElementById('scrollbox').style.position = "fixed";
document.getElementById('scrollbox').style.height = window.innerHeight + "px";
var decodedURL = decodeURIComponent(url);
pushBrowserHistoryState(decodedURL);
goToArticle(decodedURL);
@ -2271,6 +2269,11 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
* @param {String} title
*/
function goToArticle(title) {
clearFindInArticle();
//Re-enable top-level scrolling
document.getElementById('top').style.position = "relative";
document.getElementById('scrollbox').style.position = "fixed";
document.getElementById('scrollbox').style.height = window.innerHeight + "px";
selectedArchive.getDirEntryByTitle(title).then(function(dirEntry) {
if (dirEntry === null || dirEntry === undefined) {
$("#readingArticle").hide();
@ -2282,7 +2285,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
$('#articleContent').contents().find('body').html("");
readArticle(dirEntry);
}
}).fail(function() { alert("Error reading article with title " + title); });
}).fail(function() { console.error("Error reading article with title " + title); });
}
function goToRandomArticle() {

View File

@ -116,8 +116,10 @@ define([], function() {
document.getElementById('search-article').scrollTop = 0;
if (params.themeChanged) {
params.themeChanged = false;
if (history.state !== null) {
var thisURL = decodeURIComponent(history.state.title);
goToArticle(thisURL);
}
}
})`;
document.getElementById("returntoArticle_top").innerHTML = link;