Merge pull request #1605 from brianharvey/run-flags

Run flags
pull/29/head
Jens Mönig 2017-01-09 15:09:08 +01:00 zatwierdzone przez GitHub
commit 35cf8e7e4d
1 zmienionych plików z 25 dodań i 18 usunięć

43
gui.js
Wyświetl plik

@ -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();
}
]);
},