mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-11 13:18:21 -04:00
Prevent Settings tab from remaining selected when article is displayed #44
Former-commit-id: 169e5569b86eb903a89680a4be575c76b9b4c714 [formerly 27aab2c6efe25bcf81a8ba9da86a19351e163de6] Former-commit-id: 607dbedb7655a52e4b03f9c277a03512473f6817
This commit is contained in:
parent
24569e66a3
commit
d6040fc65b
@ -354,6 +354,23 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
});
|
||||
// Top menu :
|
||||
$('#btnHome').on('click', function (e) {
|
||||
//setHomeTab();
|
||||
// Give the focus to the search field, and clean up the page contents
|
||||
if (!firstRun) {
|
||||
$('#prefix').focus();
|
||||
firstRun = false;
|
||||
}
|
||||
$("#articleContent").hide();
|
||||
$("#articleContent").contents().empty();
|
||||
$('#searchingForArticles').hide();
|
||||
if (selectedArchive !== null && selectedArchive.isReady()) {
|
||||
$("#welcomeText").hide();
|
||||
goToMainArticle();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
function setHomeTab() {
|
||||
// Highlight the selected section in the navbar
|
||||
$('#liHomeNav').attr("class", "active");
|
||||
$('#liConfigureNav').attr("class", "");
|
||||
@ -382,24 +399,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
$('#articleList').show();
|
||||
$('#articleListHeaderMessage').show();
|
||||
$('#articleContent').show();
|
||||
// Give the focus to the search field, and clean up the page contents
|
||||
$("#prefix").val("");
|
||||
if (!firstRun) {
|
||||
$('#prefix').focus();
|
||||
firstRun = false;
|
||||
}
|
||||
$("#articleList").empty();
|
||||
$('#articleListHeaderMessage').empty();
|
||||
$("#readingArticle").hide();
|
||||
$("#articleContent").hide();
|
||||
$("#articleContent").contents().empty();
|
||||
$('#searchingForArticles').hide();
|
||||
if (selectedArchive !== null && selectedArchive.isReady()) {
|
||||
$("#welcomeText").hide();
|
||||
goToMainArticle();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$('#btnConfigure').on('click', function (e) {
|
||||
// Highlight the selected section in the navbar
|
||||
$('#liHomeNav').attr("class", "");
|
||||
@ -1484,6 +1489,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
selectedArchive.resolveRedirect(dirEntry, readArticle);
|
||||
}
|
||||
else {
|
||||
setHomeTab();
|
||||
|
||||
//TESTING//
|
||||
console.log("Initiating HTML load...");
|
||||
|
@ -95,24 +95,7 @@ define([], function() {
|
||||
var shortTitle = title.substring(0, 25);
|
||||
shortTitle = shortTitle == title ? shortTitle : shortTitle + "...";
|
||||
var link = '<h4 style="font-size:' + ~~(params.relativeUIFontSize * 1.4 * 0.14) + 'px;"><a href="#"><< Return to ' + shortTitle + '</a></h4>';
|
||||
var rtnFunction = "(function () { \
|
||||
$('#configuration').hide(); \
|
||||
$('#about').hide(); \
|
||||
if (params.cssTheme == 'light' && params.cssUITheme == 'dark') { \
|
||||
document.getElementById('search-article').classList.remove('dark'); \
|
||||
document.getElementById('findInArticle').classList.remove('dark'); \
|
||||
document.getElementById('prefix').classList.remove('dark'); \
|
||||
} \
|
||||
$('#formArticleSearch').show(); \
|
||||
$('#articleContent').show(); \
|
||||
$('#liHomeNav').attr('class', 'active'); \
|
||||
$('#liConfigureNav').attr('class', ''); \
|
||||
$('#liAboutNav').attr('class', ''); \
|
||||
document.getElementById('btnConfigure').classList.remove('active'); \
|
||||
document.getElementById('btnAbout').classList.remove('active'); \
|
||||
document.getElementById('search-article').style.overflow = 'hidden'; \
|
||||
checkToolbar(); \
|
||||
document.getElementById('search-article').scrollTop = 0; \
|
||||
rtnFunction = "(function () { setHomeTab(); \
|
||||
if (params.themeChanged) { \
|
||||
params.themeChanged = false; \
|
||||
if (history.state !== null) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user