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

@@ -82,7 +82,9 @@ svgedit.utilities.encode64 = function(input) {
// base64 strings are 4/3 larger than the original string
// input = svgedit.utilities.encodeUTF8(input); // convert non-ASCII characters
input = svgedit.utilities.convertToXMLReferences(input);
if(window.btoa) return window.btoa(input); // Use native if available
if(window.btoa) {
return window.btoa(input); // Use native if available
}
var output = new Array( Math.floor( (input.length + 2) / 3 ) * 4 );
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
@@ -116,7 +118,9 @@ svgedit.utilities.encode64 = function(input) {
// Function: svgedit.utilities.decode64
// Converts a string from base64
svgedit.utilities.decode64 = function(input) {
if(window.atob) return window.atob(input);
if(window.atob) {
return window.atob(input);
}
var output = '';
var chr1, chr2, chr3 = '';
var enc1, enc2, enc3, enc4 = '';