mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
Further improvements for #44
Former-commit-id: 897fd4f90df74a5be69aa646fbb421562becce7e [formerly 40459c7aeb9cadec7301057e965b871f12c525f4] Former-commit-id: de70045ade464888e87aadcb759dbace170c092b
This commit is contained in:
parent
58f848ce3c
commit
7235c1f252
@ -354,7 +354,6 @@ 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();
|
||||
@ -363,6 +362,9 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
$("#articleContent").hide();
|
||||
$("#articleContent").contents().empty();
|
||||
$('#searchingForArticles').hide();
|
||||
$("#welcomeText").show();
|
||||
$('#articleList').show();
|
||||
$('#articleListHeaderMessage').show();
|
||||
if (selectedArchive !== null && selectedArchive.isReady()) {
|
||||
$("#welcomeText").hide();
|
||||
goToMainArticle();
|
||||
@ -395,14 +397,15 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
$('#about').hide();
|
||||
$('#configuration').hide();
|
||||
$('#formArticleSearch').show();
|
||||
$("#welcomeText").show();
|
||||
$('#articleList').show();
|
||||
$('#articleListHeaderMessage').show();
|
||||
$('#articleContent').show();
|
||||
$("#prefix").val("");
|
||||
$("#articleList").empty();
|
||||
$('#articleList').hide();
|
||||
$('#articleListHeaderMessage').empty();
|
||||
$("#readingArticle").hide();
|
||||
$("#welcomeText").hide();
|
||||
// Scroll the iframe to its top
|
||||
$("#articleContent").contents().scrollTop(0);
|
||||
}
|
||||
|
||||
$('#btnConfigure').on('click', function (e) {
|
||||
@ -1489,8 +1492,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
selectedArchive.resolveRedirect(dirEntry, readArticle);
|
||||
}
|
||||
else {
|
||||
setHomeTab();
|
||||
|
||||
//TESTING//
|
||||
console.log("Initiating HTML load...");
|
||||
console.time("Time to HTML load");
|
||||
@ -1601,8 +1602,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
console.time("Time to First Paint");
|
||||
//return;
|
||||
|
||||
$('#articleList').hide();
|
||||
|
||||
//Some documents (e.g. Ray Charles Index) can't be scrolled to the very end, as some content remains benath the footer
|
||||
//so add some whitespace at the end of the document
|
||||
htmlArticle = htmlArticle.replace(/(dditional terms may apply for the media files[^<]+<\/div>\s*)/i, "$1\r\n<p> </p><p> </p><p> </p><p> </p><p> </p>\r\n");
|
||||
@ -1791,13 +1790,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
|
||||
|
||||
function injectHTML() {
|
||||
//Void progress message
|
||||
uiUtil.clear(); //Void progress messages
|
||||
$("#readingArticle").hide();
|
||||
$("#articleContent").show();
|
||||
// Scroll the iframe to its top
|
||||
$("#articleContent").contents().scrollTop(0);
|
||||
|
||||
//Adapt German Wikivoyage POI data format
|
||||
var regexpGeoLocationDE = /<span\s+class\s?=\s?"[^"]+?listing-coordinates[\s\S]+?latitude">([^<]+)[\s\S]+?longitude">([^<]+)<[\s\S]+?(<span[^>]+listing-name[^>]+>([^<]+)<\/span>)/ig;
|
||||
htmlArticle = htmlArticle.replace(regexpGeoLocationDE, function (match, latitude, longitude, href, id) {
|
||||
@ -1825,6 +1817,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
});
|
||||
|
||||
//Inject htmlArticle into iframe
|
||||
uiUtil.clear(); //Void progress messages
|
||||
setHomeTab();
|
||||
$('#articleContent').contents().find('body').html(htmlArticle);
|
||||
|
||||
setupTableOfContents();
|
||||
@ -1934,7 +1928,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
//DEV: Set this to the number of images you want to prefetch after the on-screen images have been fetched
|
||||
var prefetchSliceSize = 20;
|
||||
//DEV: SVG images are currently very taxing: keep this number at 5 or below and test on your system with Sine.html
|
||||
var svgSliceSize = 2;
|
||||
var svgSliceSize = 1;
|
||||
var visibleSlice = [];
|
||||
var svgSlice = [];
|
||||
var svgGroup1 = [];
|
||||
|
@ -95,7 +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>';
|
||||
rtnFunction = "(function () { setHomeTab(); \
|
||||
var rtnFunction = "(function () { setHomeTab(); \
|
||||
if (params.themeChanged) { \
|
||||
params.themeChanged = false; \
|
||||
if (history.state !== null) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user