kopia lustrzana https://github.com/backface/turtlestitch
motd support
On startup Snap! looks for http://snap.berkeley.edu/motd.txt, if it exists it is shown in a dialog boxpull/3/merge
rodzic
3f19a21cad
commit
a67b2e2381
23
gui.js
23
gui.js
|
@ -149,7 +149,7 @@ IDE_Morph.prototype.init = function (isAutoFill) {
|
||||||
};
|
};
|
||||||
|
|
||||||
IDE_Morph.prototype.openIn = function (world) {
|
IDE_Morph.prototype.openIn = function (world) {
|
||||||
var hash, usr;
|
var hash, usr, motd;
|
||||||
|
|
||||||
this.buildPanes();
|
this.buildPanes();
|
||||||
world.add(this);
|
world.add(this);
|
||||||
|
@ -191,13 +191,22 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
this.reactToWorldResize(world.bounds);
|
this.reactToWorldResize(world.bounds);
|
||||||
|
|
||||||
function getURL(url) {
|
function getURL(url) {
|
||||||
var request = new XMLHttpRequest();
|
try {
|
||||||
request.open('GET', url, false);
|
var request = new XMLHttpRequest();
|
||||||
request.send();
|
request.open('GET', url, false);
|
||||||
if (request.status === 200) {
|
request.send();
|
||||||
return request.responseText;
|
if (request.status === 200) {
|
||||||
|
return request.responseText;
|
||||||
|
}
|
||||||
|
throw new Error('unable to retrieve ' + url);
|
||||||
|
} catch (err) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
throw new Error('unable to retrieve ' + url);
|
}
|
||||||
|
|
||||||
|
motd = getURL('http://snap.berkeley.edu/motd.txt');
|
||||||
|
if (motd) {
|
||||||
|
this.inform('Snap!', motd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location.hash.substr(0, 6) === '#open:') {
|
if (location.hash.substr(0, 6) === '#open:') {
|
||||||
|
|
|
@ -1535,4 +1535,5 @@ ______
|
||||||
------
|
------
|
||||||
* Blocks: SyntaxElementMorph fixLayout() optimization for active highlights
|
* Blocks: SyntaxElementMorph fixLayout() optimization for active highlights
|
||||||
* Russian translation!! Yay, thanks, Svetlana Ptashnaya!!
|
* Russian translation!! Yay, thanks, Svetlana Ptashnaya!!
|
||||||
* Store, GUI, Blocks: Scaling support for Comments and serialization/deserialization
|
* Store, GUI, Blocks: Scaling support for Comments and serialization/deserialization
|
||||||
|
* GUI: motd support: On startup Snap! looks for http://snap.berkeley.edu/motd.txt, if it exists it is shown in a dialog box
|
Ładowanie…
Reference in New Issue