mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-11 05:08:43 -04:00
Ensure search loads in iframe
Former-commit-id: b56148d1ed455e1a56c0229629049f49ef8a8ed4 [formerly 1698ef45358974fceb3698944ab6eea06bb89945 [formerly d99494112e21b611e65e0d61f9e58a9d971e6e5b]] Former-commit-id: b793705f36f894ad0017b3d9d40ef7c3d7a618eb Former-commit-id: 69b4bb2eeaace330794b09ef69be976e57de722e
This commit is contained in:
parent
62ed795705
commit
c5b124dc43
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html style="background-color: black;">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Security-Policy" content="default-src http: https: file: data: blob: chrome-extension: ms-appx-web: 'unsafe-inline' 'unsafe-eval';">
|
<meta http-equiv="Content-Security-Policy" content="default-src http: https: file: data: blob: chrome-extension: ms-appx-web: 'unsafe-inline' 'unsafe-eval';">
|
||||||
|
@ -134,8 +134,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
$("#welcomeText").hide();
|
$("#welcomeText").hide();
|
||||||
$('.alert').hide();
|
$('.alert').hide();
|
||||||
$("#searchingArticles").show();
|
$("#searchingArticles").show();
|
||||||
// Ensure selected search item is displayed in the iframe, not a new window or tab
|
|
||||||
appstate.target = 'iframe';
|
|
||||||
pushBrowserHistoryState(null, prefix);
|
pushBrowserHistoryState(null, prefix);
|
||||||
// Initiate the search
|
// Initiate the search
|
||||||
searchDirEntriesFromPrefix(prefix);
|
searchDirEntriesFromPrefix(prefix);
|
||||||
@ -2879,7 +2877,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of DirEntry from given dirEntryId (including resolving redirects),
|
* Creates an instance of DirEntry from given dirEntryId (including resolving redirects),
|
||||||
* and call the function to read the corresponding article
|
* and call the function to read the corresponding article
|
||||||
@ -2890,6 +2887,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
var dirEntry = appstate.selectedArchive.parseDirEntryId(dirEntryId);
|
var dirEntry = appstate.selectedArchive.parseDirEntryId(dirEntryId);
|
||||||
// Remove focus from search field to hide keyboard and to allow navigation keys to be used
|
// Remove focus from search field to hide keyboard and to allow navigation keys to be used
|
||||||
document.getElementById('articleContent').contentWindow.focus();
|
document.getElementById('articleContent').contentWindow.focus();
|
||||||
|
// Ensure selected search item is displayed in the iframe, not a new window or tab
|
||||||
|
appstate.target = 'iframe';
|
||||||
$("#searchingArticles").show();
|
$("#searchingArticles").show();
|
||||||
if (dirEntry.isRedirect()) {
|
if (dirEntry.isRedirect()) {
|
||||||
appstate.selectedArchive.resolveRedirect(dirEntry, readArticle);
|
appstate.selectedArchive.resolveRedirect(dirEntry, readArticle);
|
||||||
@ -3725,6 +3724,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
if (appstate.target === 'iframe') {
|
if (appstate.target === 'iframe') {
|
||||||
// Tell jQuery we're removing the iframe document: clears jQuery cache and prevents memory leaks [kiwix-js #361]
|
// Tell jQuery we're removing the iframe document: clears jQuery cache and prevents memory leaks [kiwix-js #361]
|
||||||
$('#articleContent').contents().remove();
|
$('#articleContent').contents().remove();
|
||||||
|
articleContainer = document.getElementById('articleContent');
|
||||||
articleWindow = articleContainer.contentWindow;
|
articleWindow = articleContainer.contentWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3771,8 +3771,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
|||||||
// articleWindow.document.close();
|
// articleWindow.document.close();
|
||||||
|
|
||||||
if (appstate.target === 'iframe') {
|
if (appstate.target === 'iframe') {
|
||||||
// Tell jQuery we're removing the iframe document: clears jQuery cache and prevents memory leaks [kiwix-js #361]
|
|
||||||
$('#articleContent').contents().remove();
|
|
||||||
// Store the frame article's target in the top-level window, so that when we retrieve the window with
|
// Store the frame article's target in the top-level window, so that when we retrieve the window with
|
||||||
// history manipulation, we'll know where to place the iframe contentWindow
|
// history manipulation, we'll know where to place the iframe contentWindow
|
||||||
window.kiwixType = appstate.target;
|
window.kiwixType = appstate.target;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user