diff --git a/dist/entry.js b/dist/entry.js index 16f89640db..5a8fdd7159 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -356,7 +356,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(); }; @@ -667,7 +667,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(); }; @@ -763,7 +763,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"); @@ -1628,7 +1628,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); @@ -1652,7 +1652,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; } @@ -2795,7 +2795,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() { @@ -2821,7 +2821,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(); }; @@ -3020,7 +3020,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(); }; @@ -3069,7 +3069,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() { @@ -3283,13 +3283,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() { @@ -3771,7 +3771,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() { @@ -3863,8 +3863,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(); }; @@ -4060,7 +4060,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) { @@ -8179,7 +8179,7 @@ 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(); }; @@ -8187,7 +8187,7 @@ Entry.EntryObject.prototype.generateView = function() { 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(); }; @@ -8195,7 +8195,7 @@ Entry.EntryObject.prototype.generateView = function() { 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(); }; @@ -8239,7 +8239,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(); }; @@ -8249,7 +8249,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(); }; @@ -8321,24 +8321,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(); @@ -10273,7 +10273,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": @@ -10969,7 +10969,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)); @@ -11033,7 +11033,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()); @@ -11048,7 +11048,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; @@ -11995,7 +11995,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; @@ -12061,7 +12061,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); @@ -12226,7 +12226,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() { @@ -12315,7 +12315,7 @@ Entry.Utils.xmlToJsonData = function(b) { var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; for (c in d) { var f = d[c]; - f.tagName && e.blocks.push(f.getAttribute("type")); + f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); } a.push(e); } @@ -12582,7 +12582,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.General.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.General.param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12958,7 +12958,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; } } @@ -13024,7 +13024,7 @@ Entry.Variable = function(b) { this.isCloud_ = b.isCloud || !1; var a = Entry.parseNumber(b.value); this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; - "slide" == this.type && (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)); + "slide" == this.type && (this.minValue_ = Number(b.minValue ? b.minValue : 0), this.maxValue_ = Number(b.maxValue ? b.maxValue : 100)); b.isClone || (this.visible_ = b.visible || "boolean" == typeof b.visible ? b.visible : !0, this.x_ = b.x ? b.x : null, this.y_ = b.y ? b.y : null, "list" == this.type && (this.width_ = b.width ? b.width : 100, this.height_ = b.height ? b.height : 120, this.array_ = b.array ? b.array : [], this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13193,13 +13193,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, this.isFloatPoint() ? delete this.viewValue_ : this.viewValue_ = this.value_); + "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b, this.isFloatPoint() ? delete this.viewValue_ : this.viewValue_ = this.value_); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this.updateView(); }; @@ -13300,7 +13300,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() || (this.viewValue_ = b, b = Math.round(b)); this.setValue(b); @@ -14487,7 +14487,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; @@ -15255,7 +15255,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--) { @@ -15589,7 +15589,7 @@ Entry.BlockView.DRAG_RADIUS = 5; 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 { @@ -16337,10 +16337,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)]; @@ -16349,7 +16349,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)]); @@ -19016,7 +19016,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) { @@ -20055,7 +20055,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; @@ -20078,7 +20078,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); } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index d4827fcf28..309455fff8 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1149,7 +1149,7 @@ Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animatio Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", {result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33}).elem("g"),d=c.elem("rect",{x:0,y:0,width:125,height:33}),e=Entry.mediaFilePath+"block_pattern_(order).png",f=1;5>f;f++)c.elem("image",{class:"pattern"+f,href:e.replace("(order)",f),x:0,y:0,width:125,height:33});return d};Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4}; -Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&e.blocks.push(f.getAttribute("type"))}a.push(e)}}return a}; +Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; Entry.Utils.stopProjectWithToast=function(b,a){a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(Entry.container.selectObject(b.getCode().object.id),b.view.getBoard().activateBlock(b));throw Error(a);};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; (function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= diff --git a/src/util/utils.js b/src/util/utils.js index 2aa8cd070f..a963ff3591 100644 --- a/src/util/utils.js +++ b/src/util/utils.js @@ -1122,9 +1122,11 @@ Entry.Utils.xmlToJsonData = function(xml) { var blocks = category.childNodes; for (var i in blocks) { var block = blocks[i]; - if (!block.tagName) - continue; - data.blocks.push(block.getAttribute("type")); + if (!block.tagName) continue; + + var type = block.getAttribute('type') + if (!type) continue; + data.blocks.push(type); } result.push(data); } diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 13c1a639f9..2b2665853c 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -9886,10 +9886,7 @@ Entry.block = { "type": "number", "params": [ "2" ] }, - { - "type": "number", - "params": [ "2" ] - }, + null, null ], "type": "rotate_by_angle_time"