From d3e4a6a3006ad6a54fe90bd06013d20ae952ed2b Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Thu, 29 Mar 2018 10:45:40 +0100 Subject: [PATCH] Set PageMaxWidth to 100% before printing Former-commit-id: 2fd8e321450770d891a7283d49d8a9da796458c7 [formerly 8f65085fc2189b858d669617b26221cf75b6513c] Former-commit-id: b15ee641b14703e31eed30ae247e131ccaed61dc --- CHANGELOG.md | 3 ++- www/js/app.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa58f016..88f00125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ## Release 0.9.9.4 (beta) * ENHANCEMENT: Experimental support for printing articles * ENHANCEMENT: Print zoom capability -* ENHANCEMENT: Prevent prevent printing of location pins +* ENHANCEMENT: Prevent printing of location pins +* ENHANCEMENT: Set maximum page width to 100% before printing * ENHANCEMENT: Better presentation of About and Changelog information * WORKAROUND: MW-Offliner bug which places extraneous tags in some HTML id attributes diff --git a/www/js/app.js b/www/js/app.js index 7221feb5..eb60e7fa 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -170,6 +170,13 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' document.getElementById("printImageCheck").checked = false; document.getElementById("printImageCheck").disabled = true; } + //Remove max page-width restriction + if (params.removePageMaxWidth !== true) { + var tempPageMaxWidth = params.removePageMaxWidth; + params.removePageMaxWidth = true; + removePageMaxWidth(); + params.removePageMaxWidth = tempPageMaxWidth; + } var modalContent = document.getElementById("modal-content"); modalContent.classList.remove('dark'); if (params.cssUITheme != "light") modalContent.classList.add('dark'); @@ -179,7 +186,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' }); $("#printModal").off('hide.bs.modal'); $("#printModal").on('hide.bs.modal', function() { - if (document.activeElement.id != "confirm-print-continue") { setTab(); return; } + if (document.activeElement.id != "confirm-print-continue") { //User cancelled + //Restore PageMaxWidth + removePageMaxWidth(); + setTab(); + return; + } uiUtil.printCustomElements(); //innerDocument.execCommand("print", false, null); window.frames[0].frameElement.contentWindow.print();