kopia lustrzana https://github.com/backface/turtlestitch
fixed StopOthers blocks and added another option
also updated the German translationpull/3/merge
rodzic
1da3ae32aa
commit
1e959b8891
13
blocks.js
13
blocks.js
|
@ -1037,6 +1037,19 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
|
|||
);
|
||||
part.setContents(['encode URI']);
|
||||
break;
|
||||
case '%stopOthersChoices':
|
||||
part = new InputSlotMorph(
|
||||
null,
|
||||
false,
|
||||
{
|
||||
'all but this script' : ['all but this script'],
|
||||
'other scripts in sprite' : ['other scripts in sprite']
|
||||
},
|
||||
true
|
||||
);
|
||||
part.setContents(['all but this script']);
|
||||
part.isStatic = true;
|
||||
break;
|
||||
case '%typ':
|
||||
part = new InputSlotMorph(
|
||||
null,
|
||||
|
|
|
@ -185,7 +185,7 @@ SnapTranslator.dict.de = {
|
|||
'translator_e-mail':
|
||||
'jens@moenig.org', // optional
|
||||
'last_changed':
|
||||
'2013-10-04', // this, too, will appear in the Translators tab
|
||||
'2018-01-08', // this, too, will appear in the Translators tab
|
||||
|
||||
// GUI
|
||||
// control bar:
|
||||
|
@ -453,6 +453,12 @@ SnapTranslator.dict.de = {
|
|||
'stoppe dieses Skript',
|
||||
'stop all %stop':
|
||||
'stoppe alles %stop',
|
||||
'stop %stopOthersChoices':
|
||||
'stoppe %stopOthersChoices',
|
||||
'all but this script':
|
||||
'alles au\u00dfer diesem Skript',
|
||||
'other scripts in sprite':
|
||||
'andere Skripte in diesem Objekt',
|
||||
'pause all %pause':
|
||||
'pausiere alles %pause',
|
||||
'run %cmdRing %inputs':
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
/*global modules, contains*/
|
||||
|
||||
modules.locale = '2013-December-04';
|
||||
modules.locale = '2014-January-08';
|
||||
|
||||
// Global stuff
|
||||
|
||||
|
@ -149,7 +149,7 @@ SnapTranslator.dict.de = {
|
|||
'translator_e-mail':
|
||||
'jens@moenig.org',
|
||||
'last_changed':
|
||||
'2013-10-04'
|
||||
'2014-01-08'
|
||||
};
|
||||
|
||||
SnapTranslator.dict.it = {
|
||||
|
|
|
@ -594,7 +594,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
doStopOthers: {
|
||||
type: 'command',
|
||||
category: 'control',
|
||||
spec: 'stop other scripts in sprite'
|
||||
spec: 'stop %stopOthersChoices'
|
||||
},
|
||||
doRun: {
|
||||
type: 'command',
|
||||
|
@ -4361,6 +4361,7 @@ StageMorph.prototype.blockTemplates = function (category) {
|
|||
blocks.push(block('doStopBlock'));
|
||||
blocks.push(block('doStop'));
|
||||
blocks.push(block('doStopAll'));
|
||||
blocks.push(block('doStopOthers'));
|
||||
blocks.push('-');
|
||||
blocks.push(block('doRun'));
|
||||
blocks.push(block('fork'));
|
||||
|
|
44
threads.js
44
threads.js
|
@ -151,26 +151,19 @@ ThreadManager.prototype.startProcess = function (block, isThreadSafe) {
|
|||
return newProc;
|
||||
};
|
||||
|
||||
ThreadManager.prototype.stopAll = function () {
|
||||
ThreadManager.prototype.stopAll = function (excpt) {
|
||||
// excpt is optional
|
||||
this.processes.forEach(function (proc) {
|
||||
proc.stop();
|
||||
});
|
||||
};
|
||||
|
||||
ThreadManager.prototype.stopAllForReceiver = function (rcvr) {
|
||||
this.processes.forEach(function (proc) {
|
||||
if (proc.homeContext.receiver === rcvr) {
|
||||
if (proc !== excpt) {
|
||||
proc.stop();
|
||||
if (rcvr.isClone) {
|
||||
proc.isDead = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ThreadManager.prototype.stopAllForReceiverExcept = function (rcvr, excpt) {
|
||||
ThreadManager.prototype.stopAllForReceiver = function (rcvr, excpt) {
|
||||
// excpt is optional
|
||||
this.processes.forEach(function (proc) {
|
||||
if (proc.homeContext.receiver === rcvr && proc != excpt) {
|
||||
if (proc.homeContext.receiver === rcvr && proc !== excpt) {
|
||||
proc.stop();
|
||||
if (rcvr.isClone) {
|
||||
proc.isDead = true;
|
||||
|
@ -1379,12 +1372,25 @@ Process.prototype.doStopAll = function () {
|
|||
}
|
||||
};
|
||||
|
||||
Process.prototype.doStopOthers = function () {
|
||||
var stage, ide;
|
||||
Process.prototype.doStopOthers = function (choice) {
|
||||
var stage;
|
||||
if (this.homeContext.receiver) {
|
||||
stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
||||
if (stage) {
|
||||
stage.threads.stopAllForReceiverExcept(this.homeContext.receiver, this);
|
||||
|
||||
switch (this.inputOption(choice)) {
|
||||
case 'all but this script':
|
||||
stage.threads.stopAll(this);
|
||||
break;
|
||||
case 'other scripts in sprite':
|
||||
stage.threads.stopAllForReceiver(
|
||||
this.homeContext.receiver,
|
||||
this
|
||||
);
|
||||
break;
|
||||
default:
|
||||
nop();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1751,8 +1757,10 @@ Process.prototype.reportURL = function (url) {
|
|||
if (!this.httpRequest) {
|
||||
this.httpRequest = new XMLHttpRequest();
|
||||
this.httpRequest.open("GET", 'http://' + url, true);
|
||||
this.httpRequest.setRequestHeader("X-Requested-With",
|
||||
"XMLHttpRequest");
|
||||
this.httpRequest.setRequestHeader(
|
||||
"X-Requested-With",
|
||||
"XMLHttpRequest"
|
||||
);
|
||||
this.httpRequest.setRequestHeader("X-Application", "Snap! 4.0");
|
||||
this.httpRequest.send(null);
|
||||
} else if (this.httpRequest.readyState === 4) {
|
||||
|
|
Ładowanie…
Reference in New Issue