Ensure top URL will change in case it wishes to react according to storagePrompt param (such as in the embedded editor).

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2722 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-02-22 05:19:50 +00:00
parent 86800563ff
commit dd9e3b4864
1 changed files with 4 additions and 3 deletions

View File

@ -48,13 +48,14 @@ svgEditor.addExtension('storage', function() {
function replaceStoragePrompt (val) { function replaceStoragePrompt (val) {
val = val ? 'storagePrompt=' + val : ''; val = val ? 'storagePrompt=' + val : '';
if (window.location.href.indexOf('storagePrompt=') > -1) { var loc = top.location; // Allow this to work with the embedded editor as well
window.location.href = window.location.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) { if (loc.href.indexOf('storagePrompt=') > -1) {
loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) {
return (val ? n1 : '') + val + (!val && amp ? n1 : (amp || '')); return (val ? n1 : '') + val + (!val && amp ? n1 : (amp || ''));
}); });
} }
else { else {
window.location.href += (window.location.href.indexOf('?') > -1 ? '&' : '?') + val; loc.href += (loc.href.indexOf('?') > -1 ? '&' : '?') + val;
} }
} }
function setSVGContentStorage (val) { function setSVGContentStorage (val) {