summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorbrianharvey <bh@cs.berkeley.edu>2014-07-11 08:52:30 -0700
committerbrianharvey <bh@cs.berkeley.edu>2014-07-11 08:52:30 -0700
commitce7f681c55bebff231867d8f3cd67e31daa644b9 (patch)
tree81c8255b5db68c6695167fa37acfc5cf1c3c816c /gui.js
parentc965d45259f077863132f7651309bdb63d488524 (diff)
downloadsnap-byow-ce7f681c55bebff231867d8f3cd67e31daa644b9.tar.gz
snap-byow-ce7f681c55bebff231867d8f3cd67e31daa644b9.zip
Improve sbe-or-relative to generalize
New method GetURLsbeOrRelative(url) takes a relative URL and tries it first on s.b.e and if that fails as a relative url.
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/gui.js b/gui.js
index e209d4b..1d3c134 100644
--- a/gui.js
+++ b/gui.js
@@ -2349,9 +2349,8 @@ IDE_Morph.prototype.projectMenu = function () {
'Import tools',
function () {
myself.droppedText(
- myself.getURL2(
- 'tools.xml',
- 'http://snap.berkeley.edu/snapsource/tools.xml'
+ myself.getURLsbeOrRelative(
+ 'tools.xml'
),
'tools'
);
@@ -4036,16 +4035,17 @@ IDE_Morph.prototype.getURL = function (url) {
}
};
-IDE_Morph.prototype.getURL2 = function (url, url2) {
+IDE_Morph.prototype.getURLsbeOrRelative = function (url) {
var request = new XMLHttpRequest(),
myself = this;
try {
- request.open('GET', url, false);
+ request.open('GET', 'http://snap.berkeley.edu/snapsource/' +
+ url, false);
request.send();
if (request.status === 200) {
return request.responseText;
}
- return myself.getURL(url2);
+ return myself.getURL(url);
} catch (err) {
myself.showMessage(err);
return;