kopia lustrzana https://github.com/backface/turtlestitch
Fixing #run: anchor launcher
rodzic
2b530f82df
commit
fe55a1763b
36
src/gui.js
36
src/gui.js
|
@ -457,26 +457,38 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (location.hash.substr(0, 5) === '#run:') {
|
} else if (location.hash.substr(0, 5) === '#run:') {
|
||||||
|
dict = '';
|
||||||
hash = location.hash.substr(5);
|
hash = location.hash.substr(5);
|
||||||
idx = hash.indexOf("&");
|
|
||||||
if (idx > 0) {
|
//decoding if hash is an encoded URI
|
||||||
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);
|
||||||
}
|
}
|
||||||
if (hash.substr(0, 8) === '<project>') {
|
idx = hash.indexOf("&");
|
||||||
this.rawOpenProjectString(hash);
|
|
||||||
applyFlags(myself.cloud.parseDict(location.hash.substr(5)));
|
// supporting three URL cases
|
||||||
|
|
||||||
|
// xml project
|
||||||
|
if (hash.substr(0, 8) === '<project') {
|
||||||
|
this.rawOpenProjectString(hash.slice(0,hash.indexOf('</project>') + 10));
|
||||||
|
applyFlags(myself.cloud.parseDict(hash.substr(hash.indexOf('</project>') + 10)));
|
||||||
|
// no project, only flags
|
||||||
|
} else if (idx == 0){
|
||||||
|
applyFlags(myself.cloud.parseDict(hash));
|
||||||
|
// xml file path
|
||||||
|
// three path types allowed: absolute (http...) , relative to site ("/path") or relative to folder ("path")
|
||||||
} else {
|
} else {
|
||||||
this.shield = new Morph();
|
this.shield = new Morph();
|
||||||
this.shield.alpha = 0;
|
this.shield.alpha = 0;
|
||||||
this.shield.setExtent(this.parent.extent());
|
this.shield.setExtent(this.parent.extent());
|
||||||
this.parent.add(this.shield);
|
this.parent.add(this.shield);
|
||||||
this.showMessage('Fetching project...');
|
this.showMessage('Fetching project...');
|
||||||
|
if (idx > 0) {
|
||||||
|
dict = myself.cloud.parseDict(hash.substr(idx));
|
||||||
|
hash = hash.slice(0,idx);
|
||||||
|
}
|
||||||
this.getURL(
|
this.getURL(
|
||||||
hash,
|
hash,
|
||||||
projectData => {
|
projectData => {
|
||||||
|
@ -498,11 +510,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
this.shield = null;
|
this.shield = null;
|
||||||
msg.destroy();
|
msg.destroy();
|
||||||
// this.toggleAppMode(true);
|
// this.toggleAppMode(true);
|
||||||
applyFlags(
|
applyFlags(dict);
|
||||||
this.cloud.parseDict(
|
|
||||||
location.hash.substr(5)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue