summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2015-07-23 14:26:06 +0200
committerGubolin <gubolin@fantasymail.de>2015-07-23 14:26:06 +0200
commit5aec52889d79a8257971095719195fabcbc33559 (patch)
treee225dc622d1b16ee78bc495ead9a0df63c6f6b99 /gui.js
parenta3cae8db6e442da230a880a26546595afee7a3bd (diff)
parent40b1d4910ca55004c8f927abcdb02755b986923b (diff)
downloadsnap-5aec52889d79a8257971095719195fabcbc33559.tar.gz
snap-5aec52889d79a8257971095719195fabcbc33559.zip
merge upstreamdevelopment
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js49
1 files changed, 31 insertions, 18 deletions
diff --git a/gui.js b/gui.js
index 5fa1c6a..479941b 100644
--- a/gui.js
+++ b/gui.js
@@ -69,7 +69,7 @@ SpeechBubbleMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.gui = '2015-May-18';
+modules.gui = '2015-June-25';
// Declarations
@@ -82,6 +82,11 @@ var WardrobeMorph;
var SoundIconMorph;
var JukeboxMorph;
+// Get the full url without "snap.html"
+var baseUrl = document.URL.split('/');
+baseUrl.pop(baseUrl.length - 1);
+baseUrl = baseUrl.join('/') + '/';
+
// IDE_Morph ///////////////////////////////////////////////////////////
// I am SNAP's top-level frame, the Editor window
@@ -2634,13 +2639,10 @@ IDE_Morph.prototype.projectMenu = function () {
function () {
// read a list of libraries from an external file,
var libMenu = new MenuMorph(this, 'Import library'),
- libUrl = 'http://snap.berkeley.edu/snapsource/libraries/' +
- 'LIBRARIES';
+ libUrl = baseUrl + 'libraries/' + 'LIBRARIES';
function loadLib(name) {
- var url = 'http://snap.berkeley.edu/snapsource/libraries/'
- + name
- + '.xml';
+ var url = baseUrl + 'libraries/' + name + '.xml';
myself.droppedText(myself.getURL(url), name);
}
@@ -2791,7 +2793,7 @@ IDE_Morph.prototype.aboutSnap = function () {
creditsTxt = localize('Contributors')
+ '\n\nNathan Dinsmore: Saving/Loading, Snap-Logo Design, '
- + 'countless bugfixes'
+ + '\ncountless bugfixes and optimizations'
+ '\nKartik Chandra: Paint Editor'
+ '\nMichael Ball: Time/Date UI, many bugfixes'
+ '\n"Ava" Yuan Yuan: Graphic Effects'
@@ -4563,8 +4565,7 @@ IDE_Morph.prototype.getURLsbeOrRelative = function (url) {
var request = new XMLHttpRequest(),
myself = this;
try {
- request.open('GET', 'http://snap.berkeley.edu/snapsource/' +
- url, false);
+ request.open('GET', baseUrl + url, false);
request.send();
if (request.status === 200) {
return request.responseText;
@@ -5020,8 +5021,7 @@ ProjectDialogMorph.prototype.setSource = function (source) {
myself.nameField.setContents(item.name || '');
}
src = myself.ide.getURL(
- 'http://snap.berkeley.edu/snapsource/Examples/' +
- item.name + '.xml'
+ baseUrl + 'Examples/' + item.name + '.xml'
);
xml = myself.ide.serializer.parse(src);
@@ -5075,8 +5075,9 @@ ProjectDialogMorph.prototype.getLocalProjectList = function () {
ProjectDialogMorph.prototype.getExamplesProjectList = function () {
var dir,
projects = [];
+ //alert(baseUrl);
- dir = this.ide.getURL('http://snap.berkeley.edu/snapsource/Examples/');
+ dir = this.ide.getURL(baseUrl + 'Examples/');
dir.split('\n').forEach(
function (line) {
var startIdx = line.search(new RegExp('href=".*xml"')),
@@ -5095,8 +5096,8 @@ ProjectDialogMorph.prototype.getExamplesProjectList = function () {
}
}
);
- projects.sort(function (x, y) {
- return x.name < y.name ? -1 : 1;
+ projects = projects.sort(function (x, y) {
+ return x.name.toLowerCase() < y.name.toLowerCase() ? -1 : 1;
});
return projects;
};
@@ -5260,10 +5261,7 @@ ProjectDialogMorph.prototype.openProject = function () {
} else if (this.source === 'github') {
this.openGitHubProject(proj);
} else if (this.source === 'examples') {
- src = this.ide.getURL(
- 'http://snap.berkeley.edu/snapsource/Examples/' +
- proj.name + '.xml'
- );
+ src = this.ide.getURL(baseUrl + 'Examples/' + proj.name + '.xml');
this.ide.openProjectString(src);
this.destroy();
} else { // 'local'
@@ -5503,6 +5501,7 @@ ProjectDialogMorph.prototype.deleteProject = function () {
ProjectDialogMorph.prototype.shareProject = function () {
var myself = this,
+ ide = this.ide,
proj = this.listField.selected,
entry = this.listField.active;
@@ -5533,6 +5532,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()
);
@@ -5543,6 +5551,7 @@ ProjectDialogMorph.prototype.shareProject = function () {
ProjectDialogMorph.prototype.unshareProject = function () {
var myself = this,
+ ide = this.ide,
proj = this.listField.selected,
entry = this.listField.active;
@@ -5574,6 +5583,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()
);