diff --git a/gui.js b/gui.js index 66514ba1..f7118475 100644 --- a/gui.js +++ b/gui.js @@ -5005,6 +5005,7 @@ ProjectDialogMorph.prototype.deleteProject = function () { ProjectDialogMorph.prototype.shareProject = function () { var myself = this, + ide = this.ide, proj = this.listField.selected, entry = this.listField.active; @@ -5035,6 +5036,15 @@ ProjectDialogMorph.prototype.shareProject = function () { myself.ide.cloudError(), [proj.ProjectName] ); + // Set the Shared URL if the project is currently open + if (proj.ProjectName === ide.projectName) { + var usr = SnapCloud.username, + projectId = 'Username=' + + encodeURIComponent(usr.toLowerCase()) + + '&ProjectName=' + + encodeURIComponent(proj.projectName); + location.hash = projectId; + } }, myself.ide.cloudError() ); @@ -5045,6 +5055,7 @@ ProjectDialogMorph.prototype.shareProject = function () { ProjectDialogMorph.prototype.unshareProject = function () { var myself = this, + ide = this.ide, proj = this.listField.selected, entry = this.listField.active; @@ -5076,6 +5087,10 @@ ProjectDialogMorph.prototype.unshareProject = function () { myself.ide.cloudError(), [proj.ProjectName] ); + // Remove the shared URL if the project is open. + if (proj.ProjectName === ide.projectName) { + location.hash = ''; + } }, myself.ide.cloudError() );