kopia lustrzana https://github.com/backface/turtlestitch
fix and refactor "#run: flags"
rodzic
35cf8e7e4d
commit
ef51e5aaec
55
gui.js
55
gui.js
|
@ -72,7 +72,7 @@ isRetinaSupported, SliderMorph, Animation*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.gui = '2017-January-05';
|
modules.gui = '2017-January-09';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
@ -318,6 +318,24 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyFlags(dict) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dynamic notifications from non-source text files
|
// dynamic notifications from non-source text files
|
||||||
// has some issues, commented out for now
|
// has some issues, commented out for now
|
||||||
/*
|
/*
|
||||||
|
@ -327,27 +345,9 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
this.inform('Snap!', motd);
|
this.inform('Snap!', motd);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function interpretUrlAnchors() {
|
function interpretUrlAnchors() {
|
||||||
var dict;
|
var dict, idx;
|
||||||
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:') {
|
if (location.hash.substr(0, 6) === '#open:') {
|
||||||
hash = location.hash.substr(6);
|
hash = location.hash.substr(6);
|
||||||
|
@ -369,8 +369,10 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
}
|
}
|
||||||
} else if (location.hash.substr(0, 5) === '#run:') {
|
} else if (location.hash.substr(0, 5) === '#run:') {
|
||||||
hash = location.hash.substr(5);
|
hash = location.hash.substr(5);
|
||||||
idx = hash.indexOf("&");
|
idx = hash.indexOf("&");
|
||||||
if (idx > 0) {hash = hash.slice(0,idx);}
|
if (idx > 0) {
|
||||||
|
hash = hash.slice(0, idx);
|
||||||
|
}
|
||||||
if (hash.charAt(0) === '%'
|
if (hash.charAt(0) === '%'
|
||||||
|| hash.search(/\%(?:[0-9a-f]{2})/i) > -1) {
|
|| hash.search(/\%(?:[0-9a-f]{2})/i) > -1) {
|
||||||
hash = decodeURIComponent(hash);
|
hash = decodeURIComponent(hash);
|
||||||
|
@ -380,9 +382,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
} else {
|
} else {
|
||||||
this.rawOpenProjectString(getURL(hash));
|
this.rawOpenProjectString(getURL(hash));
|
||||||
}
|
}
|
||||||
this.toggleAppMode(true);
|
applyFlags(SnapCloud.parseDict(location.hash.substr(5)));
|
||||||
dict = SnapCloud.parseDict(location.hash.substr(5));
|
|
||||||
doDictFlags();
|
|
||||||
} else if (location.hash.substr(0, 9) === '#present:') {
|
} else if (location.hash.substr(0, 9) === '#present:') {
|
||||||
this.shield = new Morph();
|
this.shield = new Morph();
|
||||||
this.shield.color = this.color;
|
this.shield.color = this.color;
|
||||||
|
@ -417,8 +417,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
myself.shield.destroy();
|
myself.shield.destroy();
|
||||||
myself.shield = null;
|
myself.shield = null;
|
||||||
msg.destroy();
|
msg.destroy();
|
||||||
|
applyFlags(dict);
|
||||||
doDictFlags();
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
Ładowanie…
Reference in New Issue