From d0e024e26434e1eddefa33154c9a0a02f086ad8e Mon Sep 17 00:00:00 2001 From: clavay Date: Mon, 16 Oct 2023 13:34:57 +0200 Subject: [PATCH] add JS variable to for on before reload if ONBEFORERELOAD_ASK is true, ask the user before reload o leaving the page, else don't ask --- .../static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js b/pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js index 94711e3c..db01d820 100644 --- a/pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js +++ b/pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js @@ -169,6 +169,10 @@ Licensed under the AGPL. */ var DATERANGEPICKER_SET = false; +/** +* Ask before leaving the page +*/ +var ONBEFORERELOAD_ASK = true; // ----------------------------------------------------------- // Objects @@ -4020,7 +4024,11 @@ function fix_page_anchor() { // prevent reloading by existent window.onbeforeunload = function() { - return "you realy wan't to reload/leave the page?"; + if (ONBEFORERELOAD_ASK) { + return "you realy wan't to reload/leave the page?"; + }else { + return null; + }; }; $(window).on('hashchange', function() { // nav menu click event