Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Aug 22, 2016
2 parents 536c594 + 92e2d1f commit 74e68ed
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 49 deletions.
97 changes: 50 additions & 47 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.albert_set_eye_to = function(b, a) {
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a);
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a));
"LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e);
return a.callReturn();
};
Expand Down Expand Up @@ -678,7 +678,7 @@ Blockly.Blocks.albert_set_led_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.albert_set_led_to = function(b, a) {
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a);
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a));
"FRONT" == d ? (c.leftEye = e, c.rightEye = e) : "LEFT" == d ? c.leftEye = e : c.rightEye = e;
return a.callReturn();
};
Expand Down Expand Up @@ -804,7 +804,7 @@ Entry.block.arduino_get_number = function(b, a) {
d.open("POST", "http://localhost:23518/arduino/", !1);
d.send(String(c));
Entry.assert(200 == d.status, "arduino is not connected");
return +d.responseText;
return Number(d.responseText);
};
Blockly.Blocks.arduino_get_number = {init:function() {
this.setColour("#00979D");
Expand Down Expand Up @@ -1669,7 +1669,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() {
this.setInputsInline(!0);
}};
Entry.block.coordinate_mouse = function(b, a) {
return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y;
return "x" === a.getField("VALUE", a) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y);
};
Blockly.Blocks.coordinate_object = {init:function() {
this.setColour(calcBlockColor);
Expand All @@ -1693,7 +1693,7 @@ Entry.block.coordinate_object = function(b, a) {
var d = c.parent, d = d.pictures;
return d.indexOf(c.picture) + 1;
case "size":
return +c.getSize().toFixed(1);
return Number(c.getSize().toFixed(1));
case "picture_name":
return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name;
}
Expand Down Expand Up @@ -2836,7 +2836,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_following_speed_to = function(b, a) {
Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a);
Entry.hw.sendQueue.lineTracerSpeed = Number(a.getField("SPEED", a));
return a.callReturn();
};
Blockly.Blocks.hamster_stop = {init:function() {
Expand All @@ -2862,7 +2862,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_led_to = function(b, a) {
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a);
var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a));
"LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e);
return a.callReturn();
};
Expand Down Expand Up @@ -3061,7 +3061,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() {
this.setNextStatement(!0);
}};
Entry.block.hamster_set_port_to = function(b, a) {
var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = +a.getField("MODE", a);
var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = Number(a.getField("MODE", a));
"A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e);
return a.callReturn();
};
Expand Down Expand Up @@ -3110,7 +3110,7 @@ Blockly.Blocks.is_press_some_key = {init:function() {
this.setInputsInline(!0);
}};
Entry.block.is_press_some_key = function(b, a) {
var c = +a.getField("VALUE", a);
var c = Number(a.getField("VALUE", a));
return 0 <= Entry.pressedKeys.indexOf(c);
};
Blockly.Blocks.reach_something = {init:function() {
Expand Down Expand Up @@ -3324,13 +3324,13 @@ Entry.block.boolean_basic_operator = function(b, a) {
case "EQUAL":
return d == e;
case "GREATER":
return +d > +e;
return Number(d) > Number(e);
case "LESS":
return +d < +e;
return Number(d) < Number(e);
case "GREATER_OR_EQUAL":
return +d >= +e;
return Number(d) >= Number(e);
case "LESS_OR_EQUAL":
return +d <= +e;
return Number(d) <= Number(e);
}
};
Blockly.Blocks.show = {init:function() {
Expand Down Expand Up @@ -3812,7 +3812,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() {
}};
Entry.block.rotate_by_angle_dropdown = function(b, a) {
var c = a.getField("VALUE", a);
b.setRotation(b.getRotation() + +c);
b.setRotation(b.getRotation() + Number(c));
return a.callReturn();
};
Blockly.Blocks.see_angle = {init:function() {
Expand Down Expand Up @@ -3904,8 +3904,8 @@ Blockly.Blocks.locate = {init:function() {
Entry.block.locate = function(b, a) {
var c = a.getField("VALUE", a), d;
"mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY());
b.setX(+c);
b.setY(+d);
b.setX(Number(c));
b.setY(Number(d));
b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d);
return a.callReturn();
};
Expand Down Expand Up @@ -4101,7 +4101,7 @@ Entry.block.locate_object_time = function(b, a) {
if (0 != c) {
"mouse" == d ? (d = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = c, a.dX = d / a.frameCount, a.dY = e / a.frameCount;
} else {
return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn();
return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn();
}
}
if (0 != a.frameCount) {
Expand Down Expand Up @@ -8263,23 +8263,23 @@ Entry.EntryObject.prototype.generateView = function() {
13 == a.keyCode && c.editObjectValues(!1);
};
g.onblur = function(a) {
isNaN(g.value) || c.entity.setX(+g.value);
isNaN(g.value) || c.entity.setX(Number(g.value));
c.updateCoordinateView();
Entry.stage.updateObject();
};
k.onkeypress = function(a) {
13 == a.keyCode && c.editObjectValues(!1);
};
k.onblur = function(a) {
isNaN(k.value) || c.entity.setY(+k.value);
isNaN(k.value) || c.entity.setY(Number(k.value));
c.updateCoordinateView();
Entry.stage.updateObject();
};
n.onkeypress = function(a) {
13 == a.keyCode && c.editObjectValues(!1);
};
n.onblur = function(a) {
isNaN(n.value) || c.entity.setSize(+n.value);
isNaN(n.value) || c.entity.setSize(Number(n.value));
c.updateCoordinateView();
Entry.stage.updateObject();
};
Expand Down Expand Up @@ -8323,7 +8323,7 @@ Entry.EntryObject.prototype.generateView = function() {
m.onblur = function(a) {
a = m.value;
-1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da")));
isNaN(a) || c.entity.setRotation(+a);
isNaN(a) || c.entity.setRotation(Number(a));
c.updateRotationView();
Entry.stage.updateObject();
};
Expand All @@ -8333,7 +8333,7 @@ Entry.EntryObject.prototype.generateView = function() {
q.onblur = function(a) {
a = q.value;
-1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da")));
isNaN(a) || c.entity.setDirection(+a);
isNaN(a) || c.entity.setDirection(Number(a));
c.updateRotationView();
Entry.stage.updateObject();
};
Expand Down Expand Up @@ -8405,24 +8405,24 @@ Entry.EntryObject.prototype.generateView = function() {
}
}), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"),
m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) {
13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), m.blur());
13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur());
}, m.onblur = function(a) {
c.entity.setRotation(c.entity.getRotation());
Entry.stage.updateObject();
}, q.onkeypress = function(a) {
13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), q.blur());
13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur());
}, q.onblur = function(a) {
c.entity.setDirection(c.entity.getDirection());
Entry.stage.updateObject();
}, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"),
h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n),
d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) {
13 == a.keyCode && (isNaN(g.value) || c.entity.setX(+g.value), c.updateCoordinateView(), c.blur());
13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur());
}, g.onblur = function(a) {
c.entity.setX(c.entity.getX());
Entry.stage.updateObject();
}, k.onkeypress = function(a) {
13 == a.keyCode && (isNaN(k.value) || c.entity.setY(+k.value), c.updateCoordinateView(), c.blur());
13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur());
}, k.onblur = function(a) {
c.entity.setY(c.entity.getY());
Entry.stage.updateObject();
Expand Down Expand Up @@ -10388,7 +10388,7 @@ Entry.Parser = function(b, a, c) {
this.codeMirror = c;
this._lang = a || "js";
this.availableCode = [];
"maze" === b && (this._stageId = +Ntry.configManager.getConfig("stageId"), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code));
"maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code));
this.mappingSyntax(b);
switch(this._lang) {
case "js":
Expand Down Expand Up @@ -10720,6 +10720,9 @@ Entry.init = function(b, a) {
Entry.addEventListener("saveWorkspace", function(a) {
Entry.addActivity("save");
});
Entry.addEventListener("showBlockHelper", function(a) {
Entry.propertyPanel.select("helper");
});
"IE" != Entry.getBrowserType().substr(0, 2) || window.flashaudio ? createjs.Sound.registerPlugins([createjs.WebAudioPlugin]) : (createjs.FlashAudioPlugin.swfPath = this.mediaFilePath + "media/", createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]), window.flashaudio = !0);
Entry.soundQueue = new createjs.LoadQueue;
Entry.soundQueue.installPlugin(createjs.Sound);
Expand Down Expand Up @@ -11106,7 +11109,7 @@ p = Entry.Script.prototype;
p.init = function(b, a, c) {
Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName);
this.type = b.getAttribute("type");
this.id = +b.getAttribute("id");
this.id = Number(b.getAttribute("id"));
b.getElementsByTagName("mutation").length && b.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = b.childNodes[0].getAttribute("hashid"));
"REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0);
a instanceof Entry.Script && (this.previousScript = a, a.parentScript && (this.parentScript = a.parentScript));
Expand Down Expand Up @@ -11170,7 +11173,7 @@ p.getValue = function(b) {
return this.values[b].run();
};
p.getNumberValue = function(b) {
return +this.values[b].run();
return Number(this.values[b].run());
};
p.getStringValue = function(b) {
return String(this.values[b].run());
Expand All @@ -11185,7 +11188,7 @@ p.getStringField = function(b) {
return String(this.fields[b]);
};
p.getNumberField = function(b) {
return +this.fields[b];
return Number(this.fields[b]);
};
p.callReturn = function() {
return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null;
Expand Down Expand Up @@ -11789,7 +11792,7 @@ Entry.getElementsByClassName = function(b) {
return a;
};
Entry.parseNumber = function(b) {
return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b;
return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b);
};
Entry.countStringLength = function(b) {
var a, c = 0;
Expand Down Expand Up @@ -11855,7 +11858,7 @@ Entry.computeInputWidth = function(b) {
document.body.appendChild(a);
b = a.offsetWidth;
document.body.removeChild(a);
return +(b + 10) + "px";
return Number(b + 10) + "px";
};
Entry.isArrowOrBackspace = function(b) {
return -1 < [37, 38, 39, 40, 8].indexOf(b);
Expand Down Expand Up @@ -12020,7 +12023,7 @@ Entry.getMaxFloatPoint = function(b) {
return Math.min(a, 20);
};
Entry.convertToRoundedDecimals = function(b, a) {
return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a);
return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a);
};
Entry.attachEventListener = function(b, a, c) {
setTimeout(function() {
Expand Down Expand Up @@ -12438,7 +12441,7 @@ Entry.Func.generateBlock = function(b) {
var a = {template:b.template, params:b.params}, c = /(%\d)/mi, d = b.template.split(c), e = "", f = 0, g = 0, h;
for (h in d) {
var k = d[h];
c.test(k) ? (k = +k.split("%")[1] - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.template.function_param_string + (g ? g : ""), g++))) : e += k;
c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.template.function_param_string + (g ? g : ""), g++))) : e += k;
}
return {block:a, description:e};
};
Expand Down Expand Up @@ -12831,7 +12834,7 @@ p.removePortReadable = function(b) {
var a, c;
for (c in this.sendQueue.readablePorts) {
if (this.sendQueue.readablePorts[c] == b) {
a = +c;
a = Number(c);
break;
}
}
Expand Down Expand Up @@ -13467,13 +13470,13 @@ Entry.Variable.prototype.getId = function() {
return this.id_;
};
Entry.Variable.prototype.getValue = function() {
return this.isNumber() ? +this.value_ : this.value_;
return this.isNumber() ? Number(this.value_) : this.value_;
};
Entry.Variable.prototype.isNumber = function() {
return isNaN(this.value_) ? !1 : !0;
};
Entry.Variable.prototype.setValue = function(b) {
"slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b);
"slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b);
this.isCloud_ && Entry.variableContainer.updateCloudVariables();
this._valueWidth = null;
this.updateView();
Expand Down Expand Up @@ -13577,7 +13580,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() {
var b = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth;
0 > b && (b = 0);
1 < b && (b = 1);
var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Math.abs(c - a) * b).toFixed(2), b = parseFloat(b);
var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b);
b < a ? b = this.minValue_ : b > c && (b = this.maxValue_);
this.isFloatPoint() || (b = Math.round(b));
this.setValue(b);
Expand Down Expand Up @@ -14780,7 +14783,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) {
c.removeClass("entryRemove");
};
Entry.VariableContainer.prototype.setListLength = function(b) {
b = +b;
b = Number(b);
var a = this.selectedList.array_;
if (!isNaN(b)) {
var c = a.length;
Expand Down Expand Up @@ -15573,7 +15576,7 @@ Entry.BlockMenu = function(b, a, c, d) {
if (isNaN(a)) {
return a;
}
a = +a;
a = Number(a);
for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) {
var f = b[e];
if (!d[f].hasClass("entryRemove") && 0 === a--) {
Expand Down Expand Up @@ -15976,7 +15979,7 @@ Entry.BlockView.pngMap = {};
var h = e[g].trim();
if (0 !== h.length) {
if (d.test(h)) {
var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g);
var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g);
this._contents.push(h);
this._paramMap[k] = h;
} else {
Expand Down Expand Up @@ -16839,10 +16842,10 @@ Entry.Scope = function(b, a) {
return String(this.getValue(a, b));
};
b.getNumberValue = function(a, b) {
return +this.getValue(a);
return Number(this.getValue(a));
};
b.getBooleanValue = function(a, b) {
return +this.getValue(a, b) ? !0 : !1;
return Number(this.getValue(a, b)) ? !0 : !1;
};
b.getField = function(a, b) {
return this.block.params[this._getParamIndex(a)];
Expand All @@ -16851,7 +16854,7 @@ Entry.Scope = function(b, a) {
return String(this.getField(a));
};
b.getNumberField = function(a) {
return +this.getField(a);
return Number(this.getField(a));
};
b.getStatement = function(a, b) {
return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]);
Expand Down Expand Up @@ -19584,7 +19587,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2;
return this.mode;
};
b.setMode = function(a, b) {
a = +a;
a = Number(a);
var d = this.mode;
this.mode = a;
switch(a) {
Expand Down Expand Up @@ -20626,7 +20629,7 @@ Entry.Xml.getNumberValue = function(b, a, c) {
}
for (var d in c) {
if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) {
return +Entry.Xml.operate(b, c[d].children[0]);
return Number(Entry.Xml.operate(b, c[d].children[0]));
}
}
return null;
Expand All @@ -20649,7 +20652,7 @@ Entry.Xml.getNumberField = function(b, a) {
}
for (var d in c) {
if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) {
return +c[d].textContent;
return Number(c[d].textContent);
}
}
};
Expand Down
Loading

0 comments on commit 74e68ed

Please sign in to comment.