kopia lustrzana https://github.com/backface/turtlestitch
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.pull/3/merge
rodzic
f27e72e2b2
commit
c965d45259
21
gui.js
21
gui.js
|
@ -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) {
|
||||
|
|
Ładowanie…
Reference in New Issue