diff options
| author | brianharvey <bh@cs.berkeley.edu> | 2014-07-11 08:52:30 -0700 |
|---|---|---|
| committer | brianharvey <bh@cs.berkeley.edu> | 2014-07-11 08:52:30 -0700 |
| commit | ce7f681c55bebff231867d8f3cd67e31daa644b9 (patch) | |
| tree | 81c8255b5db68c6695167fa37acfc5cf1c3c816c /gui.js | |
| parent | c965d45259f077863132f7651309bdb63d488524 (diff) | |
| download | snap-ce7f681c55bebff231867d8f3cd67e31daa644b9.tar.gz snap-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.js | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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; |
