Calculate appRootDir for app:// links

Former-commit-id: 6ec21d22a9e04de963708b16ef845ef27401ed69 [formerly 76238b17c91ceb885d0368bfc3cdb24ff709067b [formerly cf0ea6b5c397c6ef96ae9204b0a6b99add06f426]]
Former-commit-id: 65e3134615bbec6302da0b1bba4b8dba7a1bed1b
Former-commit-id: 18bab5412d1b36615904399def77f7d32b638ae1
This commit is contained in:
Jaifroid 2021-02-14 16:42:43 +00:00
parent 14aebab45f
commit 0b2f93ed93

View File

@ -3286,7 +3286,10 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
htmlArticle = htmlArticle.replace(/href\s*=\s*"\s*geo:([\d.-]+),([\d.-]+)/ig, 'href="bingmaps:?collection=point.$1_$2_' + encodeURIComponent(dirEntry.getTitleOrUrl()));
// Process any app:// links (these are always from the app payload) to match the current protocol
htmlArticle = htmlArticle.replace(/(['"])app:\/\//g, '$1' + window.location.protocol + '//');
htmlArticle = htmlArticle.replace(/(['"])app:\/\//g, function (p0, p1) {
var appRootDir = window.location.href.replace(/\/www\/index\.html.*$/i, '');
return p1 + appRootDir;
});
//Setup endnote backlinks if the ZIM doesn't have any
htmlArticle = htmlArticle.replace(/<li\b[^>]+id=["']cite[-_]note[-_]([^"']+)[^>]+>(?![^/]+?[↑^])/ig, function (match, id) {