Skip to content

Commit

Permalink
add JS variable to for on before reload
Browse files Browse the repository at this point in the history
if ONBEFORERELOAD_ASK is true, ask the user before reload o leaving the
page, else don't ask
  • Loading branch information
clavay authored and trombastic committed Oct 16, 2023
1 parent 20961c6 commit d0e024e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ Licensed under the AGPL.
*/
var DATERANGEPICKER_SET = false;

/**
* Ask before leaving the page
*/
var ONBEFORERELOAD_ASK = true;

// -----------------------------------------------------------
// Objects
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d0e024e

Please sign in to comment.