mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-12-24 06:57:59 -05:00
Compare commits
2 Commits
dirScan
...
clickable_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
035667b0e1 | ||
|
|
d2b014656b |
@@ -1088,6 +1088,7 @@ const std::string CONTENT_CSP_HEADER =
|
||||
|
||||
"sandbox allow-scripts "
|
||||
"allow-same-origin "
|
||||
"allow-top-navigation-by-user-activation "
|
||||
"allow-modals "
|
||||
"allow-popups "
|
||||
"allow-forms "
|
||||
|
||||
@@ -257,7 +257,7 @@ function isExternalUrl(url) {
|
||||
|| url.startsWith("https:");
|
||||
}
|
||||
|
||||
function onClickEvent(e) {
|
||||
function handleLinkClick(e) {
|
||||
const iframeDocument = contentIframe.contentDocument;
|
||||
const target = matchingAncestorElement(e.target, iframeDocument, "a");
|
||||
if (target !== null && "href" in target) {
|
||||
@@ -266,6 +266,8 @@ function onClickEvent(e) {
|
||||
if ( viewerSettings.linkBlockingEnabled ) {
|
||||
return blockLink(target);
|
||||
}
|
||||
} else {
|
||||
target.setAttribute("target", "content_iframe");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,7 +303,7 @@ this.Element && function(ElementPrototype) {
|
||||
}(Element.prototype);
|
||||
|
||||
function setup_external_link_blocker() {
|
||||
setupEventHandler(contentIframe.contentDocument, 'a', 'click', onClickEvent);
|
||||
setupEventHandler(contentIframe.contentDocument, 'a', 'click', handleLinkClick);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
</div>
|
||||
|
||||
<iframe id="content_iframe"
|
||||
name="content_iframe"
|
||||
referrerpolicy="no-referrer"
|
||||
onload="on_content_load()"
|
||||
src="./skin/blank.html?KIWIXCACHEID" title="ZIM content" width="100%"
|
||||
|
||||
@@ -73,7 +73,7 @@ const ResourceCollection resources200Compressible{
|
||||
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/taskbar.css" },
|
||||
{ STATIC_CONTENT, "/ROOT%23%3F/skin/taskbar.css?cacheid=bbdaf425" },
|
||||
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/viewer.js" },
|
||||
{ STATIC_CONTENT, "/ROOT%23%3F/skin/viewer.js?cacheid=b9a574d4" },
|
||||
{ STATIC_CONTENT, "/ROOT%23%3F/skin/viewer.js?cacheid=b548ad94" },
|
||||
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/fonts/Poppins.ttf" },
|
||||
{ STATIC_CONTENT, "/ROOT%23%3F/skin/fonts/Poppins.ttf?cacheid=af705837" },
|
||||
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/fonts/Roboto.ttf" },
|
||||
@@ -312,7 +312,7 @@ R"EXPECTEDRESULT( <link type="text/css" href="./skin/taskbar.css?cacheid=bbda
|
||||
<link type="text/css" href="./skin/css/autoComplete.css?cacheid=08951e06" rel="Stylesheet" />
|
||||
<script type="module" src="./skin/i18n.js?cacheid=2cf0f8c5" defer></script>
|
||||
<script type="text/javascript" src="./skin/languages.js?cacheid=b00b12db" defer></script>
|
||||
<script type="text/javascript" src="./skin/viewer.js?cacheid=b9a574d4" defer></script>
|
||||
<script type="text/javascript" src="./skin/viewer.js?cacheid=b548ad94" defer></script>
|
||||
<script type="text/javascript" src="./skin/autoComplete.min.js?cacheid=1191aaaf"></script>
|
||||
const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";
|
||||
<img src="./skin/langSelector.svg?cacheid=00b59961">
|
||||
|
||||
Reference in New Issue
Block a user