From e750fbeec774104ad5107f993027ff571c3bc36c Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sat, 4 Mar 2023 17:53:28 +0000 Subject: [PATCH] Fix bug with print icon --- www/js/app.js | 4 +++- www/js/lib/uiUtil.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index 8d766189..0b78972f 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1095,11 +1095,13 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images document.getElementById('btnAbout').addEventListener('click', function () { var btnAboutElement = document.getElementById('btnAbout'); + // Don't allow this button to be clicked if button is being used as exit fullscreen button + if (/glyphicon-(fullscreen|resize-small)/.test(btnAboutElement.innerHTML)) return; + // Deal with use of button for printing if (/glyphicon-print/.test(btnAboutElement.innerHTML)) { printIntercept(); return; } - if (/glyphicon-(fullscreen|resize-small)/.test(btnAboutElement.innerHTML)) return; //Check if we're 'unclicking' the button var searchDiv = document.getElementById('about'); if (searchDiv.style.display != 'none') { diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index 0c827198..de7c8165 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -1025,7 +1025,7 @@ define(rqDef, function(util) { document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen ? document.msExitFullscreen() : Promise.reject('No full-screen mode API available'); - return typeof fn === 'Promise' ? fn : Promise.resolve(fn); + return Promise.resolve(fn); }; return rq(el).then(function () { console.log(el ? 'Full-screen mode enabled' : 'Full-screen mode disabled'); @@ -1039,7 +1039,7 @@ define(rqDef, function(util) { /** * Attempts to put the app into full-screen mode and (if requested) lock the display orientation using the Screen Orientation Lock API * @param {string} val A valid value in the API, e.g. '', 'natural', 'portrait', 'landscape' - * @returns + * @returns {Promise} A Promise that resolves to a string informing the result (which may be '') */ function lockDisplayOrientation(val) { if (val) {