diff options
| author | jmoenig <jens@moenig.org> | 2015-02-06 11:29:46 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2015-02-06 11:29:46 +0100 |
| commit | e45562fc530f74fff38baa7ba8c4f39ab8e4e08f (patch) | |
| tree | c5e93b506b9d9cff56c4388d807b16ee81aa6034 /gui.js | |
| parent | 273c58440cf86ed9679904a04a8442335228755c (diff) | |
| download | snap-yow-e45562fc530f74fff38baa7ba8c4f39ab8e4e08f.tar.gz snap-yow-e45562fc530f74fff38baa7ba8c4f39ab8e4e08f.zip | |
Added url switch #cloud: to open a shared project in edit mode
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2015-January-21'; +modules.gui = '2015-February-06'; // Declarations @@ -390,6 +390,46 @@ IDE_Morph.prototype.openIn = function (world) { }, this.cloudError() ); + } else if (location.hash.substr(0, 7) === '#cloud:') { + this.shield = new Morph(); + this.shield.alpha = 0; + this.shield.setExtent(this.parent.extent()); + this.parent.add(this.shield); + myself.showMessage('Fetching project\nfrom the cloud...'); + + // make sure to lowercase the username + dict = SnapCloud.parseDict(location.hash.substr(7)); + dict.Username = dict.Username.toLowerCase(); + + SnapCloud.getPublicProject( + SnapCloud.encodeDict(dict), + function (projectData) { + var msg; + myself.nextSteps([ + function () { + msg = myself.showMessage('Opening project...'); + }, + function () {nop(); }, // yield (bug in Chrome) + function () { + if (projectData.indexOf('<snapdata') === 0) { + myself.rawOpenCloudDataString(projectData); + } else if ( + projectData.indexOf('<project') === 0 + ) { + myself.rawOpenProjectString(projectData); + } + myself.hasChangedMedia = true; + }, + function () { + myself.shield.destroy(); + myself.shield = null; + msg.destroy(); + myself.toggleAppMode(false); + } + ]); + }, + this.cloudError() + ); } else if (location.hash.substr(0, 6) === '#lang:') { urlLanguage = location.hash.substr(6); this.setLanguage(urlLanguage); |
