change beforeunload to use addEventListener (only supporting IE9 now and better to allow multiple if user wishes); also CamelCase internal variable for consistency; add brackets

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2639 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Brett Zamir
2014-01-31 00:06:50 +00:00
parent 7a4d8949c7
commit 6b5a4e645e
4 changed files with 17 additions and 9 deletions

View File

@@ -1801,7 +1801,9 @@
var operaRepaint = function() {
// Repaints canvas in Opera. Needed for stroke-dasharray change as well as fill change
if (!window.opera) return;
if (!window.opera) {
return;
}
$('<p/>').hide().appendTo('body').remove();
};
@@ -4235,7 +4237,7 @@
$('#cmenu_canvas li').disableContextMenu();
canv_menu.enableContextMenuItems('#delete,#cut,#copy');
window.onbeforeunload = function() {
window.addEventListener('beforeunload', function() {
if ('localStorage' in window) {
var name = 'svgedit-' + Editor.curConfig.canvasName;
window.localStorage.setItem(name, svgCanvas.getSvgString());
@@ -4252,7 +4254,7 @@
// Browser already asks question about closing the page
return uiStrings.notification.unsavedChanges;
}
};
}, false);
Editor.openPrep = function(func) {
$('#main_menu').hide();