diff options
| author | brianharvey <bh@cs.berkeley.edu> | 2014-07-11 08:28:48 -0700 |
|---|---|---|
| committer | brianharvey <bh@cs.berkeley.edu> | 2014-07-11 08:28:48 -0700 |
| commit | c965d45259f077863132f7651309bdb63d488524 (patch) | |
| tree | 58fd1682025f75194066e6d77d0c47357f3cface /gui.js | |
| parent | f27e72e2b2005f96d680e12efb59aa146969d0ec (diff) | |
| download | snap-yow-c965d45259f077863132f7651309bdb63d488524.tar.gz snap-yow-c965d45259f077863132f7651309bdb63d488524.zip | |
Allow loading tools.xml from mirror *or* s.b.e
Using full http://s.b.e/snapsource/tools.xml disallows local repository.
Using relative tools.xml disallows running from local disk but getting tools from s.b.e.
So we try both.
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -2349,8 +2349,9 @@ IDE_Morph.prototype.projectMenu = function () { 'Import tools', function () { myself.droppedText( - myself.getURL( - 'tools.xml' + myself.getURL2( + 'tools.xml', + 'http://snap.berkeley.edu/snapsource/tools.xml' ), 'tools' ); @@ -4035,6 +4036,22 @@ IDE_Morph.prototype.getURL = function (url) { } }; +IDE_Morph.prototype.getURL2 = function (url, url2) { + var request = new XMLHttpRequest(), + myself = this; + try { + request.open('GET', url, false); + request.send(); + if (request.status === 200) { + return request.responseText; + } + return myself.getURL(url2); + } catch (err) { + myself.showMessage(err); + return; + } +}; + // IDE_Morph user dialog shortcuts IDE_Morph.prototype.showMessage = function (message, secs) { |
