diff options
| author | Jens Mönig <jens@moenig.org> | 2013-04-09 00:26:54 -0700 |
|---|---|---|
| committer | Jens Mönig <jens@moenig.org> | 2013-04-09 00:26:54 -0700 |
| commit | cd41e7c644d77a396ec80d5f32abe14be7cfcc6b (patch) | |
| tree | adbd35eb96687eadbbb4caf2a40c933b948d3f64 /gui.js | |
| parent | 0c4cedad05713aed3340c3d89a2e0c82fc87af40 (diff) | |
| parent | f3bd991f0710cc41178d6dc41cc1e69dfd41c62b (diff) | |
| download | snap-yow-cd41e7c644d77a396ec80d5f32abe14be7cfcc6b.tar.gz snap-yow-cd41e7c644d77a396ec80d5f32abe14be7cfcc6b.zip | |
Merge pull request #15 from queryselector/master
Removed .DS_Store, fixed #3, and made things consistently UTF-8
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 40 |
1 files changed, 24 insertions, 16 deletions
@@ -6,12 +6,12 @@ based on morphic.js, blocks.js, threads.js and objects.js inspired by Scratch - written by Jens Mšnig + written by Jens Mönig jens@moenig.org - Copyright (C) 2013 by Jens Mšnig + Copyright (C) 2013 by Jens Mönig - This file is part of Snap!. + This file is part of Snap!. Snap! is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -269,7 +269,7 @@ IDE_Morph.prototype.openIn = function (world) { ); } else if (location.hash.substr(0, 6) === '#lang:') { this.setLanguage(location.hash.substr(6)); - this.newProject(); + this.loadNewProject = true; } else if (location.hash.substr(0, 7) === '#signup') { this.createCloudAccount(); } @@ -1227,7 +1227,7 @@ IDE_Morph.prototype.createCorral = function () { // IDE_Morph layout IDE_Morph.prototype.fixLayout = function (situation) { - // situation is a string, i.e. + // situation is a string, i.e. // 'selectSprite' or 'refreshPalette' or 'tabEditor' var padding = 5; @@ -2177,7 +2177,9 @@ IDE_Morph.prototype.newProject = function () { if (this.stage) { this.stage.destroy(); } - location.hash = ''; + if (location.hash.substr(0, 6) !== '#lang:') { + location.hash = ''; + } this.globalVariables = new VariableFrame(); this.currentSprite = new SpriteMorph(this.globalVariables); this.sprites = new List([this.currentSprite]); @@ -2788,21 +2790,27 @@ IDE_Morph.prototype.setLanguage = function (lang) { IDE_Morph.prototype.reflectLanguage = function (lang) { var projectData; SnapTranslator.language = lang; - if (Process.prototype.isCatchingErrors) { - try { + if (!this.loadNewProject) { + if (Process.prototype.isCatchingErrors) { + try { + projectData = this.serializer.serialize(this.stage); + } catch (err) { + this.showMessage('Serialization failed: ' + err); + } + } else { projectData = this.serializer.serialize(this.stage); - } catch (err) { - this.showMessage('Serialization failed: ' + err); } - } else { - projectData = this.serializer.serialize(this.stage); } SpriteMorph.prototype.initBlocks(); this.spriteBar.tabBar.tabTo('scripts'); this.createCategories(); this.createCorralBar(); this.fixLayout(); - this.openProjectString(projectData); + if (this.loadNewProject){ + this.newProject(); + } else { + this.openProjectString(projectData); + } }; // IDE_Morph blocks scaling @@ -4478,8 +4486,8 @@ SpriteIconMorph.prototype.copySound = function (sound) { /* I am a selectable element in the SpriteEditor's "Costumes" tab, keeping - a self-updating thumbnail of the costume I'm respresenting, and a - self-updating label of the costume's name (in case it is changed + a self-updating thumbnail of the costume I'm respresenting, and a + self-updating label of the costume's name (in case it is changed elsewhere) */ @@ -5300,4 +5308,4 @@ JukeboxMorph.prototype.reactToDropOf = function (icon) { }); this.sprite.sounds.add(costume, idx); this.updateList(); -};
\ No newline at end of file +}; |
