filenames
use kebab-case for file names remove camelCase and snake_case
This commit is contained in:
35
website/agenda/planung/js/page-leave-handler.js
Normal file
35
website/agenda/planung/js/page-leave-handler.js
Normal file
@@ -0,0 +1,35 @@
|
||||
var pageHasChangedCounter=0;
|
||||
var pageIsLoaded=0;
|
||||
|
||||
function pageHasChanged(){
|
||||
console.log("pageHasChanged="+pageHasChangedCounter)
|
||||
if (pageIsLoaded==0) return;
|
||||
pageHasChangedCounter++;
|
||||
console.log("pageHasChanged="+pageHasChangedCounter)
|
||||
}
|
||||
|
||||
function confirmPageLeave(){
|
||||
if(pageHasChangedCounter==0) return null;
|
||||
return "Unsaved changed! Continue?";
|
||||
}
|
||||
|
||||
function pageLeaveHandler(){
|
||||
$('div.editor input' ).change(function(){pageHasChanged()});
|
||||
$('div.editor textarea').change(function(){pageHasChanged()});
|
||||
$('div.editor select' ).change(function(){pageHasChanged()});
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
return confirmPageLeave();
|
||||
};
|
||||
|
||||
//$(window).unload(function(){});
|
||||
pageIsLoaded=1;
|
||||
console.log("pageLeaveHandler=initialized")
|
||||
|
||||
}
|
||||
|
||||
function leavePage(){
|
||||
pageHasChangedCounter=0;
|
||||
console.log("leavePage")
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user