mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-10 20:59:03 -04:00
Fix broken button to close active content warning
This commit is contained in:
parent
817da09473
commit
a19f740d84
@ -323,14 +323,14 @@ function displayActiveContentWarning(type) {
|
|||||||
var alertHTML = '';
|
var alertHTML = '';
|
||||||
if (params.contentInjectionMode === 'jquery' && type === 'open') {
|
if (params.contentInjectionMode === 'jquery' && type === 'open') {
|
||||||
alertHTML = '<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
alertHTML = '<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
||||||
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
'<a href="#" id="activeContentClose" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
||||||
'<strong>Unable to display active content:</strong> To use <b>Archive Index</b> type a <b><i>space</i></b>, or for <b>URL Index</b> type ' +
|
'<strong>Unable to display active content:</strong> To use <b>Archive Index</b> type a <b><i>space</i></b>, or for <b>URL Index</b> type ' +
|
||||||
'<b><i>space / </i></b>, or else <a id="swModeLink" href="#contentInjectionModeDiv" class="alert-link">switch to Service Worker mode</a> ' +
|
'<b><i>space / </i></b>, or else <a id="swModeLink" href="#contentInjectionModeDiv" class="alert-link">switch to Service Worker mode</a> ' +
|
||||||
'if your platform supports it. [<a id="stop" href="#expertSettingsDiv" class="alert-link">Permanently hide</a>]' +
|
'if your platform supports it. [<a id="stop" href="#expertSettingsDiv" class="alert-link">Permanently hide</a>]' +
|
||||||
'</div>';
|
'</div>';
|
||||||
} else if (params.contentInjectionMode === 'serviceworker' && type === 'legacy') {
|
} else if (params.contentInjectionMode === 'serviceworker' && type === 'legacy') {
|
||||||
alertHTML = '<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
alertHTML = '<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
||||||
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
'<a href="#" id="activeContentClose" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
||||||
'<strong>Legacy ZIM type!</strong> To display content correctly from this historical ZIM, ' +
|
'<strong>Legacy ZIM type!</strong> To display content correctly from this historical ZIM, ' +
|
||||||
'please <a id="jqModeLink" href="#contentInjectionModeDiv" class="alert-link">switch to the legacy JQuery mode</a>. ' +
|
'please <a id="jqModeLink" href="#contentInjectionModeDiv" class="alert-link">switch to the legacy JQuery mode</a>. ' +
|
||||||
'You may need to increase font size with zoom buttons at bottom of screen. [<a id="stop" href="#expertSettingsDiv" class="alert-link">Permanently hide</a>]' +
|
'You may need to increase font size with zoom buttons at bottom of screen. [<a id="stop" href="#expertSettingsDiv" class="alert-link">Permanently hide</a>]' +
|
||||||
@ -338,7 +338,7 @@ function displayActiveContentWarning(type) {
|
|||||||
} else if (params.contentInjectionMode === 'serviceworker' && (params.manipulateImages || params.displayHiddenBlockElements || params.allowHTMLExtraction)) {
|
} else if (params.contentInjectionMode === 'serviceworker' && (params.manipulateImages || params.displayHiddenBlockElements || params.allowHTMLExtraction)) {
|
||||||
alertHTML =
|
alertHTML =
|
||||||
'<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
'<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
||||||
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
'<a href="#" id="activeContentClose" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
||||||
'<strong>Active content may not work correctly:</strong> Please ' + (params.displayHiddenBlockElements ?
|
'<strong>Active content may not work correctly:</strong> Please ' + (params.displayHiddenBlockElements ?
|
||||||
'<a id="hbeModeLink" href="#displayHiddenBlockElementsDiv" class="alert-link">disable Display hidden block elements</a> ' :
|
'<a id="hbeModeLink" href="#displayHiddenBlockElementsDiv" class="alert-link">disable Display hidden block elements</a> ' :
|
||||||
params.manipulateImages ? '<a id="imModeLink" href="#imageManipulationDiv" class="alert-link">disable Image manipulation</a> ' : '') +
|
params.manipulateImages ? '<a id="imModeLink" href="#imageManipulationDiv" class="alert-link">disable Image manipulation</a> ' : '') +
|
||||||
@ -350,7 +350,7 @@ function displayActiveContentWarning(type) {
|
|||||||
if (type === 'zimit') {
|
if (type === 'zimit') {
|
||||||
alertHTML =
|
alertHTML =
|
||||||
'<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
'<div id="activeContent" class="alert alert-warning alert-dismissible fade in" style="margin-bottom: 0;">' +
|
||||||
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
'<a href="#" id="activeContentClose" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
||||||
// '<strong>' + (params.contentInjectionMode === 'jquery' ? 'Limited Zimit' : 'Experimental') + ' support:</strong> ' +
|
// '<strong>' + (params.contentInjectionMode === 'jquery' ? 'Limited Zimit' : 'Experimental') + ' support:</strong> ' +
|
||||||
(params.contentInjectionMode === 'jquery' ? '<b>Limited Zimit support!</b> Please <a id="swModeLink" href="#contentInjectionModeDiv" ' +
|
(params.contentInjectionMode === 'jquery' ? '<b>Limited Zimit support!</b> Please <a id="swModeLink" href="#contentInjectionModeDiv" ' +
|
||||||
'class="alert-link">switch to Service Worker mode</a> if your platform supports it. ' :
|
'class="alert-link">switch to Service Worker mode</a> if your platform supports it. ' :
|
||||||
@ -363,6 +363,10 @@ function displayActiveContentWarning(type) {
|
|||||||
var alertBoxHeader = document.getElementById('alertBoxHeader');
|
var alertBoxHeader = document.getElementById('alertBoxHeader');
|
||||||
alertBoxHeader.innerHTML = alertHTML;
|
alertBoxHeader.innerHTML = alertHTML;
|
||||||
alertBoxHeader.style.display = 'block';
|
alertBoxHeader.style.display = 'block';
|
||||||
|
document.getElementById('activeContentClose').addEventListener('click', function () {
|
||||||
|
// Hide the alert box
|
||||||
|
alertBoxHeader.style.display = 'none';
|
||||||
|
});
|
||||||
['swModeLink', 'jqModeLink', 'imModeLink', 'hbeModeLink', 'stop'].forEach(function(id) {
|
['swModeLink', 'jqModeLink', 'imModeLink', 'hbeModeLink', 'stop'].forEach(function(id) {
|
||||||
// Define event listeners for both hyperlinks in alert box: these take the user to the Config tab and highlight
|
// Define event listeners for both hyperlinks in alert box: these take the user to the Config tab and highlight
|
||||||
// the options that the user needs to select
|
// the options that the user needs to select
|
||||||
|
Loading…
x
Reference in New Issue
Block a user