mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-10 04:40:27 -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 :
|
// Top menu :
|
||||||
$('#btnHome').on('click', function (e) {
|
$('#btnHome').on('click', function (e) {
|
||||||
//setHomeTab();
|
|
||||||
// Give the focus to the search field, and clean up the page contents
|
// Give the focus to the search field, and clean up the page contents
|
||||||
if (!firstRun) {
|
if (!firstRun) {
|
||||||
$('#prefix').focus();
|
$('#prefix').focus();
|
||||||
@ -363,6 +362,9 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
$("#articleContent").hide();
|
$("#articleContent").hide();
|
||||||
$("#articleContent").contents().empty();
|
$("#articleContent").contents().empty();
|
||||||
$('#searchingForArticles').hide();
|
$('#searchingForArticles').hide();
|
||||||
|
$("#welcomeText").show();
|
||||||
|
$('#articleList').show();
|
||||||
|
$('#articleListHeaderMessage').show();
|
||||||
if (selectedArchive !== null && selectedArchive.isReady()) {
|
if (selectedArchive !== null && selectedArchive.isReady()) {
|
||||||
$("#welcomeText").hide();
|
$("#welcomeText").hide();
|
||||||
goToMainArticle();
|
goToMainArticle();
|
||||||
@ -395,14 +397,15 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
$('#about').hide();
|
$('#about').hide();
|
||||||
$('#configuration').hide();
|
$('#configuration').hide();
|
||||||
$('#formArticleSearch').show();
|
$('#formArticleSearch').show();
|
||||||
$("#welcomeText").show();
|
|
||||||
$('#articleList').show();
|
|
||||||
$('#articleListHeaderMessage').show();
|
|
||||||
$('#articleContent').show();
|
$('#articleContent').show();
|
||||||
$("#prefix").val("");
|
$("#prefix").val("");
|
||||||
$("#articleList").empty();
|
$("#articleList").empty();
|
||||||
|
$('#articleList').hide();
|
||||||
$('#articleListHeaderMessage').empty();
|
$('#articleListHeaderMessage').empty();
|
||||||
$("#readingArticle").hide();
|
$("#readingArticle").hide();
|
||||||
|
$("#welcomeText").hide();
|
||||||
|
// Scroll the iframe to its top
|
||||||
|
$("#articleContent").contents().scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#btnConfigure').on('click', function (e) {
|
$('#btnConfigure').on('click', function (e) {
|
||||||
@ -1489,8 +1492,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
selectedArchive.resolveRedirect(dirEntry, readArticle);
|
selectedArchive.resolveRedirect(dirEntry, readArticle);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setHomeTab();
|
|
||||||
|
|
||||||
//TESTING//
|
//TESTING//
|
||||||
console.log("Initiating HTML load...");
|
console.log("Initiating HTML load...");
|
||||||
console.time("Time to 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");
|
console.time("Time to First Paint");
|
||||||
//return;
|
//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
|
//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
|
//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");
|
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() {
|
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
|
//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;
|
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) {
|
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
|
//Inject htmlArticle into iframe
|
||||||
|
uiUtil.clear(); //Void progress messages
|
||||||
|
setHomeTab();
|
||||||
$('#articleContent').contents().find('body').html(htmlArticle);
|
$('#articleContent').contents().find('body').html(htmlArticle);
|
||||||
|
|
||||||
setupTableOfContents();
|
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
|
//DEV: Set this to the number of images you want to prefetch after the on-screen images have been fetched
|
||||||
var prefetchSliceSize = 20;
|
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
|
//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 visibleSlice = [];
|
||||||
var svgSlice = [];
|
var svgSlice = [];
|
||||||
var svgGroup1 = [];
|
var svgGroup1 = [];
|
||||||
|
@ -95,7 +95,7 @@ define([], function() {
|
|||||||
var shortTitle = title.substring(0, 25);
|
var shortTitle = title.substring(0, 25);
|
||||||
shortTitle = shortTitle == title ? shortTitle : shortTitle + "...";
|
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 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) { \
|
if (params.themeChanged) { \
|
||||||
params.themeChanged = false; \
|
params.themeChanged = false; \
|
||||||
if (history.state !== null) { \
|
if (history.state !== null) { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user