diff --git a/gui.js b/gui.js index 24a6f056..aba93ff9 100644 --- a/gui.js +++ b/gui.js @@ -329,6 +329,26 @@ IDE_Morph.prototype.openIn = function (world) { */ function interpretUrlAnchors() { var dict; + function doDictFlags() { + if (dict.editMode) { + myself.toggleAppMode(false); + } else { + myself.toggleAppMode(true); + } + + if (!dict.noRun) { + myself.runScripts(); + } + + if (dict.hideControls) { + myself.controlBar.hide(); + window.onbeforeunload = nop; + } + if (dict.noExitWarning) { + window.onbeforeunload = nop; + } + }; + if (location.hash.substr(0, 6) === '#open:') { hash = location.hash.substr(6); if (hash.charAt(0) === '%' @@ -349,6 +369,8 @@ IDE_Morph.prototype.openIn = function (world) { } } else if (location.hash.substr(0, 5) === '#run:') { hash = location.hash.substr(5); + idx = hash.indexOf("&"); + if (idx > 0) {hash = hash.slice(0,idx);} if (hash.charAt(0) === '%' || hash.search(/\%(?:[0-9a-f]{2})/i) > -1) { hash = decodeURIComponent(hash); @@ -359,7 +381,8 @@ IDE_Morph.prototype.openIn = function (world) { this.rawOpenProjectString(getURL(hash)); } this.toggleAppMode(true); - this.runScripts(); + dict = SnapCloud.parseDict(location.hash.substr(5)); + doDictFlags(); } else if (location.hash.substr(0, 9) === '#present:') { this.shield = new Morph(); this.shield.color = this.color; @@ -395,23 +418,7 @@ IDE_Morph.prototype.openIn = function (world) { myself.shield = null; msg.destroy(); - if (dict.editMode) { - myself.toggleAppMode(false); - } else { - myself.toggleAppMode(true); - } - - if (!dict.noRun) { - myself.runScripts(); - } - - if (dict.hideControls) { - myself.controlBar.hide(); - window.onbeforeunload = nop; - } - if (dict.noExitWarning) { - window.onbeforeunload = nop; - } + doDictFlags(); } ]); },