mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-13 14:28:38 -04:00
Deprecate unsafe way of determining ZIM name
Former-commit-id: ad8e04930f08f3ade63d18ce70b63b84fd4cd2c4 [formerly f6a5f2dec20dd9c586a69029efa4d967935a2552] [formerly 5fd69a21fdbd7e7ae2a097bf4d50299c846610d2] [formerly 5fefe7c6783b6cc09e1c0afd42e6f37b4b14ad74 [formerly 3d4a9189a90d543de1ca6d7b09f40c39c0b236a5 [formerly e8cda3304bf524a6e2665081d99291b9b88378d7]]] Former-commit-id: 1933dda5993a0cd9525da7656cc6e71f077db48d [formerly f0eb64560cc6dc83072042d61cfea39d2da95935 [formerly bbe3cd930710f9501fa313bec16f6542d7b9d5f4]] Former-commit-id: 9e1dcaeb51642d010c0bbb4f367315b57459efbb [formerly e3a5d29d597fcec77c6e028d4a91b158e17dfed6] Former-commit-id: c45e8304d46346a5558840b975e99a144798e26a
This commit is contained in:
parent
d3b7ad5ecd
commit
ca3cc1fc1e
@ -852,7 +852,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
setTab();
|
setTab();
|
||||||
if (params.themeChanged) {
|
if (params.themeChanged) {
|
||||||
params.themeChanged = false;
|
params.themeChanged = false;
|
||||||
var archiveName = appstate.selectedArchive ? appstate.selectedArchive._file._files[0].name : null;
|
var archiveName = appstate.selectedArchive ? appstate.selectedArchive._file.name : null;
|
||||||
if (archiveName && ~params.lastPageVisit.indexOf(archiveName)) {
|
if (archiveName && ~params.lastPageVisit.indexOf(archiveName)) {
|
||||||
goToArticle(params.lastPageVisit.replace(/@kiwixKey@.+$/, ''));
|
goToArticle(params.lastPageVisit.replace(/@kiwixKey@.+$/, ''));
|
||||||
}
|
}
|
||||||
@ -3232,7 +3232,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
|
|
||||||
//Load cached start page if it exists and we have loaded the packaged file
|
//Load cached start page if it exists and we have loaded the packaged file
|
||||||
var htmlContent = 0;
|
var htmlContent = 0;
|
||||||
var zimName = appstate.selectedArchive._file._files[0].name.replace(/\.[^.]+$/, '').replace(/_\d+-\d+$/, '');
|
var zimName = appstate.selectedArchive._file.name.replace(/\.[^.]+$/, '').replace(/_\d+-\d+$/, '');
|
||||||
if (params.isLandingPage && params.cachedStartPages[zimName]) {
|
if (params.isLandingPage && params.cachedStartPages[zimName]) {
|
||||||
htmlContent = -1;
|
htmlContent = -1;
|
||||||
var encURL = encodeURIComponent(encodeURIComponent(params.cachedStartPages[zimName]).replace(/%2F/g, '/')).replace(/%2F/g, '/');
|
var encURL = encodeURIComponent(encodeURIComponent(params.cachedStartPages[zimName]).replace(/%2F/g, '/')).replace(/%2F/g, '/');
|
||||||
@ -3405,7 +3405,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
if (/UWP/.test(params.appType) && (appstate.target === 'window' || appstate.messageChannelWaiting) &&
|
if (/UWP/.test(params.appType) && (appstate.target === 'window' || appstate.messageChannelWaiting) &&
|
||||||
params.imageDisplay) { imageDisplayMode = 'all'; }
|
params.imageDisplay) { imageDisplayMode = 'all'; }
|
||||||
// We need to do the same for Gutenberg and PHET ZIMs
|
// We need to do the same for Gutenberg and PHET ZIMs
|
||||||
if (/gutenberg|phet/i.test(appstate.selectedArchive._file._files[0].name)) {
|
if (/gutenberg|phet/i.test(appstate.selectedArchive._file.name)) {
|
||||||
imageDisplayMode = 'all';
|
imageDisplayMode = 'all';
|
||||||
}
|
}
|
||||||
if (/\bhtml\b/i.test(mimetype)) {
|
if (/\bhtml\b/i.test(mimetype)) {
|
||||||
@ -3590,8 +3590,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
//Since page has been successfully loaded, store it in the browser history
|
//Since page has been successfully loaded, store it in the browser history
|
||||||
if (params.contentInjectionMode === 'jquery') pushBrowserHistoryState(dirEntry.namespace + '/' + dirEntry.url);
|
if (params.contentInjectionMode === 'jquery') pushBrowserHistoryState(dirEntry.namespace + '/' + dirEntry.url);
|
||||||
// Store for fast retrieval
|
// Store for fast retrieval
|
||||||
params.lastPageVisit = dirEntry.namespace + '/' + dirEntry.url + '@kiwixKey@' + appstate.selectedArchive._file._files[0].name;
|
params.lastPageVisit = dirEntry.namespace + '/' + dirEntry.url + '@kiwixKey@' + appstate.selectedArchive._file.name;
|
||||||
cache.setArticle(appstate.selectedArchive._file._files[0].name, dirEntry.namespace + '/' + dirEntry.url, htmlArticle, function(){});
|
cache.setArticle(appstate.selectedArchive._file.name, dirEntry.namespace + '/' + dirEntry.url, htmlArticle, function(){});
|
||||||
params.htmlArticle = htmlArticle;
|
params.htmlArticle = htmlArticle;
|
||||||
|
|
||||||
// Replaces ZIM-style URLs of img, script, link and media tags with a data-kiwixurl to prevent 404 errors [kiwix-js #272 #376]
|
// Replaces ZIM-style URLs of img, script, link and media tags with a data-kiwixurl to prevent 404 errors [kiwix-js #272 #376]
|
||||||
@ -4158,7 +4158,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
// If the request was not initiated by an existing controlled window, we instantiate the request here
|
// If the request was not initiated by an existing controlled window, we instantiate the request here
|
||||||
if (!appstate.messageChannelWaiting) {
|
if (!appstate.messageChannelWaiting) {
|
||||||
// We put the ZIM filename as a prefix in the URL, so that browser caches are separate for each ZIM file
|
// We put the ZIM filename as a prefix in the URL, so that browser caches are separate for each ZIM file
|
||||||
articleWindow.location.href = "../" + appstate.selectedArchive._file._files[0].name + "/" + dirEntry.namespace + "/" + encodedUrl;
|
articleWindow.location.href = "../" + appstate.selectedArchive._file.name + "/" + dirEntry.namespace + "/" + encodedUrl;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4755,7 +4755,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
//This removes any search highlighting
|
//This removes any search highlighting
|
||||||
clearFindInArticle();
|
clearFindInArticle();
|
||||||
document.getElementById('searchingArticles').style.display = 'block';
|
document.getElementById('searchingArticles').style.display = 'block';
|
||||||
var zimName = appstate.selectedArchive._file._files[0].name.replace(/\.[^.]+$/, '').replace('_\d+_\d+$', '');
|
var zimName = appstate.selectedArchive._file.name.replace(/\.[^.]+$/, '').replace('_\d+_\d+$', '');
|
||||||
if (~path.indexOf(params.cachedStartPages[zimName])) {
|
if (~path.indexOf(params.cachedStartPages[zimName])) {
|
||||||
goToMainArticle();
|
goToMainArticle();
|
||||||
return;
|
return;
|
||||||
|
@ -300,7 +300,8 @@ define(['uiUtil'], function (uiUtil) {
|
|||||||
image.src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E";
|
image.src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E";
|
||||||
image.style.opacity = '0';
|
image.style.opacity = '0';
|
||||||
// Set a minimum width to avoid some images not rendering in squashed hidden tables
|
// Set a minimum width to avoid some images not rendering in squashed hidden tables
|
||||||
if (params.displayHiddenBlockElements && image.width && !image.style.minWidth) {
|
if (params.displayHiddenBlockElements && image.width && !image.style.minWidth &&
|
||||||
|
/wiki|wiktionary/i.test(appstate.selectedArchive._file.name)) {
|
||||||
var imgX = image.width + '';
|
var imgX = image.width + '';
|
||||||
imgX = imgX.replace(/(\d+)$/, '$1px');
|
imgX = imgX.replace(/(\d+)$/, '$1px');
|
||||||
image.style.minWidth = imgX;
|
image.style.minWidth = imgX;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user