From 79e09ec640a431679c78554eeb88c1aeacb031e9 Mon Sep 17 00:00:00 2001 From: jykim Date: Wed, 12 Oct 2016 19:09:55 +0900 Subject: [PATCH 01/17] =?UTF-8?q?=ED=95=98=EB=93=9C=EC=9B=A8=EC=96=B4=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 7646 +++++++++++++++++----------------- dist/entry.min.js | 2658 ++++++------ example/example.html | 3 + src/hw.js | 270 +- src/workspace/block_entry.js | 2 +- 5 files changed, 5426 insertions(+), 5153 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index c1099ea5b3..f11775d0bb 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -33,9 +33,9 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }, setBlockByText:function(a, b) { a = []; b = jQuery.parseXML(b).getElementsByTagName("category"); - for (var d = 0;d < b.length;d++) { - for (var c = b[d], e = {category:c.getAttribute("id"), blocks:[]}, c = c.childNodes, f = 0;f < c.length;f++) { - var g = c[f]; + for (var c = 0;c < b.length;c++) { + for (var d = b[c], e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes, f = 0;f < d.length;f++) { + var g = d[f]; !g.tagName || "BLOCK" != g.tagName.toUpperCase() && "BTN" != g.tagName.toUpperCase() || e.blocks.push(g.getAttribute("type")); } a.push(e); @@ -70,21 +70,21 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: Entry.engine.speedPanelOn && Entry.engine.toggleSpeedPanel(); (b = a.canvasWidth) ? 325 > b ? b = 325 : 720 < b && (b = 720) : b = 400; a.canvasWidth = b; - var d = 9 * b / 16; + var c = 9 * b / 16; Entry.engine.view_.style.width = b + "px"; - Entry.engine.view_.style.height = d + "px"; + Entry.engine.view_.style.height = c + "px"; Entry.engine.view_.style.top = "40px"; Entry.stage.canvas.canvas.style.width = b + "px"; 400 <= b ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); Entry.playground.view_.style.left = b + .5 + "px"; Entry.propertyPanel.resize(b); - var c = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; - c && (Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.width = .7 * b + "px") : c.style.display = "none"); - if (c = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { - Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.left = .7 * b + "px", c.style.width = .3 * b + "px") : (c.style.left = "2px", c.style.top = d + 24 + "px", c.style.width = b - 4 + "px"); + var d = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; + d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * b + "px") : d.style.display = "none"); + if (d = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b - 4 + "px"); } - if (c = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { - Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.left = .7 * b + "px", c.style.width = .3 * b + "px") : (c.style.left = "2px", c.style.top = d + 24 + "px", c.style.width = b + "px"); + if (d = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b + "px"); } (b = a.menuWidth) ? 244 > b ? b = 244 : 400 < b && (b = 400) : b = 264; a.menuWidth = b; @@ -110,9 +110,9 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(a) { var b = Entry.playground.object; if (b) { - var d = a.target, c = 0 !== $(b.view_).find(d).length, d = d.tagName.toUpperCase(); + var c = a.target, d = 0 !== $(b.view_).find(c).length, c = c.tagName.toUpperCase(); a = a.type; - !b.isEditing || "INPUT" === d && c || "touchstart" === a || b.editObjectValues(!1); + !b.isEditing || "INPUT" === c && d || "touchstart" === a || b.editObjectValues(!1); } }, generateFunctionSchema:function(a) { a = "func_" + a; @@ -128,9 +128,9 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }}; window.Entry = Entry; Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() { - var a = Entry.Albert.PORT_MAP, b = Entry.hw.sendQueue, d; - for (d in a) { - b[d] = a[d]; + var a = Entry.Albert.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); a = Entry.Albert; @@ -154,44 +154,44 @@ rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{nam MINIMUM_WHEEL_SPEED:18, MINIMUM_WHEEL_SPEED_FINE:15, clear:function() { this.finalPositionCount = this.positionCount = this.directionFineCount = this.prevDirectionFine = this.prevDirection = 0; }, controlAngleFine:function(a, b) { - var d = Entry.hw.sendQueue; + var c = Entry.hw.sendQueue; a = this.validateRadian(b - a); b = Math.abs(a); if (b < this.ORIENTATION_TOLERANCE_FINE) { return !1; } - var c = 0 < a ? 1 : -1; - if (0 > c * this.prevDirectionFine && 5 < ++this.directionFineCount) { + var d = 0 < a ? 1 : -1; + if (0 > d * this.prevDirectionFine && 5 < ++this.directionFineCount) { return !1; } - this.prevDirectionFine = c; + this.prevDirectionFine = d; 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE_FINE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE_FINE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); a = parseInt(a); - d.leftWheel = -a; - d.rightWheel = a; + c.leftWheel = -a; + c.rightWheel = a; return !0; }, controlAngle:function(a, b) { - var d = Entry.hw.sendQueue; + var c = Entry.hw.sendQueue; a = this.validateRadian(b - a); b = Math.abs(a); if (b < this.ORIENTATION_TOLERANCE_ROUGH) { return !1; } - var c = 0 < a ? 1 : -1; - if (b < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && 0 > c * this.prevDirection) { + var d = 0 < a ? 1 : -1; + if (b < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && 0 > d * this.prevDirection) { return !1; } - this.prevDirection = c; + this.prevDirection = d; 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); a = parseInt(a); - d.leftWheel = -a; - d.rightWheel = a; + c.leftWheel = -a; + c.rightWheel = a; return !0; -}, controlPositionFine:function(a, b, d, c, e) { +}, controlPositionFine:function(a, b, c, d, e) { var f = Entry.hw.sendQueue; - d = this.validateRadian(Math.atan2(e - b, c - a) - d); - var g = Math.abs(d); - a = c - a; + c = this.validateRadian(Math.atan2(e - b, d - a) - c); + var g = Math.abs(c); + a = d - a; b = e - b; b = Math.sqrt(a * a + b * b); if (b < this.POSITION_TOLERANCE_FINE) { @@ -200,16 +200,16 @@ MINIMUM_WHEEL_SPEED:18, MINIMUM_WHEEL_SPEED_FINE:15, clear:function() { if (b < this.POSITION_TOLERANCE_FINE_LARGE && 5 < ++this.finalPositionCount) { return this.finalPositionCount = 0, !1; } - d = 0 < d ? Math.log(1 + g) * this.GAIN_POSITION_FINE : -Math.log(1 + g) * this.GAIN_POSITION_FINE; - d = parseInt(d); - f.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - d; - f.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + d; + c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION_FINE : -Math.log(1 + g) * this.GAIN_POSITION_FINE; + c = parseInt(c); + f.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - c; + f.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + c; return !0; -}, controlPosition:function(a, b, d, c, e) { +}, controlPosition:function(a, b, c, d, e) { var f = Entry.hw.sendQueue; - d = this.validateRadian(Math.atan2(e - b, c - a) - d); - var g = Math.abs(d); - a = c - a; + c = this.validateRadian(Math.atan2(e - b, d - a) - c); + var g = Math.abs(c); + a = d - a; b = e - b; b = Math.sqrt(a * a + b * b); if (b < this.POSITION_TOLERANCE_ROUGH) { @@ -222,7 +222,7 @@ MINIMUM_WHEEL_SPEED:18, MINIMUM_WHEEL_SPEED_FINE:15, clear:function() { } else { this.positionCount = 0; } - .01 > g ? (f.leftWheel = this.STRAIGHT_SPEED, f.rightWheel = this.STRAIGHT_SPEED) : (b = (this.MINIMUM_WHEEL_SPEED + .5 / g) * this.GAIN_BASE_SPEED, b > this.MAX_BASE_SPEED && (b = this.MAX_BASE_SPEED), d = 0 < d ? Math.log(1 + g) * this.GAIN_POSITION : -Math.log(1 + g) * this.GAIN_POSITION, b = parseInt(b), d = parseInt(d), f.leftWheel = b - d, f.rightWheel = b + d); + .01 > g ? (f.leftWheel = this.STRAIGHT_SPEED, f.rightWheel = this.STRAIGHT_SPEED) : (b = (this.MINIMUM_WHEEL_SPEED + .5 / g) * this.GAIN_BASE_SPEED, b > this.MAX_BASE_SPEED && (b = this.MAX_BASE_SPEED), c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION : -Math.log(1 + g) * this.GAIN_POSITION, b = parseInt(b), c = parseInt(c), f.leftWheel = b - c, f.rightWheel = b + c); return !0; }, validateRadian:function(a) { return a > this.PI ? a - this.PI2 : a < -this.PI ? a + this.PI2 : a; @@ -249,9 +249,9 @@ Blockly.Blocks.albert_is_oid_value = {init:function() { }}; Entry.block.albert_is_oid_value = function(a, b) { a = Entry.hw.portData; - var d = b.getField("OID", b); + var c = b.getField("OID", b); b = b.getNumberValue("VALUE"); - return "FRONT" == d ? a.frontOid == b : a.backOid == b; + return "FRONT" == c ? a.frontOid == b : a.backOid == b; }; Blockly.Blocks.albert_value = {init:function() { this.setColour("#00979D"); @@ -292,11 +292,11 @@ Entry.block.albert_move_forward_for_secs = function(a, b) { a.leftWheel = 30; a.rightWheel = 30; a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Albert.removeTimeout(d); + Entry.Albert.removeTimeout(c); }, a); - Entry.Albert.timeouts.push(d); + Entry.Albert.timeouts.push(c); return b; }; Blockly.Blocks.albert_move_backward_for_secs = {init:function() { @@ -326,11 +326,11 @@ Entry.block.albert_move_backward_for_secs = function(a, b) { a.leftWheel = -30; a.rightWheel = -30; a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Albert.removeTimeout(d); + Entry.Albert.removeTimeout(c); }, a); - Entry.Albert.timeouts.push(d); + Entry.Albert.timeouts.push(c); return b; }; Blockly.Blocks.albert_turn_for_secs = {init:function() { @@ -359,11 +359,11 @@ Entry.block.albert_turn_for_secs = function(a, b) { b.timeFlag = 1; "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Albert.removeTimeout(d); + Entry.Albert.removeTimeout(c); }, a); - Entry.Albert.timeouts.push(d); + Entry.Albert.timeouts.push(c); return b; }; Blockly.Blocks.albert_change_both_wheels_by = {init:function() { @@ -379,9 +379,9 @@ Blockly.Blocks.albert_change_both_wheels_by = {init:function() { }}; Entry.block.albert_change_both_wheels_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getNumberValue("LEFT"), c = b.getNumberValue("RIGHT"); - a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d; - a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + c : c; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; return b.callReturn(); }; Blockly.Blocks.albert_set_both_wheels_to = {init:function() { @@ -412,8 +412,8 @@ Blockly.Blocks.albert_change_wheel_by = {init:function() { }}; Entry.block.albert_change_wheel_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION"), c = b.getNumberValue("VALUE"); - "LEFT" == d ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c : ("RIGHT" != d && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + c : c); + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); return b.callReturn(); }; Blockly.Blocks.albert_set_wheel_to = {init:function() { @@ -427,8 +427,8 @@ Blockly.Blocks.albert_set_wheel_to = {init:function() { }}; Entry.block.albert_set_wheel_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION"), c = b.getNumberValue("VALUE"); - "LEFT" == d ? a.leftWheel = c : ("RIGHT" != d && (a.leftWheel = c), a.rightWheel = c); + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); return b.callReturn(); }; Blockly.Blocks.albert_stop = {init:function() { @@ -473,31 +473,31 @@ Blockly.Blocks.albert_move_to_x_y_on_board = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_move_to_x_y_on_board = function(a, b) { - var d = Entry.hw.sendQueue, c = Entry.hw.portData; + var c = Entry.hw.sendQueue, d = Entry.hw.portData; a = Entry.Albert.controller; if (b.isStart) { if (b.isMoving) { - 0 <= c.positionX && (b.x = c.positionX); - 0 <= c.positionY && (b.y = c.positionY); - b.theta = c.orientation; + 0 <= d.positionX && (b.x = d.positionX); + 0 <= d.positionY && (b.y = d.positionY); + b.theta = d.orientation; switch(b.boardState) { case 1: if (0 == b.initialized) { if (0 > b.x || 0 > b.y) { - d.leftWheel = 20; - d.rightWheel = -20; + c.leftWheel = 20; + c.rightWheel = -20; break; } b.initialized = !0; } - d = a.toRadian(b.theta); - 0 == a.controlAngle(d, Math.atan2(b.targetY - b.y, b.targetX - b.x)) && (b.boardState = 2); + c = a.toRadian(b.theta); + 0 == a.controlAngle(c, Math.atan2(b.targetY - b.y, b.targetX - b.x)) && (b.boardState = 2); break; case 2: 0 == a.controlPosition(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (b.boardState = 3); break; case 3: - 0 == a.controlPositionFine(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (d.leftWheel = 0, d.rightWheel = 0, b.isMoving = !1); + 0 == a.controlPositionFine(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (c.leftWheel = 0, c.rightWheel = 0, b.isMoving = !1); } return b; } @@ -511,8 +511,8 @@ Entry.block.albert_move_to_x_y_on_board = function(a, b) { delete b.targetX; delete b.targetY; Entry.engine.isContinue = !1; - d.leftWheel = 0; - d.rightWheel = 0; + c.leftWheel = 0; + c.rightWheel = 0; return b.callReturn(); } b.isStart = !0; @@ -525,8 +525,8 @@ Entry.block.albert_move_to_x_y_on_board = function(a, b) { b.targetX = b.getNumberValue("X"); b.targetY = b.getNumberValue("Y"); a.clear(); - d.leftWheel = 0; - d.rightWheel = 0; + c.leftWheel = 0; + c.rightWheel = 0; return b; }; Blockly.Blocks.albert_set_orientation_on_board = {init:function() { @@ -540,17 +540,17 @@ Blockly.Blocks.albert_set_orientation_on_board = {init:function() { }}; Entry.block.albert_set_orientation_on_board = function(a, b) { a = Entry.hw.sendQueue; - var d = Entry.hw.portData, c = Entry.Albert.controller; + var c = Entry.hw.portData, d = Entry.Albert.controller; if (b.isStart) { if (b.isMoving) { - b.theta = d.orientation; + b.theta = c.orientation; switch(b.boardState) { case 1: - var d = c.toRadian(b.theta), e = c.toRadian(b.targetTheta); - 0 == c.controlAngle(d, e) && (b.boardState = 2); + var c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta); + 0 == d.controlAngle(c, e) && (b.boardState = 2); break; case 2: - d = c.toRadian(b.theta), e = c.toRadian(b.targetTheta), 0 == c.controlAngleFine(d, e) && (a.leftWheel = 0, a.rightWheel = 0, b.isMoving = !1); + c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta), 0 == d.controlAngleFine(c, e) && (a.leftWheel = 0, a.rightWheel = 0, b.isMoving = !1); } return b; } @@ -569,7 +569,7 @@ Entry.block.albert_set_orientation_on_board = function(a, b) { b.boardState = 1; b.theta = -200; b.targetTheta = b.getNumberValue("ORIENTATION"); - c.clear(); + d.clear(); a.leftWheel = 0; a.rightWheel = 0; return b; @@ -584,8 +584,8 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { }}; Entry.block.albert_set_eye_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION", b), c = Number(b.getField("COLOR", b)); - "LEFT" == d ? a.leftEye = c : ("RIGHT" != d && (a.leftEye = c), a.rightEye = c); + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftEye = d : ("RIGHT" != c && (a.leftEye = d), a.rightEye = d); return b.callReturn(); }; Blockly.Blocks.albert_clear_eye = {init:function() { @@ -597,8 +597,8 @@ Blockly.Blocks.albert_clear_eye = {init:function() { }}; Entry.block.albert_clear_eye = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION", b); - "LEFT" == d ? a.leftEye = 0 : ("RIGHT" != d && (a.leftEye = 0), a.rightEye = 0); + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftEye = 0 : ("RIGHT" != c && (a.leftEye = 0), a.rightEye = 0); return b.callReturn(); }; Blockly.Blocks.albert_body_led = {init:function() { @@ -648,11 +648,11 @@ Entry.block.albert_beep = function(a, b) { b.timeFlag = 1; a.buzzer = 440; a.note = 0; - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Albert.removeTimeout(d); + Entry.Albert.removeTimeout(c); }, 200); - Entry.Albert.timeouts.push(d); + Entry.Albert.timeouts.push(c); return b; }; Blockly.Blocks.albert_change_buzzer_by = {init:function() { @@ -666,8 +666,8 @@ Blockly.Blocks.albert_change_buzzer_by = {init:function() { }}; Entry.block.albert_change_buzzer_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getNumberValue("VALUE"); - a.buzzer = void 0 != a.buzzer ? a.buzzer + d : d; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; a.note = 0; return b.callReturn(); }; @@ -710,7 +710,7 @@ Blockly.Blocks.albert_play_note_for = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_play_note_for = function(a, b) { - var d = Entry.hw.sendQueue; + var c = Entry.hw.sendQueue; if (b.isStart) { if (1 == b.timeFlag) { return b; @@ -718,18 +718,18 @@ Entry.block.albert_play_note_for = function(a, b) { delete b.isStart; delete b.timeFlag; Entry.engine.isContinue = !1; - d.note = 0; + c.note = 0; return b.callReturn(); } a = b.getNumberField("NOTE", b); - var c = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Albert.tempo; + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Albert.tempo; b.isStart = !0; b.timeFlag = 1; - d.buzzer = 0; - d.note = a + 12 * (c - 1); + c.buzzer = 0; + c.note = a + 12 * (d - 1); if (100 < e) { var f = setTimeout(function() { - d.note = 0; + c.note = 0; Entry.Albert.removeTimeout(f); }, e - 100); Entry.Albert.timeouts.push(f); @@ -763,14 +763,14 @@ Entry.block.albert_rest_for = function(a, b) { } b.isStart = !0; b.timeFlag = 1; - var d = b.getNumberValue("VALUE"), d = 6E4 * d / Entry.Albert.tempo; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Albert.tempo; a.buzzer = 0; a.note = 0; - var c = setTimeout(function() { + var d = setTimeout(function() { b.timeFlag = 0; - Entry.Albert.removeTimeout(c); - }, d); - Entry.Albert.timeouts.push(c); + Entry.Albert.removeTimeout(d); + }, c); + Entry.Albert.timeouts.push(d); return b; }; Blockly.Blocks.albert_change_tempo_by = {init:function() { @@ -883,10 +883,10 @@ Blockly.Blocks.arduino_send = {init:function() { }}; Entry.block.arduino_send = function(a, b) { a = b.getValue("VALUE", b); - var d = new XMLHttpRequest; - d.open("POST", "http://localhost:23518/arduino/", !1); - d.send(String(a)); - Entry.assert(200 == d.status, "arduino is not connected"); + var c = new XMLHttpRequest; + c.open("POST", "http://localhost:23518/arduino/", !1); + c.send(String(a)); + Entry.assert(200 == c.status, "arduino is not connected"); return b.callReturn(); }; Blockly.Blocks.arduino_get_string = {init:function() { @@ -987,8 +987,8 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { }}; Entry.block.arduino_toggle_led = function(a, b) { a = b.getNumberValue("VALUE"); - var d = b.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(a, "on" == d ? 255 : 0); + var c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); return b.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { @@ -1005,8 +1005,8 @@ Blockly.Blocks.arduino_toggle_pwm = {init:function() { }}; Entry.block.arduino_toggle_pwm = function(a, b) { a = b.getNumberValue("PORT"); - var d = b.getNumberValue("VALUE"), d = Math.round(d), d = Math.max(d, 0), d = Math.min(d, 255); - Entry.hw.setDigitalPortValue(a, d); + var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 255); + Entry.hw.setDigitalPortValue(a, c); return b.callReturn(); }; Blockly.Blocks.arduino_convert_scale = {init:function() { @@ -1027,18 +1027,18 @@ Blockly.Blocks.arduino_convert_scale = {init:function() { this.setInputsInline(!0); }}; Entry.block.arduino_convert_scale = function(a, b) { - var d = b.getNumberValue("VALUE1", b), c = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + var c = b.getNumberValue("VALUE1", b), d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); a = b.getNumberValue("VALUE4", b); b = b.getNumberValue("VALUE5", b); - if (c > e) { - var f = c, c = e, e = f + if (d > e) { + var f = d, d = e, e = f } a > b && (f = a, a = b, b = f); - d = (b - a) / (e - c) * (d - c); - d += a; - d = Math.min(b, d); - d = Math.max(a, d); - return Math.round(d); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { this.setColour("#00979D"); @@ -1169,18 +1169,18 @@ Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { this.setInputsInline(!0); }}; Entry.block.CODEino_get_accelerometer_value = function(a, b) { - var d = Entry.hw.getAnalogPortValue(b.getField("PORT", b)), c = 265, e = 402; + var c = Entry.hw.getAnalogPortValue(b.getField("PORT", b)), d = 265, e = 402; a = -90; b = 90; - if (c > e) { - var f = c, c = e, e = f + if (d > e) { + var f = d, d = e, e = f } a > b && (f = a, a = b, b = f); - d = (b - a) / (e - c) * (d - c); - d += a; - d = Math.min(b, d); - d = Math.max(a, d); - return Math.round(d); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; Blockly.Blocks.dplay_select_led = {init:function() { this.setColour("#00979D"); @@ -1193,11 +1193,11 @@ Blockly.Blocks.dplay_select_led = {init:function() { this.setNextStatement(!0); }}; Entry.block.dplay_select_led = function(a, b) { - var d = b.getField("PORT"); + var c = b.getField("PORT"); a = 7; - "7" == d ? a = 7 : "8" == d ? a = 8 : "9" == d ? a = 9 : "10" == d && (a = 10); - d = b.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(a, "on" == d ? 255 : 0); + "7" == c ? a = 7 : "8" == c ? a = 8 : "9" == c ? a = 9 : "10" == c && (a = 10); + c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); return b.callReturn(); }; Blockly.Blocks.dplay_get_switch_status = {init:function() { @@ -1210,9 +1210,9 @@ Blockly.Blocks.dplay_get_switch_status = {init:function() { }}; Entry.block.dplay_get_switch_status = function(a, b) { a = b.getField("PORT"); - var d = 2; - "2" == a ? d = 2 : "4" == a && (d = 4); - return "OFF" == b.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(d) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(d) ? 1 : 0; + var c = 2; + "2" == a ? c = 2 : "4" == a && (c = 4); + return "OFF" == b.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(c) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(c) ? 1 : 0; }; Blockly.Blocks.dplay_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1257,12 +1257,12 @@ Blockly.Blocks.dplay_DCmotor = {init:function() { }}; Entry.block.dplay_DCmotor = function(a, b) { a = b.getField("PORT"); - var d = 0; - "3" == a ? d = 5 : "6" == a && (d = 11); - var c = b.getField("OPERATOR"), e = 0, f = 0; - "FRONT" == c ? (e = 255, f = 0) : "REAR" == c ? (e = 0, f = 255) : "OFF" == c && (f = e = 0); + var c = 0; + "3" == a ? c = 5 : "6" == a && (c = 11); + var d = b.getField("OPERATOR"), e = 0, f = 0; + "FRONT" == d ? (e = 255, f = 0) : "REAR" == d ? (e = 0, f = 255) : "OFF" == d && (f = e = 0); Entry.hw.setDigitalPortValue(a, e); - Entry.hw.setDigitalPortValue(d, f); + Entry.hw.setDigitalPortValue(c, f); return b.callReturn(); }; Blockly.Blocks.dplay_buzzer = {init:function() { @@ -1278,14 +1278,14 @@ Blockly.Blocks.dplay_buzzer = {init:function() { this.setNextStatement(!0); }}; Entry.block.dplay_buzzer = function(a, b) { - var d = b.getField("PORT"); + var c = b.getField("PORT"); a = 2; - "1" == d ? a = 2 : "2" == d ? a = 4 : "3" == d && (a = 7); - d = b.getNumberValue("VALUE"); - d = Math.round(d); - d = Math.max(d, 0); - d = Math.min(d, 100); - Entry.hw.setDigitalPortValue(a, d); + "1" == c ? a = 2 : "2" == c ? a = 4 : "3" == c && (a = 7); + c = b.getNumberValue("VALUE"); + c = Math.round(c); + c = Math.max(c, 0); + c = Math.min(c, 100); + Entry.hw.setDigitalPortValue(a, c); return b.callReturn(); }; Blockly.Blocks.dplay_servo = {init:function() { @@ -1307,27 +1307,27 @@ Entry.block.dplay_servo = function(a, b) { return b.callReturn(); }; Entry.Bitbrick = {SENSOR_MAP:{1:"light", 2:"IR", 3:"touch", 4:"potentiometer", 5:"MIC", 21:"UserSensor", 11:"UserInput", 20:"LED", 19:"SERVO", 18:"DC"}, PORT_MAP:{buzzer:2, 5:4, 6:6, 7:8, 8:10, LEDR:12, LEDG:14, LEDB:16}, sensorList:function() { - for (var a = [], b = Entry.hw.portData, d = 1;5 > d;d++) { - var c = b[d]; - c && (c.value || 0 === c.value) && a.push([d + " - " + Lang.Blocks["BITBRICK_" + c.type], d.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && (d.value || 0 === d.value) && a.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); } return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, touchList:function() { - for (var a = [], b = Entry.hw.portData, d = 1;5 > d;d++) { - var c = b[d]; - c && "touch" === c.type && a.push([d.toString(), d.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && "touch" === d.type && a.push([c.toString(), c.toString()]); } return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, servoList:function() { - for (var a = [], b = Entry.hw.portData, d = 5;9 > d;d++) { - var c = b[d]; - c && "SERVO" === c.type && a.push(["ABCD"[d - 5], d.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "SERVO" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, dcList:function() { - for (var a = [], b = Entry.hw.portData, d = 5;9 > d;d++) { - var c = b[d]; - c && "DC" === c.type && a.push(["ABCD"[d - 5], d.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "DC" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, setZero:function() { @@ -1385,10 +1385,10 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { }}; Entry.block.bitbrick_turn_on_color_led_by_rgb = function(a, b) { a = b.getNumberValue("rValue"); - var d = b.getNumberValue("gValue"), c = b.getNumberValue("bValue"), e = Entry.adjustValueWithMaxMin, f = Entry.hw.sendQueue; + var c = b.getNumberValue("gValue"), d = b.getNumberValue("bValue"), e = Entry.adjustValueWithMaxMin, f = Entry.hw.sendQueue; f.LEDR = e(a, 0, 255); - f.LEDG = e(d, 0, 255); - f.LEDB = e(c, 0, 255); + f.LEDG = e(c, 0, 255); + f.LEDB = e(d, 0, 255); return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { @@ -1416,11 +1416,11 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { }}; Entry.block.bitbrick_turn_on_color_led_by_value = function(a, b) { a = b.getNumberValue("VALUE"); - var d, c, e; + var c, d, e; a %= 200; - 67 > a ? (d = 200 - 3 * a, c = 3 * a, e = 0) : 134 > a ? (a -= 67, d = 0, c = 200 - 3 * a, e = 3 * a) : 201 > a && (a -= 134, d = 3 * a, c = 0, e = 200 - 3 * a); - Entry.hw.sendQueue.LEDR = d; - Entry.hw.sendQueue.LEDG = c; + 67 > a ? (c = 200 - 3 * a, d = 3 * a, e = 0) : 134 > a ? (a -= 67, c = 0, d = 200 - 3 * a, e = 3 * a) : 201 > a && (a -= 134, c = 3 * a, d = 0, e = 200 - 3 * a); + Entry.hw.sendQueue.LEDR = c; + Entry.hw.sendQueue.LEDG = d; Entry.hw.sendQueue.LEDB = e; return b.callReturn(); }; @@ -1450,13 +1450,13 @@ Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setNextStatement(!0); }}; Entry.block.bitbrick_turn_off_all_motors = function(a, b) { - var d = Entry.hw.sendQueue; + var c = Entry.hw.sendQueue; a = Entry.Bitbrick; a.servoList().map(function(b) { - d[b[1]] = 0; + c[b[1]] = 0; }); a.dcList().map(function(b) { - d[b[1]] = 128; + c[b[1]] = 128; }); return b.callReturn(); }; @@ -1487,8 +1487,8 @@ Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { }}; Entry.block.bitbrick_dc_direction_speed = function(a, b) { a = "CW" === b.getStringField("DIRECTION"); - var d = b.getNumberValue("VALUE"), d = Math.min(d, Entry.Bitbrick.dcMaxValue), d = Math.max(d, 0); - Entry.hw.sendQueue[b.getStringField("PORT")] = a ? d + 128 : 128 - d; + var c = b.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, 0); + Entry.hw.sendQueue[b.getStringField("PORT")] = a ? c + 128 : 128 - c; return b.callReturn(); }; Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { @@ -1524,7 +1524,7 @@ Blockly.Blocks.bitbrick_convert_scale = {init:function() { }}; Entry.block.bitbrick_convert_scale = function(a, b) { a = b.getNumberField("PORT"); - var d = Entry.hw.portData[a].value, c = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + var c = Entry.hw.portData[a].value, d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); a = b.getNumberValue("VALUE4", b); b = b.getNumberValue("VALUE5", b); if (a > b) { @@ -1532,11 +1532,11 @@ Entry.block.bitbrick_convert_scale = function(a, b) { a = b; b = f; } - d = (b - a) / (e - c) * (d - c); - d += a; - d = Math.min(b, d); - d = Math.max(a, d); - return Math.round(d); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; var categoryColor = "#FF9E20"; Blockly.Blocks.start_drawing = {init:function() { @@ -1573,9 +1573,9 @@ Blockly.Blocks.set_color = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_color = function(a, b) { - var d = b.getField("VALUE", b); + var c = b.getField("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (d = Entry.hex2rgb(d), a.brush.rgb = d, a.brush.endStroke(), a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + a.brush && (c = Entry.hex2rgb(c), a.brush.rgb = c, a.brush.endStroke(), a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.set_random_color = {init:function() { @@ -1588,10 +1588,10 @@ Blockly.Blocks.set_random_color = {init:function() { Entry.block.set_random_color = function(a, b) { a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); if (a.brush) { - var d = Entry.generateRgb(); - a.brush.rgb = d; + var c = Entry.generateRgb(); + a.brush.rgb = c; a.brush.endStroke(); - a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + a.brush.opacity / 100 + ")"); + a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"); a.brush.moveTo(a.getX(), -1 * a.getY()); } return b.callReturn(); @@ -1606,9 +1606,9 @@ Blockly.Blocks.change_thickness = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_thickness = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.thickness += d, 1 > a.brush.thickness && (a.brush.thickness = 1), a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + a.brush && (a.brush.thickness += c, 1 > a.brush.thickness && (a.brush.thickness = 1), a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.set_thickness = {init:function() { @@ -1621,9 +1621,9 @@ Blockly.Blocks.set_thickness = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_thickness = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.thickness = d, a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + a.brush && (a.brush.thickness = c, a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.change_opacity = {init:function() { @@ -1636,10 +1636,10 @@ Blockly.Blocks.change_opacity = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_opacity = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - d = Entry.adjustValueWithMaxMin(a.brush.opacity + d, 0, 100); - a.brush && (a.brush.opacity = d, a.brush.endStroke(), d = a.brush.rgb, a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + c = Entry.adjustValueWithMaxMin(a.brush.opacity + c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.set_opacity = {init:function() { @@ -1652,9 +1652,9 @@ Blockly.Blocks.set_opacity = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_opacity = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(d, 0, 100), a.brush.endStroke(), d = a.brush.rgb, a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.brush_erase_all = {init:function() { @@ -1665,11 +1665,11 @@ Blockly.Blocks.brush_erase_all = {init:function() { this.setNextStatement(!0); }}; Entry.block.brush_erase_all = function(a, b) { - var d = a.brush; - if (d) { - var c = d._stroke.style, e = d._strokeStyle.width; - d.clear().setStrokeStyle(e).beginStroke(c); - d.moveTo(a.getX(), -1 * a.getY()); + var c = a.brush; + if (c) { + var d = c._stroke.style, e = c._strokeStyle.width; + c.clear().setStrokeStyle(e).beginStroke(d); + c.moveTo(a.getX(), -1 * a.getY()); } a = a.parent.getStampEntities(); a.map(function(b) { @@ -1699,10 +1699,10 @@ Blockly.Blocks.change_brush_transparency = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_brush_transparency = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - d = Entry.adjustValueWithMaxMin(a.brush.opacity - d, 0, 100); - a.brush && (a.brush.opacity = d, a.brush.endStroke(), d = a.brush.rgb, a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + c = Entry.adjustValueWithMaxMin(a.brush.opacity - c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; Blockly.Blocks.set_brush_tranparency = {init:function() { @@ -1715,9 +1715,9 @@ Blockly.Blocks.set_brush_tranparency = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_brush_tranparency = function(a, b) { - var d = b.getNumberValue("VALUE", b); + var c = b.getNumberValue("VALUE", b); a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(d, 0, 100), a.brush.endStroke(), d = a.brush.rgb, a.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + (1 - a.brush.opacity / 100) + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - a.brush.opacity / 100) + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); return b.callReturn(); }; var calcArrowColor = "#e8b349", calcBlockColor = "#FFD974", calcFontColor = "#3D3D3D"; @@ -1807,8 +1807,8 @@ Blockly.Blocks.coordinate_object = {init:function() { this.setInputsInline(!0); }}; Entry.block.coordinate_object = function(a, b) { - var d = b.getField("VALUE", b); - a = "self" == d ? a : Entry.container.getEntity(d); + var c = b.getField("VALUE", b); + a = "self" == c ? a : Entry.container.getEntity(c); switch(b.getField("COORDINATE", b)) { case "x": return a.getX(); @@ -1836,9 +1836,9 @@ Blockly.Blocks.calc_basic = {init:function() { }}; Entry.block.calc_basic = function(a, b) { a = b.getField("OPERATOR", b); - var d = b.getNumberValue("LEFTHAND", b); + var c = b.getNumberValue("LEFTHAND", b); b = b.getNumberValue("RIGHTHAND", b); - return "PLUS" == a ? d + b : "MINUS" == a ? d - b : "MULTI" == a ? d * b : d / b; + return "PLUS" == a ? c + b : "MINUS" == a ? c - b : "MULTI" == a ? c * b : c / b; }; Blockly.Blocks.calc_plus = {init:function() { this.setColour(calcBlockColor); @@ -1986,9 +1986,9 @@ Blockly.Blocks.calc_rand = {init:function() { Entry.block.calc_rand = function(a, b) { a = b.getStringValue("LEFTHAND", b); b = b.getStringValue("RIGHTHAND", b); - var d = Math.min(a, b), c = Math.max(a, b); + var c = Math.min(a, b), d = Math.max(a, b); a = Entry.isFloat(a); - return Entry.isFloat(b) || a ? (Math.random() * (c - d) + d).toFixed(2) : Math.floor(Math.random() * (c - d + 1) + d); + return Entry.isFloat(b) || a ? (Math.random() * (d - c) + c).toFixed(2) : Math.floor(Math.random() * (d - c + 1) + c); }; Blockly.Blocks.get_date = {init:function() { this.setColour(calcBlockColor); @@ -2013,9 +2013,9 @@ Blockly.Blocks.get_sound_duration = {init:function() { Entry.block.get_sound_duration = function(a, b) { b = b.getField("VALUE", b); a = a.parent.sounds; - for (var d = 0;d < a.length;d++) { - if (a[d].id == b) { - return a[d].duration; + for (var c = 0;c < a.length;c++) { + if (a[c].id == b) { + return a[c].duration; } } }; @@ -2049,8 +2049,8 @@ Blockly.Blocks.set_visible_project_timer = {init:function() { }}; Entry.block.set_visible_project_timer = function(a, b) { a = b.getField("ACTION", b); - var d = Entry.engine.projectTimer; - "SHOW" == a ? d.setVisible(!0) : d.setVisible(!1); + var c = Entry.engine.projectTimer; + "SHOW" == a ? c.setVisible(!0) : c.setVisible(!1); return b.callReturn(); }; Blockly.Blocks.timer_variable = {init:function() { @@ -2118,13 +2118,13 @@ Blockly.Blocks.substring = {init:function() { }}; Entry.block.substring = function(a, b) { a = b.getStringValue("STRING", b); - var d = b.getNumberValue("START", b) - 1; + var c = b.getNumberValue("START", b) - 1; b = b.getNumberValue("END", b) - 1; - var c = a.length - 1; - if (0 > d || 0 > b || d > c || b > c) { + var d = a.length - 1; + if (0 > c || 0 > b || c > d || b > d) { throw Error(); } - return a.substring(Math.min(d, b), Math.max(d, b) + 1); + return a.substring(Math.min(c, b), Math.max(c, b) + 1); }; Blockly.Blocks.replace_string = {init:function() { this.setColour(calcBlockColor); @@ -2205,11 +2205,11 @@ Blockly.Blocks.quotient_and_mod = {init:function() { }}; Entry.block.quotient_and_mod = function(a, b) { a = b.getNumberValue("LEFTHAND", b); - var d = b.getNumberValue("RIGHTHAND", b); - if (isNaN(a) || isNaN(d)) { + var c = b.getNumberValue("RIGHTHAND", b); + if (isNaN(a) || isNaN(c)) { throw Error(); } - return "QUOTIENT" == b.getField("OPERATOR", b) ? Math.floor(a / d) : a % d; + return "QUOTIENT" == b.getField("OPERATOR", b) ? Math.floor(a / c) : a % c; }; Blockly.Blocks.choose_project_timer_action = {init:function() { this.setColour(calcBlockColor); @@ -2225,8 +2225,8 @@ Blockly.Blocks.choose_project_timer_action = {init:function() { }}; Entry.block.choose_project_timer_action = function(a, b) { a = b.getField("ACTION"); - var d = Entry.engine, c = d.projectTimer; - "START" == a ? c.isInit ? c.isInit && c.isPaused && (c.pauseStart && (c.pausedTime += (new Date).getTime() - c.pauseStart), delete c.pauseStart, c.isPaused = !1) : d.startProjectTimer() : "STOP" == a ? c.isInit && !c.isPaused && (c.isPaused = !0, c.pauseStart = (new Date).getTime()) : "RESET" == a && c.isInit && (c.setValue(0), c.start = (new Date).getTime(), c.pausedTime = 0, delete c.pauseStart); + var c = Entry.engine, d = c.projectTimer; + "START" == a ? d.isInit ? d.isInit && d.isPaused && (d.pauseStart && (d.pausedTime += (new Date).getTime() - d.pauseStart), delete d.pauseStart, d.isPaused = !1) : c.startProjectTimer() : "STOP" == a ? d.isInit && !d.isPaused && (d.isPaused = !0, d.pauseStart = (new Date).getTime()) : "RESET" == a && d.isInit && (d.setValue(0), d.start = (new Date).getTime(), d.pausedTime = 0, delete d.pauseStart); return b.callReturn(); }; Entry.Cobl = {name:"cobl", setZero:function() { @@ -2388,9 +2388,9 @@ Blockly.Blocks.cobl_led_control = {init:function() { }}; Entry.block.cobl_led_control = function(a, b) { a = b.getStringField("PORT"); - var d = b.getStringField("OPERATOR"); + var c = b.getStringField("OPERATOR"); Entry.hw.setDigitalPortValue("RainBowLED_IDX", a); - Entry.hw.setDigitalPortValue("RainBowLED_COL", d); + Entry.hw.setDigitalPortValue("RainBowLED_COL", c); return b.callReturn(); }; Blockly.Blocks.cobl_text = {init:function() { @@ -2416,9 +2416,9 @@ Blockly.Blocks.cobl_servo_angle_control = {init:function() { Entry.block.cobl_servo_angle_control = function(a, b) { console.log("servo - test"); a = b.getNumberValue("PORT"); - var d = b.getNumberValue("VALUE"), d = Math.round(d), d = Math.max(d, 15), d = Math.min(d, 165); - 1 == a && (console.log("servo 1 degree " + d), Entry.hw.setDigitalPortValue("Servo1", d)); - 2 == a && (console.log("servo 2 degree " + d), Entry.hw.setDigitalPortValue("Servo2", d)); + var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 15), c = Math.min(c, 165); + 1 == a && (console.log("servo 1 degree " + c), Entry.hw.setDigitalPortValue("Servo1", c)); + 2 == a && (console.log("servo 2 degree " + c), Entry.hw.setDigitalPortValue("Servo2", c)); return b.callReturn(); }; Blockly.Blocks.cobl_melody = {init:function() { @@ -2449,10 +2449,10 @@ Blockly.Blocks.cobl_dcmotor = {init:function() { }}; Entry.block.cobl_dcmotor = function(a, b) { a = b.getStringField("MOTOR"); - var d = b.getStringField("DIRECTION"), c = b.getStringField("SPEED"); - console.log("MOTOR" + a + " Direction" + d + " speed" + c); - 1 == a && (Entry.hw.setDigitalPortValue("DC1_DIR", d), Entry.hw.setDigitalPortValue("DC1_SPEED", c)); - 2 == a && (Entry.hw.setDigitalPortValue("DC2_DIR", d), Entry.hw.setDigitalPortValue("DC2_SPEED", c)); + var c = b.getStringField("DIRECTION"), d = b.getStringField("SPEED"); + console.log("MOTOR" + a + " Direction" + c + " speed" + d); + 1 == a && (Entry.hw.setDigitalPortValue("DC1_DIR", c), Entry.hw.setDigitalPortValue("DC1_SPEED", d)); + 2 == a && (Entry.hw.setDigitalPortValue("DC2_DIR", c), Entry.hw.setDigitalPortValue("DC2_SPEED", d)); return b.callReturn(); }; Blockly.Blocks.cobl_extention_port = {init:function() { @@ -2467,9 +2467,9 @@ Blockly.Blocks.cobl_extention_port = {init:function() { }}; Entry.block.cobl_extention_port = function(a, b) { a = b.getStringField("PORT"); - var d = b.getStringField("LEVEL"); - 1 == a && Entry.hw.setDigitalPortValue("EXUSB1", d); - 2 == a && Entry.hw.setDigitalPortValue("EXUSB2", d); + var c = b.getStringField("LEVEL"); + 1 == a && Entry.hw.setDigitalPortValue("EXUSB1", c); + 2 == a && Entry.hw.setDigitalPortValue("EXUSB2", c); return b.callReturn(); }; Blockly.Blocks.cobl_external_led = {init:function() { @@ -2489,10 +2489,10 @@ Blockly.Blocks.cobl_external_led = {init:function() { }}; Entry.block.cobl_external_led = function(a, b) { a = b.getNumberValue("LED"); - var d = b.getStringField("RED"), c = b.getStringField("GREEN"), e = b.getStringField("BLUE"); + var c = b.getStringField("RED"), d = b.getStringField("GREEN"), e = b.getStringField("BLUE"); Entry.hw.setDigitalPortValue("ELED_IDX", a); - Entry.hw.setDigitalPortValue("ELED_R", d); - Entry.hw.setDigitalPortValue("ELED_G", c); + Entry.hw.setDigitalPortValue("ELED_R", c); + Entry.hw.setDigitalPortValue("ELED_G", d); Entry.hw.setDigitalPortValue("ELED_B", e); return b.callReturn(); }; @@ -2546,9 +2546,9 @@ Blockly.Blocks.ev3_get_sensor_value = {init:function() { Entry.block.ev3_get_sensor_value = function(a, b) { b.getStringField("PORT", b); a = Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); - var d; - $.isPlainObject(a) && (d = a.siValue || 0); - return d; + var c; + $.isPlainObject(a) && (c = a.siValue || 0); + return c; }; Blockly.Blocks.ev3_touch_sensor = {init:function() { this.setColour("#00979D"); @@ -2573,29 +2573,29 @@ Entry.block.ev3_color_sensor = function(a, b) { b.getStringField("PORT", b); a = b.getStringField("RGB", b); b = Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); - var d = ""; + var c = ""; if (b.type == Entry.EV3.deviceTypes.Color) { if (0 == b.siValue) { - d = ""; + c = ""; } else { switch(a) { case "RGB": - d = Entry.EV3.colorSensorValue[b.siValue]; + c = Entry.EV3.colorSensorValue[b.siValue]; break; case "R": - d = Entry.EV3.colorSensorValue[b.siValue].substring(0, 2); + c = Entry.EV3.colorSensorValue[b.siValue].substring(0, 2); break; case "G": - d = Entry.EV3.colorSensorValue[b.siValue].substring(2, 4); + c = Entry.EV3.colorSensorValue[b.siValue].substring(2, 4); break; case "B": - d = Entry.EV3.colorSensorValue[b.siValue].substring(4, 6); + c = Entry.EV3.colorSensorValue[b.siValue].substring(4, 6); } } } else { - d = "\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8"; + c = "\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8"; } - return d; + return c; }; Blockly.Blocks.ev3_motor_power = {init:function() { this.setColour("#00979D"); @@ -2608,8 +2608,8 @@ Blockly.Blocks.ev3_motor_power = {init:function() { }}; Entry.block.ev3_motor_power = function(a, b) { a = b.getStringField("PORT", b); - var d = b.getValue("VALUE", b); - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:d}; + var c = b.getValue("VALUE", b); + Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:c}; return b.callReturn(); }; Blockly.Blocks.ev3_motor_power_on_time = {init:function() { @@ -2635,14 +2635,14 @@ Entry.block.ev3_motor_power_on_time = function(a, b) { Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:0}; return b.callReturn(); } - var d = b.getValue("TIME", b), c = b.getValue("VALUE", b); + var c = b.getValue("TIME", b), d = b.getValue("VALUE", b); b.isStart = !0; b.timeFlag = 1; - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:c}; + Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:d}; var e = setTimeout(function() { b.timeFlag = 0; Entry.EV3.removeTimeout(e); - }, 1E3 * d); + }, 1E3 * c); Entry.EV3.timeouts.push(e); return b; }; @@ -2657,10 +2657,10 @@ Blockly.Blocks.ev3_motor_degrees = {init:function() { }}; Entry.block.ev3_motor_degrees = function(a, b) { a = b.getStringField("PORT", b); - var d = b.getValue("DEGREE", b); - 0 >= d ? d = 0 : 720 <= d && (d = 720); - var c = b.getStringField("DIRECTION", b); - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Degrees, degree:d, power:"CW" == c ? 50 : -50}; + var c = b.getValue("DEGREE", b); + 0 >= c ? c = 0 : 720 <= c && (c = 720); + var d = b.getStringField("DIRECTION", b); + Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Degrees, degree:c, power:"CW" == d ? 50 : -50}; return b.callReturn(); }; Blockly.Blocks.wait_second = {init:function() { @@ -2792,9 +2792,9 @@ Blockly.Blocks.create_clone = {init:function() { this.setNextStatement(!0); }}; Entry.block.create_clone = function(a, b) { - var d = b.getField("VALUE", b); + var c = b.getField("VALUE", b); b = b.callReturn(); - "self" == d ? a.parent.addCloneEntity(a.parent, a, null) : Entry.container.getObject(d).addCloneEntity(a.parent, null, null); + "self" == c ? a.parent.addCloneEntity(a.parent, a, null) : Entry.container.getObject(c).addCloneEntity(a.parent, null, null); return b; }; Blockly.Blocks.delete_clone = {init:function() { @@ -2853,10 +2853,10 @@ Blockly.Blocks.stop_object = {init:function() { }}; Entry.block.stop_object = function(a, b) { b = b.getField("TARGET", b); - var d = Entry.container; + var c = Entry.container; switch(b) { case "all": - return d.clearRunningState(), this.die(); + return c.clearRunningState(), this.die(); case "thisOnly": return a.parent.script.clearExecutorsByEntity(a), this.die(); case "thisThread": @@ -2932,7 +2932,7 @@ Blockly.Blocks.function_param_string = {init:function() { a.setAttribute("hashid", this.hashId); return a; }}; -Entry.block.function_param_string = function(a, b, d) { +Entry.block.function_param_string = function(a, b, c) { return b.register[b.hashId].run(); }; Entry.block.function_param_string = {skeleton:"basic_string_field", color:"#ffd974", template:"\ubb38\uc790/\uc22b\uc790\uac12", func:function() { @@ -2953,7 +2953,7 @@ Blockly.Blocks.function_param_boolean = {init:function() { a.setAttribute("hashid", this.hashId); return a; }}; -Entry.block.function_param_boolean = function(a, b, d) { +Entry.block.function_param_boolean = function(a, b, c) { return b.register[b.hashId].run(); }; Entry.block.function_param_boolean = {skeleton:"basic_boolean_field", color:"#aeb8ff", template:"\ud310\ub2e8\uac12", func:function() { @@ -2981,11 +2981,11 @@ Blockly.Blocks.function_general = {init:function() { var b = a.getElementsByTagName("field"); this.appendDummyInput().appendField(""); b.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); - for (var d = 0;d < b.length;d++) { - var c = b[d], e = c.getAttribute("hashid"); - switch(c.getAttribute("type").toLowerCase()) { + for (var c = 0;c < b.length;c++) { + var d = b[c], e = d.getAttribute("hashid"); + switch(d.getAttribute("type").toLowerCase()) { case "label": - this.appendDummyInput().appendField(c.getAttribute("content")); + this.appendDummyInput().appendField(d.getAttribute("content")); break; case "string": this.appendValueInput(e).setCheck(["String", "Number"]); @@ -2998,26 +2998,26 @@ Blockly.Blocks.function_general = {init:function() { this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/function_03.png", "*")); }, mutationToDom:function() { for (var a = document.createElement("mutation"), b = 1;b < this.inputList.length;b++) { - var d = this.inputList[b]; - if (d.fieldRow[0] && d.fieldRow[0] instanceof Blockly.FieldLabel) { - var d = d.fieldRow[0], c = document.createElement("field"); - c.setAttribute("type", "label"); - c.setAttribute("content", d.text_); + var c = this.inputList[b]; + if (c.fieldRow[0] && c.fieldRow[0] instanceof Blockly.FieldLabel) { + var c = c.fieldRow[0], d = document.createElement("field"); + d.setAttribute("type", "label"); + d.setAttribute("content", c.text_); } else { - d.connection && "String" == d.connection.check_[0] ? (c = document.createElement("field"), c.setAttribute("type", "string"), c.setAttribute("hashid", d.name)) : d.connection && "Boolean" == d.connection.check_[0] && (c = document.createElement("field"), c.setAttribute("type", "boolean"), c.setAttribute("hashid", d.name)); + c.connection && "String" == c.connection.check_[0] ? (d = document.createElement("field"), d.setAttribute("type", "string"), d.setAttribute("hashid", c.name)) : c.connection && "Boolean" == c.connection.check_[0] && (d = document.createElement("field"), d.setAttribute("type", "boolean"), d.setAttribute("hashid", c.name)); } - a.appendChild(c); + a.appendChild(d); } a.setAttribute("hashid", this.hashId); return a; }}; Entry.block.function_general = function(a, b) { if (!b.thread) { - var d = Entry.variableContainer.getFunction(b.hashId); + var c = Entry.variableContainer.getFunction(b.hashId); b.thread = new Entry.Script(a); b.thread.register = b.values; - for (var c = 0;c < d.content.childNodes.length;c++) { - "function_create" == d.content.childNodes[c].getAttribute("type") && b.thread.init(d.content.childNodes[c]); + for (var d = 0;d < c.content.childNodes.length;d++) { + "function_create" == c.content.childNodes[d].getAttribute("type") && b.thread.init(c.content.childNodes[d]); } } if (a = Entry.Engine.computeThread(a, b.thread)) { @@ -3041,9 +3041,9 @@ Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud } }}; Entry.Hamster = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, outputA:0, outputB:0, leftLed:0, rightLed:0, note:0, lineTracerMode:0, lineTracerModeId:0, lineTracerSpeed:5, ioModeA:0, ioModeB:0}, setZero:function() { - var a = Entry.Hamster.PORT_MAP, b = Entry.hw.sendQueue, d; - for (d in a) { - b[d] = a[d]; + var a = Entry.Hamster.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); a = Entry.Hamster; @@ -3101,28 +3101,28 @@ Blockly.Blocks.hamster_move_forward_once = {init:function() { }}; Entry.block.hamster_move_forward_once = function(a, b) { a = Entry.hw.sendQueue; - var d = Entry.hw.portData; + var c = Entry.hw.portData; if (b.isStart) { if (b.isMoving) { switch(b.boardState) { case 1: - 2 > b.count ? (50 > d.leftFloor && 50 > d.rightFloor ? b.count++ : b.count = 0, d = d.leftFloor - d.rightFloor, a.leftWheel = 45 + .25 * d, a.rightWheel = 45 - .25 * d) : (b.count = 0, b.boardState = 2); + 2 > b.count ? (50 > c.leftFloor && 50 > c.rightFloor ? b.count++ : b.count = 0, c = c.leftFloor - c.rightFloor, a.leftWheel = 45 + .25 * c, a.rightWheel = 45 - .25 * c) : (b.count = 0, b.boardState = 2); break; case 2: - d = d.leftFloor - d.rightFloor; - a.leftWheel = 45 + .25 * d; - a.rightWheel = 45 - .25 * d; + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; b.boardState = 3; - var c = setTimeout(function() { + var d = setTimeout(function() { b.boardState = 4; - Entry.Hamster.removeTimeout(c); + Entry.Hamster.removeTimeout(d); }, 250); - Entry.Hamster.timeouts.push(c); + Entry.Hamster.timeouts.push(d); break; case 3: - d = d.leftFloor - d.rightFloor; - a.leftWheel = 45 + .25 * d; - a.rightWheel = 45 - .25 * d; + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; break; case 4: a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1; @@ -3156,42 +3156,42 @@ Blockly.Blocks.hamster_turn_once = {init:function() { }}; Entry.block.hamster_turn_once = function(a, b) { a = Entry.hw.sendQueue; - var d = Entry.hw.portData; + var c = Entry.hw.portData; if (b.isStart) { if (b.isMoving) { if (b.isLeft) { switch(b.boardState) { case 1: - 2 > b.count ? 50 < d.leftFloor && b.count++ : (b.count = 0, b.boardState = 2); + 2 > b.count ? 50 < c.leftFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.leftFloor && (b.boardState = 3); + 20 > c.leftFloor && (b.boardState = 3); break; case 3: - 2 > b.count ? 20 > d.leftFloor && b.count++ : (b.count = 0, b.boardState = 4); + 2 > b.count ? 20 > c.leftFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.leftFloor && (b.boardState = 5); + 50 < c.leftFloor && (b.boardState = 5); break; case 5: - d = d.leftFloor - d.rightFloor, -15 < d ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * d, a.rightWheel = .5 * -d); + c = c.leftFloor - c.rightFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * c, a.rightWheel = .5 * -c); } } else { switch(b.boardState) { case 1: - 2 > b.count ? 50 < d.rightFloor && b.count++ : (b.count = 0, b.boardState = 2); + 2 > b.count ? 50 < c.rightFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.rightFloor && (b.boardState = 3); + 20 > c.rightFloor && (b.boardState = 3); break; case 3: - 2 > b.count ? 20 > d.rightFloor && b.count++ : (b.count = 0, b.boardState = 4); + 2 > b.count ? 20 > c.rightFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.rightFloor && (b.boardState = 5); + 50 < c.rightFloor && (b.boardState = 5); break; case 5: - d = d.rightFloor - d.leftFloor, -15 < d ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * -d, a.rightWheel = .5 * d); + c = c.rightFloor - c.leftFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * -c, a.rightWheel = .5 * c); } } return b; @@ -3242,11 +3242,11 @@ Entry.block.hamster_move_forward_for_secs = function(a, b) { a.rightWheel = 30; Entry.Hamster.setLineTracerMode(a, 0); a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + Entry.Hamster.removeTimeout(c); }, a); - Entry.Hamster.timeouts.push(d); + Entry.Hamster.timeouts.push(c); return b; }; Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { @@ -3277,11 +3277,11 @@ Entry.block.hamster_move_backward_for_secs = function(a, b) { a.rightWheel = -30; Entry.Hamster.setLineTracerMode(a, 0); a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + Entry.Hamster.removeTimeout(c); }, a); - Entry.Hamster.timeouts.push(d); + Entry.Hamster.timeouts.push(c); return b; }; Blockly.Blocks.hamster_turn_for_secs = {init:function() { @@ -3311,11 +3311,11 @@ Entry.block.hamster_turn_for_secs = function(a, b) { "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); Entry.Hamster.setLineTracerMode(a, 0); a = 1E3 * b.getNumberValue("VALUE"); - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + Entry.Hamster.removeTimeout(c); }, a); - Entry.Hamster.timeouts.push(d); + Entry.Hamster.timeouts.push(c); return b; }; Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { @@ -3331,9 +3331,9 @@ Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { }}; Entry.block.hamster_change_both_wheels_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getNumberValue("LEFT"), c = b.getNumberValue("RIGHT"); - a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d; - a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + c : c; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; Entry.Hamster.setLineTracerMode(a, 0); return b.callReturn(); }; @@ -3366,8 +3366,8 @@ Blockly.Blocks.hamster_change_wheel_by = {init:function() { }}; Entry.block.hamster_change_wheel_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION"), c = b.getNumberValue("VALUE"); - "LEFT" == d ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c : ("RIGHT" != d && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + c : c); + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); Entry.Hamster.setLineTracerMode(a, 0); return b.callReturn(); }; @@ -3382,8 +3382,8 @@ Blockly.Blocks.hamster_set_wheel_to = {init:function() { }}; Entry.block.hamster_set_wheel_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION"), c = b.getNumberValue("VALUE"); - "LEFT" == d ? a.leftWheel = c : ("RIGHT" != d && (a.leftWheel = c), a.rightWheel = c); + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); Entry.Hamster.setLineTracerMode(a, 0); return b.callReturn(); }; @@ -3397,9 +3397,9 @@ Blockly.Blocks.hamster_follow_line_using = {init:function() { }}; Entry.block.hamster_follow_line_using = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("COLOR"), c = b.getField("DIRECTION"), e = 1; - "RIGHT" == c ? e = 2 : "BOTH" == c && (e = 3); - "WHITE" == d && (e += 7); + var c = b.getField("COLOR"), d = b.getField("DIRECTION"), e = 1; + "RIGHT" == d ? e = 2 : "BOTH" == d && (e = 3); + "WHITE" == c && (e += 7); a.leftWheel = 0; a.rightWheel = 0; Entry.Hamster.setLineTracerMode(a, e); @@ -3415,12 +3415,12 @@ Blockly.Blocks.hamster_follow_line_until = {init:function() { }}; Entry.block.hamster_follow_line_until = function(a, b) { a = Entry.hw.sendQueue; - var d = Entry.hw.portData, c = b.getField("COLOR"), e = b.getField("DIRECTION"), f = 4; + var c = Entry.hw.portData, d = b.getField("COLOR"), e = b.getField("DIRECTION"), f = 4; "RIGHT" == e ? f = 5 : "FRONT" == e ? f = 6 : "REAR" == e && (f = 7); - "WHITE" == c && (f += 7); + "WHITE" == d && (f += 7); if (b.isStart) { - if (c = Entry.Hamster, d.lineTracerStateId != c.lineTracerStateId && (c.lineTracerStateId = d.lineTracerStateId, 64 == d.lineTracerState)) { - return delete b.isStart, Entry.engine.isContinue = !1, c.setLineTracerMode(a, 0), b.callReturn(); + if (d = Entry.Hamster, c.lineTracerStateId != d.lineTracerStateId && (d.lineTracerStateId = c.lineTracerStateId, 64 == c.lineTracerState)) { + return delete b.isStart, Entry.engine.isContinue = !1, d.setLineTracerMode(a, 0), b.callReturn(); } } else { b.isStart = !0, a.leftWheel = 0, a.rightWheel = 0, Entry.Hamster.setLineTracerMode(a, f); @@ -3462,8 +3462,8 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { }}; Entry.block.hamster_set_led_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION", b), c = Number(b.getField("COLOR", b)); - "LEFT" == d ? a.leftLed = c : ("RIGHT" != d && (a.leftLed = c), a.rightLed = c); + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftLed = d : ("RIGHT" != c && (a.leftLed = d), a.rightLed = d); return b.callReturn(); }; Blockly.Blocks.hamster_clear_led = {init:function() { @@ -3475,8 +3475,8 @@ Blockly.Blocks.hamster_clear_led = {init:function() { }}; Entry.block.hamster_clear_led = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("DIRECTION", b); - "LEFT" == d ? a.leftLed = 0 : ("RIGHT" != d && (a.leftLed = 0), a.rightLed = 0); + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftLed = 0 : ("RIGHT" != c && (a.leftLed = 0), a.rightLed = 0); return b.callReturn(); }; Blockly.Blocks.hamster_beep = {init:function() { @@ -3502,11 +3502,11 @@ Entry.block.hamster_beep = function(a, b) { b.timeFlag = 1; a.buzzer = 440; a.note = 0; - var d = setTimeout(function() { + var c = setTimeout(function() { b.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + Entry.Hamster.removeTimeout(c); }, 200); - Entry.Hamster.timeouts.push(d); + Entry.Hamster.timeouts.push(c); return b; }; Blockly.Blocks.hamster_change_buzzer_by = {init:function() { @@ -3520,8 +3520,8 @@ Blockly.Blocks.hamster_change_buzzer_by = {init:function() { }}; Entry.block.hamster_change_buzzer_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getNumberValue("VALUE"); - a.buzzer = void 0 != a.buzzer ? a.buzzer + d : d; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; a.note = 0; return b.callReturn(); }; @@ -3564,7 +3564,7 @@ Blockly.Blocks.hamster_play_note_for = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_play_note_for = function(a, b) { - var d = Entry.hw.sendQueue; + var c = Entry.hw.sendQueue; if (b.isStart) { if (1 == b.timeFlag) { return b; @@ -3572,18 +3572,18 @@ Entry.block.hamster_play_note_for = function(a, b) { delete b.isStart; delete b.timeFlag; Entry.engine.isContinue = !1; - d.note = 0; + c.note = 0; return b.callReturn(); } a = b.getNumberField("NOTE", b); - var c = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Hamster.tempo; + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Hamster.tempo; b.isStart = !0; b.timeFlag = 1; - d.buzzer = 0; - d.note = a + 12 * (c - 1); + c.buzzer = 0; + c.note = a + 12 * (d - 1); if (100 < e) { var f = setTimeout(function() { - d.note = 0; + c.note = 0; Entry.Hamster.removeTimeout(f); }, e - 100); Entry.Hamster.timeouts.push(f); @@ -3617,14 +3617,14 @@ Entry.block.hamster_rest_for = function(a, b) { } b.isStart = !0; b.timeFlag = 1; - var d = b.getNumberValue("VALUE"), d = 6E4 * d / Entry.Hamster.tempo; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Hamster.tempo; a.buzzer = 0; a.note = 0; - var c = setTimeout(function() { + var d = setTimeout(function() { b.timeFlag = 0; - Entry.Hamster.removeTimeout(c); - }, d); - Entry.Hamster.timeouts.push(c); + Entry.Hamster.removeTimeout(d); + }, c); + Entry.Hamster.timeouts.push(d); return b; }; Blockly.Blocks.hamster_change_tempo_by = {init:function() { @@ -3665,8 +3665,8 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { }}; Entry.block.hamster_set_port_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("PORT", b), c = Number(b.getField("MODE", b)); - "A" == d ? a.ioModeA = c : ("B" != d && (a.ioModeA = c), a.ioModeB = c); + var c = b.getField("PORT", b), d = Number(b.getField("MODE", b)); + "A" == c ? a.ioModeA = d : ("B" != c && (a.ioModeA = d), a.ioModeB = d); return b.callReturn(); }; Blockly.Blocks.hamster_change_output_by = {init:function() { @@ -3680,8 +3680,8 @@ Blockly.Blocks.hamster_change_output_by = {init:function() { }}; Entry.block.hamster_change_output_by = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("PORT"), c = b.getNumberValue("VALUE"); - "A" == d ? a.outputA = void 0 != a.outputA ? a.outputA + c : c : ("B" != d && (a.outputA = void 0 != a.outputA ? a.outputA + c : c), a.outputB = void 0 != a.outputB ? a.outputB + c : c); + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = void 0 != a.outputA ? a.outputA + d : d : ("B" != c && (a.outputA = void 0 != a.outputA ? a.outputA + d : d), a.outputB = void 0 != a.outputB ? a.outputB + d : d); return b.callReturn(); }; Blockly.Blocks.hamster_set_output_to = {init:function() { @@ -3695,8 +3695,8 @@ Blockly.Blocks.hamster_set_output_to = {init:function() { }}; Entry.block.hamster_set_output_to = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getField("PORT"), c = b.getNumberValue("VALUE"); - "A" == d ? a.outputA = c : ("B" != d && (a.outputA = c), a.outputB = c); + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = d : ("B" != c && (a.outputA = d), a.outputB = d); return b.callReturn(); }; Blockly.Blocks.is_clicked = {init:function() { @@ -3731,11 +3731,11 @@ Entry.block.reach_something = function(a, b) { if (!a.getVisible()) { return !1; } - var d = b.getField("VALUE", b); + var c = b.getField("VALUE", b); b = a.object; - var c = /wall/.test(d), e = ndgmr.checkPixelCollision; - if (c) { - switch(a = Entry.stage.wall, d) { + var d = /wall/.test(c), e = ndgmr.checkPixelCollision; + if (d) { + switch(a = Entry.stage.wall, c) { case "wall": if (e(b, a.up, .2, !0) || e(b, a.down, .2, !0) || e(b, a.left, .2, !0) || e(b, a.right, .2, !0)) { return !0; @@ -3763,32 +3763,32 @@ Entry.block.reach_something = function(a, b) { ; } } else { - if ("mouse" == d) { + if ("mouse" == c) { return e = Entry.stage.canvas, e = b.globalToLocal(e.mouseX, e.mouseY), b.hitTest(e.x, e.y); } - d = Entry.container.getEntity(d); - if ("textBox" == d.type || "textBox" == a.type) { - e = d.object.getTransformedBounds(); + c = Entry.container.getEntity(c); + if ("textBox" == c.type || "textBox" == a.type) { + e = c.object.getTransformedBounds(); b = b.getTransformedBounds(); if (Entry.checkCollisionRect(b, e)) { return !0; } - a = d.parent.clonedEntities; - d = 0; - for (c = a.length;d < c;d++) { - var f = a[d]; + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + var f = a[c]; if (!f.isStamp && f.getVisible() && Entry.checkCollisionRect(b, f.object.getTransformedBounds())) { return !0; } } } else { - if (d.getVisible() && e(b, d.object, .2, !0)) { + if (c.getVisible() && e(b, c.object, .2, !0)) { return !0; } - a = d.parent.clonedEntities; - d = 0; - for (c = a.length;d < c;d++) { - if (f = a[d], !f.isStamp && f.getVisible() && e(b, f.object, .2, !0)) { + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + if (f = a[c], !f.isStamp && f.getVisible() && e(b, f.object, .2, !0)) { return !0; } } @@ -3806,9 +3806,9 @@ Blockly.Blocks.boolean_comparison = {init:function() { }}; Entry.block.boolean_comparison = function(a, b) { a = b.getField("OPERATOR", b); - var d = b.getNumberValue("LEFTHAND", b); + var c = b.getNumberValue("LEFTHAND", b); b = b.getNumberValue("RIGHTHAND", b); - return "EQUAL" == a ? d == b : "BIGGER" == a ? d > b : d < b; + return "EQUAL" == a ? c == b : "BIGGER" == a ? c > b : c < b; }; Blockly.Blocks.boolean_equal = {init:function() { this.setColour("#AEB8FF"); @@ -3859,9 +3859,9 @@ Blockly.Blocks.boolean_and_or = {init:function() { }}; Entry.block.boolean_and_or = function(a, b) { a = b.getField("OPERATOR", b); - var d = b.getBooleanValue("LEFTHAND", b); + var c = b.getBooleanValue("LEFTHAND", b); b = b.getBooleanValue("RIGHTHAND", b); - return "AND" == a ? d && b : d || b; + return "AND" == a ? c && b : c || b; }; Blockly.Blocks.boolean_and = {init:function() { this.setColour("#AEB8FF"); @@ -3939,19 +3939,19 @@ Blockly.Blocks.boolean_basic_operator = {init:function() { }}; Entry.block.boolean_basic_operator = function(a, b) { a = b.getField("OPERATOR", b); - var d = b.getStringValue("LEFTHAND", b); + var c = b.getStringValue("LEFTHAND", b); b = b.getStringValue("RIGHTHAND", b); switch(a) { case "EQUAL": - return d == b; + return c == b; case "GREATER": - return Number(d) > Number(b); + return Number(c) > Number(b); case "LESS": - return Number(d) < Number(b); + return Number(c) < Number(b); case "GREATER_OR_EQUAL": - return Number(d) >= Number(b); + return Number(c) >= Number(b); case "LESS_OR_EQUAL": - return Number(d) <= Number(b); + return Number(c) <= Number(b); } }; Blockly.Blocks.show = {init:function() { @@ -3991,16 +3991,16 @@ Blockly.Blocks.dialog_time = {init:function() { }}; Entry.block.dialog_time = function(a, b) { if (!b.isStart) { - var d = b.getNumberValue("SECOND", b), c = b.getStringValue("VALUE", b), e = b.getField("OPTION", b); + var c = b.getNumberValue("SECOND", b), d = b.getStringValue("VALUE", b), e = b.getField("OPTION", b); b.isStart = !0; b.timeFlag = 1; - c || "number" == typeof c || (c = " "); - c = Entry.convertToRoundedDecimals(c, 3); - new Entry.Dialog(a, c, e); + d || "number" == typeof d || (d = " "); + d = Entry.convertToRoundedDecimals(d, 3); + new Entry.Dialog(a, d, e); a.syncDialogVisible(a.getVisible()); setTimeout(function() { b.timeFlag = 0; - }, 1E3 * d); + }, 1E3 * c); } return 0 == b.timeFlag ? (delete b.timeFlag, delete b.isStart, a.dialog && a.dialog.remove(), b.callReturn()) : b; }; @@ -4016,10 +4016,10 @@ Blockly.Blocks.dialog = {init:function() { this.setNextStatement(!0); }}; Entry.block.dialog = function(a, b) { - var d = b.getStringValue("VALUE", b); - d || "number" == typeof d || (d = " "); - var c = b.getField("OPTION", b), d = Entry.convertToRoundedDecimals(d, 3); - new Entry.Dialog(a, d, c); + var c = b.getStringValue("VALUE", b); + c || "number" == typeof c || (c = " "); + var d = b.getField("OPTION", b), c = Entry.convertToRoundedDecimals(c, 3); + new Entry.Dialog(a, c, d); a.syncDialogVisible(a.getVisible()); return b.callReturn(); }; @@ -4044,8 +4044,8 @@ Blockly.Blocks.change_to_nth_shape = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_to_nth_shape = function(a, b) { - var d = b.getField("VALUE", b), d = a.parent.getPicture(d); - a.setImage(d); + var c = b.getField("VALUE", b), c = a.parent.getPicture(c); + a.setImage(c); return b.callReturn(); }; Blockly.Blocks.change_to_next_shape = {init:function() { @@ -4056,9 +4056,9 @@ Blockly.Blocks.change_to_next_shape = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_to_next_shape = function(a, b) { - var d; - d = b.fields && "prev" === b.getStringField("DRIECTION") ? a.parent.getPrevPicture(a.picture.id) : a.parent.getNextPicture(a.picture.id); - a.setImage(d); + var c; + c = b.fields && "prev" === b.getStringField("DRIECTION") ? a.parent.getPrevPicture(a.picture.id) : a.parent.getNextPicture(a.picture.id); + a.setImage(c); return b.callReturn(); }; Blockly.Blocks.set_effect_volume = {init:function() { @@ -4073,8 +4073,8 @@ Blockly.Blocks.set_effect_volume = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_effect_volume = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hue = c + a.effect.hue : "lens" != d && "swriling" != d && "pixel" != d && "mosaic" != d && ("brightness" == d ? a.effect.brightness = c + a.effect.brightness : "blur" != d && "opacity" == d && (a.effect.alpha += c / 100)); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d + a.effect.brightness : "blur" != c && "opacity" == c && (a.effect.alpha += d / 100)); a.applyFilter(); return b.callReturn(); }; @@ -4090,8 +4090,8 @@ Blockly.Blocks.set_effect = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_effect = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hue = c : "lens" != d && "swriling" != d && "pixel" != d && "mosaic" != d && ("brightness" == d ? a.effect.brightness = c : "blur" != d && "opacity" == d && (a.effect.alpha = c / 100)); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d : "blur" != c && "opacity" == c && (a.effect.alpha = d / 100)); a.applyFilter(); return b.callReturn(); }; @@ -4116,9 +4116,9 @@ Blockly.Blocks.change_scale_percent = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_scale_percent = function(a, b) { - var d = (b.getNumberValue("VALUE", b) + 100) / 100; - a.setScaleX(a.getScaleX() * d); - a.setScaleY(a.getScaleY() * d); + var c = (b.getNumberValue("VALUE", b) + 100) / 100; + a.setScaleX(a.getScaleX() * c); + a.setScaleY(a.getScaleY() * c); return b.callReturn(); }; Blockly.Blocks.set_scale_percent = {init:function() { @@ -4131,9 +4131,9 @@ Blockly.Blocks.set_scale_percent = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_scale_percent = function(a, b) { - var d = b.getNumberValue("VALUE", b) / 100, c = a.snapshot_; - a.setScaleX(d * c.scaleX); - a.setScaleY(d * c.scaleY); + var c = b.getNumberValue("VALUE", b) / 100, d = a.snapshot_; + a.setScaleX(c * d.scaleX); + a.setScaleY(c * d.scaleY); return b.callReturn(); }; Blockly.Blocks.change_scale_size = {init:function() { @@ -4146,8 +4146,8 @@ Blockly.Blocks.change_scale_size = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_scale_size = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setSize(a.getSize() + d); + var c = b.getNumberValue("VALUE", b); + a.setSize(a.getSize() + c); return b.callReturn(); }; Blockly.Blocks.set_scale_size = {init:function() { @@ -4160,8 +4160,8 @@ Blockly.Blocks.set_scale_size = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_scale_size = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setSize(d); + var c = b.getNumberValue("VALUE", b); + a.setSize(c); return b.callReturn(); }; Blockly.Blocks.flip_y = {init:function() { @@ -4196,10 +4196,10 @@ Blockly.Blocks.set_object_order = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_object_order = function(a, b) { - var d = b.getField("VALUE", b); + var c = b.getField("VALUE", b); a = Entry.container.getCurrentObjects().indexOf(a.parent); if (-1 < a) { - return Entry.container.moveElementByBlock(a, d), b.callReturn(); + return Entry.container.moveElementByBlock(a, c), b.callReturn(); } throw Error("object is not available"); }; @@ -4224,10 +4224,10 @@ Blockly.Blocks.change_to_some_shape = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_to_some_shape = function(a, b) { - var d = b.getStringValue("VALUE"); - Entry.parseNumber(d); - d = a.parent.getPicture(d); - a.setImage(d); + var c = b.getStringValue("VALUE"); + Entry.parseNumber(c); + c = a.parent.getPicture(c); + a.setImage(c); return b.callReturn(); }; Blockly.Blocks.add_effect_amount = {init:function() { @@ -4242,8 +4242,8 @@ Blockly.Blocks.add_effect_amount = {init:function() { this.setNextStatement(!0); }}; Entry.block.add_effect_amount = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hsv = c + a.effect.hsv : "brightness" == d ? a.effect.brightness = c + a.effect.brightness : "transparency" == d && (a.effect.alpha -= c / 100); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d + a.effect.hsv : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); a.applyFilter(); return b.callReturn(); }; @@ -4259,8 +4259,8 @@ Blockly.Blocks.change_effect_amount = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_effect_amount = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hsv = c : "brightness" == d ? a.effect.brightness = c : "transparency" == d && (a.effect.alpha = 1 - c / 100); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); a.applyFilter(); return b.callReturn(); }; @@ -4276,8 +4276,8 @@ Blockly.Blocks.set_effect_amount = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_effect_amount = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hue = c + a.effect.hue : "brightness" == d ? a.effect.brightness = c + a.effect.brightness : "transparency" == d && (a.effect.alpha -= c / 100); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); a.applyFilter(); return b.callReturn(); }; @@ -4293,8 +4293,8 @@ Blockly.Blocks.set_entity_effect = {init:function() { this.setNextStatement(!0); }}; Entry.block.set_entity_effect = function(a, b) { - var d = b.getField("EFFECT", b), c = b.getNumberValue("VALUE", b); - "color" == d ? a.effect.hue = c : "brightness" == d ? a.effect.brightness = c : "transparency" == d && (a.effect.alpha = 1 - c / 100); + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); a.applyFilter(); return b.callReturn(); }; @@ -4307,26 +4307,26 @@ Blockly.Blocks.change_object_index = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_object_index = function(a, b) { - var d, c = b.getField("LOCATION", b), e = Entry.container.getCurrentObjects(); + var c, d = b.getField("LOCATION", b), e = Entry.container.getCurrentObjects(); a = e.indexOf(a.parent); e = e.length - 1; if (0 > a) { throw Error("object is not available for current scene"); } - switch(c) { + switch(d) { case "FRONT": - d = 0; + c = 0; break; case "FORWARD": - d = Math.max(0, a - 1); + c = Math.max(0, a - 1); break; case "BACKWARD": - d = Math.min(e, a + 1); + c = Math.min(e, a + 1); break; case "BACK": - d = e; + c = e; } - Entry.container.moveElementByBlock(a, d); + Entry.container.moveElementByBlock(a, c); return b.callReturn(); }; Blockly.Blocks.move_direction = {init:function() { @@ -4339,9 +4339,9 @@ Blockly.Blocks.move_direction = {init:function() { this.setNextStatement(!0); }}; Entry.block.move_direction = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setX(a.getX() + d * Math.cos((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); - a.setY(a.getY() - d * Math.sin((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c * Math.cos((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4355,8 +4355,8 @@ Blockly.Blocks.move_x = {init:function() { this.setNextStatement(!0); }}; Entry.block.move_x = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setX(a.getX() + d); + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4370,8 +4370,8 @@ Blockly.Blocks.move_y = {init:function() { this.setNextStatement(!0); }}; Entry.block.move_y = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setY(a.getY() + d); + var c = b.getNumberValue("VALUE", b); + a.setY(a.getY() + c); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4390,20 +4390,20 @@ Blockly.Blocks.locate_xy_time = {init:function() { }}; Entry.block.locate_xy_time = function(a, b) { if (!b.isStart) { - var d; - d = b.getNumberValue("VALUE1", b); + var c; + c = b.getNumberValue("VALUE1", b); b.isStart = !0; - b.frameCount = Math.floor(d * Entry.FPS); + b.frameCount = Math.floor(c * Entry.FPS); b.x = b.getNumberValue("VALUE2", b); b.y = b.getNumberValue("VALUE3", b); } if (0 != b.frameCount) { - d = b.x - a.getX(); - var c = b.y - a.getY(); - d /= b.frameCount; + c = b.x - a.getX(); + var d = b.y - a.getY(); c /= b.frameCount; - a.setX(a.getX() + d); - a.setY(a.getY() + c); + d /= b.frameCount; + a.setX(a.getX() + c); + a.setY(a.getY() + d); b.frameCount--; a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b; @@ -4422,8 +4422,8 @@ Blockly.Blocks.rotate_by_angle = {init:function() { this.setNextStatement(!0); }}; Entry.block.rotate_by_angle = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setRotation(a.getRotation() + d); + var c = b.getNumberValue("VALUE", b); + a.setRotation(a.getRotation() + c); return b.callReturn(); }; Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { @@ -4435,8 +4435,8 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { this.setNextStatement(!0); }}; Entry.block.rotate_by_angle_dropdown = function(a, b) { - var d = b.getField("VALUE", b); - a.setRotation(a.getRotation() + Number(d)); + var c = b.getField("VALUE", b); + a.setRotation(a.getRotation() + Number(c)); return b.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -4449,8 +4449,8 @@ Blockly.Blocks.see_angle = {init:function() { this.setNextStatement(!0); }}; Entry.block.see_angle = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setDirection(d); + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); return b.callReturn(); }; Blockly.Blocks.see_direction = {init:function() { @@ -4463,8 +4463,8 @@ Blockly.Blocks.see_direction = {init:function() { this.setNextStatement(!0); }}; Entry.block.see_direction = function(a, b) { - var d = b.getField("VALUE", b), c = Entry.container.getEntity(d), d = c.getX() - a.getX(), c = c.getY() - a.getY(); - 0 <= d ? a.setRotation(Math.atan(c / d) / Math.PI * 180 + 90) : a.setRotation(Math.atan(c / d) / Math.PI * 180 + 270); + var c = b.getField("VALUE", b), d = Entry.container.getEntity(c), c = d.getX() - a.getX(), d = d.getY() - a.getY(); + 0 <= c ? a.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : a.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); return b.callReturn(); }; Blockly.Blocks.locate_xy = {init:function() { @@ -4479,10 +4479,10 @@ Blockly.Blocks.locate_xy = {init:function() { this.setNextStatement(!0); }}; Entry.block.locate_xy = function(a, b) { - var d = b.getNumberValue("VALUE1", b); - a.setX(d); - d = b.getNumberValue("VALUE2", b); - a.setY(d); + var c = b.getNumberValue("VALUE1", b); + a.setX(c); + c = b.getNumberValue("VALUE2", b); + a.setY(c); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4496,8 +4496,8 @@ Blockly.Blocks.locate_x = {init:function() { this.setNextStatement(!0); }}; Entry.block.locate_x = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setX(d); + var c = b.getNumberValue("VALUE", b); + a.setX(c); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4511,8 +4511,8 @@ Blockly.Blocks.locate_y = {init:function() { this.setNextStatement(!0); }}; Entry.block.locate_y = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setY(d); + var c = b.getNumberValue("VALUE", b); + a.setY(c); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4526,11 +4526,11 @@ Blockly.Blocks.locate = {init:function() { this.setNextStatement(!0); }}; Entry.block.locate = function(a, b) { - var d = b.getField("VALUE", b), c; - "mouse" == d ? (d = Entry.stage.mouseCoordinate.x, c = Entry.stage.mouseCoordinate.y) : (c = Entry.container.getEntity(d), d = c.getX(), c = c.getY()); - a.setX(Number(d)); - a.setY(Number(c)); - a.brush && !a.brush.stop && a.brush.lineTo(d, -1 * c); + var c = b.getField("VALUE", b), d; + "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); + a.setX(Number(c)); + a.setY(Number(d)); + a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d); return b.callReturn(); }; Blockly.Blocks.move_xy_time = {init:function() { @@ -4548,12 +4548,12 @@ Blockly.Blocks.move_xy_time = {init:function() { }}; Entry.block.move_xy_time = function(a, b) { if (!b.isStart) { - var d; - d = b.getNumberValue("VALUE1", b); - var c = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + var c; + c = b.getNumberValue("VALUE1", b); + var d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); b.isStart = !0; - b.frameCount = Math.floor(d * Entry.FPS); - b.dX = c / b.frameCount; + b.frameCount = Math.floor(c * Entry.FPS); + b.dX = d / b.frameCount; b.dY = e / b.frameCount; } if (0 != b.frameCount) { @@ -4587,12 +4587,12 @@ Blockly.Blocks.rotate_by_angle_time = {init:function() { }}; Entry.block.rotate_by_angle_time = function(a, b) { if (!b.isStart) { - var d; - d = b.getNumberValue("VALUE", b); - var c = b.getNumberField("VALUE", b); + var c; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberField("VALUE", b); b.isStart = !0; - b.frameCount = Math.floor(d * Entry.FPS); - b.dAngle = c / b.frameCount; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } if (0 != b.frameCount) { return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; @@ -4618,21 +4618,21 @@ Blockly.Blocks.bounce_wall = {init:function() { this.setNextStatement(!0); }}; Entry.block.bounce_wall = function(a, b) { - var d = a.parent.getRotateMethod(), c = "free" == d ? (a.getRotation() + a.getDirection()).mod(360) : a.getDirection(), e; - if (90 > c && 0 <= c || 360 > c && 270 <= c) { + var c = a.parent.getRotateMethod(), d = "free" == c ? (a.getRotation() + a.getDirection()).mod(360) : a.getDirection(), e; + if (90 > d && 0 <= d || 360 > d && 270 <= d) { e = a.collision == Entry.Utils.COLLISION.UP; var f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1); !f && e && (a.collision = Entry.Utils.COLLISION.NONE); f && e && (f = !1); - f ? ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP) : (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = + f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP) : (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN)); } else { - 270 > c && 90 <= c && (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN) : (e = a.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1), - !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP))); + 270 > d && 90 <= d && (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN) : (e = a.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1), + !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP))); } - 360 > c && 180 <= c ? (e = a.collision == Entry.Utils.COLLISION.LEFT, c = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !c && e && (a.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c ? ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT) : (e = a.collision == Entry.Utils.COLLISION.RIGHT, c = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !c && - e && (a.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c && ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > c && 0 <= c && (e = a.collision == Entry.Utils.COLLISION.RIGHT, c = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !c && e && (a.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c ? ("free" == d ? a.setRotation(-a.getRotation() - - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT) : (e = a.collision == Entry.Utils.COLLISION.LEFT, c = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !c && e && (a.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c && ("free" == d ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT))); + 360 > d && 180 <= d ? (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT) : (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && + e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - + 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT) : (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT))); return b.callReturn(); }; Blockly.Blocks.flip_arrow_horizontal = {init:function() { @@ -4667,14 +4667,14 @@ Blockly.Blocks.see_angle_object = {init:function() { this.setNextStatement(!0); }}; Entry.block.see_angle_object = function(a, b) { - var d = b.getField("VALUE", b), c = a.getX(), e = a.getY(); - if (a.parent.id == d) { + var c = b.getField("VALUE", b), d = a.getX(), e = a.getY(); + if (a.parent.id == c) { return b.callReturn(); } - "mouse" == d ? (d = Entry.stage.mouseCoordinate.y, c = Entry.stage.mouseCoordinate.x - c, e = d - e) : (d = Entry.container.getEntity(d), c = d.getX() - c, e = d.getY() - e); - e = 0 === c && 0 === e ? a.getDirection() + a.getRotation() : 0 <= c ? -Math.atan(e / c) / Math.PI * 180 + 90 : -Math.atan(e / c) / Math.PI * 180 + 270; - c = a.getDirection() + a.getRotation(); - a.setRotation(a.getRotation() + e - c); + "mouse" == c ? (c = Entry.stage.mouseCoordinate.y, d = Entry.stage.mouseCoordinate.x - d, e = c - e) : (c = Entry.container.getEntity(c), d = c.getX() - d, e = c.getY() - e); + e = 0 === d && 0 === e ? a.getDirection() + a.getRotation() : 0 <= d ? -Math.atan(e / d) / Math.PI * 180 + 90 : -Math.atan(e / d) / Math.PI * 180 + 270; + d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + e - d); return b.callReturn(); }; Blockly.Blocks.see_angle_direction = {init:function() { @@ -4687,8 +4687,8 @@ Blockly.Blocks.see_angle_direction = {init:function() { this.setNextStatement(!0); }}; Entry.block.see_angle_direction = function(a, b) { - var d = b.getNumberValue("VALUE", b), c = a.getDirection() + a.getRotation(); - a.setRotation(a.getRotation() + d - c); + var c = b.getNumberValue("VALUE", b), d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + c - d); return b.callReturn(); }; Blockly.Blocks.rotate_direction = {init:function() { @@ -4701,8 +4701,8 @@ Blockly.Blocks.rotate_direction = {init:function() { this.setNextStatement(!0); }}; Entry.block.rotate_direction = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setDirection(d + a.getDirection()); + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); return b.callReturn(); }; Blockly.Blocks.locate_object_time = {init:function() { @@ -4718,15 +4718,15 @@ Blockly.Blocks.locate_object_time = {init:function() { }}; Entry.block.locate_object_time = function(a, b) { if (!b.isStart) { - var d, c, e; - c = b.getField("TARGET", b); - d = b.getNumberValue("VALUE", b); - d = Math.floor(d * Entry.FPS); + var c, d, e; + d = b.getField("TARGET", b); + c = b.getNumberValue("VALUE", b); + c = Math.floor(c * Entry.FPS); e = Entry.stage.mouseCoordinate; - if (0 != d) { - "mouse" == c ? (c = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(c), c = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = d, b.dX = c / b.frameCount, b.dY = e / b.frameCount; + if (0 != c) { + "mouse" == d ? (d = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = c, b.dX = d / b.frameCount, b.dY = e / b.frameCount; } else { - return "mouse" == c ? (c = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(c), c = e.getX(), e = e.getY()), a.setX(c), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.callReturn(); + return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.callReturn(); } } if (0 != b.frameCount) { @@ -4746,8 +4746,8 @@ Blockly.Blocks.rotate_absolute = {init:function() { this.setNextStatement(!0); }}; Entry.block.rotate_absolute = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setRotation(d); + var c = b.getNumberValue("VALUE", b); + a.setRotation(c); return b.callReturn(); }; Blockly.Blocks.rotate_relative = {init:function() { @@ -4760,8 +4760,8 @@ Blockly.Blocks.rotate_relative = {init:function() { this.setNextStatement(!0); }}; Entry.block.rotate_relative = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setRotation(d + a.getRotation()); + var c = b.getNumberValue("VALUE", b); + a.setRotation(c + a.getRotation()); return b.callReturn(); }; Blockly.Blocks.direction_absolute = {init:function() { @@ -4774,8 +4774,8 @@ Blockly.Blocks.direction_absolute = {init:function() { this.setNextStatement(!0); }}; Entry.block.direction_absolute = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setDirection(d); + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); return b.callReturn(); }; Blockly.Blocks.direction_relative = {init:function() { @@ -4788,8 +4788,8 @@ Blockly.Blocks.direction_relative = {init:function() { this.setNextStatement(!0); }}; Entry.block.direction_relative = function(a, b) { - var d = b.getNumberValue("VALUE", b); - a.setDirection(d + a.getDirection()); + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); return b.callReturn(); }; Blockly.Blocks.move_to_angle = {init:function() { @@ -4804,9 +4804,9 @@ Blockly.Blocks.move_to_angle = {init:function() { this.setNextStatement(!0); }}; Entry.block.move_to_angle = function(a, b) { - var d = b.getNumberValue("VALUE", b), c = b.getNumberValue("ANGLE", b); - a.setX(a.getX() + d * Math.cos((c - 90) / 180 * Math.PI)); - a.setY(a.getY() - d * Math.sin((c - 90) / 180 * Math.PI)); + var c = b.getNumberValue("VALUE", b), d = b.getNumberValue("ANGLE", b); + a.setX(a.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); return b.callReturn(); }; @@ -4824,12 +4824,12 @@ Blockly.Blocks.rotate_by_time = {init:function() { }}; Entry.block.rotate_by_time = function(a, b) { if (!b.isStart) { - var d; - d = b.getNumberValue("VALUE", b); - var c = b.getNumberValue("ANGLE", b); + var c; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberValue("ANGLE", b); b.isStart = !0; - b.frameCount = Math.floor(d * Entry.FPS); - b.dAngle = c / b.frameCount; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } if (0 != b.frameCount) { return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; @@ -4851,12 +4851,12 @@ Blockly.Blocks.direction_relative_duration = {init:function() { }}; Entry.block.direction_relative_duration = function(a, b) { if (!b.isStart) { - var d; - d = b.getNumberValue("DURATION", b); - var c = b.getNumberValue("AMOUNT", b); + var c; + c = b.getNumberValue("DURATION", b); + var d = b.getNumberValue("AMOUNT", b); b.isStart = !0; - b.frameCount = Math.floor(d * Entry.FPS); - b.dDirection = c / b.frameCount; + b.frameCount = Math.floor(c * Entry.FPS); + b.dDirection = d / b.frameCount; } if (0 != b.frameCount) { return a.setDirection(a.getDirection() + b.dDirection), b.frameCount--, b; @@ -4893,8 +4893,8 @@ Blockly.Blocks.neobot_left_motor = {init:function() { }}; Entry.block.neobot_left_motor = function(a, b) { a = b.getNumberField("SPEED"); - var d = b.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCL = a + d; + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCL = a + c; return b.callReturn(); }; Blockly.Blocks.neobot_stop_left_motor = {init:function() { @@ -4918,8 +4918,8 @@ Blockly.Blocks.neobot_right_motor = {init:function() { }}; Entry.block.neobot_right_motor = function(a, b) { a = b.getNumberField("SPEED"); - var d = b.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCR = a + d; + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCR = a + c; return b.callReturn(); }; Blockly.Blocks.neobot_stop_right_motor = {init:function() { @@ -4981,8 +4981,8 @@ Blockly.Blocks.neobot_set_servo = {init:function() { }}; Entry.block.neobot_set_servo = function(a, b) { a = b.getNumberField("PORT"); - var d = b.getNumberField("DEGREE"); - Entry.hw.sendQueue["OUT" + a] = d; + var c = b.getNumberField("DEGREE"); + Entry.hw.sendQueue["OUT" + a] = c; 3 === a && (a = 4); Entry.hw.sendQueue.OPT |= a; return b.callReturn(); @@ -4998,11 +4998,11 @@ Blockly.Blocks.neobot_set_output = {init:function() { }}; Entry.block.neobot_set_output = function(a, b) { a = b.getStringField("PORT", b); - var d = b.getNumberValue("VALUE", b), c = a; - 0 > d ? d = 0 : 255 < d && (d = 255); - 3 === c && (c = 4); - Entry.hw.sendQueue["OUT" + a] = d; - Entry.hw.sendQueue.OPT &= ~c; + var c = b.getNumberValue("VALUE", b), d = a; + 0 > c ? c = 0 : 255 < c && (c = 255); + 3 === d && (d = 4); + Entry.hw.sendQueue["OUT" + a] = c; + Entry.hw.sendQueue.OPT &= ~d; return b.callReturn(); }; Blockly.Blocks.neobot_set_fnd = {init:function() { @@ -5041,11 +5041,11 @@ Entry.block.neobot_play_note_for = function(a, b) { Entry.engine.isContinue = !1; return b.callReturn(); } - var d = b.getNumberField("NOTE", b), c = b.getNumberField("OCTAVE", b), e = b.getNumberField("DURATION", b), d = d + 12 * c; + var c = b.getNumberField("NOTE", b), d = b.getNumberField("OCTAVE", b), e = b.getNumberField("DURATION", b), c = c + 12 * d; b.isStart = !0; b.timeFlag = 1; - 65 < d && (d = 65); - a.SND = d; + 65 < c && (c = 65); + a.SND = c; setTimeout(function() { b.timeFlag = 0; }, 1 / e * 2E3); @@ -5062,8 +5062,8 @@ Entry.Roborobo_Roduino = {name:"roborobo_roduino", INSTRUCTION:{DIGITAL_READ:1, Entry.hw.update(); this.wait(32); }, wait:function(a) { - for (var b = (new Date).getTime(), d = b;d < b + a;) { - d = (new Date).getTime(); + for (var b = (new Date).getTime(), c = b;c < b + a;) { + c = (new Date).getTime(); } }, ColorPin:[0, 0, 0]}; Entry.Roborobo_SchoolKit = {name:"roborobo_schoolkit", INSTRUCTION:{DIGITAL_READ:1, DIGITAL_WRITE:2, MOTOR:3, COLOR:4, SERVO:5}, setZero:function() { @@ -5077,8 +5077,8 @@ Entry.Roborobo_SchoolKit = {name:"roborobo_schoolkit", INSTRUCTION:{DIGITAL_READ Entry.hw.update(); this.wait(32); }, wait:function(a) { - for (var b = (new Date).getTime(), d = b;d < b + a;) { - d = (new Date).getTime(); + for (var b = (new Date).getTime(), c = b;c < b + a;) { + c = (new Date).getTime(); } }, ColorPin:[0, 0, 0]}; Blockly.Blocks.roduino_on_block = {init:function() { @@ -5154,19 +5154,19 @@ Blockly.Blocks.roduino_get_color = {init:function() { Entry.block.roduino_get_color = function(a, b) { a = 0; b = b.getField("VALUE", b); - var d = [Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2] - 2]]; + var c = [Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2] - 2]]; switch(b) { case "red": - 1 == d[0] && 0 == d[1] && 0 == d[2] && (a = 1); + 1 == c[0] && 0 == c[1] && 0 == c[2] && (a = 1); break; case "green": - 0 == d[0] && 1 == d[1] && 0 == d[2] && (a = 1); + 0 == c[0] && 1 == c[1] && 0 == c[2] && (a = 1); break; case "blue": - 0 == d[0] && 0 == d[1] && 1 == d[2] && (a = 1); + 0 == c[0] && 0 == c[1] && 1 == c[2] && (a = 1); break; case "yellow": - 1 == d[0] && 1 == d[1] && 1 == d[2] && (a = 1); + 1 == c[0] && 1 == c[1] && 1 == c[2] && (a = 1); } return a; }; @@ -5182,8 +5182,8 @@ Blockly.Blocks.roduino_set_digital = {init:function() { }}; Entry.block.roduino_set_digital = function(a, b) { a = b.getNumberValue("VALUE"); - var d = b.getField("OPERATOR"); - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, a, "on" == d ? 1 : 0]); + var c = b.getField("OPERATOR"); + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, a, "on" == c ? 1 : 0]); return b.callReturn(); }; Blockly.Blocks.roduino_motor = {init:function() { @@ -5196,13 +5196,13 @@ Blockly.Blocks.roduino_motor = {init:function() { }}; Entry.block.roduino_motor = function(a, b) { pin2 = 0; - var d; + var c; value2 = 0; a = b.getField("MODE"); - d = b.getField("OPERATOR"); + c = b.getField("OPERATOR"); "motor1" == a ? (a = 9, pin2 = 10) : (a = 11, pin2 = 12); - "cw" == d ? (d = 1, value2 = 0) : "ccw" == d ? (d = 0, value2 = 1) : value2 = d = 0; - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR, a, d, pin2, value2]); + "cw" == c ? (c = 1, value2 = 0) : "ccw" == c ? (c = 0, value2 = 1) : value2 = c = 0; + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR, a, c, pin2, value2]); return b.callReturn(); }; Blockly.Blocks.roduino_set_color_pin = {init:function() { @@ -5220,9 +5220,9 @@ Blockly.Blocks.roduino_set_color_pin = {init:function() { }}; Entry.block.roduino_set_color_pin = function(a, b) { a = b.getNumberValue("RED", b); - var d = b.getNumberValue("GREEN", b), c = b.getNumberValue("BLUE", b); - Entry.Roborobo_Roduino.ColorPin = [a, d, c]; - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR, a, d, c]); + var c = b.getNumberValue("GREEN", b), d = b.getNumberValue("BLUE", b); + Entry.Roborobo_Roduino.ColorPin = [a, c, d]; + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR, a, c, d]); return b.callReturn(); }; Blockly.Blocks.schoolkit_on_block = {init:function() { @@ -5265,8 +5265,8 @@ Blockly.Blocks.schoolkit_set_output = {init:function() { }}; Entry.block.schoolkit_set_output = function(a, b) { a = b.getNumberValue("VALUE"); - var d = b.getField("OPERATOR"); - Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, a, "on" == d ? 1 : 0]); + var c = b.getField("OPERATOR"); + Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, a, "on" == c ? 1 : 0]); return b.callReturn(); }; Blockly.Blocks.schoolkit_get_in_port_number = {init:function() { @@ -5302,13 +5302,13 @@ Blockly.Blocks.schoolkit_motor = {init:function() { this.setNextStatement(!0); }}; Entry.block.schoolkit_motor = function(a, b) { - var d; - d = b.getField("MODE"); + var c; + c = b.getField("MODE"); a = b.getField("OPERATOR"); - var c = b.getNumberValue("VALUE"); - d = "motor1" == d ? 7 : 8; - 255 < c ? c = 255 : 0 > c && (c = 0); - "cw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, d, c]) : "ccw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, d, c]) : "stop" == a && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 0, d, c]); + var d = b.getNumberValue("VALUE"); + c = "motor1" == c ? 7 : 8; + 255 < d ? d = 255 : 0 > d && (d = 0); + "cw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, c, d]) : "ccw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, c, d]) : "stop" == a && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 0, c, d]); return b.callReturn(); }; Blockly.Blocks.schoolkit_set_servo_value = {init:function() { @@ -5326,9 +5326,9 @@ Blockly.Blocks.schoolkit_set_servo_value = {init:function() { }}; Entry.block.schoolkit_set_servo_value = function(a, b) { a = b.getNumberValue("PIN"); - var d = b.getNumberValue("VALUE"); - 0 > d ? d = 0 : 180 < d && (d = 180); - Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.SERVO, a, d]); + var c = b.getNumberValue("VALUE"); + 0 > c ? c = 0 : 180 < c && (c = 180); + Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.SERVO, a, c]); return b.callReturn(); }; Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED:[67, 1], CM_SPRING_RIGHT:[69, 1, 69, 2], CM_SPRING_LEFT:[70, 1, 69, 2], CM_SWITCH:[71, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_IR_LEFT:[91, 2, 91, 4], CM_IR_RIGHT:[93, 2, 91, 4], CM_CALIBRATION_LEFT:[95, 2], CM_CALIBRATION_RIGHT:[97, 2], AUX_MOTOR_SPEED_LEFT:[152, 2], AUX_MOTOR_SPEED_RIGHT:[154, 2]}, setZero:function() { @@ -5339,8 +5339,8 @@ Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{C this.update(); this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0], [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0]]); this.update(); -}, name:"robotis_carCont", delay:40, postCallReturn:function(a, b, d) { - if (0 >= d) { +}, name:"robotis_carCont", delay:40, postCallReturn:function(a, b, c) { + if (0 >= c) { return this.setRobotisData(b), this.update(), a.callReturn(); } if (a.isStart) { @@ -5358,12 +5358,12 @@ Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{C this.setRobotisData(b); setTimeout(function() { a.timeFlag = 0; - }, d); + }, c); return a; }, wait:function(a, b) { Entry.hw.socket.send(JSON.stringify(a)); - for (var d = a = (new Date).getTime();d < a + b;) { - d = (new Date).getTime(); + for (var c = a = (new Date).getTime();c < a + b;) { + c = (new Date).getTime(); } }, update:function() { Entry.hw.update(); @@ -5405,10 +5405,10 @@ Blockly.Blocks.robotis_openCM70_cm_custom_value = {init:function() { }}; Entry.block.robotis_openCM70_cm_custom_value = function(a, b) { a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var d = 0, c = b.getStringField("SIZE"); - "BYTE" == c ? d = 1 : "WORD" == c ? d = 2 : "DWORD" == c && (d = 4); + var c = 0, d = b.getStringField("SIZE"); + "BYTE" == d ? c = 1 : "WORD" == d ? c = 2 : "DWORD" == d && (c = 4); b = b.getNumberValue("VALUE"); - Entry.Robotis_carCont.setRobotisData([[a, b, d, 0, d]]); + Entry.Robotis_carCont.setRobotisData([[a, b, c, 0, c]]); Entry.Robotis_carCont.update(); return Entry.hw.portData[b]; }; @@ -5428,12 +5428,12 @@ Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { }}; Entry.block.robotis_openCM70_sensor_value = function(a, b) { a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var d = 0, c = 0, e = 0, f = 0; + var c = 0, d = 0, e = 0, f = 0; b = b.getStringField("SENSOR"); - "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], - c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); + "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); e += 0 * f; - Entry.Robotis_carCont.setRobotisData([[a, d, c, 0, f]]); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); return Entry.hw.portData[e]; }; @@ -5471,20 +5471,20 @@ Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { }}; Entry.block.robotis_openCM70_aux_sensor_value = function(a, b) { a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var d = 0, c = 0, e = 0, f = 0, g = b.getStringField("PORT"); + var c = 0, d = 0, e = 0, f = 0, g = b.getStringField("PORT"); b = b.getStringField("SENSOR"); var h = 0; "PORT_3" == g ? h = 2 : "PORT_4" == g ? h = 3 : "PORT_5" == g ? h = 4 : "PORT_6" == g && (h = 5); - "AUX_SERVO_POSITION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : - "AUX_TOUCH" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : - "AUX_BRIGHTNESS" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], - c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); + "AUX_SERVO_POSITION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : + "AUX_TOUCH" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : + "AUX_BRIGHTNESS" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); e += h * f; - 0 != h && (c = 6 * f); - Entry.Robotis_carCont.setRobotisData([[a, d, c, 0, f]]); + 0 != h && (d = 6 * f); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); return Entry.hw.portData[e]; }; @@ -5505,12 +5505,12 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { }}; Entry.block.robotis_openCM70_cm_buzzer_index = function(a, b) { a = b.getField("CM_BUZZER_INDEX", b); - var d = b.getNumberValue("CM_BUZZER_TIME", b), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f, g; + var c = b.getNumberValue("CM_BUZZER_TIME", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f, g; e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0]; f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1]; - g = parseInt(10 * d); + g = parseInt(10 * c); 50 < g && (g = 50); - return Entry.Robotis_carCont.postCallReturn(b, [[c, e, f, g], [c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3 * d); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g], [d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3 * c); }; Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setColour("#00979D"); @@ -5525,8 +5525,8 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { }}; Entry.block.robotis_openCM70_cm_buzzer_melody = function(a, b) { a = b.getField("CM_BUZZER_MELODY", b); - var d = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - return Entry.Robotis_carCont.postCallReturn(b, [[d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], 255], [d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3); + var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + return Entry.Robotis_carCont.postCallReturn(b, [[c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], 255], [c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3); }; Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -5548,9 +5548,9 @@ Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { }}; Entry.block.robotis_openCM70_cm_led = function(a, b) { a = b.getField("CM_LED", b); - var d = b.getField("VALUE", b), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0; + var c = b.getField("VALUE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0; "CM_LED_R" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == a && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); - return Entry.Robotis_carCont.postCallReturn(b, [[c, e, f, d]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setColour("#00979D"); @@ -5564,11 +5564,11 @@ Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { }}; Entry.block.robotis_openCM70_cm_motion = function(a, b) { a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - var d, c, e; - d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0]; - c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1]; + var c, d, e; + c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0]; + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1]; e = b.getNumberValue("VALUE", b); - return Entry.Robotis_carCont.postCallReturn(b, [[a, d, c, e]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, d, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -5581,11 +5581,11 @@ Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { }}; Entry.block.robotis_openCM70_aux_motor_speed = function(a, b) { a = b.getField("PORT", b); - var d = b.getField("DIRECTION_ANGLE", b), c = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0]; g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; - "CW" == d ? (c += 1024, 2047 < c && (c = 2047)) : 1023 < c && (c = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, c]], Entry.Robotis_openCM70.delay); + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setColour("#00979D"); @@ -5597,10 +5597,10 @@ Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { }}; Entry.block.robotis_openCM70_aux_servo_mode = function(a, b) { a = b.getField("PORT", b); - var d = b.getField("MODE", b), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + var c = b.getField("MODE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0]; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[c, e + (a - 1) * f, f, d]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setColour("#00979D"); @@ -5613,11 +5613,11 @@ Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { }}; Entry.block.robotis_openCM70_aux_servo_speed = function(a, b) { a = b.getField("PORT", b); - var d = b.getField("DIRECTION_ANGLE", b), c = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0]; g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; - "CW" == d ? (c += 1024, 2047 < c && (c = 2047)) : 1023 < c && (c = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, c]], Entry.Robotis_openCM70.delay); + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setColour("#00979D"); @@ -5630,11 +5630,11 @@ Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { }}; Entry.block.robotis_openCM70_aux_servo_position = function(a, b) { a = b.getField("PORT", b); - var d = b.getNumberValue("VALUE"), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0]; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; - 1023 < d ? d = 1023 : 0 > d && (d = 0); - return Entry.Robotis_carCont.postCallReturn(b, [[c, e + (a - 1) * f, f, d]], Entry.Robotis_openCM70.delay); + 1023 < c ? c = 1023 : 0 > c && (c = 0); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setColour("#00979D"); @@ -5647,10 +5647,10 @@ Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { }}; Entry.block.robotis_openCM70_aux_led_module = function(a, b) { a = b.getField("PORT", b); - var d = b.getField("LED_MODULE", b), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + var c = b.getField("LED_MODULE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0]; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[c, e + (a - 1) * f, f, d]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setColour("#00979D"); @@ -5663,10 +5663,10 @@ Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { }}; Entry.block.robotis_openCM70_aux_custom = function(a, b) { a = b.getField("PORT", b); - var d = b.getNumberValue("VALUE"), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0]; f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[c, e + (a - 1) * f, f, d]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setColour("#00979D"); @@ -5683,10 +5683,10 @@ Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { }}; Entry.block.robotis_openCM70_cm_custom = function(a, b) { a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - var d, c; - d = b.getNumberValue("ADDRESS"); - c = b.getNumberValue("VALUE"); - return Entry.Robotis_carCont.postCallReturn(b, [[a, d, 65535 < c ? 4 : 255 < c ? 2 : 1, c]], Entry.Robotis_openCM70.delay); + var c, d; + c = b.getNumberValue("ADDRESS"); + d = b.getNumberValue("VALUE"); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, 65535 < d ? 4 : 255 < d ? 2 : 1, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setColour("#00979D"); @@ -5697,15 +5697,15 @@ Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { }}; Entry.block.robotis_carCont_sensor_value = function(a, b) { a = Entry.Robotis_carCont.INSTRUCTION.READ; - var d = 0, c = 0, e = 0, f = 0; + var c = 0, d = 0, e = 0, f = 0; b = b.getStringField("SENSOR"); - "CM_SPRING_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : - "CM_SWITCH" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : - "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : - "CM_IR_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : - "CM_CALIBRATION_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == b && (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], - c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); - Entry.Robotis_carCont.setRobotisData([[a, d, c, 0, f]]); + "CM_SPRING_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : + "CM_SWITCH" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : + "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : + "CM_IR_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : + "CM_CALIBRATION_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == b && (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], + d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); return Entry.hw.portData[e]; }; @@ -5718,12 +5718,12 @@ Blockly.Blocks.robotis_carCont_cm_led = {init:function() { }}; Entry.block.robotis_carCont_cm_led = function(a, b) { a = b.getField("VALUE_LEFT", b); - var d = b.getField("VALUE_RIGHT", b), c = Entry.Robotis_carCont.INSTRUCTION.WRITE, e, f, g = 0; + var c = b.getField("VALUE_RIGHT", b), d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e, f, g = 0; e = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0]; f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; - 1 == a && 1 == d ? g = 9 : 1 == a && 0 == d && (g = 8); - 0 == a && 1 == d && (g = 1); - return Entry.Robotis_carCont.postCallReturn(b, [[c, e, f, g]], Entry.Robotis_carCont.delay); + 1 == a && 1 == c ? g = 9 : 1 == a && 0 == c && (g = 8); + 0 == a && 1 == c && (g = 1); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -5745,12 +5745,12 @@ Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setNextStatement(!0); }}; Entry.block.robotis_carCont_aux_motor_speed = function(a, b) { - var d = b.getField("DIRECTION", b); + var c = b.getField("DIRECTION", b); a = b.getField("DIRECTION_ANGLE", b); - var c = b.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f; - "LEFT" == d ? (d = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (d = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); - "CW" == a ? (c += 1024, 2047 < c && (c = 2047)) : 1023 < c && (c = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, d, f, c]], Entry.Robotis_carCont.delay); + var d = b.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); + "CW" == a ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, c, f, d]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setColour("#00979D"); @@ -5762,11 +5762,11 @@ Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setNextStatement(!0); }}; Entry.block.robotis_carCont_cm_calibration = function(a, b) { - var d = b.getField("DIRECTION", b); + var c = b.getField("DIRECTION", b); a = b.getNumberValue("VALUE"); - var c = Entry.Robotis_carCont.INSTRUCTION.WRITE, e; - "LEFT" == d ? (d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); - return Entry.Robotis_carCont.postCallReturn(b, [[c, d, e, a]], Entry.Robotis_carCont.delay); + var d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); + return Entry.Robotis_carCont.postCallReturn(b, [[d, c, e, a]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.when_scene_start = {init:function() { this.setColour("#3BBD70"); @@ -5799,10 +5799,10 @@ Blockly.Blocks.start_neighbor_scene = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.start_neighbor_scene = function(a, b) { - var d = Entry.scene.selectedScene; + var c = Entry.scene.selectedScene; a = Entry.scene.getScenes(); - d = a.indexOf(d); - "next" == b.getField("OPERATOR", b) ? d + 1 < a.length && (b = Entry.scene.getSceneById(a[d + 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")) : 0 < d && (b = Entry.scene.getSceneById(a[d - 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")); + c = a.indexOf(c); + "next" == b.getField("OPERATOR", b) ? c + 1 < a.length && (b = Entry.scene.getSceneById(a[c + 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (b = Entry.scene.getSceneById(a[c - 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")); return null; }; Blockly.Blocks.sound_something = {init:function() { @@ -5815,8 +5815,8 @@ Blockly.Blocks.sound_something = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.sound_something = function(a, b) { - var d = b.getField("VALUE", b); - Entry.isExist(d, "id", a.parent.sounds) && createjs.Sound.play(d); + var c = b.getField("VALUE", b); + Entry.isExist(c, "id", a.parent.sounds) && createjs.Sound.play(c); return b.callReturn(); }; Blockly.Blocks.sound_something_second = {init:function() { @@ -5831,12 +5831,12 @@ Blockly.Blocks.sound_something_second = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.sound_something_second = function(a, b) { - var d = b.getField("VALUE", b), c = b.getNumberValue("SECOND", b); - if (Entry.isExist(d, "id", a.parent.sounds)) { - var e = createjs.Sound.play(d); + var c = b.getField("VALUE", b), d = b.getNumberValue("SECOND", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { + var e = createjs.Sound.play(c); setTimeout(function() { e.stop(); - }, 1E3 * c); + }, 1E3 * d); } return b.callReturn(); }; @@ -5860,10 +5860,10 @@ Entry.block.sound_something_wait = function(a, b) { } b.isPlay = !0; b.playState = 1; - var d = b.getField("VALUE", b), c = a.parent.getSound(d); - Entry.isExist(d, "id", a.parent.sounds) && (createjs.Sound.play(d), setTimeout(function() { + var c = b.getField("VALUE", b), d = a.parent.getSound(c); + Entry.isExist(c, "id", a.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { b.playState = 0; - }, 1E3 * c.duration)); + }, 1E3 * d.duration)); return b; }; Blockly.Blocks.sound_something_second_wait = {init:function() { @@ -5888,15 +5888,15 @@ Entry.block.sound_something_second_wait = function(a, b) { } b.isPlay = !0; b.playState = 1; - var d = b.getField("VALUE", b); - if (Entry.isExist(d, "id", a.parent.sounds)) { - var c = createjs.Sound.play(d); + var c = b.getField("VALUE", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { + var d = createjs.Sound.play(c); a = b.getNumberValue("SECOND", b); setTimeout(function() { - c.stop(); + d.stop(); b.playState = 0; }, 1E3 * a); - c.addEventListener("complete", function(b) { + d.addEventListener("complete", function(b) { }); } return b; @@ -5966,8 +5966,8 @@ Blockly.Blocks.sound_something_with_block = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.sound_something_with_block = function(a, b) { - var d = b.getStringValue("VALUE", b); - (a = a.parent.getSound(d)) && createjs.Sound.play(a.id); + var c = b.getStringValue("VALUE", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id); return b.callReturn(); }; Blockly.Blocks.sound_something_second_with_block = {init:function() { @@ -5982,8 +5982,8 @@ Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.sound_something_second_with_block = function(a, b) { - var d = b.getStringValue("VALUE", b), c = b.getNumberValue("SECOND", b); - (a = a.parent.getSound(d)) && createjs.Sound.play(a.id, {startTime:0, duration:1E3 * c}); + var c = b.getStringValue("VALUE", b), d = b.getNumberValue("SECOND", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id, {startTime:0, duration:1E3 * d}); return b.callReturn(); }; Blockly.Blocks.sound_something_wait_with_block = {init:function() { @@ -6006,8 +6006,8 @@ Entry.block.sound_something_wait_with_block = function(a, b) { } b.isPlay = !0; b.playState = 1; - var d = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(d)) { + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { createjs.Sound.play(a.id), setTimeout(function() { b.playState = 0; }, 1E3 * a.duration); @@ -6036,15 +6036,15 @@ Entry.block.sound_something_second_wait_with_block = function(a, b) { } b.isPlay = !0; b.playState = 1; - var d = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(d)) { - var c = createjs.Sound.play(a.id); + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = createjs.Sound.play(a.id); a = b.getNumberValue("SECOND", b); setTimeout(function() { - c.stop(); + d.stop(); b.playState = 0; }, 1E3 * a); - c.addEventListener("complete", function(b) { + d.addEventListener("complete", function(b) { }); } return b; @@ -6063,10 +6063,10 @@ Blockly.Blocks.sound_from_to = {init:function() { this.setPreviousStatement(!0); }}; Entry.block.sound_from_to = function(a, b) { - var d = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(d)) { - var d = 1E3 * b.getNumberValue("START", b), c = 1E3 * b.getNumberValue("END", b); - createjs.Sound.play(a.id, {startTime:Math.min(d, c), duration:Math.max(d, c) - Math.min(d, c)}); + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var c = 1E3 * b.getNumberValue("START", b), d = 1E3 * b.getNumberValue("END", b); + createjs.Sound.play(a.id, {startTime:Math.min(c, d), duration:Math.max(c, d) - Math.min(c, d)}); } return b.callReturn(); }; @@ -6094,13 +6094,13 @@ Entry.block.sound_from_to_and_wait = function(a, b) { } b.isPlay = !0; b.playState = 1; - var d = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(d)) { - var c = 1E3 * b.getNumberValue("START", b), e = 1E3 * b.getNumberValue("END", b), d = Math.min(c, e), c = Math.max(c, e) - d; - createjs.Sound.play(a.id, {startTime:d, duration:c}); + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = 1E3 * b.getNumberValue("START", b), e = 1E3 * b.getNumberValue("END", b), c = Math.min(d, e), d = Math.max(d, e) - c; + createjs.Sound.play(a.id, {startTime:c, duration:d}); setTimeout(function() { b.playState = 0; - }, c); + }, d); } return b; }; @@ -6208,8 +6208,8 @@ Blockly.Blocks.message_cast = {init:function() { }}; Entry.block.message_cast = function(a, b) { a = b.getField("VALUE", b); - var d = Entry.isExist(a, "id", Entry.variableContainer.messages_); - if ("null" == a || !d) { + var c = Entry.isExist(a, "id", Entry.variableContainer.messages_); + if ("null" == a || !c) { throw Error("value can not be null or undefined"); } Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); @@ -6231,7 +6231,7 @@ Blockly.Blocks.message_cast_wait = {init:function() { Entry.block.message_cast_wait = function(a, b) { if (b.runningScript) { a = b.runningScript; - for (var d = a.length, c = 0;c < d;c++) { + for (var c = a.length, d = 0;d < c;d++) { var e = a.shift(); e && !e.isEnd() && a.push(e); } @@ -6242,9 +6242,9 @@ Entry.block.message_cast_wait = function(a, b) { if ("null" == a || !e) { throw Error("value can not be null or undefined"); } - d = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); - for (a = [];d.length;) { - (e = d.shift()) && (a = a.concat(e)); + c = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); + for (a = [];c.length;) { + (e = c.shift()) && (a = a.concat(e)); } b.runningScript = a; return b; @@ -6269,8 +6269,8 @@ Blockly.Blocks.text_write = {init:function() { this.setNextStatement(!0); }}; Entry.block.text_write = function(a, b) { - var d = b.getStringValue("VALUE", b), d = Entry.convertToRoundedDecimals(d, 3); - a.setText(d); + var c = b.getStringValue("VALUE", b), c = Entry.convertToRoundedDecimals(c, 3); + a.setText(c); return b.callReturn(); }; Blockly.Blocks.text_append = {init:function() { @@ -6283,8 +6283,8 @@ Blockly.Blocks.text_append = {init:function() { this.setNextStatement(!0); }}; Entry.block.text_append = function(a, b) { - var d = b.getStringValue("VALUE", b); - a.setText(Entry.convertToRoundedDecimals(a.getText(), 3) + Entry.convertToRoundedDecimals(d, 3)); + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(a.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); return b.callReturn(); }; Blockly.Blocks.text_prepend = {init:function() { @@ -6297,8 +6297,8 @@ Blockly.Blocks.text_prepend = {init:function() { this.setNextStatement(!0); }}; Entry.block.text_prepend = function(a, b) { - var d = b.getStringValue("VALUE", b); - a.setText(Entry.convertToRoundedDecimals(d, 3) + Entry.convertToRoundedDecimals(a.getText(), 3)); + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(a.getText(), 3)); return b.callReturn(); }; Blockly.Blocks.text_flush = {init:function() { @@ -6338,13 +6338,13 @@ Blockly.Blocks.change_variable = {init:function() { b && b.removeRef("_variableRefs", a); }}; Entry.block.change_variable = function(a, b) { - var d = b.getField("VARIABLE", b), c = b.getNumberValue("VALUE", b), c = Entry.parseNumber(c); - if (0 == c && "boolean" == typeof c) { + var c = b.getField("VARIABLE", b), d = b.getNumberValue("VALUE", b), d = Entry.parseNumber(d); + if (0 == d && "boolean" == typeof d) { throw Error("Type is not correct"); } - d = Entry.variableContainer.getVariable(d, a); - a = Entry.getMaxFloatPoint([c, d.getValue()]); - d.setValue((c + d.getValue()).toFixed(a)); + c = Entry.variableContainer.getVariable(c, a); + a = Entry.getMaxFloatPoint([d, c.getValue()]); + c.setValue((d + c.getValue()).toFixed(a)); return b.callReturn(); }; Blockly.Blocks.set_variable = {init:function() { @@ -6365,8 +6365,8 @@ Blockly.Blocks.set_variable = {init:function() { b && b.removeRef("_variableRefs", a); }}; Entry.block.set_variable = function(a, b) { - var d = b.getField("VARIABLE", b), c = b.getValue("VALUE", b); - Entry.variableContainer.getVariable(d, a).setValue(c); + var c = b.getField("VARIABLE", b), d = b.getValue("VALUE", b); + Entry.variableContainer.getVariable(c, a).setValue(d); return b.callReturn(); }; Blockly.Blocks.show_variable = {init:function() { @@ -6384,8 +6384,8 @@ Blockly.Blocks.show_variable = {init:function() { b && b.removeRef("_variableRefs", a); }}; Entry.block.show_variable = function(a, b) { - var d = b.getField("VARIABLE", b); - a = Entry.variableContainer.getVariable(d, a); + var c = b.getField("VARIABLE", b); + a = Entry.variableContainer.getVariable(c, a); a.setVisible(!0); a.updateView(); return b.callReturn(); @@ -6405,8 +6405,8 @@ Blockly.Blocks.hide_variable = {init:function() { b && b.removeRef("_variableRefs", a); }}; Entry.block.hide_variable = function(a, b) { - var d = b.getField("VARIABLE", b); - Entry.variableContainer.getVariable(d, a).setVisible(!1); + var c = b.getField("VARIABLE", b); + Entry.variableContainer.getVariable(c, a).setVisible(!1); return b.callReturn(); }; Blockly.Blocks.get_y = {init:function() { @@ -6445,24 +6445,24 @@ Blockly.Blocks.ask_and_wait = {init:function() { Entry.container && Entry.container.hideProjectAnswer(a); }}; Entry.block.ask_and_wait = function(a, b) { - var d = Entry.container.inputValue, c = Entry.stage.inputField, e = b.getValue("VALUE", b); + var c = Entry.container.inputValue, d = Entry.stage.inputField, e = b.getValue("VALUE", b); if (!e) { throw Error("message can not be empty"); } - if (d.sprite == a && c && !c._isHidden) { + if (c.sprite == a && d && !d._isHidden) { return b; } - if (d.sprite != a && b.isInit) { + if (c.sprite != a && b.isInit) { return a.dialog && a.dialog.remove(), delete b.isInit, b.callReturn(); } - if (d.complete && d.sprite == a && c._isHidden && b.isInit) { - return a.dialog && a.dialog.remove(), delete d.complete, delete b.isInit, b.callReturn(); + if (c.complete && c.sprite == a && d._isHidden && b.isInit) { + return a.dialog && a.dialog.remove(), delete c.complete, delete b.isInit, b.callReturn(); } e = Entry.convertToRoundedDecimals(e, 3); new Entry.Dialog(a, e, "speak"); Entry.stage.showInputField(); - d.script = b; - d.sprite = a; + c.script = b; + c.sprite = a; b.isInit = !0; return b; }; @@ -6498,10 +6498,10 @@ Blockly.Blocks.add_value_to_list = {init:function() { b && b.removeRef("_variableRefs", a); }}; Entry.block.add_value_to_list = function(a, b) { - var d = b.getField("LIST", b), c = b.getValue("VALUE", b); - a = Entry.variableContainer.getList(d, a); + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); a.array_ || (a.array_ = []); - a.array_.push({data:c}); + a.array_.push({data:d}); a.updateView(); return b.callReturn(); }; @@ -6517,12 +6517,12 @@ Blockly.Blocks.remove_value_from_list = {init:function() { this.setNextStatement(!0); }}; Entry.block.remove_value_from_list = function(a, b) { - var d = b.getField("LIST", b), c = b.getValue("VALUE", b); - a = Entry.variableContainer.getList(d, a); - if (!a.array_ || isNaN(c) || c > a.array_.length) { + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(d) || d > a.array_.length) { throw Error("can not remove value from array"); } - a.array_.splice(c - 1, 1); + a.array_.splice(d - 1, 1); a.updateView(); return b.callReturn(); }; @@ -6540,12 +6540,12 @@ Blockly.Blocks.insert_value_to_list = {init:function() { this.setNextStatement(!0); }}; Entry.block.insert_value_to_list = function(a, b) { - var d = b.getField("LIST", b), c = b.getValue("DATA", b), e = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(d, a); + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); if (!a.array_ || isNaN(e) || 0 == e || e > a.array_.length + 1) { throw Error("can not insert value to array"); } - a.array_.splice(e - 1, 0, {data:c}); + a.array_.splice(e - 1, 0, {data:d}); a.updateView(); return b.callReturn(); }; @@ -6563,12 +6563,12 @@ Blockly.Blocks.change_value_list_index = {init:function() { this.setNextStatement(!0); }}; Entry.block.change_value_list_index = function(a, b) { - var d = b.getField("LIST", b), c = b.getValue("DATA", b), e = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(d, a); + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); if (!a.array_ || isNaN(e) || e > a.array_.length) { throw Error("can not insert value to array"); } - a.array_[e - 1].data = c; + a.array_[e - 1].data = d; a.updateView(); return b.callReturn(); }; @@ -6583,9 +6583,9 @@ Blockly.Blocks.value_of_index_from_list = {init:function() { this.setInputsInline(!0); }}; Entry.block.value_of_index_from_list = function(a, b) { - var d = b.getField("LIST", b); + var c = b.getField("LIST", b); b = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(d, a); + a = Entry.variableContainer.getList(c, a); b = Entry.getListRealIndex(b, a); if (!a.array_ || isNaN(b) || b > a.array_.length) { throw Error("can not insert value to array"); @@ -6676,17 +6676,17 @@ Entry.block.is_included_in_list = function(a, b) { return !1; } a = a.array_; - for (var d = 0, c = a.length;d < c;d++) { - if (a[d].data.toString() == b.toString()) { + for (var c = 0, d = a.length;c < d;c++) { + if (a[c].data.toString() == b.toString()) { return !0; } } return !1; }; Entry.Xbot = {PORT_MAP:{rightWheel:0, leftWheel:0, head:90, armR:90, armL:90, analogD5:127, analogD6:127, D4:0, D7:0, D12:0, D13:0, ledR:0, ledG:0, ledB:0, lcdNum:0, lcdTxt:" ", note:262, duration:0}, setZero:function() { - var a = Entry.Xbot.PORT_MAP, b = Entry.hw.sendQueue, d; - for (d in a) { - b[d] = a[d]; + var a = Entry.Xbot.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); Entry.Xbot.removeAllTimeouts(); @@ -6734,11 +6734,11 @@ Blockly.Blocks.xbot_digitalOutput = {init:function() { }}; Entry.block.xbot_digitalOutput = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getStringField("DEVICE", b), c = b.getStringField("VALUE", b); - a.D13 = "D13" == d && "HIGH" == c ? 1 : 0; - a.D4 = "D4" == d && "HIGH" == c ? 1 : 0; - a.D7 = "D7" == d && "HIGH" == c ? 1 : 0; - a.D12 = "D12" == d && "HIGH" == c ? 1 : 0; + var c = b.getStringField("DEVICE", b), d = b.getStringField("VALUE", b); + a.D13 = "D13" == c && "HIGH" == d ? 1 : 0; + a.D4 = "D4" == c && "HIGH" == d ? 1 : 0; + a.D7 = "D7" == c && "HIGH" == d ? 1 : 0; + a.D12 = "D12" == c && "HIGH" == d ? 1 : 0; return b.callReturn(); }; Blockly.Blocks.xbot_analogOutput = {init:function() { @@ -6752,8 +6752,8 @@ Blockly.Blocks.xbot_analogOutput = {init:function() { }}; Entry.block.xbot_analogOutput = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getStringField("DEVICE", b), c = b.getNumberValue("VALUE", b); - "analogD5" == d ? a.analogD5 = c : "analogD6" == d && (a.analogD6 = c); + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "analogD5" == c ? a.analogD5 = d : "analogD6" == c && (a.analogD6 = d); return b.callReturn(); }; Blockly.Blocks.xbot_servo = {init:function() { @@ -6767,8 +6767,8 @@ Blockly.Blocks.xbot_servo = {init:function() { }}; Entry.block.xbot_servo = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getStringField("DEVICE", b), c = b.getNumberValue("VALUE", b); - "head" == d ? a.head = c : "right" == d ? a.armR = c : "left" == d && (a.armL = c); + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "head" == c ? a.head = d : "right" == c ? a.armR = d : "left" == c && (a.armL = d); return b.callReturn(); }; Blockly.Blocks.xbot_oneWheel = {init:function() { @@ -6782,8 +6782,8 @@ Blockly.Blocks.xbot_oneWheel = {init:function() { }}; Entry.block.xbot_oneWheel = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getStringField("DEVICE", b), c = b.getNumberValue("VALUE", b); - "rightWheel" == d ? a.rightWheel = c : "leftWheel" == d ? a.leftWheel = c : a.rightWheel = a.leftWheel = c; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "rightWheel" == c ? a.rightWheel = d : "leftWheel" == c ? a.leftWheel = d : a.rightWheel = a.leftWheel = d; return b.callReturn(); }; Blockly.Blocks.xbot_twoWheel = {init:function() { @@ -6832,10 +6832,10 @@ Blockly.Blocks.xbot_rgb_picker = {init:function() { }}; Entry.block.xbot_rgb_picker = function(a, b) { a = b.getStringField("VALUE"); - var d = Entry.hw.sendQueue; - d.ledR = parseInt(.3 * parseInt(a.substr(1, 2), 16)); - d.ledG = parseInt(.3 * parseInt(a.substr(3, 2), 16)); - d.ledB = parseInt(.3 * parseInt(a.substr(5, 2), 16)); + var c = Entry.hw.sendQueue; + c.ledR = parseInt(.3 * parseInt(a.substr(1, 2), 16)); + c.ledG = parseInt(.3 * parseInt(a.substr(3, 2), 16)); + c.ledB = parseInt(.3 * parseInt(a.substr(5, 2), 16)); return b.callReturn(); }; Blockly.Blocks.xbot_buzzer = {init:function() { @@ -6849,9 +6849,9 @@ Blockly.Blocks.xbot_buzzer = {init:function() { }}; Entry.block.xbot_buzzer = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getStringField("NOTE", b), c = b.getStringField("OCTAVE", b), e = b.getNumberValue("VALUE", b), d = d + c; - a.note = "C2" == d ? 65 : "D2" == d ? 73 : "E2" == d ? 82 : "F2" == d ? 87 : "G2" == d ? 98 : "A2" == d ? 110 : "B2" == d ? 123 : "C3" == d ? 131 : "D3" == d ? 147 : "E3" == d ? 165 : "F3" == d ? 175 : "G3" == d ? 196 : "A3" == d ? 220 : "B3" == d ? 247 : "C4" == d ? 262 : "D4" == d ? 294 : "E4" == d ? 330 : "F4" == d ? 349 : "G4" == d ? 392 : "A4" == d ? 440 : "B4" == d ? 494 : "C5" == d ? 523 : "D5" == d ? 587 : "E5" == d ? 659 : "F5" == d ? 698 : "G5" == d ? 784 : "A5" == d ? 880 : "B5" == d ? - 988 : "C6" == d ? 1047 : "D6" == d ? 1175 : "E6" == d ? 1319 : "F6" == d ? 1397 : "G6" == d ? 1568 : "A6" == d ? 1760 : "B6" == d ? 1976 : "C7" == d ? 2093 : "D7" == d ? 2349 : "E7" == d ? 2637 : "F7" == d ? 2794 : "G7" == d ? 3136 : "A7" == d ? 3520 : "B7" == d ? 3951 : 262; + var c = b.getStringField("NOTE", b), d = b.getStringField("OCTAVE", b), e = b.getNumberValue("VALUE", b), c = c + d; + a.note = "C2" == c ? 65 : "D2" == c ? 73 : "E2" == c ? 82 : "F2" == c ? 87 : "G2" == c ? 98 : "A2" == c ? 110 : "B2" == c ? 123 : "C3" == c ? 131 : "D3" == c ? 147 : "E3" == c ? 165 : "F3" == c ? 175 : "G3" == c ? 196 : "A3" == c ? 220 : "B3" == c ? 247 : "C4" == c ? 262 : "D4" == c ? 294 : "E4" == c ? 330 : "F4" == c ? 349 : "G4" == c ? 392 : "A4" == c ? 440 : "B4" == c ? 494 : "C5" == c ? 523 : "D5" == c ? 587 : "E5" == c ? 659 : "F5" == c ? 698 : "G5" == c ? 784 : "A5" == c ? 880 : "B5" == c ? + 988 : "C6" == c ? 1047 : "D6" == c ? 1175 : "E6" == c ? 1319 : "F6" == c ? 1397 : "G6" == c ? 1568 : "A6" == c ? 1760 : "B6" == c ? 1976 : "C7" == c ? 2093 : "D7" == c ? 2349 : "E7" == c ? 2637 : "F7" == c ? 2794 : "G7" == c ? 3136 : "A7" == c ? 3520 : "B7" == c ? 3951 : 262; a.duration = 40 * e; return b.callReturn(); }; @@ -6866,8 +6866,8 @@ Blockly.Blocks.xbot_lcd = {init:function() { }}; Entry.block.xbot_lcd = function(a, b) { a = Entry.hw.sendQueue; - var d = b.getNumberField("LINE", b), c = b.getStringValue("VALUE", b); - 0 == d ? (a.lcdNum = 0, a.lcdTxt = c) : 1 == d && (a.lcdNum = 1, a.lcdTxt = c); + var c = b.getNumberField("LINE", b), d = b.getStringValue("VALUE", b); + 0 == c ? (a.lcdNum = 0, a.lcdTxt = d) : 1 == c && (a.lcdNum = 1, a.lcdTxt = d); return b.callReturn(); }; Entry.Collection = function(a) { @@ -6899,14 +6899,14 @@ Entry.Collection = function(a) { b.push.call(this, a); }; a.unshift = function() { - for (var a = Array.prototype.slice.call(arguments, 0), c = this._hashMap, e = a.length - 1;0 <= e;e--) { + for (var a = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = a.length - 1;0 <= e;e--) { var f = a[e]; b.unshift.call(this, f); - c[f.id] = f; + d[f.id] = f; } }; - a.insert = function(a, c) { - b.splice.call(this, c, 0, a); + a.insert = function(a, d) { + b.splice.call(this, d, 0, a); this._hashMap[a.id] = a; }; a.has = function(b) { @@ -6928,16 +6928,16 @@ Entry.Collection = function(a) { return b.indexOf.call(this, a); }; a.find = function(b) { - for (var a = [], e, f = 0, g = this.length;f < g;f++) { - e = !0; + for (var a = [], c, f = 0, g = this.length;f < g;f++) { + c = !0; var h = this[f], k; for (k in b) { if (b[k] != h[k]) { - e = !1; + c = !1; break; } } - e && a.push(h); + c && a.push(h); } return a; }; @@ -6951,11 +6951,11 @@ Entry.Collection = function(a) { delete this._hashMap[a.id]; return a; }; - a.slice = function(a, c) { - a = b.slice.call(this, a, c); - c = this._hashMap; - for (var e in a) { - delete c[a[e].id]; + a.slice = function(a, d) { + a = b.slice.call(this, a, d); + d = this._hashMap; + for (var c in a) { + delete d[a[c].id]; } return a; }; @@ -6963,15 +6963,15 @@ Entry.Collection = function(a) { var a = this.indexOf(b); -1 < a && (delete this._hashMap[b.id], this.splice(a, 1)); }; - a.splice = function(a, c) { - var e = b.slice.call(arguments, 2), f = this._hashMap; - c = void 0 === c ? this.length - a : c; - for (var g = b.splice.call(this, a, c), h = 0, k = g.length;h < k;h++) { + a.splice = function(a, d) { + var c = b.slice.call(arguments, 2), f = this._hashMap; + d = void 0 === d ? this.length - a : d; + for (var g = b.splice.call(this, a, d), h = 0, k = g.length;h < k;h++) { delete f[g[h].id]; } h = 0; - for (k = e.length;h < k;h++) { - f = e[h], b.splice.call(this, a++, 0, f), this._hashMap[f.id] = f; + for (k = c.length;h < k;h++) { + f = c[h], b.splice.call(this, a++, 0, f), this._hashMap[f.id] = f; } return g; }; @@ -6982,14 +6982,14 @@ Entry.Collection = function(a) { this._hashMap = {}; }; a.map = function(b, a) { - for (var e = [], f = 0, g = this.length;f < g;f++) { - e.push(b(this[f], a)); + for (var c = [], d = 0, g = this.length;d < g;d++) { + c.push(b(this[d], a)); } - return e; + return c; }; - a.moveFromTo = function(a, c) { - var e = this.length - 1; - 0 > a || 0 > c || a > e || c > e || b.splice.call(this, c, 0, b.splice.call(this, a, 1)[0]); + a.moveFromTo = function(a, d) { + var c = this.length - 1; + 0 > a || 0 > d || a > c || d > c || b.splice.call(this, d, 0, b.splice.call(this, a, 1)[0]); }; a.sort = function() { }; @@ -7052,33 +7052,33 @@ Entry.Utils.generateId = function() { return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); }; Entry.Utils.intersectArray = function(a, b) { - for (var d = [], c = 0;c < a.length;c++) { + for (var c = [], d = 0;d < a.length;d++) { for (var e = 0;e < b.length;e++) { - if (a[c] == b[e]) { - d.push(a[c]); + if (a[d] == b[e]) { + c.push(a[d]); break; } } } - return d; + return c; }; -Entry.Utils.isPointInMatrix = function(a, b, d) { - d = void 0 === d ? 0 : d; - var c = a.offsetX ? a.x + a.offsetX : a.x, e = a.offsetY ? a.y + a.offsety : a.y; - return c - d <= b.x && c + a.width + d >= b.x && e - d <= b.y && e + a.height + d >= b.y; +Entry.Utils.isPointInMatrix = function(a, b, c) { + c = void 0 === c ? 0 : c; + var d = a.offsetX ? a.x + a.offsetX : a.x, e = a.offsetY ? a.y + a.offsety : a.y; + return d - c <= b.x && d + a.width + c >= b.x && e - c <= b.y && e + a.height + c >= b.y; }; Entry.Utils.colorDarken = function(a, b) { - function d(b) { + function c(b) { 2 != b.length && (b = "0" + b); return b; } - var c, e; - 7 === a.length ? (c = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (c = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + var d, e; + 7 === a.length ? (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); b = void 0 === b ? .7 : b; - c = d(Math.floor(c * b).toString(16)); - e = d(Math.floor(e * b).toString(16)); - a = d(Math.floor(a * b).toString(16)); - return "#" + c + e + a; + d = c(Math.floor(d * b).toString(16)); + e = c(Math.floor(e * b).toString(16)); + a = c(Math.floor(a * b).toString(16)); + return "#" + d + e + a; }; Entry.Utils.colorLighten = function(a, b) { b = 0 === b ? 0 : b || 20; @@ -7088,62 +7088,62 @@ Entry.Utils.colorLighten = function(a, b) { return Entry.Utils.hslToHex(a); }; Entry.Utils.bound01 = function(a, b) { - var d = a; - "string" == typeof d && -1 != d.indexOf(".") && 1 === parseFloat(d) && (a = "100%"); - d = "string" === typeof a && -1 != a.indexOf("%"); + var c = a; + "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (a = "100%"); + c = "string" === typeof a && -1 != a.indexOf("%"); a = Math.min(b, Math.max(0, parseFloat(a))); - d && (a = parseInt(a * b, 10) / 100); + c && (a = parseInt(a * b, 10) / 100); return 1E-6 > Math.abs(a - b) ? 1 : a % b / parseFloat(b); }; Entry.Utils.hexToHsl = function(a) { - var b, d; - 7 === a.length ? (b = parseInt(a.substr(1, 2), 16), d = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (b = parseInt(a.substr(1, 2), 16), d = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + var b, c; + 7 === a.length ? (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); b = Entry.Utils.bound01(b, 255); - d = Entry.Utils.bound01(d, 255); + c = Entry.Utils.bound01(c, 255); a = Entry.Utils.bound01(a, 255); - var c = Math.max(b, d, a), e = Math.min(b, d, a), f, g = (c + e) / 2; - if (c == e) { + var d = Math.max(b, c, a), e = Math.min(b, c, a), f, g = (d + e) / 2; + if (d == e) { f = e = 0; } else { - var h = c - e, e = .5 < g ? h / (2 - c - e) : h / (c + e); - switch(c) { + var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); + switch(d) { case b: - f = (d - a) / h + (d < a ? 6 : 0); + f = (c - a) / h + (c < a ? 6 : 0); break; - case d: + case c: f = (a - b) / h + 2; break; case a: - f = (b - d) / h + 4; + f = (b - c) / h + 4; } f /= 6; } return {h:360 * f, s:e, l:g}; }; Entry.Utils.hslToHex = function(a) { - function b(b, a, d) { - 0 > d && (d += 1); - 1 < d && --d; - return d < 1 / 6 ? b + 6 * (a - b) * d : .5 > d ? a : d < 2 / 3 ? b + (a - b) * (2 / 3 - d) * 6 : b; + function b(b, a, c) { + 0 > c && (c += 1); + 1 < c && --c; + return c < 1 / 6 ? b + 6 * (a - b) * c : .5 > c ? a : c < 2 / 3 ? b + (a - b) * (2 / 3 - c) * 6 : b; } - function d(b) { + function c(b) { return 1 == b.length ? "0" + b : "" + b; } - var c, e; + var d, e; e = Entry.Utils.bound01(a.h, 360); - c = Entry.Utils.bound01(a.s, 1); + d = Entry.Utils.bound01(a.s, 1); a = Entry.Utils.bound01(a.l, 1); - if (0 === c) { - c = a = e = a; + if (0 === d) { + d = a = e = a; } else { - var f = .5 > a ? a * (1 + c) : a + c - a * c, g = 2 * a - f; - c = b(g, f, e + 1 / 3); + var f = .5 > a ? a * (1 + d) : a + d - a * d, g = 2 * a - f; + d = b(g, f, e + 1 / 3); a = b(g, f, e); e = b(g, f, e - 1 / 3); } a *= 255; e *= 255; - return "#" + [d(Math.round(255 * c).toString(16)), d(Math.round(a).toString(16)), d(Math.round(e).toString(16))].join(""); + return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(a).toString(16)), c(Math.round(e).toString(16))].join(""); }; Entry.Utils.bindGlobalEvent = function(a) { var b = $(document); @@ -7232,16 +7232,16 @@ Entry.addEventListener = function(a, b) { Entry.dispatchEvent = function(a, b) { this.events_ || (this.events_ = {}); if (this.events_[a]) { - for (var d = 0, c = this.events_[a].length;d < c;d++) { - this.events_[a][d].call(window, b); + for (var c = 0, d = this.events_[a].length;c < d;c++) { + this.events_[a][c].call(window, b); } } }; Entry.removeEventListener = function(a, b) { if (this.events_[a]) { - for (var d = 0, c = this.events_[a].length;d < c;d++) { - if (this.events_[a][d] === b) { - this.events_[a].splice(d, 1); + for (var c = 0, d = this.events_[a].length;c < d;c++) { + if (this.events_[a][c] === b) { + this.events_[a].splice(c, 1); break; } } @@ -7256,27 +7256,27 @@ Entry.addTwoNumber = function(a, b) { } a += ""; b += ""; - var d = a.indexOf("."), c = b.indexOf("."), e = 0, f = 0; - 0 < d && (e = a.length - d - 1); - 0 < c && (f = b.length - c - 1); + var c = a.indexOf("."), d = b.indexOf("."), e = 0, f = 0; + 0 < c && (e = a.length - c - 1); + 0 < d && (f = b.length - d - 1); return 0 < e || 0 < f ? e >= f ? (parseFloat(a) + parseFloat(b)).toFixed(e) : (parseFloat(a) + parseFloat(b)).toFixed(f) : parseInt(a) + parseInt(b); }; Entry.hex2rgb = function(a) { return (a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a)) ? {r:parseInt(a[1], 16), g:parseInt(a[2], 16), b:parseInt(a[3], 16)} : null; }; -Entry.rgb2hex = function(a, b, d) { - return "#" + (16777216 + (a << 16) + (b << 8) + d).toString(16).slice(1); +Entry.rgb2hex = function(a, b, c) { + return "#" + (16777216 + (a << 16) + (b << 8) + c).toString(16).slice(1); }; Entry.generateRgb = function() { return {r:Math.floor(256 * Math.random()), g:Math.floor(256 * Math.random()), b:Math.floor(256 * Math.random())}; }; -Entry.adjustValueWithMaxMin = function(a, b, d) { - return a > d ? d : a < b ? b : a; +Entry.adjustValueWithMaxMin = function(a, b, c) { + return a > c ? c : a < b ? b : a; }; -Entry.isExist = function(a, b, d) { - for (var c = 0;c < d.length;c++) { - if (d[c][b] == a) { - return d[c]; +Entry.isExist = function(a, b, c) { + for (var d = 0;d < c.length;d++) { + if (c[d][b] == a) { + return c[d]; } } return !1; @@ -7288,8 +7288,8 @@ Entry.removeElement = function(a) { a && a.parentNode && a.parentNode.removeChild(a); }; Entry.getElementsByClassName = function(a) { - for (var b = [], d = document.getElementsByTagName("*"), c = 0;c < d.length;c++) { - -1 < (" " + d[c].className + " ").indexOf(" " + a + " ") && b.push(d[c]); + for (var b = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { + -1 < (" " + c[d].className + " ").indexOf(" " + a + " ") && b.push(c[d]); } return b; }; @@ -7297,18 +7297,18 @@ Entry.parseNumber = function(a) { return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a); }; Entry.countStringLength = function(a) { - var b, d = 0; + var b, c = 0; for (b = 0;b < a.length;b++) { - 255 < a.charCodeAt(b) ? d += 2 : d++; + 255 < a.charCodeAt(b) ? c += 2 : c++; } - return d; + return c; }; Entry.cutStringByLength = function(a, b) { - var d, c = 0; - for (d = 0;c < b && d < a.length;d++) { - 255 < a.charCodeAt(d) ? c += 2 : c++; + var c, d = 0; + for (c = 0;d < b && c < a.length;c++) { + 255 < a.charCodeAt(c) ? d += 2 : d++; } - return a.substr(0, d); + return a.substr(0, c); }; Entry.isChild = function(a, b) { if (!b) { @@ -7342,14 +7342,14 @@ Entry.bindAnimationCallback = function(a, b) { a.addEventListener("oanimationend", b, !1); }; Entry.cloneSimpleObject = function(a) { - var b = {}, d; - for (d in a) { - b[d] = a[d]; + var b = {}, c; + for (c in a) { + b[c] = a[c]; } return b; }; Entry.nodeListToArray = function(a) { - for (var b = Array(a.length), d = -1, c = a.length;++d !== c;b[d] = a[d]) { + for (var b = Array(a.length), c = -1, d = a.length;++c !== d;b[c] = a[c]) { } return b; }; @@ -7366,16 +7366,16 @@ Entry.isArrowOrBackspace = function(a) { return -1 < [37, 38, 39, 40, 8].indexOf(a); }; Entry.hexStringToBin = function(a) { - for (var b = [], d = 0;d < a.length - 1;d += 2) { - b.push(parseInt(a.substr(d, 2), 16)); + for (var b = [], c = 0;c < a.length - 1;c += 2) { + b.push(parseInt(a.substr(c, 2), 16)); } return String.fromCharCode.apply(String, b); }; -Entry.findObjsByKey = function(a, b, d) { - for (var c = [], e = 0;e < a.length;e++) { - a[e][b] == d && c.push(a[e]); +Entry.findObjsByKey = function(a, b, c) { + for (var d = [], e = 0;e < a.length;e++) { + a[e][b] == c && d.push(a[e]); } - return c; + return d; }; Entry.factorials = []; Entry.factorial = function(a) { @@ -7403,8 +7403,8 @@ Entry.toDegrees = function(a) { return 180 * a / Math.PI; }; Entry.getPicturesJSON = function(a) { - for (var b = [], d = 0, c = a.length;d < c;d++) { - var e = a[d], f = {}; + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; f._id = e._id; f.id = e.id; f.dimension = e.dimension; @@ -7417,8 +7417,8 @@ Entry.getPicturesJSON = function(a) { return b; }; Entry.getSoundsJSON = function(a) { - for (var b = [], d = 0, c = a.length;d < c;d++) { - var e = a[d], f = {}; + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; f._id = e._id; f.duration = e.duration; f.ext = e.ext; @@ -7437,16 +7437,16 @@ Entry.getBrowserType = function() { if (Entry.userAgent) { return Entry.userAgent; } - var a = navigator.userAgent, b, d = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if (/trident/i.test(d[1])) { + var a = navigator.userAgent, b, c = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if (/trident/i.test(c[1])) { return b = /\brv[ :]+(\d+)/g.exec(a) || [], "IE " + (b[1] || ""); } - if ("Chrome" === d[1] && (b = a.match(/\b(OPR|Edge)\/(\d+)/), null != b)) { + if ("Chrome" === c[1] && (b = a.match(/\b(OPR|Edge)\/(\d+)/), null != b)) { return b.slice(1).join(" ").replace("OPR", "Opera"); } - d = d[2] ? [d[1], d[2]] : [navigator.appName, navigator.appVersion, "-?"]; - null != (b = a.match(/version\/(\d+)/i)) && d.splice(1, 1, b[1]); - a = d.join(" "); + c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; + null != (b = a.match(/version\/(\d+)/i)) && c.splice(1, 1, b[1]); + a = c.join(" "); return Entry.userAgent = a; }; Entry.setBasicBrush = function(a) { @@ -7456,24 +7456,24 @@ Entry.setBasicBrush = function(a) { b.opacity = 100; b.setStrokeStyle(1); b.beginStroke("rgba(255,0,0,1)"); - var d = new createjs.Shape(b); - Entry.stage.selectedObjectContainer.addChild(d); + var c = new createjs.Shape(b); + Entry.stage.selectedObjectContainer.addChild(c); a.brush && (a.brush = null); a.brush = b; a.shape && (a.shape = null); - a.shape = d; + a.shape = c; }; Entry.setCloneBrush = function(a, b) { - var d = new createjs.Graphics; - d.thickness = b.thickness; - d.rgb = b.rgb; - d.opacity = b.opacity; - d.setStrokeStyle(d.thickness); - d.beginStroke("rgba(" + d.rgb.r + "," + d.rgb.g + "," + d.rgb.b + "," + d.opacity / 100 + ")"); - b = new createjs.Shape(d); + var c = new createjs.Graphics; + c.thickness = b.thickness; + c.rgb = b.rgb; + c.opacity = b.opacity; + c.setStrokeStyle(c.thickness); + c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); + b = new createjs.Shape(c); Entry.stage.selectedObjectContainer.addChild(b); a.brush && (a.brush = null); - a.brush = d; + a.brush = c; a.shape && (a.shape = null); a.shape = b; }; @@ -7484,42 +7484,42 @@ Entry.getStringIndex = function(a) { if (!a) { return ""; } - for (var b = {string:a, index:1}, d = 0, c = [], e = a.length - 1;0 < e;--e) { + for (var b = {string:a, index:1}, c = 0, d = [], e = a.length - 1;0 < e;--e) { var f = a.charAt(e); if (isNaN(f)) { break; } else { - c.unshift(f), d = e; + d.unshift(f), c = e; } } - 0 < d && (b.string = a.substring(0, d), b.index = parseInt(c.join("")) + 1); + 0 < c && (b.string = a.substring(0, c), b.index = parseInt(d.join("")) + 1); return b; }; -Entry.getOrderedName = function(a, b, d) { +Entry.getOrderedName = function(a, b, c) { if (!a) { return "untitled"; } if (!b || 0 === b.length) { return a; } - d || (d = "name"); - for (var c = 0, e = Entry.getStringIndex(a), f = 0, g = b.length;f < g;f++) { - var h = Entry.getStringIndex(b[f][d]); - e.string === h.string && h.index > c && (c = h.index); + c || (c = "name"); + for (var d = 0, e = Entry.getStringIndex(a), f = 0, g = b.length;f < g;f++) { + var h = Entry.getStringIndex(b[f][c]); + e.string === h.string && h.index > d && (d = h.index); } - return 0 < c ? e.string + c : a; + return 0 < d ? e.string + d : a; }; Entry.changeXmlHashId = function(a) { if (/function_field/.test(a.getAttribute("type"))) { - for (var b = a.getElementsByTagName("mutation"), d = 0, c = b.length;d < c;d++) { - b[d].setAttribute("hashid", Entry.generateHash()); + for (var b = a.getElementsByTagName("mutation"), c = 0, d = b.length;c < d;c++) { + b[c].setAttribute("hashid", Entry.generateHash()); } } return a; }; Entry.getMaxFloatPoint = function(a) { - for (var b = 0, d = 0, c = a.length;d < c;d++) { - var e = String(a[d]), f = e.indexOf("."); + for (var b = 0, c = 0, d = a.length;c < d;c++) { + var e = String(a[c]), f = e.indexOf("."); -1 !== f && (e = e.length - (f + 1), e > b && (b = e)); } return Math.min(b, 20); @@ -7527,13 +7527,13 @@ Entry.getMaxFloatPoint = function(a) { Entry.convertToRoundedDecimals = function(a, b) { return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b); }; -Entry.attachEventListener = function(a, b, d) { +Entry.attachEventListener = function(a, b, c) { setTimeout(function() { - a.addEventListener(b, d); + a.addEventListener(b, c); }, 0); }; -Entry.deAttachEventListener = function(a, b, d) { - a.removeEventListener(b, d); +Entry.deAttachEventListener = function(a, b, c) { + a.removeEventListener(b, c); }; Entry.isEmpty = function(a) { if (!a) { @@ -7562,10 +7562,10 @@ Entry.Utils.isTouchEvent = function(a) { return "mousedown" !== a.type.toLowerCase(); }; Entry.Utils.inherit = function(a, b) { - function d() { + function c() { } - d.prototype = a.prototype; - b.prototype = new d; + c.prototype = a.prototype; + b.prototype = new c; return b; }; Entry.bindAnimationCallbackOnce = function(a, b) { @@ -7579,16 +7579,16 @@ Entry.Utils.isFunction = function(a) { }; Entry.Utils.addFilters = function(a, b) { a = a.elem("defs"); - var d = a.elem("filter", {id:"entryTrashcanFilter_" + b}); - 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 = a.elem("filter", {id:"entryBlockShadowFilter_" + b, 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"}); + var c = a.elem("filter", {id:"entryTrashcanFilter_" + b}); + c.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); + c.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); + c = c.elem("feMerge"); + c.elem("feMergeNode", {"in":"offsetBlur"}); + c.elem("feMergeNode", {"in":"SourceGraphic"}, c); + c = a.elem("filter", {id:"entryBlockShadowFilter_" + b, height:"200%"}); + c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); + c.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"}); + c.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); b = a.elem("filter", {id:"entryBlockHighlightFilter_" + b}); b.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); b.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"}); @@ -7596,27 +7596,27 @@ Entry.Utils.addFilters = function(a, b) { Entry.Utils.addBlockPattern = function(a, b) { a = a.elem("pattern", {id:"blockHoverPattern_" + b, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}); b = a.elem("g"); - for (var d = b.elem("rect", {x:0, y:0, width:125, height:33}), c = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { - b.elem("image", {class:"pattern" + e, href:c.replace("(order)", e), x:0, y:0, width:125, height:33}); + for (var c = b.elem("rect", {x:0, y:0, width:125, height:33}), d = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { + b.elem("image", {class:"pattern" + e, href:d.replace("(order)", e), x:0, y:0, width:125, height:33}); } - return {pattern:a, rect:d}; + return {pattern:a, rect:c}; }; Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; Entry.Utils.createMouseEvent = function(a, b) { - var d = document.createEvent("MouseEvent"); - d.initMouseEvent(a, !0, !0, window, 0, 0, 0, b.clientX, b.clientY, !1, !1, !1, !1, 0, null); - return d; + var c = document.createEvent("MouseEvent"); + c.initMouseEvent(a, !0, !0, window, 0, 0, 0, b.clientX, b.clientY, !1, !1, !1, !1, 0, null); + return c; }; Entry.Utils.xmlToJsonData = function(a) { a = $.parseXML(a); var b = []; a = a.childNodes[0].childNodes; - for (var d in a) { - var c = a[d]; - if (c.tagName) { - var e = {category:c.getAttribute("id"), blocks:[]}, c = c.childNodes; - for (d in c) { - var f = c[d]; + for (var c in a) { + var d = a[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); } b.push(e); @@ -7624,12 +7624,12 @@ Entry.Utils.xmlToJsonData = function(a) { } return b; }; -Entry.Utils.stopProjectWithToast = function(a, b, d) { - var c = a.block; +Entry.Utils.stopProjectWithToast = function(a, b, c) { + var d = a.block; b = b || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; - Entry.toast && !d && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); + Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); Entry.engine && Entry.engine.toggleStop(); - "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? c = a.block.funcBlock : a.funcExecutor && (c = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), c && (Entry.container.selectObject(c.getCode().object.id, !0), c.view.getBoard().activateBlock(c))); + "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? d = a.block.funcBlock : a.funcExecutor && (d = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); throw Error(b); }; Entry.Utils.AsyncError = function(a) { @@ -7642,31 +7642,31 @@ Entry.Utils.isChrome = function() { return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); }; Entry.Utils.waitForWebfonts = function(a, b) { - for (var d = 0, c = 0, e = a.length;c < e;++c) { - (function(c) { + for (var c = 0, d = 0, e = a.length;d < e;++d) { + (function(d) { function e() { - h && h.offsetWidth != k && (++d, h.parentNode.removeChild(h), h = null); - if (d >= a.length && (l && clearInterval(l), d == a.length)) { + f && f.offsetWidth != k && (++c, f.parentNode.removeChild(f), f = null); + if (c >= a.length && (l && clearInterval(l), c == a.length)) { return b(), !0; } } - var h = document.createElement("span"); - h.innerHTML = "giItT1WQy@!-/#"; - h.style.position = "absolute"; - h.style.left = "-10000px"; - h.style.top = "-10000px"; - h.style.fontSize = "300px"; - h.style.fontFamily = "sans-serif"; - h.style.fontVariant = "normal"; - h.style.fontStyle = "normal"; - h.style.fontWeight = "normal"; - h.style.letterSpacing = "0"; - document.body.appendChild(h); - var k = h.offsetWidth; - h.style.fontFamily = c; + var f = document.createElement("span"); + f.innerHTML = "giItT1WQy@!-/#"; + f.style.position = "absolute"; + f.style.left = "-10000px"; + f.style.top = "-10000px"; + f.style.fontSize = "300px"; + f.style.fontFamily = "sans-serif"; + f.style.fontVariant = "normal"; + f.style.fontStyle = "normal"; + f.style.fontWeight = "normal"; + f.style.letterSpacing = "0"; + document.body.appendChild(f); + var k = f.offsetWidth; + f.style.fontFamily = d; var l; e() || (l = setInterval(e, 50)); - })(a[c]); + })(a[d]); } }; window.requestAnimFrame = function() { @@ -7695,10 +7695,10 @@ Entry.Utils.hasSpecialCharacter = function(a) { return /!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(a); }; Entry.Model = function(a, b) { - var d = Entry.Model; - d.generateSchema(a); - d.generateSetter(a); - d.generateObserve(a); + var c = Entry.Model; + c.generateSchema(a); + c.generateSetter(a); + c.generateObserve(a); (void 0 === b || b) && Object.seal(a); return a; }; @@ -7708,13 +7708,13 @@ Entry.Model = function(a, b) { if (void 0 !== a) { a = JSON.parse(JSON.stringify(a)); b.data = {}; - for (var c in a) { + for (var d in a) { (function(c) { b.data[c] = a[c]; Object.defineProperty(b, c, {get:function() { return b.data[c]; }}); - })(c); + })(d); } b._toJSON = this._toJSON; } @@ -7735,12 +7735,12 @@ Entry.Model = function(a, b) { b.unobserve = this.unobserve; b.notify = this.notify; }; - a.observe = function(b, a, c, e) { - c = new Entry.Observer(this.observers, b, a, c); + a.observe = function(b, a, d, e) { + d = new Entry.Observer(this.observers, b, a, d); if (!1 !== e) { b[a]([]); } - return c; + return d; }; a.unobserve = function(b) { b.destroy(); @@ -7748,11 +7748,11 @@ Entry.Model = function(a, b) { a.notify = function(b, a) { "string" === typeof b && (b = [b]); var c = this; - c.observers.map(function(e) { - var f = b; - void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, b)); - if (f.length) { - e.object[e.funcName](f.map(function(b) { + c.observers.map(function(d) { + var e = b; + void 0 !== d.attrs && (e = Entry.Utils.intersectArray(d.attrs, b)); + if (e.length) { + d.object[d.funcName](e.map(function(b) { return {name:b, object:c, oldValue:a[b]}; })); } @@ -7766,11 +7766,11 @@ Entry.Model = function(a, b) { return b; }; })(Entry.Model); -Entry.Observer = function(a, b, d, c) { +Entry.Observer = function(a, b, c, d) { this.parent = a; this.object = b; - this.funcName = d; - this.attrs = c; + this.funcName = c; + this.attrs = d; a.push(this); }; (function(a) { @@ -7807,28 +7807,28 @@ Entry.Commander = function(a) { }; (function(a) { a.do = function(b) { - var a = this, c = Array.prototype.slice.call(arguments); - c.shift(); + var a = this, d = Array.prototype.slice.call(arguments); + d.shift(); var e = Entry.Command[b]; - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, e.undo].concat(e.state.apply(this, c))); - e = Entry.Command[b].do.apply(this, c); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, e.undo].concat(e.state.apply(this, d))); + e = Entry.Command[b].do.apply(this, d); setTimeout(function() { a.report("do"); - a.report(b, c); + a.report(b, d); }, 0); return {value:e, isPass:this.isPass.bind(this)}; }; a.undo = function() { - var b = Array.prototype.slice.call(arguments), a = b.shift(), c = Entry.Command[a]; + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; this.report("undo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, c.undo].concat(c.state.apply(this, b))); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, d.undo].concat(d.state.apply(this, b))); return {value:Entry.Command[a].do.apply(this, b), isPass:this.isPass.bind(this)}; }; a.redo = function() { - var b = Array.prototype.slice.call(arguments), a = b.shift(), c = Entry.Command[a]; + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; that.report("redo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.undo, a].concat(c.state.apply(null, b))); - c.undo.apply(this, b); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.undo, a].concat(d.state.apply(null, b))); + d.undo.apply(this, b); }; a.setCurrentEditor = function(b, a) { this.editor[b] = a; @@ -7894,13 +7894,13 @@ Entry.Commander = function(a) { }, state:function(b) { "string" !== typeof b && (b = b.id); return [b]; - }, log:function(b, d) { + }, log:function(b, c) { b = this.editor.board.findById(b.id); - return [a.recoverBlock.type, ["block", b.stringify()], ["pointer", d], ["code", this.editor.board.code.stringify()]]; + return [a.recoverBlock.type, ["block", b.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; }, undo:"destroyBlock"}; - a.insertBlock = {type:Entry.STATIC.COMMAND_TYPES.insertBlock, do:function(b, a, c) { + a.insertBlock = {type:Entry.STATIC.COMMAND_TYPES.insertBlock, do:function(b, a, d) { "string" === typeof b && (b = this.editor.board.findById(b)); - this.editor.board.insert(b, a, c); + this.editor.board.insert(b, a, d); }, state:function(b, a) { "string" === typeof b && (b = this.editor.board.findById(b)); a = [b.id]; @@ -7908,28 +7908,28 @@ Entry.Commander = function(a) { a.push(c); "string" !== typeof b && "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); return a; - }, log:function(b, d, c) { + }, log:function(b, c, d) { "string" === typeof b && (b = this.editor.board.findById(b)); - return [a.insertBlock.type, ["blockId", b.id], ["targetPointer", b.targetPointer()], ["count", c], ["code", this.editor.board.code.stringify()]]; + return [a.insertBlock.type, ["blockId", b.id], ["targetPointer", b.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; }, undo:"insertBlock"}; a.separateBlock = {type:Entry.STATIC.COMMAND_TYPES.separateBlock, do:function(b) { b.view && b.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); b.doSeparate(); }, state:function(b) { - var a = [b.id], c = b.targetPointer(); - a.push(c); + var a = [b.id], d = b.targetPointer(); + a.push(d); "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); return a; }, log:function(b) { "string" === typeof b && (b = this.editor.board.findById(b)); return [a.separateBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; }, undo:"insertBlock"}; - a.moveBlock = {type:Entry.STATIC.COMMAND_TYPES.moveBlock, do:function(b, a, c) { - void 0 !== a ? (b = this.editor.board.findById(b), b.moveTo(a, c)) : b._updatePos(); + a.moveBlock = {type:Entry.STATIC.COMMAND_TYPES.moveBlock, do:function(b, a, d) { + void 0 !== a ? (b = this.editor.board.findById(b), b.moveTo(a, d)) : b._updatePos(); }, state:function(b) { "string" === typeof b && (b = this.editor.board.findById(b)); return [b.id, b.x, b.y]; - }, log:function(b, d, c) { + }, log:function(b, c, d) { return [a.moveBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; }, undo:"moveBlock"}; a.cloneBlock = {type:Entry.STATIC.COMMAND_TYPES.cloneBlock, do:function(b) { @@ -7940,8 +7940,8 @@ Entry.Commander = function(a) { return [b]; }, log:function(b) { "string" === typeof b && (b = this.editor.board.findById(b)); - var d = this.editor.board.code.getThreads().pop(); - return [a.cloneBlock.type, ["blockId", b.id], ["thread", d.stringify()], ["code", this.editor.board.code.stringify()]]; + var c = this.editor.board.code.getThreads().pop(); + return [a.cloneBlock.type, ["blockId", b.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; }, undo:"uncloneBlock"}; a.uncloneBlock = {type:Entry.STATIC.COMMAND_TYPES.uncloneBlock, do:function(b) { b = this.editor.board.code.getThreads().pop().getFirstBlock(); @@ -7954,20 +7954,20 @@ Entry.Commander = function(a) { this._tempStorage = null; return [a.uncloneBlock.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; }, undo:"cloneBlock"}; - a.scrollBoard = {type:Entry.STATIC.COMMAND_TYPES.scrollBoard, do:function(b, a, c) { - c || this.editor.board.scroller._scroll(b, a); + a.scrollBoard = {type:Entry.STATIC.COMMAND_TYPES.scrollBoard, do:function(b, a, d) { + d || this.editor.board.scroller._scroll(b, a); delete this.editor.board.scroller._diffs; }, state:function(b, a) { return [-b, -a]; - }, log:function(b, d) { - return [a.scrollBoard.type, ["dx", b], ["dy", d]]; + }, log:function(b, c) { + return [a.scrollBoard.type, ["dx", b], ["dy", c]]; }, undo:"scrollBoard"}; - a.setFieldValue = {type:Entry.STATIC.COMMAND_TYPES.setFieldValue, do:function(b, a, c, e, f) { + a.setFieldValue = {type:Entry.STATIC.COMMAND_TYPES.setFieldValue, do:function(b, a, d, e, f) { a.setValue(f, !0); - }, state:function(b, a, c, e, f) { - return [b, a, c, f, e]; - }, log:function(b, d, c, e, f) { - return [a.setFieldValue.type, ["pointer", c], ["newValue", f], ["code", this.editor.board.code.stringify()]]; + }, state:function(b, a, d, e, f) { + return [b, a, d, f, e]; + }, log:function(b, c, d, e, f) { + return [a.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; }, undo:"setFieldValue"}; })(Entry.Command); (function(a) { @@ -8014,7 +8014,7 @@ Entry.Container = function() { this.currentObjects_ = this.copiedObject = null; }; Entry.Container.prototype.generateView = function(a, b) { - var d = this; + var c = this; this._view = a; this._view.addClass("entryContainer"); this._view.addClass("entryContainerWorkspace"); @@ -8034,19 +8034,19 @@ Entry.Container.prototype.generateView = function(a, b) { function a(b) { m && 5 < Math.sqrt(Math.pow(b.pageX - m.x, 2) + Math.pow(b.pageY - m.y, 2)) && g && (clearTimeout(g), g = null); } - function f(b) { + function d(b) { b.stopPropagation(); h.unbind(".container"); g && (clearTimeout(g), g = null); } var g = null, h = $(document), k = b.type, l = !1; if (Entry.Utils.isRightButton(b)) { - d._rightClick(b), l = !0; + c._rightClick(b), l = !0; } else { var m = {x:b.clientX, y:b.clientY}; "touchstart" !== k || l || (b.stopPropagation(), b = Entry.Utils.convertMouseEvent(b), g = setTimeout(function() { - g && (g = null, d._rightClick(b)); - }, 1E3), h.bind("mousemove.container touchmove.container", a), h.bind("mouseup.container touchend.container", f)); + g && (g = null, c._rightClick(b)); + }, 1E3), h.bind("mousemove.container touchmove.container", a), h.bind("mouseup.container touchend.container", d)); } }); this._view.appendChild(a); @@ -8073,22 +8073,22 @@ Entry.Container.prototype.updateListView = function() { for (var a = this.listView_;a.hasChildNodes();) { a.removeChild(a.lastChild); } - var b = this.getCurrentObjects(), d; - for (d in b) { - a.appendChild(b[d].view_); + var b = this.getCurrentObjects(), c; + for (c in b) { + a.appendChild(b[c].view_); } Entry.stage.sortZorder(); } }; Entry.Container.prototype.setObjects = function(a) { for (var b in a) { - var d = new Entry.EntryObject(a[b]); - this.objects_.push(d); - d.generateView(); - d.pictures.map(function(b) { + var c = new Entry.EntryObject(a[b]); + this.objects_.push(c); + c.generateView(); + c.pictures.map(function(b) { Entry.playground.generatePictureElement(b); }); - d.sounds.map(function(b) { + c.sounds.map(function(b) { Entry.playground.generateSoundElement(b); }); } @@ -8106,17 +8106,17 @@ Entry.Container.prototype.getPictureElement = function(a, b) { throw Error("No picture found"); }; Entry.Container.prototype.setPicture = function(a) { - var b = this.getObject(a.objectId), d; - for (d in b.pictures) { - if (a.id === b.pictures[d].id) { - var c = {}; - c.dimension = a.dimension; - c.id = a.id; - c.filename = a.filename; - c.fileurl = a.fileurl; - c.name = a.name; - c.view = b.pictures[d].view; - b.pictures[d] = c; + var b = this.getObject(a.objectId), c; + for (c in b.pictures) { + if (a.id === b.pictures[c].id) { + var d = {}; + d.dimension = a.dimension; + d.id = a.id; + d.filename = a.filename; + d.fileurl = a.fileurl; + d.name = a.name; + d.view = b.pictures[c].view; + b.pictures[c] = d; return; } } @@ -8130,37 +8130,37 @@ Entry.Container.prototype.selectPicture = function(a, b) { throw Error("No picture found"); }; Entry.Container.prototype.addObject = function(a, b) { - var d = new Entry.EntryObject(a); - d.name = Entry.getOrderedName(d.name, this.objects_); - Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, d); - d.scene || (d.scene = Entry.scene.selectedScene); - "number" == typeof b ? a.sprite.category && "background" == a.sprite.category.main ? (d.setLock(!0), this.objects_.push(d)) : this.objects_.splice(b, 0, d) : a.sprite.category && "background" == a.sprite.category.main ? this.objects_.push(d) : this.objects_.unshift(d); - d.generateView(); - d.pictures.map(function(b) { + var c = new Entry.EntryObject(a); + c.name = Entry.getOrderedName(c.name, this.objects_); + Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); + c.scene || (c.scene = Entry.scene.selectedScene); + "number" == typeof b ? a.sprite.category && "background" == a.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(b, 0, c) : a.sprite.category && "background" == a.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); + c.generateView(); + c.pictures.map(function(b) { Entry.playground.generatePictureElement(b); }); - d.sounds.map(function(b) { + c.sounds.map(function(b) { Entry.playground.generateSoundElement(b); }); this.setCurrentObjects(); this.updateObjectsOrder(); this.updateListView(); - this.selectObject(d.id); + this.selectObject(c.id); Entry.variableContainer.updateViews(); - return new Entry.State(this, this.removeObject, d); + return new Entry.State(this, this.removeObject, c); }; Entry.Container.prototype.addCloneObject = function(a, b) { a = a.toJSON(); - var d = Entry.generateHash(); - Entry.variableContainer.addCloneLocalVariables({objectId:a.id, newObjectId:d, json:a}); - a.id = d; + var c = Entry.generateHash(); + Entry.variableContainer.addCloneLocalVariables({objectId:a.id, newObjectId:c, json:a}); + a.id = c; a.scene = b || Entry.scene.selectedScene; this.addObject(a); }; Entry.Container.prototype.removeObject = function(a) { - var b = this.objects_.indexOf(a), d = a.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, d, b); - d = new Entry.State(this.addObject, d, b); + var b = this.objects_.indexOf(a), c = a.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, b); + c = new Entry.State(this.addObject, c, b); a.destroy(); this.objects_.splice(b, 1); this.setCurrentObjects(); @@ -8169,7 +8169,7 @@ Entry.Container.prototype.removeObject = function(a) { Entry.toast.success(Lang.Workspace.remove_object, a.name + " " + Lang.Workspace.remove_object_msg); Entry.variableContainer.removeLocalVariables(a.id); Entry.playground.reloadPlayground(); - return d; + return c; }; Entry.Container.prototype.selectObject = function(a, b) { a = this.getObject(a); @@ -8187,10 +8187,10 @@ Entry.Container.prototype.getAllObjects = function() { }; Entry.Container.prototype.getObject = function(a) { !a && Entry.playground && Entry.playground.object && (a = Entry.playground.object.id); - for (var b = this.objects_.length, d = 0;d < b;d++) { - var c = this.objects_[d]; - if (c.id == a) { - return c; + for (var b = this.objects_.length, c = 0;c < b;c++) { + var d = this.objects_[c]; + if (d.id == a) { + return d; } } }; @@ -8202,18 +8202,18 @@ Entry.Container.prototype.getEntity = function(a) { }; Entry.Container.prototype.getVariable = function(a) { for (var b = 0;b < this.variables_.length;b++) { - var d = this.variables_[b]; - if (d.getId() == a || d.getName() == a) { - return d; + var c = this.variables_[b]; + if (c.getId() == a || c.getName() == a) { + return c; } } }; -Entry.Container.prototype.moveElement = function(a, b, d) { - var c; - c = this.getCurrentObjects(); - a = this.getAllObjects().indexOf(c[a]); - b = this.getAllObjects().indexOf(c[b]); - !d && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, b, a, !0); +Entry.Container.prototype.moveElement = function(a, b, c) { + var d; + d = this.getCurrentObjects(); + a = this.getAllObjects().indexOf(d[a]); + b = this.getAllObjects().indexOf(d[b]); + !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, b, a, !0); this.objects_.splice(b, 0, this.objects_.splice(a, 1)[0]); this.setCurrentObjects(); Entry.container.updateListView(); @@ -8227,42 +8227,42 @@ Entry.Container.prototype.moveElementByBlock = function(a, b) { this.updateListView(); }; Entry.Container.prototype.getDropdownList = function(a, b) { - var d = []; + var c = []; switch(a) { case "sprites": - var c = this.getCurrentObjects(), e = c.length; + var d = this.getCurrentObjects(), e = d.length; for (a = 0;a < e;a++) { - b = c[a], d.push([b.name, b.id]); + b = d[a], c.push([b.name, b.id]); } break; case "spritesWithMouse": - c = this.getCurrentObjects(); - e = c.length; + d = this.getCurrentObjects(); + e = d.length; for (a = 0;a < e;a++) { - b = c[a], d.push([b.name, b.id]); + b = d[a], c.push([b.name, b.id]); } - d.push([Lang.Blocks.mouse_pointer, "mouse"]); + c.push([Lang.Blocks.mouse_pointer, "mouse"]); break; case "spritesWithSelf": - c = this.getCurrentObjects(); - e = c.length; + d = this.getCurrentObjects(); + e = d.length; for (a = 0;a < e;a++) { - b = c[a], d.push([b.name, b.id]); + b = d[a], c.push([b.name, b.id]); } - d.push([Lang.Blocks.self, "self"]); + c.push([Lang.Blocks.self, "self"]); break; case "collision": - d.push([Lang.Blocks.mouse_pointer, "mouse"]); - c = this.getCurrentObjects(); - e = c.length; + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + d = this.getCurrentObjects(); + e = d.length; for (a = 0;a < e;a++) { - b = c[a], d.push([b.name, b.id]); + b = d[a], c.push([b.name, b.id]); } - d.push([Lang.Blocks.wall, "wall"]); - d.push([Lang.Blocks.wall_up, "wall_up"]); - d.push([Lang.Blocks.wall_down, "wall_down"]); - d.push([Lang.Blocks.wall_right, "wall_right"]); - d.push([Lang.Blocks.wall_left, "wall_left"]); + c.push([Lang.Blocks.wall, "wall"]); + c.push([Lang.Blocks.wall_up, "wall_up"]); + c.push([Lang.Blocks.wall_down, "wall_down"]); + c.push([Lang.Blocks.wall_right, "wall_right"]); + c.push([Lang.Blocks.wall_left, "wall_left"]); break; case "pictures": b = Entry.playground.object || b; @@ -8271,34 +8271,34 @@ Entry.Container.prototype.getDropdownList = function(a, b) { } b = b.pictures; for (a = 0;a < b.length;a++) { - c = b[a], d.push([c.name, c.id]); + d = b[a], c.push([d.name, d.id]); } break; case "messages": b = Entry.variableContainer.messages_; for (a = 0;a < b.length;a++) { - c = b[a], d.push([c.name, c.id]); + d = b[a], c.push([d.name, d.id]); } break; case "variables": b = Entry.variableContainer.variables_; for (a = 0;a < b.length;a++) { - c = b[a], c.object_ && Entry.playground.object && c.object_ != Entry.playground.object.id || d.push([c.getName(), c.getId()]); + d = b[a], d.object_ && Entry.playground.object && d.object_ != Entry.playground.object.id || c.push([d.getName(), d.getId()]); } - d && 0 !== d.length || d.push([Lang.Blocks.VARIABLE_variable, "null"]); + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); break; case "lists": b = Entry.playground.object || b; - c = Entry.variableContainer.lists_; - for (a = 0;a < c.length;a++) { - e = c[a], e.object_ && b && e.object_ != b.id || d.push([e.getName(), e.getId()]); + d = Entry.variableContainer.lists_; + for (a = 0;a < d.length;a++) { + e = d[a], e.object_ && b && e.object_ != b.id || c.push([e.getName(), e.getId()]); } - d && 0 !== d.length || d.push([Lang.Blocks.VARIABLE_list, "null"]); + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); break; case "scenes": b = Entry.scene.scenes_; for (a = 0;a < b.length;a++) { - c = b[a], d.push([c.name, c.id]); + d = b[a], c.push([d.name, d.id]); } break; case "sounds": @@ -8308,24 +8308,24 @@ Entry.Container.prototype.getDropdownList = function(a, b) { } b = b.sounds; for (a = 0;a < b.length;a++) { - c = b[a], d.push([c.name, c.id]); + d = b[a], c.push([d.name, d.id]); } break; case "clone": - d.push([Lang.Blocks.oneself, "self"]); + c.push([Lang.Blocks.oneself, "self"]); e = this.objects_.length; for (a = 0;a < e;a++) { - b = this.objects_[a], d.push([b.name, b.id]); + b = this.objects_[a], c.push([b.name, b.id]); } break; case "objectSequence": for (e = this.getCurrentObjects().length, a = 0;a < e;a++) { - d.push([(a + 1).toString(), a.toString()]); + c.push([(a + 1).toString(), a.toString()]); } ; } - d.length || (d = [[Lang.Blocks.no_target, "null"]]); - return d; + c.length || (c = [[Lang.Blocks.no_target, "null"]]); + return c; }; Entry.Container.prototype.clearRunningState = function() { this.mapObject(function(a) { @@ -8337,14 +8337,14 @@ Entry.Container.prototype.clearRunningState = function() { }); }; Entry.Container.prototype.mapObject = function(a, b) { - for (var d = this.objects_.length, c = [], e = 0;e < d;e++) { - c.push(a(this.objects_[e], b)); + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e], b)); } - return c; + return d; }; Entry.Container.prototype.mapObjectOnScene = function(a, b) { - for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { - e.push(a(d[f], b)); + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f], b)); } return e; }; @@ -8358,20 +8358,20 @@ Entry.Container.prototype.clearRunningStateOnScene = function() { }); }; Entry.Container.prototype.mapEntity = function(a, b) { - for (var d = this.objects_.length, c = [], e = 0;e < d;e++) { - c.push(a(this.objects_[e].entity, b)); + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e].entity, b)); } - return c; + return d; }; Entry.Container.prototype.mapEntityOnScene = function(a, b) { - for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { - e.push(a(d[f].entity, b)); + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f].entity, b)); } return e; }; Entry.Container.prototype.mapEntityIncludeClone = function(a, b) { - for (var d = this.objects_, c = d.length, e = [], f = 0;f < c;f++) { - var g = d[f], h = g.clonedEntities.length; + for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; e.push(a(g.entity, b)); for (var k = 0;k < h;k++) { var l = g.clonedEntities[k]; @@ -8381,8 +8381,8 @@ Entry.Container.prototype.mapEntityIncludeClone = function(a, b) { return e; }; Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(a, b) { - for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { - var g = d[f], h = g.clonedEntities.length; + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; e.push(a(g.entity, b)); for (var k = 0;k < h;k++) { var l = g.clonedEntities[k]; @@ -8399,21 +8399,21 @@ Entry.Container.prototype.cachePicture = function(a, b) { this.cachedPicture[a] = b; }; Entry.Container.prototype.toJSON = function() { - for (var a = [], b = this.objects_.length, d = 0;d < b;d++) { - a.push(this.objects_[d].toJSON()); + for (var a = [], b = this.objects_.length, c = 0;c < b;c++) { + a.push(this.objects_[c].toJSON()); } return a; }; Entry.Container.prototype.takeSequenceSnapshot = function() { - for (var a = this.objects_.length, b = this.objects_, d = 0;d < a;d++) { - b[d].index = d; + for (var a = this.objects_.length, b = this.objects_, c = 0;c < a;c++) { + b[c].index = c; } }; Entry.Container.prototype.loadSequenceSnapshot = function() { - for (var a = this.objects_.length, b = Array(a), d = 0;d < a;d++) { - var c = this.objects_[d]; - b[c.index || d] = c; - delete c.index; + for (var a = this.objects_.length, b = Array(a), c = 0;c < a;c++) { + var d = this.objects_[c]; + b[d.index || c] = d; + delete d.index; } this.objects_ = b; this.setCurrentObjects(); @@ -8440,17 +8440,17 @@ Entry.Container.prototype.setCopiedObject = function(a) { this.copiedObject = a; }; Entry.Container.prototype.updateObjectsOrder = function() { - for (var a = Entry.scene.getScenes(), b = [], d = 0;d < a.length;d++) { - for (var c = this.getSceneObjects(a[d]), e = 0;e < c.length;e++) { - b.push(c[e]); + for (var a = Entry.scene.getScenes(), b = [], c = 0;c < a.length;c++) { + for (var d = this.getSceneObjects(a[c]), e = 0;e < d.length;e++) { + b.push(d[e]); } } this.objects_ = b; }; Entry.Container.prototype.getSceneObjects = function(a) { a = a || Entry.scene.selectedScene; - for (var b = [], d = this.getAllObjects(), c = 0;c < d.length;c++) { - a.id == d[c].scene.id && b.push(d[c]); + for (var b = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { + a.id == c[d].scene.id && b.push(c[d]); } return b; }; @@ -8472,7 +8472,7 @@ Entry.Container.prototype.getProjectWithJSON = function(a) { Entry.Container.prototype.blurAllInputs = function() { this.getSceneObjects().map(function(a) { a = a.view_.getElementsByTagName("input"); - for (var b = 0, d = a.length;b < d;b++) { + for (var b = 0, c = a.length;b < c;b++) { a[b].blur(); } }); @@ -8483,9 +8483,9 @@ Entry.Container.prototype.showProjectAnswer = function() { }; Entry.Container.prototype.hideProjectAnswer = function(a) { if ((a = this.inputValue) && a.isVisible() && !Entry.engine.isState("run")) { - for (var b = Entry.container.getAllObjects(), d = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], c = 0, e = b.length;c < e;c++) { - for (var f = b[c].script, g = 0;g < d.length;g++) { - if (f.hasBlockType(d[g])) { + for (var b = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { + if (f.hasBlockType(c[g])) { return; } } @@ -8535,20 +8535,20 @@ Entry.db = {data:{}, typeMap:{}}; }; })(Entry.db); Entry.Dom = function(a, b) { - var d = /<(\w+)>/, c; - c = a instanceof HTMLElement ? $(a) : a instanceof jQuery ? a : d.test(a) ? $(a) : $("<" + a + ">"); + var c = /<(\w+)>/, d; + d = a instanceof HTMLElement ? $(a) : a instanceof jQuery ? a : c.test(a) ? $(a) : $("<" + a + ">"); if (void 0 === b) { - return c; + return d; } - b.id && c.attr("id", b.id); - b.class && c.addClass(b.class); + b.id && d.attr("id", b.id); + b.class && d.addClass(b.class); b.classes && b.classes.map(function(b) { - c.addClass(b); + d.addClass(b); }); - b.src && c.attr("src", b.src); - b.parent && b.parent.append(c); - c.bindOnClick = function() { - var b, a, d = function(b) { + b.src && d.attr("src", b.src); + b.parent && b.parent.append(d); + d.bindOnClick = function() { + var b, a, c = function(b) { b.stopImmediatePropagation(); b.handled || (b.handled = !0, a.call(this, b)); }; @@ -8556,12 +8556,12 @@ Entry.Dom = function(a, b) { }, b = "string" === typeof arguments[0] ? arguments[0] : "") : a = arguments[0] instanceof Function ? arguments[0] : function() { }; if (b) { - $(this).on("click tab", b, d); + $(this).on("click tab", b, c); } else { - $(this).on("click tab", d); + $(this).on("click tab", c); } }; - return c; + return d; }; Entry.SVG = function(a) { a = document.getElementById(a); @@ -8573,8 +8573,8 @@ Entry.SVG.createElement = function(a, b) { a = "string" === typeof a ? document.createElementNS(Entry.SVG.NS, a) : a; if (b) { b.href && (a.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href); - for (var d in b) { - a.setAttribute(d, b[d]); + for (var c in b) { + a.setAttribute(c, b[c]); } } this instanceof SVGElement && this.appendChild(a); @@ -8589,28 +8589,28 @@ Entry.SVG.createElement = function(a, b) { }; Entry.SVG.attr = function(a, b) { if ("string" === typeof a) { - var d = {}; - d[a] = b; - a = d; + var c = {}; + c[a] = b; + a = c; } if (a) { a.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); - for (var c in a) { - this.setAttribute(c, a[c]); + for (var d in a) { + this.setAttribute(d, a[d]); } } return this; }; Entry.SVG.addClass = function(a) { - for (var b = this.getAttribute("class"), d = 0;d < arguments.length;d++) { - a = arguments[d], this.hasClass(a) || (b += " " + a); + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) || (b += " " + a); } this.setAttribute("class", b); return this; }; Entry.SVG.removeClass = function(a) { - for (var b = this.getAttribute("class"), d = 0;d < arguments.length;d++) { - a = arguments[d], this.hasClass(a) && (b = b.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) && (b = b.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); } this.setAttribute("class", b); return this; @@ -8625,18 +8625,18 @@ Entry.SVG.remove = function() { Entry.SVG.removeAttr = function(a) { this.removeAttribute(a); }; -Entry.Dialog = function(a, b, d, c) { +Entry.Dialog = function(a, b, c, d) { a.dialog && a.dialog.remove(); a.dialog = this; this.parent = a; this.padding = 10; this.border = 2; "number" == typeof b && (b = String(b)); - Entry.console && Entry.console.print(b, d); + Entry.console && Entry.console.print(b, c); this.message_ = b = b.match(/.{1,15}/g).join("\n"); - this.mode_ = d; - "speak" !== d && "ask" !== d || this.generateSpeak(); - c || Entry.stage.loadDialog(this); + this.mode_ = c; + "speak" !== c && "ask" !== c || this.generateSpeak(); + d || Entry.stage.loadDialog(this); }; Entry.Dialog.prototype.generateSpeak = function() { this.object = new createjs.Container; @@ -8645,13 +8645,13 @@ Entry.Dialog.prototype.generateSpeak = function() { a.textBaseline = "top"; a.textAlign = "left"; a.text = this.message_; - var b = a.getTransformedBounds(), d = b.height, b = 10 <= b.width ? b.width : 17, c = new createjs.Shape; - c.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, b + 2 * this.padding, d + 2 * this.padding, this.padding); - this.object.addChild(c); + var b = a.getTransformedBounds(), c = b.height, b = 10 <= b.width ? b.width : 17, d = new createjs.Shape; + d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, b + 2 * this.padding, c + 2 * this.padding, this.padding); + this.object.addChild(d); this.object.regX = b / 2; - this.object.regY = d / 2; + this.object.regY = c / 2; this.width = b; - this.height = d; + this.height = c; this.notch = this.createSpeakNotch("ne"); this.update(); this.object.addChild(this.notch); @@ -8699,12 +8699,12 @@ p.generateView = function(a) { var b = Entry.createElement("div"); b.addClass("entryContainerDoneWorkspace"); this.doneContainer = b; - var d = Entry.createElement("iframe"); - d.setAttribute("id", "doneProjectframe"); - d.setAttribute("frameborder", 0); - d.setAttribute("src", "/api/iframe/project/" + a); - this.doneProjectFrame = d; - this.doneContainer.appendChild(d); + var c = Entry.createElement("iframe"); + c.setAttribute("id", "doneProjectframe"); + c.setAttribute("frameborder", 0); + c.setAttribute("src", "/api/iframe/project/" + a); + this.doneProjectFrame = c; + this.doneContainer.appendChild(c); b.addClass("entryRemove"); }; p.getView = function() { @@ -8718,8 +8718,8 @@ p.resize = function() { }; Entry.Engine = function() { function a(b) { - var a = [37, 38, 39, 40, 32], c = b.keyCode || b.which, e = Entry.stage.inputField; - 32 == c && e && e.hasFocus() || -1 < a.indexOf(c) && b.preventDefault(); + var a = b.keyCode || b.which, d = Entry.stage.inputField; + 32 == a && d && d.hasFocus() || -1 < [37, 38, 39, 40, 32].indexOf(a) && b.preventDefault(); } this.state = "stop"; this.popup = null; @@ -8791,13 +8791,13 @@ Entry.Engine.prototype.generateView = function(a, b) { this.view_ = a; this.view_.addClass("entryEngine_w"); this.view_.addClass("entryEngineWorkspace_w"); - var d = Entry.createElement("button"); - this.speedButton = d; + var c = Entry.createElement("button"); + this.speedButton = c; this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); this.view_.appendChild(this.speedButton); this.speedButton.bindOnClick(function(b) { Entry.engine.toggleSpeedPanel(); - d.blur(); + c.blur(); }); this.maximizeButton = Entry.createElement("button"); this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); @@ -8806,13 +8806,13 @@ Entry.Engine.prototype.generateView = function(a, b) { Entry.engine.toggleFullscreen(); this.blur(); }); - var c = Entry.createElement("button"); - this.coordinateButton = c; + var d = Entry.createElement("button"); + this.coordinateButton = d; this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); this.view_.appendChild(this.coordinateButton); this.coordinateButton.bindOnClick(function(b) { this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); - c.blur(); + d.blur(); this.blur(); Entry.stage.toggleCoordinator(); }); @@ -8893,33 +8893,33 @@ Entry.Engine.prototype.toggleSpeedPanel = function() { this.speedLabel_.innerHTML = Lang.Workspace.speed; this.view_.insertBefore(this.speedLabel_, this.maximizeButton); this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); - for (var a = Entry.createElement("tr"), b = this.speeds, d = 0;5 > d;d++) { - (function(d) { - var c = Entry.createElement("td", "progressCell" + d); - c.bindOnClick(function() { - Entry.engine.setSpeedMeter(b[d]); + for (var a = Entry.createElement("tr"), b = this.speeds, c = 0;5 > c;c++) { + (function(c) { + var d = Entry.createElement("td", "progressCell" + c); + d.bindOnClick(function() { + Entry.engine.setSpeedMeter(b[c]); }); - a.appendChild(c); - })(d); + a.appendChild(d); + })(c); } this.view_.insertBefore(this.speedProgress_, this.maximizeButton); this.speedProgress_.appendChild(a); this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); - var c = (Entry.interfaceState.canvasWidth - 84) / 5; + var d = (Entry.interfaceState.canvasWidth - 84) / 5; $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(b) { function a(b) { b.stopPropagation(); b = Entry.Utils.convertMouseEvent(b); - b = Math.floor((b.clientX - 80) / (5 * c) * 5); + b = Math.floor((b.clientX - 80) / (5 * d) * 5); 0 > b || 4 < b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); } - function d(b) { + function c(b) { $(document).unbind(".speedPanel"); } b.stopPropagation && b.stopPropagation(); b.preventDefault && b.preventDefault(); if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - Entry.Utils.convertMouseEvent(b), b = $(document), b.bind("mousemove.speedPanel touchmove.speedPanel", a), b.bind("mouseup.speedPanel touchend.speedPanel", d); + Entry.Utils.convertMouseEvent(b), b = $(document), b.bind("mousemove.speedPanel touchmove.speedPanel", a), b.bind("mouseup.speedPanel touchend.speedPanel", c); } }); this.view_.insertBefore(this.speedHandle_, this.maximizeButton); @@ -8951,9 +8951,9 @@ Entry.Engine.computeThread = function(a, b) { Entry.engine.isContinue = !0; for (a = !1;b && Entry.engine.isContinue && !a;) { Entry.engine.isContinue = !b.isRepeat; - var d = b.run(); - a = d && d === b; - b = d; + var c = b.run(); + a = c && c === b; + b = c; } return b; }; @@ -9047,9 +9047,9 @@ Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { a === b[0] && a.parent.script.raiseEvent(b[1], a); }; Entry.Engine.prototype.captureKeyEvent = function(a) { - var b = a.keyCode, d = Entry.type; - a.ctrlKey && "workspace" == d ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); - Entry.engine.isState("stop") && "workspace" === d && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); + var b = a.keyCode, c = Entry.type; + a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); + Entry.engine.isState("stop") && "workspace" === c && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); }; Entry.Engine.prototype.raiseKeyEvent = function(a, b) { return a.parent.script.raiseEvent(b[0], a, String(b[1])); @@ -9088,9 +9088,9 @@ Entry.Engine.prototype.showProjectTimer = function() { Entry.Engine.prototype.hideProjectTimer = function() { var a = this.projectTimer; if (a && a.isVisible() && !this.isState("run")) { - for (var b = Entry.container.getAllObjects(), d = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], c = 0, e = b.length;c < e;c++) { - for (var f = b[c].script, g = 0;g < d.length;g++) { - if (f.hasBlockType(d[g])) { + for (var b = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { + if (f.hasBlockType(c[g])) { return; } } @@ -9113,10 +9113,10 @@ Entry.Engine.prototype.stopProjectTimer = function() { a && (this.updateProjectTimer(0), a.isPaused = !1, a.isInit = !1, a.pausedTime = 0, clearInterval(a.tick)); }; Entry.Engine.prototype.updateProjectTimer = function(a) { - var b = Entry.engine, d = b.projectTimer; - if (d) { - var c = (new Date).getTime(); - "undefined" == typeof a ? d.isPaused || b.isState("pause") || d.setValue((c - d.start - d.pausedTime) / 1E3) : (d.setValue(a), d.pausedTime = 0, d.start = c); + var b = Entry.engine, c = b.projectTimer; + if (c) { + var d = (new Date).getTime(); + "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); } }; Entry.EntityObject = function(a) { @@ -9333,15 +9333,15 @@ Entry.EntityObject.prototype.getFont = function() { Entry.EntityObject.prototype.setFont = function(a) { if ("textBox" == this.parent.objectType && this.font !== a) { a || (a = "20px Nanum Gothic"); - var b = a.split(" "), d; - if (d = -1 < b.indexOf("bold")) { - b.splice(d - 1, 1), this.setFontBold(!0); + var b = a.split(" "), c; + if (c = -1 < b.indexOf("bold")) { + b.splice(c - 1, 1), this.setFontBold(!0); } - if (d = -1 < b.indexOf("italic")) { - b.splice(d - 1, 1), this.setFontItalic(!0); + if (c = -1 < b.indexOf("italic")) { + b.splice(c - 1, 1), this.setFontItalic(!0); } - d = parseInt(b.shift()); - this.setFontSize(d); + c = parseInt(b.shift()); + this.setFontSize(c); this.setFontType(b.join(" ")); this.font = this.getFont(); this.textObject.font = a; @@ -9399,18 +9399,18 @@ Entry.EntityObject.prototype.toggleFontItalic = function() { return this.fontItalic; }; Entry.EntityObject.prototype.setFontName = function(a) { - for (var b = this.font.split(" "), d = [], c = 0, e = b.length;c < e;c++) { - ("bold" === b[c] || "italic" === b[c] || -1 < b[c].indexOf("px")) && d.push(b[c]); + for (var b = this.font.split(" "), c = [], d = 0, e = b.length;d < e;d++) { + ("bold" === b[d] || "italic" === b[d] || -1 < b[d].indexOf("px")) && c.push(b[d]); } - this.setFont(d.join(" ") + " " + a); + this.setFont(c.join(" ") + " " + a); }; Entry.EntityObject.prototype.getFontName = function() { if ("textBox" == this.type) { if (!this.font) { return ""; } - for (var a = this.font.split(" "), b = [], d = 0, c = a.length;d < c;d++) { - "bold" !== a[d] && "italic" !== a[d] && -1 === a[d].indexOf("px") && b.push(a[d]); + for (var a = this.font.split(" "), b = [], c = 0, d = a.length;c < d;c++) { + "bold" !== a[c] && "italic" !== a[c] && -1 === a[c].indexOf("px") && b.push(a[c]); } return b.join(" ").trim(); } @@ -9456,13 +9456,13 @@ Entry.EntityObject.prototype.setImage = function(a) { Entry.assert("sprite" == this.type, "Set image is only for sprite object"); a.id || (a.id = Entry.generateHash()); this.picture = a; - var d = this.picture.dimension, c = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; - this.setWidth(d.width); - this.setHeight(d.height); - d.scaleX || (d.scaleX = this.getScaleX(), d.scaleY = this.getScaleY()); + var c = this.picture.dimension, d = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; + this.setWidth(c.width); + this.setHeight(c.height); + c.scaleX || (c.scaleX = this.getScaleX(), c.scaleY = this.getScaleY()); this.setScaleX(this.scaleX); this.setScaleY(this.scaleY); - this.setRegX(this.width / 2 + c); + this.setRegX(this.width / 2 + d); this.setRegY(this.height / 2 + e); var f = a.id + this.id, g = Entry.container.getCachedPicture(f); g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight()), g.onload = function(a) { @@ -9476,36 +9476,36 @@ Entry.EntityObject.prototype.setImage = function(a) { }; Entry.EntityObject.prototype.applyFilter = function(a) { function b(b, a) { - for (var d in b) { - if (b[d] !== a[d]) { + for (var c in b) { + if (b[c] !== a[c]) { return !1; } } return !0; } - var d = this.effect, c = this.object; - if (a || !b(d, this.getInitialEffectValue())) { + var c = this.effect, d = this.object; + if (a || !b(c, this.getInitialEffectValue())) { (function(b, a) { - var d = [], c = Entry.adjustValueWithMaxMin; + var c = [], d = Entry.adjustValueWithMaxMin; b.brightness = b.brightness; - var k = new createjs.ColorMatrix; - k.adjustColor(c(b.brightness, -100, 100), 0, 0, 0); - k = new createjs.ColorMatrixFilter(k); - d.push(k); + var e = new createjs.ColorMatrix; + e.adjustColor(d(b.brightness, -100, 100), 0, 0, 0); + e = new createjs.ColorMatrixFilter(e); + c.push(e); b.hue = b.hue.mod(360); - k = new createjs.ColorMatrix; - k.adjustColor(0, 0, 0, b.hue); - k = new createjs.ColorMatrixFilter(k); - d.push(k); - var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * b.hsv * Math.PI / 180, m = Math.cos(l), l = Math.sin(l), n = Math.abs(b.hsv / 100); + e = new createjs.ColorMatrix; + e.adjustColor(0, 0, 0, b.hue); + e = new createjs.ColorMatrixFilter(e); + c.push(e); + var e = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], f = 10.8 * b.hsv * Math.PI / 180, m = Math.cos(f), f = Math.sin(f), n = Math.abs(b.hsv / 100); 1 < n && (n -= Math.floor(n)); - 0 < n && .33 >= n ? k = [1, 0, 0, 0, 0, 0, m, l, 0, 0, 0, -1 * l, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= n ? k = [m, 0, l, 0, 0, 0, 1, 0, 0, 0, l, 0, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= n && (k = [m, l, 0, 0, 0, -1 * l, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); - k = (new createjs.ColorMatrix).concat(k); - k = new createjs.ColorMatrixFilter(k); - d.push(k); - a.alpha = b.alpha = c(b.alpha, 0, 1); - a.filters = d; - })(d, c), c.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; + 0 < n && .33 >= n ? e = [1, 0, 0, 0, 0, 0, m, f, 0, 0, 0, -1 * f, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= n ? e = [m, 0, f, 0, 0, 0, 1, 0, 0, 0, f, 0, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= n && (e = [m, f, 0, 0, 0, -1 * f, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); + e = (new createjs.ColorMatrix).concat(e); + e = new createjs.ColorMatrixFilter(e); + c.push(e); + a.alpha = b.alpha = d(b.alpha, 0, 1); + a.filters = c; + })(c, d), d.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; } }; Entry.EntityObject.prototype.resetFilter = function() { @@ -9689,21 +9689,21 @@ Entry.Func.save = function() { Entry.Func.syncFuncName = function(a) { var b = 0; a = a.split(" "); - var d = "", c; - c = Blockly.mainWorkspace.getAllBlocks(); - for (var e = 0;e < c.length;e++) { - var f = c[e]; + var c = "", d; + d = Blockly.mainWorkspace.getAllBlocks(); + for (var e = 0;e < d.length;e++) { + var f = d[e]; if ("function_general" === f.type) { for (var f = f.inputList, g = 0;g < f.length;g++) { var h = f[g]; - 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_ && (d += h.fieldRow[0].text_, d += " "); + 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_ && (c += h.fieldRow[0].text_, c += " "); } - d = d.trim(); - if (d === this.srcFName && this.srcFName.split(" ").length == a.length) { - for (d = 0;d < f.length;d++) { - if (h = f[d], 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_) { + c = c.trim(); + if (c === this.srcFName && this.srcFName.split(" ").length == a.length) { + for (c = 0;c < f.length;c++) { + if (h = f[c], 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_) { if (void 0 === a[b]) { - f.splice(d, 1); + f.splice(c, 1); break; } else { h.fieldRow[0].text_ = a[b]; @@ -9712,7 +9712,7 @@ Entry.Func.syncFuncName = function(a) { } } } - d = ""; + c = ""; b = 0; } } @@ -9729,16 +9729,16 @@ Entry.Func.getMenuXml = function() { if (this.targetFunc) { var b = this.FIELD_BLOCK, b = b.replace("#1", Entry.generateHash()), b = b.replace("#2", Entry.generateHash()), b = Blockly.Xml.textToDom(b).childNodes, a = a.concat(Entry.nodeListToArray(b)) } - for (var d in Entry.variableContainer.functions_) { - b = Entry.variableContainer.functions_[d], b === this.targetFunc ? (b = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), b.id).block, a.push(b)) : a.push(b.block); + for (var c in Entry.variableContainer.functions_) { + b = Entry.variableContainer.functions_[c], b === this.targetFunc ? (b = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), b.id).block, a.push(b)) : a.push(b.block); } return a; }; Entry.Func.syncFunc = function() { var a = Entry.Func; if (a.targetFunc) { - var b = a.workspace.topBlocks_[0].toString(), d = a.workspace.topBlocks_.length; - (a.fieldText != b || a.workspaceLength != d) && 1 > Blockly.Block.dragMode_ && (a.updateMenu(), a.fieldText = b, a.workspaceLength = d); + var b = a.workspace.topBlocks_[0].toString(), c = a.workspace.topBlocks_.length; + (a.fieldText != b || a.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (a.updateMenu(), a.fieldText = b, a.workspaceLength = c); } }; Entry.Func.setupMenuCode = function() { @@ -9755,34 +9755,34 @@ Entry.Func.refreshMenuCode = function() { } }; Entry.Func.requestParamBlock = function(a) { - var b = Entry.generateHash(), d; + var b = Entry.generateHash(), c; switch(a) { case "string": - d = Entry.block.function_param_string; + c = Entry.block.function_param_string; break; case "boolean": - d = Entry.block.function_param_boolean; + c = Entry.block.function_param_boolean; break; default: return null; } b = a + "Param_" + b; - a = Entry.Func.createParamBlock(b, d, a); + a = Entry.Func.createParamBlock(b, c, a); Entry.block[b] = a; return b; }; Entry.Func.registerParamBlock = function(a) { -1 < a.indexOf("stringParam") ? Entry.Func.createParamBlock(a, Entry.block.function_param_string, a) : -1 < a.indexOf("booleanParam") && Entry.Func.createParamBlock(a, Entry.block.function_param_boolean, a); }; -Entry.Func.createParamBlock = function(a, b, d) { - var c = function() { +Entry.Func.createParamBlock = function(a, b, c) { + var d = function() { }; - d = "string" === d ? "function_param_string" : "function_param_boolean"; - c.prototype = b; - c = new c; - c.changeEvent = new Entry.Event; - c.template = Lang.template[d]; - return Entry.block[a] = c; + c = "string" === c ? "function_param_string" : "function_param_boolean"; + d.prototype = b; + d = new d; + d.changeEvent = new Entry.Event; + d.template = Lang.template[c]; + return Entry.block[a] = d; }; Entry.Func.updateMenu = function() { if (Entry.playground && Entry.playground.mainWorkspace) { @@ -9796,10 +9796,10 @@ Entry.Func.prototype.edit = function() { }; Entry.Func.generateBlock = function(a) { a = Entry.block["func_" + a.id]; - var b = {template:a.template, params:a.params}, d = /(%\d)/mi, c = a.template.split(d), e = "", f = 0, g = 0, h; - for (h in c) { - var k = c[h]; - d.test(k) ? (k = Number(k.split("%")[1]) - 1, k = a.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; + var b = {template:a.template, params:a.params}, c = /(%\d)/mi, d = a.template.split(c), e = "", f = 0, g = 0, h; + for (h in d) { + var k = d[h]; + c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = a.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:b, description:e}; }; @@ -9811,27 +9811,27 @@ Entry.Func.prototype.generateBlock = function(a) { Entry.Func.generateWsBlock = function(a) { this.unbindFuncChangeEvent(); a = a ? a : this.targetFunc; - for (var b = a.content.getEventMap("funcDef")[0].params[0], d = 0, c = 0, e = [], f = "", g = a.hashMap, h = a.paramMap;b;) { + for (var b = a.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = a.hashMap, h = a.paramMap;b;) { var k = b.params[0]; switch(b.type) { case "function_field_label": f = f + " " + k; break; case "function_field_boolean": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (d ? d : "")}); + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); g[k.type] = !1; - h[k.type] = d + c; - d++; + h[k.type] = c + d; + c++; e.push({type:"Block", accept:"boolean"}); - f += " %" + (d + c); + f += " %" + (c + d); break; case "function_field_string": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (c ? c : "")}), g[k.type] = !1, h[k.type] = d + c, c++, f += " %" + (d + c), e.push({type:"Block", accept:"string"}); + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); } b = b.getOutputBlock(); } - d++; - f += " %" + (d + c); + c++; + f += " %" + (c + d); e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); Entry.Mutator.mutate("func_" + a.id, {params:e, template:f}); for (var l in g) { @@ -9871,19 +9871,19 @@ p.renderBlock = function(a) { if (a && this.visible && b && !Entry.block[a].isPrimitive) { this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); this.code.clear(); - var d = Entry.block[a].def, d = d || {type:a}; - this.code.createThread([d]); + var c = Entry.block[a].def, c = c || {type:a}; + this.code.createThread([c]); this.code.board.align(); this.code.board.resize(); - var d = this.code.getThreads()[0].getFirstBlock().view, c = d.svgGroup.getBBox(); - a = c.width; - c = c.height; - d = d.getSkeleton().box(d).offsetX; - isNaN(d) && (d = 0); + var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); + a = d.width; + d = d.height; + c = c.getSkeleton().box(c).offsetX; + isNaN(c) && (c = 0); this.blockHelperDescription_.innerHTML = b; this._renderView.align(); - $(this.blockHelperDescription_).css({top:c + 30}); - this._renderView.svgDom.css({"margin-left":-(a / 2) - 20 - d}); + $(this.blockHelperDescription_).css({top:d + 30}); + this._renderView.svgDom.css({"margin-left":-(a / 2) - 20 - c}); } }; p.getView = function() { @@ -9924,10 +9924,10 @@ Entry.HWMonitor = function(a) { b = b.ports; this.pathGroup = null; this.pathGroup = this._svgGroup.elem("g"); - var a = [], c; - for (c in b) { - var e = this.generatePortView(b[c], "_svgGroup"); - this._portViews[c] = e; + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svgGroup"); + this._portViews[d] = e; a.push(e); } a.sort(function(b, a) { @@ -9977,10 +9977,10 @@ Entry.HWMonitor = function(a) { this._template = b; b = b.listPorts; this.pathGroup = this._svglistGroup.elem("g"); - var a = [], c; - for (c in b) { - var e = this.generatePortView(b[c], "_svglistGroup"); - this._listPortViews[c] = e; + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svglistGroup"); + this._listPortViews[d] = e; a.push(e); } var f = this._portMapList; @@ -10008,11 +10008,11 @@ Entry.HWMonitor = function(a) { return this.svgDom; }; a.update = function() { - var b = Entry.hw.portData, a = Entry.hw.sendQueue, c = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == c) { + var b = Entry.hw.portData, a = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; + if ("list" == d) { f = this._listPortViews; } else { - if ("both" == c) { + if ("both" == d) { if (f = this._listPortViews, this._portViews) { for (var g in this._portViews) { f[g] = this._portViews[g]; @@ -10028,7 +10028,7 @@ Entry.HWMonitor = function(a) { } } for (var h in f) { - if (c = f[h], "input" == c.type) { + if (d = f[h], "input" == d.type) { var k = b[h]; 0 < e.length && $.each(e, function(b, a) { if ($.isPlainObject(k)) { @@ -10037,8 +10037,8 @@ Entry.HWMonitor = function(a) { return !1; } }); - c.value.textContent = k ? k : 0; - c.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); + d.value.textContent = k ? k : 0; + d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); } else { k = a[h], 0 < e.length && $.each(e, function(b, a) { if ($.isPlainObject(k)) { @@ -10046,7 +10046,7 @@ Entry.HWMonitor = function(a) { } else { return !1; } - }), c.value.textContent = k ? k : 0, c.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); + }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); } } }; @@ -10079,25 +10079,25 @@ Entry.HWMonitor = function(a) { a.alignList = function() { var b; b = this._hwModule.monitorTemplate.listPorts; - for (var a = b.length, c = 0;c < b.length;c++) { - b[c].group.attr({transform:"translate(" + this._template.width * (c / a - .5) + "," + (-this._template.width / 2 - 30) + ")"}); + for (var a = b.length, d = 0;d < b.length;d++) { + b[d].group.attr({transform:"translate(" + this._template.width * (d / a - .5) + "," + (-this._template.width / 2 - 30) + ")"}); } b = this._portMapList.n.concat(); this._alignNSList(b, -this._template.width * this.scale / 2 - 32, -27); }; - a._alignEW = function(b, a, c) { - var e = b.length, f = this._rect.height - 50; + a._alignEW = function(b, a, d) { + var c = b.length, f = this._rect.height - 50; tP = -f / 2; bP = f / 2; height = this._rect.height; listVLine = wholeHeight = 0; mode = this._hwModule.monitorTemplate; - for (f = 0;f < e;f++) { + for (f = 0;f < c;f++) { wholeHeight += b[f].height + 5; } wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < e;) { - var g = b.shift(), f = b.pop(), h = tP, k = bP, l = c; + for (;1 < c;) { + var g = b.shift(), f = b.pop(), h = tP, k = bP, l = d; wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === b.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); wholeWidth -= g.width + f.width + 10; a += l; @@ -10105,20 +10105,20 @@ Entry.HWMonitor = function(a) { b.length && b[0].group.attr({transform:"translate(" + a + ",60)"}); g && rPort && (this._movePort(g, a, tP, h), this._movePort(rPort, a, bP, k)); }; - a._alignNS = function(b, a, c) { - for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < b.length;k++) { + a._alignNS = function(b, a, d) { + for (var c = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < b.length;k++) { h += b[k].width + 5; } - h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); + h < f - c && (f = h / 2 + 3, c = -h / 2 - 3); for (;1 < b.length;) { - var k = b.shift(), l = b.pop(), m = e, n = f, q = c; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === b.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, a, m); + var k = b.shift(), l = b.pop(), m = c, n = f, q = d; + h <= f - c ? (c += k.width + 5, f -= l.width + 5, q = 0) : 0 === b.length ? (c = (c + f) / 2 - 3, f = c + 6) : (c = Math.max(c, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, c, a, m); this._movePort(l, f, a, n); h -= k.width + l.width + 10; a += q; } - b.length && this._movePort(b[0], (f + e - b[0].width) / 2, a, 100); + b.length && this._movePort(b[0], (f + c - b[0].width) / 2, a, 100); }; a._alignNSList = function(b, a) { a = this._rect.width; @@ -10131,10 +10131,10 @@ Entry.HWMonitor = function(a) { k = b[c], c != b.length - 1 && (l = b[c + 1]), f += k.width, lP = initX, h = initY + 30 * e, k.group.attr({transform:"translate(" + lP + "," + h + ")"}), initX += k.width + 10, f > a - (k.width + l.width / 2.2) && (e += 1, initX = g, f = 0); } }; - a._movePort = function(b, a, c, e) { - var f = a, g = b.box.x * this.scale, h = b.box.y * this.scale; - a > e ? (f = a - b.width, a = a > g && g > e ? "M" + g + "," + c + "L" + g + "," + h : "M" + (a + e) / 2 + "," + c + "l0," + (h > c ? 28 : -3) + "H" + g + "L" + g + "," + h) : a = a < g && g < e ? "m" + g + "," + c + "L" + g + "," + h : "m" + (e + a) / 2 + "," + c + "l0," + (h > c ? 28 : -3) + "H" + g + "L" + g + "," + h; - b.group.attr({transform:"translate(" + f + "," + c + ")"}); + a._movePort = function(b, a, d, e) { + var c = a, g = b.box.x * this.scale, h = b.box.y * this.scale; + a > e ? (c = a - b.width, a = a > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (a + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : a = a < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + a) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; + b.group.attr({transform:"translate(" + c + "," + d + ")"}); b.path.attr({d:a}); }; })(Entry.HWMonitor.prototype); @@ -10158,51 +10158,57 @@ p.initSocket = function() { if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; } else { - var a = this, b, d; + var a = this, b, c; this.connected = !1; this.connectTrial++; if (-1 < location.protocol.indexOf("https")) { - d = new WebSocket("wss://hardware.play-entry.org:23518"); + c = io("https://hardware.play-entry.org:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}); } else { try { - b = new WebSocket("ws://127.0.0.1:23518"), b.binaryType = "arraybuffer", b.onopen = function() { + b = io("https://127.0.0.1:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}), b.on("connect", function() { + c.close(); a.socketType = "WebSocket"; a.initHardware(b); - }.bind(this), b.onmessage = function(b) { - b = JSON.parse(b.data); - a.checkDevice(b); - a.updatePortData(b); - }.bind(this), b.onclose = function() { - "WebSocket" === a.socketType && (this.socket = null, a.initSocket()); - }; - } catch (c) { + }), b.on("mode", function(a) { + b.mode = a; + }), b.on("message", function(b) { + b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); + }), b.on("disconnect reconnecting", function() { + "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); + }), b.on("reconnecting", function() { + "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); + }); + } catch (d) { } try { - d = new WebSocket("wss://hardware.play-entry.org:23518"); - } catch (c) { + c = io("https://hardware.play-entry.org:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}); + } catch (d) { } } - d.binaryType = "arraybuffer"; - d.onopen = function() { - a.socketType = "WebSocketSecurity"; - a.initHardware(d); - }; - d.onmessage = function(b) { - b = JSON.parse(b.data); - a.checkDevice(b); - a.updatePortData(b); - }; - d.onclose = function() { - "WebSocketSecurity" === a.socketType && (this.socket = null, a.initSocket()); - }; + c.on("connect", function() { + b.close(); + a.socketType = "WebSocket"; + a.initHardware(c); + }); + c.on("mode", function(b) { + c.mode = b; + }); + c.on("message", function(b) { + b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); + }); + c.on("disconnect", function() { + "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); + }); + c.on("reconnecting", function() { + "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); + }); Entry.dispatchEvent("hwChanged"); } - } catch (c) { + } catch (d) { } }; p.retryConnect = function() { - this.connectTrial = 0; - this.initSocket(); + this.socket ? this.executeHardware() : (this.executeHardware(), this.connectTrial = 0, this.initSocket()); }; p.initHardware = function(a) { this.socket = a; @@ -10227,9 +10233,9 @@ p.getDigitalPortValue = function(a) { }; p.setPortReadable = function(a) { this.sendQueue.readablePorts || (this.sendQueue.readablePorts = []); - var b = !1, d; - for (d in this.sendQueue.readablePorts) { - if (this.sendQueue.readablePorts[d] == a) { + var b = !1, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { b = !0; break; } @@ -10238,10 +10244,10 @@ p.setPortReadable = function(a) { }; p.removePortReadable = function(a) { if (this.sendQueue.readablePorts || Array.isArray(this.sendQueue.readablePorts)) { - var b, d; - for (d in this.sendQueue.readablePorts) { - if (this.sendQueue.readablePorts[d] == a) { - b = Number(d); + var b, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { + b = Number(c); break; } } @@ -10249,7 +10255,7 @@ p.removePortReadable = function(a) { } }; p.update = function() { - this.socket && 1 == this.socket.readyState && this.socket.send(JSON.stringify(this.sendQueue)); + this.socket && this.socket.emit("message", {data:JSON.stringify(this.sendQueue), mode:this.socket.mode, type:"utf8"}); }; p.updatePortData = function(a) { this.portData = a; @@ -10280,6 +10286,75 @@ p.banHW = function() { Entry.playground.mainWorkspace.blockMenu.banClass(a[b].name, !0); } }; +p.executeHardware = function() { + function a(b) { + navigator.msLaunchUri(b, function() { + }, function() { + alert("\uc124\uce58\uc548\ub42c\uc5c9"); + }); + } + function b(b) { + var a = document.createElement("iframe"); + a.src = "about:blank"; + a.style = "display:none"; + document.getElementsByTagName("body")[0].appendChild(a); + var c = null, c = setTimeout(function() { + var d = !1; + try { + a.contentWindow.location.href = b, d = !0; + } catch (l) { + "NS_ERROR_UNKNOWN_PROTOCOL" == l.name && (d = !1); + } + d || alert("\uc124\uce58\uc548\ub42c\uc5c9"); + document.getElementsByTagName("body")[0].removeChild(a); + clearTimeout(c); + }, 500); + } + function c(b) { + var a = !1; + window.focus(); + window.onblur = function() { + a = !0; + }; + location.assign(encodeURI(b)); + setTimeout(function() { + (0 == a || 0 < navigator.userAgent.indexOf("Edge")) && alert("\uc124\uce58 \uc548\ub42c\uc5c9"); + window.onblur = null; + }, 1500); + } + var d = {_bNotInstalled:!1, init:function(b, a) { + this._w = window.open("", "comic_viewer_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); + var c = null, c = setTimeout(function() { + d.runViewer(b, a); + clearInterval(c); + }, 1E3); + }, runViewer:function(b, a) { + this._w.document.write(""); + var c = 0, d = null, d = setInterval(function() { + try { + this._w.location.href; + } catch (n) { + this._bNotInstalled = !0; + } + if (10 < c) { + clearInterval(d); + var b = 0, e = null, e = setInterval(function() { + b++; + this._w.closed || 2 < b ? clearInterval(e) : this._w.close(); + this._bNotInstalled = !1; + c = 0; + }.bind(this), 5E3); + a(!this._bNotInstalled); + } + c++; + }.bind(this), 100); + }, set:function() { + this._bNotInstalled = !0; + }}, e = "entryhw://-clientId:" + (this.socket ? this.socket.id : ""); + 0 < navigator.userAgent.indexOf("MSIE") || 0 < navigator.userAgent.indexOf("Trident") ? void 0 != navigator.msLaunchUri ? a(e) : 9 > (0 < document.documentMode ? document.documentMode : navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]) ? alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4.") : d.init(e, function(b) { + 0 == b && alert("\uc124\uce58\uc548\ub42c\uc5c9"); + }) : 0 < navigator.userAgent.indexOf("Firefox") ? b(e) : 0 < navigator.userAgent.indexOf("Chrome") || 0 < navigator.userAgent.indexOf("Safari") ? c(e) : alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4."); +}; Entry.PropertyPanel = function() { this.modes = {}; this.selected = null; @@ -10313,10 +10388,10 @@ Entry.PropertyPanel = function() { }; a.select = function(b) { for (var a in this.modes) { - var c = this.modes[a]; - c.tabDom.removeClass("selected"); - c.contentDom.addClass("entryRemove"); - c.obj.visible = !1; + var d = this.modes[a]; + d.tabDom.removeClass("selected"); + d.contentDom.addClass("entryRemove"); + d.obj.visible = !1; } a = this.modes[b]; a.tabDom.addClass("selected"); @@ -10422,50 +10497,50 @@ Entry.initialize_ = function() { }; Entry.createDom = function(a, b) { if (b && "workspace" != b) { - "minimize" == b ? (d = Entry.createElement("canvas"), d.className = "entryCanvasWorkspace", d.id = "entryCanvas", d.width = 640, d.height = 360, c = Entry.createElement("div", "entryCanvasWrapper"), c.appendChild(d), a.appendChild(c), this.canvas_ = d, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), a.appendChild(c), this.engineView = c, this.engine.generateView(this.engineView, b)) : "phone" == b && (this.stateManagerView = d = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, - b), c = Entry.createElement("div"), a.appendChild(c), this.engineView = c, this.engine.generateView(this.engineView, b), d = Entry.createElement("canvas"), d.addClass("entryCanvasPhone"), d.id = "entryCanvas", d.width = 640, d.height = 360, c.insertBefore(d, this.engine.footerView_), this.canvas_ = d, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), a.appendChild(d), this.containerView = d, this.container.generateView(this.containerView, b), d = Entry.createElement("div"), - a.appendChild(d), this.playgroundView = d, this.playground.generateView(this.playgroundView, b)); + "minimize" == b ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), a.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b)) : "phone" == b && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, + b), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), a.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, b), c = Entry.createElement("div"), + a.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, b)); } else { Entry.documentMousedown.attach(this, this.cancelObjectEdit); - var d = Entry.createElement("div"); - a.appendChild(d); - this.sceneView = d; - this.scene.generateView(this.sceneView, b); - d = Entry.createElement("div"); - this.sceneView.appendChild(d); - this.stateManagerView = d; - this.stateManager.generateView(this.stateManagerView, b); var c = Entry.createElement("div"); a.appendChild(c); - this.engineView = c; + this.sceneView = c; + this.scene.generateView(this.sceneView, b); + c = Entry.createElement("div"); + this.sceneView.appendChild(c); + this.stateManagerView = c; + this.stateManager.generateView(this.stateManagerView, b); + var d = Entry.createElement("div"); + a.appendChild(d); + this.engineView = d; this.engine.generateView(this.engineView, b); - d = Entry.createElement("canvas"); - d.addClass("entryCanvasWorkspace"); - d.id = "entryCanvas"; - d.width = 640; - d.height = 360; - c.insertBefore(d, this.engine.addButton); - d.addEventListener("mousewheel", function(b) { + c = Entry.createElement("canvas"); + c.addClass("entryCanvasWorkspace"); + c.id = "entryCanvas"; + c.width = 640; + c.height = 360; + d.insertBefore(c, this.engine.addButton); + c.addEventListener("mousewheel", function(b) { var a = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); b = 0 < b.wheelDelta ? !0 : !1; - for (var d = 0;d < a.length;d++) { - var c = a[d]; - c.scrollButton_.y = b ? 46 <= c.scrollButton_.y ? c.scrollButton_.y - 23 : 23 : c.scrollButton_.y + 23; - c.updateView(); + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d.scrollButton_.y = b ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; + d.updateView(); } }); - this.canvas_ = d; + this.canvas_ = c; this.stage.initStage(this.canvas_); - d = Entry.createElement("div"); + c = Entry.createElement("div"); this.propertyPanel.generateView(a, b); - this.containerView = d; + this.containerView = c; this.container.generateView(this.containerView, b); this.propertyPanel.addMode("object", this.container); this.helper.generateView(this.containerView, b); this.propertyPanel.addMode("helper", this.helper); - d = Entry.createElement("div"); - a.appendChild(d); - this.playgroundView = d; + c = Entry.createElement("div"); + a.appendChild(c); + this.playgroundView = c; this.playground.generateView(this.playgroundView, b); this.propertyPanel.select("object"); this.helper.bindWorkspace(this.playground.mainWorkspace); @@ -10515,8 +10590,8 @@ Entry.Activity = function(a, b) { this.timestamp = new Date; a = []; if (void 0 !== b) { - for (var d = 0, c = b.length;d < c;d++) { - var e = b[d]; + for (var c = 0, d = b.length;c < d;c++) { + var e = b[c]; a.push({key:e[0], value:e[1]}); } } @@ -10544,9 +10619,9 @@ Entry.ActivityReporter = function() { a.report = function() { }; })(Entry.ActivityReporter.prototype); -Entry.State = function(a, b, d, c) { +Entry.State = function(a, b, c, d) { this.caller = b; - this.func = d; + this.func = c; 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); this.message = a; this.time = Entry.getUpTime(); @@ -10579,7 +10654,7 @@ Entry.StateManager = function() { }; Entry.StateManager.prototype.generateView = function(a, b) { }; -Entry.StateManager.prototype.addCommand = function(a, b, d, c) { +Entry.StateManager.prototype.addCommand = function(a, b, c, d) { if (!this.isIgnoring()) { if (this.isRestoring()) { var e = new Entry.State, f = Array.prototype.slice.call(arguments); @@ -10696,8 +10771,8 @@ Entry.EntryObject = function(a) { this.pictures = a.sprite.pictures; this.sounds = []; this.sounds = a.sprite.sounds; - for (var d = 0;d < this.sounds.length;d++) { - this.sounds[d].id || (this.sounds[d].id = Entry.generateHash()), Entry.initSound(this.sounds[d]); + for (var c = 0;c < this.sounds.length;c++) { + this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); } this.lock = a.lock ? a.lock : !1; this.isEditing = !1; @@ -10708,31 +10783,31 @@ Entry.EntryObject = function(a) { this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, a.entity ? a.entity : this.initEntity(a)); this.clonedEntities = []; Entry.stage.loadObject(this); - for (d in this.pictures) { + for (c in this.pictures) { (function(a) { a.objectId = this.id; a.id || (a.id = Entry.generateHash()); - var d = new Image; + var c = new Image; if (a.fileurl) { - d.src = a.fileurl; + c.src = a.fileurl; } else { if (a.fileurl) { - d.src = a.fileurl; + c.src = a.fileurl; } else { - var f = a.filename; - d.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png"; + var d = a.filename; + c.src = Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/image/" + d + ".png"; } } Entry.Loader.addQueue(); - d.onload = function(d) { + c.onload = function(c) { Entry.container.cachePicture(a.id + b.entity.id, this); Entry.requestUpdate = !0; Entry.Loader.removeQueue(); }; - d.onerror = function(b) { + c.onerror = function(b) { Entry.Loader.removeQueue(); }; - })(this.pictures[d]); + })(this.pictures[c]); } } }; @@ -10745,11 +10820,11 @@ Entry.EntryObject.prototype.generateView = function() { var b = this; longPressTimer = null; $(a).bind("mousedown touchstart", function(a) { - function d(b) { + function c(b) { b.stopPropagation(); h && 5 < Math.sqrt(Math.pow(b.pageX - h.x, 2) + Math.pow(b.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); } - function c(b) { + function d(b) { b.stopPropagation(); e.unbind(".object"); longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); @@ -10762,26 +10837,26 @@ Entry.EntryObject.prototype.generateView = function() { var h = {x:a.clientX, y:a.clientY}; "touchstart" !== f || g || (a.stopPropagation(), Entry.documentMousedown.notify(a), longPressTimer = setTimeout(function() { longPressTimer && (longPressTimer = null, b._rightClick(a)); - }, 1E3), e.bind("mousemove.object touchmove.object", d), e.bind("mouseup.object touchend.object", c)); + }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); } }); this.view_ = a; - var d = this, a = Entry.createElement("ul"); + var c = this, a = Entry.createElement("ul"); a.addClass("objectInfoView"); Entry.objectEditable || a.addClass("entryHide"); - var c = Entry.createElement("li"); - c.addClass("objectInfo_visible"); - this.entity.getVisible() || c.addClass("objectInfo_unvisible"); - c.bindOnClick(function(b) { - Entry.engine.isState("run") || (b = d.entity, b.setVisible(!b.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); + var d = Entry.createElement("li"); + d.addClass("objectInfo_visible"); + this.entity.getVisible() || d.addClass("objectInfo_unvisible"); + d.bindOnClick(function(b) { + Entry.engine.isState("run") || (b = c.entity, b.setVisible(!b.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); }); var e = Entry.createElement("li"); e.addClass("objectInfo_unlock"); this.getLock() && e.addClass("objectInfo_lock"); e.bindOnClick(function(b) { - Entry.engine.isState("run") || (b = d, b.setLock(!b.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), b.updateInputViews(b.getLock())); + Entry.engine.isState("run") || (b = c, b.setLock(!b.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), b.updateInputViews(b.getLock())); }); - a.appendChild(c); + a.appendChild(d); a.appendChild(e); this.view_.appendChild(a); a = Entry.createElement("div"); @@ -10791,17 +10866,17 @@ Entry.EntryObject.prototype.generateView = function() { a = Entry.createElement("div"); a.addClass("entryObjectWrapperWorkspace"); this.view_.appendChild(a); - c = Entry.createElement("input"); - c.bindOnClick(function(b) { + d = Entry.createElement("input"); + d.bindOnClick(function(b) { b.preventDefault(); - Entry.container.selectObject(d.id); + Entry.container.selectObject(c.id); this.readOnly || (this.focus(), this.select()); }); - c.addClass("entryObjectNameWorkspace"); - a.appendChild(c); - this.nameView_ = c; + d.addClass("entryObjectNameWorkspace"); + a.appendChild(d); + this.nameView_ = d; this.nameView_.entryObject = this; - c.setAttribute("readonly", !0); + d.setAttribute("readonly", !0); var f = this; this.nameView_.onblur = function(b) { this.entryObject.name = this.value; @@ -10811,36 +10886,36 @@ Entry.EntryObject.prototype.generateView = function() { 13 == b.keyCode && f.editObjectValues(!1); }; this.nameView_.value = this.name; - c = Entry.createElement("div"); - c.addClass("entryObjectEditWorkspace"); - c.object = this; - this.editView_ = c; - this.view_.appendChild(c); - $(c).mousedown(function(a) { - var d = b.isEditing; + d = Entry.createElement("div"); + d.addClass("entryObjectEditWorkspace"); + d.object = this; + this.editView_ = d; + this.view_.appendChild(d); + $(d).mousedown(function(a) { + var c = b.isEditing; a.stopPropagation(); Entry.documentMousedown.notify(a); - Entry.engine.isState("run") || !1 !== d || (b.editObjectValues(!d), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); + Entry.engine.isState("run") || !1 !== c || (b.editObjectValues(!c), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); }); - c.blur = function(a) { + d.blur = function(a) { b.editObjectComplete(); }; - Entry.objectEditable && Entry.objectDeletable && (c = Entry.createElement("div"), c.addClass("entryObjectDeleteWorkspace"), c.object = this, this.deleteView_ = c, this.view_.appendChild(c), c.bindOnClick(function(b) { + Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeleteWorkspace"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(b) { Entry.engine.isState("run") || Entry.container.removeObject(this.object); })); - c = Entry.createElement("div"); - c.addClass("entryObjectInformationWorkspace"); - c.object = this; + d = Entry.createElement("div"); + d.addClass("entryObjectInformationWorkspace"); + d.object = this; this.isInformationToggle = !1; - a.appendChild(c); - this.informationView_ = c; + a.appendChild(d); + this.informationView_ = d; a = Entry.createElement("div"); a.addClass("entryObjectRotationWrapperWorkspace"); a.object = this; this.view_.appendChild(a); - c = Entry.createElement("span"); - c.addClass("entryObjectCoordinateWorkspace"); - a.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryObjectCoordinateWorkspace"); + a.appendChild(d); e = Entry.createElement("span"); e.addClass("entryObjectCoordinateSpanWorkspace"); e.innerHTML = "X:"; @@ -10871,45 +10946,45 @@ Entry.EntryObject.prototype.generateView = function() { this.select(); }); m.setAttribute("readonly", !0); - c.appendChild(e); - c.appendChild(g); - c.appendChild(h); - c.appendChild(k); - c.appendChild(l); - c.appendChild(m); - c.xInput_ = g; - c.yInput_ = k; - c.sizeInput_ = m; - this.coordinateView_ = c; - d = this; + d.appendChild(e); + d.appendChild(g); + d.appendChild(h); + d.appendChild(k); + d.appendChild(l); + d.appendChild(m); + d.xInput_ = g; + d.yInput_ = k; + d.sizeInput_ = m; + this.coordinateView_ = d; + c = this; g.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); + 13 == b.keyCode && c.editObjectValues(!1); }; g.onblur = function(b) { - isNaN(g.value) || d.entity.setX(Number(g.value)); - d.updateCoordinateView(); + isNaN(g.value) || c.entity.setX(Number(g.value)); + c.updateCoordinateView(); Entry.stage.updateObject(); }; k.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); + 13 == b.keyCode && c.editObjectValues(!1); }; k.onblur = function(b) { - isNaN(k.value) || d.entity.setY(Number(k.value)); - d.updateCoordinateView(); + isNaN(k.value) || c.entity.setY(Number(k.value)); + c.updateCoordinateView(); Entry.stage.updateObject(); }; m.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); + 13 == b.keyCode && c.editObjectValues(!1); }; m.onblur = function(b) { - isNaN(m.value) || d.entity.setSize(Number(m.value)); - d.updateCoordinateView(); + isNaN(m.value) || c.entity.setSize(Number(m.value)); + c.updateCoordinateView(); Entry.stage.updateObject(); }; - c = Entry.createElement("div"); - c.addClass("entryObjectRotateLabelWrapperWorkspace"); - this.view_.appendChild(c); - this.rotateLabelWrapperView_ = c; + 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 + " : "; @@ -10933,47 +11008,47 @@ Entry.EntryObject.prototype.generateView = function() { this.select(); }); this.directionInput_ = q; - c.appendChild(e); - c.appendChild(n); - c.appendChild(h); - c.appendChild(q); - c.rotateInput_ = n; - c.directionInput_ = q; - d = this; + d.appendChild(e); + d.appendChild(n); + d.appendChild(h); + d.appendChild(q); + d.rotateInput_ = n; + d.directionInput_ = q; + c = this; n.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); + 13 == b.keyCode && c.editObjectValues(!1); }; n.onblur = function(b) { b = n.value; -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); - isNaN(b) || d.entity.setRotation(Number(b)); - d.updateRotationView(); + isNaN(b) || c.entity.setRotation(Number(b)); + c.updateRotationView(); Entry.stage.updateObject(); }; q.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); + 13 == b.keyCode && c.editObjectValues(!1); }; q.onblur = function(b) { b = q.value; -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); - isNaN(b) || d.entity.setDirection(Number(b)); - d.updateRotationView(); + isNaN(b) || c.entity.setDirection(Number(b)); + c.updateRotationView(); Entry.stage.updateObject(); }; - c = Entry.createElement("div"); - c.addClass("rotationMethodWrapper"); - a.appendChild(c); - this.rotationMethodWrapper_ = c; + d = Entry.createElement("div"); + d.addClass("rotationMethodWrapper"); + a.appendChild(d); + this.rotationMethodWrapper_ = d; a = Entry.createElement("span"); a.addClass("entryObjectRotateMethodLabelWorkspace"); - c.appendChild(a); + d.appendChild(a); a.innerHTML = Lang.Workspace.rotate_method + " : "; a = Entry.createElement("div"); a.addClass("entryObjectRotateModeWorkspace"); a.addClass("entryObjectRotateModeAWorkspace"); a.object = this; this.rotateModeAView_ = a; - c.appendChild(a); + d.appendChild(a); a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); }); @@ -10982,7 +11057,7 @@ Entry.EntryObject.prototype.generateView = function() { a.addClass("entryObjectRotateModeBWorkspace"); a.object = this; this.rotateModeBView_ = a; - c.appendChild(a); + d.appendChild(a); a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); }); @@ -10991,7 +11066,7 @@ Entry.EntryObject.prototype.generateView = function() { a.addClass("entryObjectRotateModeCWorkspace"); a.object = this; this.rotateModeCView_ = a; - c.appendChild(a); + d.appendChild(a); a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); }); @@ -11014,46 +11089,46 @@ Entry.EntryObject.prototype.generateView = function() { }}, {text:Lang.Workspace.context_remove, href:"/", action:function(a) { a.preventDefault(); Entry.container.removeObject(b); - }}])), this.view_ = a, a = Entry.createElement("ul"), a.addClass("objectInfoView"), c = Entry.createElement("li"), c.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), a.appendChild(c), a.appendChild(e), this.view_.appendChild(a), a = Entry.createElement("div"), a.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(a), this.thumbnailView_ = a, a = Entry.createElement("div"), a.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(a), - c = Entry.createElement("input"), c.addClass("entryObjectNameWorkspace"), a.appendChild(c), this.nameView_ = c, this.nameView_.entryObject = this, this.nameView_.onblur = function() { + }}])), this.view_ = a, a = Entry.createElement("ul"), a.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), a.appendChild(d), a.appendChild(e), this.view_.appendChild(a), a = Entry.createElement("div"), a.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(a), this.thumbnailView_ = a, a = Entry.createElement("div"), a.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(a), + d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), a.appendChild(d), this.nameView_ = d, this.nameView_.entryObject = this, this.nameView_.onblur = function() { this.entryObject.name = this.value; Entry.playground.reloadPlayground(); }, this.nameView_.onkeypress = function(b) { - 13 == b.keyCode && d.editObjectValues(!1); - }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (c = Entry.createElement("div"), c.addClass("entryObjectDeletePhone"), c.object = this, this.deleteView_ = c, this.view_.appendChild(c), c.bindOnClick(function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeletePhone"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(b) { Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })), c = Entry.createElement("button"), c.addClass("entryObjectEditPhone"), c.object = this, c.bindOnClick(function(b) { + })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(b) { if (b = Entry.container.getObject(this.id)) { Entry.container.selectObject(b.id), Entry.playground.injectObject(b); } - }), this.view_.appendChild(c), c = Entry.createElement("div"), c.addClass("entryObjectInformationWorkspace"), c.object = this, this.isInformationToggle = !1, a.appendChild(c), this.informationView_ = c, c = Entry.createElement("div"), c.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(c), this.rotateLabelWrapperView_ = c, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", n = Entry.createElement("input"), - n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, c.appendChild(e), c.appendChild(n), c.appendChild(h), c.appendChild(q), c.rotateInput_ = n, c.directionInput_ = q, d = this, n.onkeypress = function(b) { - 13 == b.keyCode && (b = n.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || d.entity.setRotation(Number(b)), d.updateRotationView(), n.blur()); + }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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 + " : ", n = Entry.createElement("input"), + n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, 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(n), d.appendChild(h), d.appendChild(q), d.rotateInput_ = n, d.directionInput_ = q, c = this, n.onkeypress = function(b) { + 13 == b.keyCode && (b = n.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), n.blur()); }, n.onblur = function(b) { - d.entity.setRotation(d.entity.getRotation()); + c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, q.onkeypress = function(b) { - 13 == b.keyCode && (b = q.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || d.entity.setDirection(Number(b)), d.updateRotationView(), q.blur()); + 13 == b.keyCode && (b = q.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), q.blur()); }, q.onblur = function(b) { - d.entity.setDirection(d.entity.getDirection()); + c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); - }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), c = Entry.createElement("span"), c.addClass("entryObjectCoordinateWorkspace"), a.appendChild(c), 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, m = Entry.createElement("input"), m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), c.appendChild(e), c.appendChild(g), c.appendChild(h), c.appendChild(k), c.appendChild(l), c.appendChild(m), - c.xInput_ = g, c.yInput_ = k, c.sizeInput_ = m, this.coordinateView_ = c, d = this, g.onkeypress = function(b) { - 13 == b.keyCode && (isNaN(g.value) || d.entity.setX(Number(g.value)), d.updateCoordinateView(), d.blur()); + }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.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, m = Entry.createElement("input"), m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(m), + d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = m, this.coordinateView_ = d, c = this, g.onkeypress = function(b) { + 13 == b.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(b) { - d.entity.setX(d.entity.getX()); + c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, k.onkeypress = function(b) { - 13 == b.keyCode && (isNaN(k.value) || d.entity.setY(Number(k.value)), d.updateCoordinateView(), d.blur()); + 13 == b.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); }, k.onblur = function(b) { - d.entity.setY(d.entity.getY()); + c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); - }, c = Entry.createElement("div"), c.addClass("rotationMethodWrapper"), a.appendChild(c), this.rotationMethodWrapper_ = c, a = Entry.createElement("span"), a.addClass("entryObjectRotateMethodLabelWorkspace"), c.appendChild(a), a.innerHTML = Lang.Workspace.rotate_method + " : ", a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeAWorkspace"), a.object = this, this.rotateModeAView_ = a, c.appendChild(a), a.bindOnClick(function(b) { + }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), a.appendChild(d), this.rotationMethodWrapper_ = d, a = Entry.createElement("span"), a.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(a), a.innerHTML = Lang.Workspace.rotate_method + " : ", a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeAWorkspace"), a.object = this, this.rotateModeAView_ = a, d.appendChild(a), a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.setRotateMethod("free"); - }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeBWorkspace"), a.object = this, this.rotateModeBView_ = a, c.appendChild(a), a.bindOnClick(function(b) { + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeBWorkspace"), a.object = this, this.rotateModeBView_ = a, d.appendChild(a), a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); - }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeCWorkspace"), a.object = this, this.rotateModeCView_ = a, c.appendChild(a), a.bindOnClick(function(b) { + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeCWorkspace"), a.object = this, this.rotateModeCView_ = a, d.appendChild(a), a.bindOnClick(function(b) { Entry.engine.isState("run") || this.object.setRotateMethod("none"); }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; } @@ -11079,16 +11154,16 @@ Entry.EntryObject.prototype.initEntity = function(a) { b.rotation = 0; b.direction = 90; if ("sprite" == this.objectType) { - var d = a.sprite.pictures[0].dimension; - b.regX = d.width / 2; - b.regY = d.height / 2; - b.scaleX = b.scaleY = "background" == a.sprite.category.main || "new" == a.sprite.category.main ? Math.max(270 / d.height, 480 / d.width) : "new" == a.sprite.category.main ? 1 : 200 / (d.width + d.height); - b.width = d.width; - b.height = d.height; + var c = a.sprite.pictures[0].dimension; + b.regX = c.width / 2; + b.regY = c.height / 2; + b.scaleX = b.scaleY = "background" == a.sprite.category.main || "new" == a.sprite.category.main ? Math.max(270 / c.height, 480 / c.width) : "new" == a.sprite.category.main ? 1 : 200 / (c.width + c.height); + b.width = c.width; + b.height = c.height; } else { if ("textBox" == this.objectType) { if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.text, a.options) { - if (a = a.options, d = "", a.bold && (d += "bold "), a.italic && (d += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = d + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) { + if (a = a.options, c = "", a.bold && (c += "bold "), a.italic && (c += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = c + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) { b.width = 256, b.height = .5625 * b.width, b.regX = b.width / 2, b.regY = b.height / 2; } } else { @@ -11113,10 +11188,10 @@ Entry.EntryObject.prototype.updateThumbnailView = function() { Entry.EntryObject.prototype.updateCoordinateView = function(a) { if ((this.isSelected() || a) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { a = this.coordinateView_.xInput_.value; - var b = this.coordinateView_.yInput_.value, d = this.coordinateView_.sizeInput_.value, c = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); - a != c && (this.coordinateView_.xInput_.value = c); + var b = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); + a != d && (this.coordinateView_.xInput_.value = d); b != e && (this.coordinateView_.yInput_.value = e); - d != f && (this.coordinateView_.sizeInput_.value = f); + c != f && (this.coordinateView_.sizeInput_.value = f); } }; Entry.EntryObject.prototype.updateRotationView = function(a) { @@ -11151,18 +11226,18 @@ Entry.EntryObject.prototype.getPicture = function(a) { return this.selectedPicture; } a = a.trim(); - for (var b = this.pictures, d = b.length, c = 0;c < d;c++) { - if (b[c].id == a) { - return b[c]; + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; } } - for (c = 0;c < d;c++) { - if (b[c].name == a) { - return b[c]; + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; } } a = Entry.parseNumber(a); - if ((!1 !== a || "boolean" != typeof a) && d >= a && 0 < a) { + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { return b[a - 1]; } throw Error("No picture found"); @@ -11177,16 +11252,16 @@ Entry.EntryObject.prototype.setPicture = function(a) { throw Error("No picture found"); }; Entry.EntryObject.prototype.getPrevPicture = function(a) { - for (var b = this.pictures, d = b.length, c = 0;c < d;c++) { - if (b[c].id == a) { - return b[0 == c ? d - 1 : c - 1]; + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[0 == d ? c - 1 : d - 1]; } } }; Entry.EntryObject.prototype.getNextPicture = function(a) { - for (var b = this.pictures, d = b.length, c = 0;c < d;c++) { - if (b[c].id == a) { - return b[c == d - 1 ? 0 : c + 1]; + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d == c - 1 ? 0 : d + 1]; } } }; @@ -11237,7 +11312,7 @@ Entry.EntryObject.prototype.toggleInformation = function(a) { void 0 === a && (a = this.isInformationToggle = !this.isInformationToggle); a ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); }; -Entry.EntryObject.prototype.addCloneEntity = function(a, b, d) { +Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); }; @@ -11278,32 +11353,32 @@ Entry.EntryObject.prototype.destroy = function() { }; Entry.EntryObject.prototype.getSound = function(a) { a = a.trim(); - for (var b = this.sounds, d = b.length, c = 0;c < d;c++) { - if (b[c].id == a) { - return b[c]; + for (var b = this.sounds, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; } } - for (c = 0;c < d;c++) { - if (b[c].name == a) { - return b[c]; + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; } } a = Entry.parseNumber(a); - if ((!1 !== a || "boolean" != typeof a) && d >= a && 0 < a) { + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { return b[a - 1]; } throw Error("No Sound"); }; -Entry.EntryObject.prototype.addCloneVariables = function(a, b, d, c) { +Entry.EntryObject.prototype.addCloneVariables = function(a, b, c, d) { b.variables = []; b.lists = []; - d || (d = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", a.id)); - c || (c = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", a.id)); - for (a = 0;a < d.length;a++) { - b.variables.push(d[a].clone()); - } + c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", a.id)); + d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", a.id)); for (a = 0;a < c.length;a++) { - b.lists.push(c[a].clone()); + b.variables.push(c[a].clone()); + } + for (a = 0;a < d.length;a++) { + b.lists.push(d[a].clone()); } }; Entry.EntryObject.prototype.getLock = function() { @@ -11327,12 +11402,12 @@ Entry.EntryObject.prototype.editObjectValues = function(a) { var b; b = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; if (a) { - var d = this.nameView_; + var c = this.nameView_; $(b).removeClass("selectedNotEditingObject"); - $(d).removeClass("selectedNotEditingObject"); + $(c).removeClass("selectedNotEditingObject"); window.setTimeout(function() { - $(d).removeAttr("readonly"); - d.addClass("selectedEditingObject"); + $(c).removeAttr("readonly"); + c.addClass("selectedEditingObject"); }); for (a = 0;a < b.length;a++) { $(b[a]).removeAttr("readonly"), b[a].addClass("selectedEditingObject"); @@ -11378,7 +11453,7 @@ Entry.EntryObject.prototype.clearExecutor = function() { this.script.clearExecutors(); }; Entry.EntryObject.prototype._rightClick = function(a) { - var b = this, d = [{text:Lang.Workspace.context_rename, callback:function(a) { + var b = this, c = [{text:Lang.Workspace.context_rename, callback:function(a) { a.stopPropagation(); b.setLock(!1); b.editObjectValues(!0); @@ -11393,7 +11468,7 @@ Entry.EntryObject.prototype._rightClick = function(a) { Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); }}]; a = Entry.Utils.convertMouseEvent(a); - Entry.ContextMenu.show(d, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); + Entry.ContextMenu.show(c, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); }; Entry.Painter = function() { this.toolbox = {selected:"cursor"}; @@ -11447,11 +11522,11 @@ Entry.Painter.prototype.initHandle = function() { a.y = 90; a.rect = new createjs.Shape; var b = this; - a.rect.on("mousedown", function(d) { - "cursor" === b.toolbox.selected && (b.initCommand(), this.offset = {x:this.parent.x - this.x - d.stageX, y:this.parent.y - this.y - d.stageY}, this.parent.handleMode = "move", a.isSelectCenter = !1); + a.rect.on("mousedown", function(c) { + "cursor" === b.toolbox.selected && (b.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", a.isSelectCenter = !1); }); - a.rect.on("pressmove", function(d) { - "cursor" !== b.toolbox.selected || a.isSelectCenter || (b.doCommand(), this.parent.x = d.stageX + this.offset.x, this.parent.y = d.stageY + this.offset.y, b.updateImageHandle()); + a.rect.on("pressmove", function(c) { + "cursor" !== b.toolbox.selected || a.isSelectCenter || (b.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, b.updateImageHandle()); }); a.on("mouseup", function(a) { b.checkCommand(); @@ -11554,9 +11629,9 @@ Entry.Painter.prototype.generateYHandle = function() { }; Entry.Painter.prototype.updateImageHandle = function() { if (this.handle.visible) { - var a = this.handle, b = a.direction, d = a.width, c = a.height, e = a.regX, f = a.regY; - a.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-d / 2, -c / 2).lt(0, -c / 2).lt(0, -c / 2).lt(+d / 2, -c / 2).lt(+d / 2, +c / 2).lt(-d / 2, +c / 2).cp(); - a.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -c / 2).lt(0, -c / 2 - 20).cp(); + var a = this.handle, b = a.direction, c = a.width, d = a.height, e = a.regX, f = a.regY; + a.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); + a.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); a.NEHandle.x = +a.width / 2; a.NEHandle.y = -a.height / 2; a.NWHandle.x = -a.width / 2; @@ -11575,8 +11650,8 @@ Entry.Painter.prototype.updateImageHandle = function() { a.SHandle.y = +a.height / 2; a.RHandle.x = -2; a.RHandle.y = -a.height / 2 - 20 - 2; - this.handle.visible && (d = this.selectedObject, this.selectedObject.text ? (d.width = this.selectedObject.width, d.height = this.selectedObject.height) : (d.width = d.image.width, d.height = d.image.height), d.scaleX = a.width / d.width, d.scaleY = a.height / d.height, d.x = a.x, d.y = a.y, d.regX = d.width / 2 + e / d.scaleX, d.regY = d.height / 2 + f / d.scaleY, d.rotation = a.rotation, d.direction = b, this.selectArea.x1 = a.x - a.width / 2, this.selectArea.y1 = a.y - a.height / 2, this.selectArea.x2 = - a.width, this.selectArea.y2 = a.height, this.objectWidthInput.value = Math.abs(d.width * d.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(d.height * d.scaleY).toFixed(0), this.objectRotateInput.value = (1 * d.rotation).toFixed(0)); + this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = a.width / c.width, c.scaleY = a.height / c.height, c.x = a.x, c.y = a.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = a.rotation, c.direction = b, this.selectArea.x1 = a.x - a.width / 2, this.selectArea.y1 = a.y - a.height / 2, this.selectArea.x2 = + a.width, this.selectArea.y2 = a.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); this.updateImageHandleCursor(); this.stage.update(); } @@ -11585,7 +11660,7 @@ Entry.Painter.prototype.updateImageHandleCursor = function() { var a = this.handle; a.rect.cursor = "move"; a.RHandle.cursor = "crosshair"; - for (var b = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], d = Math.floor((a.rotation + 22.5) % 180 / 45), c = 0;c < d;c++) { + for (var b = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((a.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { b.push(b.shift()); } a.NHandle.cursor = b[1]; @@ -11622,13 +11697,13 @@ Entry.Painter.prototype.initPicture = function() { a.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (a.file_ = JSON.parse(JSON.stringify(a.file)), a.file_save(!0)); a.file.modified = !1; a.clearCanvas(!0); - var d = new Image; - d.id = b.id ? b.id : Entry.generateHash(); - a.file.id = d.id; + var c = new Image; + c.id = b.id ? b.id : Entry.generateHash(); + a.file.id = c.id; a.file.name = b.name; a.file.mode = "edit"; - d.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; - d.onload = function(b) { + c.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; + c.onload = function(b) { a.addImage(b.target); }; } @@ -11698,23 +11773,23 @@ Entry.Painter.prototype.updateHandle_ = function() { this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); this.stage.update(); }; -Entry.Painter.prototype.matchTolerance = function(a, b, d, c, e) { +Entry.Painter.prototype.matchTolerance = function(a, b, c, d, e) { var f = this.colorLayerData.data[a], g = this.colorLayerData.data[a + 1]; a = this.colorLayerData.data[a + 2]; - return f >= b - e / 100 * b && f <= b + e / 100 * b && g >= d - e / 100 * d && g <= d + e / 100 * d && a >= c - e / 100 * c && a <= c + e / 100 * c; + return f >= b - e / 100 * b && f <= b + e / 100 * b && g >= c - e / 100 * c && g <= c + e / 100 * c && a >= d - e / 100 * d && a <= d + e / 100 * d; }; -Entry.Painter.prototype.matchColorOnly = function(a, b, d, c) { - return b === this.colorLayerData.data[a] && d === this.colorLayerData.data[a + 1] && c === this.colorLayerData.data[a + 2] ? !0 : !1; +Entry.Painter.prototype.matchColorOnly = function(a, b, c, d) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] ? !0 : !1; }; -Entry.Painter.prototype.matchColor = function(a, b, d, c, e) { - return b === this.colorLayerData.data[a] && d === this.colorLayerData.data[a + 1] && c === this.colorLayerData.data[a + 2] && e === this.colorLayerData.data[a + 3] ? !0 : !1; +Entry.Painter.prototype.matchColor = function(a, b, c, d, e) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] && e === this.colorLayerData.data[a + 3] ? !0 : !1; }; -Entry.Painter.prototype.colorPixel = function(a, b, d, c, e) { +Entry.Painter.prototype.colorPixel = function(a, b, c, d, e) { e || (e = 255); - this.stroke.transparent && (e = c = d = b = 0); + this.stroke.transparent && (e = d = c = b = 0); this.colorLayerData.data[a] = b; - this.colorLayerData.data[a + 1] = d; - this.colorLayerData.data[a + 2] = c; + this.colorLayerData.data[a + 1] = c; + this.colorLayerData.data[a + 2] = d; this.colorLayerData.data[a + 3] = e; }; Entry.Painter.prototype.pickStrokeColor = function(a) { @@ -11724,8 +11799,8 @@ Entry.Painter.prototype.pickStrokeColor = function(a) { document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; }; Entry.Painter.prototype.drawText = function(a) { - var b = document.getElementById("entryPainterAttrFontStyle").value, d = document.getElementById("entryPainterAttrFontName").value, c = document.getElementById("entryPainterAttrFontSize").value; - a = new createjs.Text(a, b + " " + c + 'px "' + d + '"', this.stroke.lineColor); + var b = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; + a = new createjs.Text(a, b + " " + d + 'px "' + c + '"', this.stroke.lineColor); a.textBaseline = "top"; a.x = this.oldPt.x; a.y = this.oldPt.y; @@ -11741,9 +11816,9 @@ Entry.Painter.prototype.addImage = function(a) { b.regX = b.image.width / 2 | 0; b.regY = b.image.height / 2 | 0; if (540 < b.image.height) { - var d = 540 / b.image.height; - b.scaleX = d; - b.scaleY = d; + var c = 540 / b.image.height; + b.scaleX = c; + b.scaleY = c; } b.name = a.id; b.id = a.id; @@ -11794,11 +11869,11 @@ Entry.Painter.prototype.restorePainter = function(a) { this.ctx.putImageData(a, 0, 0); a = new Image; a.src = this.canvas.toDataURL(); - var d = this; + var c = this; a.onload = function(b) { b = new createjs.Bitmap(b.target); - d.objectContainer.removeAllChildren(); - d.objectContainer.addChild(b); + c.objectContainer.removeAllChildren(); + c.objectContainer.addChild(b); }; Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, b); }; @@ -11814,19 +11889,19 @@ Entry.Painter.prototype.fill = function() { this.clearHandle(); var a = this.canvas.width, b = this.canvas.height; this.colorLayerData = this.ctx.getImageData(0, 0, a, b); - var d = new createjs.Point(this.stage.mouseX, this.stage.mouseY); - d.x = Math.round(d.x); - d.y = Math.round(d.y); - for (var c = 4 * (d.y * a + d.x), e = this.colorLayerData.data[c], f = this.colorLayerData.data[c + 1], g = this.colorLayerData.data[c + 2], h = this.colorLayerData.data[c + 3], k, l, d = [[d.x, d.y]], m = Entry.hex2rgb(this.stroke.lineColor);d.length;) { - for (var c = d.pop(), n = c[0], q = c[1], c = 4 * (q * a + n);0 <= q && this.matchColor(c, e, f, g, h);) { - --q, c -= 4 * a; - } - c += 4 * a; + var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); + c.x = Math.round(c.x); + c.y = Math.round(c.y); + for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], m = Entry.hex2rgb(this.stroke.lineColor);c.length;) { + for (var d = c.pop(), n = d[0], q = d[1], d = 4 * (q * a + n);0 <= q && this.matchColor(d, e, f, g, h);) { + --q, d -= 4 * a; + } + d += 4 * a; q += 1; - for (l = k = !1;q < b - 1 && this.matchColor(c, e, f, g, h);) { - q += 1, this.colorPixel(c, m.r, m.g, m.b), 0 < n && (this.matchColor(c - 4, e, f, g, h) ? k || (d.push([n - 1, q]), k = !0) : k && (k = !1)), n < a - 1 && (this.matchColor(c + 4, e, f, g, h) ? l || (d.push([n + 1, q]), l = !0) : l && (l = !1)), c += 4 * a; + for (l = k = !1;q < b - 1 && this.matchColor(d, e, f, g, h);) { + q += 1, this.colorPixel(d, m.r, m.g, m.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, q]), k = !0) : k && (k = !1)), n < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, q]), l = !0) : l && (l = !1)), d += 4 * a; } - if (1080 < d.length) { + if (1080 < c.length) { break; } } @@ -11978,8 +12053,8 @@ Entry.Painter.prototype.file_save = function(a) { Entry.Painter.prototype.transparent = function() { var a = this.canvas.width, b = this.canvas.height; this.colorLayerData = this.ctx.getImageData(0, 0, a, b); - var d = a * (b - 1) * 4, c = 4 * (a - 1), e = 4 * (a * b - 1); - this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(1, b) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(a, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(a, b); + var c = a * (b - 1) * 4, d = 4 * (a - 1), e = 4 * (a * b - 1); + this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, b) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(a, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(a, b); }; Entry.Painter.prototype.fillTransparent = function(a, b) { this.stage.mouseX = a; @@ -11988,9 +12063,9 @@ Entry.Painter.prototype.fillTransparent = function(a, b) { this.fill(); }; Entry.Painter.prototype.trim = function() { - var a = this.canvas.width, b = this.ctx.getImageData(0, 0, a, this.canvas.height), d = b.data.length, c, e = null, f = null, g = null, h = null, k; - for (c = 0;c < d;c += 4) { - 0 !== b.data[c + 3] && (g = c / 4 % a, k = ~~(c / 4 / a), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); + var a = this.canvas.width, b = this.ctx.getImageData(0, 0, a, this.canvas.height), c = b.data.length, d, e = null, f = null, g = null, h = null, k; + for (d = 0;d < c;d += 4) { + 0 !== b.data[d + 3] && (g = d / 4 % a, k = ~~(d / 4 / a), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); } a = h - e; b = g - f; @@ -12007,10 +12082,10 @@ Entry.Painter.prototype.addPicture = function(a) { var b = new Image; b.id = Entry.generateHash(); b.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; - var d = this; + var c = this; b.onload = function(b) { - d.addImage(b.target); - d.selectToolbox("cursor"); + c.addImage(b.target); + c.selectToolbox("cursor"); }; }; Entry.Painter.prototype.initCoordinator = function() { @@ -12025,34 +12100,34 @@ Entry.Painter.prototype.toggleCoordinator = function() { this.stage.update(); }; Entry.Painter.prototype.initDashedLine = function() { - createjs.Graphics.prototype.dashedLineTo = function(a, b, d, c, e) { + createjs.Graphics.prototype.dashedLineTo = function(a, b, c, d, e) { this.moveTo(a, b); - var f = d - a, g = c - b; + var f = c - a, g = d - b; e = Math.floor(Math.sqrt(f * f + g * g) / e); for (var f = f / e, g = g / e, h = 0;h++ < e;) { a += f, b += g, this[0 === h % 2 ? "moveTo" : "lineTo"](a, b); } - this[0 === h % 2 ? "moveTo" : "lineTo"](d, c); + this[0 === h % 2 ? "moveTo" : "lineTo"](c, d); return this; }; - createjs.Graphics.prototype.drawDashedRect = function(a, b, d, c, e) { + createjs.Graphics.prototype.drawDashedRect = function(a, b, c, d, e) { this.moveTo(a, b); - d = a + d; - c = b + c; - this.dashedLineTo(a, b, d, b, e); - this.dashedLineTo(d, b, d, c, e); - this.dashedLineTo(d, c, a, c, e); - this.dashedLineTo(a, c, a, b, e); + c = a + c; + d = b + d; + this.dashedLineTo(a, b, c, b, e); + this.dashedLineTo(c, b, c, d, e); + this.dashedLineTo(c, d, a, d, e); + this.dashedLineTo(a, d, a, b, e); return this; }; - createjs.Graphics.prototype.drawResizableDashedRect = function(a, b, d, c, e, f) { + createjs.Graphics.prototype.drawResizableDashedRect = function(a, b, c, d, e, f) { this.moveTo(a, b); - d = a + d; - c = b + c; - this.dashedLineTo(a + f, b, d - f, b, e); - this.dashedLineTo(d, b + f, d, c - f, e); - this.dashedLineTo(d - f, c, a + f, c, e); - this.dashedLineTo(a, c - f, a, b + f, e); + c = a + c; + d = b + d; + this.dashedLineTo(a + f, b, c - f, b, e); + this.dashedLineTo(c, b + f, c, d - f, e); + this.dashedLineTo(c - f, d, a + f, d, e); + this.dashedLineTo(a, d - f, a, b + f, e); return this; }; }; @@ -12061,15 +12136,15 @@ Entry.Painter.prototype.generateView = function(a) { this.view_ = a; if (!Entry.type || "workspace" == Entry.type) { this.view_.addClass("entryPainterWorkspace"); - var d = Entry.createElement("div", "entryPainterTop"); - d.addClass("entryPlaygroundPainterTop"); - this.view_.appendChild(d); - var c = Entry.createElement("div", "entryPainterToolbox"); - c.addClass("entryPlaygroundPainterToolbox"); + var c = Entry.createElement("div", "entryPainterTop"); + c.addClass("entryPlaygroundPainterTop"); this.view_.appendChild(c); + var d = Entry.createElement("div", "entryPainterToolbox"); + d.addClass("entryPlaygroundPainterToolbox"); + this.view_.appendChild(d); var e = Entry.createElement("div", "entryPainterToolboxTop"); e.addClass("entryPainterToolboxTop"); - c.appendChild(e); + d.appendChild(e); var f = Entry.createElement("div", "entryPainterContainer"); f.addClass("entryPlaygroundPainterContainer"); this.view_.appendChild(f); @@ -12104,18 +12179,18 @@ Entry.Painter.prototype.generateView = function(a) { e.addClass("entryPlaygroundPainterFlipY"); this.flipObject.appendChild(e); Entry.addEventListener("windowResized", function(b) { - var d = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + var c = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; b = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - var c = parseInt(document.getElementById("entryCanvas").style.width), d = d - (c + 240), c = b - 349; - a.style.width = d + "px"; - f.style.width = d - 54 + "px"; - f.style.height = c + "px"; - g.style.top = c + 30 + "px"; - g.style.height = b - c + "px"; + var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = b - 349; + a.style.width = c + "px"; + f.style.width = c - 54 + "px"; + f.style.height = d + "px"; + g.style.top = d + 30 + "px"; + g.style.height = b - d + "px"; }); var h = Entry.createElement("nav", "entryPainterTopMenu"); h.addClass("entryPlaygroundPainterTopMenu"); - d.appendChild(h); + c.appendChild(h); e = Entry.createElement("ul"); h.appendChild(e); var k = Entry.createElement("li"); @@ -12205,108 +12280,108 @@ Entry.Painter.prototype.generateView = function(a) { k.appendChild(e); this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); e.addClass("entryPlaygroundPainterTopStageXY"); - d.appendChild(e); + c.appendChild(e); e = Entry.createElement("ul", "entryPainterTopToolbar"); e.addClass("entryPlaygroundPainterTopToolbar"); - d.appendChild(e); - d = Entry.createElement("li", "entryPainterTopToolbarUndo"); - d.bindOnClick(function() { + c.appendChild(e); + c = Entry.createElement("li", "entryPainterTopToolbarUndo"); + c.bindOnClick(function() { }); - d.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(d); - d = Entry.createElement("li", "entryPainterTopToolbarRedo"); - d.bindOnClick(function() { + c.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(c); + c = Entry.createElement("li", "entryPainterTopToolbarRedo"); + c.bindOnClick(function() { }); - d.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(d); - d = Entry.createElement("ul"); - d.addClass("entryPlaygroundPainterToolboxContainer"); - c.appendChild(d); + c.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(c); + c = Entry.createElement("ul"); + c.addClass("entryPlaygroundPainterToolboxContainer"); + d.appendChild(c); this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); this.toolboxCursor.title = "\uc774\ub3d9"; this.toolboxCursor.bindOnClick(function() { b.selectToolbox("cursor"); }); this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); - d.appendChild(this.toolboxCursor); + c.appendChild(this.toolboxCursor); this.toolboxSelect = Entry.createElement("li", "entryPainterToolboxSelect"); this.toolboxSelect.title = "\uc790\ub974\uae30"; this.toolboxSelect.bindOnClick(function() { b.selectToolbox("select"); }); this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); - d.appendChild(this.toolboxSelect); + c.appendChild(this.toolboxSelect); this.toolboxPen = Entry.createElement("li", "entryPainterToolboxPen"); this.toolboxPen.title = "\ud39c"; this.toolboxPen.bindOnClick(function() { b.selectToolbox("pen"); }); this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); - d.appendChild(this.toolboxPen); + c.appendChild(this.toolboxPen); this.toolboxLine = Entry.createElement("li", "entryPainterToolboxLine"); this.toolboxLine.title = "\uc9c1\uc120"; this.toolboxLine.bindOnClick(function() { b.selectToolbox("line"); }); this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); - d.appendChild(this.toolboxLine); + c.appendChild(this.toolboxLine); this.toolboxRect = Entry.createElement("li", "entryPainterToolboxRect"); this.toolboxRect.title = "\uc0ac\uac01\ud615"; this.toolboxRect.bindOnClick(function() { b.selectToolbox("rect"); }); this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); - d.appendChild(this.toolboxRect); + c.appendChild(this.toolboxRect); this.toolboxCircle = Entry.createElement("li", "entryPainterToolboxCircle"); this.toolboxCircle.title = "\uc6d0"; this.toolboxCircle.bindOnClick(function() { b.selectToolbox("circle"); }); this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); - d.appendChild(this.toolboxCircle); + c.appendChild(this.toolboxCircle); this.toolboxText = Entry.createElement("li", "entryPainterToolboxText"); this.toolboxText.title = "\uae00\uc0c1\uc790"; this.toolboxText.bindOnClick(function() { b.selectToolbox("text"); }); this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); - d.appendChild(this.toolboxText); + c.appendChild(this.toolboxText); this.toolboxFill = Entry.createElement("li", "entryPainterToolboxFill"); this.toolboxFill.bindOnClick(function() { b.selectToolbox("fill"); }); this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); - d.appendChild(this.toolboxFill); + c.appendChild(this.toolboxFill); this.toolboxErase = Entry.createElement("li", "entryPainterToolboxErase"); this.toolboxErase.title = "\uc9c0\uc6b0\uae30"; this.toolboxErase.bindOnClick(function() { b.selectToolbox("erase"); }); this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); - d.appendChild(this.toolboxErase); - c = Entry.createElement("li", "entryPainterToolboxCoordinate"); - c.title = "\uc88c\ud45c"; - c.bindOnClick(function() { + c.appendChild(this.toolboxErase); + d = Entry.createElement("li", "entryPainterToolboxCoordinate"); + d.title = "\uc88c\ud45c"; + d.bindOnClick(function() { b.toggleCoordinator(); }); - c.addClass("entryPlaygroundPainterToolboxCoordinate"); - d.appendChild(c); + d.addClass("entryPlaygroundPainterToolboxCoordinate"); + c.appendChild(d); this.attrResizeArea = Entry.createElement("fieldset", "painterAttrResize"); this.attrResizeArea.addClass("entryPlaygroundPainterAttrResize"); g.appendChild(this.attrResizeArea); - c = Entry.createElement("legend"); - c.innerHTML = Lang.Workspace.picture_size; - this.attrResizeArea.appendChild(c); - c = Entry.createElement("div", "painterAttrWrapper"); - c.addClass("painterAttrWrapper"); - this.attrResizeArea.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrResizeX"); - c.appendChild(d); + d = Entry.createElement("legend"); + d.innerHTML = Lang.Workspace.picture_size; + this.attrResizeArea.appendChild(d); + d = Entry.createElement("div", "painterAttrWrapper"); + d.addClass("painterAttrWrapper"); + this.attrResizeArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrResizeX"); + d.appendChild(c); e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrResizeXTop"); e.innerHTML = "X"; - d.appendChild(e); + c.appendChild(e); this.objectWidthInput = Entry.createElement("input", "entryPainterAttrWidth"); this.objectWidthInput.onblur = function() { if (isNaN(this.value)) { @@ -12316,18 +12391,18 @@ Entry.Painter.prototype.generateView = function(a) { b.updateImageHandle(); }; this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); - d.appendChild(this.objectWidthInput); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterSizeText"); - d.innerHTML = "x"; - c.appendChild(d); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundAttrReiszeY"); - c.appendChild(d); + c.appendChild(this.objectWidthInput); c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrResizeYTop"); - c.innerHTML = "Y"; + c.addClass("entryPlaygroundPainterSizeText"); + c.innerHTML = "x"; d.appendChild(c); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundAttrReiszeY"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrResizeYTop"); + d.innerHTML = "Y"; + c.appendChild(d); this.objectHeightInput = Entry.createElement("input", "entryPainterAttrHeight"); this.objectHeightInput.onblur = function() { if (isNaN(this.value)) { @@ -12337,21 +12412,21 @@ Entry.Painter.prototype.generateView = function(a) { b.updateImageHandle(); }; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput"); - d.appendChild(this.objectHeightInput); + c.appendChild(this.objectHeightInput); this.attrRotateArea = Entry.createElement("div", "painterAttrRotateArea"); this.attrRotateArea.addClass("painterAttrRotateArea"); g.appendChild(this.attrRotateArea); - c = Entry.createElement("div"); - c.addClass("painterAttrRotateName"); - c.innerHTML = Lang.Workspace.picture_rotation; - this.attrRotateArea.appendChild(c); - c = Entry.createElement("fieldset", "entryPainterAttrRotate"); - c.addClass("entryPlaygroundPainterAttrRotate"); - this.attrRotateArea.appendChild(c); d = Entry.createElement("div"); - d.addClass("painterAttrRotateTop"); - d.innerHTML = "\u03bf"; - c.appendChild(d); + d.addClass("painterAttrRotateName"); + d.innerHTML = Lang.Workspace.picture_rotation; + this.attrRotateArea.appendChild(d); + d = Entry.createElement("fieldset", "entryPainterAttrRotate"); + d.addClass("entryPlaygroundPainterAttrRotate"); + this.attrRotateArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("painterAttrRotateTop"); + c.innerHTML = "\u03bf"; + d.appendChild(c); this.objectRotateInput = Entry.createElement("input", "entryPainterAttrDegree"); this.objectRotateInput.onblur = function() { if (isNaN(this.value)) { @@ -12363,7 +12438,7 @@ Entry.Painter.prototype.generateView = function(a) { }; this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); this.objectRotateInput.defaultValue = "0"; - c.appendChild(this.objectRotateInput); + d.appendChild(this.objectRotateInput); this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); g.appendChild(this.attrColorArea); @@ -12373,14 +12448,14 @@ Entry.Painter.prototype.generateView = function(a) { this.attrCircleArea = Entry.createElement("div"); this.attrCircleArea.addClass("painterAttrCircleArea"); g.appendChild(this.attrCircleArea); - c = Entry.createElement("div", "entryPainterAttrCircle"); - c.addClass("painterAttrCircle"); - this.attrCircleArea.appendChild(c); - this.attrCircleArea.painterAttrCircle = c; - c = Entry.createElement("input", "entryPainterAttrCircleInput"); - c.value = "#000000"; - c.addClass("painterAttrCircleInput"); - this.attrCircleArea.appendChild(c); + d = Entry.createElement("div", "entryPainterAttrCircle"); + d.addClass("painterAttrCircle"); + this.attrCircleArea.appendChild(d); + this.attrCircleArea.painterAttrCircle = d; + d = Entry.createElement("input", "entryPainterAttrCircleInput"); + d.value = "#000000"; + d.addClass("painterAttrCircleInput"); + this.attrCircleArea.appendChild(d); this.attrColorSpoid = Entry.createElement("div"); this.attrColorSpoid.bindOnClick(function() { b.selectToolbox("spoid"); @@ -12388,46 +12463,46 @@ Entry.Painter.prototype.generateView = function(a) { this.attrColorSpoid.addClass("painterAttrColorSpoid"); g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(a) { - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrColorElement"); - "transparent" === a ? d.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : d.style.backgroundColor = a; - d.bindOnClick(function(d) { + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrColorElement"); + "transparent" === a ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = a; + c.bindOnClick(function(c) { "transparent" === a ? (b.stroke.transparent = !0, b.stroke.lineColor = "#ffffff") : (b.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = a, b.stroke.fillColor = a), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = a, b.stroke.lineColor = a)); document.getElementById("entryPainterAttrCircle").style.backgroundColor = b.stroke.lineColor; document.getElementById("entryPainterAttrCircleInput").value = a; }); - m.appendChild(d); + m.appendChild(c); }); this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); g.appendChild(this.attrThickArea); - c = Entry.createElement("legend"); - c.addClass("painterAttrThickName"); - c.innerHTML = Lang.Workspace.thickness; - this.attrThickArea.appendChild(c); + d = Entry.createElement("legend"); + d.addClass("painterAttrThickName"); + d.innerHTML = Lang.Workspace.thickness; + this.attrThickArea.appendChild(d); var n = Entry.createElement("fieldset", "entryPainterAttrThick"); n.addClass("entryPlaygroundPainterAttrThick"); this.attrThickArea.appendChild(n); - c = Entry.createElement("div"); - c.addClass("paintAttrThickTop"); - n.appendChild(c); + d = Entry.createElement("div"); + d.addClass("paintAttrThickTop"); + n.appendChild(d); e = Entry.createElement("select", "entryPainterAttrThick"); e.addClass("entryPlaygroundPainterAttrThickInput"); e.size = "1"; e.onchange = function(a) { b.stroke.thickness = a.target.value; }; - for (c = 1;10 >= c;c++) { - d = Entry.createElement("option"), d.value = c, d.innerHTML = c, e.appendChild(d); + for (d = 1;10 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); } n.appendChild(e); - c = Entry.createElement("div", "entryPainterShapeLineColor"); - c.addClass("painterAttrShapeLineColor"); - d = Entry.createElement("div", "entryPainterShapeInnerBackground"); - d.addClass("painterAttrShapeInnerBackground"); - c.appendChild(d); - n.appendChild(c); - this.attrThickArea.painterAttrShapeLineColor = c; + d = Entry.createElement("div", "entryPainterShapeLineColor"); + d.addClass("painterAttrShapeLineColor"); + c = Entry.createElement("div", "entryPainterShapeInnerBackground"); + c.addClass("painterAttrShapeInnerBackground"); + d.appendChild(c); + n.appendChild(d); + this.attrThickArea.painterAttrShapeLineColor = d; n.bindOnClick(function() { q.style.zIndex = "1"; this.style.zIndex = "10"; @@ -12436,16 +12511,16 @@ Entry.Painter.prototype.generateView = function(a) { this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); g.appendChild(this.attrBackgroundArea); - c = Entry.createElement("fieldset", "entryPainterAttrbackground"); - c.addClass("entryPlaygroundPainterAttrBackground"); - this.attrBackgroundArea.appendChild(c); - d = Entry.createElement("div"); - d.addClass("paintAttrBackgroundTop"); - c.appendChild(d); + d = Entry.createElement("fieldset", "entryPainterAttrbackground"); + d.addClass("entryPlaygroundPainterAttrBackground"); + this.attrBackgroundArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("paintAttrBackgroundTop"); + d.appendChild(c); var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); q.addClass("painterAttrShapeBackgroundColor"); this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; - d.appendChild(q); + c.appendChild(q); var r = !1; q.bindOnClick(function(b) { n.style.zIndex = "1"; @@ -12458,44 +12533,44 @@ Entry.Painter.prototype.generateView = function(a) { e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrTop"); this.attrFontArea.appendChild(e); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPaintAttrTop_"); - e.appendChild(c); - c = Entry.createElement("legend"); - c.addClass("panterAttrFontTitle"); - c.innerHTML = Lang.Workspace.textStyle; + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPaintAttrTop_"); + e.appendChild(d); + d = Entry.createElement("legend"); + d.addClass("panterAttrFontTitle"); + d.innerHTML = Lang.Workspace.textStyle; k = Entry.createElement("select", "entryPainterAttrFontName"); k.addClass("entryPlaygroundPainterAttrFontName"); k.size = "1"; k.onchange = function(a) { b.font.name = a.target.value; }; - for (c = 0;c < Entry.fonts.length;c++) { - h = Entry.fonts[c], d = Entry.createElement("option"), d.value = h.family, d.innerHTML = h.name, k.appendChild(d); + for (d = 0;d < Entry.fonts.length;d++) { + h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); } e.appendChild(k); e = Entry.createElement("div"); e.addClass("painterAttrFontSizeArea"); this.attrFontArea.appendChild(e); - c = Entry.createElement("div"); - c.addClass("painterAttrFontSizeTop"); - e.appendChild(c); + d = Entry.createElement("div"); + d.addClass("painterAttrFontSizeTop"); + e.appendChild(d); k = Entry.createElement("select", "entryPainterAttrFontSize"); k.addClass("entryPlaygroundPainterAttrFontSize"); k.size = "1"; k.onchange = function(a) { b.font.size = a.target.value; }; - for (c = 20;72 >= c;c++) { - d = Entry.createElement("option"), d.value = c, d.innerHTML = c, k.appendChild(d); + for (d = 20;72 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); } e.appendChild(k); e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrFontStyleArea"); this.attrFontArea.appendChild(e); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrFontTop"); - e.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrFontTop"); + e.appendChild(d); k = Entry.createElement("select", "entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle"); k.size = "1"; @@ -12503,8 +12578,8 @@ Entry.Painter.prototype.generateView = function(a) { b.font.style = a.target.value; }; h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; - for (c = 0;c < h.length;c++) { - l = h[c], d = Entry.createElement("option"), d.value = l.value, d.innerHTML = l.label, k.appendChild(d); + for (d = 0;d < h.length;d++) { + l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); } e.appendChild(k); this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); @@ -12516,10 +12591,10 @@ Entry.Painter.prototype.generateView = function(a) { var u = Entry.createElement("div"); u.addClass("entryPlaygroundPaitnerAttrLineArea"); this.attrLineArea.appendChild(u); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(c); - c.value = "line"; + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); + u.appendChild(d); + d.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); t.bindOnClick(function(b) { @@ -12531,7 +12606,7 @@ Entry.Painter.prototype.generateView = function(a) { u.onmouseleave = function(b) { this.addClass("entryRemove"); }; - c.bindOnClick(function(b) { + d.bindOnClick(function(b) { this.attrLineArea.removeClass(t); this.attrLineArea.appendChild(v); this.attrLineArea.onchange(b); @@ -12764,9 +12839,9 @@ Entry.Painter2 = function(a) { }; a._keyboardPressControl = function(b) { if (this.isShow && !Entry.Utils.isInInput(b)) { - var a = b.keyCode || b.which, c = b.ctrlKey; - 8 == a || 46 == a ? (this.cut(), b.preventDefault()) : c && (67 == a ? this.copy() : 88 == a && this.cut()); - c && 86 == a && this.paste(); + var a = b.keyCode || b.which, d = b.ctrlKey; + 8 == a || 46 == a ? (this.cut(), b.preventDefault()) : d && (67 == a ? this.copy() : 88 == a && this.cut()); + d && 86 == a && this.paste(); this.lc.trigger("keyDown", b); } }; @@ -12777,37 +12852,37 @@ Entry.Painter2 = function(a) { var b = this, a = Entry.createElement(document.getElementById("canvas-top-menu")); a.addClass("entryPlaygroundPainterTop"); a.addClass("entryPainterTop"); - var c = Entry.createElement("nav", "entryPainterTopMenu"); - c.addClass("entryPlaygroundPainterTopMenu"); - a.appendChild(c); + var d = Entry.createElement("nav", "entryPainterTopMenu"); + d.addClass("entryPlaygroundPainterTopMenu"); + a.appendChild(d); var e = Entry.createElement("ul"); - c.appendChild(e); + d.appendChild(e); var f = Entry.createElement("li"); - c.appendChild(f); - c = Entry.createElement("a", "entryPainterTopMenuFileNew"); - c.bindOnClick(function() { + d.appendChild(f); + d = Entry.createElement("a", "entryPainterTopMenuFileNew"); + d.bindOnClick(function() { b.newPicture(); }); - c.addClass("entryPlaygroundPainterTopMenuFileNew"); - c.innerHTML = Lang.Workspace.new_picture; - f.appendChild(c); - c = Entry.createElement("li", "entryPainterTopMenuFile"); - c.addClass("entryPlaygroundPainterTopMenuFile"); - c.innerHTML = Lang.Workspace.painter_file; - e.appendChild(c); + d.addClass("entryPlaygroundPainterTopMenuFileNew"); + d.innerHTML = Lang.Workspace.new_picture; + f.appendChild(d); + d = Entry.createElement("li", "entryPainterTopMenuFile"); + d.addClass("entryPlaygroundPainterTopMenuFile"); + d.innerHTML = Lang.Workspace.painter_file; + e.appendChild(d); f = Entry.createElement("ul"); - c.appendChild(f); - c = Entry.createElement("li"); - f.appendChild(c); + d.appendChild(f); + d = Entry.createElement("li"); + f.appendChild(d); var g = Entry.createElement("a", "entryPainterTopMenuFileSave"); g.bindOnClick(function() { b.file_save(!1); }); g.addClass("entryPainterTopMenuFileSave"); g.innerHTML = Lang.Workspace.painter_file_save; - c.appendChild(g); - c = Entry.createElement("li"); - f.appendChild(c); + d.appendChild(g); + d = Entry.createElement("li"); + f.appendChild(d); f = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); f.bindOnClick(function() { b.file.mode = "new"; @@ -12815,7 +12890,7 @@ Entry.Painter2 = function(a) { }); f.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); f.innerHTML = Lang.Workspace.painter_file_saveas; - c.appendChild(f); + d.appendChild(f); f = Entry.createElement("li", "entryPainterTopMenuEdit"); f.addClass("entryPlaygroundPainterTopMenuEdit"); f.innerHTML = Lang.Workspace.painter_edit; @@ -12824,42 +12899,42 @@ Entry.Painter2 = function(a) { f.appendChild(e); f = Entry.createElement("li"); e.appendChild(f); - c = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); - c.bindOnClick(function() { + d = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); + d.bindOnClick(function() { Entry.dispatchEvent("openPictureImport"); }); - c.addClass("entryPainterTopMenuEditImport"); - c.innerHTML = Lang.Workspace.get_file; - f.appendChild(c); + d.addClass("entryPainterTopMenuEditImport"); + d.innerHTML = Lang.Workspace.get_file; + f.appendChild(d); f = Entry.createElement("li"); e.appendChild(f); - c = Entry.createElement("a", "entryPainterTopMenuEditCopy"); - c.bindOnClick(function() { + d = Entry.createElement("a", "entryPainterTopMenuEditCopy"); + d.bindOnClick(function() { b.copy(); }); - c.addClass("entryPlaygroundPainterTopMenuEditCopy"); - c.innerHTML = Lang.Workspace.copy_file; - f.appendChild(c); + d.addClass("entryPlaygroundPainterTopMenuEditCopy"); + d.innerHTML = Lang.Workspace.copy_file; + f.appendChild(d); this._copyButton = f; f = Entry.createElement("li"); e.appendChild(f); - c = Entry.createElement("a", "entryPainterTopMenuEditCut"); - c.bindOnClick(function() { + d = Entry.createElement("a", "entryPainterTopMenuEditCut"); + d.bindOnClick(function() { b.cut(); }); - c.addClass("entryPlaygroundPainterTopMenuEditCut"); - c.innerHTML = Lang.Workspace.cut_picture; - f.appendChild(c); + d.addClass("entryPlaygroundPainterTopMenuEditCut"); + d.innerHTML = Lang.Workspace.cut_picture; + f.appendChild(d); this._cutButton = f; f = Entry.createElement("li"); e.appendChild(f); - c = Entry.createElement("a", "entryPainterTopMenuEditPaste"); - c.bindOnClick(function() { + d = Entry.createElement("a", "entryPainterTopMenuEditPaste"); + d.bindOnClick(function() { b.paste(); }); - c.addClass("entryPlaygroundPainterTopMenuEditPaste"); - c.innerHTML = Lang.Workspace.paste_picture; - f.appendChild(c); + d.addClass("entryPlaygroundPainterTopMenuEditPaste"); + d.innerHTML = Lang.Workspace.paste_picture; + f.appendChild(d); this._pasteButton = f; f = Entry.createElement("li"); e.appendChild(f); @@ -12894,8 +12969,8 @@ Entry.BlockParser = function(a) { } var a = ""; b = b.getThreads(); - for (var c = 0;c < b.length;c++) { - a += this.Thread(b[c]); + for (var d = 0;d < b.length;d++) { + a += this.Thread(b[d]); } return a; }; @@ -12905,8 +12980,8 @@ Entry.BlockParser = function(a) { } var a = ""; b = b.getBlocks(); - for (var c = 0;c < b.length;c++) { - a += this.Block(b[c]); + for (var d = 0;d < b.length;d++) { + a += this.Block(b[d]); } return a; }; @@ -12926,10 +13001,10 @@ Entry.BlockParser = function(a) { return "function promise() {\n" + this.indent(b) + "}\n"; }; a.BasicIteration = function(b) { - var a = b.params[0], c = this.publishIterateVariable(); + var a = b.params[0], d = this.publishIterateVariable(); b = this.Thread(b.statements[0]); this.unpublishIterateVariable(); - return "for (var " + c + " = 0; " + c + " < " + a + "; " + c + "++){\n" + this.indent(b) + "}\n"; + return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++){\n" + this.indent(b) + "}\n"; }; a.BasicIf = function(b) { var a = this.Thread(b.statements[0]); @@ -12964,11 +13039,11 @@ Entry.JSParser = function(a) { }; (function(a) { a.Program = function(b) { - var a = [], c = []; - c.push({type:this.syntax.Program}); - var e = this.initScope(b), c = c.concat(this.BlockStatement(b)); + var a = [], d = []; + d.push({type:this.syntax.Program}); + var e = this.initScope(b), d = d.concat(this.BlockStatement(b)); this.unloadScope(); - a.push(c); + a.push(d); return a = a.concat(e); }; a.Identifier = function(b, a) { @@ -12979,32 +13054,32 @@ Entry.JSParser = function(a) { return this[b.type](b); }; a.ForStatement = function(b) { - var a = b.init, c = b.test, e = b.update, f = b.body; + var a = b.init, d = b.test, e = b.update, f = b.body; if (this.syntax.ForStatement) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - var f = this[f.type](f), a = a.declarations[0].init.value, g = c.operator, c = c.right.value, h = 0; - "++" != e.operator && (e = a, a = c, c = e); + var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; + "++" != e.operator && (e = a, a = d, d = e); switch(g) { case "<": - h = c - a; + h = d - a; break; case "<=": - h = c + 1 - a; + h = d + 1 - a; break; case ">": - h = a - c; + h = a - d; break; case ">=": - h = a + 1 - c; + h = a + 1 - d; } return this.BasicIteration(b, h, f); }; a.BlockStatement = function(b) { var a = []; b = b.body; - for (var c = 0;c < b.length;c++) { - var e = b[c], f = this[e.type](e); + for (var d = 0;d < b.length;d++) { + var e = b[d], f = this[e.type](e); if (f) { if (void 0 === f.type) { throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; @@ -13057,8 +13132,8 @@ Entry.JSParser = function(a) { throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; }; a.WhileStatement = function(b) { - var a = b.body, c = this.syntax.WhileStatement, a = this[a.type](a); - if (c) { + var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); + if (d) { throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } return this.BasicWhile(b, a); @@ -13118,17 +13193,17 @@ Entry.JSParser = function(a) { return ["||", "&&"]; }; a.MemberExpression = function(b) { - var a = b.object, c = b.property; + var a = b.object, d = b.property; console.log(a.type); a = this[a.type](a); console.log(a); - c = this[c.type](c, a); + d = this[d.type](d, a); if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; } - a = c; + a = d; if (!a) { - throw {message:c + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; + throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; } return a; }; @@ -13167,8 +13242,8 @@ Entry.JSParser = function(a) { }; a.scanDefinition = function(b) { b = b.body; - for (var a = [], c = 0;c < b.length;c++) { - var e = b[c]; + for (var a = [], d = 0;d < b.length;d++) { + var e = b[d]; "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); } return a; @@ -13176,12 +13251,12 @@ Entry.JSParser = function(a) { a.BasicFunction = function(b, a) { return null; }; - a.BasicIteration = function(b, a, c) { - var e = this.syntax.BasicIteration; - if (!e) { + a.BasicIteration = function(b, a, d) { + var c = this.syntax.BasicIteration; + if (!c) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - return {params:[a], type:e, statements:[c]}; + return {params:[a], type:c, statements:[d]}; }; a.BasicWhile = function(b, a) { var c = b.test.raw; @@ -13193,18 +13268,18 @@ Entry.JSParser = function(a) { a.BasicIf = function(b) { var a = b.consequent, a = this[a.type](a); try { - var c = "", e = "===" === b.test.operator ? "==" : b.test.operator; + var d = "", e = "===" === b.test.operator ? "==" : b.test.operator; if ("Identifier" === b.test.left.type && "Literal" === b.test.right.type) { - c = b.test.left.name + " " + e + " " + b.test.right.raw; + d = b.test.left.name + " " + e + " " + b.test.right.raw; } else { if ("Literal" === b.test.left.type && "Identifier" === b.test.right.type) { - c = b.test.right.name + " " + e + " " + b.test.left.raw; + d = b.test.right.name + " " + e + " " + b.test.left.raw; } else { throw Error(); } } - if (this.syntax.BasicIf[c]) { - return Array.isArray(a) || "object" !== typeof a || (a = [a]), {type:this.syntax.BasicIf[c], statements:[a]}; + if (this.syntax.BasicIf[d]) { + return Array.isArray(a) || "object" !== typeof a || (a = [a]), {type:this.syntax.BasicIf[d], statements:[a]}; } throw Error(); } catch (f) { @@ -13213,10 +13288,10 @@ Entry.JSParser = function(a) { }; })(Entry.JSParser.prototype); Entry.ParserOld = {}; -Entry.Parser = function(a, b, d) { +Entry.Parser = function(a, b, c) { this._mode = a; this.syntax = {}; - this.codeMirror = d; + this.codeMirror = c; this._lang = b || "js"; this.availableCode = []; "maze" === a && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); @@ -13225,16 +13300,16 @@ Entry.Parser = function(a, b, d) { case "js": this._parser = new Entry.JSParser(this.syntax); b = this.syntax; - var c = {}, e; + var d = {}, e; for (e in b.Scope) { - c[e + "();\n"] = b.Scope[e]; + d[e + "();\n"] = b.Scope[e]; } - "BasicIf" in b && (c.front = "BasicIf"); + "BasicIf" in b && (d.front = "BasicIf"); CodeMirror.commands.javascriptComplete = function(b) { - CodeMirror.showHint(b, null, {globalScope:c}); + CodeMirror.showHint(b, null, {globalScope:d}); }; - d.on("keyup", function(b, a) { - !b.state.completionActive && 65 <= a.keyCode && 95 >= a.keyCode && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:c}); + c.on("keyup", function(b, a) { + !b.state.completionActive && 65 <= a.keyCode && 95 >= a.keyCode && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:d}); }); break; case "block": @@ -13247,14 +13322,14 @@ Entry.Parser = function(a, b, d) { switch(this._lang) { case "js": try { - var c = acorn.parse(b), a = this._parser.Program(c); + var d = acorn.parse(b), a = this._parser.Program(d); } catch (e) { this.codeMirror && (e instanceof SyntaxError ? (b = {from:{line:e.loc.line - 1, ch:e.loc.column - 2}, to:{line:e.loc.line - 1, ch:e.loc.column + 1}}, e.message = "\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4.") : (b = this.getLineNumber(e.node.start, e.node.end), b.message = e.message, b.severity = "error", this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0})), Entry.toast.alert("Error", e.message)), a = []; } break; case "block": - b = this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g), a = Array.isArray(b) ? b.reduce(function(b, a, d) { - 1 === d && (b += "\n"); + b = this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g), a = Array.isArray(b) ? b.reduce(function(b, a, c) { + 1 === c && (b += "\n"); return (-1 < a.indexOf("function") ? a + b : b + a) + "\n"; }) : ""; } @@ -13271,8 +13346,8 @@ Entry.Parser = function(a, b, d) { return e; }; a.mappingSyntax = function(b) { - for (var a = Object.keys(Entry.block), c = 0;c < a.length;c++) { - var e = a[c], f = Entry.block[e]; + for (var a = Object.keys(Entry.block), d = 0;d < a.length;d++) { + var e = a[d], f = Entry.block[e]; if (f.mode === b && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { for (var g = this.syntax, h = 0;h < f.length;h++) { var k = f[h]; @@ -13311,12 +13386,12 @@ p.generateView = function(a) { var b = Entry.createElement("div", "entryPdfWorkspace"); b.addClass("entryRemove"); this._view = b; - var d = "/pdfjs/web/viewer.html"; - a && "" != a && (d += "?file=" + a); + var c = "/pdfjs/web/viewer.html"; + a && "" != a && (c += "?file=" + a); pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); pdfViewIframe.setAttribute("id", "pdfViewIframe"); pdfViewIframe.setAttribute("frameborder", 0); - pdfViewIframe.setAttribute("src", d); + pdfViewIframe.setAttribute("src", c); b.appendChild(pdfViewIframe); }; p.getView = function() { @@ -13359,7 +13434,7 @@ Entry.FieldTrashcan = function(a) { a.checkBlock = function() { var b = this.dragBlock; if (b && b.block.isDeletable()) { - var a = this.board.offset(), c = this.getPosition(), e = c.x + a.left, a = c.y + a.top, f, g; + var a = this.board.offset(), d = this.getPosition(), e = d.x + a.left, a = d.y + a.top, f, g; if (b = b.dragInstance) { f = b.offsetX, g = b.offsetY; } @@ -13384,9 +13459,9 @@ Entry.FieldTrashcan = function(a) { a.tAnimation = function(b) { if (b !== this.isOver) { b = void 0 === b ? !0 : b; - var a, c = this.trashcanTop; + var a, d = this.trashcanTop; a = b ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; - $(c).velocity(a, {duration:50}); + $(d).velocity(a, {duration:50}); this.isOver = b; } }; @@ -13394,8 +13469,8 @@ Entry.FieldTrashcan = function(a) { this._dragBlockObserver && this._dragBlockObserver.destroy(); this.board = b; this.svgGroup || this._generateView(); - var a = b.svg, c = a.firstChild; - c ? a.insertBefore(this.svgGroup, c) : a.appendChild(this.svgGroup); + var a = b.svg, d = a.firstChild; + d ? a.insertBefore(this.svgGroup, d) : a.appendChild(this.svgGroup); this._dragBlockObserver = b.observe(this, "updateDragBlock", ["dragBlock"]); this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + b.suffix + ")"}); this.setPosition(); @@ -13451,7 +13526,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; this.board && this.board.hide(), this.overlayBoard && this.overlayBoard.hide(), this.set({selectedBoard:this.vimBoard}), this.vimBoard.show(), this.codeToText(this.board.code, b), this.blockMenu.renderText(function() { this.blockMenu.reDraw(); }.bind(this)), this.board.clear(), this.oldTextType = this.textType; - } catch (c) { + } catch (d) { } break; case Entry.Workspace.MODE_BOARD: @@ -13459,7 +13534,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; this.board.show(), this.set({selectedBoard:this.board}), this.textToCode(this.oldMode, this.oldTextType), this.vimBoard && this.vimBoard.hide(), this.overlayBoard && this.overlayBoard.hide(), this.blockMenu.renderBlock(function() { this.blockMenu.reDraw(); }.bind(this)), this.oldTextType = this.textType; - } catch (c) { + } catch (d) { this.board && this.board.hide(), this.set({selectedBoard:this.vimBoard}), this.mode = Entry.Workspace.MODE_VIMBOARD, this.oldTextType == Entry.Vim.PARSER_TYPE_JS_TO_BLOCK ? (b.boardType = Entry.Workspace.MODE_VIMBOARD, b.textType = Entry.Vim.TEXT_TYPE_JS, b.runType = Entry.Vim.MAZE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK, Entry.dispatchEvent("changeMode", b), Ntry.dispatchEvent("textError", b)) : this.oldTextType == Entry.Vim.PARSER_TYPE_PY_TO_BLOCK && (b.boardType = Entry.Workspace.MODE_VIMBOARD, b.textType = Entry.Vim.TEXT_TYPE_PY, b.runType = Entry.Vim.WORKSPACE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK, Entry.dispatchEvent("changeMode", b)); } @@ -13512,11 +13587,11 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); }; a._keyboardControl = function(b) { - var a = b.keyCode || b.which, c = b.ctrlKey; + var a = b.keyCode || b.which, d = b.ctrlKey; if (!Entry.Utils.isInInput(b)) { var e = this.selectedBlockView; - e && !e.isInBlockMenu && e.block.isDeletable() && (8 == a || 46 == a ? (Entry.do("destroyBlock", e.block), b.preventDefault()) : c && (67 == a ? e.block.copyToClipboard() : 88 == a && (b = e.block, b.copyToClipboard(), b.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); - c && 86 == a && (a = this.selectedBoard) && a instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); + e && !e.isInBlockMenu && e.block.isDeletable() && (8 == a || 46 == a ? (Entry.do("destroyBlock", e.block), b.preventDefault()) : d && (67 == a ? e.block.copyToClipboard() : 88 == a && (b = e.block, b.copyToClipboard(), b.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); + d && 86 == a && (a = this.selectedBoard) && a instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); } }; a._handleChangeBoard = function() { @@ -13525,9 +13600,9 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; }; a._syncTextCode = function() { if (this.mode === Entry.Workspace.MODE_VIMBOARD) { - var b = this.vimBoard.textToCode(this.textType), a = this.board, c = a.code; - c.load(b); - c.createView(a); + var b = this.vimBoard.textToCode(this.textType), a = this.board, d = a.code; + d.load(b); + d.createView(a); this.board.alignThreads(); } }; @@ -13552,27 +13627,27 @@ Entry.BlockDriver = function() { if (!b) { return c; } - for (var e = 0;e < b.length;e++) { - var f = b[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (c.params || (c.params = []), c.params.push(a(h)), c.index[t] = c.params.length - 1) : "field" === g && (c.params || (c.params = []), c.params.push(f.textContent), c.index[t] = c.params.length - 1); + for (var d = 0;d < b.length;d++) { + var e = b[d], f = e.tagName, g = $(e).children()[0], h = e.getAttribute("name"); + "value" === f ? "block" == g.nodeName && (c.params || (c.params = []), c.params.push(a(g)), c.index[h] = c.params.length - 1) : "field" === f && (c.params || (c.params = []), c.params.push(e.textContent), c.index[h] = c.params.length - 1); } return c; } - var c = Blockly.Blocks[b], e = EntryStatic.blockInfo[b], f, g; + var d = Blockly.Blocks[b], e = EntryStatic.blockInfo[b], f, g; if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { var e = $.parseXML(e), h = a(e.childNodes[0]) } - c = (new Entry.BlockMockup(c, h, b)).toJSON(); - c.class = f; - c.isNotFor = g; - _.isEmpty(c.paramsKeyMap) && delete c.paramsKeyMap; - _.isEmpty(c.statementsKeyMap) && delete c.statementsKeyMap; - c.func = Entry.block[b]; - -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(b.toUpperCase()) && (c.isPrimitive = !0); - Entry.block[b] = c; + d = (new Entry.BlockMockup(d, h, b)).toJSON(); + d.class = f; + d.isNotFor = g; + _.isEmpty(d.paramsKeyMap) && delete d.paramsKeyMap; + _.isEmpty(d.statementsKeyMap) && delete d.statementsKeyMap; + d.func = Entry.block[b]; + -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(b.toUpperCase()) && (d.isPrimitive = !0); + Entry.block[b] = d; }; })(Entry.BlockDriver.prototype); -Entry.BlockMockup = function(a, b, d) { +Entry.BlockMockup = function(a, b, c) { this.templates = []; this.params = []; this.statements = []; @@ -13598,21 +13673,21 @@ Entry.BlockMockup = function(a, b, d) { a.toJSON = function() { function b(a) { if (a && (a = a.params)) { - for (var d = 0;d < a.length;d++) { - var c = a[d]; - c && (delete c.index, b(c)); + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d && (delete d.index, b(d)); } } } var a = ""; this.output ? a = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? a = "basic_event" : 1 == this.statements.length ? a = "basic_loop" : 2 == this.statements.length ? a = "basic_double_loop" : this.isPrev && this.isNext ? a = "basic" : this.isPrev && !this.isNext && (a = "basic_without_next"); b(this.def); - var c = /dummy_/mi, e; + var d = /dummy_/mi, e; for (e in this.paramsKeyMap) { - c.test(e) && delete this.paramsKeyMap[e]; + d.test(e) && delete this.paramsKeyMap[e]; } for (e in this.statementsKeyMap) { - c.test(e) && delete this.statementsKeyMap[e]; + d.test(e) && delete this.statementsKeyMap[e]; } return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(b) { return "string" === typeof b; @@ -13715,30 +13790,30 @@ Entry.Playground.prototype.generateDefaultView = function(a) { return a; }; Entry.Playground.prototype.generateTabView = function(a) { - var b = this, d = Entry.createElement("ul"); - d.addClass("entryTabListWorkspace"); - this.tabList_ = d; - a.appendChild(d); + var b = this, c = Entry.createElement("ul"); + c.addClass("entryTabListWorkspace"); + this.tabList_ = c; + a.appendChild(c); this.tabViewElements = {}; a = Entry.createElement("li", "entryCodeTab"); a.innerHTML = Lang.Workspace.tab_code; a.addClass("entryTabListItemWorkspace"); a.addClass("entryTabSelected"); - d.appendChild(a); + c.appendChild(a); a.bindOnClick(function(a) { b.changeViewMode("code"); b.blockMenu.reDraw(); }); this.tabViewElements.code = a; - Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), d.appendChild(a), a.bindOnClick(function(b) { + Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), d.appendChild(a), a.bindOnClick(function(b) { + }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("text"); }), this.tabViewElements.text = a, a.addClass("entryRemove")); - Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), d.appendChild(a), a.bindOnClick(function(b) { + Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("sound"); }), this.tabViewElements.sound = a); - Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), d.appendChild(a), a.bindOnClick(function(b) { + Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), this.tabViewElements.variable = a); @@ -13762,10 +13837,10 @@ Entry.Playground.prototype.generatePictureView = function(a) { b.bindOnClick(function(b) { Entry.dispatchEvent("openPictureManager"); }); - var d = Entry.createElement("div", "entryAddPictureInner"); - d.addClass("entryPlaygroundAddPictureInner"); - d.innerHTML = Lang.Workspace.picture_add; - b.appendChild(d); + var c = Entry.createElement("div", "entryAddPictureInner"); + c.addClass("entryPlaygroundAddPictureInner"); + c.innerHTML = Lang.Workspace.picture_add; + b.appendChild(c); a.appendChild(b); b = Entry.createElement("ul", "entryPictureList"); b.addClass("entryPlaygroundPictureList"); @@ -13785,7 +13860,7 @@ Entry.Playground.prototype.generatePictureView = function(a) { } else { "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(b) { Entry.dispatchEvent("openPictureManager"); - }), d = Entry.createElement("div", "entryAddPictureInner"), d.addClass("entryPlaygroundAddPictureInnerPhone"), d.innerHTML = Lang.Workspace.picture_add, b.appendChild(d), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { + }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { a.item.data("start_pos", a.item.index()); }, stop:function(b, a) { b = a.item.data("start_pos"); @@ -13800,138 +13875,138 @@ Entry.Playground.prototype.generateTextView = function(a) { a = Entry.createElement("div"); a.addClass("textProperties"); b.appendChild(a); - var d = Entry.createElement("div"); - d.addClass("entryTextFontSelect"); - a.appendChild(d); - var c = Entry.createElement("select", "entryPainterAttrFontName"); - c.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); - c.size = "1"; - c.onchange = function(b) { + var c = Entry.createElement("div"); + c.addClass("entryTextFontSelect"); + a.appendChild(c); + var d = Entry.createElement("select", "entryPainterAttrFontName"); + d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); + d.size = "1"; + d.onchange = function(b) { Entry.playground.object.entity.setFontType(b.target.value); }; for (var e = 0;e < Entry.fonts.length;e++) { var f = Entry.fonts[e], g = Entry.createElement("option"); g.value = f.family; g.innerHTML = f.name; - c.appendChild(g); + d.appendChild(g); } - this.fontName_ = c; - d.appendChild(c); + this.fontName_ = d; + c.appendChild(d); e = Entry.createElement("ul"); e.addClass("entryPlayground_text_buttons"); a.appendChild(e); - d = Entry.createElement("li"); - d.addClass("entryPlaygroundTextAlignLeft"); - d.bindOnClick(function(b) { + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignLeft"); + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); }); - e.appendChild(d); - this.alignLeftBtn = d; - d = Entry.createElement("li"); - d.addClass("entryPlaygroundTextAlignCenter"); - d.bindOnClick(function(b) { + e.appendChild(c); + this.alignLeftBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignCenter"); + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); }); - e.appendChild(d); - this.alignCenterBtn = d; - d = Entry.createElement("li"); - d.addClass("entryPlaygroundTextAlignRight"); - d.bindOnClick(function(b) { + e.appendChild(c); + this.alignCenterBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignRight"); + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); }); - e.appendChild(d); - this.alignRightBtn = d; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { + e.appendChild(c); + this.alignRightBtn = c; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; }); var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); - c.appendChild(h); + d.appendChild(h); h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { var b = !Entry.playground.object.entity.getUnderLine() || !1; k.src = Entry.mediaFilePath + "text_button_underline_" + b + ".png"; Entry.playground.object.entity.setUnderLine(b); }); var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); - c.appendChild(k); + d.appendChild(k); k.src = Entry.mediaFilePath + "text_button_underline_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; }); var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); - c.appendChild(l); + d.appendChild(l); l.src = Entry.mediaFilePath + "text_button_italic_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { - var b = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(b); - m.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; - }); - var m = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - c.appendChild(m); - m.src = Entry.mediaFilePath + "text_button_strike_false.png"; c = Entry.createElement("li"); e.appendChild(c); d = Entry.createElement("a"); c.appendChild(d); d.bindOnClick(function() { - Entry.playground.toggleColourChooser("foreground"); + var b = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(b); + m.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; }); - c = Entry.createElement("img"); - d.appendChild(c); - c.src = Entry.mediaFilePath + "text_button_color_false.png"; + var m = Entry.createElement("img", "entryPlaygroundText_strikeImage"); + d.appendChild(m); + m.src = Entry.mediaFilePath + "text_button_strike_false.png"; d = Entry.createElement("li"); e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + Entry.playground.toggleColourChooser("foreground"); + }); + d = Entry.createElement("img"); + c.appendChild(d); + d.src = Entry.mediaFilePath + "text_button_color_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); e = Entry.createElement("a"); - d.appendChild(e); + c.appendChild(e); e.bindOnClick(function() { Entry.playground.toggleColourChooser("background"); }); - d = Entry.createElement("img"); - e.appendChild(d); - d.src = Entry.mediaFilePath + "text_button_background_false.png"; + c = Entry.createElement("img"); + e.appendChild(c); + c.src = Entry.mediaFilePath + "text_button_background_false.png"; e = Entry.createElement("div"); e.addClass("entryPlayground_fgColorDiv"); - d = Entry.createElement("div"); - d.addClass("entryPlayground_bgColorDiv"); - a.appendChild(e); - a.appendChild(d); c = Entry.createElement("div"); - c.addClass("entryPlaygroundTextColoursWrapper"); - this.coloursWrapper = c; - b.appendChild(c); + c.addClass("entryPlayground_bgColorDiv"); + a.appendChild(e); + a.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextColoursWrapper"); + this.coloursWrapper = d; + b.appendChild(d); a = Entry.getColourCodes(); for (e = 0;e < a.length;e++) { - d = Entry.createElement("div"), d.addClass("modal_colour"), d.setAttribute("colour", a[e]), d.style.backgroundColor = a[e], 0 === e && d.addClass("modalColourTrans"), d.bindOnClick(function(b) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { Entry.playground.setTextColour(b.target.getAttribute("colour")); - }), c.appendChild(d); + }), d.appendChild(c); } - c.style.display = "none"; - c = Entry.createElement("div"); - c.addClass("entryPlaygroundTextBackgroundsWrapper"); - this.backgroundsWrapper = c; - b.appendChild(c); + d.style.display = "none"; + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextBackgroundsWrapper"); + this.backgroundsWrapper = d; + b.appendChild(d); for (e = 0;e < a.length;e++) { - d = Entry.createElement("div"), d.addClass("modal_colour"), d.setAttribute("colour", a[e]), d.style.backgroundColor = a[e], 0 === e && d.addClass("modalColourTrans"), d.bindOnClick(function(b) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { Entry.playground.setBackgroundColour(b.target.getAttribute("colour")); - }), c.appendChild(d); + }), d.appendChild(c); } - c.style.display = "none"; + d.style.display = "none"; a = Entry.createElement("input"); a.addClass("entryPlayground_textBox"); a.onkeyup = function() { @@ -14046,10 +14121,10 @@ Entry.Playground.prototype.generateSoundView = function(a) { b.bindOnClick(function(b) { Entry.dispatchEvent("openSoundManager"); }); - var d = Entry.createElement("div", "entryAddSoundInner"); - d.addClass("entryPlaygroundAddSoundInner"); - d.innerHTML = Lang.Workspace.sound_add; - b.appendChild(d); + var c = Entry.createElement("div", "entryAddSoundInner"); + c.addClass("entryPlaygroundAddSoundInner"); + c.innerHTML = Lang.Workspace.sound_add; + b.appendChild(c); a.appendChild(b); b = Entry.createElement("ul", "entrySoundList"); b.addClass("entryPlaygroundSoundList"); @@ -14065,7 +14140,7 @@ Entry.Playground.prototype.generateSoundView = function(a) { } else { "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(b) { Entry.dispatchEvent("openSoundManager"); - }), d = Entry.createElement("div", "entryAddSoundInner"), d.addClass("entryPlaygroundAddSoundInnerPhone"), d.innerHTML = Lang.Workspace.sound_add, b.appendChild(d), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { + }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { a.item.data("start_pos", a.item.index()); }, stop:function(b, a) { b = a.item.data("start_pos"); @@ -14102,10 +14177,10 @@ Entry.Playground.prototype.injectPicture = function() { a.removeChild(a.lastChild); } if (this.object) { - for (var b = this.object.pictures, d = 0, c = b.length;d < c;d++) { - var e = b[d].view; + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; e || console.log(e); - e.orderHolder.innerHTML = d + 1; + e.orderHolder.innerHTML = c + 1; a.appendChild(e); } this.selectPicture(this.object.selectedPicture); @@ -14127,18 +14202,18 @@ Entry.Playground.prototype.addPicture = function(a, b) { this.selectPicture(a); }; Entry.Playground.prototype.setPicture = function(a) { - var b = Entry.container.getPictureElement(a.id, a.objectId), d = $(b); + var b = Entry.container.getPictureElement(a.id, a.objectId), c = $(b); if (b) { a.view = b; b.picture = a; - b = d.find("#t_" + a.id)[0]; + b = c.find("#t_" + a.id)[0]; if (a.fileurl) { b.style.backgroundImage = 'url("' + a.fileurl + '")'; } else { - var c = a.filename; - b.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + c.substring(0, 2) + "/" + c.substring(2, 4) + "/thumb/" + c + '.png")'; + var d = a.filename; + b.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; } - d.find("#s_" + a.id)[0].innerHTML = a.dimension.width + " X " + a.dimension.height; + c.find("#s_" + a.id)[0].innerHTML = a.dimension.width + " X " + a.dimension.height; } Entry.container.setPicture(a); }; @@ -14151,8 +14226,8 @@ Entry.Playground.prototype.clonePicture = function(a) { this.addPicture(a, !0); }; Entry.Playground.prototype.selectPicture = function(a) { - for (var b = this.object.pictures, d = 0, c = b.length;d < c;d++) { - var e = b[d]; + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c]; e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); } var f; @@ -14196,9 +14271,9 @@ Entry.Playground.prototype.injectSound = function() { a.removeChild(a.lastChild); } if (this.object) { - for (var b = this.object.sounds, d = 0, c = b.length;d < c;d++) { - var e = b[d].view; - e.orderHolder.innerHTML = d + 1; + for (var b = this.object.sounds, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; + e.orderHolder.innerHTML = c + 1; a.appendChild(e); } } @@ -14226,10 +14301,10 @@ Entry.Playground.prototype.changeViewMode = function(a) { } "default" != a && this.tabViewElements[a].addClass("entryTabSelected"); if ("variable" != a) { - var d = this.view_.children; - for (b = 0;b < d.length;b++) { - var c = d[b]; - -1 < c.id.toUpperCase().indexOf(a.toUpperCase()) ? c.removeClass("entryRemove") : c.addClass("entryRemove"); + var c = this.view_.children; + for (b = 0;b < c.length;b++) { + var d = c[b]; + -1 < d.id.toUpperCase().indexOf(a.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); } Entry.pictureEditable && ("picture" == a ? (this.painter.show(), this.pictureView_.object && this.pictureView_.object == this.object || (this.pictureView_.object = this.object, this.injectPicture())) : this.painter.hide()); if ("sound" == a && (!this.soundView_.object || this.soundView_.object != this.object)) { @@ -14338,7 +14413,7 @@ Entry.Playground.prototype.refreshPlayground = function() { }; Entry.Playground.prototype.updateListViewOrder = function(a) { a = "picture" == a ? this.pictureListView_.childNodes : this.soundListView_.childNodes; - for (var b = 0, d = a.length;b < d;b++) { + for (var b = 0, c = a.length;b < c;b++) { a[b].orderHolder.innerHTML = b + 1; } }; @@ -14347,8 +14422,8 @@ Entry.Playground.prototype.generatePictureElement = function(a) { if ("" === this.value.trim()) { Entry.deAttachEventListener(this, "blur", b), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", b); } else { - for (var a = $(".entryPlaygroundPictureName"), d = 0;d < a.length;d++) { - if (a.eq(d).val() == f.value && a[d] != this) { + for (var a = $(".entryPlaygroundPictureName"), c = 0;c < a.length;c++) { + if (a.eq(c).val() == f.value && a[c] != this) { Entry.deAttachEventListener(this, "blur", b); alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); this.focus(); @@ -14361,11 +14436,11 @@ Entry.Playground.prototype.generatePictureElement = function(a) { Entry.dispatchEvent("pictureNameChanged", this.picture); } } - var d = Entry.createElement("li", a.id); - a.view = d; - d.addClass("entryPlaygroundPictureElement"); - d.picture = a; - d.bindOnClick(function(b) { + var c = Entry.createElement("li", a.id); + a.view = c; + c.addClass("entryPlaygroundPictureElement"); + c.picture = a; + c.bindOnClick(function(b) { Entry.playground.selectPicture(this.picture); }); Entry.Utils.disableContextmenu(a.view); @@ -14375,24 +14450,24 @@ Entry.Playground.prototype.generatePictureElement = function(a) { }}, {text:Lang.Workspace.context_duplicate, callback:function() { Entry.playground.clonePicture(a.id); }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removePicture(a.id) ? (Entry.removeElement(d), Entry.toast.success(Lang.Workspace.shape_remove_ok, a.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); + Entry.playground.object.removePicture(a.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, a.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { Entry.playground.downloadPicture(a.id); }}], "workspace-contextmenu"); }); - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundPictureOrder"); - d.orderHolder = c; - d.appendChild(c); - c = Entry.createElement("div", "t_" + a.id); - c.addClass("entryPlaygroundPictureThumbnail"); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundPictureOrder"); + c.orderHolder = d; + c.appendChild(d); + d = Entry.createElement("div", "t_" + a.id); + d.addClass("entryPlaygroundPictureThumbnail"); if (a.fileurl) { - c.style.backgroundImage = 'url("' + a.fileurl + '")'; + d.style.backgroundImage = 'url("' + a.fileurl + '")'; } else { var e = a.filename; - c.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; + d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; } - d.appendChild(c); + c.appendChild(d); var f = Entry.createElement("input"); f.addClass("entryPlaygroundPictureName"); f.addClass("entryEllipsis"); @@ -14402,11 +14477,11 @@ Entry.Playground.prototype.generatePictureElement = function(a) { f.onkeypress = function(b) { 13 == b.keyCode && this.blur(); }; - d.appendChild(f); - c = Entry.createElement("div", "s_" + a.id); - c.addClass("entryPlaygroundPictureSize"); - c.innerHTML = a.dimension.width + " X " + a.dimension.height; - d.appendChild(c); + c.appendChild(f); + d = Entry.createElement("div", "s_" + a.id); + d.addClass("entryPlaygroundPictureSize"); + d.innerHTML = a.dimension.width + " X " + a.dimension.height; + c.appendChild(d); }; Entry.Playground.prototype.generateSoundElement = function(a) { var b = Entry.createElement("sound", a.id); @@ -14424,24 +14499,24 @@ Entry.Playground.prototype.generateSoundElement = function(a) { Entry.removeElement(b); }}], "workspace-contextmenu"); }); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundSoundOrder"); - b.orderHolder = d; - b.appendChild(d); var c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundThumbnail"); - c.addClass("entryPlaygroundSoundPlay"); + c.addClass("entryPlaygroundSoundOrder"); + b.orderHolder = c; + b.appendChild(c); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundSoundThumbnail"); + d.addClass("entryPlaygroundSoundPlay"); var e = !1, f; - c.addEventListener("click", function() { - e ? (e = !1, c.removeClass("entryPlaygroundSoundStop"), c.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, c.removeClass("entryPlaygroundSoundPlay"), c.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { - c.removeClass("entryPlaygroundSoundStop"); - c.addClass("entryPlaygroundSoundPlay"); + d.addEventListener("click", function() { + e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { + d.removeClass("entryPlaygroundSoundStop"); + d.addClass("entryPlaygroundSoundPlay"); e = !1; }), f.addEventListener("loop", function(b) { }), f.addEventListener("failed", function(b) { })); }); - b.appendChild(c); + b.appendChild(d); var g = Entry.createElement("input"); g.addClass("entryPlaygroundSoundName"); g.sound = a; @@ -14466,10 +14541,10 @@ Entry.Playground.prototype.generateSoundElement = function(a) { 13 == b.keyCode && this.blur(); }; b.appendChild(g); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundSoundLength"); - d.innerHTML = a.duration + " \ucd08"; - b.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundLength"); + c.innerHTML = a.duration + " \ucd08"; + b.appendChild(c); }; Entry.Playground.prototype.toggleColourChooser = function(a) { "foreground" === a ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === a && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); @@ -14561,10 +14636,10 @@ Entry.Popup.prototype.remove = function() { }; Entry.Popup.prototype.resize = function(a) { a = window.popup.window_; - var b = .9 * window.innerWidth, d = .9 * window.innerHeight - 35; - 9 * b <= 16 * d ? d = b / 16 * 9 + 35 : (b = 16 * d / 9, d += 35); + var b = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; + 9 * b <= 16 * c ? c = b / 16 * 9 + 35 : (b = 16 * c / 9, c += 35); a.style.width = String(b) + "px"; - a.style.height = String(d) + "px"; + a.style.height = String(c) + "px"; Entry.stage && Entry.stage.updateBoundRect(); }; Entry.popupHelper = function(a) { @@ -14572,23 +14647,23 @@ Entry.popupHelper = function(a) { this.nowContent; a && (window.popupHelper = null); Entry.assert(!window.popupHelper, "Popup exist"); - var b = ["confirm", "spinner"], d = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; + var b = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var c = this; + var d = this; this.body_.bindOnClick(function(a) { - if (!(c.nowContent && -1 < b.indexOf(c.nowContent.prop("type")))) { - var f = $(a.target); - d.forEach(function(b) { - f.hasClass(b) && this.popup.hide(); + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var e = $(a.target); + c.forEach(function(b) { + e.hasClass(b) && this.popup.hide(); }.bind(this)); a.target == this && this.popup.hide(); } }); this.body_.bind("touchstart", function(a) { - if (!(c.nowContent && -1 < b.indexOf(c.nowContent.prop("type")))) { - var f = $(a.target); - d.forEach(function(b) { - f.hasClass(b) && this.popup.hide(); + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var e = $(a.target); + c.forEach(function(b) { + e.hasClass(b) && this.popup.hide(); }.bind(this)); a.target == this && this.popup.hide(); } @@ -14609,23 +14684,23 @@ Entry.popupHelper.prototype.clearPopup = function() { } }; Entry.popupHelper.prototype.addPopup = function(a, b) { - var d = Entry.Dom("div"), c = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); - c.bindOnClick(function() { + var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); + d.bindOnClick(function() { b.closeEvent ? b.closeEvent(this) : this.hide(); }.bind(this)); var e = this; - c.bind("touchstart", function() { + d.bind("touchstart", function() { b.closeEvent ? b.closeEvent(e) : e.hide(); }); var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - f.append(c); - b.title && (c = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(c), c.text(b.title)); - d.addClass(a); - d.append(f); - d.popupWrapper_ = f; - d.prop("type", b.type); - "function" === typeof b.setPopupLayout && b.setPopupLayout(d); - this.popupList[a] = d; + f.append(d); + b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(b.title)); + c.addClass(a); + c.append(f); + c.popupWrapper_ = f; + c.prop("type", b.type); + "function" === typeof b.setPopupLayout && b.setPopupLayout(c); + this.popupList[a] = c; }; Entry.popupHelper.prototype.hasPopup = function(a) { return !!this.popupList[a]; @@ -14661,17 +14736,17 @@ Entry.Reporter = function(a) { this.isRealTime = a; this.activities = []; }; -Entry.Reporter.prototype.start = function(a, b, d) { - this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:b, projectId:a, time:d})); +Entry.Reporter.prototype.start = function(a, b, c) { + this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:b, projectId:a, time:c})); this.userId = b; this.projectId = a; }; Entry.Reporter.prototype.report = function(a) { if (!this.isRealTime || this.io) { - var b = [], d; - for (d in a.params) { - var c = a.params[d]; - "object" !== typeof c ? b.push(c) : c.id && b.push(c.id); + var b = [], c; + for (c in a.params) { + var d = a.params[c]; + "object" !== typeof d ? b.push(d) : d.id && b.push(d.id); } a = {message:a.message, userId:this.userId, projectId:this.projectId, time:a.time, params:b}; this.isRealTime ? this.io.emit("activity", a) : this.activities.push(a); @@ -14688,16 +14763,16 @@ Entry.Scene = function() { }; Entry.Scene.viewBasicWidth = 70; Entry.Scene.prototype.generateView = function(a, b) { - var d = this; + var c = this; this.view_ = a; this.view_.addClass("entryScene"); b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(b) { - var a = $(this).offset(), f = $(window), g = b.pageX - a.left + f.scrollLeft(); - b = b.pageY - a.top + f.scrollTop(); + var a = $(this).offset(), d = $(window), g = b.pageX - a.left + d.scrollLeft(); + b = b.pageY - a.top + d.scrollTop(); b = 40 - b; a = -40 / 55; - f = $(d.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(g < f || g > f + 55) && b > 40 + a * (g - f) && (g = d.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); + d = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; + !(g < d || g > d + 55) && b > 40 + a * (g - d) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(b, a) { a.item.data("start_pos", a.item.index()); $(a.item[0]).clone(!0); @@ -14710,38 +14785,38 @@ Entry.Scene.prototype.generateView = function(a, b) { }), this.view_.appendChild(a), this.addButton_ = a)); }; Entry.Scene.prototype.generateElement = function(a) { - var b = this, d = Entry.createElement("li", a.id); - d.addClass("entrySceneElementWorkspace"); - d.addClass("entrySceneButtonWorkspace"); - d.addClass("minValue"); - $(d).on("mousedown", function(b) { + var b = this, c = Entry.createElement("li", a.id); + c.addClass("entrySceneElementWorkspace"); + c.addClass("entrySceneButtonWorkspace"); + c.addClass("minValue"); + $(c).on("mousedown", function(b) { Entry.engine.isState("run") ? b.preventDefault() : Entry.scene.selectScene(a); }); - var c = Entry.createElement("input"); - c.addClass("entrySceneFieldWorkspace"); - c.value = a.name; - Entry.sceneEditable || (c.disabled = "disabled"); + var d = Entry.createElement("input"); + d.addClass("entrySceneFieldWorkspace"); + d.value = a.name; + Entry.sceneEditable || (d.disabled = "disabled"); var e = Entry.createElement("span"); e.addClass("entrySceneLeftWorkspace"); - d.appendChild(e); + c.appendChild(e); var f = Entry.createElement("span"); f.addClass("entrySceneInputCover"); f.style.width = Entry.computeInputWidth(a.name); - d.appendChild(f); + c.appendChild(f); a.inputWrapper = f; - c.onkeyup = function(d) { - d = d.keyCode; - Entry.isArrowOrBackspace(d) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == d && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); + d.onkeyup = function(c) { + c = c.keyCode; + Entry.isArrowOrBackspace(c) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); }; - c.onblur = function(b) { - c.value = this.value; + d.onblur = function(b) { + d.value = this.value; a.name = this.value; f.style.width = Entry.computeInputWidth(a.name); }; - f.appendChild(c); + f.appendChild(d); e = Entry.createElement("span"); e.addClass("entrySceneRemoveButtonCoverWorkspace"); - d.appendChild(e); + c.appendChild(e); if (Entry.sceneEditable) { var g = Entry.createElement("button"); g.addClass("entrySceneRemoveButtonWorkspace"); @@ -14752,14 +14827,14 @@ Entry.Scene.prototype.generateElement = function(a) { }); e.appendChild(g); } - Entry.Utils.disableContextmenu(d); - $(d).on("contextmenu", function() { + Entry.Utils.disableContextmenu(c); + $(c).on("contextmenu", function() { var b = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { Entry.scene.cloneScene(a); }}]; Entry.ContextMenu.show(b, "workspace-contextmenu"); }); - return a.view = d; + return a.view = c; }; Entry.Scene.prototype.updateView = function() { if (!Entry.type || "workspace" == Entry.type) { @@ -14772,7 +14847,7 @@ Entry.Scene.prototype.updateView = function() { }; Entry.Scene.prototype.addScenes = function(a) { if ((this.scenes_ = a) && 0 !== a.length) { - for (var b = 0, d = a.length;b < d;b++) { + for (var b = 0, c = a.length;b < c;b++) { this.generateElement(a[b]); } } else { @@ -14797,8 +14872,8 @@ Entry.Scene.prototype.removeScene = function(a) { } else { var b = this.getScenes().indexOf(this.getSceneById(a.id)); this.getScenes().splice(b, 1); - for (var b = Entry.container.getSceneObjects(a), d = 0;d < b.length;d++) { - Entry.container.removeObject(b[d]); + for (var b = Entry.container.getSceneObjects(a), c = 0;c < b.length;c++) { + Entry.container.removeObject(b[c]); } Entry.stage.removeObjectContainer(a); $(a.view).remove(); @@ -14823,13 +14898,13 @@ Entry.Scene.prototype.selectScene = function(a) { } }; Entry.Scene.prototype.toJSON = function() { - for (var a = [], b = this.getScenes().length, d = 0;d < b;d++) { - var c = this.getScenes()[d], e = c.view, f = c.inputWrapper; - delete c.view; - delete c.inputWrapper; - a.push(JSON.parse(JSON.stringify(c))); - c.view = e; - c.inputWrapper = f; + for (var a = [], b = this.getScenes().length, c = 0;c < b;c++) { + var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; + delete d.view; + delete d.inputWrapper; + a.push(JSON.parse(JSON.stringify(d))); + d.view = e; + d.inputWrapper = f; } return a; }; @@ -14840,9 +14915,9 @@ Entry.Scene.prototype.moveScene = function(a, b) { $(".entrySceneElementWorkspace").removeAttr("style"); }; Entry.Scene.prototype.getSceneById = function(a) { - for (var b = this.getScenes(), d = 0;d < b.length;d++) { - if (b[d].id == a) { - return b[d]; + for (var b = this.getScenes(), c = 0;c < b.length;c++) { + if (b[c].id == a) { + return b[c]; } } return !1; @@ -14870,25 +14945,25 @@ Entry.Scene.prototype.cloneScene = function(a) { this.generateElement(b); this.addScene(b); a = Entry.container.getSceneObjects(a); - for (var d = a.length - 1;0 <= d;d--) { - Entry.container.addCloneObject(a[d], b.id); + for (var c = a.length - 1;0 <= c;c--) { + Entry.container.addCloneObject(a[c], b.id); } } }; Entry.Scene.prototype.resize = function() { - var a = this.getScenes(), b = this.selectedScene, d = a[0]; - if (0 !== a.length && d) { - var c = $(d.view).offset().left, d = parseFloat($(b.view).css("margin-left")), e = $(this.view_).width() - c, f = 0, g; + var a = this.getScenes(), b = this.selectedScene, c = a[0]; + if (0 !== a.length && c) { + var d = $(c.view).offset().left, c = parseFloat($(b.view).css("margin-left")), e = $(this.view_).width() - d, f = 0, g; for (g in a) { - var c = a[g], h = c.view; + var d = a[g], h = d.view; h.addClass("minValue"); - $(c.inputWrapper).width(Entry.computeInputWidth(c.name)); + $(d.inputWrapper).width(Entry.computeInputWidth(d.name)); h = $(h); - f = f + h.width() + d; + f = f + h.width() + c; } if (f > e) { - for (g in e -= $(b.view).width(), d = e / (a.length - 1) - (Entry.Scene.viewBasicWidth + d), a) { - c = a[g], b.id != c.id ? (c.view.removeClass("minValue"), $(c.inputWrapper).width(d)) : c.view.addClass("minValue"); + for (g in e -= $(b.view).width(), c = e / (a.length - 1) - (Entry.Scene.viewBasicWidth + c), a) { + d = a[g], b.id != d.id ? (d.view.removeClass("minValue"), $(d.inputWrapper).width(c)) : d.view.addClass("minValue"); } } } @@ -14901,63 +14976,63 @@ Entry.Script = function(a) { this.entity = a; }; p = Entry.Script.prototype; -p.init = function(a, b, d) { +p.init = function(a, b, c) { Entry.assert("BLOCK" == a.tagName.toUpperCase(), a.tagName); this.type = a.getAttribute("type"); this.id = Number(a.getAttribute("id")); a.getElementsByTagName("mutation").length && a.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = a.childNodes[0].getAttribute("hashid")); "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); b instanceof Entry.Script && (this.previousScript = b, b.parentScript && (this.parentScript = b.parentScript)); - d instanceof Entry.Script && (this.parentScript = d); + c instanceof Entry.Script && (this.parentScript = c); a = a.childNodes; for (b = 0;b < a.length;b++) { - if (d = a[b], "NEXT" == d.tagName.toUpperCase()) { + if (c = a[b], "NEXT" == c.tagName.toUpperCase()) { this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(a[b].childNodes[0], this); } else { - if ("VALUE" == d.tagName.toUpperCase()) { + if ("VALUE" == c.tagName.toUpperCase()) { this.values || (this.values = {}); - var c = new Entry.Script(this.entity); - this.register && (c.register = this.register); - c.init(d.childNodes[0]); - this.values[d.getAttribute("name")] = c; + var d = new Entry.Script(this.entity); + this.register && (d.register = this.register); + d.init(c.childNodes[0]); + this.values[c.getAttribute("name")] = d; } else { - "FIELD" == d.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[d.getAttribute("name")] = d.textContent) : "STATEMENT" == d.tagName.toUpperCase() && (this.statements || (this.statements = {}), c = new Entry.Script(this.entity), this.register && (c.register = this.register), c.init(d.childNodes[0], null, this), c.key = d.getAttribute("name"), this.statements[d.getAttribute("name")] = c); + "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); } } } }; p.clone = function(a, b) { - var d = new Entry.Script(a); - d.id = this.id; - d.type = this.type; - d.isRepeat = this.isRepeat; + var c = new Entry.Script(a); + c.id = this.id; + c.type = this.type; + c.isRepeat = this.isRepeat; if (this.parentScript && !this.previousScript && 2 != b) { - d.parentScript = this.parentScript.clone(a); - for (var c = d.parentScript.statements[this.key] = d;c.nextScript;) { - c = c.nextScript, c.parentScript = d.parentScript; + c.parentScript = this.parentScript.clone(a); + for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c.parentScript; } } - this.nextScript && 1 != b && (d.nextScript = this.nextScript.clone(a, 0), d.nextScript.previousScript = this); - this.previousScript && 0 !== b && (d.previousScript = this.previousScript.clone(a, 1), d.previousScript.previousScript = this); + this.nextScript && 1 != b && (c.nextScript = this.nextScript.clone(a, 0), c.nextScript.previousScript = this); + this.previousScript && 0 !== b && (c.previousScript = this.previousScript.clone(a, 1), c.previousScript.previousScript = this); if (this.fields) { - d.fields = {}; + c.fields = {}; for (var e in this.fields) { - d.fields[e] = this.fields[e]; + c.fields[e] = this.fields[e]; } } if (this.values) { - for (e in d.values = {}, this.values) { - d.values[e] = this.values[e].clone(a); + for (e in c.values = {}, this.values) { + c.values[e] = this.values[e].clone(a); } } if (this.statements) { - for (e in d.statements = {}, this.statements) { - for (d.statements[e] = this.statements[e].clone(a, 2), c = d.statements[e], c.parentScript = d;c.nextScript;) { - c = c.nextScript, c.parentScript = d; + for (e in c.statements = {}, this.statements) { + for (c.statements[e] = this.statements[e].clone(a, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c; } } } - return d; + return c; }; p.getStatement = function(a) { return this.statements[a]; @@ -15053,10 +15128,10 @@ Entry.Stage.prototype.initStage = function(a) { }); b = function(b) { b.preventDefault(); - var a = Entry.stage.getBoundRect(), e; - -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (e = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (e = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), + var a = Entry.stage.getBoundRect(), c; + -1 < Entry.getBrowserType().indexOf("IE") ? (c = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (c = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (c = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.body.scrollTop) / a.height - .5)); - Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:b.toFixed(1)}; + Entry.stage.mouseCoordinate = {x:c.toFixed(1), y:b.toFixed(1)}; Entry.dispatchEvent("stageMouseMove"); }; a.onmousemove = b; @@ -15072,9 +15147,9 @@ Entry.Stage.prototype.initStage = function(a) { var a = Entry.stage.inputField.value(); Entry.stage.hideInputField(); if (a) { - var e = Entry.container; - e.setInputValue(a); - e.inputValue.complete = !0; + var c = Entry.container; + c.setInputValue(a); + c.inputValue.complete = !0; } } catch (f) { } @@ -15123,12 +15198,12 @@ Entry.Stage.prototype.unloadDialog = function(a) { this.dialogContainer.removeChild(a.object); }; Entry.Stage.prototype.sortZorder = function() { - for (var a = Entry.container.getCurrentObjects(), b = this.selectedObjectContainer, d = 0, c = a.length - 1;0 <= c;c--) { - for (var e = a[c], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { - e[g].shape && b.setChildIndex(e[g].shape, d++), b.setChildIndex(e[g].object, d++); + for (var a = Entry.container.getCurrentObjects(), b = this.selectedObjectContainer, c = 0, d = a.length - 1;0 <= d;d--) { + for (var e = a[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { + e[g].shape && b.setChildIndex(e[g].shape, c++), b.setChildIndex(e[g].object, c++); } - f.shape && b.setChildIndex(f.shape, d++); - b.setChildIndex(f.object, d++); + f.shape && b.setChildIndex(f.shape, c++); + b.setChildIndex(f.object, c++); } }; Entry.Stage.prototype.initCoordinator = function() { @@ -15170,30 +15245,30 @@ Entry.Stage.prototype.updateObject = function() { var b = a.entity; this.handle.setWidth(b.getScaleX() * b.getWidth()); this.handle.setHeight(b.getScaleY() * b.getHeight()); - var d, c; + var c, d; if ("textBox" == b.type) { if (b.getLineBreak()) { - d = b.regX * b.scaleX, c = -b.regY * b.scaleY; + c = b.regX * b.scaleX, d = -b.regY * b.scaleY; } else { var e = b.getTextAlign(); - c = -b.regY * b.scaleY; + d = -b.regY * b.scaleY; switch(e) { case Entry.TEXT_ALIGN_LEFT: - d = -b.getWidth() / 2 * b.scaleX; + c = -b.getWidth() / 2 * b.scaleX; break; case Entry.TEXT_ALIGN_CENTER: - d = b.regX * b.scaleX; + c = b.regX * b.scaleX; break; case Entry.TEXT_ALIGN_RIGHT: - d = b.getWidth() / 2 * b.scaleX; + c = b.getWidth() / 2 * b.scaleX; } } } else { - d = (b.regX - b.width / 2) * b.scaleX, c = (b.height / 2 - b.regY) * b.scaleY; + c = (b.regX - b.width / 2) * b.scaleX, d = (b.height / 2 - b.regY) * b.scaleY; } e = b.getRotation() / 180 * Math.PI; - this.handle.setX(b.getX() - d * Math.cos(e) - c * Math.sin(e)); - this.handle.setY(-b.getY() - d * Math.sin(e) + c * Math.cos(e)); + this.handle.setX(b.getX() - c * Math.cos(e) - d * Math.sin(e)); + this.handle.setY(-b.getY() - c * Math.sin(e) + d * Math.cos(e)); this.handle.setRegX((b.regX - b.width / 2) * b.scaleX); this.handle.setRegY((b.regY - b.height / 2) * b.scaleY); this.handle.setRotation(b.getRotation()); @@ -15213,33 +15288,33 @@ Entry.Stage.prototype.updateHandle = function() { b.setHeight(a.height / b.getScaleY()), b.setWidth(a.width / b.getScaleX()); } else { if (0 !== b.width) { - var d = Math.abs(a.width / b.width); - b.flip && (d *= -1); - b.setScaleX(d); + var c = Math.abs(a.width / b.width); + b.flip && (c *= -1); + b.setScaleX(c); } 0 !== b.height && b.setScaleY(a.height / b.height); } - d = a.rotation / 180 * Math.PI; + c = a.rotation / 180 * Math.PI; if ("textBox" == b.type) { - var c; + var d; if (b.getLineBreak()) { b.setX(a.x), b.setY(-a.y); } else { switch(b.getTextAlign()) { case Entry.TEXT_ALIGN_LEFT: - b.setX(a.x - a.width / 2 * Math.cos(d)); - b.setY(-a.y + a.width / 2 * Math.sin(d)); + b.setX(a.x - a.width / 2 * Math.cos(c)); + b.setY(-a.y + a.width / 2 * Math.sin(c)); break; case Entry.TEXT_ALIGN_CENTER: b.setX(a.x); b.setY(-a.y); break; case Entry.TEXT_ALIGN_RIGHT: - b.setX(a.x + a.width / 2 * Math.cos(d)), b.setY(-a.y - a.width / 2 * Math.sin(d)); + b.setX(a.x + a.width / 2 * Math.cos(c)), b.setY(-a.y - a.width / 2 * Math.sin(c)); } } } else { - c = b.width / 2 + a.regX / b.scaleX, b.setX(a.x + a.regX * Math.cos(d) - a.regY * Math.sin(d)), b.setRegX(c), c = b.height / 2 + a.regY / b.scaleY, b.setY(-a.y - a.regX * Math.sin(d) - a.regY * Math.cos(d)), b.setRegY(c); + d = b.width / 2 + a.regX / b.scaleX, b.setX(a.x + a.regX * Math.cos(c) - a.regY * Math.sin(c)), b.setRegX(d), d = b.height / 2 + a.regY / b.scaleY, b.setY(-a.y - a.regX * Math.sin(c) - a.regY * Math.cos(c)), b.setRegY(d); } b.setDirection(a.direction); b.setRotation(a.rotation); @@ -15290,14 +15365,14 @@ Entry.Stage.prototype.showInputField = function(a) { a = new createjs.Container; var b = new Image; b.src = Entry.mediaFilePath + "confirm_button.png"; - var d = new createjs.Bitmap; - d.scaleX = .23; - d.scaleY = .23; - d.x = 160; - d.y = 89; - d.cursor = "pointer"; - d.image = b; - a.addChild(d); + var c = new createjs.Bitmap; + c.scaleX = .23; + c.scaleY = .23; + c.x = 160; + c.y = 89; + c.cursor = "pointer"; + c.image = b; + a.addChild(c); a.on("mousedown", function(b) { Entry.dispatchEvent("canvasInputComplete"); }); @@ -15326,8 +15401,8 @@ Entry.Stage.prototype.initObjectContainers = function() { }; Entry.Stage.prototype.selectObjectContainer = function(a) { if (this.canvas) { - for (var b = this.objectContainers, d = 0;d < b.length;d++) { - this.canvas.removeChild(b[d]); + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + this.canvas.removeChild(b[c]); } this.selectedObjectContainer = this.getObjectContainerByScene(a); this.canvas.addChildAt(this.selectedObjectContainer, 2); @@ -15351,9 +15426,9 @@ Entry.Stage.prototype.removeObjectContainer = function(a) { b.splice(this.objectContainers.indexOf(a), 1); }; Entry.Stage.prototype.getObjectContainerByScene = function(a) { - for (var b = this.objectContainers, d = 0;d < b.length;d++) { - if (b[d].scene.id == a.id) { - return b[d]; + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + if (b[c].scene.id == a.id) { + return b[c]; } } }; @@ -15361,19 +15436,19 @@ Entry.Stage.prototype.moveSprite = function(a) { if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { var b = 5; a.shiftKey && (b = 1); - var d = this.selectedObject.entity; + var c = this.selectedObject.entity; switch(a.keyCode) { case 38: - d.setY(d.getY() + b); + c.setY(c.getY() + b); break; case 40: - d.setY(d.getY() - b); + c.setY(c.getY() - b); break; case 37: - d.setX(d.getX() - b); + c.setX(c.getX() - b); break; case 39: - d.setX(d.getX() + b); + c.setX(c.getX() + b); } this.updateObject(); } @@ -15411,9 +15486,9 @@ Entry.PyAstGenerator = function() { }; (function(a) { a.generate = function(b) { - var a = filbert.parse, c = {locations:!1, ranges:!1}, e; + var a = filbert.parse, d = {locations:!1, ranges:!1}, e; try { - return e = a(b, c), console.log("astTree", e), e; + return e = a(b, d), console.log("astTree", e), e; } catch (f) { throw f.message = " \ud30c\uc774\uc36c \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694", f; } @@ -15479,39 +15554,39 @@ function Node(a) { }; })(Entry.Queue.prototype); Entry.PyHint = function() { - function a(b, a, d) { - b = fuzzy.filter(a, b, d); + function a(b, a, c) { + b = fuzzy.filter(a, b, c); return b = b.map(function(b) { return b.original; }); } - CodeMirror.registerHelper("hint", "python", function(c) { - var e = c.getCursor(), f = c.getTokenAt(e); + CodeMirror.registerHelper("hint", "python", function(d) { + var e = d.getCursor(), f = d.getTokenAt(e); /^[\w$_]*$/.test(f.string) || (f = {start:e.ch, end:e.ch, string:"", state:f.state, className:":" == f.string ? "python-type" : null}); - var g = [], h = f.string, r; + var g = [], h = f.string, k; if ("variable" == f.type) { - r = f.string, null != r && (g = g.concat(a(b, h)), g = g.concat(a(d._global, h, {extract:function(b) { + k = f.string, null != k && (g = g.concat(a(b, h)), g = g.concat(a(c._global, h, {extract:function(b) { return b.displayText; }}))); } else { if ("property" == f.type || "variable-2" == f.type || "." == f.state.lastToken) { - r = f.string; - c = c.getLineTokens(e.line); - for (var t = c.shift();"variable" !== t.type && "variable-2" !== t.type;) { - t = c.shift(); + k = f.string; + d = d.getLineTokens(e.line); + for (var t = d.shift();"variable" !== t.type && "variable-2" !== t.type;) { + t = d.shift(); } - c = t.string; - null != r && d[c] && (g = g.concat(a(d[c], h, {extract:function(b) { + d = t.string; + null != k && c[d] && (g = g.concat(a(c[d], h, {extract:function(b) { return b.displayText; }}))); - "." == f.state.lastToken && (g = g.concat(d[c])); + "." == f.state.lastToken && (g = g.concat(c[d])); } } return {list:g.slice(0, 25), from:CodeMirror.Pos(e.line, f.start), to:CodeMirror.Pos(e.line, f.end)}; }); - var b = "Entry;self;Hw;while True;True;False;break;for i in range;if;if else;len;random.randint".split(";"), d = {_global:[]}, c = Entry.block, e; - for (e in c) { - var f = c[e].syntax; + var b = "Entry;self;Hw;while True;True;False;break;for i in range;if;if else;len;random.randint".split(";"), c = {_global:[]}, d = Entry.block, e; + for (e in d) { + var f = d[e].syntax; if (f && f.py) { f = f.py.join(""); f = f.split("."); @@ -15523,10 +15598,10 @@ Entry.PyHint = function() { } } var g = f.shift(); - d[g] || (d[g] = [], d._global.push({displayText:g, text:g})); + c[g] || (c[g] = [], c._global.push({displayText:g, text:g})); var f = f[0].split(","), h = "(" + Array(f.length).join(" , ") + ")", f = f[0].split("(")[0]; - d[g].push({displayText:f, text:f + h}); - "def" == g ? d._global.push({displayText:g + " " + f, text:g + " " + f + h}) : d._global.push({displayText:g + "." + f, text:g + "." + f + h}); + c[g].push({displayText:f, text:f + h}); + "def" == g ? c._global.push({displayText:g + " " + f, text:g + " " + f + h}) : c._global.push({displayText:g + "." + f, text:g + "." + f + h}); } } }; @@ -15583,7 +15658,6 @@ Entry.TextCodingUtil = function() { break; case "/": b = "DIVIDE"; - break; } return b; }; @@ -15594,7 +15668,6 @@ Entry.TextCodingUtil = function() { break; case "||": b = null; - break; } return b; }; @@ -15688,21 +15761,20 @@ Entry.TextCodingUtil = function() { break; case "DIVIDE": b = "/"; - break; } return b; }; - a.variableFilter = function(b, a, c) { - var e = c; + a.variableFilter = function(b, a, d) { + var c = d; b = b.data.type; - "change_variable" == b || "set_variable" == b || "get_variable" == b ? 1 == a && (e = eval(c)) : "length_of_list" == b || "is_included_in_list" == b ? 2 == a && (e = eval(c)) : "value_of_index_from_list" == b ? 2 == a ? e = eval(c) : 4 == a && this.isNumeric(c) && (e = c - 1) : "remove_value_from_list" == b ? 2 == a ? e = eval(c) : 1 == a && this.isNumeric(c) && (e = c - 1) : "insert_value_to_list" == b ? 2 == a ? e = eval(c) : 3 == a && this.isNumeric(c) && (e = c - 1) : "change_value_list_index" == - b ? 1 == a ? e = eval(c) : 2 == a && this.isNumeric(c) && (e = c - 1) : "add_value_to_list" == b && 2 == a && (e = eval(c)); - return e; + "change_variable" == b || "set_variable" == b || "get_variable" == b ? 1 == a && (c = eval(d)) : "length_of_list" == b || "is_included_in_list" == b ? 2 == a && (c = eval(d)) : "value_of_index_from_list" == b ? 2 == a ? c = eval(d) : 4 == a && this.isNumeric(d) && (c = d - 1) : "remove_value_from_list" == b ? 2 == a ? c = eval(d) : 1 == a && this.isNumeric(d) && (c = d - 1) : "insert_value_to_list" == b ? 2 == a ? c = eval(d) : 3 == a && this.isNumeric(d) && (c = d - 1) : "change_value_list_index" == + b ? 1 == a ? c = eval(d) : 2 == a && this.isNumeric(d) && (c = d - 1) : "add_value_to_list" == b && 2 == a && (c = eval(d)); + return c; }; a.isGlobalVariableExisted = function(b) { - var a = Entry.variableContainer.variables_, c; - for (c in a) { - var e = a[c]; + var a = Entry.variableContainer.variables_, d; + for (d in a) { + var e = a[d]; if (null === e.object_ && e.name_ == b) { return !0; } @@ -15734,24 +15806,24 @@ Entry.TextCodingUtil = function() { } return !1; }; - a.updateLocalVariable = function(b, a, c) { - var e = Entry.variableContainer.variables_, f; - for (f in e) { - var g = e[f]; - if (g.object_ === c.id && g.name_ == b) { + a.updateLocalVariable = function(b, a, d) { + var c = Entry.variableContainer.variables_, f; + for (f in c) { + var g = c[f]; + if (g.object_ === d.id && g.name_ == b) { g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, value:a, name:b, isCloud:g.isClud_}); Entry.variableContainer.updateList(); break; } } }; - a.createLocalVariable = function(b, a, c) { - this.isLocalVariableExisted(b, c) || (Entry.variableContainer.addVariable({name:b, value:a, object:c.id, variableType:"variable"}), Entry.variableContainer.updateList()); + a.createLocalVariable = function(b, a, d) { + this.isLocalVariableExisted(b, d) || (Entry.variableContainer.addVariable({name:b, value:a, object:d.id, variableType:"variable"}), Entry.variableContainer.updateList()); }; a.isLocalVariable = function(b) { - var a = Entry.playground.object, c = Entry.variableContainer.variables_, e; - for (e in c) { - var f = c[e]; + var a = Entry.playground.object, d = Entry.variableContainer.variables_, e; + for (e in d) { + var f = d[e]; if (f.object_ == a.id && f.id_ == b) { return !0; } @@ -15759,9 +15831,9 @@ Entry.TextCodingUtil = function() { return !1; }; a.isGlobalListExisted = function(b) { - var a = Entry.variableContainer.lists_, c; - for (c in a) { - var e = a[c]; + var a = Entry.variableContainer.lists_, d; + for (d in a) { + var e = a[d]; if (null === e.object_ && e.name_ == b) { return !0; } @@ -15794,11 +15866,11 @@ Entry.TextCodingUtil = function() { } return !1; }; - a.updateLocalList = function(b, a, c) { - var e = Entry.variableContainer.lists_, f; - for (f in e) { - var g = e[f]; - if (g.object_ === c.id && g.name_ == b) { + a.updateLocalList = function(b, a, d) { + var c = Entry.variableContainer.lists_, f; + for (f in c) { + var g = c[f]; + if (g.object_ === d.id && g.name_ == b) { g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, name:b, isCloud:g.isClud_, width:g.width_, height:g.height_, array:a}); g.updateView(); Entry.variableContainer.updateList(); @@ -15806,13 +15878,13 @@ Entry.TextCodingUtil = function() { } } }; - a.createLocalList = function(b, a, c) { - this.isLocalListExisted(b, c) || (Entry.variableContainer.addList({name:b, array:a, object:c.id, variableType:"list"}), Entry.variableContainer.updateList()); + a.createLocalList = function(b, a, d) { + this.isLocalListExisted(b, d) || (Entry.variableContainer.addList({name:b, array:a, object:d.id, variableType:"list"}), Entry.variableContainer.updateList()); }; a.isLocalList = function(b) { - var a = Entry.playground.object, c = Entry.variableContainer.lists_, e; - for (e in c) { - var f = c[e]; + var a = Entry.playground.object, d = Entry.variableContainer.lists_, e; + for (e in d) { + var f = d[e]; if (f.object_ == a.id && f.id_ == b) { return !0; } @@ -15837,10 +15909,10 @@ Entry.TextCodingUtil = function() { a.makeDefinition = function(b) { var a = /(%.)/mi; b = Entry.block[b.data.type].syntax.py[0].split(a); - for (var c = "", e = 0;e < b.length;e++) { - var f = b[e], c = a.test(f) ? c + "event" : c + f + for (var d = "", e = 0;e < b.length;e++) { + var f = b[e], d = a.test(f) ? d + "event" : d + f } - return c; + return d; }; a.isNoPrintBlock = function(b) { return !1; @@ -15848,10 +15920,10 @@ Entry.TextCodingUtil = function() { a.entryEventFuncFilter = function(b) { var a = !1; b = b.split("\n"); - for (var c in b) { - var e = b[c]; - "def entry_event_start():" == e || "def entry_event_mouse_down():" == e || "def entry_event_mouse_up():" == e || "def entry_event_object_down():" == e || "def entry_event_scene_start():" == e || "def entry_event_clone_create():" == e ? (tokens = e.split("def"), e = tokens[1].substring(0, tokens[1].length - 1).trim() + "\n", b[c] = e, a = !0) : (new RegExp(/^def entry_event_key(.+):$/)).test(e) || (new RegExp(/^def entry_event_signal(.+):$/)).test(e) ? (tokens = e.split("def"), e = tokens[1].substring(0, - tokens[1].length - 1).trim() + "\n", b[c] = e, a = !0) : a && (e = b[c], e = e.replace("\t", ""), b[c] = e); + for (var d in b) { + var e = b[d]; + "def entry_event_start():" == e || "def entry_event_mouse_down():" == e || "def entry_event_mouse_up():" == e || "def entry_event_object_down():" == e || "def entry_event_scene_start():" == e || "def entry_event_clone_create():" == e ? (tokens = e.split("def"), e = tokens[1].substring(0, tokens[1].length - 1).trim() + "\n", b[d] = e, a = !0) : (new RegExp(/^def entry_event_key(.+):$/)).test(e) || (new RegExp(/^def entry_event_signal(.+):$/)).test(e) ? (tokens = e.split("def"), e = tokens[1].substring(0, + tokens[1].length - 1).trim() + "\n", b[d] = e, a = !0) : a && (e = b[d], e = e.replace("\t", ""), b[d] = e); } return b.join("\n"); }; @@ -15876,65 +15948,65 @@ Entry.TextCodingUtil = function() { } } if (b.data.params[1]) { - var c = this.searchFuncDefParam(b.data.params[1]); - c.data.params[0].data && (a = c.data.params[0].data.type, "function_field_string" != c.data.type && "function_field_boolean" != c.data.type || this._funcParamQ.enqueue(a)); - c.data.params[1] && c.data.params[1].data.params[0].data && (a = c.data.params[1].data.params[0].data.type, "function_field_string" != c.data.params[1].data.type && "function_field_boolean" != c.data.params[1].data.type || this._funcParamQ.enqueue(a)); + var d = this.searchFuncDefParam(b.data.params[1]); + d.data.params[0].data && (a = d.data.params[0].data.type, "function_field_string" != d.data.type && "function_field_boolean" != d.data.type || this._funcParamQ.enqueue(a)); + d.data.params[1] && d.data.params[1].data.params[0].data && (a = d.data.params[1].data.params[0].data.type, "function_field_string" != d.data.params[1].data.type && "function_field_boolean" != d.data.params[1].data.type || this._funcParamQ.enqueue(a)); } } - return c; + return d; }; a.getLastParam = function(b) { b && b.data && b.data.params[1] && (b = this.getLastParam(b.data.params[1])); return b; }; - a.isFuncContentsMatch = function(b, a, c) { - for (var e = !0, f = 0;f < b.length && e;f++) { - var e = !1, g = b[f], h = a[f]; + a.isFuncContentsMatch = function(b, a, d) { + for (var c = !0, f = 0;f < b.length && c;f++) { + var c = !1, g = b[f], h = a[f]; if (g && !h) { - e = fasle; + c = fasle; break; } if (!g && h) { - e = !1; + c = !1; break; } if (h.type == g.data.type) { - var e = !0, k = h.params, l = g.data.params, m = []; + var c = !0, k = h.params, l = g.data.params, m = []; l.map(function(b, a) { b && m.push(b); }); l = m; if (k.length == l.length) { - for (var e = !0, n = 0;n < k.length && e;n++) { - if (e = !1, k[n].name) { + for (var c = !0, n = 0;n < k.length && c;n++) { + if (c = !1, k[n].name) { for (var q in textFuncParams) { if (k[n].name == textFuncParams[q]) { - for (var r in c) { - if (l[n].data.type == r && c[r] == q) { - e = !0; + for (var r in d) { + if (l[n].data.type == r && d[r] == q) { + c = !0; break; } } - if (e) { + if (c) { break; } } } } else { - "True" == k[n].type || "False" == k[n].type ? k[n].type == l[n].data.type && (e = !0) : k[n].type && k[n].params && k[n].params[0] == l[n].data.params[0] && (e = !0); + "True" == k[n].type || "False" == k[n].type ? k[n].type == l[n].data.type && (c = !0) : k[n].type && k[n].params && k[n].params[0] == l[n].data.params[0] && (c = !0); } } - e && h.statements && 0 != h.statements.length && (e = this.isFuncContentsMatch(g.data.statements[0]._data, h.statements[0])); + c && h.statements && 0 != h.statements.length && (c = this.isFuncContentsMatch(g.data.statements[0]._data, h.statements[0])); } else { - e = !1; + c = !1; break; } } else { - e = !1; + c = !1; break; } } - return e; + return c; }; a.isParamBlock = function(b) { b = b.type; @@ -16060,9 +16132,9 @@ Entry.BlockToJsParser = function(a) { } var a = ""; b = b.getBlocks(); - for (var c = 0;c < b.length;c++) { - var e = b[c]; - c != b.length - 1 ? (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e + "\n" : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e + "\n")) : (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e)); + for (var d = 0;d < b.length;d++) { + var e = b[d]; + d != b.length - 1 ? (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e + "\n" : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e + "\n")) : (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e)); } return a + "\n"; }; @@ -16074,7 +16146,7 @@ Entry.BlockToJsParser = function(a) { return ""; }; a.Scope = function(b) { - var a = !1, c = "", e = /(%.)/mi; + var a = !1, d = "", e = /(%.)/mi; if (b._schema.syntax.js) { var f = b._schema.syntax.js.concat(), a = !0 } else { @@ -16083,25 +16155,25 @@ Entry.BlockToJsParser = function(a) { f.shift(); for (var f = f[0].split(e), g = b._schema.params, h = b.data.params, k = 0;k < f.length;k++) { var l = f[k]; - 0 !== l.length && "Scope" !== l && ("Judge" === l ? a = !0 : e.test(l) ? (l = l.split("%")[1], l = parseInt(l) - 1, g[l] && "Image" != g[l].type && ("Block" == g[l].type ? (l = this.Block(h[l]), c += l) : c += this[g[l].type](h[l], g[l]))) : c += l); + 0 !== l.length && "Scope" !== l && ("Judge" === l ? a = !0 : e.test(l) ? (l = l.split("%")[1], l = parseInt(l) - 1, g[l] && "Image" != g[l].type && ("Block" == g[l].type ? (l = this.Block(h[l]), d += l) : d += this[g[l].type](h[l], g[l]))) : d += l); } - "#" == c.charAt(c.length - 1) && (a = !0, c = c.substring(0, c.length - 1), c = c.trim()); - a || (c += "();"); - return c = Entry.TextCodingUtil.prototype.jsAdjustSyntax(b, c); + "#" == d.charAt(d.length - 1) && (a = !0, d = d.substring(0, d.length - 1), d = d.trim()); + a || (d += "();"); + return d = Entry.TextCodingUtil.prototype.jsAdjustSyntax(b, d); }; a.BasicFunction = function(b) { b = this.Thread(b.statements[0]); return "function promise() {\n" + this.indent(b).trim() + "}"; }; a.BasicIteration = function(b) { - var a = b.params[0], c = this.publishIterateVariable(); + var a = b.params[0], d = this.publishIterateVariable(); b = this.Thread(b.statements[0]); this.unpublishIterateVariable(); - return "for (var " + c + " = 0; " + c + " < " + a + "; " + c + "++) {\n" + this.indent(b) + "}"; + return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++) {\n" + this.indent(b) + "}"; }; a.BasicIf = function(b) { if (2 == b.data.statements.length) { - var a = this.Thread(b.statements[0]), c = this.Thread(b.statements[1]), e = b._schema.syntax.concat(), e = (b = b.data.params[0]) && "True" == b.data.type ? e[1] : void 0 === b ? e[1] : this.Block(b), a = "if (" + e + ") {\n" + this.indent(a) + "}\nelse {\n" + this.indent(c) + "}\n" + var a = this.Thread(b.statements[0]), d = this.Thread(b.statements[1]), e = b._schema.syntax.concat(), e = (b = b.data.params[0]) && "True" == b.data.type ? e[1] : void 0 === b ? e[1] : this.Block(b), a = "if (" + e + ") {\n" + this.indent(a) + "}\nelse {\n" + this.indent(d) + "}\n" } else { a = this.Thread(b.statements[0]), e = b._schema.syntax.concat(), e = (b = b.data.params[0]) && "True" == b.data.type ? e[1] : void 0 === b ? e[1] : this.Block(b), a = "if (" + e + ") {\n" + this.indent(a) + "}\n"; } @@ -16114,8 +16186,8 @@ Entry.BlockToJsParser = function(a) { a.indent = function(b) { var a = ""; b = b.split("\n"); - for (var c in b) { - var e = b[c]; + for (var d in b) { + var e = b[d]; 0 != e.length && (a += "\t" + e + "\n"); } return a; @@ -16179,37 +16251,37 @@ Entry.BlockToPyParser = function(a) { } var a = ""; b = b.getBlocks(); - for (var c = !1, e = "", f = "", g = 0;g < b.length;g++) { + for (var d = !1, e = "", f = "", g = 0;g < b.length;g++) { var h = b[g]; if (this._parseMode == Entry.Parser.PARSE_GENERAL) { if (Entry.TextCodingUtil.prototype.isNoPrintBlock(h)) { continue; } - 0 == g ? (c = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? e = this.Block(h) + "\n" : f += this.Block(h) + "\n" : 0 != g && (f += this.Block(h) + "\n"); + 0 == g ? (d = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? e = this.Block(h) + "\n" : f += this.Block(h) + "\n" : 0 != g && (f += this.Block(h) + "\n"); } else { - this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = (c = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? "" : this.Block(h) + "\n"); + this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = (d = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? "" : this.Block(h) + "\n"); } this._queue.clear(); this._variableMap.clear(); } - this._parseMode == Entry.Parser.PARSE_GENERAL && (a = c ? e + Entry.TextCodingUtil.prototype.indent(f) + "\n" : e + f + "\n"); + this._parseMode == Entry.Parser.PARSE_GENERAL && (a = d ? e + Entry.TextCodingUtil.prototype.indent(f) + "\n" : e + f + "\n"); return a = a.trim() + "\n"; }; a.Block = function(b) { - var a = "", c; - b._schema && b._schema.syntax && (c = b._schema.syntax.py[0]); - this.isFunc(b) ? (a += this.makeFuncDef(b), this.isRegisteredFunc(b) && (c = this.makeFuncSyntax(b))) : this.isFuncStmtParam(b) && (a += b.data.type); - if (!c || null == c) { + var a = "", d; + b._schema && b._schema.syntax && (d = b._schema.syntax.py[0]); + this.isFunc(b) ? (a += this.makeFuncDef(b), this.isRegisteredFunc(b) && (d = this.makeFuncSyntax(b))) : this.isFuncStmtParam(b) && (a += b.data.type); + if (!d || null == d) { return a; } var e = /(%.)/mi, f = /(\$.)/mi; - c = c.split(e); + d = d.split(e); var g = b._schema.params, h = b.data.params, k = b._schema.skeleton, l = b._schema.paramsKeyMap, m; if (this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l) { var n } - for (var q = 0;q < c.length;q++) { - if (n = c[q], 0 !== n.length) { + for (var q = 0;q < d.length;q++) { + if (n = d[q], 0 !== n.length) { if (e.test(n)) { n = n.split("%")[1]; var r = Number(n) - 1; @@ -16304,8 +16376,8 @@ Entry.BlockToPyParser = function(a) { return "func" == b.data.type.split("_")[0] ? !0 : !1; }; a.isRegisteredFunc = function(b) { - b = b.data.type.split("_")[1]; - return Entry.variableContainer.functions_[b] ? !0 : !1; + b = b.data.type.split("_"); + return Entry.variableContainer.functions_[b[1]] ? !0 : !1; }; a.isFuncStmtParam = function(b) { b = b.data.type.split("_")[0]; @@ -16314,10 +16386,10 @@ Entry.BlockToPyParser = function(a) { a.makeFuncSyntax = function(b) { var a = b._schema.template.trim(); b = b._schema.params; - var c = /(%.)/mi, a = a.trim().split(c), e = "", f = "", g; + var d = /(%.)/mi, a = a.trim().split(d), e = "", f = "", g; for (g in a) { var h = a[g].trim(); - if (c.test(h)) { + if (d.test(h)) { var k = h.split("%")[1], k = Number(k) - 1; "Indicator" != b[k].type && (f += h.concat(", ")); } else { @@ -16329,27 +16401,27 @@ Entry.BlockToPyParser = function(a) { return e.trim().concat("(").concat(f.trim()).concat(")"); }; a.makeFuncDef = function(b) { - var a = "def ", c = this.getFuncInfo(b); - this.isRegisteredFunc(b) || (c.name = "f"); - if (c.name) { - a += c.name; + var a = "def ", d = this.getFuncInfo(b); + this.isRegisteredFunc(b) || (d.name = "f"); + if (d.name) { + a += d.name; } else { return a; } a = a.concat("("); - if (c.params && 0 != c.params.length) { - for (var e in c.params) { - a += c.params[e], a = a.concat(", "); + if (d.params && 0 != d.params.length) { + for (var e in d.params) { + a += d.params[e], a = a.concat(", "); } b = a.lastIndexOf(","); a = a.substring(0, b); a = a.trim(); } a = a.concat("):").concat("\n"); - if (c.statements && c.statements.length) { + if (d.statements && d.statements.length) { b = ""; - for (var f in c.statements) { - b += this.Block(c.statements[f]).concat("\n"); + for (var f in d.statements) { + b += this.Block(d.statements[f]).concat("\n"); } b = b.concat("\n"); a += Entry.TextCodingUtil.prototype.indent(b).concat("\n"); @@ -16360,18 +16432,18 @@ Entry.BlockToPyParser = function(a) { a.getFuncInfo = function(b) { var a = {}; if (b = b.data.type.split("_")[1]) { - var c = Entry.variableContainer.functions_[b]; - if (!c) { + var d = Entry.variableContainer.functions_[b]; + if (!d) { return a.name = "\ud568\uc218", a; } } else { return a; } - b = c.block.template; + b = d.block.template; var e = b.search(/(%.)/); b = b.substring(0, e).trim().split(" ").join("__"); Entry.TextCodingUtil.prototype.initQueue(); - Entry.TextCodingUtil.prototype.gatherFuncDefParam(c.content._data[0]._data[0].data.params[0]); + Entry.TextCodingUtil.prototype.gatherFuncDefParam(d.content._data[0]._data[0].data.params[0]); for (var f = [], g = {};m = Entry.TextCodingUtil.prototype._funcParamQ.dequeue();) { f.push(m); } @@ -16395,10 +16467,10 @@ Entry.BlockToPyParser = function(a) { this._funcMap.put(k, m); } } - k = c.content._data[0]._data; + k = d.content._data[0]._data; l = []; - for (c = 1;c < k.length;c++) { - l.push(k[c]); + for (d = 1;d < k.length;d++) { + l.push(k[d]); } b && (a.name = b); 0 != Object.keys(f).length && (a.params = f); @@ -16415,8 +16487,8 @@ Entry.JsToBlockParser = function(a) { }; (function(a) { a.Program = function(b) { - var a = [], c = []; - c.push({type:this.syntax.Program}); + var a = [], d = []; + d.push({type:this.syntax.Program}); for (var e in b) { var f = b[e]; if ("Program" != f.type) { @@ -16425,10 +16497,10 @@ Entry.JsToBlockParser = function(a) { this.initScope(f); var f = this.BlockStatement(f), g; for (g in f) { - c.push(f[g]); + d.push(f[g]); } this.unloadScope(); - 0 != c.length && a.push(c); + 0 != d.length && a.push(d); } return a; }; @@ -16443,32 +16515,32 @@ Entry.JsToBlockParser = function(a) { return this[b.type](b); }; a.ForStatement = function(b) { - var a = b.init, c = b.test, e = b.update, f = b.body; + var a = b.init, d = b.test, e = b.update, f = b.body; if (this.syntax.ForStatement) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - var f = this[f.type](f), a = a.declarations[0].init.value, g = c.operator, c = c.right.value, h = 0; - "++" != e.operator && (e = a, a = c, c = e); + var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; + "++" != e.operator && (e = a, a = d, d = e); switch(g) { case "<": - h = c - a; + h = d - a; break; case "<=": - h = c + 1 - a; + h = d + 1 - a; break; case ">": - h = a - c; + h = a - d; break; case ">=": - h = a + 1 - c; + h = a + 1 - d; } return this.BasicIteration(b, h, f); }; a.BlockStatement = function(b) { var a = []; b = b.body; - for (var c = 0;c < b.length;c++) { - var e = b[c], f = this[e.type](e); + for (var d = 0;d < b.length;d++) { + var e = b[d], f = this[e.type](e); Entry.TextCodingUtil.prototype.hasBlockInfo(e, this._blockInfo) || this._blockCount++; Entry.TextCodingUtil.prototype.updateBlockInfo(e, this._blockInfo); if (f) { @@ -16523,8 +16595,8 @@ Entry.JsToBlockParser = function(a) { throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; }; a.WhileStatement = function(b) { - var a = b.body, c = this.syntax.WhileStatement, a = this[a.type](a); - if (c) { + var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); + if (d) { throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } return this.BasicWhile(b, a); @@ -16578,7 +16650,7 @@ Entry.JsToBlockParser = function(a) { return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); }; a.BinaryExpression = function(b) { - var a, c = {}; + var a, d = {}; a = String(b.operator); var e = b.left.name; switch(a) { @@ -16615,7 +16687,7 @@ Entry.JsToBlockParser = function(a) { h = this[a.type](a), (h = Entry.TextCodingUtil.prototype.radarVariableConvertor(h)) && e.push(h); } if (a = String(b.operator)) { - (h = a = Entry.TextCodingUtil.prototype.jTobBinaryOperatorConvertor(a)) && e.push(h), c.operator = a; + (h = a = Entry.TextCodingUtil.prototype.jTobBinaryOperatorConvertor(a)) && e.push(h), d.operator = a; } a = b.right; if ("Literal" == a.type || "Identifier" == a.type) { @@ -16633,50 +16705,50 @@ Entry.JsToBlockParser = function(a) { } else { h = this[a.type](a), "ai_boolean_object" == f && (h = h.params[0], e.splice(1, 1)), h && e.push(h); } - c.type = f; - c.params = e; + d.type = f; + d.params = e; } else { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; } - return c; + return d; }; a.LogicalExpression = function(b) { - var a = {}, c = String(b.operator); - switch(c) { + var a = {}, d = String(b.operator); + switch(d) { case "&&": var e = "ai_boolean_and"; break; default: e = "ai_boolean_and"; } - var f = [], c = b.left; - if ("Literal" == c.type || "Identifier" == c.type) { + var f = [], d = b.left; + if ("Literal" == d.type || "Identifier" == d.type) { arguments = []; - arguments.push(c); - var c = Entry.block[e].params, g; - for (g in c) { - var h = c[g].type; + arguments.push(d); + var d = Entry.block[e].params, g; + for (g in d) { + var h = d[g].type; "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); } for (var k in arguments) { - c = arguments[k], (c = this[c.type](c)) && null != c && f.push(c); + d = arguments[k], (d = this[d.type](d)) && null != d && f.push(d); } } else { - (c = this[c.type](c)) && f.push(c); + (d = this[d.type](d)) && f.push(d); } - if (c = String(b.operator)) { - c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), f.push(c); + if (d = String(b.operator)) { + d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), f.push(d); } - c = b.right; - if ("Literal" == c.type || "Identifier" == c.type) { + d = b.right; + if ("Literal" == d.type || "Identifier" == d.type) { arguments = []; - arguments.push(c); - c = Entry.block[e].params; - for (g in c) { - h = c[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); + arguments.push(d); + d = Entry.block[e].params; + for (g in d) { + h = d[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); } for (k in arguments) { - c = arguments[k], (c = this[c.type](c)) && null != c && f.push(c); + d = arguments[k], (d = this[d.type](d)) && null != d && f.push(d); } if ("True" != f[0].type && "ai_boolean_distance" != f[0].type && "ai_boolean_object" != f[0].type && "ai_boolean_and" != f[0].type && "ai_distance_value" != f[0].type) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; @@ -16685,7 +16757,7 @@ Entry.JsToBlockParser = function(a) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; } } else { - (c = this[c.type](c)) && f.push(c); + (d = this[d.type](d)) && f.push(d); } a.type = e; a.params = f; @@ -16695,13 +16767,13 @@ Entry.JsToBlockParser = function(a) { return ["||", "&&"]; }; a.MemberExpression = function(b) { - var a = b.object, c = b.property, a = this[a.type](a), c = this[c.type](c, a); + var a = b.object, d = b.property, a = this[a.type](a), d = this[d.type](d, a); if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; } - a = c; + a = d; if (!a) { - throw {message:c + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; + throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; } return a; }; @@ -16714,12 +16786,12 @@ Entry.JsToBlockParser = function(a) { a.CallExpression = function(b) { var a = b.callee; b = b.arguments; - for (var c = [], a = this[a.type](a), a = this.syntax.Scope[a], e = Entry.block[a], f = 0;f < b.length;f++) { + for (var d = [], a = this[a.type](a), a = this.syntax.Scope[a], e = Entry.block[a], f = 0;f < b.length;f++) { var g = b[f], g = this[g.type](g, a); "Dropdown" != e.params[f].type && "Block" === e.params[f].type && (g = "string" == typeof g ? {type:"text", params:[g]} : "number" == typeof g ? {type:"number", params:[g]} : g); - c.push(g); + d.push(g); } - return {type:a, params:c}; + return {type:a, params:d}; }; a.NewExpression = function(b) { throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; @@ -16746,8 +16818,8 @@ Entry.JsToBlockParser = function(a) { }; a.scanDefinition = function(b) { b = b.body; - for (var a = [], c = 0;c < b.length;c++) { - var e = b[c]; + for (var a = [], d = 0;d < b.length;d++) { + var e = b[d]; "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); } return a; @@ -16755,15 +16827,15 @@ Entry.JsToBlockParser = function(a) { a.BasicFunction = function(b, a) { return null; }; - a.BasicIteration = function(b, a, c) { + a.BasicIteration = function(b, a, d) { if (10 < a) { throw {message:"\ubc18\ubcf5 \uc22b\uc790\uac12\uc774 10\uc744 \ub118\uc73c\uba74 \uc548\ub429\ub2c8\ub2e4.", node:b.test}; } - var e = this.syntax.BasicIteration; - if (!e) { + var c = this.syntax.BasicIteration; + if (!c) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - return {params:[a], type:e, statements:[c]}; + return {params:[a], type:c, statements:[d]}; }; a.BasicWhile = function(b, a) { var c = b.test.raw; @@ -16773,7 +16845,7 @@ Entry.JsToBlockParser = function(a) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; }; a.BasicIf = function(b) { - var a = {params:[], statements:[]}, c, e = [], f = [], g = [], h = b.consequent; + var a = {params:[], statements:[]}, d, e = [], f = [], g = [], h = b.consequent; if (h) { var k = this[h.type](h) } @@ -16783,19 +16855,19 @@ Entry.JsToBlockParser = function(a) { try { var m = b.test.operator ? "===" === b.test.operator ? "==" : b.test.operator : null, n = b.test.left && b.test.right ? b.test.left.name + b.test.right.value : null; if ("frontwall" == n && "==" == m) { - c = this.syntax.BasicIf["front == 'wall'"]; + d = this.syntax.BasicIf["front == 'wall'"]; } else { if ("fronthump" == n && "==" == m) { - c = this.syntax.BasicIf["front == 'hump'"]; + d = this.syntax.BasicIf["front == 'hump'"]; } else { if ("frontstone" == n && "==" == m) { - c = this.syntax.BasicIf["front == 'stone'"]; + d = this.syntax.BasicIf["front == 'stone'"]; } else { if ("frontbee" == n && "==" == m) { - c = this.syntax.BasicIf["front == 'bee'"]; + d = this.syntax.BasicIf["front == 'bee'"]; } else { if (b.test.value || b.test.left && b.test.right) { - c = "ai_if_else"; + d = "ai_if_else"; var q = this[b.test.type](b.test, this.syntax.Scope); g.push(q); } else { @@ -16805,7 +16877,7 @@ Entry.JsToBlockParser = function(a) { } } } - c ? (k && 0 != k.length && a.statements.push(k), l && 0 != l.length && a.statements.push(l), c && (a.type = c), g && 0 != g.length && (a.params = g)) : (k && 0 != k.length && (e = k), l && 0 != l.length && (f = l), c && (a.type = c), g && 0 != g.length && (a.params = g), a.statements = [e, f]); + d ? (k && 0 != k.length && a.statements.push(k), l && 0 != l.length && a.statements.push(l), d && (a.type = d), g && 0 != g.length && (a.params = g)) : (k && 0 != k.length && (e = k), l && 0 != l.length && (f = l), d && (a.type = d), g && 0 != g.length && (a.params = g), a.statements = [e, f]); return a; } catch (r) { throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; @@ -16822,15 +16894,15 @@ Entry.PyToBlockParser = function(a) { }; (function(a) { a.Program = function(b) { - var a = [], c; - for (c in b) { - if ("Program" != b[c].type) { + var a = [], d; + for (d in b) { + if ("Program" != b[d].type) { return; } - var e = [], f = b[c].body; + var e = [], f = b[d].body; console.log("nodes", f); - for (c in f) { - var g = f[c]; + for (d in f) { + var g = f[d]; console.log("Program node", g); g = this[g.type](g); console.log("result block", g); @@ -16851,7 +16923,7 @@ Entry.PyToBlockParser = function(a) { }; a.CallExpression = function(b) { console.log("CallExpression component", b); - var a = {}, c = [], e, f = b.callee, g = this[f.type](f); + var a = {}, d = [], e, f = b.callee, g = this[f.type](f); console.log("CallExpression calleeData", g); arguments = b.arguments; if ("Identifier" == f.type) { @@ -16917,11 +16989,11 @@ Entry.PyToBlockParser = function(a) { console.log("CallExpression arguments", arguments); for (var r in arguments) { if (q = arguments[r]) { - console.log("CallExpression argument", q, "typeof", typeof q), q = this[q.type](q, f[r], n[r], !0), console.log("CallExpression param", q), "__pythonRuntime.functions.range" == k && q.type ? (e = q.type, c = q.params) : c.push(q); + console.log("CallExpression argument", q, "typeof", typeof q), q = this[q.type](q, f[r], n[r], !0), console.log("CallExpression param", q), "__pythonRuntime.functions.range" == k && q.type ? (e = q.type, d = q.params) : d.push(q); } } console.log("CallExpression syntax", m); - console.log("CallExpression argument params", c); + console.log("CallExpression argument params", d); if ("%2.append" == m || "%2.pop" == m) { if ("self" == l[0]) { var h = Entry.playground.object, t = l[1]; @@ -16936,9 +17008,9 @@ Entry.PyToBlockParser = function(a) { console.log("CallExpression append calleeData", g); r = this.ParamDropdownDynamic(t, f[1], n[1]); console.log("CallExpression listName", r); - c.push(r); - console.log("CallExpression params[0]", c[0]); - "%2.pop" == m && ("number" == c[0].type ? c[0].params[0] += 1 : "text" == c[0].type && (c[0].params[0] = String(Number(c[0].params[0]) + 1))); + d.push(r); + console.log("CallExpression params[0]", d[0]); + "%2.pop" == m && ("number" == d[0].type ? d[0].params[0] += 1 : "text" == d[0].type && (d[0].params[0] = String(Number(d[0].params[0]) + 1))); } else { if ("%2.insert" == m) { if ("self" == l[0]) { @@ -16950,61 +17022,61 @@ Entry.PyToBlockParser = function(a) { return a; } } - console.log("CallExpression insert params", c); - c.pop(); + console.log("CallExpression insert params", d); + d.pop(); console.log("CallExpression append calleeData", g); r = this.ParamDropdownDynamic(t, f[1], n[1]); console.log("CallExpression listName", r); - c.splice(0, 0, r); + d.splice(0, 0, r); console.log("CallExpression check arguments", arguments); console.log("CallExpression arguments[1] 2", arguments[1]); q = this[arguments[1].type](arguments[1], f[2], n[2], !0); console.log("CallExpression check param", q); - c.splice(0, 0, q); - console.log("CallExpression insert params", c); - "number" == c[2].type ? c[2].params[0] += 1 : "text" == c[2].type && (c[2].params[0] = String(Number(c[2].params[0]) + 1)); + d.splice(0, 0, q); + console.log("CallExpression insert params", d); + "number" == d[2].type ? d[2].params[0] += 1 : "text" == d[2].type && (d[2].params[0] = String(Number(d[2].params[0]) + 1)); } else { - "len" == m ? (r = this.ParamDropdownDynamic(c[1].name, f[1], n[1]), delete c[1], c[1] = r) : "%4 in %2" == m && (q = b.arguments[1], q = this[q.type](q, f[3], n[3], !0), r = b.arguments[3].name, r = this.ParamDropdownDynamic(r, f[1], n[1]), c = [], c.push(""), c.push(r), c.push(""), c.push(q), c.push("")); + "len" == m ? (r = this.ParamDropdownDynamic(d[1].name, f[1], n[1]), delete d[1], d[1] = r) : "%4 in %2" == m && (q = b.arguments[1], q = this[q.type](q, f[3], n[3], !0), r = b.arguments[3].name, r = this.ParamDropdownDynamic(r, f[1], n[1]), d = [], d.push(""), d.push(r), d.push(""), d.push(q), d.push("")); } } e && (a.type = e); - c && (a.params = c); + d && (a.params = d); } else { - c = []; + d = []; for (r in arguments) { - q = arguments[r], console.log("CallExpression argument", q, "typeof", typeof q), f = this[q.type](q), console.log("CallExpression argumentData", f), "__pythonRuntime.utils.createParamsObj" == f.callee ? c = f.arguments : c.push(f); + q = arguments[r], console.log("CallExpression argument", q, "typeof", typeof q), f = this[q.type](q), console.log("CallExpression argumentData", f), "__pythonRuntime.utils.createParamsObj" == f.callee ? d = f.arguments : d.push(f); } - console.log("CallExpression args", c); - a.arguments = c; + console.log("CallExpression args", d); + a.arguments = d; } console.log("CallExpression Function Check result", a); if (a.arguments && a.arguments[0] && "__pythonRuntime.utils.createParamsObj" == a.arguments[0].callee) { return a; } - a.callee && (c = a.callee.name + (a.arguments ? a.arguments.length : 0), console.log("funcKey", c), e = this._funcMap.get(c)) && (a = {}, a.type = e); + a.callee && (d = a.callee.name + (a.arguments ? a.arguments.length : 0), console.log("funcKey", d), e = this._funcMap.get(d)) && (a = {}, a.type = e); console.log("CallExpression result", a); return a; }; - a.Identifier = function(b, a, c) { - console.log("Identifier component", b, "paramMeta", a, "paramDefMeta", c); + a.Identifier = function(b, a, d) { + console.log("Identifier component", b, "paramMeta", a, "paramDefMeta", d); a = {}; a.name = b.name; if (!0 === b.userCode || !1 === b.userCode) { a.userCode = b.userCode; } - if (c = this.getBlockType("%1")) { + if (d = this.getBlockType("%1")) { b = b.name; - var e = Entry.block[c], f = e.params, e = e.def.params; + var c = Entry.block[d], f = c.params, c = c.def.params; if (!Entry.TextCodingUtil.prototype.isGlobalVariableExisted(b)) { return a; } var g = [], h, k; for (k in f) { - console.log("Identifiler paramsMeta, paramsDefMeta", f[k], e[k]), "Text" != f[k].type && (h = this["Param" + f[k].type](b, f[k], e[k])); + console.log("Identifiler paramsMeta, paramsDefMeta", f[k], c[k]), "Text" != f[k].type && (h = this["Param" + f[k].type](b, f[k], c[k])); } console.log("Identifiler param", h); h && g.push(h); - a.type = c; + a.type = d; 0 != g.length && (a.params = g); } console.log("Identifiler result", a); @@ -17012,23 +17084,23 @@ Entry.PyToBlockParser = function(a) { }; a.VariableDeclaration = function(b) { console.log("VariableDeclaration component", b); - var a = {declarations:[]}, c, e; + var a = {declarations:[]}, d, e; b = b.declarations; for (var f in b) { var g = b[f], g = this[g.type](g); console.log("VariableDeclaration declarationData", g); g && a.declarations.push(g); - g && g.type && (c = g.type); + g && g.type && (d = g.type); g && g.params && (e = g.params); } - c && (a.type = c); + d && (a.type = d); e && (a.params = e); console.log("VariableDeclaration result", a); return a; }; a.VariableDeclarator = function(b) { console.log("VariableDeclarator component", b); - var a = {}, c, e; + var a = {}, d, e; e = b.id; var f = b.init; if ("__params0" != e.name && "__formalsIndex0" != e.name && "__args0" != e.name) { @@ -17059,9 +17131,9 @@ Entry.PyToBlockParser = function(a) { h = e.name; f = []; arguments = g.arguments; - for (c in arguments) { + for (d in arguments) { var m = {}; - m.data = String(arguments[c].params[0]); + m.data = String(arguments[d].params[0]); f.push(m); } Entry.TextCodingUtil.prototype.isGlobalListExisted(h) ? Entry.TextCodingUtil.prototype.updateGlobalList(h, f) : Entry.TextCodingUtil.prototype.createGlobalList(h, f); @@ -17078,14 +17150,14 @@ Entry.PyToBlockParser = function(a) { a.init = g; console.log("VariableDeclarator init.type", f.type); if ("Literal" == f.type) { - c = e = this.getBlockType("%1 = %2"); + d = e = this.getBlockType("%1 = %2"); } else { if (g.params && g.params[0] && g.params[0].name && h.name == g.params[0].name) { - if (console.log("VariableDeclarator idData.name", h.name, "initData.params[0].name", g.params[0].name), c = e = this.getBlockType("%1 += %2"), "PLUS" != g.operator) { + if (console.log("VariableDeclarator idData.name", h.name, "initData.params[0].name", g.params[0].name), d = e = this.getBlockType("%1 += %2"), "PLUS" != g.operator) { return a; } } else { - c = e = this.getBlockType("%1 = %2"); + d = e = this.getBlockType("%1 = %2"); } } k = Entry.block[e]; @@ -17094,86 +17166,86 @@ Entry.PyToBlockParser = function(a) { h.name && (m = this.ParamDropdownDynamic(h.name, e[0], k[0])); e = []; "Literal" == f.type ? (h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g)) : (console.log("VariableDeclarator idData", h, "initData", g), g.params && g.params[0] && h.name == g.params[0].name ? (console.log("in initData.params[0]"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g.params[2])) : (console.log("in initData"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g))); - a.type = c; + a.type = d; a.params = e; } console.log("VariableDeclarator result", a); return a; } }; - a.Literal = function(b, a, c, e) { - console.log("Literal component", b, "paramMeta", a, "paramDefMeta", c, "aflag", e); + a.Literal = function(b, a, d, e) { + console.log("Literal component", b, "paramMeta", a, "paramDefMeta", d, "aflag", e); e = b.value; console.log("Literal value", e); - a || (a = {type:"Block"}, c || (c = "number" == typeof e ? {type:"number"} : {type:"text"})); + a || (a = {type:"Block"}, d || (d = "number" == typeof e ? {type:"number"} : {type:"text"})); if ("Indicator" == a.type) { return null; } if ("Text" == a.type) { return ""; } - console.log("Literal paramMeta", a, "paramDefMeta", c); - null != b.value ? (a = this["Param" + a.type](e, a, c), console.log("Literal param", void 0)) : (a = [], c = this[b.left.type](b.left), a.push(c), a.push(b.operator), b = this[b.right.type](b.right), a.push(b)); + console.log("Literal paramMeta", a, "paramDefMeta", d); + null != b.value ? (a = this["Param" + a.type](e, a, d), console.log("Literal param", void 0)) : (a = [], d = this[b.left.type](b.left), a.push(d), a.push(b.operator), b = this[b.right.type](b.right), a.push(b)); b = a; console.log("Literal result", b); return b; }; - a.ParamBlock = function(b, a, c) { - console.log("ParamBlock value", b, "paramMeta", a, "paramDefMeta", c); + a.ParamBlock = function(b, a, d) { + console.log("ParamBlock value", b, "paramMeta", a, "paramDefMeta", d); a = {}; - var e = b, f = []; + var c = b, f = []; if (!0 === b) { return a.type = "True", a; } if (!1 === b) { return a.type = "False", a; } - var g = Entry.block[c.type], h = g.params, g = g.def.params; + var g = Entry.block[d.type], h = g.params, g = g.def.params; if (h && 0 != h.length) { for (var k in h) { - console.log("aaa", h[k], "bbb", g[k]), e = this["Param" + h[k].type](b, h[k], g[k]); + console.log("aaa", h[k], "bbb", g[k]), c = this["Param" + h[k].type](b, h[k], g[k]); } } else { - e = b; + c = b; } - console.log("ParamBlock param", e); - f.push(e); - a.type = c.type; + console.log("ParamBlock param", c); + f.push(c); + a.type = d.type; a.params = f; console.log("ParamBlock result", a); return a; }; - a.ParamAngle = function(b, a, c) { - console.log("ParamAngle value, paramMeta, paramDefMeta", b, a, c); + a.ParamAngle = function(b, a, d) { + console.log("ParamAngle value, paramMeta, paramDefMeta", b, a, d); return b; }; - a.ParamTextInput = function(b, a, c) { - console.log("ParamTextInput value, paramMeta, paramDefMeta", b, a, c); + a.ParamTextInput = function(b, a, d) { + console.log("ParamTextInput value, paramMeta, paramDefMeta", b, a, d); return b; }; - a.ParamColor = function(b, a, c) { - console.log("ParamColor value, paramMeta, paramDefMeta", b, a, c); + a.ParamColor = function(b, a, d) { + console.log("ParamColor value, paramMeta, paramDefMeta", b, a, d); console.log("ParamColor result", b); return b; }; - a.ParamDropdown = function(b, a, c) { - console.log("ParamDropdown value, paramMeta, paramDefMeta", b, a, c); - var e; + a.ParamDropdown = function(b, a, d) { + console.log("ParamDropdown value, paramMeta, paramDefMeta", b, a, d); + var c; a = a.options; console.log("options", a); for (var f in a) { - if (c = a[f], b == c[1]) { - e = c[1]; + if (d = a[f], b == d[1]) { + c = d[1]; break; } } - e && (e = String(e)); - console.log("ParamDropdown result", e); - return e; + c && (c = String(c)); + console.log("ParamDropdown result", c); + return c; }; - a.ParamDropdownDynamic = function(b, a, c) { - console.log("ParamDropdownDynamic value, paramMeta, paramDefMeta", b, a, c); - var e; + a.ParamDropdownDynamic = function(b, a, d) { + console.log("ParamDropdownDynamic value, paramMeta, paramDefMeta", b, a, d); + var c; if ("mouse" == b || "wall" == b || "wall_up" == b || "wall_down" == b || "wall_right" == b || "wall_left" == b) { return b; } @@ -17182,46 +17254,46 @@ Entry.PyToBlockParser = function(a) { for (var f in a) { if (b == a[f][0]) { console.log("options[i][0]", a[f][0]); - e = a[f][1]; + c = a[f][1]; break; } } - e && (e = String(e)); - console.log("ParamDropdownDynamic result", e); - return e; + c && (c = String(c)); + console.log("ParamDropdownDynamic result", c); + return c; }; - a.ParamKeyboard = function(b, a, c) { - console.log("ParamKeyboard value, paramMeta, paramDefMeta", b, a, c); + a.ParamKeyboard = function(b, a, d) { + console.log("ParamKeyboard value, paramMeta, paramDefMeta", b, a, d); b = Entry.KeyboardCode.prototype.keyCharToCode[b]; console.log("ParamKeyboard result", b); return b; }; - a.Indicator = function(b, a, c) { + a.Indicator = function(b, a, d) { }; a.MemberExpression = function(b) { console.log("MemberExpression component", b); - var a = {}, c, e = b.object, f = b.property; - c = this[e.type](e); - a.object = c; + var a = {}, d, e = b.object, f = b.property; + d = this[e.type](e); + a.object = d; var g = this[f.type](f); a.property = g; - console.log("MemberExpression objectData", c); + console.log("MemberExpression objectData", d); console.log("MemberExpression propertyData", g); if ("call" == g.name && 0 == g.userCode) { return a; } if ("__pythonRuntime.ops.subscriptIndex" == g.callee) { e = Entry.playground.object; - if (c.object && "self" == c.object.name) { - if (f = c.property.name, !Entry.TextCodingUtil.prototype.isLocalListExisted(f, e)) { + if (d.object && "self" == d.object.name) { + if (f = d.property.name, !Entry.TextCodingUtil.prototype.isLocalListExisted(f, e)) { return a; } } else { - if (f = c.name, !Entry.TextCodingUtil.prototype.isGlobalListExisted(f)) { + if (f = d.name, !Entry.TextCodingUtil.prototype.isGlobalListExisted(f)) { return a; } } - c = e = this.getBlockType("%2[%4]"); + d = e = this.getBlockType("%2[%4]"); var arguments = g.arguments, e = Entry.block[e], h = e.params, k = e.def.params, f = this.ParamDropdownDynamic(f, h[1], k[1]); console.log("MemberExpression listName", f); g = []; @@ -17231,11 +17303,11 @@ Entry.PyToBlockParser = function(a) { "number" == arguments[0].type ? arguments[0].params[0] += 1 : "text" == arguments[0].type && (arguments[0].params[0] = String(Number(arguments[0].params[0]) + 1)); g.push(arguments[0]); g.push(""); - a.type = c; + a.type = d; a.params = g; } else { if (g = [], "self" == e.name) { - c = e = this.getBlockType("%1"); + d = e = this.getBlockType("%1"); e = Entry.block[e]; h = e.params; k = e.def.params; @@ -17246,7 +17318,7 @@ Entry.PyToBlockParser = function(a) { } f = this.ParamDropdownDynamic(f, h[0], k[0]); g.push(f); - a.type = c; + a.type = d; 0 != g.length && (a.params = g); } else { return a; @@ -17259,31 +17331,31 @@ Entry.PyToBlockParser = function(a) { console.log("WhileStatement component", b); var a; a = {statements:[]}; - var c = b.test; - console.log("WhileStatement test", c); - if (!0 === c.value) { + var d = b.test; + console.log("WhileStatement test", d); + if (!0 === d.value) { var e = this.getBlockType("while True:\n$1") } console.log("WhileStatement type", e); var f = Entry.block[e].params; console.log("WhileStatement paramsMeta", f); var g = []; - if ("Literal" == c.type || "Identifier" == c.type) { + if ("Literal" == d.type || "Identifier" == d.type) { arguments = []; - arguments.push(c); + arguments.push(d); f = Entry.block[e].params; - c = Entry.block[e].def.params; + d = Entry.block[e].def.params; console.log("WhileStatement paramsMeta", f); - console.log("WhileStatement paramsDefMeta", c); + console.log("WhileStatement paramsDefMeta", d); for (var h in f) { var k = f[h].type; "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); } for (var l in arguments) { - h = arguments[l], console.log("WhileStatement argument", h), h = this[h.type](h, f[l], c[l], !0), console.log("WhileStatement Literal param", h), h && null != h && g.push(h); + h = arguments[l], console.log("WhileStatement argument", h), h = this[h.type](h, f[l], d[l], !0), console.log("WhileStatement Literal param", h), h && null != h && g.push(h); } } else { - h = this[c.type](c), console.log("WhileStatement Not Literal param", h), h && null != h && g.push(h); + h = this[d.type](d), console.log("WhileStatement Not Literal param", h), h && null != h && g.push(h); } f = b.body; f = this[f.type](f); @@ -17294,7 +17366,7 @@ Entry.PyToBlockParser = function(a) { }; a.BlockStatement = function(b) { console.log("BlockStatement component", b); - var a = {statements:[], data:[]}, c = [], e = [], f = []; + var a = {statements:[], data:[]}, d = [], e = [], f = []; b = b.body; console.log("BlockStatement bodies", b); for (var g in b) { @@ -17311,9 +17383,9 @@ Entry.PyToBlockParser = function(a) { if (f[k].declarations) { b = f[0].declarations; for (k in b) { - h = b[k], (h = h.init) && c.push(h); + h = b[k], (h = h.init) && d.push(h); } - a.params = c; + a.params = d; } } else { if (1 == k) { @@ -17336,9 +17408,9 @@ Entry.PyToBlockParser = function(a) { if (f[k] && f[k].declarations) { b = f[k].declarations; for (k in b) { - h = b[k], (h = h.init) && c.push(h); + h = b[k], (h = h.init) && d.push(h); } - a.params = c; + a.params = d; } else { (h = f[k]) && h.type && e.push(h); } @@ -17362,25 +17434,25 @@ Entry.PyToBlockParser = function(a) { console.log("IfStatement component", b); var a; a = {statements:[]}; - var c, e = [], f = b.consequent, g = b.alternate; - c = null != g ? "if_else" : "_if"; - a.type = c; - console.log("IfStatement type", c); + var d, e = [], f = b.consequent, g = b.alternate; + d = null != g ? "if_else" : "_if"; + a.type = d; + console.log("IfStatement type", d); var h = b.test; console.log("IfStatement test", h); if ("Literal" == h.type || "Identifier" == h.type) { arguments = []; arguments.push(h); - h = Entry.block[c].params; - c = Entry.block[c].def.params; + h = Entry.block[d].params; + d = Entry.block[d].def.params; console.log("IfStatement paramsMeta", h); - console.log("IfStatement paramsDefMeta", c); + console.log("IfStatement paramsDefMeta", d); for (var k in h) { var l = h[k].type; "Indicator" == l ? (l = {raw:null, type:"Literal", value:null}, k < arguments.length && arguments.splice(k, 0, l)) : "Text" == l && (l = {raw:"", type:"Literal", value:""}, k < arguments.length && arguments.splice(k, 0, l)); } for (var m in arguments) { - k = arguments[m], console.log("IfStatement argument", k), k = this[k.type](k, h[m], c[m], !0), console.log("IfStatement Literal param", k), k && null != k && e.push(k); + k = arguments[m], console.log("IfStatement argument", k), k = this[k.type](k, h[m], d[m], !0), console.log("IfStatement Literal param", k), k && null != k && e.push(k); } } else { k = this[h.type](h), console.log("IfStatement Not Literal param", k), k && null != k && e.push(k); @@ -17415,18 +17487,18 @@ Entry.PyToBlockParser = function(a) { }; a.ForStatement = function(b) { console.log("ForStatement component", b); - var a = {statements:[]}, c = this.getBlockType("for i in range"); - a.type = c; - if (c = b.init) { - var e = this[c.type](c) + var a = {statements:[]}, d = this.getBlockType("for i in range"); + a.type = d; + if (d = b.init) { + var e = this[d.type](d) } a.init = e; - console.log("ForStatement init", c); + console.log("ForStatement init", d); e = b.body.body; console.log("ForStatement bodies", e); if (e) { for (var f in e) { - 0 != f && (c = e[f], console.log("ForStatement bodyData", c, "index", f), c = this[c.type](c), console.log("ForStatement bodyData result", c, "index", f), a.statements.push(c)); + 0 != f && (d = e[f], console.log("ForStatement bodyData", d, "index", f), d = this[d.type](d), console.log("ForStatement bodyData result", d, "index", f), a.statements.push(d)); } } console.log("ForStatement bodyData result", a); @@ -17469,8 +17541,8 @@ Entry.PyToBlockParser = function(a) { console.log("LogicalExpression component", b); var a; a = {}; - var c = String(b.operator); - switch(c) { + var d = String(b.operator); + switch(d) { case "&&": var e = "(%1 and %3)"; break; @@ -17480,47 +17552,47 @@ Entry.PyToBlockParser = function(a) { default: e = "(%1 and %3)"; } - var e = this.getBlockType(e), f = [], c = b.left; - if ("Literal" == c.type || "Identifier" == c.type) { + var e = this.getBlockType(e), f = [], d = b.left; + if ("Literal" == d.type || "Identifier" == d.type) { arguments = []; - arguments.push(c); - var c = Entry.block[e].params, g = Entry.block[e].def.params; - console.log("LogicalExpression paramsMeta", c); + arguments.push(d); + var d = Entry.block[e].params, g = Entry.block[e].def.params; + console.log("LogicalExpression paramsMeta", d); console.log("LogicalExpression paramsDefMeta", g); - for (var h in c) { - var k = c[h].type; + for (var h in d) { + var k = d[h].type; "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); } for (var l in arguments) { var m = arguments[l]; console.log("LogicalExpression argument", m); - m = this[m.type](m, c[l], g[l], !0); + m = this[m.type](m, d[l], g[l], !0); console.log("LogicalExpression param", m); m && null != m && f.push(m); } } else { - (m = this[c.type](c)) && f.push(m); + (m = this[d.type](d)) && f.push(m); } console.log("LogicalExpression left param", m); - c = String(b.operator); - console.log("LogicalExpression operator", c); - c && (m = c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), f.push(m)); - c = b.right; - if ("Literal" == c.type || "Identifier" == c.type) { + d = String(b.operator); + console.log("LogicalExpression operator", d); + d && (m = d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), f.push(m)); + d = b.right; + if ("Literal" == d.type || "Identifier" == d.type) { arguments = []; - arguments.push(c); - c = Entry.block[e].params; + arguments.push(d); + d = Entry.block[e].params; g = Entry.block[e].def.params; - console.log("LogicalExpression paramsMeta", c); + console.log("LogicalExpression paramsMeta", d); console.log("LogicalExpression paramsDefMeta", g); - for (h in c) { - k = c[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); + for (h in d) { + k = d[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); } for (l in arguments) { - m = arguments[l], console.log("LogicalExpression argument", m), m = this[m.type](m, c[l], g[l], !0), console.log("LogicalExpression param", m), m && null != m && f.push(m); + m = arguments[l], console.log("LogicalExpression argument", m), m = this[m.type](m, d[l], g[l], !0), console.log("LogicalExpression param", m), m && null != m && f.push(m); } } else { - (m = this[c.type](c)) && f.push(m); + (m = this[d.type](d)) && f.push(m); } console.log("LogicalExpression right param", m); a.type = e; @@ -17530,7 +17602,7 @@ Entry.PyToBlockParser = function(a) { }; a.BinaryExpression = function(b) { console.log("BinaryExpression component", b); - var a = {}, c = {}, e = String(b.operator); + var a = {}, d = {}, e = String(b.operator); switch(e) { case "==": var f = "(%1 %2boolean_compare# %3)"; @@ -17591,10 +17663,10 @@ Entry.PyToBlockParser = function(a) { } console.log("BinaryExpression left params", a); if ("boolean_not" == f) { - return a.splice(0, 0, ""), a.splice(2, 0, ""), console.log("BinaryExpression boolean_not params", a), c.type = f, c.params = a, c; + return a.splice(0, 0, ""), a.splice(2, 0, ""), console.log("BinaryExpression boolean_not params", a), d.type = f, d.params = a, d; } if (e = String(b.operator)) { - console.log("BinaryExpression operator", e), (m = e = Entry.TextCodingUtil.prototype.binaryOperatorConvert(e)) && a.push(m), c.operator = e; + console.log("BinaryExpression operator", e), (m = e = Entry.TextCodingUtil.prototype.binaryOperatorConvert(e)) && a.push(m), d.operator = e; } e = b.right; if ("Literal" == e.type || "Identifier" == e.type) { @@ -17614,21 +17686,21 @@ Entry.PyToBlockParser = function(a) { (m = this[e.type](e)) && a.push(m); } console.log("BinaryExpression right param", m); - c.type = f; - c.params = a; + d.type = f; + d.params = a; } else { return a; } console.log("BinaryExpression params", a); - a = c; + a = d; console.log("BinaryExpression result", a); return a; }; a.UpdateExpression = function(b) { console.log("UpdateExpression", b); - var a = {}, c = b.argument; - if (c) { - var e = this[c.type](c) + var a = {}, d = b.argument; + if (d) { + var e = this[d.type](d) } a.argument = e; a.operator = b.operator; @@ -17638,7 +17710,7 @@ Entry.PyToBlockParser = function(a) { }; a.AssignmentExpression = function(b) { console.log("AssignmentExpression component", b); - var a = {}, c, e = [], f, g = b.left; + var a = {}, d, e = [], f, g = b.left; if (g.type) { var h = this[g.type](g); console.log("AssignmentExpression leftData", h); @@ -17660,22 +17732,22 @@ Entry.PyToBlockParser = function(a) { } if ("__pythonRuntime.objects.list" == l && "self" == h.object.name) { var m = h.property.name; - c = []; + d = []; var arguments = k.arguments, n; for (n in arguments) { var q = {}; q.data = String(arguments[n].params[0]); - c.push(q); + d.push(q); } q = Entry.playground.object; - Entry.TextCodingUtil.prototype.isLocalListExisted(m, q) ? Entry.TextCodingUtil.prototype.updateLocalList(m, c, q) : Entry.TextCodingUtil.prototype.createLocalList(m, c, q); + Entry.TextCodingUtil.prototype.isLocalListExisted(m, q) ? Entry.TextCodingUtil.prototype.updateLocalList(m, d, q) : Entry.TextCodingUtil.prototype.createLocalList(m, d, q); } if (h.property && "__pythonRuntime.ops.subscriptIndex" == h.property.callee) { var m = "%1[%2] = %3", r = this.getBlockType(m) } else { - g.arguments && g.arguments[0] ? (c = b.left.name ? b.left.name : b.left.object.name.concat(b.left.property.name), m = b.right.arguments[0].name ? b.right.arguments[0].name : b.right.arguments[0].object.name.concat(b.right.arguments[0].property.name), console.log("AssignmentExpression leftEx", c, "rightEx", m), m = b.right.arguments && c == m ? "%1 += %2" : "%1 = %2") : m = "%1 = %2", r = this.getBlockType(m); + g.arguments && g.arguments[0] ? (d = b.left.name ? b.left.name : b.left.object.name.concat(b.left.property.name), m = b.right.arguments[0].name ? b.right.arguments[0].name : b.right.arguments[0].object.name.concat(b.right.arguments[0].property.name), console.log("AssignmentExpression leftEx", d, "rightEx", m), m = b.right.arguments && d == m ? "%1 += %2" : "%1 = %2") : m = "%1 = %2", r = this.getBlockType(m); } - c = r; + d = r; } if (operator) { var t = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator) @@ -17719,37 +17791,37 @@ Entry.PyToBlockParser = function(a) { } } } - a.type = c; + a.type = d; a.params = e; console.log("AssignmentExpression result", a); return a; }; a.FunctionDeclaration = function(b) { console.log("FunctionDeclaration component", b); - var a = {}, c = b.body; + var a = {}, d = b.body; b = b.id; if ("__getParam0" == b.name) { return a; } - var e = this[c.type](c); + var e = this[d.type](d); console.log("FunctionDeclaration bodyData", e); if ("Identifier" == b.type) { var f = this[b.type](b) } console.log("FunctionDeclaration idData", f); - c = []; + d = []; b = []; var f = f.name, e = e.data, g; for (g in e) { if (e[g].declarations) { var h = e[g].declarations; - 0 < h.length && c.push(h[0].name); + 0 < h.length && d.push(h[0].name); } else { e[g].argument && (h = e[g].argument.statements) && 0 < h.length && (b = h); } } console.log("FunctionDeclaration textFuncName", f); - console.log("FunctionDeclaration textFuncParams", c); + console.log("FunctionDeclaration textFuncParams", d); console.log("FunctionDeclaration textFuncStatements", b); var k, l, m, e = Entry.variableContainer.functions_, n; for (n in e) { @@ -17774,7 +17846,7 @@ Entry.PyToBlockParser = function(a) { console.log("first blockFuncName", blockFuncName); console.log("first textFuncName", f); if (f == blockFuncName) { - if (console.log("textFuncName", f), console.log("blockFuncName", blockFuncName), console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), c.length == Object.keys(h).length ? (k = !0, console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), l = q.content._data[0]._data, g = l.slice(), g.shift(), console.log("blockFuncContents", l), l = Entry.TextCodingUtil.prototype.isFuncContentsMatch(g, + if (console.log("textFuncName", f), console.log("blockFuncName", blockFuncName), console.log("textFuncParams.length", d.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), d.length == Object.keys(h).length ? (k = !0, console.log("textFuncParams.length", d.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), l = q.content._data[0]._data, g = l.slice(), g.shift(), console.log("blockFuncContents", l), l = Entry.TextCodingUtil.prototype.isFuncContentsMatch(g, b, h)) : l = k = !1, k && l) { m = "func".concat("_").concat(n); break; @@ -17790,7 +17862,7 @@ Entry.PyToBlockParser = function(a) { console.log("FunctionDeclaration matchFlag", l); if (k && l) { console.log("targetFuncId", m); - var u = c.length; + var u = d.length; this._funcMap.put(f + u, m); console.log("FunctionDeclaration this._funcMap", this._funcMap); a = m; @@ -17808,7 +17880,7 @@ Entry.PyToBlockParser = function(a) { Entry.variableContainer.updateList(); a = m; console.log("textFuncName", f); - u = c.length; + u = d.length; u = f + u; n = m; m = "func".concat("_").concat(n); @@ -17816,13 +17888,13 @@ Entry.PyToBlockParser = function(a) { console.log("FunctionDeclaration result", a); } else { console.log("FunctionDeclaration textFuncName", f); - console.log("FunctionDeclaration textFuncParams", c); + console.log("FunctionDeclaration textFuncParams", d); console.log("FunctionDeclaration textFuncStatements", b); k = new Entry.Func; k.generateBlock(!0); console.log("FunctionDeclaration newFunc", k); m = []; - for (g = 1;g <= c.length + 1;g++) { + for (g = 1;g <= d.length + 1;g++) { m.push("%" + g); } k.block.template = f + " " + m.join(" "); @@ -17840,8 +17912,8 @@ Entry.PyToBlockParser = function(a) { } else { m[0] = f, k.description = f + " "; } - if (0 < c.length) { - for (e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = e, k.paramMap[h] = Number(0), console.log("FunctionDeclaration paramBlock", k), t = 1;t < c.length;t++) { + if (0 < d.length) { + for (e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = e, k.paramMap[h] = Number(0), console.log("FunctionDeclaration paramBlock", k), t = 1;t < d.length;t++) { e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.searchFuncDefParam(m[1]), console.log("FunctionDeclaration paramBlock", l), 0 == l.data.params.length ? l.data.params[0] = g : 1 == l.data.params.length && (l.data.params[1] = e), k.paramMap[h] = Number(t), console.log("FunctionDeclaration paramBlock", k); } @@ -17854,7 +17926,7 @@ Entry.PyToBlockParser = function(a) { Entry.Func.generateWsBlock(k); Entry.variableContainer.saveFunction(k); Entry.variableContainer.updateList(); - u = c.length; + u = d.length; u = f + u; n = k.id; m = "func".concat("_").concat(n); @@ -17878,9 +17950,9 @@ Entry.PyToBlockParser = function(a) { console.log("ReturnStatement component", b); var a = {}; if (b = b.argument) { - var c = this[b.type](b) + var d = this[b.type](b) } - c && (a.argument = c); + d && (a.argument = d); console.log("ReturnStaement result", a); return a; }; @@ -17895,14 +17967,14 @@ Entry.PyToBlockParser = function(a) { }; a.NewExpression = function(b) { console.log("NewExpression component", b); - var a = {}, c = b.callee, c = this[c.type](c), arguments = b.arguments, e = [], f; + var a = {}, d = b.callee, d = this[d.type](d), arguments = b.arguments, e = [], f; for (f in arguments) { var g = arguments[f]; console.log("NewExpression argument", g); g = this[g.type](g); e.push(g); } - a.callee = c; + a.callee = d; a.arguments = e; console.log("NewExpression result", a); return a; @@ -18053,11 +18125,11 @@ Entry.Console = function() { this._isEditing !== b && (this._isEditing = b); }; })(Entry.Console.prototype); -Entry.Parser = function(a, b, d, c) { +Entry.Parser = function(a, b, c, d) { this._mode = a; this.syntax = {}; - this.codeMirror = d; - this._lang = c || "js"; + this.codeMirror = c; + this._lang = d || "js"; this._type = b; this.availableCode = []; Entry.Parser.PARSE_GENERAL = 0; @@ -18073,32 +18145,32 @@ Entry.Parser = function(a, b, d, c) { break; case "py": this._parser = new Entry.PyToBlockParser(this.syntax); - c = this.syntax; + d = this.syntax; var e = {}, f; - for (f in c.Scope) { - e[f + "();\n"] = c.Scope[f]; + for (f in d.Scope) { + e[f + "();\n"] = d.Scope[f]; } - "BasicIf" in c && (e.front = "BasicIf"); + "BasicIf" in d && (e.front = "BasicIf"); CodeMirror.commands.javascriptComplete = function(b) { CodeMirror.showHint(b, null, {globalScope:e}); }; - d.on("keyup", function(b, a) { + c.on("keyup", function(b, a) { (65 <= a.keyCode && 95 >= a.keyCode || 167 == a.keyCode || 190 == a.keyCode) && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:e}); }); break; case "blockJs": this._parser = new Entry.BlockToJsParser(this.syntax); - c = this.syntax; + d = this.syntax; break; case "blockPy": - this._parser = new Entry.BlockToPyParser(this.syntax), c = this.syntax; + this._parser = new Entry.BlockToPyParser(this.syntax), d = this.syntax; } }; (function(a) { - a.setParser = function(b, a, c) { + a.setParser = function(b, a, d) { this._mode = b; this._type = a; - this._cm = c; + this._cm = d; this.syntax = this.mappingSyntax(b); switch(a) { case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK: @@ -18112,18 +18184,18 @@ Entry.Parser = function(a, b, d, c) { case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS: this._parser = new Entry.BlockToJsParser(this.syntax); b = this.syntax; - var e = {}, f; + var c = {}, f; for (f in b.Scope) { - e[f + "();\n"] = b.Scope[f]; + c[f + "();\n"] = b.Scope[f]; } - c.on("keydown", function(b, a) { + d.on("keydown", function(b, a) { var d = a.keyCode; - (65 <= d && 95 >= d || 167 == d || !a.shiftKey && 190 == d) && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:e}); + (65 <= d && 95 >= d || 167 == d || !a.shiftKey && 190 == d) && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:c}); }); this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK; break; case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY: - this._parser = new Entry.BlockToPyParser(this.syntax), c.setOption("mode", {name:"python", globalVars:!0}), c.markText({line:0, ch:0}, {line:5}, {readOnly:!0}), this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; + this._parser = new Entry.BlockToPyParser(this.syntax), d.setOption("mode", {name:"python", globalVars:!0}), d.markText({line:0, ch:0}, {line:5}, {readOnly:!0}), this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; } }; a.parse = function(b, a) { @@ -18199,11 +18271,11 @@ Entry.Parser = function(a, b, d, c) { return e; }; a.mappingSyntax = function(b) { - for (var a = Object.keys(Entry.block), c = {}, e = 0;e < a.length;e++) { + for (var a = Object.keys(Entry.block), d = {}, e = 0;e < a.length;e++) { var f = a[e], g = Entry.block[f]; if (b === Entry.Vim.MAZE_MODE) { if (-1 < this.availableCode.indexOf(f) && (g = g.syntax)) { - for (var h = c, k = 0;k < g.length;k++) { + for (var h = d, k = 0;k < g.length;k++) { var l = g[k]; if (!(-1 < l.indexOf("%"))) { var m = l.indexOf("("); @@ -18220,12 +18292,12 @@ Entry.Parser = function(a, b, d, c) { } else { if (b === Entry.Vim.WORKSPACE_MODE) { for (l in f = Entry.block, f) { - g = f[l], h = null, g.syntax && g.syntax.py && (h = g.syntax.py), h && (h = String(h), g = h.split("("), 0 != g[0].length && (h = g[0]), c[h] = l); + g = f[l], h = null, g.syntax && g.syntax.py && (h = g.syntax.py), h && (h = String(h), g = h.split("("), 0 != g[0].length && (h = g[0]), d[h] = l); } } } } - return c; + return d; }; a.setAvailableCode = function(b, a) { var c = [], e; @@ -18245,11 +18317,11 @@ Entry.Parser = function(a, b, d, c) { this.availableCode = this.availableCode.concat(c); }; a.findErrorInfo = function(b) { - var a = 0, c = 0, e = this.codeMirror.getValue().split("\n"), f; + var a = 0, d = 0, e = this.codeMirror.getValue().split("\n"), f; for (f in e) { var g = e[f].trim(); a++; - if (!(0 == g.length || 1 == g.length || -1 < g.indexOf("else")) && (c++, c == b.blockCount)) { + if (!(0 == g.length || 1 == g.length || -1 < g.indexOf("else")) && (d++, d == b.blockCount)) { break; } } @@ -18263,15 +18335,15 @@ Entry.PyBlockAssembler = function(a) { }; (function(a) { a.Program = function(b) { - var a = [], c; - for (c in b) { - if ("Program" != b[c].type) { + var a = [], d; + for (d in b) { + if ("Program" != b[d].type) { return; } - var e = [], f = b[c].body; + var e = [], f = b[d].body; console.log("nodes", f); - for (c in f) { - var g = f[c], g = this[g.type](g); + for (d in f) { + var g = f[d], g = this[g.type](g); console.log("checkitout", g); g = this._assembler[g.type](g); e.push(g); @@ -18291,14 +18363,14 @@ Entry.PyBlockAssembler = function(a) { }; a.AssignmentExpression = function(b) { console.log("AssignmentExpression component", b); - var a = [], c; - c = b.left; - c.type ? ("Literal" == c.type ? (c = this[c.type](paramsMeta[0], c), console.log("AssignmentExpression left Literal param", c)) : c = this[c.type](c), c && a.push(c), console.log("AssignmentExpression left param", c)) : (c = b.left, this[c.type](c)); + var a = [], d; + d = b.left; + d.type ? ("Literal" == d.type ? (d = this[d.type](paramsMeta[0], d), console.log("AssignmentExpression left Literal param", d)) : d = this[d.type](d), d && a.push(d), console.log("AssignmentExpression left param", d)) : (d = b.left, this[d.type](d)); operator = String(b.operator); console.log("AssignmentExpression operator", operator); - operator && (c = operator = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator), a.push(c)); - c = b.right; - c.type ? ("Literal" == c.type ? (c = this[c.type](paramsMeta[2], c), console.log("AssignmentExpression right Literal param", c)) : c = this[c.type](c), c && a.push(c), console.log("AssignmentExpression right param", c)) : (c = b.right, this[c.type](c)); + operator && (d = operator = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator), a.push(d)); + d = b.right; + d.type ? ("Literal" == d.type ? (d = this[d.type](paramsMeta[2], d), console.log("AssignmentExpression right Literal param", d)) : d = this[d.type](d), d && a.push(d), console.log("AssignmentExpression right param", d)) : (d = b.right, this[d.type](d)); console.log("AssignmentExpression params", a); console.log("AssignmentExpression result", result); return result; @@ -18307,15 +18379,15 @@ Entry.PyBlockAssembler = function(a) { console.log("CallExpression component", b); var a; a = {}; - var c = b.callee, c = this[c.type](c); - console.log("CallExpression calleeData", c, "calleeData typeof", typeof c); - var e = "object" != typeof c.object ? String(c.object).concat(".").concat(String(c.property)) : String(c.object.object).concat(".").concat(String(c.object.property)).concat(".").concat(String(c.property)); + var d = b.callee, d = this[d.type](d); + console.log("CallExpression calleeData", d, "calleeData typeof", typeof d); + var e = "object" != typeof d.object ? String(d.object).concat(".").concat(String(d.property)) : String(d.object.object).concat(".").concat(String(d.object.property)).concat(".").concat(String(d.property)); console.log("CallExpression syntax", e); - c = this.getBlockType(e); - console.log("CallExpression type1", c); - c || "__pythonRuntime.functions.range" == e && (c = "repeat_basic"); - console.log("CallExpression type2", c); - e = Entry.block[c].params; + d = this.getBlockType(e); + console.log("CallExpression type1", d); + d || "__pythonRuntime.functions.range" == e && (d = "repeat_basic"); + console.log("CallExpression type2", d); + e = Entry.block[d].params; console.log("CallExpression paramsMeta", e); var arguments = b.arguments, f = [], g; for (g in arguments) { @@ -18323,21 +18395,21 @@ Entry.PyBlockAssembler = function(a) { console.log("CallExpression argument", h); if ("Literal" == h.type) { var k = e[g]; - "Indicator" == k.type ? (h = null, f.push(h), g--) : (console.log("CallExpression argument index", h.type, g), h = this[h.type](k, h, c, g), f.push(h)); + "Indicator" == k.type ? (h = null, f.push(h), g--) : (console.log("CallExpression argument index", h.type, g), h = this[h.type](k, h, d, g), f.push(h)); g == arguments.length - 1 && (console.log("CallExpression in1"), g < e.length && (console.log("CallExpression in2"), f.push(null))); console.log("CallExpression i", g); } } console.log("CallExpression params", f); - a.type = c; + a.type = d; a.params = f; console.log("CallExpression result", a); return a; }; - a.Literal = function(b, a, c, e) { - console.log("Literal paramMeta component particularIndex blockType", b, a, c, e); + a.Literal = function(b, a, d, e) { + console.log("Literal paramMeta component particularIndex blockType", b, a, d, e); a = a.value; - b = c ? this["Param" + b.type](b, a, c, e) : this["Param" + b.type](b, a); + b = d ? this["Param" + b.type](b, a, d, e) : this["Param" + b.type](b, a); console.log("Literal result", b); return b; }; @@ -18374,72 +18446,72 @@ Entry.PyBlockAssembler = function(a) { console.log("ParamKeyboard result", b); return b; }; - a.ParamBlock = function(b, a, c, e) { - console.log("ParamBlock paramMeta value blockType", b, a, c, e); - var f = {}, g = []; - c = Entry.TextCodingUtil.prototype.particularParam(c); - if (null != c) { - var h = c[e]; + a.ParamBlock = function(b, a, d, e) { + console.log("ParamBlock paramMeta value blockType", b, a, d, e); + var c = {}, g = []; + d = Entry.TextCodingUtil.prototype.particularParam(d); + if (null != d) { + var h = d[e]; if (h) { - h = c[e]; + h = d[e]; console.log("ParamBlock particularType", h); e = h; - f.type = e; - c = Entry.block[e].params; + c.type = e; + d = Entry.block[e].params; console.log("ParamBlock particular block paramsMeta", b); var k, l; - for (l in c) { - b = c[l]; + for (l in d) { + b = d[l]; b = b.options; for (var m in b) { h = b[m], a == h[0] && (k = h[1]); } } g.push(k); - f.params = g; + c.params = g; } else { switch(e = typeof a, e) { case "number": - f.type = "number"; + c.type = "number"; g.push(a); - f.params = g; + c.params = g; break; case "boolean": - 1 == a ? f.type = "True" : 0 == a && (f.type = "False"); + 1 == a ? c.type = "True" : 0 == a && (c.type = "False"); break; default: - f.type = "text", g.push(a), f.params = g; + c.type = "text", g.push(a), c.params = g; } } } else { switch(e = typeof a, e) { case "number": - f.type = "number"; + c.type = "number"; g.push(a); - f.params = g; + c.params = g; break; case "boolean": - 1 == a ? f.type = "True" : 0 == a && (f.type = "False"); + 1 == a ? c.type = "True" : 0 == a && (c.type = "False"); break; default: - f.type = "text", g.push(a), f.params = g; + c.type = "text", g.push(a), c.params = g; } } console.log("ParamBlock valueType", e); - console.log("ParamBlock result", f); - return f; + console.log("ParamBlock result", c); + return c; }; - a.Indicator = function(b, a, c) { + a.Indicator = function(b, a, d) { }; a.MemberExpression = function(b) { console.log("MemberExpression component", b); - var a = {}, c = b.object; + var a = {}, d = b.object; b = b.property; - c = this[c.type](c); + d = this[d.type](d); b = this[b.type](b); - console.log("MemberExpression objectData", c); + console.log("MemberExpression objectData", d); console.log("MemberExpression structure", b); - a.object = c; + a.object = d; a.property = b; console.log("MemberExpression result", a); return a; @@ -18452,22 +18524,22 @@ Entry.PyBlockAssembler = function(a) { }; a.WhileStatement = function(b) { console.log("WhileStatement component", b); - var a = {}, c = b.test, e; - 1 == c.value && (e = this.getBlockType("while True:\n$1")); + var a = {}, d = b.test, e; + 1 == d.value && (e = this.getBlockType("while True:\n$1")); console.log("WhileStatement type", e); var f = Entry.block[e].params; console.log("WhileStatement paramsMeta", f); var g = []; - c && (c.type = "Literal", f = f[0], c = "Indicator" == f.type ? null : this[c.type](f, c), g.push(c)); - c = []; + d && (d.type = "Literal", f = f[0], d = "Indicator" == f.type ? null : this[d.type](f, d), g.push(d)); + d = []; b = b.body.body; for (var h in b) { - f = b[h], f = this[f.type](f), c.push(f); + f = b[h], f = this[f.type](f), d.push(f); } a.type = e; a.params = g; a.statements = []; - a.statements.push(c); + a.statements.push(d); console.log("WhileStatement result", a); return a; }; @@ -18477,13 +18549,13 @@ Entry.PyBlockAssembler = function(a) { this._blockStatments = []; var a = {}; b = b.body; - for (var c in b) { - var e = b[c]; - console.log("BlockStatement body", e, "i", c); + for (var d in b) { + var e = b[d]; + console.log("BlockStatement body", e, "i", d); e = this[e.type](e); - console.log("BlockStatement bodyData", e, "i", c); + console.log("BlockStatement bodyData", e, "i", d); if (e.declarations) { - console.log("BlockStatement statements type params bodyData", c, e); + console.log("BlockStatement statements type params bodyData", d, e); var e = e.declarations, f; for (f in e) { var g = e[f]; @@ -18502,16 +18574,16 @@ Entry.PyBlockAssembler = function(a) { }; a.IfStatement = function(b) { console.log("IfStatement component", b); - var a = {}, c = [], e = [], f = [], g = [], h = b.test, k = b.alternate, l = b.consequent; + var a = {}, d = [], e = [], f = [], g = [], h = b.test, k = b.alternate, l = b.consequent; b = this.getBlockType(null == k ? "if %1:\n$1" : "if %1:\n$1\nelse:\n$2"); if (null != h) { var m = Entry.block[b].params; console.log("IfStatement paramsMeta", m); - c = []; + d = []; h.type = "Literal"; m = m[0]; h = "Indicator" == m.type ? null : this[h.type](m, h); - c.push(h); + d.push(h); } if (null != l) { for (var n in l.body) { @@ -18530,32 +18602,32 @@ Entry.PyBlockAssembler = function(a) { 0 != e.length && g.push(e); 0 != f.length && g.push(f); a.type = b; - 0 != c.length && (a.params = c); + 0 != d.length && (a.params = d); 0 != g.length && (a.statements = g); console.log("IfStatement result", a); return a; }; a.VariableDeclaration = function(b) { console.log("VariableDeclaration component", b); - var a = {}, c = []; + var a = {}, d = []; b = b.declarations; for (var e in b) { var f = b[e], f = this[f.type](f); console.log("VariableDeclaration declarationData", f); - c.push(f); + d.push(f); } - a.declarations = c; + a.declarations = d; console.log("VariableDeclaration result", a); return a; }; a.VariableDeclarator = function(b) { console.log("VariableDeclarator component", b); - var a = {}, c = b.id, e = this[c.type](c); + var a = {}, d = b.id, e = this[d.type](d); console.log("VariableDeclarator idData", e); b = b.init; b = this[b.type](b); console.log("VariableDeclarator initData", b); - a.id = c; + a.id = d; a.init = b; console.log("VariableDeclarator result", a); return a; @@ -18578,8 +18650,8 @@ Entry.PyBlockAssembler = function(a) { }; a.LogicalExpression = function(b) { console.log("LogicalExpression component", b); - var a = {}, c = String(b.operator); - switch(c) { + var a = {}, d = String(b.operator); + switch(d) { case "&&": var e = "%1 and %3"; break; @@ -18591,13 +18663,13 @@ Entry.PyBlockAssembler = function(a) { } var e = this.getBlockType(e), f = Entry.block[e].params; console.log("LogicalExpression paramsMeta", f); - var g = [], c = b.left; - c.type ? ("Literal" == c.type ? (c = this[c.type](f[0], c), console.log("LogicalExpression left Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("LogicalExpression left param", c)) : (c = b.left, this[c.type](c)); - c = String(b.operator); - console.log("LogicalExpression operator", c); - c && (c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), g.push(c)); - c = b.right; - c.type ? ("Literal" == c.type ? (c = this[c.type](f[2], c), console.log("LogicalExpression right Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("LogicalExpression right param", c)) : (c = b.right, this[c.type](c)); + var g = [], d = b.left; + d.type ? ("Literal" == d.type ? (d = this[d.type](f[0], d), console.log("LogicalExpression left Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("LogicalExpression left param", d)) : (d = b.left, this[d.type](d)); + d = String(b.operator); + console.log("LogicalExpression operator", d); + d && (d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), g.push(d)); + d = b.right; + d.type ? ("Literal" == d.type ? (d = this[d.type](f[2], d), console.log("LogicalExpression right Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("LogicalExpression right param", d)) : (d = b.right, this[d.type](d)); a.type = e; a.params = g; console.log("LogicalExpression result", a); @@ -18605,9 +18677,9 @@ Entry.PyBlockAssembler = function(a) { }; a.BinaryExpression = function(b) { console.log("BinaryExpression component", b); - var a = {params:[]}, c = String(b.operator); - console.log("BinaryExpression operator", c); - if (c) { + var a = {params:[]}, d = String(b.operator); + console.log("BinaryExpression operator", d); + if (d) { var e = "(%1 %2 %3)" } console.log("BinaryExpression syntax", e); @@ -18615,13 +18687,13 @@ Entry.PyBlockAssembler = function(a) { console.log("BinaryExpression type", e); var f = Entry.block[e].params; console.log("BinaryExpression paramsMeta", f); - var g = [], c = b.left; - c.type ? ("Literal" == c.type ? (c = this[c.type](f[0], c), console.log("BinaryExpression left Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("BinaryExpression left param", c)) : (c = b.left, this[c.type](c)); - if (c = String(b.operator)) { - console.log("BinaryExpression operator", c), (c = Entry.TextCodingUtil.prototype.binaryOperatorConvert(c)) && g.push(c); + var g = [], d = b.left; + d.type ? ("Literal" == d.type ? (d = this[d.type](f[0], d), console.log("BinaryExpression left Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("BinaryExpression left param", d)) : (d = b.left, this[d.type](d)); + if (d = String(b.operator)) { + console.log("BinaryExpression operator", d), (d = Entry.TextCodingUtil.prototype.binaryOperatorConvert(d)) && g.push(d); } - c = b.right; - c.type ? ("Literal" == c.type ? (c = this[c.type](f[2], c), console.log("BinaryExpression right Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("BinaryExpression right param", c)) : (c = b.right, this[c.type](c)); + d = b.right; + d.type ? ("Literal" == d.type ? (d = this[d.type](f[2], d), console.log("BinaryExpression right Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("BinaryExpression right param", d)) : (d = b.right, this[d.type](d)); console.log("BinaryExpression params", g); a.type = e; a.params = g; @@ -18772,15 +18844,15 @@ Entry.PyToBlockParserTemp = function(a) { }; (function(a) { a.Program = function(b) { - var a = [], c; - for (c in b) { - if ("Program" != b[c].type) { + var a = [], d; + for (d in b) { + if ("Program" != b[d].type) { return; } - var e = [], f = b[c].body; + var e = [], f = b[d].body; console.log("nodes", f); - for (c in f) { - var g = f[c], g = this[g.type](g); + for (d in f) { + var g = f[d], g = this[g.type](g); console.log("checkitout", g); g = this._assembler[g.type](g); e.push(g); @@ -18813,12 +18885,12 @@ Entry.PyToBlockParserTemp = function(a) { }; a.Function = function(b) { console.log("Function", b); - var a = this[b.id](b), c = [], e; + var a = this[b.id](b), d = [], e; for (e in b.params) { - c.push(b.params[e]); + d.push(b.params[e]); } b = this[b.body](b); - return {id:a, params:c, body:b}; + return {id:a, params:d, body:b}; }; a.ExpressionStatement = function(b) { var a = this[b.expression.type](b.expression); @@ -18826,9 +18898,9 @@ Entry.PyToBlockParserTemp = function(a) { }; a.BlockStatement = function(b) { console.log("BlockStatement", b); - var a = [], c; - for (c in b.body) { - var e = b.body[c]; + var a = [], d; + for (d in b.body) { + var e = b.body[d]; console.log("BlockStatement statement", e); e = this[e.type](e); console.log("BlockStatement body", e); @@ -18847,8 +18919,8 @@ Entry.PyToBlockParserTemp = function(a) { }; a.WithStatement = function(b) { console.log("WithStatement", b); - var a = this[b.object.type](b.object), c = this[b.body.type](b.body); - return {type:b.type, object:a, body:c}; + var a = this[b.object.type](b.object), d = this[b.body.type](b.body); + return {type:b.type, object:a, body:d}; }; a.ReturnStaement = function(b) { console.log("ReturnStaement", b); @@ -18858,8 +18930,8 @@ Entry.PyToBlockParserTemp = function(a) { }; a.LabeledStatement = function(b) { console.log("LabeledStatement", b); - var a = this[b.label.type](b.label), c = this[b.body.type](b.body); - return {type:b.type, label:a, body:c}; + var a = this[b.label.type](b.label), d = this[b.body.type](b.body); + return {type:b.type, label:a, body:d}; }; a.BreakStatement = function(b) { console.log("BreakStatement", b); @@ -18877,37 +18949,37 @@ Entry.PyToBlockParserTemp = function(a) { }; a.IfStatement = function(b) { console.log("IfStatement", b); - var a = this[b.test.type](b.test), c = {body:[]}; + var a = this[b.test.type](b.test), d = {body:[]}; if (null === b.alternate) { - c = null; + d = null; } else { for (var e in b.alternate.body) { var f = b.alternate.body[e], g = this[f.type](f); - c.body.push(g); + d.body.push(g); } } g = {body:[]}; for (e in b.consequent.body) { f = b.consequent.body[e], f = this[f.type](f), g.body.push(f); } - console.log("alternate", c); + console.log("alternate", d); console.log("consequent", g); - return {type:b.type, test:a, consequent:g, alternate:c}; + return {type:b.type, test:a, consequent:g, alternate:d}; }; a.SwitchStatement = function(b) { console.log("SwitchStatement", b); - var a = this[b.discriminant.type](b.discriminant), c = [], e; + var a = this[b.discriminant.type](b.discriminant), d = [], e; for (e in b.cases) { var f = b.cases[e], f = this[f.type](f); - c.push(f); + d.push(f); } - return {type:b.type, discriminant:a, cases:c}; + return {type:b.type, discriminant:a, cases:d}; }; a.SwitchCase = function(b) { console.log("SwitchCase", b); var a; a = null === b.test ? null : this[b.test.type](b.test); - for (var c in b.consequent) { + for (var d in b.consequent) { b = this[statment.type](statment), (void 0).push(b); } return {test:a, consequent:void 0}; @@ -18919,11 +18991,11 @@ Entry.PyToBlockParserTemp = function(a) { }; a.TryStatement = function(b) { console.log("TryStatement", b); - var a = this[b.block.type](b.block), c; - c = null === b.handler ? null : this[b.handler.type](b.handler); + var a = this[b.block.type](b.block), d; + d = null === b.handler ? null : this[b.handler.type](b.handler); var e; e = null === b.finalizer ? null : this[b.finalizer.type](b.finalizer); - return {type:b.type, block:a, handler:c, finalizer:e}; + return {type:b.type, block:a, handler:d, finalizer:e}; }; a.CatchClause = function(b) { console.log("CatchClause", b); @@ -18933,21 +19005,21 @@ Entry.PyToBlockParserTemp = function(a) { }; a.WhileStatement = function(b) { console.log("WhileStatement", b); - var a = this[b.test.type](b.test), c = this[b.body.type](b.body); + var a = this[b.test.type](b.test), d = this[b.body.type](b.body); console.log("WhileStatement test", a); - console.log("WhileStatement body", c); - return {type:b.type, test:a, body:c}; + console.log("WhileStatement body", d); + return {type:b.type, test:a, body:d}; }; a.DoWhileStatement = function(b) { console.log("DoWhileStatement", b); var a; a = this[b.init.type](b.init); - var c; - c = null === b.test ? null : this[b.test.type](b.test); + var d; + d = null === b.test ? null : this[b.test.type](b.test); var e; e = null === b.update ? null : this[b.update.type](b.update); var f = this[b.body.type](b.body); - return {type:b.type, init:a, test:c, update:e, body:f}; + return {type:b.type, init:a, test:d, update:e, body:f}; }; a.ForStatement = function(b) { console.log("ForStatement", b); @@ -18957,20 +19029,20 @@ Entry.PyToBlockParserTemp = function(a) { } else { this[b.init.type](b.init); } - var c; - c = null === b.test ? null : this[b.test.type](b.test); + var d; + d = null === b.test ? null : this[b.test.type](b.test); var e; e = null === b.update ? null : this[b.update.type](b.update); var f = this[b.body.type](b.body); console.log("ForStatement body", f); - return {type:b.type, init:a, test:c, update:e, body:f}; + return {type:b.type, init:a, test:d, update:e, body:f}; }; a.ForInStatement = function(b) { console.log("ForInStatement", b); var a; a = this[b.left.type](b.left); - var c = this[b.right.type](b.right), e = this[b.body.type](b.body); - return {type:b.type, left:a, right:c, body:e}; + var d = this[b.right.type](b.right), e = this[b.body.type](b.body); + return {type:b.type, left:a, right:d, body:e}; }; a.FunctionDeclaration = function(b) { console.log("FunctionDeclaration", b); @@ -18978,9 +19050,9 @@ Entry.PyToBlockParserTemp = function(a) { }; a.VariableDeclaration = function(b) { console.log("VariableDeclaration", b); - var a = [], c; - for (c in b.declarations) { - var e = b.declarations[c], e = this[e.type](e); + var a = [], d; + for (d in b.declarations) { + var e = b.declarations[d], e = this[e.type](e); console.log("declaration", e); a.push(e); } @@ -18989,11 +19061,11 @@ Entry.PyToBlockParserTemp = function(a) { }; a.VariableDeclarator = function(b) { console.log("VariableDeclarator", b); - var a = this[b.id.type](b.id), c; - c = null === b.init ? null : this[b.init.type](b.init); + var a = this[b.id.type](b.id), d; + d = null === b.init ? null : this[b.init.type](b.init); console.log("id", a); - console.log("init", c); - return {type:b.type, id:a, init:c}; + console.log("init", d); + return {type:b.type, id:a, init:d}; }; a.ThisExpression = function(b) { console.log("ThisExpression", b); @@ -19005,8 +19077,8 @@ Entry.PyToBlockParserTemp = function(a) { if (null === b.elements) { a = null; } else { - for (var c in b.elements) { - var e = b.elements[c], e = this[e.type](e); + for (var d in b.elements) { + var e = b.elements[d], e = this[e.type](e); a.push(e); } } @@ -19015,15 +19087,15 @@ Entry.PyToBlockParserTemp = function(a) { a.ObjectExpression = function(b) { console.log("ObjectExpression", b); for (var a in b.properties) { - var c = b.properties[a], c = this[c.type](c); - (void 0).push(c); + var d = b.properties[a], d = this[d.type](d); + (void 0).push(d); } return {type:b.type, properties:void 0}; }; a.Property = function(b) { console.log("Property", b); - var a = this[b.key.type](b.key), c = this[b.value.type](b.value); - return {type:b.type, key:a, value:c, kind:b.kind}; + var a = this[b.key.type](b.key), d = this[b.value.type](b.value); + return {type:b.type, key:a, value:d, kind:b.kind}; }; a.FunctionExpression = function(b) { console.log("FunctionExpression", b); @@ -19057,8 +19129,8 @@ Entry.PyToBlockParserTemp = function(a) { default: a = null; } - var c = b.prefix, e = this[b.argument.type](b.argument); - return {type:b.type, operator:a, prefix:c, argument:e}; + var d = b.prefix, e = this[b.argument.type](b.argument); + return {type:b.type, operator:a, prefix:d, argument:e}; }; a.UpdateExpression = function(b) { console.log("UpdateExpression", b); @@ -19073,8 +19145,8 @@ Entry.PyToBlockParserTemp = function(a) { default: a = null; } - var c = this[b.argument.type](b.argument); - return {type:b.type, operator:a, prefix:b.prefix, argument:c}; + var d = this[b.argument.type](b.argument); + return {type:b.type, operator:a, prefix:b.prefix, argument:d}; }; a.BinaryExpression = function(b) { console.log("BinaryExpression", b); @@ -19149,8 +19221,8 @@ Entry.PyToBlockParserTemp = function(a) { default: a = null; } - var c = this[b.left.type](b.left), e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:c, right:e}; + var d = this[b.left.type](b.left), e = this[b.right.type](b.right); + return {type:b.type, operator:a, left:d, right:e}; }; a.AssignmentExpression = function(b) { console.log("AssignmentExpression", b); @@ -19192,10 +19264,10 @@ Entry.PyToBlockParserTemp = function(a) { default: a = null; } - var c; - c = b.left; + var d; + d = b.left; var e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:c, right:e}; + return {type:b.type, operator:a, left:d, right:e}; }; a.LogicalExpression = function(b) { console.log("LogicalExpression", b); @@ -19210,35 +19282,35 @@ Entry.PyToBlockParserTemp = function(a) { default: a = null; } - var c = this[b.left.type](b.left), e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:c, right:e}; + var d = this[b.left.type](b.left), e = this[b.right.type](b.right); + return {type:b.type, operator:a, left:d, right:e}; }; a.MemberExpression = function(b) { console.log("MemberExpression", b); - var a = this[b.object.type](b.object), c = this[b.property.type](b.property), e = b.computed; + var a = this[b.object.type](b.object), d = this[b.property.type](b.property), e = b.computed; console.log("object", a); - console.log("property", c); - return {type:b.type, object:a, property:c, computed:e}; + console.log("property", d); + return {type:b.type, object:a, property:d, computed:e}; }; a.ConditionalExpression = function(b) { console.log("ConditionalExpression", b); - var a = this[b.callee.type](b.callee), c; - for (c in b.arguments) { - var e = b.arguments[c], e = this[e.type](e); + var a = this[b.callee.type](b.callee), d; + for (d in b.arguments) { + var e = b.arguments[d], e = this[e.type](e); (void 0).push(e); } return {type:b.type, callee:a, arguments:void 0}; }; a.CallExpression = function(b) { console.log("CallExpression", b); - var a = this[b.callee.type](b.callee), c = [], e; + var a = this[b.callee.type](b.callee), d = [], e; for (e in b.arguments) { var f = b.arguments[e], f = this[f.type](f); - c.push(f); + d.push(f); } console.log("callee", a); - console.log("arguments", c); - return {type:b.type, callee:a, arguments:c}; + console.log("arguments", d); + return {type:b.type, callee:a, arguments:d}; }; a.NewExpression = function(b) { console.log("NewExpression", b); @@ -19247,8 +19319,8 @@ Entry.PyToBlockParserTemp = function(a) { a.SequenceExpression = function(b) { console.log("SequenceExpression", b); for (var a in b.expressions) { - var c = b.expressions[a], c = this[c.type](c); - (void 0).push(c); + var d = b.expressions[a], d = this[d.type](d); + (void 0).push(d); } return {type:b.type, expressions:void 0}; }; @@ -19261,78 +19333,78 @@ Entry.Toast = function() { this.body_.addClass("entryToastContainer"); document.body.appendChild(this.body_); }; -Entry.Toast.prototype.warning = function(a, b, d) { - var c = Entry.createElement("div", "entryToast"); - c.addClass("entryToast"); - c.addClass("entryToastWarning"); - c.bindOnClick(function() { +Entry.Toast.prototype.warning = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastWarning"); + d.bindOnClick(function() { Entry.toast.body_.removeChild(this); }); var e = Entry.createElement("div", "entryToast"); e.addClass("entryToastTitle"); e.innerHTML = a; - c.appendChild(e); + d.appendChild(e); a = Entry.createElement("p", "entryToast"); a.addClass("entryToastMessage"); a.innerHTML = b; - c.appendChild(a); - this.toasts_.push(c); - this.body_.appendChild(c); - d || window.setTimeout(function() { - c.style.opacity = 1; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; var b = setInterval(function() { - .05 > c.style.opacity && (clearInterval(b), c.style.display = "none", Entry.removeElement(c)); - c.style.opacity *= .9; + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; }, 20); }, 1E3); }; -Entry.Toast.prototype.success = function(a, b, d) { - var c = Entry.createElement("div", "entryToast"); - c.addClass("entryToast"); - c.addClass("entryToastSuccess"); - c.bindOnClick(function() { +Entry.Toast.prototype.success = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastSuccess"); + d.bindOnClick(function() { Entry.toast.body_.removeChild(this); }); var e = Entry.createElement("div", "entryToast"); e.addClass("entryToastTitle"); e.innerHTML = a; - c.appendChild(e); + d.appendChild(e); a = Entry.createElement("p", "entryToast"); a.addClass("entryToastMessage"); a.innerHTML = b; - c.appendChild(a); - this.toasts_.push(c); - this.body_.appendChild(c); - d || window.setTimeout(function() { - c.style.opacity = 1; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; var b = setInterval(function() { - .05 > c.style.opacity && (clearInterval(b), c.style.display = "none", Entry.removeElement(c)); - c.style.opacity *= .9; + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; }, 20); }, 1E3); }; -Entry.Toast.prototype.alert = function(a, b, d) { - var c = Entry.createElement("div", "entryToast"); - c.addClass("entryToast"); - c.addClass("entryToastAlert"); - c.bindOnClick(function() { +Entry.Toast.prototype.alert = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastAlert"); + d.bindOnClick(function() { Entry.toast.body_.removeChild(this); }); var e = Entry.createElement("div", "entryToast"); e.addClass("entryToastTitle"); e.innerHTML = a; - c.appendChild(e); + d.appendChild(e); a = Entry.createElement("p", "entryToast"); a.addClass("entryToastMessage"); a.innerHTML = b; - c.appendChild(a); - this.toasts_.push(c); - this.body_.appendChild(c); - d || window.setTimeout(function() { - c.style.opacity = 1; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; var b = setInterval(function() { - .05 > c.style.opacity && (clearInterval(b), c.style.display = "none", Entry.toast.body_.removeChild(c)); - c.style.opacity *= .9; + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.toast.body_.removeChild(d)); + d.style.opacity *= .9; }, 20); }, 5E3); }; @@ -19377,13 +19449,13 @@ Entry.ContextMenu = {}; }); Entry.Utils.disableContextmenu(this.dom); }; - a.show = function(b, a, c) { + a.show = function(b, a, d) { this._hideEvent = Entry.documentMousedown.attach(this, function() { this.hide(); }); this.dom || this.createDom(); if (0 !== b.length) { - var e = this; + var c = this; void 0 !== a && (this._className = a, this.dom.addClass(a)); var f = this.dom; f.empty(); @@ -19398,7 +19470,7 @@ Entry.ContextMenu = {}; m && k.callback && function(b, a) { b.mousedown(function(b) { b.preventDefault(); - e.hide(); + c.hide(); a(b); }); }(q, k.callback); @@ -19407,14 +19479,14 @@ Entry.ContextMenu = {}; } f.removeClass("entryRemove"); this.visible = !0; - this.position(c || Entry.mouseCoordinate); + this.position(d || Entry.mouseCoordinate); } }; a.position = function(b) { var a = this.dom; a.css({left:0, top:0}); - var c = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); - b.x + c > g && (b.x -= c + 3); + var d = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); + b.x + d > g && (b.x -= d + 3); b.y + e > f && (b.y -= e); a.css({left:b.x, top:b.y}); }; @@ -19469,7 +19541,7 @@ Entry.Variable.prototype.generateView = function(a) { }); } else { if ("slide" == b) { - var d = this; + var c = this; this.view_ = new createjs.Container; this.rect_ = new createjs.Shape; this.view_.addChild(this.rect_); @@ -19487,7 +19559,7 @@ Entry.Variable.prototype.generateView = function(a) { "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}); }); this.view_.on("pressmove", function(b) { - "workspace" != Entry.type || d.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }); this.view_.visible = this.visible_; this.view_.addChild(this.valueView_); @@ -19502,17 +19574,17 @@ Entry.Variable.prototype.generateView = function(a) { this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); this.valueSetter_.cursor = "pointer"; this.valueSetter_.on("mousedown", function(b) { - Entry.engine.isState("run") && (d.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); + Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); }); this.valueSetter_.on("pressmove", function(b) { if (Entry.engine.isState("run")) { var a = this.offsetX; this.offsetX = -(this.x - .75 * b.stageX + 240); - a !== this.offsetX && (b = d.getX(), d.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + d.maxWidth + 10 > this.offsetX ? this.offsetX - b : d.maxWidth + 10)); + a !== this.offsetX && (b = c.getX(), c.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + c.maxWidth + 10 > this.offsetX ? this.offsetX - b : c.maxWidth + 10)); } }); this.valueSetter_.on("pressup", function(b) { - d.isAdjusting = !1; + c.isAdjusting = !1; }); this.view_.addChild(this.valueSetter_); b = Entry.variableContainer.variables_.length; @@ -19597,11 +19669,11 @@ Entry.Variable.prototype.updateView = function() { -2, this.getWidth() - 20 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !1, this.scrollPosition = 0); for (b = this.scrollPosition;b < this.scrollPosition + a && b < this.array_.length;b++) { this.elementView.indexView.text = b + 1; - var d = String(this.array_[b].data), c = Math.floor((this.getWidth() - 50) / 7), d = Entry.cutStringByLength(d, c), d = String(this.array_[b].data).length > d.length ? d + ".." : d; - this.elementView.valueView.text = d; - d = this.elementView.clone(!0); - d.y = 20 * (b - this.scrollPosition) + 23; - this.view_.addChild(d); + var c = String(this.array_[b].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[b].data).length > c.length ? c + ".." : c; + this.elementView.valueView.text = c; + c = this.elementView.clone(!0); + c.y = 20 * (b - this.scrollPosition) + 23; + this.view_.addChild(c); } } else { "answer" == this.type ? (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), this.valueView_.y = 1, this.isNumber() ? parseInt(this.getValue(), 10) == this.getValue() ? this.valueView_.text = this.getValue() : this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), null === this._valueWidth && (this._valueWidth = @@ -19739,8 +19811,8 @@ Entry.Variable.prototype.updateSlideValueByView = function() { var a = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; 0 > a && (a = 0); 1 < a && (a = 1); - var b = parseFloat(this.minValue_), d = parseFloat(this.maxValue_), a = (b + Number(Math.abs(d - b) * a)).toFixed(2), a = parseFloat(a); - a < b ? a = this.minValue_ : a > d && (a = this.maxValue_); + var b = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), a = (b + Number(Math.abs(c - b) * a)).toFixed(2), a = parseFloat(a); + a < b ? a = this.minValue_ : a > c && (a = this.maxValue_); this.isFloatPoint() || (a = Math.round(a)); this.setValue(a); }; @@ -19782,65 +19854,65 @@ Entry.VariableContainer = function() { Entry.VariableContainer.prototype.createDom = function(a) { var b = this; this.view_ = a; - var d = Entry.createElement("table"); - d.addClass("entryVariableSelectorWorkspace"); - this.view_.appendChild(d); - var c = Entry.createElement("tr"); - d.appendChild(c); + var c = Entry.createElement("table"); + c.addClass("entryVariableSelectorWorkspace"); + this.view_.appendChild(c); + var d = Entry.createElement("tr"); + c.appendChild(d); var e = this.createSelectButton("all"); e.setAttribute("rowspan", "2"); e.addClass("selected", "allButton"); - c.appendChild(e); - c.appendChild(this.createSelectButton("variable", Entry.variableEnable)); - c.appendChild(this.createSelectButton("message", Entry.messageEnable)); - c = Entry.createElement("tr"); - c.appendChild(this.createSelectButton("list", Entry.listEnable)); - c.appendChild(this.createSelectButton("func", Entry.functionEnable)); - d.appendChild(c); - d = Entry.createElement("ul"); - d.addClass("entryVariableListWorkspace"); - this.view_.appendChild(d); - this.listView_ = d; - d = Entry.createElement("li"); - d.addClass("entryVariableAddWorkspace"); - d.addClass("entryVariableListElementWorkspace"); - d.innerHTML = "+ " + Lang.Workspace.variable_add; + d.appendChild(e); + d.appendChild(this.createSelectButton("variable", Entry.variableEnable)); + d.appendChild(this.createSelectButton("message", Entry.messageEnable)); + d = Entry.createElement("tr"); + d.appendChild(this.createSelectButton("list", Entry.listEnable)); + d.appendChild(this.createSelectButton("func", Entry.functionEnable)); + c.appendChild(d); + c = Entry.createElement("ul"); + c.addClass("entryVariableListWorkspace"); + this.view_.appendChild(c); + this.listView_ = c; + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.variable_add; var f = this; - this.variableAddButton_ = d; - d.bindOnClick(function(a) { + this.variableAddButton_ = c; + c.bindOnClick(function(a) { a = f.variableAddPanel; - var d = a.view.name.value.trim(); - a.isOpen ? d && 0 !== d.length ? b.addVariable() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addVariable() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); }); this.generateVariableAddView(); this.generateListAddView(); this.generateVariableSplitterView(); this.generateVariableSettingView(); this.generateListSettingView(); - d = Entry.createElement("li"); - d.addClass("entryVariableAddWorkspace"); - d.addClass("entryVariableListElementWorkspace"); - d.innerHTML = "+ " + Lang.Workspace.message_create; - this.messageAddButton_ = d; - d.bindOnClick(function(a) { + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.message_create; + this.messageAddButton_ = c; + c.bindOnClick(function(a) { b.addMessage({name:Lang.Workspace.message + " " + (b.messages_.length + 1)}); }); - d = Entry.createElement("li"); - d.addClass("entryVariableAddWorkspace"); - d.addClass("entryVariableListElementWorkspace"); - d.innerHTML = "+ " + Lang.Workspace.list_create; - this.listAddButton_ = d; - d.bindOnClick(function(a) { + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.list_create; + this.listAddButton_ = c; + c.bindOnClick(function(a) { a = f.listAddPanel; - var d = a.view.name.value.trim(); - a.isOpen ? d && 0 !== d.length ? b.addList() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addList() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); }); - d = Entry.createElement("li"); - d.addClass("entryVariableAddWorkspace"); - d.addClass("entryVariableListElementWorkspace"); - d.innerHTML = "+ " + Lang.Workspace.function_add; - this.functionAddButton_ = d; - d.bindOnClick(function(a) { + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.function_add; + this.functionAddButton_ = c; + c.bindOnClick(function(a) { a = b._getBlockMenu(); Entry.playground.changeViewMode("code"); "func" != a.lastSelector && a.selectMenu("func"); @@ -19849,20 +19921,20 @@ Entry.VariableContainer.prototype.createDom = function(a) { return a; }; Entry.VariableContainer.prototype.createSelectButton = function(a, b) { - var d = this; + var c = this; void 0 === b && (b = !0); - var c = Entry.createElement("td"); - c.addClass("entryVariableSelectButtonWorkspace", a); - c.innerHTML = Lang.Workspace[a]; - b ? c.bindOnClick(function(b) { - d.selectFilter(a); + var d = Entry.createElement("td"); + d.addClass("entryVariableSelectButtonWorkspace", a); + d.innerHTML = Lang.Workspace[a]; + b ? d.bindOnClick(function(b) { + c.selectFilter(a); this.addClass("selected"); - }) : c.addClass("disable"); - return c; + }) : d.addClass("disable"); + return d; }; Entry.VariableContainer.prototype.selectFilter = function(a) { - for (var b = this.view_.getElementsByTagName("td"), d = 0;d < b.length;d++) { - b[d].removeClass("selected"), b[d].hasClass(a) && b[d].addClass("selected"); + for (var b = this.view_.getElementsByTagName("td"), c = 0;c < b.length;c++) { + b[c].removeClass("selected"), b[c].hasClass(a) && b[c].addClass("selected"); } this.viewMode_ = a; this.select(); @@ -19870,15 +19942,15 @@ Entry.VariableContainer.prototype.selectFilter = function(a) { }; Entry.VariableContainer.prototype.updateVariableAddView = function(a) { a = "variable" == (a ? a : "variable") ? this.variableAddPanel : this.listAddPanel; - var b = a.info, d = a.view; + var b = a.info, c = a.view; a.view.addClass("entryRemove"); - d.cloudCheck.removeClass("entryVariableAddChecked"); - d.localCheck.removeClass("entryVariableAddChecked"); - d.globalCheck.removeClass("entryVariableAddChecked"); - d.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); - b.isCloud && d.cloudCheck.addClass("entryVariableAddChecked"); - a.isOpen && (d.removeClass("entryRemove"), d.name.focus()); - b.object ? (d.localCheck.addClass("entryVariableAddChecked"), d.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : d.globalCheck.addClass("entryVariableAddChecked"); + c.cloudCheck.removeClass("entryVariableAddChecked"); + c.localCheck.removeClass("entryVariableAddChecked"); + c.globalCheck.removeClass("entryVariableAddChecked"); + c.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); + b.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); + a.isOpen && (c.removeClass("entryRemove"), c.name.focus()); + b.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); }; Entry.VariableContainer.prototype.select = function(a) { a = this.selected == a ? null : a; @@ -19886,48 +19958,48 @@ Entry.VariableContainer.prototype.select = function(a) { a && (a.listElement.addClass("selected"), this.selected = a, a instanceof Entry.Variable ? (this.renderVariableReference(a), a.object_ && Entry.container.selectObject(a.object_, !0)) : a instanceof Entry.Func ? this.renderFunctionReference(a) : this.renderMessageReference(a)); }; Entry.VariableContainer.prototype.renderMessageReference = function(a) { - for (var b = this, d = this._messageRefs, c = a.id, e = [], f = 0;f < d.length;f++) { - -1 < d[f].block.params.indexOf(c) && e.push(d[f]); + for (var b = this, c = this._messageRefs, d = a.id, e = [], f = 0;f < c.length;f++) { + -1 < c[f].block.params.indexOf(d) && e.push(c[f]); } - d = Entry.createElement("ul"); - d.addClass("entryVariableListCallerListWorkspace"); + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); for (f in e) { - var c = e[f], g = Entry.createElement("li"); + var d = e[f], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(c.object.thumbnailView_.cloneNode()); + g.appendChild(d.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = c.object.name + " : " + Lang.Blocks["START_" + c.block.type]; + h.innerHTML = d.object.name + " : " + Lang.Blocks["START_" + d.block.type]; g.appendChild(h); - g.caller = c; + g.caller = d; g.message = a; g.bindOnClick(function(a) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(this.message)); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); - d.appendChild(g); + c.appendChild(g); } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); - a.callerListElement = d; - this.listView_.insertBefore(d, a.listElement); - this.listView_.insertBefore(a.listElement, d); + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; Entry.VariableContainer.prototype.renderVariableReference = function(a) { - for (var b = this, d = this._variableRefs, c = a.id_, e = [], f = 0;f < d.length;f++) { - -1 < d[f].block.params.indexOf(c) && e.push(d[f]); + for (var b = this, c = this._variableRefs, d = a.id_, e = [], f = 0;f < c.length;f++) { + -1 < c[f].block.params.indexOf(d) && e.push(c[f]); } - d = Entry.createElement("ul"); - d.addClass("entryVariableListCallerListWorkspace"); + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); for (f in e) { - var c = e[f], g = Entry.createElement("li"); + var d = e[f], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(c.object.thumbnailView_.cloneNode()); + g.appendChild(d.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = c.object.name + " : " + Lang.Blocks["VARIABLE_" + c.block.type]; + h.innerHTML = d.object.name + " : " + Lang.Blocks["VARIABLE_" + d.block.type]; g.appendChild(h); - g.caller = c; + g.caller = d; g.variable = a; g.bindOnClick(function(a) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null)); @@ -19937,21 +20009,21 @@ Entry.VariableContainer.prototype.renderVariableReference = function(a) { Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); - d.appendChild(g); + c.appendChild(g); } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); - a.callerListElement = d; - this.listView_.insertBefore(d, a.listElement); - this.listView_.insertBefore(a.listElement, d); + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; Entry.VariableContainer.prototype.renderFunctionReference = function(a) { - for (var b = this, d = this._functionRefs, c = [], e = 0;e < d.length;e++) { - c.push(d[e]); + for (var b = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { + d.push(c[e]); } - d = Entry.createElement("ul"); - d.addClass("entryVariableListCallerListWorkspace"); - for (e in c) { - var f = c[e], g = Entry.createElement("li"); + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); + for (e in d) { + var f = d[e], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); g.appendChild(f.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); @@ -19959,19 +20031,19 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(a) { h.innerHTML = f.object.name; g.appendChild(h); g.caller = f; - g.bindOnClick(function(d) { + g.bindOnClick(function(c) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(a)); - d = this.caller.block; + c = this.caller.block; Entry.playground.toggleOnVariableView(); - d.view.getBoard().activateBlock(d); + c.view.getBoard().activateBlock(c); Entry.playground.changeViewMode("variable"); }); - d.appendChild(g); + c.appendChild(g); } - 0 === c.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); - a.callerListElement = d; - this.listView_.insertBefore(d, a.listElement); - this.listView_.insertBefore(a.listElement, d); + 0 === d.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; Entry.VariableContainer.prototype.updateList = function() { if (this.listView_) { @@ -19982,12 +20054,12 @@ Entry.VariableContainer.prototype.updateList = function() { var a = this.viewMode_, b = []; if ("all" == a || "message" == a) { "message" == a && this.listView_.appendChild(this.messageAddButton_); - for (var d in this.messages_) { - var c = this.messages_[d]; - b.push(c); - var e = c.listElement; + for (var c in this.messages_) { + var d = this.messages_[c]; + b.push(d); + var e = d.listElement; this.listView_.appendChild(e); - c.callerListElement && this.listView_.appendChild(c.callerListElement); + d.callerListElement && this.listView_.appendChild(d.callerListElement); } } if ("all" == a || "variable" == a) { @@ -19998,18 +20070,18 @@ Entry.VariableContainer.prototype.updateList = function() { this.listView_.appendChild(this.variableAddPanel.view); this.variableSplitters.top.innerHTML = Lang.Workspace.Variable_used_at_all_objects; this.listView_.appendChild(this.variableSplitters.top); - for (d in this.variables_) { - c = this.variables_[d], c.object_ || (b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); + for (c in this.variables_) { + d = this.variables_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.Variable_used_at_special_object; this.listView_.appendChild(this.variableSplitters.bottom); - for (d in this.variables_) { - c = this.variables_[d], c.object_ && (b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); + for (c in this.variables_) { + d = this.variables_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.updateVariableAddView("variable"); } else { - for (d in this.variables_) { - c = this.variables_[d], b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement); + for (c in this.variables_) { + d = this.variables_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); } } } @@ -20022,24 +20094,24 @@ Entry.VariableContainer.prototype.updateList = function() { this.variableSplitters.top.innerHTML = Lang.Workspace.List_used_all_objects; this.listView_.appendChild(this.variableSplitters.top); this.updateVariableAddView("list"); - for (d in this.lists_) { - c = this.lists_[d], c.object_ || (b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); + for (c in this.lists_) { + d = this.lists_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.list_used_specific_objects; this.listView_.appendChild(this.variableSplitters.bottom); - for (d in this.lists_) { - c = this.lists_[d], c.object_ && (b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); + for (c in this.lists_) { + d = this.lists_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.updateVariableAddView("variable"); } else { - for (d in this.lists_) { - c = this.lists_[d], b.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement); + for (c in this.lists_) { + d = this.lists_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); } } } if ("all" == a || "func" == a) { - for (d in "func" == a && this.listView_.appendChild(this.functionAddButton_), this.functions_) { - a = this.functions_[d], b.push(a), e = a.listElement, this.listView_.appendChild(e), a.callerListElement && this.listView_.appendChild(a.callerListElement); + for (c in "func" == a && this.listView_.appendChild(this.functionAddButton_), this.functions_) { + a = this.functions_[c], b.push(a), e = a.listElement, this.listView_.appendChild(e), a.callerListElement && this.listView_.appendChild(a.callerListElement); } } this.listView_.appendChild(this.variableSettingView); @@ -20048,18 +20120,18 @@ Entry.VariableContainer.prototype.updateList = function() { }; Entry.VariableContainer.prototype.setMessages = function(a) { for (var b in a) { - var d = a[b]; - d.id || (d.id = Entry.generateHash()); - this.createMessageView(d); - this.messages_.push(d); + var c = a[b]; + c.id || (c.id = Entry.generateHash()); + this.createMessageView(c); + this.messages_.push(c); } Entry.playground.reloadPlayground(); this.updateList(); }; Entry.VariableContainer.prototype.setVariables = function(a) { for (var b in a) { - var d = new Entry.Variable(a[b]), c = d.getType(); - "variable" == c || "slide" == c ? (d.generateView(this.variables_.length), this.createVariableView(d), this.variables_.push(d)) : "list" == c ? (d.generateView(this.lists_.length), this.createListView(d), this.lists_.push(d)) : "timer" == c ? this.generateTimer(d) : "answer" == c && this.generateAnswer(d); + var c = new Entry.Variable(a[b]), d = c.getType(); + "variable" == d || "slide" == d ? (c.generateView(this.variables_.length), this.createVariableView(c), this.variables_.push(c)) : "list" == d ? (c.generateView(this.lists_.length), this.createListView(c), this.lists_.push(c)) : "timer" == d ? this.generateTimer(c) : "answer" == d && this.generateAnswer(c); } Entry.isEmpty(Entry.engine.projectTimer) && Entry.variableContainer.generateTimer(); Entry.isEmpty(Entry.container.inputValue) && Entry.variableContainer.generateAnswer(); @@ -20068,10 +20140,10 @@ Entry.VariableContainer.prototype.setVariables = function(a) { }; Entry.VariableContainer.prototype.setFunctions = function(a) { for (var b in a) { - var d = new Entry.Func(a[b]); - d.generateBlock(); - this.createFunctionView(d); - this.functions_[d.id] = d; + var c = new Entry.Func(a[b]); + c.generateBlock(); + this.createFunctionView(c); + this.functions_[c.id] = c; } this.updateList(); }; @@ -20079,14 +20151,14 @@ Entry.VariableContainer.prototype.getFunction = function(a) { return this.functions_[a]; }; Entry.VariableContainer.prototype.getVariable = function(a, b) { - var d = Entry.findObjsByKey(this.variables_, "id_", a)[0]; - b && b.isClone && d.object_ && (d = Entry.findObjsByKey(b.variables, "id_", a)[0]); - return d; + var c = Entry.findObjsByKey(this.variables_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.variables, "id_", a)[0]); + return c; }; Entry.VariableContainer.prototype.getList = function(a, b) { - var d = Entry.findObjsByKey(this.lists_, "id_", a)[0]; - b && b.isClone && d.object_ && (d = Entry.findObjsByKey(b.lists, "id_", a)[0]); - return d; + var c = Entry.findObjsByKey(this.lists_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.lists, "id_", a)[0]); + return c; }; Entry.VariableContainer.prototype.createFunction = function() { if (!Entry.Func.isEdit) { @@ -20103,22 +20175,22 @@ Entry.VariableContainer.prototype.removeFunction = function(a) { delete a[b]; b = "func_" + b; Entry.container.removeFuncBlocks(b); - for (var d in a) { - a[d].content.removeBlocksByType(b); + for (var c in a) { + a[c].content.removeBlocksByType(b); } this.updateList(); }; Entry.VariableContainer.prototype.checkListPosition = function(a, b) { - var d = a.x_ + a.width_, c = -a.y_, e = -a.y_ + -a.height_; - return b.x > a.x_ && b.x < d && b.y < c && b.y > e ? !0 : !1; + var c = a.x_ + a.width_, d = -a.y_, e = -a.y_ + -a.height_; + return b.x > a.x_ && b.x < c && b.y < d && b.y > e ? !0 : !1; }; Entry.VariableContainer.prototype.getListById = function(a) { - var b = this.lists_, d = []; + var b = this.lists_, c = []; if (0 < b.length) { - for (var c = 0;c < b.length;c++) { - this.checkListPosition(b[c], a) && d.push(b[c]); + for (var d = 0;d < b.length;d++) { + this.checkListPosition(b[d], a) && c.push(b[d]); } - return d; + return c; } return !1; }; @@ -20132,17 +20204,17 @@ Entry.VariableContainer.prototype.saveFunction = function(a) { Entry.VariableContainer.prototype.createFunctionView = function(a) { var b = this; if (this.view_) { - var d = Entry.createElement("li"); - d.addClass("entryVariableListElementWorkspace"); - d.addClass("entryFunctionElementWorkspace"); - d.bindOnClick(function(d) { - d.stopPropagation(); + var c = Entry.createElement("li"); + c.addClass("entryVariableListElementWorkspace"); + c.addClass("entryFunctionElementWorkspace"); + c.bindOnClick(function(c) { + c.stopPropagation(); b.select(a); }); - var c = Entry.createElement("button"); - c.addClass("entryVariableListElementDeleteWorkspace"); - c.bindOnClick(function(d) { - d.stopPropagation(); + var d = Entry.createElement("button"); + d.addClass("entryVariableListElementDeleteWorkspace"); + d.bindOnClick(function(c) { + c.stopPropagation(); confirm(Lang.Workspace.will_you_delete_function) && (b.removeFunction(a), b.selected = null); }); var e = Entry.createElement("button"); @@ -20156,17 +20228,17 @@ Entry.VariableContainer.prototype.createFunctionView = function(a) { var g = Entry.createElement("div"); g.addClass("entryVariableFunctionElementNameWorkspace"); g.innerHTML = a.description; - d.nameField = g; - d.appendChild(g); - d.appendChild(e); - d.appendChild(c); - a.listElement = d; + c.nameField = g; + c.appendChild(g); + c.appendChild(e); + c.appendChild(d); + a.listElement = c; } }; Entry.VariableContainer.prototype.checkAllVariableName = function(a, b) { b = this[b]; - for (var d = 0;d < b.length;d++) { - if (b[d].name_ == a) { + for (var c = 0;c < b.length;c++) { + if (b[c].name_ == a) { return !0; } } @@ -20179,8 +20251,8 @@ Entry.VariableContainer.prototype.addVariable = function(a) { a && 0 !== a.length || (a = Lang.Workspace.variable); a.length > this._maxNameLength && (a = this._truncName(a, "variable")); a = this.checkAllVariableName(a, "variables_") ? Entry.getOrderedName(a, this.variables_, "name_") : a; - var d = b.info; - a = {name:a, isCloud:d.isCloud, object:d.object, variableType:"variable"}; + var c = b.info; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"variable"}; b.view.addClass("entryRemove"); this.resetVariableAddPanel("variable"); } @@ -20194,14 +20266,14 @@ Entry.VariableContainer.prototype.addVariable = function(a) { return new Entry.State(this, this.removeVariable, a); }; Entry.VariableContainer.prototype.removeVariable = function(a) { - var b = this.variables_.indexOf(a), d = a.toJSON(); + var b = this.variables_.indexOf(a), c = a.toJSON(); this.selected == a && this.select(null); a.remove(); this.variables_.splice(b, 1); - Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, d); + Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, c); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.addVariable, d); + return new Entry.State(this, this.addVariable, c); }; Entry.VariableContainer.prototype.changeVariableName = function(a, b) { a.name_ != b && (Entry.isExist(b, "name_", this.variables_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (a.setName(b), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); @@ -20210,43 +20282,43 @@ Entry.VariableContainer.prototype.changeListName = function(a, b) { a.name_ != b && (Entry.isExist(b, "name_", this.lists_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (a.name_ = b, a.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); }; Entry.VariableContainer.prototype.removeList = function(a) { - var b = this.lists_.indexOf(a), d = a.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, d); + var b = this.lists_.indexOf(a), c = a.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, c); this.selected == a && this.select(null); a.remove(); this.lists_.splice(b, 1); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.addList, d); + return new Entry.State(this, this.addList, c); }; Entry.VariableContainer.prototype.createVariableView = function(a) { - var b = this, d = Entry.createElement("li"), c = Entry.createElement("div"); - c.addClass("entryVariableListElementWrapperWorkspace"); - d.appendChild(c); - d.addClass("entryVariableListElementWorkspace"); - a.object_ ? d.addClass("entryVariableLocalElementWorkspace") : a.isCloud_ ? d.addClass("entryVariableCloudElementWorkspace") : d.addClass("entryVariableGlobalElementWorkspace"); - d.bindOnClick(function(d) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); + d.addClass("entryVariableListElementWrapperWorkspace"); + c.appendChild(d); + c.addClass("entryVariableListElementWorkspace"); + a.object_ ? c.addClass("entryVariableLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); + c.bindOnClick(function(c) { b.select(a); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); - e.bindOnClick(function(d) { - d.stopPropagation(); + e.bindOnClick(function(c) { + c.stopPropagation(); b.removeVariable(a); b.selectedVariable = null; b.variableSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); - f.bindOnClick(function(d) { - d.stopPropagation(); + f.bindOnClick(function(c) { + c.stopPropagation(); h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); b.updateSelectedVariable(a); h.focus(); }); - d.editButton = f; + c.editButton = f; var g = Entry.createElement("button"); g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove"); @@ -20258,7 +20330,7 @@ Entry.VariableContainer.prototype.createVariableView = function(a) { this.addClass("entryRemove"); b.updateSelectedVariable(null, "variable"); }); - d.editSaveButton = g; + c.editSaveButton = g; var h = Entry.createElement("input"); h.addClass("entryVariableListElementNameWorkspace"); h.setAttribute("disabled", "disabled"); @@ -20266,18 +20338,18 @@ Entry.VariableContainer.prototype.createVariableView = function(a) { h.bindOnClick(function(b) { b.stopPropagation(); }); - h.onblur = function(d) { - (d = this.value.trim()) && 0 !== d.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); + h.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); }; h.onkeydown = function(b) { 13 == b.keyCode && this.blur(); }; - d.nameField = h; - c.appendChild(h); - c.appendChild(f); - c.appendChild(g); - c.appendChild(e); - a.listElement = d; + c.nameField = h; + d.appendChild(h); + d.appendChild(f); + d.appendChild(g); + d.appendChild(e); + a.listElement = c; }; Entry.VariableContainer.prototype.addMessage = function(a) { a.id || (a.id = Entry.generateHash()); @@ -20302,16 +20374,16 @@ Entry.VariableContainer.prototype.changeMessageName = function(a, b) { a.name != b && (Entry.isExist(b, "name", this.messages_) ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (a.name = b, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); }; Entry.VariableContainer.prototype.createMessageView = function(a) { - var b = this, d = Entry.createElement("li"); - d.addClass("entryVariableListElementWorkspace"); - d.addClass("entryMessageElementWorkspace"); - d.bindOnClick(function(d) { + var b = this, c = Entry.createElement("li"); + c.addClass("entryVariableListElementWorkspace"); + c.addClass("entryMessageElementWorkspace"); + c.bindOnClick(function(c) { b.select(a); }); - var c = Entry.createElement("button"); - c.addClass("entryVariableListElementDeleteWorkspace"); - c.bindOnClick(function(d) { - d.stopPropagation(); + var d = Entry.createElement("button"); + d.addClass("entryVariableListElementDeleteWorkspace"); + d.bindOnClick(function(c) { + c.stopPropagation(); b.removeMessage(a); }); var e = Entry.createElement("button"); @@ -20338,28 +20410,28 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { g.bindOnClick(function(b) { b.stopPropagation(); }); - g.onblur = function(d) { - (d = this.value.trim()) && 0 !== d.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); + g.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); }; g.onkeydown = function(b) { 13 == b.keyCode && this.blur(); }; - d.nameField = g; - d.appendChild(g); - d.appendChild(e); - d.appendChild(f); - d.appendChild(c); - a.listElement = d; + c.nameField = g; + c.appendChild(g); + c.appendChild(e); + c.appendChild(f); + c.appendChild(d); + a.listElement = c; }; Entry.VariableContainer.prototype.addList = function(a) { if (!a) { var b = this.listAddPanel; a = b.view.name.value.trim(); a && 0 !== a.length || (a = Lang.Workspace.list); - var d = b.info; + var c = b.info; a.length > this._maxNameLength && (a = this._truncName(a, "list")); a = this.checkAllVariableName(a, "lists_") ? Entry.getOrderedName(a, this.lists_, "name_") : a; - a = {name:a, isCloud:d.isCloud, object:d.object, variableType:"list"}; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"list"}; b.view.addClass("entryRemove"); this.resetVariableAddPanel("list"); } @@ -20373,38 +20445,38 @@ Entry.VariableContainer.prototype.addList = function(a) { return new Entry.State(this, this.removelist, a); }; Entry.VariableContainer.prototype.createListView = function(a) { - var b = this, d = Entry.createElement("li"), c = Entry.createElement("div"); - c.addClass("entryVariableListElementWrapperWorkspace"); - d.appendChild(c); - d.addClass("entryVariableListElementWorkspace"); - a.object_ ? d.addClass("entryListLocalElementWorkspace") : a.isCloud_ ? d.addClass("entryListCloudElementWorkspace") : d.addClass("entryListGlobalElementWorkspace"); - d.bindOnClick(function(d) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); + d.addClass("entryVariableListElementWrapperWorkspace"); + c.appendChild(d); + c.addClass("entryVariableListElementWorkspace"); + a.object_ ? c.addClass("entryListLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); + c.bindOnClick(function(c) { b.select(a); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); - e.bindOnClick(function(d) { - d.stopPropagation(); + e.bindOnClick(function(c) { + c.stopPropagation(); b.removeList(a); b.selectedList = null; b.listSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); - f.bindOnClick(function(d) { - d.stopPropagation(); + f.bindOnClick(function(c) { + c.stopPropagation(); h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); b.updateSelectedVariable(a); h.focus(); }); - d.editButton = f; + c.editButton = f; var g = Entry.createElement("button"); g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove"); - g.bindOnClick(function(d) { - d.stopPropagation(); + g.bindOnClick(function(c) { + c.stopPropagation(); h.blur(); h.setAttribute("disabled", "disabled"); f.removeClass("entryRemove"); @@ -20412,7 +20484,7 @@ Entry.VariableContainer.prototype.createListView = function(a) { b.select(a); b.updateSelectedVariable(null, "list"); }); - d.editSaveButton = g; + c.editSaveButton = g; var h = Entry.createElement("input"); h.setAttribute("disabled", "disabled"); h.addClass("entryVariableListElementNameWorkspace"); @@ -20420,27 +20492,27 @@ Entry.VariableContainer.prototype.createListView = function(a) { h.bindOnClick(function(b) { b.stopPropagation(); }); - h.onblur = function(d) { - (d = this.value.trim()) && 0 !== d.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); + h.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); }; h.onkeydown = function(b) { 13 == b.keyCode && this.blur(); }; - d.nameField = h; - c.appendChild(h); - c.appendChild(f); - c.appendChild(g); - c.appendChild(e); - a.listElement = d; + c.nameField = h; + d.appendChild(h); + d.appendChild(f); + d.appendChild(g); + d.appendChild(e); + a.listElement = c; }; Entry.VariableContainer.prototype.mapVariable = function(a, b) { - for (var d = this.variables_.length, c = 0;c < d;c++) { - a(this.variables_[c], b); + for (var c = this.variables_.length, d = 0;d < c;d++) { + a(this.variables_[d], b); } }; Entry.VariableContainer.prototype.mapList = function(a, b) { - for (var d = this.lists_.length, c = 0;c < d;c++) { - a(this.lists_[c], b); + for (var c = this.lists_.length, d = 0;d < c;d++) { + a(this.lists_[d], b); } }; Entry.VariableContainer.prototype.getVariableJSON = function() { @@ -20464,16 +20536,16 @@ Entry.VariableContainer.prototype.getMessageJSON = function() { Entry.VariableContainer.prototype.getFunctionJSON = function() { var a = [], b; for (b in this.functions_) { - var d = this.functions_[b], d = {id:d.id, content:JSON.stringify(d.content.toJSON())}; - a.push(d); + var c = this.functions_[b], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; + a.push(c); } return a; }; Entry.VariableContainer.prototype.resetVariableAddPanel = function(a) { a = a || "variable"; - var b = "variable" == a ? this.variableAddPanel : this.listAddPanel, d = b.info; - d.isCloud = !1; - d.object = null; + var b = "variable" == a ? this.variableAddPanel : this.listAddPanel, c = b.info; + c.isCloud = !1; + c.object = null; b.view.name.value = ""; b.isOpen = !1; this.updateVariableAddView(a); @@ -20484,68 +20556,68 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { this.variableAddPanel.isOpen = !1; b.addClass("entryVariableAddSpaceWorkspace"); b.addClass("entryRemove"); - var d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - b.appendChild(d); - var c = Entry.createElement("input"); - c.addClass("entryVariableAddSpaceInputWorkspace"); - c.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); - c.variableContainer = this; - c.onkeypress = function(b) { + var c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + b.appendChild(c); + var d = Entry.createElement("input"); + d.addClass("entryVariableAddSpaceInputWorkspace"); + d.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); + d.variableContainer = this; + d.onkeypress = function(b) { 13 == b.keyCode && (Entry.variableContainer.addVariable(), a.updateSelectedVariable(a.variables_[0]), b = a.variables_[0].listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; - this.variableAddPanel.view.name = c; - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - d.bindOnClick(function(b) { + this.variableAddPanel.view.name = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + c.bindOnClick(function(b) { a.variableAddPanel.info.object = null; a.updateVariableAddView("variable"); }); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.Variable_use_all_objects; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.globalCheck = c; - this.variableAddPanel.info.object || c.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - d.bindOnClick(function(b) { - Entry.playground.object && (b = a.variableAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("variable")); - }); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.Variable_use_this_object; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.localCheck = c; - this.variableAddPanel.info.object && c.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - b.cloudWrapper = d; - d.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - d.bindOnClick(function(b) { + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_all_objects; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.globalCheck = d; + this.variableAddPanel.info.object || d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + c.bindOnClick(function(b) { + Entry.playground.object && (b = a.variableAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("variable")); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_this_object; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.localCheck = d; + this.variableAddPanel.info.object && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + b.cloudWrapper = c; + c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + c.bindOnClick(function(b) { b = a.variableAddPanel.info; b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("variable")); }); - b.appendChild(d); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - c.innerHTML = Lang.Workspace.Variable_create_cloud; - d.appendChild(c); - c = Entry.createElement("span"); - this.variableAddPanel.view.cloudCheck = c; - c.addClass("entryVariableAddSpaceCheckWorkspace"); - c.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.variableAddPanel.info.isCloud && c.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - b.appendChild(d); + b.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + d.innerHTML = Lang.Workspace.Variable_create_cloud; + c.appendChild(d); + d = Entry.createElement("span"); + this.variableAddPanel.view.cloudCheck = d; + d.addClass("entryVariableAddSpaceCheckWorkspace"); + d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.variableAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + b.appendChild(c); b = Entry.createElement("span"); b.addClass("entryVariableAddSpaceCancelWorkspace"); b.addClass("entryVariableAddSpaceButtonWorkspace"); @@ -20554,7 +20626,7 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { a.variableAddPanel.view.addClass("entryRemove"); a.resetVariableAddPanel("variable"); }); - d.appendChild(b); + c.appendChild(b); b = Entry.createElement("span"); b.addClass("entryVariableAddSpaceConfirmWorkspace"); b.addClass("entryVariableAddSpaceButtonWorkspace"); @@ -20568,7 +20640,7 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { b.editSaveButton.removeClass("entryRemove"); b.nameField.removeAttribute("disabled"); }); - d.appendChild(b); + c.appendChild(b); }; Entry.VariableContainer.prototype.generateListAddView = function() { var a = this, b = Entry.createElement("li"); @@ -20576,69 +20648,69 @@ Entry.VariableContainer.prototype.generateListAddView = function() { this.listAddPanel.isOpen = !1; b.addClass("entryVariableAddSpaceWorkspace"); b.addClass("entryRemove"); - var d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - d.addClass("entryListAddSpaceNameWrapperWorkspace"); - b.appendChild(d); - var c = Entry.createElement("input"); - c.addClass("entryVariableAddSpaceInputWorkspace"); - c.setAttribute("placeholder", Lang.Workspace.list_name); - this.listAddPanel.view.name = c; - c.variableContainer = this; - c.onkeypress = function(b) { + var c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + c.addClass("entryListAddSpaceNameWrapperWorkspace"); + b.appendChild(c); + var d = Entry.createElement("input"); + d.addClass("entryVariableAddSpaceInputWorkspace"); + d.setAttribute("placeholder", Lang.Workspace.list_name); + this.listAddPanel.view.name = d; + d.variableContainer = this; + d.onkeypress = function(b) { 13 == b.keyCode && (a.addList(), b = a.lists_[0], a.updateSelectedVariable(b), b = b.listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - d.bindOnClick(function(b) { + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + c.bindOnClick(function(b) { a.listAddPanel.info.object = null; a.updateVariableAddView("list"); }); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.use_all_objects; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.globalCheck = c; - this.listAddPanel.info.object || c.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - d.bindOnClick(function(b) { + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.use_all_objects; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.globalCheck = d; + this.listAddPanel.info.object || d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + c.bindOnClick(function(b) { Entry.playground.object && (b = a.listAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("list")); }); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.Variable_use_this_object; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.localCheck = c; + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_this_object; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.localCheck = d; this.variableAddPanel.info.object && addVariableLocalCheck.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - b.cloudWrapper = d; - d.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - d.bindOnClick(function(b) { + c.appendChild(d); + c = Entry.createElement("div"); + b.cloudWrapper = c; + c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + c.bindOnClick(function(b) { b = a.listAddPanel.info; b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("list")); }); - b.appendChild(d); - c = Entry.createElement("span"); - c.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - c.innerHTML = Lang.Workspace.List_create_cloud; - d.appendChild(c); - c = Entry.createElement("span"); - this.listAddPanel.view.cloudCheck = c; - c.addClass("entryVariableAddSpaceCheckWorkspace"); - c.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.listAddPanel.info.isCloud && c.addClass("entryVariableAddChecked"); - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - b.appendChild(d); + b.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + d.innerHTML = Lang.Workspace.List_create_cloud; + c.appendChild(d); + d = Entry.createElement("span"); + this.listAddPanel.view.cloudCheck = d; + d.addClass("entryVariableAddSpaceCheckWorkspace"); + d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.listAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + b.appendChild(c); b = Entry.createElement("span"); b.addClass("entryVariableAddSpaceCancelWorkspace"); b.addClass("entryVariableAddSpaceButtonWorkspace"); @@ -20647,7 +20719,7 @@ Entry.VariableContainer.prototype.generateListAddView = function() { a.listAddPanel.view.addClass("entryRemove"); a.resetVariableAddPanel("list"); }); - d.appendChild(b); + c.appendChild(b); b = Entry.createElement("span"); b.addClass("entryVariableAddSpaceConfirmWorkspace"); b.addClass("entryVariableAddSpaceButtonWorkspace"); @@ -20662,7 +20734,7 @@ Entry.VariableContainer.prototype.generateListAddView = function() { b.editSaveButton.removeClass("entryRemove"); b.nameField.removeAttribute("disabled"); }); - d.appendChild(b); + c.appendChild(b); }; Entry.VariableContainer.prototype.generateVariableSplitterView = function() { var a = Entry.createElement("li"); @@ -20680,19 +20752,19 @@ Entry.VariableContainer.prototype.openVariableAddPanel = function(a) { this.updateVariableAddView(a); }; Entry.VariableContainer.prototype.getMenuXml = function(a) { - for (var b = [], d = 0 !== this.variables_.length, c = 0 !== this.lists_.length, e, f = 0, g;g = a[f];f++) { + for (var b = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = a[f];f++) { var h = g.tagName; - h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !d && "variable" == e || !c && "list" == e || b.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !d && "variable" == e || (c || "list" != e) && b.push(g); + h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || b.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && b.push(g); } return b; }; Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { - var b = [], d = this; - this.mapVariable(function(a, d) { - a.object_ && a.object_ == d.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = d.newObjectId, delete a.x, delete a.y, b.push(a), d.json.script = d.json.script.replace(new RegExp(a.originId, "g"), a.id)); + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); }, a); b.map(function(b) { - d.addVariable(b); + c.addVariable(b); }); }; Entry.VariableContainer.prototype.generateTimer = function(a) { @@ -20718,74 +20790,74 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { b.addClass("entryVariableSettingWorkspace"); this.listView_.appendChild(b); b.addClass("entryRemove"); - var d = Entry.createElement("div"); - d.addClass("entryVariableSettingVisibleWrapperWorkspace"); - d.bindOnClick(function(b) { + var c = Entry.createElement("div"); + c.addClass("entryVariableSettingVisibleWrapperWorkspace"); + c.bindOnClick(function(b) { b = a.selectedVariable; - var d = a.variableSettingView.visibleCheck; + var c = a.variableSettingView.visibleCheck; b.setVisible(!b.isVisible()); - b.isVisible() ? d.addClass("entryVariableSettingChecked") : d.removeClass("entryVariableSettingChecked"); + b.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); }); - b.appendChild(d); - var c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.show_variable; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableSettingCheckWorkspace"); - b.visibleCheck = c; - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableSettingInitValueWrapperWorkspace"); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.default_value; - d.appendChild(c); - c = Entry.createElement("input"); - c.addClass("entryVariableSettingInitValueInputWorkspace"); - b.initValueInput = c; - c.value = 0; - c.onkeyup = function(b) { + b.appendChild(c); + var d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.show_variable; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableSettingCheckWorkspace"); + b.visibleCheck = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingInitValueWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.default_value; + c.appendChild(d); + d = Entry.createElement("input"); + d.addClass("entryVariableSettingInitValueInputWorkspace"); + b.initValueInput = d; + d.value = 0; + d.onkeyup = function(b) { a.selectedVariable.setValue(this.value); }; - c.onblur = function(b) { + d.onblur = function(b) { a.selectedVariable.setValue(this.value); }; - b.initValueInput = c; - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryVariableSettingSplitterWorkspace"); - b.appendChild(d); - d = Entry.createElement("div"); - d.addClass("entryVariableSettingSlideWrapperWorkspace"); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.slide; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryVariableSettingCheckWorkspace"); - b.slideCheck = c; - d.appendChild(c); - d.bindOnClick(function(b) { - var d; + b.initValueInput = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingSplitterWorkspace"); + b.appendChild(c); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingSlideWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.slide; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableSettingCheckWorkspace"); + b.slideCheck = d; + c.appendChild(d); + c.bindOnClick(function(b) { + var c; b = a.selectedVariable; - var c = a.variables_, f = b.getType(); - "variable" == f ? (d = b.toJSON(), d.variableType = "slide", d = new Entry.Variable(d), c.splice(c.indexOf(b), 0, d), 0 > d.getValue() && d.setValue(0), 100 < d.getValue() && d.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (d = b.toJSON(), d.variableType = "variable", d = new Entry.Variable(d), c.splice(c.indexOf(b), 0, d), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - a.createVariableView(d); + var d = a.variables_, f = b.getType(); + "variable" == f ? (c = b.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = b.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + a.createVariableView(c); a.removeVariable(b); - a.updateSelectedVariable(d); - d.generateView(); + a.updateSelectedVariable(c); + c.generateView(); }); - d = Entry.createElement("div"); - b.minMaxWrapper = d; - d.addClass("entryVariableSettingMinMaxWrapperWorkspace"); - b.appendChild(d); - c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.min_value; - d.appendChild(c); + c = Entry.createElement("div"); + b.minMaxWrapper = c; + c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.min_value; + c.appendChild(d); var e = Entry.createElement("input"); e.addClass("entryVariableSettingMinValueInputWorkspace"); - c = a.selectedVariable; - e.value = c && "slide" == c.type ? c.minValue_ : 0; + d = a.selectedVariable; + e.value = d && "slide" == d.type ? d.minValue_ : 0; e.onkeypress = function(b) { 13 === b.keyCode && this.blur(); }; @@ -20793,14 +20865,14 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(this.value), a.updateVariableSettingView(b)); }; b.minValueInput = e; - d.appendChild(e); + c.appendChild(e); var f = Entry.createElement("span"); f.addClass("entryVariableSettingMaxValueSpanWorkspace"); f.innerHTML = Lang.Workspace.max_value; - d.appendChild(f); + c.appendChild(f); var g = Entry.createElement("input"); g.addClass("entryVariableSettingMaxValueInputWorkspace"); - g.value = c && "slide" == c.type ? c.maxValue_ : 100; + g.value = d && "slide" == d.type ? d.maxValue_ : 100; g.onkeypress = function(b) { 13 === b.keyCode && this.blur(); }; @@ -20808,15 +20880,15 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(this.value), a.updateVariableSettingView(b)); }; b.maxValueInput = g; - d.appendChild(g); + c.appendChild(g); }; Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { - var b = this.variableSettingView, d = b.visibleCheck, c = b.initValueInput, e = b.slideCheck, f = b.minValueInput, g = b.maxValueInput, h = b.minMaxWrapper; - d.removeClass("entryVariableSettingChecked"); - a.isVisible() && d.addClass("entryVariableSettingChecked"); + var b = this.variableSettingView, c = b.visibleCheck, d = b.initValueInput, e = b.slideCheck, f = b.minValueInput, g = b.maxValueInput, h = b.minMaxWrapper; + c.removeClass("entryVariableSettingChecked"); + a.isVisible() && c.addClass("entryVariableSettingChecked"); e.removeClass("entryVariableSettingChecked"); "slide" == a.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = a.getMinValue(), g.value = a.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - c.value = a.getValue(); + d.value = a.getValue(); a.listElement.appendChild(b); b.removeClass("entryRemove"); }; @@ -20829,89 +20901,89 @@ Entry.VariableContainer.prototype.generateListSettingView = function() { b.addClass("entryListSettingWorkspace"); this.listView_.appendChild(b); b.addClass("entryRemove"); - var d = Entry.createElement("div"); - d.addClass("entryListSettingVisibleWrapperWorkspace"); - d.bindOnClick(function(b) { + var c = Entry.createElement("div"); + c.addClass("entryListSettingVisibleWrapperWorkspace"); + c.bindOnClick(function(b) { b = a.selectedList; - var d = a.listSettingView.visibleCheck; + var c = a.listSettingView.visibleCheck; b.setVisible(!b.isVisible()); - b.isVisible() ? d.addClass("entryListSettingCheckedWorkspace") : d.removeClass("entryListSettingCheckedWorkspace"); + b.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); }); - b.appendChild(d); - var c = Entry.createElement("span"); - c.innerHTML = Lang.Workspace.show_list_workspace; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryListSettingCheckWorkspace"); - b.visibleCheck = c; - d.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryListSettingLengthWrapperWorkspace"); + b.appendChild(c); + var d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.show_list_workspace; + c.appendChild(d); d = Entry.createElement("span"); - d.addClass("entryListSettingLengthSpanWorkspace"); - d.innerHTML = Lang.Workspace.number_of_list; + d.addClass("entryListSettingCheckWorkspace"); + b.visibleCheck = d; c.appendChild(d); - b.appendChild(c); d = Entry.createElement("div"); - d.addClass("entryListSettingLengthControllerWorkspace"); - c.appendChild(d); + d.addClass("entryListSettingLengthWrapperWorkspace"); c = Entry.createElement("span"); - c.addClass("entryListSettingMinusWorkspace"); - c.bindOnClick(function(b) { + c.addClass("entryListSettingLengthSpanWorkspace"); + c.innerHTML = Lang.Workspace.number_of_list; + d.appendChild(c); + b.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryListSettingLengthControllerWorkspace"); + d.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryListSettingMinusWorkspace"); + d.bindOnClick(function(b) { a.selectedList.array_.pop(); a.updateListSettingView(a.selectedList); }); - d.appendChild(c); - c = Entry.createElement("input"); - c.addClass("entryListSettingLengthInputWorkspace"); - c.onblur = function() { + c.appendChild(d); + d = Entry.createElement("input"); + d.addClass("entryListSettingLengthInputWorkspace"); + d.onblur = function() { a.setListLength(this.value); }; - c.onkeypress = function(b) { + d.onkeypress = function(b) { 13 == b.keyCode && this.blur(); }; - b.lengthInput = c; - d.appendChild(c); - c = Entry.createElement("span"); - c.addClass("entryListSettingPlusWorkspace"); - c.bindOnClick(function(b) { + b.lengthInput = d; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryListSettingPlusWorkspace"); + d.bindOnClick(function(b) { a.selectedList.array_.push({data:0}); a.updateListSettingView(a.selectedList); }); - d.appendChild(c); - d = Entry.createElement("div"); - b.seperator = d; - b.appendChild(d); - d.addClass("entryListSettingSeperatorWorkspace"); - d = Entry.createElement("div"); - d.addClass("entryListSettingListValuesWorkspace"); - b.listValues = d; - b.appendChild(d); + c.appendChild(d); + c = Entry.createElement("div"); + b.seperator = c; + b.appendChild(c); + c.addClass("entryListSettingSeperatorWorkspace"); + c = Entry.createElement("div"); + c.addClass("entryListSettingListValuesWorkspace"); + b.listValues = c; + b.appendChild(c); }; Entry.VariableContainer.prototype.updateListSettingView = function(a) { var b = this; a = a || this.selectedList; - var d = this.listSettingView, c = d.listValues, e = d.visibleCheck, f = d.lengthInput, g = d.seperator; + var c = this.listSettingView, d = c.listValues, e = c.visibleCheck, f = c.lengthInput, g = c.seperator; e.removeClass("entryListSettingCheckedWorkspace"); a.isVisible() && e.addClass("entryListSettingCheckedWorkspace"); f.value = a.array_.length; - for (a.listElement.appendChild(d);c.firstChild;) { - c.removeChild(c.firstChild); + for (a.listElement.appendChild(c);d.firstChild;) { + d.removeChild(d.firstChild); } var h = a.array_; 0 === h.length ? g.addClass("entryRemove") : g.removeClass("entryRemove"); for (e = 0;e < h.length;e++) { - (function(d) { + (function(c) { var e = Entry.createElement("div"); e.addClass("entryListSettingValueWrapperWorkspace"); var f = Entry.createElement("span"); f.addClass("entryListSettingValueNumberSpanWorkspace"); - f.innerHTML = d + 1; + f.innerHTML = c + 1; e.appendChild(f); f = Entry.createElement("input"); - f.value = h[d].data; + f.value = h[c].data; f.onblur = function() { - h[d].data = this.value; + h[c].data = this.value; a.updateView(); }; f.onkeypress = function(b) { @@ -20921,28 +20993,28 @@ Entry.VariableContainer.prototype.updateListSettingView = function(a) { e.appendChild(f); f = Entry.createElement("span"); f.bindOnClick(function() { - h.splice(d, 1); + h.splice(c, 1); b.updateListSettingView(); }); f.addClass("entryListSettingValueRemoveWorkspace"); e.appendChild(f); - c.appendChild(e); + d.appendChild(e); })(e); } a.updateView(); - d.removeClass("entryRemove"); + c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(a) { a = Number(a); var b = this.selectedList.array_; if (!isNaN(a)) { - var d = b.length; - if (d < a) { - for (a -= d, d = 0;d < a;d++) { + var c = b.length; + if (c < a) { + for (a -= c, c = 0;c < a;c++) { b.push({data:0}); } } else { - d > a && (b.length = a); + c > a && (b.length = a); } } this.updateListSettingView(); @@ -20960,12 +21032,12 @@ Entry.VariableContainer.prototype.updateSelectedVariable = function(a, b) { a ? "variable" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "slide" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "list" == a.type && (this.selectedList = a, this.updateListSettingView(a)) : (this.selectedVariable = null, "variable" == (b || "variable") ? this.variableSettingView.addClass("entryRemove") : this.listSettingView.addClass("entryRemove")); }; Entry.VariableContainer.prototype.removeLocalVariables = function(a) { - var b = [], d = this; - this.mapVariable(function(a, d) { - a.object_ && a.object_ == d && b.push(a); + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c && b.push(a); }, a); b.map(function(b) { - d.removeVariable(b); + c.removeVariable(b); }); }; Entry.VariableContainer.prototype.updateCloudVariables = function() { @@ -20986,37 +21058,37 @@ Entry.VariableContainer.prototype.updateCloudVariables = function() { }; Entry.VariableContainer.prototype.addRef = function(a, b) { if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - var d = {object:b.getCode().object, block:b}; - b.funcBlock && (d.funcBlock = b.funcBlock, delete b.funcBlock); - this[a].push(d); + var c = {object:b.getCode().object, block:b}; + b.funcBlock && (c.funcBlock = b.funcBlock, delete b.funcBlock); + this[a].push(c); if ("_functionRefs" == a) { a = b.type.substr(5); - for (var c = Entry.variableContainer.functions_[a].content.getBlockList(), e = 0;e < c.length;e++) { - b = c[e]; + for (var d = Entry.variableContainer.functions_[a].content.getBlockList(), e = 0;e < d.length;e++) { + b = d[e]; var f = b.events; -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (f && f.viewAdd && f.viewAdd.forEach(function(a) { - b.getCode().object = d.object; - a && (b.funcBlock = d.block, a(b)); + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); }), f && f.dataAdd && f.dataAdd.forEach(function(a) { - b.getCode().object = d.object; - a && (b.funcBlock = d.block, a(b)); + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); })); } } - return d; + return c; } }; Entry.VariableContainer.prototype.removeRef = function(a, b) { if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - for (var d = this[a], c = 0;c < d.length;c++) { - if (d[c].block == b) { - d.splice(c, 1); + for (var c = this[a], d = 0;d < c.length;d++) { + if (c[d].block == b) { + c.splice(d, 1); break; } } - if ("_functionRefs" == a && (a = b.type.substr(5), c = Entry.variableContainer.functions_[a])) { - for (d = c.content.getBlockList(), c = 0;c < d.length;c++) { - b = d[c]; + if ("_functionRefs" == a && (a = b.type.substr(5), d = Entry.variableContainer.functions_[a])) { + for (c = d.content.getBlockList(), d = 0;d < c.length;d++) { + b = c[d]; var e = b.events; -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (e && e.viewDestroy && e.viewDestroy.forEach(function(a) { a && a(b); @@ -21054,12 +21126,13 @@ Entry.block.jr_repeat = {skeleton:"pebble_loop", color:"#127CDB", template:"%1 \ if (0 < this.repeatCount) { this.repeatCount--; var a = this.block.statements[0]; - if (0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + if (0 === a.getBlocks().length) { + return; } - } else { - delete this.repeatCount; + this.executor.stepInto(a); + return Entry.STATIC.CONTINUE; } + delete this.repeatCount; }}; Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf43 \ubaa8\uc73c\uae30 %1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_item_image.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { if (this.isContinue) { @@ -21104,27 +21177,27 @@ Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, d = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { b.isAction = !1; }); }, 3); - }, c; + }, d; switch(Ntry.unitComp.direction) { case Ntry.STATIC.EAST: - c = a.TURN_LEFT; + d = a.TURN_LEFT; break; case Ntry.STATIC.SOUTH: - c = a.HALF_ROTATION; + d = a.HALF_ROTATION; break; case Ntry.STATIC.WEST: - c = a.TURN_RIGHT; + d = a.TURN_RIGHT; break; default: - d(); + c(); } - c && Ntry.dispatchEvent("unitAction", c, d); + d && Ntry.dispatchEvent("unitAction", d, c); return Entry.STATIC.CONTINUE; } }}; @@ -21138,27 +21211,27 @@ Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this, d = function() { + var b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", a.WALK, function() { b.isAction = !1; }); }, 3); - }, c; + }, d; switch(Ntry.unitComp.direction) { case a.SOUTH: - c = a.TURN_LEFT; + d = a.TURN_LEFT; break; case a.WEST: - c = a.HALF_ROTATION; + d = a.HALF_ROTATION; break; case a.NORTH: - c = a.TURN_RIGHT; + d = a.TURN_RIGHT; break; default: - d(); + c(); } - c && Ntry.dispatchEvent("unitAction", c, d); + d && Ntry.dispatchEvent("unitAction", d, c); return Entry.STATIC.CONTINUE; } }}; @@ -21171,27 +21244,27 @@ Entry.block.jr_south = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, d = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { b.isAction = !1; }); }, 3); - }, c; + }, d; switch(Ntry.unitComp.direction) { case a.EAST: - c = a.TURN_RIGHT; + d = a.TURN_RIGHT; break; case a.NORTH: - c = a.HALF_ROTATION; + d = a.HALF_ROTATION; break; case a.WEST: - c = a.TURN_LEFT; + d = a.TURN_LEFT; break; default: - d(); + c(); } - c && Ntry.dispatchEvent("unitAction", c, d); + d && Ntry.dispatchEvent("unitAction", d, c); return Entry.STATIC.CONTINUE; } }}; @@ -21204,27 +21277,27 @@ Entry.block.jr_west = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, d = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", a.WALK, function() { b.isAction = !1; }); }, 3); - }, c; + }, d; switch(Ntry.unitComp.direction) { case a.SOUTH: - c = a.TURN_RIGHT; + d = a.TURN_RIGHT; break; case a.EAST: - c = a.HALF_ROTATION; + d = a.HALF_ROTATION; break; case a.NORTH: - c = a.TURN_LEFT; + d = a.TURN_LEFT; break; default: - d(); + c(); } - c && Ntry.dispatchEvent("unitAction", c, d); + d && Ntry.dispatchEvent("unitAction", d, c); return Entry.STATIC.CONTINUE; } }}; @@ -21307,9 +21380,9 @@ Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", temp }}; Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); @@ -21325,9 +21398,9 @@ Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", templa }}; Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); @@ -21371,12 +21444,13 @@ Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB" if (0 < this.repeatCount) { this.repeatCount--; var a = this.block.statements[0]; - if (0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + if (0 === a.getBlocks().length) { + return; } - } else { - delete this.repeatCount; + this.executor.stepInto(a); + return Entry.STATIC.CONTINUE; } + delete this.repeatCount; }}; Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { }}; @@ -21394,17 +21468,17 @@ Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#4 }}; Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); b = {x:b.x, y:b.y}; Ntry.addVectorByDirection(b, a.direction, 1); - d = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}); + c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}); a = this.block.statements[0]; - if (0 === d.length) { + if (0 === c.length) { return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); @@ -21416,9 +21490,9 @@ Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB }}; Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); @@ -21451,9 +21525,9 @@ Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color: }}; Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); @@ -21469,9 +21543,9 @@ Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB }}; Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, d; - for (d in a) { - b = a[d]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); @@ -21537,13 +21611,13 @@ Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", temp }}; Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { }}; -Entry.Thread = function(a, b, d) { +Entry.Thread = function(a, b, c) { this._data = new Entry.Collection; this._code = b; this.changeEvent = new Entry.Event(this); this.changeEvent.attach(this, this.handleChange); this._event = null; - this.parent = d ? d : b; + this.parent = c ? c : b; this.load(a); }; (function(a) { @@ -21618,8 +21692,8 @@ Entry.Thread = function(a, b, d) { a.destroy = function(b) { this._code.destroyThread(this, !1); this.view && this.view.destroy(b); - for (var a = this._data, c = a.length - 1;0 <= c;c--) { - a[c].destroy(b); + for (var a = this._data, d = a.length - 1;0 <= d;d--) { + a[d].destroy(b); } }; a.getBlock = function(b) { @@ -21632,10 +21706,10 @@ Entry.Thread = function(a, b, d) { }; a.countBlock = function() { for (var b = 0, a = 0;a < this._data.length;a++) { - var c = this._data[a]; - if (c.type && (b++, c = c.statements)) { - for (var e = 0;e < c.length;e++) { - b += c[e].countBlock(); + var d = this._data[a]; + if (d.type && (b++, d = d.statements)) { + for (var e = 0;e < d.length;e++) { + b += d[e].countBlock(); } } } @@ -21676,23 +21750,23 @@ Entry.Thread = function(a, b, d) { if (b == c.type) { return !0; } - for (var f = c.params, g = 0;g < f.length;g++) { - var h = f[g]; + for (var d = c.params, e = 0;e < d.length;e++) { + var h = d[e]; if (h && h.constructor == Entry.Block && a(h)) { return !0; } } if (c = c.statements) { - for (f = 0;f < c.length;f++) { - if (c[f].hasBlockType(b)) { + for (d = 0;d < c.length;d++) { + if (c[d].hasBlockType(b)) { return !0; } } } return !1; } - for (var c = 0;c < this._data.length;c++) { - if (a(this._data[c])) { + for (var d = 0;d < this._data.length;d++) { + if (a(this._data[d])) { return !0; } } @@ -21762,28 +21836,28 @@ Entry.skeleton.basic_event = {path:function(a) { return {x:1, y:15}; }}; Entry.skeleton.basic_loop = {path:function(a) { - var b = a.contentWidth, d = a.contentHeight, d = Math.max(30, d + 2), b = Math.max(0, b + 9 - d / 2); + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); a = a._statements[0] ? a._statements[0].height : 20; a = Math.max(a, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h/gi, d / 2).replace(/%sh/gi, a + 1); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, a + 1); }, magnets:function(a) { - var b = Math.max(a.contentHeight + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, d = Math.max(d, 20); - return {previous:{x:0, y:0}, next:{x:0, y:d + b + 18 + a.offsetY}}; + var b = Math.max(a.contentHeight + 2, 30), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 20); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 18 + a.offsetY}}; }, box:function(a) { - var b = a.contentWidth, d = Math.max(a.contentHeight + 2, 30); + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 30); a = a._statements[0] ? a._statements[0].height : 20; a = Math.max(a, 20); - return {offsetX:-8, offsetY:0, width:b + 30, height:d + a + 17, marginBottom:0}; + return {offsetX:-8, offsetY:0, width:b + 30, height:c + a + 17, marginBottom:0}; }, statementPos:function(a) { return [{x:16, y:Math.max(30, a.contentHeight + 2) + 1}]; }, contentPos:function(a) { return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; }}; Entry.skeleton.basic_define = {path:function(a) { - var b = a.contentWidth, d = a.contentHeight, d = Math.max(30, d + 2), b = Math.max(0, b + 9 - d / 2); + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); a = a._statements[0] ? a._statements[0].height : 30; a = Math.max(a, 20); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, d).replace(/%w/gi, b).replace(/%h/gi, d / 2).replace(/%bw/gi, b - 8).replace(/%sh/gi, a + 1); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%h/gi, c / 2).replace(/%bw/gi, b - 8).replace(/%sh/gi, a + 1); }, magnets:function() { return {}; }, box:function(a) { @@ -21806,13 +21880,13 @@ Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(a) { a = Math.max(a._statements[0] ? a._statements[0].height : 50, 50); return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, a + 4).replace(/%cih/gi, a - 50); }, magnets:function(a) { - var b = Math.max(a.contentHeight + 2, 41), d = a._statements[0] ? a._statements[0].height : 20, d = Math.max(d, 51); - return {previous:{x:0, y:0}, next:{x:0, y:d + b + 13 + a.offsetY}}; + var b = Math.max(a.contentHeight + 2, 41), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 51); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 13 + a.offsetY}}; }, box:function(a) { - var b = a.contentWidth, d = Math.max(a.contentHeight + 2, 41); + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 41); a = a._statements[0] ? a._statements[0].height : 20; a = Math.max(a, 51); - return {offsetX:-(b / 2 + 13), offsetY:0, width:b + 30, height:d + a + 13, marginBottom:0}; + return {offsetX:-(b / 2 + 13), offsetY:0, width:b + 30, height:c + a + 13, marginBottom:0}; }, statementPos:function(a) { return [{x:0, y:Math.max(39, a.contentHeight + 2) + 1.5}]; }, contentPos:function() { @@ -21882,21 +21956,21 @@ Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:En return {previous:{x:0, y:0}}; }}; Entry.skeleton.basic_double_loop = {path:function(a) { - var b = a.contentWidth, d = a.contentHeight % 1E6, c = Math.floor(a.contentHeight / 1E6), d = Math.max(30, d + 2), c = Math.max(30, c + 2), b = Math.max(0, b + 5 - d / 2), e = a._statements; + var b = a.contentWidth, c = a.contentHeight % 1E6, d = Math.floor(a.contentHeight / 1E6), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; a = e[0] ? e[0].height : 20; e = e[1] ? e[1].height : 20; a = Math.max(a, 20); e = Math.max(e, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, d).replace(/%wh2/gi, c).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, d / 2).replace(/%h2/gi, c / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); + return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); }, magnets:function(a) { - var b = Math.max(a.contentHeight % 1E6 + 2, 30), d = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), c = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, c = Math.max(c, 20), e = Math.max(e, 20); - return {previous:{x:0, y:0}, next:{x:0, y:c + e + b + d + 19 + a.offsetY}}; + var b = Math.max(a.contentHeight % 1E6 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); + return {previous:{x:0, y:0}, next:{x:0, y:d + e + b + c + 19 + a.offsetY}}; }, box:function(a) { - var b = a.contentWidth, d = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), c = Math.max(a.contentHeight % 1E6 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E6 : 20; + var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = Math.max(a.contentHeight % 1E6 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E6 : 20; a = a._statements[1] ? a._statements[1].height : 20; e = Math.max(e, 20); a = Math.max(a, 20); - return {offsetX:-8, offsetY:0, width:b + 30, height:d + c + e + a + 17, marginBottom:0}; + return {offsetX:-8, offsetY:0, width:b + 30, height:c + d + e + a + 17, marginBottom:0}; }, statementPos:function(a) { var b = Math.max(30, a.contentHeight % 1E6 + 2) + 1; return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30) + 1}]; @@ -21904,7 +21978,7 @@ Entry.skeleton.basic_double_loop = {path:function(a) { return {x:14, y:Math.max(a.contentHeight % 1E6, 28) / 2 + 1}; }}; Entry.Block = function(a, b) { - var d = this; + var c = this; Entry.Model(this, !1); this._schema = null; this.setThread(b); @@ -21912,7 +21986,7 @@ Entry.Block = function(a, b) { a = this.getCode(); a.registerBlock(this); (b = this.events.dataAdd) && a.object && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(d); + Entry.Utils.isFunction(b) && b(c); }); }; Entry.Block.MAGNET_RANGE = 10; @@ -21942,8 +22016,8 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; if (b) { for (var a in b) { this.events[a] || (this.events[a] = []); - for (var c = b[a], e = 0;e < c.length;e++) { - var f = c[e]; + for (var d = b[a], e = 0;e < d.length;e++) { + var f = d[e]; f && 0 > this.events[a].indexOf(f) && this.events[a].push(f); } } @@ -21952,7 +22026,7 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; b = this.params; a = this._schema.params; for (e = 0;a && e < a.length;e++) { - c = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !c || "Output" !== a[e].type && "Block" !== a[e].type || (c = new Entry.Block(c, this.thread)), f ? b.splice(e, 1, c) : b.push(c); + d = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !d || "Output" !== a[e].type && "Block" !== a[e].type || (d = new Entry.Block(d, this.thread)), f ? b.splice(e, 1, d) : b.push(d); } if (b = this._schema.statements) { for (e = 0;e < b.length;e++) { @@ -22093,17 +22167,17 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; a.copy = function() { var b = this.getThread(), a = []; if (b instanceof Entry.Thread) { - for (var c = b.getBlocks().indexOf(this), b = b.toJSON(!0, c), c = 0;c < b.length;c++) { - a.push(b[c]); + for (var d = b.getBlocks().indexOf(this), b = b.toJSON(!0, d), d = 0;d < b.length;d++) { + a.push(b[d]); } } else { a.push(this.toJSON(!0)); } b = this.view.getAbsoluteCoordinate(); - c = a[0]; - c.x = b.x + 15; - c.y = b.y + 15; - c.id = Entry.Utils.generateId(); + d = a[0]; + d.x = b.x + 15; + d.y = b.y + 15; + d.id = Entry.Utils.generateId(); return a; }; a.copyToClipboard = function() { @@ -22194,11 +22268,11 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; return JSON.stringify(this.toJSON()); }; })(Entry.Block.prototype); -Entry.BlockMenu = function(a, b, d, c) { +Entry.BlockMenu = function(a, b, c, d) { Entry.Model(this, !1); this._align = b || "CENTER"; this.setAlign(this._align); - this._scroll = void 0 !== c ? c : !1; + this._scroll = void 0 !== d ? d : !1; this._bannedClass = []; this._categories = []; this.suffix = "blockMenu"; @@ -22210,8 +22284,8 @@ Entry.BlockMenu = function(a, b, d, c) { this.visible = !0; this._svgId = "blockMenu" + (new Date).getTime(); this._clearCategory(); - this._categoryData = d; - this._generateView(d); + this._categoryData = c; + this._generateView(c); this._splitters = []; this.setWidth(); this.svg = Entry.SVG(this._svgId); @@ -22225,7 +22299,7 @@ Entry.BlockMenu = function(a, b, d, c) { this.svgBlockGroup = this.svgGroup.elem("g"); this.svgBlockGroup.board = this; this.changeEvent = new Entry.Event(this); - d && this._generateCategoryCodes(d); + c && this._generateCategoryCodes(c); this.observe(this, "_handleDragBlock", ["dragBlock"]); this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(a)); Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); @@ -22235,20 +22309,20 @@ Entry.BlockMenu = function(a, b, d, c) { (function(a) { a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; a._generateView = function(b) { - var a = this.view, c = this; + var a = this.view, d = this; b && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:a}), this._generateCategoryView(b)); this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:a}); this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); this.svgDom.mouseenter(function(b) { - c._scroller && c._scroller.setOpacity(1); - b = c.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = c.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); + d._scroller && d._scroller.setOpacity(1); + b = d.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = d.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); }); this.svgDom.mouseleave(function(b) { - Entry.playground && !Entry.playground.resizing && (c._scroller && c._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); }); $(window).scroll(function() { - c.updateOffset(); + d.updateOffset(); }); }; a.changeCode = function(b) { @@ -22281,9 +22355,9 @@ Entry.BlockMenu = function(a, b, d, c) { this._clearSplitters(); a.view && !b && a.view.reDraw(); b = a.getThreads(); - for (var a = 10, c = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { + for (var a = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { var h = b[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = c - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); } this.updateSplitters(); this.changeEvent.notify(); @@ -22291,12 +22365,12 @@ Entry.BlockMenu = function(a, b, d, c) { }; a.cloneToGlobal = function(b) { if (!this._boardBlockView && null !== this.dragBlock) { - var a = this.workspace, c = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; - if (!g || c != Entry.Workspace.MODE_BOARD && c != Entry.Workspace.MODE_OVERLAYBOARD) { + var a = this.workspace, d = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; + if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { Entry.GlobalSvg.setView(e, a.getMode()) && Entry.GlobalSvg.addControl(b); } else { - if (g.code && (a = e.block, c = a.getThread(), a && c)) { - a = c.toJSON(!0); + if (g.code && (a = e.block, d = a.getThread(), a && d)) { + a = d.toJSON(!0); this._boardBlockView = Entry.do("addThread", a).value.getFirstBlock().view; var g = this.offset().top - g.offset().top, h, k; if (a = this.dragBlock.mouseDownCoordinate) { @@ -22315,8 +22389,8 @@ Entry.BlockMenu = function(a, b, d, c) { if (b) { this.workspace.getBoard(); this._boardBlockView = null; - var a = Entry.GlobalSvg.left, c = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; - return a < b - c; + var a = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; + return a < b - d; } } }; @@ -22338,16 +22412,16 @@ Entry.BlockMenu = function(a, b, d, c) { a.renderText = function(b) { var a = this.code.getThreads(); this.code.mode = "text"; - for (var c = 0;c < a.length;c++) { - a[c].view.renderText(); + for (var d = 0;d < a.length;d++) { + a[d].view.renderText(); } b && b(); }; a.renderBlock = function(b) { var a = this.code.getThreads(); this.code.mode = "code"; - for (var c = 0;c < a.length;c++) { - a[c].view.renderBlock(); + for (var d = 0;d < a.length;d++) { + a[d].view.renderBlock(); } b && b(); }; @@ -22357,10 +22431,10 @@ Entry.BlockMenu = function(a, b, d, c) { }; a.updateSplitters = function(b) { b = void 0 === b ? 0 : b; - var a = this._svgWidth - 20, c; - this._splitters.forEach(function(e) { - c = parseFloat(e.getAttribute("y1")) + b; - e.attr({x2:a, y1:c, y2:c}); + var a = this._svgWidth - 20, d; + this._splitters.forEach(function(c) { + d = parseFloat(c.getAttribute("y1")) + b; + c.attr({x2:a, y1:d, y2:d}); }); }; a._clearSplitters = function() { @@ -22373,13 +22447,13 @@ Entry.BlockMenu = function(a, b, d, c) { this.updateSplitters(); }; a.setMenu = function() { - var b = this._categoryCodes, a = this._categoryElems, c; - for (c in b) { - for (var e = b[c], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { + var b = this._categoryCodes, a = this._categoryElems, d; + for (d in b) { + for (var e = b[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; this.checkBanClass(Entry.block[h]) && f--; } - 0 === f ? a[c].addClass("entryRemove") : a[c].removeClass("entryRemove"); + 0 === f ? a[d].addClass("entryRemove") : a[d].removeClass("entryRemove"); } }; a.getCategoryCodes = function(b) { @@ -22394,9 +22468,9 @@ Entry.BlockMenu = function(a, b, d, c) { return b; } b = Number(b); - for (var a = this._categories, c = this._categoryElems, e = 0;e < a.length;e++) { + for (var a = this._categories, d = this._categoryElems, e = 0;e < a.length;e++) { var f = a[e]; - if (!c[f].hasClass("entryRemove") && 0 === b--) { + if (!d[f].hasClass("entryRemove") && 0 === b--) { return f; } } @@ -22427,8 +22501,8 @@ Entry.BlockMenu = function(a, b, d, c) { a._generateCategoryCodes = function(b) { this._categoryCodes = {}; for (var a = 0;a < b.length;a++) { - var c = b[a], e = []; - c.blocks.forEach(function(b) { + var d = b[a], e = []; + d.blocks.forEach(function(b) { var a = Entry.block[b]; if (a && a.def) { if (a.defs) { @@ -22442,9 +22516,9 @@ Entry.BlockMenu = function(a, b, d, c) { e.push([{type:b}]); } }); - c = c.category; - this._categories.push(c); - this._categoryCodes[c] = e; + d = d.category; + this._categories.push(d); + this._categoryCodes[d] = e; } }; a.banClass = function(b, a) { @@ -22481,11 +22555,11 @@ Entry.BlockMenu = function(a, b, d, c) { b.stopPropagation && b.stopPropagation(); b.preventDefault && b.preventDefault(); b = Entry.Utils.convertMouseEvent(b); - var d = e.dragInstance; - e._scroller.scroll(-b.pageY + d.offsetY); - d.set({offsetY:b.pageY}); + var a = e.dragInstance; + e._scroller.scroll(-b.pageY + a.offsetY); + a.set({offsetY:b.pageY}); } - function c(b) { + function d(b) { $(document).unbind(".blockMenu"); delete e.dragInstance; } @@ -22497,9 +22571,9 @@ Entry.BlockMenu = function(a, b, d, c) { Entry.documentMousedown && Entry.documentMousedown.notify(b); var f = $(document); f.bind("mousemove.blockMenu", a); - f.bind("mouseup.blockMenu", c); + f.bind("mouseup.blockMenu", d); f.bind("touchmove.blockMenu", a); - f.bind("touchend.blockMenu", c); + f.bind("touchend.blockMenu", d); this.dragInstance = new Entry.DragInstance({startY:b.pageY, offsetY:b.pageY}); } }; @@ -22521,8 +22595,8 @@ Entry.BlockMenu = function(a, b, d, c) { this._scroller && this._scroller.setOpacity(0); }; a._captureKeyEvent = function(b) { - var a = b.keyCode, c = Entry.type; - b.ctrlKey && "workspace" == c && 48 < a && 58 > a && (b.preventDefault(), this.selectMenu(a - 49)); + var a = b.keyCode, d = Entry.type; + b.ctrlKey && "workspace" == d && 48 < a && 58 > a && (b.preventDefault(), this.selectMenu(a - 49)); }; a.setPatternRectFill = function(b) { this.patternRect.attr({fill:b}); @@ -22541,8 +22615,8 @@ Entry.BlockMenu = function(a, b, d, c) { this._categoryElems = {}; b = this._categoryCodes; for (a in b) { - var c = b[a]; - c.constructor == Entry.Code && c.clear(); + var d = b[a]; + d.constructor == Entry.Code && d.clear(); } this._categoryCodes = null; }; @@ -22561,11 +22635,11 @@ Entry.BlockMenu = function(a, b, d, c) { }; a._generateCategoryElement = function(b) { var a = this; - (function(b, e) { - b.text(Lang.Blocks[e.toUpperCase()]); - a._categoryElems[e] = b; + (function(b, c) { + b.text(Lang.Blocks[c.toUpperCase()]); + a._categoryElems[c] = b; b.bindOnClick(function(b) { - a.selectMenu(e); + a.selectMenu(c); }); })(Entry.Dom("li", {id:"entryCategory" + b, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), b); }; @@ -22579,15 +22653,15 @@ Entry.BlockMenu = function(a, b, d, c) { a._generateHwCode = function() { var b = this._categoryCodes.arduino; b instanceof Entry.Code && b.clear(); - for (var a = this._categoryData, c, b = a.length - 1;0 <= b;b--) { + for (var a = this._categoryData, d, b = a.length - 1;0 <= b;b--) { if ("arduino" === a[b].category) { - c = a[b].blocks; + d = a[b].blocks; break; } } a = []; - for (b = 0;b < c.length;b++) { - var e = c[b], f = Entry.block[e]; + for (b = 0;b < d.length;b++) { + var e = d[b], f = Entry.block[e]; if (!this.checkBanClass(f)) { if (f && f.def) { if (f.defs) { @@ -22661,8 +22735,8 @@ Entry.BlockMenuScroller.RADIUS = 7; return this._visible; }; a._updateRatio = function() { - var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), c = b.blockMenuContainer.height(), b = b.offset(); - this.vRatio = a = (a.height + (a.top - b.top) + 10) / c; + var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), d = b.blockMenuContainer.height(), b = b.offset(); + this.vRatio = a = (a.height + (a.top - b.top) + 10) / d; 1 >= a ? this.setVisible(!1) : this.setVisible(!0); }; a._reset = function() { @@ -22675,11 +22749,11 @@ Entry.BlockMenuScroller.RADIUS = 7; b.stopPropagation && b.stopPropagation(); b.preventDefault && b.preventDefault(); b = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - var c = e.dragInstance; - e.scroll(b.pageY - c.offsetY); - c.set({offsetY:b.pageY}); + var a = e.dragInstance; + e.scroll(b.pageY - a.offsetY); + a.set({offsetY:b.pageY}); } - function c(b) { + function d(b) { $(document).unbind(".scroll"); delete e.dragInstance; } @@ -22692,9 +22766,9 @@ Entry.BlockMenuScroller.RADIUS = 7; f = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; var g = $(document); g.bind("mousemove.scroll", a); - g.bind("mouseup.scroll", c); + g.bind("mouseup.scroll", d); g.bind("touchmove.scroll", a); - g.bind("touchend.scroll", c); + g.bind("touchend.scroll", d); e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); } b.stopPropagation(); @@ -22703,8 +22777,8 @@ Entry.BlockMenuScroller.RADIUS = 7; $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); }; })(Entry.BlockMenuScroller.prototype); -Entry.BlockView = function(a, b, d) { - var c = this; +Entry.BlockView = function(a, b, c) { + var d = this; Entry.Model(this, !1); this.block = a; this._lazyUpdatePos = _.debounce(a._updatePos.bind(a), 200); @@ -22725,13 +22799,13 @@ Entry.BlockView = function(a, b, d) { e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; this.mouseHandler = function() { - var b = c.block.events; + var b = d.block.events; b && b.mousedown && b.mousedown.forEach(function(b) { - b(c); + b(d); }); - c.onMouseDown.apply(c, arguments); + d.onMouseDown.apply(d, arguments); }; - this._startRender(a, d); + this._startRender(a, c); this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); @@ -22802,10 +22876,10 @@ Entry.BlockView.pngMap = {}; case Entry.Workspace.MODE_BOARD: ; case Entry.Workspace.MODE_OVERLAYBOARD: - for (var c = /(%\d)/mi, e = (a.template ? a.template : Lang.template[this.block.type]).split(c), f = a.params, g = 0;g < e.length;g++) { + for (var d = /(%\d)/mi, e = (a.template ? a.template : Lang.template[this.block.type]).split(d), f = a.params, g = 0;g < e.length;g++) { var h = e[g].trim(); if (0 !== h.length) { - if (c.test(h)) { + if (d.test(h)) { var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, b, g); this._contents.push(h); this._paramMap[k] = h; @@ -22846,9 +22920,9 @@ Entry.BlockView.pngMap = {}; }; a.alignContent = function(b) { !0 !== b && (b = !1); - for (var a = 0, c = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { + for (var a = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { var l = this._contents[k]; - l instanceof Entry.FieldLineBreak ? (this._alignStatement(b, f), l.align(f), f++, c = l.box.y, a = 8) : (l.align(a, c, b), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (a += Entry.BlockView.PARAM_SPACE)); + l instanceof Entry.FieldLineBreak ? (this._alignStatement(b, f), l.align(f), f++, d = l.box.y, a = 8) : (l.align(a, d, b), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (a += Entry.BlockView.PARAM_SPACE)); l = l.box; 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); a += l.width; @@ -22888,13 +22962,13 @@ Entry.BlockView.pngMap = {}; this._moveTo(b.x, b.y, !1); this.getBoard().svgBlockGroup.appendChild(this.svgGroup); }; - a._moveTo = function(b, a, c) { + a._moveTo = function(b, a, d) { this.set({x:b, y:a}); this._lazyUpdatePos(); - this.visible && this.display && this._setPosition(c); + this.visible && this.display && this._setPosition(d); }; - a._moveBy = function(b, a, c) { - return this._moveTo(this.x + b, this.y + a, c); + a._moveBy = function(b, a, d) { + return this._moveTo(this.x + b, this.y + a, d); }; a._addControl = function() { var b = this; @@ -22912,7 +22986,7 @@ Entry.BlockView.pngMap = {}; $(this.svgGroup).unbind(".blockViewMousedown"); }; a.onMouseDown = function(b) { - function d(b) { + function c(b) { b.stopPropagation(); var c = g.workspace.getMode(), d; c === Entry.Workspace.MODE_VIMBOARD && a.vimBoardEvent(b, "dragOver"); @@ -22923,7 +22997,7 @@ Entry.BlockView.pngMap = {}; offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), b && g.generateCodeMagnetMap(), f._updateCloseBlock())); } } - function c(b) { + function d(b) { e && (clearTimeout(e), e = null); $(document).unbind(".block"); f.terminateDrag(b); @@ -22947,14 +23021,14 @@ Entry.BlockView.pngMap = {}; k = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; var l = $(document); - l.bind("mousemove.block touchmove.block", d); - l.bind("mouseup.block touchend.block", c); + l.bind("mousemove.block touchmove.block", c); + l.bind("mouseup.block touchend.block", d); this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); g.set({dragBlock:this}); this.addDragging(); this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; "touchstart" === h && (e = setTimeout(function() { - e && (e = null, c(), f._rightClick(b)); + e && (e = null, d(), f._rightClick(b)); }, 1E3)); } else { Entry.Utils.isRightButton(b) && this._rightClick(b); @@ -22962,31 +23036,31 @@ Entry.BlockView.pngMap = {}; g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && (vimBoard = $(".entryVimBoard>.CodeMirror")[0], document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event))); } }; - a.vimBoardEvent = function(b, a, c) { - b && (b = Entry.Utils.createMouseEvent(a, b), c && (b.block = c), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b)); + a.vimBoardEvent = function(b, a, d) { + b && (b = Entry.Utils.createMouseEvent(a, b), d && (b.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b)); }; a.terminateDrag = function(b) { - var a = this.getBoard(), c = this.dragMode, e = this.block, f = a.workspace.getMode(); + var a = this.getBoard(), d = this.dragMode, e = this.block, f = a.workspace.getMode(); this.removeDragging(); this.set({visible:!0}); this.dragMode = Entry.DRAG_MODE_NONE; if (f === Entry.Workspace.MODE_VIMBOARD) { a instanceof Entry.BlockMenu ? (a.terminateDrag(), this.vimBoardEvent(b, "dragEnd", e)) : a.clear(); } else { - if (c === Entry.DRAG_MODE_DRAG) { + if (d === Entry.DRAG_MODE_DRAG) { var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg, h = this.block.getPrevBlock(this.block); b = !1; switch(Entry.GlobalSvg.terminateDrag(this)) { case g.DONE: g = a.magnetedBlockView; g instanceof Entry.BlockView && (g = g.block); - h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = c, a.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), b = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", + h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, a.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), b = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", e); break; case g.RETURN: e = this.block; - c = this.originPos; - h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(c.x, c.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); + d = this.originPos; + h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); break; case g.REMOVE: createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); @@ -23002,9 +23076,9 @@ Entry.BlockView.pngMap = {}; a._updateCloseBlock = function() { var b = this.getBoard(), a; if (this._skeleton.magnets) { - for (var c in this.magnet) { - if (a = "next" === c ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), c) : this.getBoard().getNearestMagnet(this.x, this.y, c)) { - return b.setMagnetedBlock(a.view, c); + for (var d in this.magnet) { + if (a = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { + return b.setMagnetedBlock(a.view, d); } } b.setMagnetedBlock(null); @@ -23035,10 +23109,10 @@ Entry.BlockView.pngMap = {}; this._contents.forEach(function(b) { b.constructor !== Entry.Block && b.destroy(); }); - var c = this.block; - b = c.events.viewDestroy; + var d = this.block; + b = d.events.viewDestroy; "workspace" == Entry.type && b && !this.isInBlockMenu && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(c); + Entry.Utils.isFunction(b) && b(d); }); this._schemaChangeEvent && this._schemaChangeEvent.destroy(); }; @@ -23062,14 +23136,14 @@ Entry.BlockView.pngMap = {}; var b = this.svgGroup; if (this.magnet.next) { if (b = this.magneting) { - var a = this._board.dragBlock.getShadow(), c = this.getAbsoluteCoordinate(), e; + var a = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; if ("previous" === b) { - e = this.magnet.next, e = "translate(" + (c.x + e.x) + "," + (c.y + e.y) + ")"; + e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; } else { if ("next" === b) { e = this.magnet.previous; var f = this._board.dragBlock.getBelowHeight(); - e = "translate(" + (c.x + e.x) + "," + (c.y + e.y - f) + ")"; + e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; } } $(a).attr({transform:e, display:"block"}); @@ -23182,9 +23256,9 @@ Entry.BlockView.pngMap = {}; a._changeFill = function(b) { var a = this.getBoard(); if (a.patternRect && !a.dragBlock) { - var c = this._fillColor, e = this._path, a = this.getBoard(); - b ? (a.setPatternRectFill(c), c = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : a.disablePattern(); - e.attr({fill:c}); + var d = this._fillColor, e = this._path, a = this.getBoard(); + b ? (a.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : a.disablePattern(); + e.attr({fill:d}); } }; a.addActivated = function() { @@ -23199,14 +23273,14 @@ Entry.BlockView.pngMap = {}; requestAnimFrame(this._updateContents.bind(this)); var a = b.params; if (a) { - for (var c = 0;c < a.length;c++) { - var e = a[c]; + for (var d = 0;d < a.length;d++) { + var e = a[d]; e instanceof Entry.Block && e.view.reDraw(); } } if (b = b.statements) { - for (c = 0;c < b.length;c++) { - b[c].view.reDraw(); + for (d = 0;d < b.length;d++) { + b[d].view.reDraw(); } } } @@ -23305,16 +23379,16 @@ Entry.BlockView.pngMap = {}; a._rightClick = function(b) { var a = Entry.disposeEvent; a && a.notify(b); - var c = this, e = c.block; + var d = this, e = d.block; if (!this.isInBlockMenu) { var a = [], f = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { Entry.do("cloneBlock", e); }}, g = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { - c.block.copyToClipboard(); + d.block.copyToClipboard(); }}, h = {text:Lang.Blocks.Delete_Blocks, enable:e.isDeletable(), callback:function() { - Entry.do("destroyBlock", c.block); + Entry.do("destroyBlock", d.block); }}, k = {text:Lang.Menus.save_as_image, callback:function() { - c.downloadAsImage(); + d.downloadAsImage(); }}; a.push(f); a.push(g); @@ -23349,11 +23423,11 @@ Entry.Field = function() { a.destroyOption(); }); }; - a.align = function(b, a, c) { - var e = this.svgGroup; + a.align = function(b, a, d) { + var c = this.svgGroup; this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); var f = "translate(" + b + "," + a + ")"; - void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + void 0 === d || d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); this.box.set({x:b, y:a}); }; a.getAbsolutePosFromBoard = function() { @@ -23361,17 +23435,17 @@ Entry.Field = function() { return {x:b.x + this.box.x + a.x, y:b.y + this.box.y + a.y}; }; a.getAbsolutePosFromDocument = function() { - var b = this._block.view, a = b.getContentPos(), c = b.getAbsoluteCoordinate(), b = b.getBoard().svgDom.offset(); - return {x:c.x + this.box.x + a.x + b.left, y:c.y + this.box.y + a.y + b.top}; + var b = this._block.view, a = b.getContentPos(), d = b.getAbsoluteCoordinate(), b = b.getBoard().svgDom.offset(); + return {x:d.x + this.box.x + a.x + b.left, y:d.y + this.box.y + a.y + b.top}; }; a.getRelativePos = function() { var b = this._block.view.getContentPos(), a = this.box; return {x:a.x + b.x, y:a.y + b.y}; }; a.truncate = function() { - var b = String(this.getValue()), a = this.TEXT_LIMIT_LENGTH, c = b.substring(0, a); - b.length > a && (c += "..."); - return c; + var b = String(this.getValue()), a = this.TEXT_LIMIT_LENGTH, d = b.substring(0, a); + b.length > a && (d += "..."); + return d; }; a.appendSvgOptionGroup = function() { return this._block.view.getBoard().svgGroup.elem("g"); @@ -23390,12 +23464,12 @@ Entry.Field = function() { if (!0 === a.disableMouseEvent) { return !1; } - var c = a.workspace.selectedBlockView; - if (!c || a != c.getBoard()) { + var d = a.workspace.selectedBlockView; + if (!d || a != d.getBoard()) { return !1; } a = b.getSvgRoot(); - return a == c.svgGroup || $(a).has($(b.svgGroup)); + return a == d.svgGroup || $(a).has($(b.svgGroup)); }; a._selectBlockView = function() { var b = this._block.view; @@ -23420,14 +23494,14 @@ Entry.Field = function() { return Entry.isMobile() ? 22 : 16; }; })(Entry.Field.prototype); -Entry.FieldBlock = function(a, b, d, c, e) { +Entry.FieldBlock = function(a, b, c, d, e) { Entry.Model(this, !1); this._blockView = b; this._block = b.block; this._valueBlock = null; this.box = new Entry.BoxModel; this.changeEvent = new Entry.Event(this); - this._index = d; + this._index = c; this.contentIndex = e; this._content = a; this.acceptType = a.accept; @@ -23437,7 +23511,7 @@ Entry.FieldBlock = function(a, b, d, c, e) { this._position = a.position; this.box.observe(b, "alignContent", ["width", "height"]); this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(b.getBoard(), c); + this.renderStart(b.getBoard(), d); }; Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); (function(a) { @@ -23452,13 +23526,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); this.updateValueBlock(c); this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); }; - a.align = function(b, a, c) { - var e = this.svgGroup; + a.align = function(b, a, d) { + var c = this.svgGroup; this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); var f = this._valueBlock; f && (a = -.5 * f.view.height); f = "translate(" + b + "," + a + ")"; - void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + void 0 === d || d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); this.box.set({x:b, y:a}); }; a.calcWH = function() { @@ -23563,8 +23637,8 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); this._block.getThread(); var a = this._blockView.getBoard(); b = new Entry.Block({type:b}, this); - var c = a.workspace, e; - c && (e = c.getMode()); + var d = a.workspace, e; + d && (e = d.getMode()); b.createView(a, e); return b; }; @@ -23583,9 +23657,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); return this._block.pointer(b); }; })(Entry.FieldBlock.prototype); -Entry.Scroller = function(a, b, d) { +Entry.Scroller = function(a, b, c) { this._horizontal = void 0 === b ? !0 : b; - this._vertical = void 0 === d ? !0 : d; + this._vertical = void 0 === c ? !0 : c; this.board = a; this.svgGroup = null; this.vRatio = this.vY = this.vWidth = this.hRatio = this.hX = this.hWidth = 0; @@ -23602,7 +23676,7 @@ Entry.Scroller.RADIUS = 7; var b = Entry.Scroller.RADIUS, a = this; this.svgGroup = this.board.svg.elem("g").attr({class:"boardScrollbar"}); this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * b, rx:b, ry:b}), this.hScrollbar.mousedown = function(b) { - function e(b) { + function c(b) { b.stopPropagation(); b.preventDefault(); b.originalEvent.touches && (b = b.originalEvent.touches[0]); @@ -23610,23 +23684,23 @@ Entry.Scroller.RADIUS = 7; a.scroll((b.pageX - c.offsetX) / a.hRatio, 0); c.set({offsetX:b.pageX, offsetY:b.pageY}); } - function f(b) { + function d(b) { $(document).unbind(".scroll"); delete a.dragInstance; } if (0 === b.button || b instanceof Touch) { Entry.documentMousedown && Entry.documentMousedown.notify(b); var g = $(document); - g.bind("mousemove.scroll", e); - g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); - g.bind("touchend.scroll", f); + g.bind("mousemove.scroll", c); + g.bind("mouseup.scroll", d); + g.bind("touchmove.scroll", c); + g.bind("touchend.scroll", d); a.dragInstance = new Entry.DragInstance({startX:b.pageX, startY:b.pageY, offsetX:b.pageX, offsetY:b.pageY}); } b.stopPropagation(); }); this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * b, rx:b, ry:b}), this.vScrollbar.mousedown = function(b) { - function e(b) { + function c(b) { b.stopPropagation(); b.preventDefault(); b.originalEvent.touches && (b = b.originalEvent.touches[0]); @@ -23634,17 +23708,17 @@ Entry.Scroller.RADIUS = 7; a.scroll(0, (b.pageY - c.offsetY) / a.vRatio); c.set({offsetX:b.pageX, offsetY:b.pageY}); } - function f(b) { + function d(b) { $(document).unbind(".scroll"); delete a.dragInstance; } if (0 === b.button || b instanceof Touch) { Entry.documentMousedown && Entry.documentMousedown.notify(b); var g = $(document); - g.bind("mousemove.scroll", e); - g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); - g.bind("touchend.scroll", f); + g.bind("mousemove.scroll", c); + g.bind("mouseup.scroll", d); + g.bind("touchmove.scroll", c); + g.bind("touchend.scroll", d); a.dragInstance = new Entry.DragInstance({startX:b.pageX, startY:b.pageY, offsetX:b.pageX, offsetY:b.pageY}); } b.stopPropagation(); @@ -23683,15 +23757,15 @@ Entry.Scroller.RADIUS = 7; }; a.resizeScrollBar = function() { if (this._visible) { - var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), c = b.svgDom, e = c.width(), c = c.height(), f = a.left - b.offset().left, b = a.top - b.offset().top, g = a.width, a = a.height; + var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), d = b.svgDom, e = d.width(), d = d.height(), f = a.left - b.offset().left, b = a.top - b.offset().top, g = a.width, a = a.height; if (this._horizontal) { var h = -g + Entry.BOARD_PADDING, k = e - Entry.BOARD_PADDING, g = (e + 2 * Entry.Scroller.RADIUS) * g / (k - h + g); isNaN(g) && (g = 0); this.hX = (f - h) / (k - h) * (e - g - 2 * Entry.Scroller.RADIUS); - this.hScrollbar.attr({width:g, x:this.hX, y:c - 2 * Entry.Scroller.RADIUS}); + this.hScrollbar.attr({width:g, x:this.hX, y:d - 2 * Entry.Scroller.RADIUS}); this.hRatio = (e - g - 2 * Entry.Scroller.RADIUS) / (k - h); } - this._vertical && (f = -a + Entry.BOARD_PADDING, g = c - Entry.BOARD_PADDING, a = (c + 2 * Entry.Scroller.RADIUS) * a / (g - f + a), this.vY = (b - f) / (g - f) * (c - a - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:a, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (c - a - 2 * Entry.Scroller.RADIUS) / (g - f)); + this._vertical && (f = -a + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, a = (d + 2 * Entry.Scroller.RADIUS) * a / (g - f + a), this.vY = (b - f) / (g - f) * (d - a - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:a, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - a - 2 * Entry.Scroller.RADIUS) / (g - f)); } }; a._bindEvent = function() { @@ -23733,10 +23807,10 @@ Entry.Board.DRAG_RADIUS = 5; this.wrapper = Entry.Dom("div", {parent:a, class:"entryBoardWrapper"}); this.svgDom = Entry.Dom($(''), {parent:this.wrapper}); this.visible = !0; - var c = this; + var d = this; this.svg = Entry.SVG(this._svgId); $(window).scroll(function() { - c.updateOffset(); + d.updateOffset(); }); this.svgGroup = this.svg.elem("g"); this.svgThreadGroup = this.svgGroup.elem("g"); @@ -23793,11 +23867,11 @@ Entry.Board.DRAG_RADIUS = 5; b.on("wheel", function() { a.mouseWheel.apply(a, arguments); }); - var c = a.scroller; - c && (b.mouseenter(function(b) { - c.setOpacity(1); + var d = a.scroller; + d && (b.mouseenter(function(b) { + d.setOpacity(1); }), b.mouseleave(function(b) { - c.setOpacity(0); + d.setOpacity(0); })); }; a.onMouseDown = function(b) { @@ -23805,10 +23879,10 @@ Entry.Board.DRAG_RADIUS = 5; b.stopPropagation && b.stopPropagation(); b.preventDefault && b.preventDefault(); b = Entry.Utils.convertMouseEvent(b); - var c = e.mouseDownCoordinate; - Math.sqrt(Math.pow(b.pageX - c.x, 2) + Math.pow(b.pageY - c.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), c = e.dragInstance, e.scroller.scroll(b.pageX - c.offsetX, b.pageY - c.offsetY), c.set({offsetX:b.pageX, offsetY:b.pageY})); + var a = e.mouseDownCoordinate; + Math.sqrt(Math.pow(b.pageX - a.x, 2) + Math.pow(b.pageY - a.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), a = e.dragInstance, e.scroller.scroll(b.pageX - a.offsetX, b.pageY - a.offsetY), a.set({offsetX:b.pageX, offsetY:b.pageY})); } - function c(b) { + function d(b) { f && (clearTimeout(f), f = null); $(document).unbind(".entryBoard"); delete e.mouseDownCoordinate; @@ -23824,12 +23898,12 @@ Entry.Board.DRAG_RADIUS = 5; var k = $(document); this.mouseDownCoordinate = {x:h.pageX, y:h.pageY}; k.bind("mousemove.entryBoard", a); - k.bind("mouseup.entryBoard", c); + k.bind("mouseup.entryBoard", d); k.bind("touchmove.entryBoard", a); - k.bind("touchend.entryBoard", c); + k.bind("touchend.entryBoard", d); this.dragInstance = new Entry.DragInstance({startX:h.pageX, startY:h.pageY, offsetX:h.pageX, offsetY:h.pageY}); "touchstart" === g && (f = setTimeout(function() { - f && (f = null, c(), e._rightClick(b)); + f && (f = null, d(), e._rightClick(b)); }, 1E3)); } else { Entry.Utils.isRightButton(b) && this._rightClick(b); @@ -23862,15 +23936,15 @@ Entry.Board.DRAG_RADIUS = 5; this.visible = !0; }; a.alignThreads = function() { - for (var b = this.svgDom.height(), a = this.code.getThreads(), c = 15, e = 0, b = b - 30, f = 50, g = 0;g < a.length;g++) { + for (var b = this.svgDom.height(), a = this.code.getThreads(), d = 15, e = 0, b = b - 30, f = 50, g = 0;g < a.length;g++) { var h = a[g].getFirstBlock(); if (h && (h = h.view, h.movable)) { - var k = h.svgGroup.getBBox(), l = c + 15; - l > b && (f = f + e + 10, e = 0, c = 15); + var k = h.svgGroup.getBBox(), l = d + 15; + l > b && (f = f + e + 10, e = 0, d = 15); e = Math.max(e, k.width); - l = c + 15; + l = d + 15; h._moveTo(f, l, !1); - c = c + k.height + 15; + d = d + k.height + 15; } } this.scroller.resizeScrollBar(); @@ -23881,22 +23955,22 @@ Entry.Board.DRAG_RADIUS = 5; }; a.updateOffset = function() { this._offset = this.svg.getBoundingClientRect(); - var b = $(window), a = b.scrollTop(), b = b.scrollLeft(), c = this._offset; - this.relativeOffset = {top:c.top - a, left:c.left - b}; - this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (c.width / 2 - 65) + "," + (c.height - 200) + ")"}); + var b = $(window), a = b.scrollTop(), b = b.scrollLeft(), d = this._offset; + this.relativeOffset = {top:d.top - a, left:d.left - b}; + this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (d.width / 2 - 65) + "," + (d.height - 200) + ")"}); }; a.generateButtons = function() { var b = this, a = this.svgGroup.elem("g"); this.btnWrapper = a; - var c = a.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); - c.textContent = Lang.Buttons.save; + var d = a.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); + d.textContent = Lang.Buttons.save; var e = a.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); e.textContent = Lang.Buttons.cancel; var f = a.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), a = a.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); $(f).bind("mousedown touchstart", function() { b.save(); }); - $(c).bind("mousedown touchstart", function() { + $(d).bind("mousedown touchstart", function() { b.save(); }); $(a).bind("mousedown touchstart", function() { @@ -23916,22 +23990,22 @@ Entry.Board.DRAG_RADIUS = 5; var b = this.code; if (b && this.dragBlock) { for (var a in this.dragBlock.magnet) { - var c = this._getCodeBlocks(b, a); - c.sort(function(b, a) { + var d = this._getCodeBlocks(b, a); + d.sort(function(b, a) { return b.point - a.point; }); - c.unshift({point:-Number.MAX_VALUE, blocks:[]}); - for (var e = 1;e < c.length;e++) { - var f = c[e], g = f, h = f.startBlock; + d.unshift({point:-Number.MAX_VALUE, blocks:[]}); + for (var e = 1;e < d.length;e++) { + var f = d[e], g = f, h = f.startBlock; if (h) { - for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = c[l], g);) { + for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = d[l], g);) { } delete f.startBlock; } f.endPoint = Number.MAX_VALUE; - c[e - 1].endPoint = f.point; + d[e - 1].endPoint = f.point; } - this._magnetMap[a] = c; + this._magnetMap[a] = d; } } }; @@ -23962,83 +24036,83 @@ Entry.Board.DRAG_RADIUS = 5; } return c; }; - a._getNextMagnets = function(b, a, c, e) { - var f = b.getBlocks(), g = [], h = []; - c || (c = {x:0, y:0}); - var k = c.x; - c = c.y; - for (var l = 0;l < f.length;l++) { - var m = f[l], n = m.view; + a._getNextMagnets = function(b, a, d, e) { + var c = b.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < c.length;l++) { + var m = c[l], n = m.view; n.zIndex = a; if (n.dragInstance) { break; } - c += n.y; + d += n.y; k += n.x; - b = c + 1; - n.magnet.next && (b += n.height, h.push({point:c, endPoint:b, startBlock:m, blocks:[]}), h.push({point:b, blocks:[]}), n.absX = k); + b = d + 1; + n.magnet.next && (b += n.height, h.push({point:d, endPoint:b, startBlock:m, blocks:[]}), h.push({point:b, blocks:[]}), n.absX = k); m.statements && (a += .01); for (var q = 0;q < m.statements.length;q++) { b = m.statements[q]; var r = m.view._statements[q]; r.zIndex = a; r.absX = k + r.x; - h.push({point:r.y + c - 30, endPoint:r.y + c, startBlock:r, blocks:[]}); - h.push({point:r.y + c + r.height, blocks:[]}); + h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); + h.push({point:r.y + d + r.height, blocks:[]}); a += .01; - g = g.concat(this._getNextMagnets(b, a, {x:r.x + k, y:r.y + c}, e)); + g = g.concat(this._getNextMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); } - n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getPreviousMagnets = function(b, a, c, e) { - var f = b.getBlocks(); + a._getPreviousMagnets = function(b, a, d, e) { + var c = b.getBlocks(); b = []; - c || (c = {x:0, y:0}); - e = c.x; - c = c.y; - var f = f[0], g = f.view; + d || (d = {x:0, y:0}); + e = d.x; + d = d.y; + var c = c[0], g = c.view; g.zIndex = a; if (g.dragInstance) { return []; } - c += g.y - 15; + d += g.y - 15; e += g.x; - return g.magnet.previous ? (a = c + 1 + g.height, b.push({point:c, endPoint:a, startBlock:f, blocks:[]}), b.push({point:a, blocks:[]}), g.absX = e, b) : []; - }; - a._getFieldMagnets = function(b, a, c, e) { - var f = b.getBlocks(), g = [], h = []; - c || (c = {x:0, y:0}); - var k = c.x; - c = c.y; - for (var l = 0;l < f.length;l++) { - var m = f[l], n = m.view; + return g.magnet.previous ? (a = d + 1 + g.height, b.push({point:d, endPoint:a, startBlock:c, blocks:[]}), b.push({point:a, blocks:[]}), g.absX = e, b) : []; + }; + a._getFieldMagnets = function(b, a, d, e) { + var c = b.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < c.length;l++) { + var m = c[l], n = m.view; if (n.dragInstance) { break; } n.zIndex = a; - c += n.y; + d += n.y; k += n.x; - h = h.concat(this._getFieldBlockMetaData(n, k, c, a, e)); + h = h.concat(this._getFieldBlockMetaData(n, k, d, a, e)); m.statements && (a += .01); for (var q = 0;q < m.statements.length;q++) { b = m.statements[q]; - var r = m.view._statements[q], g = g.concat(this._getFieldMagnets(b, a, {x:r.x + k, y:r.y + c}, e)); + var r = m.view._statements[q], g = g.concat(this._getFieldMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); } - n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getFieldBlockMetaData = function(b, a, c, e, f) { - var g = b._contents, h = []; - c += b.contentPos.y; - for (var k = 0;k < g.length;k++) { - var l = g[k]; + a._getFieldBlockMetaData = function(b, a, d, e, f) { + var c = b._contents, h = []; + d += b.contentPos.y; + for (var k = 0;k < c.length;k++) { + var l = c[k]; if (l instanceof Entry.FieldBlock) { var m = l._valueBlock; if (!m.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var n = a + l.box.x, q = c + l.box.y + b.contentHeight % 1E3 * -.5, r = c + l.box.y + l.box.height; + var n = a + l.box.x, q = d + l.box.y + b.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; l.acceptType === f && (h.push({point:q, endPoint:r, startBlock:m, blocks:[]}), h.push({point:r, blocks:[]})); l = m.view; l.absX = n; @@ -24049,55 +24123,55 @@ Entry.Board.DRAG_RADIUS = 5; } return h; }; - a._getOutputMagnets = function(b, a, c, e) { - var f = b.getBlocks(), g = [], h = []; - c || (c = {x:0, y:0}); - var k = c.x; - c = c.y; - for (var l = 0;l < f.length;l++) { - var m = f[l], n = m.view; + a._getOutputMagnets = function(b, a, d, e) { + var c = b.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < c.length;l++) { + var m = c[l], n = m.view; if (n.dragInstance) { break; } n.zIndex = a; - c += n.y; + d += n.y; k += n.x; - h = h.concat(this._getOutputMetaData(n, k, c, a, e)); + h = h.concat(this._getOutputMetaData(n, k, d, a, e)); m.statements && (a += .01); for (var q = 0;q < m.statements.length;q++) { b = m.statements[q]; - var r = m.view._statements[q], g = g.concat(this._getOutputMagnets(b, a, {x:r.x + k, y:r.y + c}, e)); + var r = m.view._statements[q], g = g.concat(this._getOutputMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); } - n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getOutputMetaData = function(b, a, c, e, f) { - var g = b._contents, h = []; + a._getOutputMetaData = function(b, a, d, e, f) { + var c = b._contents, h = []; a += b.contentPos.x; - c += b.contentPos.y; - for (b = 0;b < g.length;b++) { - var k = g[b], l = a + k.box.x, m = c - 24, n = c; - k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (m = k._valueBlock) && (h = h.concat(this._getOutputMetaData(m.view, l, c + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (m = k._valueBlock) && (m.view.dragInstance || - (h = h.concat(this._getOutputMetaData(m.view, a + k.box.x, c + k.box.y, e + .01, f))))); + d += b.contentPos.y; + for (b = 0;b < c.length;b++) { + var k = c[b], l = a + k.box.x, m = d - 24, n = d; + k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (m = k._valueBlock) && (h = h.concat(this._getOutputMetaData(m.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (m = k._valueBlock) && (m.view.dragInstance || + (h = h.concat(this._getOutputMetaData(m.view, a + k.box.x, d + k.box.y, e + .01, f))))); } return h; }; - a.getNearestMagnet = function(b, a, c) { - var e = this._magnetMap[c]; - if (e && 0 !== e.length) { - var f = 0, g = e.length - 1, h, k = null, l = "previous" === c ? a - 15 : a; - for (a = -1 < ["previous", "next"].indexOf(c) ? 20 : 0;f <= g;) { - if (h = (f + g) / 2 | 0, c = e[h], l < c.point) { + a.getNearestMagnet = function(b, a, d) { + var c = this._magnetMap[d]; + if (c && 0 !== c.length) { + var f = 0, g = c.length - 1, h, k = null, l = "previous" === d ? a - 15 : a; + for (a = -1 < ["previous", "next"].indexOf(d) ? 20 : 0;f <= g;) { + if (h = (f + g) / 2 | 0, d = c[h], l < d.point) { g = h - 1; } else { - if (l > c.endPoint) { + if (l > d.endPoint) { f = h + 1; } else { - e = c.blocks; - for (f = 0;f < e.length;f++) { - if (g = e[f].view, g.absX - a < b && b < g.absX + g.width && (g = c.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { - k = c.blocks[f]; + c = d.blocks; + for (f = 0;f < c.length;f++) { + if (g = c[f].view, g.absX - a < b && b < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { + k = d.blocks[f]; } } return k; @@ -24122,8 +24196,8 @@ Entry.Board.DRAG_RADIUS = 5; }; a.activateBlock = function(b) { b = b.view; - var a = b.getAbsoluteCoordinate(), c = this.svgDom, e = a.x, a = a.y, e = c.width() / 2 - e, c = c.height() / 2 - a - 100; - this.scroller.scroll(e, c); + var a = b.getAbsoluteCoordinate(), d = this.svgDom, e = a.x, a = a.y, e = d.width() / 2 - e, d = d.height() / 2 - a - 100; + this.scroller.scroll(e, d); b.addActivated(); this._activatedBlockView = b; }; @@ -24137,9 +24211,9 @@ Entry.Board.DRAG_RADIUS = 5; b.separate(a); c && c.getNextBlock() && c.getNextBlock().view.bindPrev(); }; - a.insert = function(b, a, c) { + a.insert = function(b, a, d) { "string" === typeof b && (b = this.findById(b)); - this.separate(b, c); + this.separate(b, d); 3 === a.length ? b.moveTo(a[0], a[1]) : 4 === a.length && 0 === a[3] ? (a = this.code.getThreads()[a[2]], b.thread.cut(b), a.insertToTop(b), b.getNextBlock().view.bindPrev()) : (a = a instanceof Array ? this.code.getTargetByPointer(a) : a, a instanceof Entry.Block ? ("basic" === b.getBlockType() && b.view.bindPrev(a), b.doInsert(a)) : a instanceof Entry.FieldStatement ? (b.view.bindPrev(a), a.insertTopBlock(b)) : b.doInsert(a)); }; a.adjustThreadsPosition = function() { @@ -24184,11 +24258,11 @@ Entry.Board.DRAG_RADIUS = 5; var a = Entry.disposeEvent; a && a.notify(b); if (this.visible) { - var a = [], c = this._contextOptions; - c[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; - c[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; + var a = [], d = this._contextOptions; + d[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; + d[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; for (var e = 0;e < this._contextOptions.length;e++) { - c[e].activated && a.push(c[e].option); + d[e].activated && a.push(d[e].option); } b = Entry.Utils.convertMouseEvent(b); Entry.ContextMenu.show(a, null, {x:b.clientX, y:b.clientY}); @@ -24243,17 +24317,17 @@ Entry.PARAM = -1; a.unregisterEvent = function(b, a) { (a = this._eventMap[a]) && 0 !== a.length && (b = a.indexOf(b), 0 > b || a.splice(b, 1)); }; - a.raiseEvent = function(b, a, c) { + a.raiseEvent = function(b, a, d) { b = this._eventMap[b]; - var e = []; + var c = []; if (void 0 !== b) { for (var f = 0;f < b.length;f++) { var g = b[f]; - if (void 0 === c || -1 < g.params.indexOf(c)) { - g = new Entry.Executor(b[f], a), this.executors.push(g), e.push(g); + if (void 0 === d || -1 < g.params.indexOf(d)) { + g = new Entry.Executor(b[f], a), this.executors.push(g), c.push(g); } } - return e; + return c; } }; a.getEventMap = function(b) { @@ -24264,8 +24338,8 @@ Entry.PARAM = -1; }; a.tick = function() { for (var b = this.executors, a = 0;a < b.length;a++) { - var c = b[a]; - c.isEnd() ? (b.splice(a--, 1), 0 === b.length && this.executeEndEvent.notify()) : c.execute(); + var d = b[a]; + d.isEnd() ? (b.splice(a--, 1), 0 === b.length && this.executeEndEvent.notify()) : d.execute(); } }; a.removeExecutor = function(b) { @@ -24279,8 +24353,8 @@ Entry.PARAM = -1; this.executors = []; }; a.clearExecutorsByEntity = function(b) { - for (var a = this.executors, c = 0;c < a.length;c++) { - var e = a[c]; + for (var a = this.executors, d = 0;d < a.length;d++) { + var e = a[d]; e.entity === b && e.end(); } }; @@ -24316,14 +24390,14 @@ Entry.PARAM = -1; }); }; a.toJSON = function() { - for (var b = this.getThreads(), a = [], c = 0, e = b.length;c < e;c++) { - a.push(b[c].toJSON()); + for (var b = this.getThreads(), a = [], d = 0, e = b.length;d < e;d++) { + a.push(b[d].toJSON()); } return a; }; a.countBlock = function() { - for (var b = this.getThreads(), a = 0, c = 0;c < b.length;c++) { - a += b[c].countBlock(); + for (var b = this.getThreads(), a = 0, d = 0;d < b.length;d++) { + a += b[d].countBlock(); } return a; }; @@ -24348,8 +24422,8 @@ Entry.PARAM = -1; Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); }; a.hasBlockType = function(b) { - for (var a = this.getThreads(), c = 0;c < a.length;c++) { - if (a[c].hasBlockType(b)) { + for (var a = this.getThreads(), d = 0;d < a.length;d++) { + if (a[d].hasBlockType(b)) { return !0; } } @@ -24370,8 +24444,8 @@ Entry.PARAM = -1; b.shift(); for (var a = this._data[b.shift()].getBlock(b.shift());b.length;) { a instanceof Entry.Block || (a = a.getValueBlock()); - var c = b.shift(), e = b.shift(); - -1 < c ? a = a.statements[c].getBlock(e) : -1 === c && (a = a.view.getParam(e)); + var d = b.shift(), e = b.shift(); + -1 < d ? a = a.statements[d].getBlock(e) : -1 === d && (a = a.view.getParam(e)); } return a; }; @@ -24379,17 +24453,17 @@ Entry.PARAM = -1; b = b.concat(); b.shift(); b.shift(); - var a = this._data[b.shift()], c; + var a = this._data[b.shift()], d; if (1 === b.length) { - c = a.getBlock(b.shift() - 1); + d = a.getBlock(b.shift() - 1); } else { - for (c = a.getBlock(b.shift());b.length;) { - c instanceof Entry.Block || (c = c.getValueBlock()); + for (d = a.getBlock(b.shift());b.length;) { + d instanceof Entry.Block || (d = d.getValueBlock()); var e = b.shift(), a = b.shift(); - -1 < e ? (c = c.statements[e], c = b.length ? c.getBlock(a) : 0 === a ? c.view.getParent() : c.getBlock(a - 1)) : -1 === e && (c = c.view.getParam(a)); + -1 < e ? (d = d.statements[e], d = b.length ? d.getBlock(a) : 0 === a ? d.view.getParent() : d.getBlock(a - 1)) : -1 === e && (d = d.view.getParam(a)); } } - return c; + return d; }; a.getBlockList = function(b, a) { for (var c = this.getThreads(), e = [], f = 0;f < c.length;f++) { @@ -24442,17 +24516,17 @@ Entry.ConnectionRipple = {}; }; a.setView = function(b) { this._ripple || this.createDom(b); - var a = this._ripple, c = b.getBoard().svgGroup; + var a = this._ripple, d = b.getBoard().svgGroup; a.remove(); b = b.getAbsoluteCoordinate(); a.attr({cx:b.x, cy:b.y}); - c.appendChild(a); + d.appendChild(a); a._startTime = new Date; return this; }; a.dispose = function() { - var b = this, a = this._ripple, c = (new Date - a._startTime) / 150; - 1 < c ? a.remove() : (a.attr({r:25 * c, opacity:1 - c}), window.setTimeout(function() { + var b = this, a = this._ripple, d = (new Date - a._startTime) / 150; + 1 < d ? a.remove() : (a.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { b.dispose(); }, 10)); }; @@ -24475,9 +24549,9 @@ Entry.Executor = function(a, b) { if ("AsyncError" === e.name) { b = Entry.STATIC.BREAK; } else { - var c = !1; - "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (c = !0); - Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); + var d = !1; + "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (d = !0); + Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", d); } } if (this.isEnd()) { @@ -24591,14 +24665,14 @@ Entry.Scope = function(a, b) { return Entry.STATIC.BREAK; }; })(Entry.Scope.prototype); -Entry.FieldAngle = function(a, b, d) { +Entry.FieldAngle = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; this.svgGroup = null; this.position = a.position; this._contents = a; - this._index = d; + this._index = c; a = this.getValue(); this.setValue(this.modValue(void 0 !== a ? a : 90)); this._CONTENT_HEIGHT = this.getContentHeight(); @@ -24629,9 +24703,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); b.stopPropagation(); }); this.optionGroup.on("keyup", function(a) { - var d = a.keyCode || a.which; + var c = a.keyCode || a.which; b.applyValue(a); - -1 < [13, 27].indexOf(d) && b.destroyOption(); + -1 < [13, 27].indexOf(c) && b.destroyOption(); }); var a = this.getAbsolutePosFromDocument(); a.y -= this.box.height / 2; @@ -24661,23 +24735,23 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); b = [b.clientX, b.clientY]; var a = this.getAbsolutePosFromDocument(); this.optionGroup.val(this.modValue(function(b, a) { - var d = a[0] - b[0]; + var c = a[0] - b[0]; b = a[1] - b[1] - 49 - 1; - a = Math.atan(-b / d); + a = Math.atan(-b / c); a = Entry.toDegrees(a); a = 90 - a; - 0 > d ? a += 180 : 0 < b && (a += 360); + 0 > c ? a += 180 : 0 < b && (a += 360); return 15 * Math.round(a / 15); }([a.x + this.box.width / 2, a.y + this.box.height / 2 + 1], b))); this.applyValue(); }; a.updateGraph = function() { this._fillPath && this._fillPath.remove(); - var b = Entry.toRadian(this.getValue()), a = 49 * Math.sin(b), c = -49 * Math.cos(b), b = b > Math.PI ? 1 : 0; - this._fillPath = this.svgOptionGroup.elem("path", {d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X", a).replace("%Y", c).replace("%LARGE", b), class:"entry-angle-fill-area"}); + var b = Entry.toRadian(this.getValue()), a = 49 * Math.sin(b), d = -49 * Math.cos(b), b = b > Math.PI ? 1 : 0; + this._fillPath = this.svgOptionGroup.elem("path", {d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X", a).replace("%Y", d).replace("%LARGE", b), class:"entry-angle-fill-area"}); this.svgOptionGroup.appendChild(this._dividerGroup); this._indicator && this._indicator.remove(); - this._indicator = this.svgOptionGroup.elem("line", {x1:0, y1:0, x2:a, y2:c}); + this._indicator = this.svgOptionGroup.elem("line", {x1:0, y1:0, x2:a, y2:d}); this._indicator.attr({class:"entry-angle-indicator"}); }; a.applyValue = function() { @@ -24708,13 +24782,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); this.command(); }; })(Entry.FieldAngle.prototype); -Entry.FieldColor = function(a, b, d) { +Entry.FieldColor = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; this.svgGroup = null; this._contents = a; - this._index = d; + this._index = c; this._position = a.position; this.key = a.key; this.setValue(this.getValue() || "#FF0000"); @@ -24727,20 +24801,20 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldColor); a.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var b = this._CONTENT_HEIGHT, a = this._CONTENT_WIDTH, c = this._position, e; - c ? (e = c.x || 0, c = c.y || 0) : (e = 0, c = -b / 2); - this._header = this.svgGroup.elem("rect", {x:e, y:c, width:a, height:b, fill:this.getValue()}); + var b = this._CONTENT_HEIGHT, a = this._CONTENT_WIDTH, d = this._position, e; + d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -b / 2); + this._header = this.svgGroup.elem("rect", {x:e, y:d, width:a, height:b, fill:this.getValue()}); this._bindRenderOptions(); - this.box.set({x:e, y:c, width:a, height:b}); + this.box.set({x:e, y:d, width:a, height:b}); }; a.renderOptions = function() { var b = this; this._attachDisposeEvent(); var a = Entry.FieldColor.getWidgetColorList(); this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); - for (var c = 0;c < a.length;c++) { - for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < a[c].length;f++) { - var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = a[c][f]; + for (var d = 0;d < a.length;d++) { + for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < a[d].length;f++) { + var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = a[d][f]; g.css({"background-color":h}); g.attr({"data-color-value":h}); (function(a, c) { @@ -24770,7 +24844,7 @@ Entry.FieldColor.getWidgetColorList = function() { return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; }; -Entry.FieldDropdown = function(a, b, d) { +Entry.FieldDropdown = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; @@ -24778,7 +24852,7 @@ Entry.FieldDropdown = function(a, b, d) { this._contents = a; this._noArrow = a.noArrow; this._arrowColor = a.arrowColor; - this._index = d; + this._index = c; this.setValue(this.getValue()); this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); this._FONT_SIZE = this.getFontSize(a.fontSize); @@ -24790,20 +24864,20 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); a.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var b = this._blockView, a = Entry.isMobile(), c = a ? 33 : 20, a = a ? 24 : 10; + var b = this._blockView, a = Entry.isMobile(), d = a ? 33 : 20, a = a ? 24 : 10; this.svgGroup = b.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); this.textElement = this.svgGroup.elem("text", {x:5}); this.textElement.textContent = this.getTextByValue(this.getValue()); b = this.textElement.getBBox(); this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * b.height}); - c = this.textElement.getBoundingClientRect().width + c; - this._noArrow && (c -= a); + d = this.textElement.getBoundingClientRect().width + d; + this._noArrow && (d -= a); a = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:c, height:a, y:-a / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); + this._header = this.svgGroup.elem("rect", {width:d, height:a, y:-a / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); this.svgGroup.appendChild(this.textElement); - this._noArrow || (b = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:b.points, fill:b.color, stroke:b.color, transform:"translate(" + (c - b.width - 5) + "," + -b.height / 2 + ")"})); + this._noArrow || (b = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:b.points, fill:b.color, stroke:b.color, transform:"translate(" + (d - b.width - 5) + "," + -b.height / 2 + ")"})); this._bindRenderOptions(); - this.box.set({x:0, y:0, width:c, height:a}); + this.box.set({x:0, y:0, width:d, height:a}); }; a.resize = function() { var b = Entry.isMobile(), a = b ? 33 : 20, b = b ? 24 : 10, a = this.textElement.getBoundingClientRect().width + a; @@ -24819,8 +24893,8 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); this.optionGroup.bind("mousedown touchstart", function(b) { b.stopPropagation(); }); - for (var a = this._contents.options, a = this._contents.options, c = 0, e = a.length;c < e;c++) { - var f = a[c], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); + for (var a = this._contents.options, a = this._contents.options, d = 0, e = a.length;d < e;d++) { + var f = a[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); Entry.Dom("span", {class:"right", parent:h}).text(g); this.getValue() == f && k.text("\u2713"); (function(a, c) { @@ -24840,10 +24914,10 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); a._position = function() { var b = this.getAbsolutePosFromDocument(); b.y += this.box.height / 2; - var a = $(document).height(), c = this.optionGroup.height(), e = this.optionGroup.width() + 30; - if (a < b.y + c + 30) { + var a = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; + if (a < b.y + d + 30) { var a = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); - this._blockView.y < a / 2 ? (b.x += this.box.width / 2 - e / 2, a -= f.y + 30, this.optionGroup.height(a)) : (b.x += this.box.width + 1, a -= a - f.y, a - 30 < c && this.optionGroup.height(a - a % 30), b.y -= this.optionGroup.height()); + this._blockView.y < a / 2 ? (b.x += this.box.width / 2 - e / 2, a -= f.y + 30, this.optionGroup.height(a)) : (b.x += this.box.width + 1, a -= a - f.y, a - 30 < d && this.optionGroup.height(a - a % 30), b.y -= this.optionGroup.height()); } else { b.x += this.box.width / 2 - e / 2; } @@ -24860,8 +24934,8 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); if (!b || "null" === b) { return Lang.Blocks.no_target; } - for (var a = this._contents.options, c = 0, e = a.length;c < e;c++) { - var f = a[c]; + for (var a = this._contents.options, d = 0, e = a.length;d < e;d++) { + var f = a[d]; if (f[1] == b) { return f[0]; } @@ -24876,16 +24950,16 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); return {color:this._arrowColor || this._blockView._schema.color, points:b ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:b ? 13 : 4.2, width:b ? 19 : 6.4}; }; })(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(a, b, d) { +Entry.FieldDropdownDynamic = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; this.svgGroup = null; this._contents = a; - this._index = d; + this._index = c; this._arrowColor = a.arrowColor; - d = this._contents.menuName; - Entry.Utils.isFunction(d) ? this._menuGenerator = d : this._menuName = d; + c = this._contents.menuName; + Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); this._FONT_SIZE = this.getFontSize(a.fontSize); this._ROUND = a.roundValue || 3; @@ -24914,8 +24988,8 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); var a; a = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); this._contents.options = a; - for (var c = 0;c < a.length;c++) { - var e = a[c], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); + for (var d = 0;d < a.length;d++) { + var e = a[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); Entry.Dom("span", {class:"right", parent:g}).text(f); this.getValue() == e && h.text("\u2713"); (function(a, c) { @@ -24933,7 +25007,7 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); this._position(); }; })(Entry.FieldDropdownDynamic.prototype); -Entry.FieldImage = function(a, b, d) { +Entry.FieldImage = function(a, b, c) { this._block = b.block; this._blockView = b; this._content = a; @@ -24942,7 +25016,7 @@ Entry.FieldImage = function(a, b, d) { this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; this._position = a.position; this._imgElement = this._path = this.svgGroup = null; - this._index = d; + this._index = c; this.setValue(null); this.renderStart(); }; @@ -24956,7 +25030,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldImage); this.box.set({x:this._size, y:0, width:this._size, height:this._size}); }; })(Entry.FieldImage.prototype); -Entry.FieldIndicator = function(a, b, d) { +Entry.FieldIndicator = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; @@ -24965,7 +25039,7 @@ Entry.FieldIndicator = function(a, b, d) { this._boxMultiplier = a.boxMultiplier || 2; this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; this._position = a.position; - this._index = d; + this._index = c; this._imgElement = this._path = this.svgGroup = null; this.setValue(null); this.renderStart(); @@ -24994,14 +25068,14 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); }; })(Entry.FieldIndicator.prototype); Entry.Keyboard = {}; -Entry.FieldKeyboard = function(a, b, d) { +Entry.FieldKeyboard = function(a, b, c) { this._block = b.block; this._blockView = b; this.box = new Entry.BoxModel; this.svgGroup = null; this.position = a.position; this._contents = a; - this._index = d; + this._index = c; this.setValue(String(this.getValue())); this._CONTENT_HEIGHT = this.getContentHeight(); this._optionVisible = !1; @@ -25065,10 +25139,10 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); }; })(Entry.FieldKeyboard.prototype); -Entry.FieldLineBreak = function(a, b, d) { +Entry.FieldLineBreak = function(a, b, c) { this._block = b.block; this._blockView = b; - this._index = d; + this._index = c; this.box = new Entry.BoxModel; this.setValue(null); this.renderStart(); @@ -25082,14 +25156,14 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); 0 !== a._statements.length && this.box.set({y:(a._statements[b].height || 20) + Math.max(a.contentHeight % 1E3, 30)}); }; })(Entry.FieldLineBreak.prototype); -Entry.FieldOutput = function(a, b, d, c, e) { +Entry.FieldOutput = function(a, b, c, d, e) { Entry.Model(this, !1); this._blockView = b; this._block = b.block; this._valueBlock = null; this.box = new Entry.BoxModel; this.changeEvent = new Entry.Event(this); - this._index = d; + this._index = c; this.contentIndex = e; this._content = a; this.acceptType = a.accept; @@ -25098,7 +25172,7 @@ Entry.FieldOutput = function(a, b, d, c, e) { this._position = a.position; this.box.observe(b, "alignContent", ["width", "height"]); this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(b.getBoard(), c); + this.renderStart(b.getBoard(), d); }; Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); (function(a) { @@ -25113,13 +25187,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); this._updateValueBlock(c); this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); }; - a.align = function(b, a, c) { - var e = this.svgGroup; + a.align = function(b, a, d) { + var c = this.svgGroup; this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); var f = this._valueBlock; f && (a = -.5 * f.view.height); f = "translate(" + b + "," + a + ")"; - void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + void 0 === d || d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); this.box.set({x:b, y:a}); }; a.calcWH = function() { @@ -25203,12 +25277,12 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); return this._block.pointer(b); }; })(Entry.FieldOutput.prototype); -Entry.FieldStatement = function(a, b, d) { +Entry.FieldStatement = function(a, b, c) { Entry.Model(this, !1); this._blockView = b; this.block = b.block; this.view = this; - this._index = d; + this._index = c; this.acceptType = a.accept; this._thread = this.statementSvgGroup = this.svgGroup = null; this._position = a.position; @@ -25237,13 +25311,13 @@ Entry.FieldStatement = function(a, b, d) { a.changeEvent.attach(this, this.checkTopBlock); this.calcHeight(); }; - a.align = function(b, a, c) { - c = void 0 === c ? !0 : c; - var e = this.svgGroup; + a.align = function(b, a, d) { + d = void 0 === d ? !0 : d; + var c = this.svgGroup; this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); var f = "translate(" + b + "," + a + ")"; this.set({x:b, y:a}); - c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); }; a.calcHeight = function() { var b = this._thread.view.requestPartHeight(null); @@ -25293,10 +25367,10 @@ Entry.FieldStatement = function(a, b, d) { b && this.firstBlock !== b ? (this.firstBlock = b, b.view.bindPrev(this), b._updatePos()) : b || (this.firstBlock = null); }; })(Entry.FieldStatement.prototype); -Entry.FieldText = function(a, b, d) { +Entry.FieldText = function(a, b, c) { this._block = b.block; this._blockView = b; - this._index = d; + this._index = c; this.box = new Entry.BoxModel; this._fontSize = a.fontSize || b.getSkeleton().fontSize || 12; this._color = a.color || this._block.getSchema().fontColor || b.getSkeleton().color || "white"; @@ -25320,14 +25394,14 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldText); this.box.set({x:0, y:0, width:a.width, height:a.height}); }; })(Entry.FieldText.prototype); -Entry.FieldTextInput = function(a, b, d) { +Entry.FieldTextInput = function(a, b, c) { this._blockView = b; this._block = b.block; this.box = new Entry.BoxModel; this.svgGroup = null; this.position = a.position; this._contents = a; - this._index = d; + this._index = c; this.value = this.getValue() || ""; this._CONTENT_HEIGHT = this.getContentHeight(); this.renderStart(); @@ -25358,9 +25432,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); b.stopPropagation(); }); this.optionGroup.on("keyup", function(a) { - var d = a.keyCode || a.which; + var c = a.keyCode || a.which; b.applyValue(a); - -1 < [13, 27].indexOf(d) && b.destroyOption(); + -1 < [13, 27].indexOf(c) && b.destroyOption(); }); var a = this.getAbsolutePosFromDocument(); a.y -= this.box.height / 2; @@ -25421,10 +25495,10 @@ Entry.GlobalSvg = {}; this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); }; a.align = function() { - var b = this._view.getSkeleton().box(this._view).offsetX || 0, a = this._view.getSkeleton().box(this._view).offsetY || 0, b = -1 * b + 1, a = -1 * a + 1; - this._offsetX = b; - this._offsetY = a; - this.svgGroup.attr({transform:"translate(" + b + "," + a + ")"}); + var a = this._view.getSkeleton().box(this._view).offsetX || 0, c = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, c = -1 * c + 1; + this._offsetX = a; + this._offsetY = c; + this.svgGroup.attr({transform:"translate(" + a + "," + c + ")"}); }; a.show = function() { this._container.removeClass("entryRemove"); @@ -25433,23 +25507,23 @@ Entry.GlobalSvg = {}; this._container.addClass("entryRemove"); }; a.position = function() { - var b = this._view; - if (b) { - var a = b.getAbsoluteCoordinate(), b = b.getBoard().offset(); - this.left = a.x + b.left - this._offsetX; - this.top = a.y + b.top - this._offsetY; + var a = this._view; + if (a) { + var c = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); + this.left = c.x + a.left - this._offsetX; + this.top = c.y + a.top - this._offsetY; this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); } }; - a.terminateDrag = function(b) { - var a = Entry.mouseCoordinate, c = b.getBoard(), e = c.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; - return a.y > c.offset().top - 20 && a.x > f + h ? this.DONE : a.y > g && a.x > f && e.visible ? b.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + a.terminateDrag = function(a) { + var b = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; + return b.y > d.offset().top - 20 && b.x > f + h ? this.DONE : b.y > g && b.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; }; a.addControl = function(a) { this.onMouseDown.apply(this, arguments); }; a.onMouseDown = function(a) { - function d(a) { + function b(a) { var b = a.pageX; a = a.pageY; var c = e.left + (b - e._startX), d = e.top + (a - e._startY); @@ -25459,7 +25533,7 @@ Entry.GlobalSvg = {}; e.left = c; e.top = d; } - function c(a) { + function d(a) { $(document).unbind(".block"); } this._startY = a.pageY; @@ -25467,10 +25541,10 @@ Entry.GlobalSvg = {}; a.stopPropagation(); a.preventDefault(); var f = $(document); - f.bind("mousemove.block", d); - f.bind("mouseup.block", c); - f.bind("touchmove.block", d); - f.bind("touchend.block", c); + f.bind("mousemove.block", b); + f.bind("mouseup.block", d); + f.bind("touchmove.block", b); + f.bind("touchend.block", d); this._startX = a.pageX; this._startY = a.pageY; }; @@ -25478,11 +25552,11 @@ Entry.GlobalSvg = {}; Entry.Mutator = function() { }; (function(a) { - a.mutate = function(a, d) { + a.mutate = function(a, c) { a = Entry.block[a]; void 0 === a.changeEvent && (a.changeEvent = new Entry.Event); - a.template = d.template; - a.params = d.params; + a.template = c.template; + a.params = c.params; a.changeEvent.notify(1); }; })(Entry.Mutator); @@ -25525,11 +25599,11 @@ Entry.RenderView = function(a, b) { a.align = function() { var a = this.code.getThreads(); if (a && 0 !== a.length) { - for (var d = 0, c = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { + for (var c = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { var g = a[e].getFirstBlock().view; - g._moveTo(c, d - g.offsetY, !1); + g._moveTo(d, c - g.offsetY, !1); g = g.svgGroup.getBBox().height; - d += g + 15; + c += g + 15; } this._bBox = this.svgGroup.getBBox(); this.height = this._bBox.height; @@ -25575,26 +25649,26 @@ Entry.ThreadView = function(a, b) { return this.parent; }; a.renderText = function() { - for (var a = this.thread.getBlocks(), d = 0;d < a.length;d++) { - a[d].view.renderText(); + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderText(); } }; a.renderBlock = function() { - for (var a = this.thread.getBlocks(), d = 0;d < a.length;d++) { - a[d].view.renderBlock(); + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderBlock(); } }; a.requestAbsoluteCoordinate = function(a) { - var d = this.thread.getBlocks(), c = d.shift(), e = {x:0, y:0}; - for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());c && c.view !== a && c.view;) { - c = c.view, e.x += c.x + c.magnet.next.x, e.y += c.y + c.magnet.next.y, c = d.shift(); + var b = this.thread.getBlocks(), d = b.shift(), e = {x:0, y:0}; + for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { + d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = b.shift(); } return e; }; - a.requestPartHeight = function(a, d) { - d = this.thread.getBlocks(); - for (var c = d.pop(), e = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;c && c.view !== a && c.view;) { - c = c.view, e = c.magnet.next ? e + c.magnet.next.y : e + c.height, c.dragMode === Entry.DRAG_MODE_DRAG && (e = 0), c = d.pop(); + a.requestPartHeight = function(a, c) { + c = this.thread.getBlocks(); + for (var b = c.pop(), e = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;b && b.view !== a && b.view;) { + b = b.view, e = b.magnet.next ? e + b.magnet.next.y : e + b.height, b.dragMode === Entry.DRAG_MODE_DRAG && (e = 0), b = c.pop(); } return e; }; @@ -25605,8 +25679,8 @@ Entry.ThreadView = function(a, b) { return this.parent instanceof Entry.Board; }; a.reDraw = function() { - for (var a = this.thread._data, d = a.length - 1;0 <= d;d--) { - a[d].view.reDraw(); + for (var a = this.thread._data, c = a.length - 1;0 <= c;c--) { + a[c].view.reDraw(); } }; a.setZIndex = function(a) { @@ -25637,22 +25711,22 @@ Entry.Vim = function(a, b) { }; (function(a) { a.createDom = function(a) { - function d(a) { + function b(a) { var b = e.getCodeToText(a.block); e.codeMirror.display.dragFunctions.leave(a); var c = Entry.Utils.createMouseEvent("mousedown", a); e.codeMirror.display.scroller.dispatchEvent(c); - var b = b.split("\n"), d = b.length - 1, l = 0; + var b = b.split("\n"), d = b.length - 1, f = 0; b.forEach(function(a, b) { e.codeMirror.replaceSelection(a); - l = e.doc.getCursor().line; - e.codeMirror.indentLine(l); + f = e.doc.getCursor().line; + e.codeMirror.indentLine(f); 0 !== b && d === b || e.codeMirror.replaceSelection("\n"); }); a = Entry.Utils.createMouseEvent("mouseup", a); e.codeMirror.display.scroller.dispatchEvent(a); } - function c(a) { + function d(a) { e.codeMirror.display.dragFunctions.over(a); } var e; @@ -25661,10 +25735,10 @@ Entry.Vim = function(a, b) { this.doc = this.codeMirror.getDoc(); e = this; a = this.view[0]; - a.removeEventListener("dragEnd", d); - a.removeEventListener("dragOver", c); - a.addEventListener("dragEnd", d); - a.addEventListener("dragOver", c); + a.removeEventListener("dragEnd", b); + a.removeEventListener("dragOver", d); + a.addEventListener("dragEnd", b); + a.addEventListener("dragOver", d); }; a.hide = function() { this.view.addClass("entryRemove"); @@ -25677,26 +25751,26 @@ Entry.Vim = function(a, b) { a = this.codeMirror.getValue(); return this._parser.parse(a); }; - a.codeToText = function(a, d) { - var c; - d && (this._mode = d.runType); - Entry.playground && (c = Entry.playground.object, c = "# " + c.name + " \uc624\ube0c\uc81d\ud2b8\uc758 \ud30c\uc774\uc36c \ucf54\ub4dc"); - d = d.textType; - d === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : d === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); + a.codeToText = function(a, c) { + var b; + c && (this._mode = c.runType); + Entry.playground && (b = Entry.playground.object, b = "# " + b.name + " \uc624\ube0c\uc81d\ud2b8\uc758 \ud30c\uc774\uc36c \ucf54\ub4dc"); + c = c.textType; + c === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : c === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); a = this._parser.parse(a, Entry.Parser.PARSE_GENERAL); - d === Entry.Vim.TEXT_TYPE_PY && (a = c.concat("\n\n").concat(Entry.Vim.PYTHON_IMPORT_ENTRY).concat("\n\n").concat(a)); + c === Entry.Vim.TEXT_TYPE_PY && (a = b.concat("\n\n").concat(Entry.Vim.PYTHON_IMPORT_ENTRY).concat("\n\n").concat(a)); this.codeMirror.setValue(a + "\n"); - d == Entry.Vim.TEXT_TYPE_PY && this.codeMirror.getDoc().markText({line:0, ch:0}, {line:4, ch:0}, {readOnly:!0}); + c == Entry.Vim.TEXT_TYPE_PY && this.codeMirror.getDoc().markText({line:0, ch:0}, {line:4, ch:0}, {readOnly:!0}); a = this.codeMirror.getDoc(); a.setCursor({line:a.lastLine() - 1}); }; a.getCodeToText = function(a) { - var d = this.workspace.oldTextType; - d === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : d === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); + var b = this.workspace.oldTextType; + b === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : b === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); return this._parser.parse(a, Entry.Parser.PARSE_SYNTAX); }; - a.setParserAvailableCode = function(a, d) { - this._parser.setAvailableCode(a, d); + a.setParserAvailableCode = function(a, c) { + this._parser.setAvailableCode(a, c); }; })(Entry.Vim.prototype); Entry.Xml = {}; @@ -25713,13 +25787,13 @@ Entry.Xml.getNextBlock = function(a) { return null; }; Entry.Xml.getStatementBlock = function(a, b) { - var d = b.getElementsByTagName("statement"); - if (!d.length) { + var c = b.getElementsByTagName("statement"); + if (!c.length) { return b; } - for (var c in d) { - if (d[c].getAttribute("name") == a) { - return d[c].children[0]; + for (var d in c) { + if (c[d].getAttribute("name") == a) { + return c[d].children[0]; } } return null; @@ -25766,21 +25840,21 @@ Entry.Xml.getValue = function(a, b) { if (!b.length) { return null; } - for (var d in b) { - if ("VALUE" == b[d].tagName.toUpperCase() && b[d].getAttribute("name") == a) { - return b[d].children[0]; + for (var c in b) { + if ("VALUE" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].children[0]; } } return null; }; -Entry.Xml.getNumberValue = function(a, b, d) { - d = d.childNodes; - if (!d.length) { +Entry.Xml.getNumberValue = function(a, b, c) { + c = c.childNodes; + if (!c.length) { return null; } - for (var c in d) { - if (d[c].tagName && "VALUE" == d[c].tagName.toUpperCase() && d[c].getAttribute("name") == b) { - return Number(Entry.Xml.operate(a, d[c].children[0])); + for (var d in c) { + if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { + return Number(Entry.Xml.operate(a, c[d].children[0])); } } return null; @@ -25790,9 +25864,9 @@ Entry.Xml.getField = function(a, b) { if (!b.length) { return null; } - for (var d in b) { - if (b[d].tagName && "FIELD" == b[d].tagName.toUpperCase() && b[d].getAttribute("name") == a) { - return b[d].textContent; + for (var c in b) { + if (b[c].tagName && "FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].textContent; } } }; @@ -25801,20 +25875,20 @@ Entry.Xml.getNumberField = function(a, b) { if (!b.length) { return null; } - for (var d in b) { - if ("FIELD" == b[d].tagName.toUpperCase() && b[d].getAttribute("name") == a) { - return Number(b[d].textContent); + for (var c in b) { + if ("FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return Number(b[c].textContent); } } }; -Entry.Xml.getBooleanValue = function(a, b, d) { - d = d.getElementsByTagName("value"); - if (!d.length) { +Entry.Xml.getBooleanValue = function(a, b, c) { + c = c.getElementsByTagName("value"); + if (!c.length) { return null; } - for (var c in d) { - if (d[c].getAttribute("name") == b) { - return Entry.Xml.operate(a, d[c].children[0]); + for (var d in c) { + if (c[d].getAttribute("name") == b) { + return Entry.Xml.operate(a, c[d].children[0]); } } return null; @@ -25822,14 +25896,14 @@ Entry.Xml.getBooleanValue = function(a, b, d) { Entry.Xml.operate = function(a, b) { return Entry.block[b.getAttribute("type")](a, b); }; -Entry.Xml.cloneBlock = function(a, b, d) { - var c = a.cloneNode(); - a.parentNode && "xml" != a.parentNode.tagName && Entry.Xml.cloneBlock(a.parentNode, c, "parent"); +Entry.Xml.cloneBlock = function(a, b, c) { + var d = a.cloneNode(); + a.parentNode && "xml" != a.parentNode.tagName && Entry.Xml.cloneBlock(a.parentNode, d, "parent"); for (var e = 0;e < a.childNodes.length;e++) { var f = a.childNodes[e]; - f instanceof Text ? c.textContent = f.textContent : "parent" == d ? c.appendChild(b) : c.appendChild(Entry.Xml.cloneBlock(f, c, "child")); + f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(b) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); } - return c; + return d; }; Entry.Youtube = function(a) { this.generateView(a); diff --git a/dist/entry.min.js b/dist/entry.min.js index ef1357f08e..7e8264ea99 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,76 +1,76 @@ Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions);Entry.container.setObjects(b.objects); Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();Entry.Loader.isLoaded()&&Entry.Loader.handleLoad();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&& -Entry.Func.workspace.visible&&Entry.Func.cancelEdit();b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){b=[];a=jQuery.parseXML(a).getElementsByTagName("category");for(var d=0;da?a=325:720a?a=244:400svg").css({width:a- +this.resizeElement(JSON.parse(b))}else this.resizeElement({menuWidth:280,canvasWidth:480})},resizeElement:function(b){if("workspace"==Entry.type){var a=this.interfaceState;!b.canvasWidth&&a.canvasWidth&&(b.canvasWidth=a.canvasWidth);!b.menuWidth&&this.interfaceState.menuWidth&&(b.menuWidth=a.menuWidth);Entry.engine.speedPanelOn&&Entry.engine.toggleSpeedPanel();(a=b.canvasWidth)?325>a?a=325:720a?a=244:400svg").css({width:a- 64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth();$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user? -window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var d=b.target,c=0!==$(a.view_).find(d).length,d=d.tagName.toUpperCase();b=b.type;!a.isEditing||"INPUT"===d&&c||"touchstart"===b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a= -function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block[b]=a}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,d;for(d in b)a[d]=b[d];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, +window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target,d=0!==$(a.view_).find(c).length,c=c.tagName.toUpperCase();b=b.type;!a.isEditing||"INPUT"===c&&d||"touchstart"===b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a= +function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block[b]=a}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, type:"input",pos:{x:0,y:0}},accelerationY:{name:Lang.Blocks.ALBERT_sensor_acceleration_y,type:"input",pos:{x:0,y:0}},accelerationZ:{name:Lang.Blocks.ALBERT_sensor_acceleration_z,type:"input",pos:{x:0,y:0}},frontOid:{name:Lang.Blocks.ALBERT_sensor_front_oid,type:"input",pos:{x:0,y:0}},backOid:{name:Lang.Blocks.ALBERT_sensor_back_oid,type:"input",pos:{x:0,y:0}},positionX:{name:Lang.Blocks.ALBERT_sensor_position_x,type:"input",pos:{x:0,y:0}},positionY:{name:Lang.Blocks.ALBERT_sensor_position_y,type:"input", pos:{x:0,y:0}},orientation:{name:Lang.Blocks.ALBERT_sensor_orientation,type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output",pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_left_proximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_right_proximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye,type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led_en,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led_en,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b); var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},controller:{PI:3.14159265,PI2:6.2831853,prevDirection:0,prevDirectionFine:0,directionFineCount:0,positionCount:0,finalPositionCount:0,GAIN_ANGLE:30,GAIN_ANGLE_FINE:30,GAIN_POSITION_FINE:30,STRAIGHT_SPEED:20,MAX_BASE_SPEED:20,GAIN_BASE_SPEED:1,GAIN_POSITION:35,POSITION_TOLERANCE_FINE:3,POSITION_TOLERANCE_FINE_LARGE:5,POSITION_TOLERANCE_ROUGH:5,POSITION_TOLERANCE_ROUGH_LARGE:10, -ORIENTATION_TOLERANCE_FINE:.08,ORIENTATION_TOLERANCE_ROUGH:.09,ORIENTATION_TOLERANCE_ROUGH_LARGE:.18,MINIMUM_WHEEL_SPEED:18,MINIMUM_WHEEL_SPEED_FINE:15,clear:function(){this.finalPositionCount=this.positionCount=this.directionFineCount=this.prevDirectionFine=this.prevDirection=0},controlAngleFine:function(b,a){var d=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ac*this.prevDirectionFine&&5<++this.directionFineCount)return!1; -this.prevDirectionFine=c;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);d.leftWheel=-b;d.rightWheel=b;return!0},controlAngle:function(b,a){var d=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ac*this.prevDirection)return!1; -this.prevDirection=c;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);d.leftWheel=-b;d.rightWheel=b;return!0},controlPositionFine:function(b,a,d,c,e){var f=Entry.hw.sendQueue;d=this.validateRadian(Math.atan2(e-a,c-b)-d);var g=Math.abs(d);b=c-b;a=e-a;a=Math.sqrt(b*b+a*a);if(ag?(f.leftWheel=this.STRAIGHT_SPEED,f.rightWheel=this.STRAIGHT_SPEED):(a=(this.MINIMUM_WHEEL_SPEED+.5/g)*this.GAIN_BASE_SPEED,a>this.MAX_BASE_SPEED&&(a=this.MAX_BASE_SPEED),d=0this.PI?b-this.PI2:b<-this.PI?b+this.PI2:b},toRadian:function(b){return 3.14159265* +ORIENTATION_TOLERANCE_FINE:.08,ORIENTATION_TOLERANCE_ROUGH:.09,ORIENTATION_TOLERANCE_ROUGH_LARGE:.18,MINIMUM_WHEEL_SPEED:18,MINIMUM_WHEEL_SPEED_FINE:15,clear:function(){this.finalPositionCount=this.positionCount=this.directionFineCount=this.prevDirectionFine=this.prevDirection=0},controlAngleFine:function(b,a){var c=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ad*this.prevDirectionFine&&5<++this.directionFineCount)return!1; +this.prevDirectionFine=d;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);c.leftWheel=-b;c.rightWheel=b;return!0},controlAngle:function(b,a){var c=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ad*this.prevDirection)return!1; +this.prevDirection=d;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);c.leftWheel=-b;c.rightWheel=b;return!0},controlPositionFine:function(b,a,c,d,e){var f=Entry.hw.sendQueue;c=this.validateRadian(Math.atan2(e-a,d-b)-c);var g=Math.abs(c);b=d-b;a=e-a;a=Math.sqrt(b*b+a*a);if(ag?(f.leftWheel=this.STRAIGHT_SPEED,f.rightWheel=this.STRAIGHT_SPEED):(a=(this.MINIMUM_WHEEL_SPEED+.5/g)*this.GAIN_BASE_SPEED,a>this.MAX_BASE_SPEED&&(a=this.MAX_BASE_SPEED),c=0this.PI?b-this.PI2:b<-this.PI?b+this.PI2:b},toRadian:function(b){return 3.14159265* b/180}},name:"albert"};Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){b=Entry.hw.portData;return 40a.x||0>a.y){d.leftWheel=20;d.rightWheel=-20;break}a.initialized=!0}d=b.toRadian(a.theta);0==b.controlAngle(d,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x, -a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX;delete a.targetY;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1; -a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();d.leftWheel=0;d.rightWheel=0;return a}; +Entry.block.albert_move_to_x_y_on_board=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;b=Entry.Albert.controller;if(a.isStart){if(a.isMoving){0<=d.positionX&&(a.x=d.positionX);0<=d.positionY&&(a.y=d.positionY);a.theta=d.orientation;switch(a.boardState){case 1:if(0==a.initialized){if(0>a.x||0>a.y){c.leftWheel=20;c.rightWheel=-20;break}a.initialized=!0}c=b.toRadian(a.theta);0==b.controlAngle(c,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x, +a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(c.leftWheel=0,c.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX;delete a.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1; +a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();c.leftWheel=0;c.rightWheel=0;return a}; Blockly.Blocks.albert_set_orientation_on_board={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_1);this.appendValueInput("ORIENTATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_orientation_on_board=function(b,a){b=Entry.hw.sendQueue;var d=Entry.hw.portData,c=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=d.orientation;switch(a.boardState){case 1:var d=c.toRadian(a.theta),e=c.toRadian(a.targetTheta);0==c.controlAngle(d,e)&&(a.boardState=2);break;case 2:d=c.toRadian(a.theta),e=c.toRadian(a.targetTheta),0==c.controlAngleFine(d,e)&&(b.leftWheel=0,b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState; -delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");c.clear();b.leftWheel=0;b.rightWheel=0;return a}; +Entry.block.albert_set_orientation_on_board=function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta);0==d.controlAngle(c,e)&&(a.boardState=2);break;case 2:c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta),0==d.controlAngleFine(c,e)&&(b.leftWheel=0,b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState; +delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");d.clear();b.leftWheel=0;b.rightWheel=0;return a}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan, "3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.Blocks.ALBERT_color_white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_eye_to=function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a),c=Number(a.getField("COLOR",a));"LEFT"==d?b.leftEye=c:("RIGHT"!=d&&(b.leftEye=c),b.rightEye=c);return a.callReturn()}; +Entry.block.albert_set_eye_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"LEFT"==c?b.leftEye=d:("RIGHT"!=c&&(b.leftEye=d),b.rightEye=d);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_clear_eye=function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a);"LEFT"==d?b.leftEye=0:("RIGHT"!=d&&(b.leftEye=0),b.rightEye=0);return a.callReturn()}; +Entry.block.albert_clear_eye=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"LEFT"==c?b.leftEye=0:("RIGHT"!=c&&(b.leftEye=0),b.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_body_led=function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.bodyLed=1:b.bodyLed=0;return a.callReturn()}; Blockly.Blocks.albert_front_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_front_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_front_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_front_led=function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.frontLed=1:b.frontLed=0;return a.callReturn()};Blockly.Blocks.albert_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_beep=function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(d)},200);Entry.Albert.timeouts.push(d);return a}; +Entry.block.albert_beep=function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c);return a}; Blockly.Blocks.albert_change_buzzer_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_change_buzzer_by=function(b,a){b=Entry.hw.sendQueue;var d=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+d:d;b.note=0;return a.callReturn()}; +Entry.block.albert_change_buzzer_by=function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+c:c;b.note=0;return a.callReturn()}; Blockly.Blocks.albert_set_buzzer_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_set_buzzer_to=function(b,a){b=Entry.hw.sendQueue;b.buzzer=a.getNumberValue("VALUE");b.note=0;return a.callReturn()};Blockly.Blocks.albert_clear_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_buzzer).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_buzzer=function(b,a){b=Entry.hw.sendQueue;b.buzzer=0;b.note=0;return a.callReturn()}; Blockly.Blocks.albert_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_1).appendField(new Blockly.FieldDropdown([[Lang.General.note_c+"","4"],[Lang.General.note_c+"#","5"],[Lang.General.note_d+"","6"],[Lang.General.note_e+"b","7"],[Lang.General.note_e+"","8"],[Lang.General.note_f+"","9"],[Lang.General.note_f+"#","10"],[Lang.General.note_g+"","11"],[Lang.General.note_g+"#","12"],[Lang.General.note_a+"","13"],[Lang.General.note_b+ "b","14"],[Lang.General.note_b+"","15"]]),"NOTE").appendField(Lang.Blocks.ALBERT_play_note_for_2).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]]),"OCTAVE").appendField(Lang.Blocks.ALBERT_play_note_for_3);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_play_note_for=function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.note=0;return a.callReturn()}b=a.getNumberField("NOTE",a);var c=a.getNumberField("OCTAVE",a),e=6E4*a.getNumberValue("VALUE",a)/Entry.Albert.tempo;a.isStart=!0;a.timeFlag=1;d.buzzer=0;d.note=b+12*(c-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -92,7 +92,7 @@ Entry.CODEino.getSensorKey()}):Entry.hw.sendQueue={SET:{0:{type:Entry.CODEino.se 9:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},10:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},11:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},12:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},13:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0}},TIME:Entry.CODEino.getSensorTime(Entry.CODEino.sensorTypes.DIGITAL),KEY:Entry.CODEino.getSensorKey()};Entry.hw.update()},sensorTypes:{ALIVE:0,DIGITAL:1,ANALOG:2,PWM:3,RGBLED_PIN:4,TONE:5,PULSEIN:6,ULTRASONIC:7,TIMER:8,ADDCOLOR:9},BlockState:{}}; Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.arduino_send=function(b,a){b=a.getValue("VALUE",a);var d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(b));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; +Entry.block.arduino_send=function(b,a){b=a.getValue("VALUE",a);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(b));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; Entry.block.arduino_get_number=function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return Number(a.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -104,12 +104,12 @@ Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#009 Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){b=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(b[1])}; Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){b=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(b)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){b=a.getNumberValue("VALUE");var d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==d?255:0);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){b=a.getNumberValue("VALUE");var c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==c?255:0);return a.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){b=a.getNumberValue("PORT");var d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(b,d);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){b=a.getNumberValue("PORT");var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(b,c);return a.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(b,a){var d=a.getNumberValue("VALUE1",a),c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(c>e)var f=c,c=e,e=f;b>a&&(f=b,b=a,a=f);d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)}; +Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}; Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; @@ -130,11 +130,11 @@ Entry.block.CODEino_is_button_pressed=function(b,a){b=a.getNumberField("PORT",a) Blockly.Blocks.CODEino_get_accelerometer_direction={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19,"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]]),"DIRECTION");this.appendDummyInput().appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.CODEino_get_accelerometer_direction=function(b,a){b=a.getField("DIRECTION",a);a=0;"LEFT"==b||"RIGHT"==b?a=3:"FRONT"==b||"REAR"==b?a=4:"REVERSE"==b&&(a=5);a=Entry.hw.getAnalogPortValue(a)-265;a=Math.min(90,180/137*a+-90);a=Math.max(-90,a);a=Math.round(a);if("LEFT"==b||"REAR"==b)return-30>a?1:0;if("RIGHT"==b||"FRONT"==b)return 30a?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(b,a){var d=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),c=265,e=402;b=-90;a=90;if(c>e)var f=c,c=e,e=f;b>a&&(f=b,b=a,a=f);d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)}; +Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),d=265,e=402;b=-90;a=90;if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var d=a.getField("PORT");b=7;"7"==d?b=7:"8"==d?b=8:"9"==d?b=9:"10"==d&&(b=10);d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==d?255:0);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT");b=7;"7"==c?b=7:"8"==c?b=8:"9"==c?b=9:"10"==c&&(b=10);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==c?255:0);return a.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_switch_status=function(b,a){b=a.getField("PORT");var d=2;"2"==b?d=2:"4"==b&&(d=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}; +Entry.block.dplay_get_switch_status=function(b,a){b=a.getField("PORT");var c=2;"2"==b?c=2:"4"==b&&(c=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(c)?1:0:0==Entry.hw.getDigitalPortValue(c)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.dplay_get_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_3);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc88 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uac00\ubcc0\uc800\ud56d","ADJU"],["\ube5b\uc13c\uc11c","LIGHT"],["\uc628\ub3c4\uc13c\uc11c","TEMP"],["\uc870\uc774\uc2a4\ud2f1 X","JOYS"],["\uc870\uc774\uc2a4\ud2f1 Y","JOYS"],["\uc801\uc678\uc120", @@ -142,56 +142,56 @@ Blockly.Blocks.dplay_get_value={init:function(){this.setColour("#00979D");this.a Blockly.Blocks.dplay_get_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_tilt).appendField(new Blockly.FieldDropdown([["\uc67c\ucabd \uae30\uc6b8\uc784","LEFT"],["\uc624\ub978\ucabd \uae30\uc6b8\uc784","LIGHT"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_tilt=function(b,a){return"LIGHT"==a.getField("STATUS",a)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; Blockly.Blocks.dplay_DCmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc67c\ucabd","3"],["\uc624\ub978\ucabd","6"]]),"PORT");this.appendDummyInput().appendField(" DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){b=a.getField("PORT");var d=0;"3"==b?d=5:"6"==b&&(d=11);var c=a.getField("OPERATOR"),e=0,f=0;"FRONT"==c?(e=255,f=0):"REAR"==c?(e=0,f=255):"OFF"==c&&(f=e=0);Entry.hw.setDigitalPortValue(b,e);Entry.hw.setDigitalPortValue(d,f);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){b=a.getField("PORT");var c=0;"3"==b?c=5:"6"==b&&(c=11);var d=a.getField("OPERATOR"),e=0,f=0;"FRONT"==d?(e=255,f=0):"REAR"==d?(e=0,f=255):"OFF"==d&&(f=e=0);Entry.hw.setDigitalPortValue(b,e);Entry.hw.setDigitalPortValue(c,f);return a.callReturn()}; Blockly.Blocks.dplay_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubd80\uc800\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\ub3c4","1"],["\ub808","2"],["\ubbf8","3"]]),"PORT");this.appendDummyInput().appendField("\ub85c");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var d=a.getField("PORT");b=2;"1"==d?b=2:"2"==d?b=4:"3"==d&&(b=7);d=a.getNumberValue("VALUE");d=Math.round(d);d=Math.max(d,0);d=Math.min(d,100);Entry.hw.setDigitalPortValue(b,d);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var c=a.getField("PORT");b=2;"1"==c?b=2:"2"==c?b=4:"3"==c&&(b=7);c=a.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(b,c);return a.callReturn()}; Blockly.Blocks.dplay_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4\ubaa8\ud130 \uac01\ub3c4\ub97c");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc774\ub3d9");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dplay_servo=function(b,a){b=a.getNumberValue("VALUE");b=Math.round(b);b=Math.max(b,0);b=Math.min(b,180);Entry.hw.setDigitalPortValue(9,b);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,d=1;5>d;d++){var c=a[d];c&&(c.value||0===c.value)&&b.push([d+" - "+Lang.Blocks["BITBRICK_"+c.type],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,d=1;5>d;d++){var c=a[d]; -c&&"touch"===c.type&&b.push([d.toString(),d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,d=5;9>d;d++){var c=a[d];c&&"SERVO"===c.type&&b.push(["ABCD"[d-5],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,d=5;9>d;d++){var c=a[d];c&&"DC"===c.type&&b.push(["ABCD"[d-5],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= +Entry.block.dplay_servo=function(b,a){b=a.getNumberValue("VALUE");b=Math.round(b);b=Math.max(b,0);b=Math.min(b,180);Entry.hw.setDigitalPortValue(9,b);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; +d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b].value}; Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){b=a.getNumberValue("rValue");var d=a.getNumberValue("gValue"),c=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(d,0,255);f.LEDB=e(c,0,255);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){b=a.getNumberValue("rValue");var c=a.getNumberValue("gValue"),d=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){b=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(b.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(b.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(b.substr(5,2),16);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){b=a.getNumberValue("VALUE");var d,c,e;b%=200;67>b?(d=200-3*b,c=3*b,e=0):134>b?(b-=67,d=0,c=200-3*b,e=3*b):201>b&&(b-=134,d=3*b,c=0,e=200-3*b);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=c;Entry.hw.sendQueue.LEDB=e;return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){b=a.getNumberValue("VALUE");var c,d,e;b%=200;67>b?(c=200-3*b,d=3*b,e=0):134>b?(b-=67,c=0,d=200-3*b,e=3*b):201>b&&(b-=134,c=3*b,d=0,e=200-3*b);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return a.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();b=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=b;a.isStart=!0;return a}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(b,a){var d=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){d[a[1]]=0});b.dcList().map(function(a){d[a[1]]=128});return a.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){c[a[1]]=0});b.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; Entry.block.bitbrick_dc_speed=function(b,a){b=a.getNumberValue("VALUE");b=Math.min(b,Entry.Bitbrick.dcMaxValue);b=Math.max(b,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b+128;return a.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){b="CW"===a.getStringField("DIRECTION");var d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?d+128:128-d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){b="CW"===a.getStringField("DIRECTION");var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?c+128:128-c;return a.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){b=a.getNumberValue("VALUE")+1;b=Math.min(b,Entry.Bitbrick.servoMaxValue);b=Math.max(b,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b;return a.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(b,a){b=a.getNumberField("PORT");var d=Entry.hw.portData[b].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.bitbrick_convert_scale=function(b,a){b=a.getNumberField("PORT");var c=Entry.hw.portData[b].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(b,a){var d=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(d=Entry.hex2rgb(d),b.brush.rgb=d,b.brush.endStroke(),b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var d=Entry.generateRgb();b.brush.rgb=d;b.brush.endStroke();b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; +Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=d,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=d,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity+d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(b,a){var d=b.brush;if(d){var c=d._stroke.style,e=d._strokeStyle.width;d.clear().setStrokeStyle(e).beginStroke(c);d.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()}; +Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()}; Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity-d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; +Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; @@ -202,9 +202,9 @@ Entry.block.distance_something=function(b,a){a=a.getField("VALUE",a);if("mouse"= Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){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);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var d=a.getField("VALUE",a);b="self"==d?b:Entry.container.getEntity(d);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1));case "picture_name":return a=b.parent,a=a.pictures,a[a.indexOf(b.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a);b="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1));case "picture_name":return a=b.parent,a=a.pictures,a[a.indexOf(b.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_basic=function(b,a){b=a.getField("OPERATOR",a);var d=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?d+a:"MINUS"==b?d-a:"MULTI"==b?d*a:d/a};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_basic=function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?c+a:"MINUS"==b?c-a:"MULTI"==b?c*a:c/a};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b+a};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_minus=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b-a};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_times=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b*a};Blockly.Blocks.calc_divide={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("/",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -219,21 +219,21 @@ Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);th Entry.block.calc_operation=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(a)&&(1b))throw Error("x range exceeded");a.indexOf("_")&&(a=a.split("_")[0]);-1<["sin","cos","tan"].indexOf(a)&&(b=Entry.toRadian(b));switch(a){case "square":a=b*b;break;case "factorial":a=Entry.factorial(b);break;case "root":a=Math.sqrt(b);break;case "log":a=Math.log(b)/Math.LN10;break;case "ln":a=Math.log(b);break;case "asin":case "acos":case "atan":a= Entry.toDegrees(Math[a](b));break;case "unnatural":a=b-Math.floor(b);0>b&&(a=1-a);break;default:a=Math[a](b)}return Math.round(1E3*a)/1E3}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var d=Math.min(b,a),c=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(c-d)+d).toFixed(2):Math.floor(Math.random()*(c-d+1)+d)}; +Entry.block.calc_rand=function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var c=Math.min(b,a),d=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){b=a.getField("VALUE",a);a=new Date;return"YEAR"==b?a.getFullYear():"MONTH"==b?a.getMonth()+1:"DAY"==b?a.getDate():"HOUR"==b?a.getHours():"MINUTE"==b?a.getMinutes():a.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(b,a){a=a.getField("VALUE",a);b=b.parent.sounds;for(var d=0;da||a>b.length-1)throw Error();return b[a]}; Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){b=a.getStringValue("STRING",a);var d=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var c=b.length-1;if(0>d||0>a||d>c||a>c)throw Error();return b.substring(Math.min(d,a),Math.max(d,a)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){b=a.getStringValue("STRING",a);var c=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var d=b.length-1;if(0>c||0>a||c>d||a>d)throw Error();return b.substring(Math.min(c,a),Math.max(c,a)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", "String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], @@ -245,10 +245,10 @@ this.setOutput(!0,"String")}};Entry.block.combine_something=function(b,a){b=a.ge Blockly.Blocks.quotient_and_mod={init:function(){this.setColour(calcBlockColor);"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_1,calcFontColor),this.appendValueInput("LEFTHAND").setCheck(["Number","String"]),this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_2,calcFontColor),this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]),this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_3,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_quotient_and_mod_sub_1, "QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2,"MOD"]],null,!0,calcArrowColor),"OPERATOR")):"en"==Lang.type&&(this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2,"MOD"]],null,!0,calcArrowColor),"OPERATOR"),this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_2,calcFontColor),this.appendValueInput("LEFTHAND").setCheck(["Number", "String"]),this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_3,calcFontColor),this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]));this.appendDummyInput().appendField(Lang.Blocks.CALC_quotient_and_mod_4,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.quotient_and_mod=function(b,a){b=a.getNumberValue("LEFTHAND",a);var d=a.getNumberValue("RIGHTHAND",a);if(isNaN(b)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(b/d):b%d}; +Entry.block.quotient_and_mod=function(b,a){b=a.getNumberValue("LEFTHAND",a);var c=a.getNumberValue("RIGHTHAND",a);if(isNaN(b)||isNaN(c))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(b/c):b%c}; Blockly.Blocks.choose_project_timer_action={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_choose_project_timer_action_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],null,!0,calcArrowColor),"ACTION").appendField(Lang.Blocks.CALC_choose_project_timer_action_2, calcFontColor).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/calc_01.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)},whenAdd:function(){Entry.engine&&Entry.engine.showProjectTimer()},whenRemove:function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}}; -Entry.block.choose_project_timer_action=function(b,a){b=a.getField("ACTION");var d=Entry.engine,c=d.projectTimer;"START"==b?c.isInit?c.isInit&&c.isPaused&&(c.pauseStart&&(c.pausedTime+=(new Date).getTime()-c.pauseStart),delete c.pauseStart,c.isPaused=!1):d.startProjectTimer():"STOP"==b?c.isInit&&!c.isPaused&&(c.isPaused=!0,c.pauseStart=(new Date).getTime()):"RESET"==b&&c.isInit&&(c.setValue(0),c.start=(new Date).getTime(),c.pausedTime=0,delete c.pauseStart);return a.callReturn()};Entry.Cobl={name:"cobl",setZero:function(){for(var b=0;14>b;b++)Entry.hw.sendQueue[b]=0;Entry.hw.update()}};Blockly.Blocks.cobl_read_ultrason={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_ultrason=function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}; +Entry.block.choose_project_timer_action=function(b,a){b=a.getField("ACTION");var c=Entry.engine,d=c.projectTimer;"START"==b?d.isInit?d.isInit&&d.isPaused&&(d.pauseStart&&(d.pausedTime+=(new Date).getTime()-d.pauseStart),delete d.pauseStart,d.isPaused=!1):c.startProjectTimer():"STOP"==b?d.isInit&&!d.isPaused&&(d.isPaused=!0,d.pauseStart=(new Date).getTime()):"RESET"==b&&d.isInit&&(d.setValue(0),d.start=(new Date).getTime(),d.pausedTime=0,delete d.pauseStart);return a.callReturn()};Entry.Cobl={name:"cobl",setZero:function(){for(var b=0;14>b;b++)Entry.hw.sendQueue[b]=0;Entry.hw.update()}};Blockly.Blocks.cobl_read_ultrason={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_ultrason=function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}; Blockly.Blocks.cobl_read_potenmeter={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uac00\ubcc0\uc800\ud56d \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_potenmeter=function(b,a){console.log("cobl_read_potenmeter");return Entry.hw.getAnalogPortValue("potenmeter")}; Blockly.Blocks.cobl_read_irread1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR1 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_irread1=function(b,a){return Entry.hw.getAnalogPortValue("potenmeter")};Blockly.Blocks.cobl_read_irread2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR2 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}}; Entry.block.cobl_read_irread2=function(b,a){a.getValue("irread2",a);return Entry.hw.getAnalogPortValue("irread2")};Blockly.Blocks.cobl_read_joyx={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1X\ucd95 \uc77d\uae30(1,0,-1)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_joyx=function(b,a){return Entry.hw.getAnalogPortValue("joyx")}; @@ -260,37 +260,37 @@ Blockly.Blocks.cobl_read_temps={init:function(){this.setColour("#00979D");this.a Blockly.Blocks.cobl_read_light={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc1d\uae30\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_light=function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getAnalogPortValue("light1");if(2==b)return Entry.hw.getAnalogPortValue("light2")}; Blockly.Blocks.cobl_read_btn={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\ud2bc\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.cobl_read_btn=function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getDigitalPortValue("btn1");if(2==b)return Entry.hw.getDigitalPortValue("btn2")}; Blockly.Blocks.cobl_led_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Rainbow LED");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"]]),"PORT");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OFF","OFF"],["Red","Red"],["Orange","Orange"],["Yellow","Yellow"],["Green","Green"],["Blue","Blue"],["Dark Blue","Dark Blue"],["Purple","Purple"],["White","White"]]), -"OPERATOR");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_led_control=function(b,a){b=a.getStringField("PORT");var d=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",b);Entry.hw.setDigitalPortValue("RainBowLED_COL",d);return a.callReturn()};Blockly.Blocks.cobl_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}}; +"OPERATOR");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_led_control=function(b,a){b=a.getStringField("PORT");var c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",b);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return a.callReturn()};Blockly.Blocks.cobl_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}}; Entry.block.cobl_text=function(b,a){return a.getStringField("NAME")};Blockly.Blocks.cobl_servo_angle_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Servo");this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField("Angle-");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(15~165)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_servo_angle_control=function(b,a){console.log("servo - test");b=a.getNumberValue("PORT");var d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,15),d=Math.min(d,165);1==b&&(console.log("servo 1 degree "+d),Entry.hw.setDigitalPortValue("Servo1",d));2==b&&(console.log("servo 2 degree "+d),Entry.hw.setDigitalPortValue("Servo2",d));return a.callReturn()}; +Entry.block.cobl_servo_angle_control=function(b,a){console.log("servo - test");b=a.getNumberValue("PORT");var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==b&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==b&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return a.callReturn()}; Blockly.Blocks.cobl_melody={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Melody");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["(Low)So","L_So"],["(Low)So#","L_So#"],["(Low)La","L_La"],["(Low)La#","L_La#"],["(Low)Ti","L_Ti"],["Do","Do"],["Do#","Do#"],["Re","Re"],["Re#","Re#"],["Mi","Mi"],["Fa","Fa"],["Fa#","Fa#"],["So","So"],["So#","So#"],["La","La"],["La#","La#"],["Ti","Ti"],["(High)Do","H_Do"],["(High)Do#","H_Do#"],["(High)Re","H_Re"],["(High)R2#", "H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]]),"MELODY");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_melody=function(b,a){b=a.getStringField("MELODY");console.log("cobl_melody"+b);Entry.hw.setDigitalPortValue("Melody",b);return a.callReturn()}; Blockly.Blocks.cobl_dcmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DcMotor");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"MOTOR");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1.Clockwise","1"],["2.Counter Clockwise","2"],["3.Stop","3"]]),"DIRECTION");this.appendDummyInput().appendField(" Speed");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"SPEED");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_dcmotor=function(b,a){b=a.getStringField("MOTOR");var d=a.getStringField("DIRECTION"),c=a.getStringField("SPEED");console.log("MOTOR"+b+" Direction"+d+" speed"+c);1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",d),Entry.hw.setDigitalPortValue("DC1_SPEED",c));2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",d),Entry.hw.setDigitalPortValue("DC2_SPEED",c));return a.callReturn()}; +Entry.block.cobl_dcmotor=function(b,a){b=a.getStringField("MOTOR");var c=a.getStringField("DIRECTION"),d=a.getStringField("SPEED");console.log("MOTOR"+b+" Direction"+c+" speed"+d);1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d));2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d));return a.callReturn()}; Blockly.Blocks.cobl_extention_port={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Extention Port");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"PORT");this.appendDummyInput().appendField(" Level");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"LEVEL");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_extention_port=function(b,a){b=a.getStringField("PORT");var d=a.getStringField("LEVEL");1==b&&Entry.hw.setDigitalPortValue("EXUSB1",d);2==b&&Entry.hw.setDigitalPortValue("EXUSB2",d);return a.callReturn()}; +Entry.block.cobl_extention_port=function(b,a){b=a.getStringField("PORT");var c=a.getStringField("LEVEL");1==b&&Entry.hw.setDigitalPortValue("EXUSB1",c);2==b&&Entry.hw.setDigitalPortValue("EXUSB2",c);return a.callReturn()}; Blockly.Blocks.cobl_external_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("External LED ");this.appendValueInput("LED").setCheck(["Number","String"]);this.appendDummyInput().appendField(" (1~64)");this.appendDummyInput().appendField(" R ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"RED");this.appendDummyInput().appendField(" G ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"GREEN");this.appendDummyInput().appendField(" B ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"BLUE");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_external_led=function(b,a){b=a.getNumberValue("LED");var d=a.getStringField("RED"),c=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",d);Entry.hw.setDigitalPortValue("ELED_G",c);Entry.hw.setDigitalPortValue("ELED_B",e);return a.callReturn()}; +Entry.block.cobl_external_led=function(b,a){b=a.getNumberValue("LED");var c=a.getStringField("RED"),d=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);return a.callReturn()}; Blockly.Blocks.cobl_7_segment={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("7 Segment");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(0~9999)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_7_segment=function(b,a){b=a.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",b);return a.callReturn()};Entry.Codestar={name:"codestar",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/codestar.png",width:333,height:409,listPorts:{13:{name:"\uc9c4\ub3d9\ubaa8\ud130",type:"output",pos:{x:0,y:0}},6:{name:"\uc9c4\ub3d9\uc13c\uc11c",type:"input",pos:{x:0,y:0}}},ports:{7:{name:"\ube68\uac04\uc0c9",type:"output",pos:{x:238,y:108}},8:{name:"\ud30c\ub780\uc0c9",type:"output", pos:{x:265,y:126}},9:{name:"3\uc0c9 \ube68\uac04\uc0c9",type:"output",pos:{x:292,y:34}},10:{name:"3\uc0c9 \ub179\uc0c9",type:"output",pos:{x:292,y:34}},11:{name:"3\uc0c9 \ud30c\ub780\uc0c9",type:"output",pos:{x:292,y:34}},12:{name:"\ubc84\ud2bc",type:"input",pos:{x:248,y:142}},a0:{name:"\uc67c\ucabd \ubcbd\uac10\uc9c0",type:"input",pos:{x:24,y:231}},a2:{name:"\ub9c8\uc774\ud06c",type:"input",pos:{x:225,y:67}},a3:{name:"\ubd80\uc800",type:"output",pos:{x:283,y:105}},a4:{name:"\uc67c\ucabd \ub77c\uc778\uac10\uc9c0", type:"input",pos:{x:37,y:353}},a5:{name:"\uc624\ub978\ucabd \ub77c\uc778\uac10\uc9c0",type:"input",pos:{x:50,y:368}},a6:{name:"\uc870\ub3c4\uc13c\uc11c",type:"input",pos:{x:273,y:22}},a7:{name:"\uc624\ub978\ucabd \ubcbd\uac10\uc9c0",type:"input",pos:{x:103,y:381}},temperature:{name:"\uc628\ub3c4\uc13c\uc11c",type:"input",pos:{x:311,y:238}},sonar:{name:"\ucd08\uc74c\ud30c",type:"input",pos:{x:7,y:277}},leftwheel:{name:"\uc67c\ucabd \ubc14\ud034",type:"output",pos:{x:177,y:370}},rightwheel:{name:"\uc624\ub978\ucabd \ubc14\ud034", type:"output",pos:{x:83,y:218}}},mode:"both"}};Entry.EV3={PORT_MAP:{A:0,B:0,C:0,D:0,1:void 0,2:void 0,3:void 0,4:void 0},motorMovementTypes:{Degrees:0,Power:1},deviceTypes:{NxtTouch:1,NxtLight:2,NxtSound:3,NxtColor:4,NxtUltrasonic:5,NxtTemperature:6,LMotor:7,MMotor:8,Touch:16,Color:29,Ultrasonic:30,Gyroscope:32,Infrared:33,Initializing:125,Empty:126,WrongPort:127,Unknown:255},colorSensorValue:" 000000 0000FF 00FF00 FFFF00 FF0000 FFFFFF A52A2A".split(" "),timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b); 0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},setZero:function(){var b=this.PORT_MAP;Object.keys(b).forEach(function(a){/[A-D]/i.test(a)?Entry.hw.sendQueue[a]={type:Entry.EV3.motorMovementTypes.Power,power:0}:Entry.hw.sendQueue[a]=b[a]});Entry.hw.update()},name:"EV3"}; -Blockly.Blocks.ev3_get_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.ev3_get_sensor_value=function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var d;$.isPlainObject(b)&&(d=b.siValue||0);return d}; +Blockly.Blocks.ev3_get_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.ev3_get_sensor_value=function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c;$.isPlainObject(b)&&(c=b.siValue||0);return c}; Blockly.Blocks.ev3_touch_sensor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.ev3_touch_sensor=function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));a=!1;b.type==Entry.EV3.deviceTypes.Touch&&1<=Number(b.siValue)&&(a=!0);return a}; Blockly.Blocks.ev3_color_sensor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 ").appendField(new Blockly.FieldDropdown([["RGB","RGB"],["R","R"],["G","G"],["B","B"]]),"RGB").appendField("\uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.ev3_color_sensor=function(b,a){a.getStringField("PORT",a);b=a.getStringField("RGB",a);a=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var d="";if(a.type==Entry.EV3.deviceTypes.Color)if(0==a.siValue)d="";else switch(b){case "RGB":d=Entry.EV3.colorSensorValue[a.siValue];break;case "R":d=Entry.EV3.colorSensorValue[a.siValue].substring(0,2);break;case "G":d=Entry.EV3.colorSensorValue[a.siValue].substring(2,4);break;case "B":d=Entry.EV3.colorSensorValue[a.siValue].substring(4,6)}else d= -"\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return d};Blockly.Blocks.ev3_motor_power={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.ev3_motor_power=function(b,a){b=a.getStringField("PORT",a);var d=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};return a.callReturn()}; +Entry.block.ev3_color_sensor=function(b,a){a.getStringField("PORT",a);b=a.getStringField("RGB",a);a=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c="";if(a.type==Entry.EV3.deviceTypes.Color)if(0==a.siValue)c="";else switch(b){case "RGB":c=Entry.EV3.colorSensorValue[a.siValue];break;case "R":c=Entry.EV3.colorSensorValue[a.siValue].substring(0,2);break;case "G":c=Entry.EV3.colorSensorValue[a.siValue].substring(2,4);break;case "B":c=Entry.EV3.colorSensorValue[a.siValue].substring(4,6)}else c= +"\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return c};Blockly.Blocks.ev3_motor_power={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.ev3_motor_power=function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}; Blockly.Blocks.ev3_motor_power_on_time={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("TIME").setCheck(["Number"]);this.appendDummyInput().appendField("\ucd08 \ub3d9\uc548");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)}}; -Entry.block.ev3_motor_power_on_time=function(b,a){b=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var d=a.getValue("TIME",a),c=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};var e=setTimeout(function(){a.timeFlag= -0;Entry.EV3.removeTimeout(e)},1E3*d);Entry.EV3.timeouts.push(e);return a}; +Entry.block.ev3_motor_power_on_time=function(b,a){b=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),d=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};var e=setTimeout(function(){a.timeFlag= +0;Entry.EV3.removeTimeout(e)},1E3*c);Entry.EV3.timeouts.push(e);return a}; Blockly.Blocks.ev3_motor_degrees={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\uc2dc\uacc4\ubc29\ud5a5","CW"],["\ubc18\uc2dc\uacc4\ubc29\ud5a5","CCW"]]),"DIRECTION").appendField("\uc73c\ub85c ");this.appendValueInput("DEGREE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub3c4 \ub9cc\ud07c \ud68c\uc804"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.ev3_motor_degrees=function(b,a){b=a.getStringField("PORT",a);var d=a.getValue("DEGREE",a);0>=d?d=0:720<=d&&(d=720);var c=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:d,power:"CW"==c?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.ev3_motor_degrees=function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("DEGREE",a);0>=c?c=0:720<=c&&(c=720);var d=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==d?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*b*1E3);return a}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.repeat_basic=function(b,a){if(!a.isLooped){a.isLooped=!0;b=a.getNumberValue("VALUE",a);if(0>b)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(b)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; @@ -303,31 +303,31 @@ Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn( Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();b=a.getBooleanValue("BOOL",a);a.isLooped=!0;return b?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(b,a){var d=a.getField("VALUE",a);a=a.callReturn();"self"==d?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(d).addCloneEntity(b.parent,null,null);return a};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a);a=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return a};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){b=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(b=!b);return(a.isLooped=b)?a.getStatement("DO",a):a.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){a=a.getField("TARGET",a);var d=Entry.container;switch(a){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; +"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){a=a.getField("TARGET",a);var c=Entry.container;switch(a){case "all":return c.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){b=b.parent.getClonedEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_label={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#f9c535",template:"%1%2",params:[{type:"TextInput",value:"\ud568\uc218"},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_string={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#ffd974",template:"%1%2",params:[{type:"Block",accept:"stringMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_boolean={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#aeb8ff",template:"%1%2",params:[{type:"Block",accept:"booleanMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.stringHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_string=function(b,a,d){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +this.hashId);return b}};Entry.block.function_param_string=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.booleanHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,d){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(b,a){return a.callReturn()}; Entry.block.function_create={skeleton:"basic",color:"#cc7337",event:"funcDef",template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2",params:[{type:"Block",accept:"paramMagnet",value:{type:"function_field_label"}},{type:"Indicator",img:"/lib/entryjs/images/block_icon/function_03.png",size:12}],func:function(){}}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(b){var a=b.getElementsByTagName("field");this.appendDummyInput().appendField("");a.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var d=0;da.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,b.leftWheel=45+.25*d,b.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;b.leftWheel=45+.25*d;b.rightWheel=45-.25*d;a.boardState=3;var c=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(c)},250);Entry.Hamster.timeouts.push(c); -break;case 3:d=d.leftFloor-d.rightFloor;b.leftWheel=45+.25*d;b.rightWheel=45-.25*d;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a}; +Entry.block.hamster_move_forward_once=function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData;if(a.isStart){if(a.isMoving){switch(a.boardState){case 1:2>a.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,b.leftWheel=45+.25*c,b.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;a.boardState=3;var d=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d); +break;case 3:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a}; Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_once_right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(b,a){b=Entry.hw.sendQueue;var d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){b=Entry.hw.sendQueue;var d=a.getField("PORT",a),c=Number(a.getField("MODE",a));"A"==d?b.ioModeA=c:("B"!=d&&(b.ioModeA=c),b.ioModeB=c);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT",a),d=Number(a.getField("MODE",a));"A"==c?b.ioModeA=d:("B"!=c&&(b.ioModeA=d),b.ioModeB=d);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){b=Entry.hw.sendQueue;var d=a.getField("PORT"),c=a.getNumberValue("VALUE");"A"==d?b.outputA=void 0!=b.outputA?b.outputA+c:c:("B"!=d&&(b.outputA=void 0!=b.outputA?b.outputA+c:c),b.outputB=void 0!=b.outputB?b.outputB+c:c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=void 0!=b.outputA?b.outputA+d:d:("B"!=c&&(b.outputA=void 0!=b.outputA?b.outputA+d:d),b.outputB=void 0!=b.outputB?b.outputB+d:d);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){b=Entry.hw.sendQueue;var d=a.getField("PORT"),c=a.getNumberValue("VALUE");"A"==d?b.outputA=c:("B"!=d&&(b.outputA=c),b.outputB=c);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=d:("B"!=c&&(b.outputA=d),b.outputB=d);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){b=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(b)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var d=a.getField("VALUE",a);a=b.object;var c=/wall/.test(d),e=ndgmr.checkPixelCollision;if(c)switch(b=Entry.stage.wall,d){case "wall":if(e(a,b.up,.2,!0)||e(a,b.down,.2,!0)||e(a,b.left,.2,!0)||e(a,b.right,.2,!0))return!0;break;case "wall_up":if(e(a,b.up,.2,!0))return!0;break;case "wall_down":if(e(a,b.down,.2,!0))return!0;break;case "wall_right":if(e(a,b.right,.2,!0))return!0;break;case "wall_left":if(e(a,b.left,.2,!0))return!0}else{if("mouse"== -d)return e=Entry.stage.canvas,e=a.globalToLocal(e.mouseX,e.mouseY),a.hitTest(e.x,e.y);d=Entry.container.getEntity(d);if("textBox"==d.type||"textBox"==b.type){e=d.object.getTransformedBounds();a=a.getTransformedBounds();if(Entry.checkCollisionRect(a,e))return!0;b=d.parent.clonedEntities;d=0;for(c=b.length;d","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=function(b,a){b=a.getField("OPERATOR",a);var d=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?d==a:"BIGGER"==b?d>a:d","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_comparison=function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?c==a:"BIGGER"==b?c>a:c","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.boolean_bigger=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b>a};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.boolean_smaller=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){b=a.getField("OPERATOR",a);var d=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return d==a;case "GREATER":return Number(d)>Number(a);case "LESS":return Number(d)=Number(a);case "LESS_OR_EQUAL":return Number(d)<=Number(a)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){b=a.getField("OPERATOR",a);var c=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return c==a;case "GREATER":return Number(c)>Number(a);case "LESS":return Number(c)=Number(a);case "LESS_OR_EQUAL":return Number(c)<=Number(a)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dialog_time=function(b,a){if(!a.isStart){var d=a.getNumberValue("SECOND",a),c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;c||"number"==typeof c||(c=" ");c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*d)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; +Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(b,a){var d=a.getStringValue("VALUE",a);d||"number"==typeof d||(d=" ");var c=a.getField("OPTION",a),d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,c);b.syncDialogVisible(b.getVisible());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}; Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(b,a){var d=a.getField("VALUE",a),d=b.parent.getPicture(d);b.setImage(d);return a.callReturn()}; +Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(b,a){var d;d=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(d);return a.callReturn()}; +Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c+b.effect.hue:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c+b.effect.brightness:"blur"!=d&&"opacity"==d&&(b.effect.alpha+=c/100));b.applyFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c:"blur"!=d&&"opacity"==d&&(b.effect.alpha=c/100));b.applyFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}; Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(b,a){var d=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*d);b.setScaleY(b.getScaleY()*d);return a.callReturn()}; +Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=function(b,a){var d=a.getNumberValue("VALUE",a)/100,c=b.snapshot_;b.setScaleX(d*c.scaleX);b.setScaleY(d*c.scaleY);return a.callReturn()}; +Entry.block.set_scale_percent=function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+d);return a.callReturn()}; +Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(d);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; +Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(b,a){var d=a.getField("VALUE",a);b=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1b)throw Error("object is not available for current scene");switch(c){case "FRONT":d=0;break;case "FORWARD":d=Math.max(0,b-1);break;case "BACKWARD":d=Math.min(e,b+1);break;case "BACK":d=e}Entry.container.moveElementByBlock(b,d);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(b,a){var c,d=a.getField("LOCATION",a),e=Entry.container.getCurrentObjects();b=e.indexOf(b.parent);e=e.length-1;if(0>b)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,b-1);break;case "BACKWARD":c=Math.min(e,b+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(b,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(b.getY()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){d=a.x-b.getX();var c=a.y-b.getY();d/=a.frameCount;c/=a.frameCount;b.setX(b.getX()+d);b.setY(b.getY()+c);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+d);return a.callReturn()}; +Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var d=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(d));return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()}; +Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_direction=function(b,a){var d=a.getField("VALUE",a),c=Entry.container.getEntity(d),d=c.getX()-b.getX(),c=c.getY()-b.getY();0<=d?b.setRotation(Math.atan(c/d)/Math.PI*180+90):b.setRotation(Math.atan(c/d)/Math.PI*180+270);return a.callReturn()}; +Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var d=a.getNumberValue("VALUE1",a);b.setX(d);d=a.getNumberValue("VALUE2",a);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_y=function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var d=a.getField("VALUE",a),c;"mouse"==d?(d=Entry.stage.mouseCoordinate.x,c=Entry.stage.mouseCoordinate.y):(c=Entry.container.getEntity(d),d=c.getX(),c=c.getY());b.setX(Number(d));b.setY(Number(c));b.brush&&!b.brush.stop&&b.brush.lineTo(d,-1*c);return a.callReturn()}; +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(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_xy_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dX=c/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(b,a){var d=b.parent.getRotateMethod(),c="free"==d?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>c&&0<=c||360>c&&270<=c){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision== -Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>c&&90<=c&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==d? -b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>c&&180<=c?(e=b.collision==Entry.Utils.COLLISION.LEFT, -c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()): -b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>c&&0<=c&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,c=ndgmr.checkPixelCollision(Entry.stage.wall.left, -b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; +Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision== +Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c? +b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): +b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle_object=function(b,a){var d=a.getField("VALUE",a),c=b.getX(),e=b.getY();if(b.parent.id==d)return a.callReturn();"mouse"==d?(d=Entry.stage.mouseCoordinate.y,c=Entry.stage.mouseCoordinate.x-c,e=d-e):(d=Entry.container.getEntity(d),c=d.getX()-c,e=d.getY()-e);e=0===c&&0===e?b.getDirection()+b.getRotation():0<=c?-Math.atan(e/c)/Math.PI*180+90:-Math.atan(e/c)/Math.PI*180+270;c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-c);return a.callReturn()}; +Entry.block.see_angle_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle_direction=function(b,a){var d=a.getNumberValue("VALUE",a),c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+d-c);return a.callReturn()}; +Entry.block.see_angle_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()}; +Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var d,c,e;c=a.getField("TARGET",a);d=a.getNumberValue("VALUE",a);d=Math.floor(d*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=d)"mouse"==c?(c=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(c),c=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=d,a.dX=c/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==c?(c=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(c),c=e.getX(),e=e.getY()),b.setX(c),b.setY(e),b.brush&& +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;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=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)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_absolute=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d);return a.callReturn()}; +Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_relative=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d+b.getRotation());return a.callReturn()}; +Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; Blockly.Blocks.direction_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_absolute=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()}; +Entry.block.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()}; +Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var d=a.getNumberValue("VALUE",a),c=a.getNumberValue("ANGLE",a);b.setX(b.getX()+d*Math.cos((c-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((c-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var c=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dDirection=c/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, y:0}},FND:{name:"FND",type:"output",pos:{x:0,y:0}}},ports:{IN1:{name:"IN1",type:"input",pos:{x:270,y:200}},IN2:{name:"IN2",type:"input",pos:{x:325,y:200}},IN3:{name:"IN3",type:"input",pos:{x:325,y:500}},DCL:{name:"L-Motor",type:"output",pos:{x:270,y:500}},DCR:{name:"R-Motor",type:"output",pos:{x:435,y:500}},OUT1:{name:"OUT1",type:"output",pos:{x:380,y:200}},OUT2:{name:"OUT2",type:"output",pos:{x:435,y:200}},OUT3:{name:"OUT3",type:"output",pos:{x:380,y:500}}},mode:"both"}}; Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b]}; Blockly.Blocks.neobot_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){b=a.getNumberField("SPEED");var d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+c;return a.callReturn()}; Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}; Blockly.Blocks.neobot_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){b=a.getNumberField("SPEED");var d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+c;return a.callReturn()}; Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}; Blockly.Blocks.neobot_all_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc591\ucabd \ubaa8\ud130\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField(" \uc758 \uc18d\ub3c4\ub85c ").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4","1"],["\ud6c4\uc9c4", "2"],["\uc81c\uc790\ub9ac \uc88c\ud68c\uc804","3"],["\uc81c\uc790\ub9ac \uc6b0\ud68c\uc804","4"],["\uc88c\ud68c\uc804","5"],["\uc6b0\ud68c\uc804","6"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -530,16 +530,16 @@ Entry.block.neobot_all_motor=function(b,a){a.getNumberField("TYPE");b=a.getNumbe 16+b,Entry.hw.sendQueue.DCR=0}return a.callReturn()}; Blockly.Blocks.neobot_set_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","10"],["20\ub3c4","20"],["30\ub3c4","30"],["40\ub3c4","40"],["50\ub3c4","50"],["60\ub3c4","60"],["70\ub3c4","70"],["80\ub3c4","80"],["90\ub3c4","90"],["100\ub3c4","100"],["110\ub3c4", "110"],["120\ub3c4","120"],["130\ub3c4","130"],["140\ub3c4","140"],["150\ub3c4","150"],["160\ub3c4","160"],["170\ub3c4","170"],["180\ub3c4","180"]]),"DEGREE").appendField(" \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_servo=function(b,a){b=a.getNumberField("PORT");var d=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+b]=d;3===b&&(b=4);Entry.hw.sendQueue.OPT|=b;return a.callReturn()}; +Entry.block.neobot_set_servo=function(b,a){b=a.getNumberField("PORT");var c=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+b]=c;3===b&&(b=4);Entry.hw.sendQueue.OPT|=b;return a.callReturn()}; Blockly.Blocks.neobot_set_output={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub9cc\ud07c \ucd9c\ub825").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.neobot_set_output=function(b,a){b=a.getStringField("PORT",a);var d=a.getNumberValue("VALUE",a),c=b;0>d?d=0:255c?c=0:255b&&(b=0);Entry.hw.sendQueue.FND=b;return a.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([["\ubb34\uc74c","0"],[Lang.General.note_c,"1"],[Lang.General.note_c+"#","2"],[Lang.General.note_d,"3"],[Lang.General.note_d+"#","4"],[Lang.General.note_e,"5"],[Lang.General.note_f,"6"],[Lang.General.note_f+"#","7"],[Lang.General.note_g,"8"],[Lang.General.note_g+"#","9"],[Lang.General.note_a,"10"],[Lang.General.note_a+"#","11"], [Lang.General.note_b,"12"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2","1"],["3","2"],["4","3"],["5","4"],["6","5"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"],["16\ubd84\uc74c\ud45c","16"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.SND=0;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("NOTE",a),c=a.getNumberField("OCTAVE",a),e=a.getNumberField("DURATION",a),d=d+12*c;a.isStart=!0;a.timeFlag=1;65b;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),d=a;db;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),d=a;db;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),c=a;cb;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),c=a;cc&&(c=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,d,c]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,2,d,c]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,d,c]);return a.callReturn()}; +Entry.block.schoolkit_motor=function(b,a){var c;c=a.getField("MODE");b=a.getField("OPERATOR");var d=a.getNumberValue("VALUE");c="motor1"==c?7:8;255d&&(d=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,c,d]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,2,c,d]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,c,d]);return a.callReturn()}; Blockly.Blocks.schoolkit_set_servo_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.roborobo_num_pin_1);this.appendValueInput("PIN").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.roborobo_num_pin_2);this.appendDummyInput().appendField(" : ");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.roborobo_degree);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.schoolkit_set_servo_value=function(b,a){b=a.getNumberValue("PIN");var d=a.getNumberValue("VALUE");0>d?d=0:180=d)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= -0},d);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var d=b=(new Date).getTime();dc?c=0:180=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= +0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=b=(new Date).getTime();cd&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(b,a){b=a.getField("PORT",a);var c=a.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(b,a){b=a.getField("PORT",a);var d=a.getField("LED_MODULE",a),c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(b,a){b=a.getField("PORT",a);var c=a.getField("LED_MODULE",a),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){b=a.getField("PORT",a);var d=a.getNumberValue("VALUE"),c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){b=a.getField("PORT",a);var c=a.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(b,a){b=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var d,c;d=a.getNumberValue("ADDRESS");c=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[b,d,65535b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; Entry.block.sound_volume_set=function(b,a){b=a.getNumberValue("VALUE",a)/100;1b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(b,a){var d=a.getStringValue("VALUE",a);(b=b.parent.getSound(d))&&createjs.Sound.play(b.id);return a.callReturn()}; +Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id);return a.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var d=a.getStringValue("VALUE",a),c=a.getNumberValue("SECOND",a);(b=b.parent.getSound(d))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*c});return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*d});return a.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a}; +Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var c=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){c.stop();a.playState=0},1E3*b);c.addEventListener("complete",function(a){})}return a}; +Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*b);d.addEventListener("complete",function(a){})}return a}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var d=1E3*a.getNumberValue("START",a),c=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(d,c),duration:Math.max(d,c)-Math.min(d,c)})}return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var c=1E3*a.getNumberValue("START",a),d=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return a.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),d=Math.min(c,e),c=Math.max(c,e)-d;createjs.Sound.play(b.id,{startTime:d,duration:c});setTimeout(function(){a.playState=0},c)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; +Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(b.id,{startTime:c,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, "39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; @@ -686,44 +686,44 @@ Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");th Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}, whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){b=a.getField("VALUE",a);var d=Entry.isExist(b,"id",Entry.variableContainer.messages_);if("null"==b||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",b]);return a.callReturn()}; +b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){b=a.getField("VALUE",a);var c=Entry.isExist(b,"id",Entry.variableContainer.messages_);if("null"==b||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",b]);return a.callReturn()}; Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}}; -Entry.block.message_cast_wait=function(b,a){if(a.runningScript){b=a.runningScript;for(var d=b.length,c=0;cb.array_.length)throw Error("can not remove value from array");b.array_.splice(c-1,1);b.updateView();return a.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(d)||d>b.array_.length)throw Error("can not remove value from array");b.array_.splice(d-1,1);b.updateView();return a.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);if(!b.array_||isNaN(e)||0==e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:c});b.updateView();return a.callReturn()}; +Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||0==e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:d});b.updateView();return a.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);if(!b.array_||isNaN(e)||e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=c;b.updateView();return a.callReturn()}; +Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=d;b.updateView();return a.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var d=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data}; Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){b=a.getField("LIST",a);return Entry.variableContainer.getList(b).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.show_list=function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!0);return a.callReturn()}; @@ -734,39 +734,39 @@ Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(b,a){b=a.getField("LIST",a);a=a.getStringValue("DATA",a);b=Entry.variableContainer.getList(b);if(!b)return!1;b=b.array_;for(var d=0,c=b.length;db||0>c||b>e||c>e||a.splice.call(this,c,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b=a.x&&e-d<=a.y&&e+b.height+d>=a.y}; -Entry.Utils.colorDarken=function(b,a){function d(a){2!=a.length&&(a="0"+a);return a}var c,e;7===b.length?(c=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(c=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;c=d(Math.floor(c*a).toString(16));e=d(Math.floor(e*a).toString(16));b=d(Math.floor(b*a).toString(16));return"#"+c+e+b}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;b=Entry.Utils.hexToHsl(b);b.l+=a/100;b.l=Math.min(1,Math.max(0,b.l));return Entry.Utils.hslToHex(b)};Entry.Utils.bound01=function(b,a){var d=b;"string"==typeof d&&-1!=d.indexOf(".")&&1===parseFloat(d)&&(b="100%");d="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));d&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,d;7===b.length?(a=parseInt(b.substr(1,2),16),d=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),d=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);d=Entry.Utils.bound01(d,255);b=Entry.Utils.bound01(b,255);var c=Math.max(a,d,b),e=Math.min(a,d,b),f,g=(c+e)/2;if(c==e)f=e=0;else{var h=c-e,e=.5d&&(d+=1);1d?b:d<2/3?a+(b-a)*(2/3-d)*6:a}function d(a){return 1==a.length?"0"+a:""+a}var c,e;e=Entry.Utils.bound01(b.h,360);c=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===c)c=b=e=b;else{var f=.5>b?b*(1+c):b+c-b*c,g=2*b-f;c=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[d(Math.round(255*c).toString(16)),d(Math.round(b).toString(16)),d(Math.round(e).toString(16))].join("")}; +this.setNextStatement(!0)}};Entry.block.xbot_lcd=function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberField("LINE",a),d=a.getStringValue("VALUE",a);0==c?(b.lcdNum=0,b.lcdTxt=d):1==c&&(b.lcdNum=1,b.lcdTxt=d);return a.callReturn()};Entry.Collection=function(b){this.length=0;this._hashMap={};this._observers=[];this.set(b)}; +(function(b,a){b.set=function(b){for(;this.length;)a.pop.call(this);var c=this._hashMap,e;for(e in c)delete c[e];if(void 0!==b){e=0;for(var f=b.length;eb||0>d||b>c||d>c||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; +Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));b=c(Math.floor(b*a).toString(16));return"#"+d+e+b}; +Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;b=Entry.Utils.hexToHsl(b);b.l+=a/100;b.l=Math.min(1,Math.max(0,b.l));return Entry.Utils.hslToHex(b)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; +Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var d=0,c=this.events_[b].length;d=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; -Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,d){return"#"+(16777216+(b<<16)+(a<<8)+d).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,d){return b>d?d:b=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; +Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},d;for(d in b)a[d]=b[d];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),d=-1,c=b.length;++d!==c;a[d]=b[d]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],d=0;da.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; +Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cc&&(c=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,d){setTimeout(function(){b.addEventListener(a,d)},0)};Entry.deAttachEventListener=function(b,a,d){b.removeEventListener(a,d)}; -Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function d(){}d.prototype=b.prototype;a.prototype=new d;return a}; +Entry.getBrowserType=function(){if(Entry.userAgent)return Entry.userAgent;var b=navigator.userAgent,a,c=b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(c[1]))return a=/\brv[ :]+(\d+)/g.exec(b)||[],"IE "+(a[1]||"");if("Chrome"===c[1]&&(a=b.match(/\b(OPR|Edge)\/(\d+)/),null!=a))return a.slice(1).join(" ").replace("OPR","Opera");c=c[2]?[c[1],c[2]]:[navigator.appName,navigator.appVersion,"-?"];null!=(a=b.match(/version\/(\d+)/i))&&c.splice(1,1,a[1]);b=c.join(" "); +return Entry.userAgent=b};Entry.setBasicBrush=function(b){var a=new createjs.Graphics;a.thickness=1;a.rgb=Entry.hex2rgb("#ff0000");a.opacity=100;a.setStrokeStyle(1);a.beginStroke("rgba(255,0,0,1)");var c=new createjs.Shape(a);Entry.stage.selectedObjectContainer.addChild(c);b.brush&&(b.brush=null);b.brush=a;b.shape&&(b.shape=null);b.shape=c}; +Entry.setCloneBrush=function(b,a){var c=new createjs.Graphics;c.thickness=a.thickness;c.rgb=a.rgb;c.opacity=a.opacity;c.setStrokeStyle(c.thickness);c.beginStroke("rgba("+c.rgb.r+","+c.rgb.g+","+c.rgb.b+","+c.opacity/100+")");a=new createjs.Shape(c);Entry.stage.selectedObjectContainer.addChild(a);b.brush&&(b.brush=null);b.brush=c;b.shape&&(b.shape=null);b.shape=a};Entry.isFloat=function(b){return/\d+\.{1}\d+$/.test(b)}; +Entry.getStringIndex=function(b){if(!b)return"";for(var a={string:b,index:1},c=0,d=[],e=b.length-1;0d&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; -Entry.Utils.addFilters=function(b,a){b=b.elem("defs");var d=b.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=b.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"});a=b.elem("filter",{id:"entryBlockHighlightFilter_"+a});a.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});a.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){b=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"});a=b.elem("g");for(var d=a.elem("rect",{x:0,y:0,width:125,height:33}),c=Entry.mediaFilePath+"block_pattern_(order).png",e=1;5>e;e++)a.elem("image",{class:"pattern"+e,href:c.replace("(order)",e),x:0,y:0,width:125,height:33});return{pattern:b,rect:d}}; -Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var d=document.createEvent("MouseEvent");d.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return d};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var d in b){var c=b[d];if(c.tagName){var e={category:c.getAttribute("id"),blocks:[]},c=c.childNodes;for(d in c){var f=c[d];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,d){var c=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!d&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?c=b.block.funcBlock:b.funcExecutor&&(c=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),c&&(Entry.container.selectObject(c.getCode().object.id, -!0),c.view.getBoard().activateBlock(c)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var d=0,c=0,e=b.length;c=b.length&&(l&&clearInterval(l),d==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=c;var l;e()||(l=setInterval(e,50))})(b[c])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Utils.hasSpecialCharacter=function(b){return/!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(b)};Entry.Model=function(b,a){var d=Entry.Model;d.generateSchema(b);d.generateSetter(b);d.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 c in b)(function(c){a.data[c]=b[c];Object.defineProperty(a,c,{get:function(){return a.data[c]}})})(c);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var c={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(c[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),c)};b.generateObserve= -function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,c,e){c=new Entry.Observer(this.observers,a,b,c);if(!1!==e)a[b]([]);return c};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var c=this;c.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:c,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Observer=function(b,a,d,c){this.parent=b;this.object=a;this.funcName=d;this.attrs=c;b.push(this)};(function(b){b.destroy=function(){var a=this.parent,b=a.indexOf(this);-1e;e++)a.elem("image",{class:"pattern"+e,href:d.replace("(order)",e),x:0,y:0,width:125,height:33});return{pattern:b,rect:c}}; +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&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; +Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, +!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; +Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var f=document.createElement("span");f.innerHTML="giItT1WQy@!-/#";f.style.position="absolute";f.style.left="-10000px";f.style.top="-10000px";f.style.fontSize="300px";f.style.fontFamily="sans-serif";f.style.fontVariant="normal";f.style.fontStyle="normal";f.style.fontWeight= +"normal";f.style.letterSpacing="0";document.body.appendChild(f);var k=f.offsetWidth;f.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); +Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Utils.hasSpecialCharacter=function(b){return/!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(b)};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(c){a.data[c]=b[c];Object.defineProperty(a,c,{get:function(){return a.data[c]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var c={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(c[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),c)};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 c=this;c.observers.map(function(d){var e=a;void 0!==d.attrs&&(e=Entry.Utils.intersectArray(d.attrs,a));if(e.length)d.object[d.funcName](e.map(function(a){return{name:a,object:c,oldValue:b[a]}}))})};b._toJSON=function(){var a= +{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Observer=function(b,a,c,d){this.parent=b;this.object=a;this.funcName=c;this.attrs=d;b.push(this)};(function(b){b.destroy=function(){var a=this.parent,b=a.indexOf(this);-1/,c;c=b instanceof HTMLElement?$(b):b instanceof jQuery?b:d.test(b)?$(b):$("<"+b+">");if(void 0===a)return c;a.id&&c.attr("id",a.id);a.class&&c.addClass(a.class);a.classes&&a.classes.map(function(a){c.addClass(a)});a.src&&c.attr("src",a.src);a.parent&&a.parent.append(c);c.bindOnClick=function(){var a,b,d=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.x+b.width+this.width?(this.object.x=b.x+b.width+ this.width/2,a+="e"):(this.object.x=b.x-this.width/2,a+="w");this.notch.type!=a&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(a),this.object.addChild(this.notch));this._isNoContentTried&&this.parent.setText("");Entry.requestUpdate=!0}; Entry.Dialog.prototype.createSpeakNotch=function(b){var a=new createjs.Shape;a.type=b;"ne"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0,this.height+this.padding-1.5).lt(-10,this.height+this.padding+20).lt(20,this.height+this.padding-1.5):"nw"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,this.height+this.padding-1.5).lt(this.width+10,this.height+this.padding+20).lt(this.width-20,this.height+this.padding-1.5):"se"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0, --this.padding+1.5).lt(-10,-this.padding-20).lt(20,-this.padding+1.5):"sw"==b&&a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,-this.padding+1.5).lt(this.width+10,-this.padding-20).lt(this.width-20,-this.padding+1.5);return a};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null;Entry.requestUpdate=!0};Entry.DoneProject=function(b){this.generateView(b)};var p=Entry.DoneProject.prototype;p.init=function(b){this.projectId=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerDoneWorkspace");this.doneContainer=a;var d=Entry.createElement("iframe");d.setAttribute("id","doneProjectframe");d.setAttribute("frameborder",0);d.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=d;this.doneContainer.appendChild(d);a.addClass("entryRemove")};p.getView=function(){return this.doneContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("doneProjectframe"),a=this.doneContainer.offsetWidth;b.width=a+"px";b.height=9*a/16+"px"};Entry.Engine=function(){function b(a){var b=[37,38,39,40,32],c=a.keyCode||a.which,e=Entry.stage.inputField;32==c&&e&&e.hasFocus()||-1d;d++)(function(d){var c=Entry.createElement("td","progressCell"+d);c.bindOnClick(function(){Entry.engine.setSpeedMeter(a[d])});b.appendChild(c)})(d);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); -a=Math.floor((a.clientX-80)/(5*c)*5);0>a||4c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); +a=Math.floor((a.clientX-80)/(5*d)*5);0>a||4a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(b=!1;a&&Entry.engine.isContinue&&!b;){Entry.engine.isContinue=!a.isRepeat;var d=a.run();b=d&&d===a;a=d}return a};Entry.Engine.prototype.isState=function(b){return-1=a&&Entry.stage.moveSprite(b)}; +Entry.Engine.prototype.captureKeyEvent=function(b){var a=b.keyCode,c=Entry.type;b.ctrlKey&&"workspace"==c?83==a?(b.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==a?(b.preventDefault(),Entry.engine.run()):90==a&&(b.preventDefault(),Entry.dispatchEvent(b.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",a]);Entry.engine.isState("stop")&&"workspace"===c&&37<=a&&40>=a&&Entry.stage.moveSprite(b)}; Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),d=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],c=0,e=a.length;c=n?k=[1,0,0,0,0,0,m,l,0,0,0,-1*l,m,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=n?k=[m,0,l,0,0,0,1,0,0,0,l,0,m,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=n&&(k=[m,l,0,0,0,-1*l,m,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);d.push(k);b.alpha=a.alpha=c(a.alpha,0,1);b.filters=d})(d,c),c.cache(0, +Entry.EntityObject.prototype.applyFilter=function(b){function a(a,b){for(var c in a)if(a[c]!==b[c])return!1;return!0}var c=this.effect,d=this.object;if(b||!a(c,this.getInitialEffectValue()))(function(a,b){var c=[],d=Entry.adjustValueWithMaxMin;a.brightness=a.brightness;var e=new createjs.ColorMatrix;e.adjustColor(d(a.brightness,-100,100),0,0,0);e=new createjs.ColorMatrixFilter(e);c.push(e);a.hue=a.hue.mod(360);e=new createjs.ColorMatrix;e.adjustColor(0,0,0,a.hue);e=new createjs.ColorMatrixFilter(e); +c.push(e);var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],f=10.8*a.hsv*Math.PI/180,m=Math.cos(f),f=Math.sin(f),n=Math.abs(a.hsv/100);1=n?e=[1,0,0,0,0,0,m,f,0,0,0,-1*f,m,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=n?e=[m,0,f,0,0,0,1,0,0,0,f,0,m,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=n&&(e=[m,f,0,0,0,-1*f,m,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c})(c,d),d.cache(0, 0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0};Entry.EntityObject.prototype.resetFilter=function(){"sprite"==this.parent.objectType&&(this.object.filters=[],this.setInitialEffectValue(),this.object.alpha=this.effect.alpha,this.object.cache(0,0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.updateDialog=function(){this.dialog&&this.dialog.update();Entry.requestUpdate=!0}; Entry.EntityObject.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON();this.collision=Entry.Utils.COLLISION.NONE};Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture());Entry.requestUpdate=!0}; Entry.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var b=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(b,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; @@ -945,55 +945,61 @@ Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playgro Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()};Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()}; Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);b.recreateView();a.changeOverlayBoardCode(b);b.view.board.alignThreads();this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)};Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}}; Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0;b=b.split(" ");var d="",c;c=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=d)}}; +Entry.Func.getMenuXml=function(){var b=[];this.targetFunc||(b=b.concat(this.createBtn));if(this.targetFunc)var a=this.FIELD_BLOCK,a=a.replace("#1",Entry.generateHash()),a=a.replace("#2",Entry.generateHash()),a=Blockly.Xml.textToDom(a).childNodes,b=b.concat(Entry.nodeListToArray(a));for(var c in Entry.variableContainer.functions_)a=Entry.variableContainer.functions_[c],a===this.targetFunc?(a=Entry.Func.generateBlock(this.targetFunc,Blockly.Xml.workspaceToDom(Entry.Func.workspace),a.id).block,b.push(a)): +b.push(a.block);return b};Entry.Func.syncFunc=function(){var b=Entry.Func;if(b.targetFunc){var a=b.workspace.topBlocks_[0].toString(),c=b.workspace.topBlocks_.length;(b.fieldText!=a||b.workspaceLength!=c)&&1>Blockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +p.renderBlock=function(b){var a=Lang.Helper[b];if(b&&this.visible&&a&&!Entry.block[b].isPrimitive){this.first&&(this.blockHelperContent_.removeClass("entryBlockHelperIntro"),this.first=!1);this.code.clear();var c=Entry.block[b].def,c=c||{type:b};this.code.createThread([c]);this.code.board.align();this.code.board.resize();var c=this.code.getThreads()[0].getFirstBlock().view,d=c.svgGroup.getBBox();b=d.width;d=d.height;c=c.getSkeleton().box(c).offsetX;isNaN(c)&&(c=0);this.blockHelperDescription_.innerHTML= +a;this._renderView.align();$(this.blockHelperDescription_).css({top:d+30});this._renderView.svgDom.css({"margin-left":-(b/2)-20-c})}};p.getView=function(){return this.view};p.resize=function(){};Entry.HWMontior={};Entry.HWMonitor=function(b){this.svgDom=Entry.Dom($(''));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; (function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],c;for(c in a){var e=this.generatePortView(a[c],"_svgGroup");this._portViews[c]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)a[c]= -b[c];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)delete a[c];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],c;for(c in a){var e=this.generatePortView(a[c],"_svglistGroup");this._listPortViews[c]=e;b.push(e)}var f=this._portMapList; +b[c];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)delete a[c];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){b=this[b].elem("g");b.addClass("hwComponent");var c;c=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3});var e=b.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),f=b.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});f.textContent=a.name;f=f.getComputedTextLength(); -b.elem("rect").attr({x:f+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var g=b.elem("text").attr({x:f+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});g.textContent=0;f+=40;e.attr({width:f});return{group:b,value:g,type:a.type,path:c,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:f},width:f}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,c=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==c)f=this._listPortViews;else if("both"==c){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(c=f[h],"input"==c.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* +b.elem("rect").attr({x:f+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var g=b.elem("text").attr({x:f+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});g.textContent=0;f+=40;e.attr({width:f});return{group:b,value:g,type:a.type,path:c,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:f},width:f}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, +e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a;a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3-5,-27); -a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){var a;a=this._hwModule.monitorTemplate.listPorts;for(var b=a.length,c=0;cb-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};b._movePort=function(a,b,c,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster, +a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){var a;a=this._hwModule.monitorTemplate.listPorts;for(var b=a.length,d=0;db-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};b._movePort=function(a,b,d,e){var c=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b>e?(c=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+c+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster, "2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit,"12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,d;this.connected=!1;this.connectTrial++;if(-1=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1");var c=0,d=null,d=setInterval(function(){try{this._w.location.href}catch(n){this._bNotInstalled=!0}if(10(0"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:c};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; -b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var c=this.modes[b];c.tabDom.removeClass("selected");c.contentDom.addClass("entryRemove");c.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); +b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); b.contentDom.removeClass("entryRemove");b.obj.resize&&b.obj.resize();b.obj.visible=!0;this.selected=a};b.initializeSplitter=function(a){var b=this;a.bind("mousedown touchstart",function(a){b._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.clientX||a.x})}))});$(document).bind("mouseup touchend", function(a){if(a=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(a),b._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;"tablet"=== this.device?this.view_.setAttribute("class","entry tablet"):this.view_.setAttribute("class","entry");Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload= @@ -1002,86 +1008,86 @@ Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3",Entry.mediaFilePath+"so Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,d=a.length,c=0;c=b&&0=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), +Entry.EntryObject.prototype.addCloneEntity=function(b,a,c){this.clonedEntities.length>Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,d=a.length,c=0;c=b&&0=b&&0=a-e/100*a&&f<=a+e/100*a&&g>=d-e/100*d&&g<=d+e/100*d&&b>=c-e/100*c&&b<=c+e/100*c};Entry.Painter.prototype.matchColorOnly=function(b,a,d,c){return a===this.colorLayerData.data[b]&&d===this.colorLayerData.data[b+1]&&c===this.colorLayerData.data[b+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(b,a,d,c,e){return a===this.colorLayerData.data[b]&&d===this.colorLayerData.data[b+1]&&c===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,d,c,e){e||(e=255);this.stroke.transparent&&(e=c=d=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=d;this.colorLayerData.data[b+2]=c;this.colorLayerData.data[b+3]=e}; +Entry.Painter.prototype.matchTolerance=function(b,a,c,d,e){var f=this.colorLayerData.data[b],g=this.colorLayerData.data[b+1];b=this.colorLayerData.data[b+2];return f>=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,d=document.getElementById("entryPainterAttrFontName").value,c=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+c+'px "'+d+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -1140,49 +1146,49 @@ Entry.Painter.prototype.stagemousemove=function(b){"picture"==Entry.playground.g this.move_rect(b):"circle"===this.toolbox.selected?this.move_circle(b):"erase"===this.toolbox.selected&&this.move_erase(b)),this.painterTopStageXY.innerHTML="x:"+b.stageX.toFixed(1)+", y:"+b.stageY.toFixed(1))}; Entry.Painter.prototype.stagemouseup=function(b){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected?(this.selectArea.x1=this.oldPt.x,this.selectArea.y1=this.oldPt.y,this.selectArea.x2=b.stageX-this.oldPt.x,this.selectArea.y2=b.stageY-this.oldPt.y,this.stage.removeChild(this._handle),this.stage.update(),0this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";c.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var m=Entry.createElement("div");m.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(m);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -c=Entry.createElement("div","entryPainterAttrCircle");c.addClass("painterAttrCircle");this.attrCircleArea.appendChild(c);this.attrCircleArea.painterAttrCircle=c;c=Entry.createElement("input","entryPainterAttrCircleInput");c.value="#000000";c.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(c);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?d.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":d.style.backgroundColor=b;d.bindOnClick(function(d){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});m.appendChild(d)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);c=Entry.createElement("legend");c.addClass("painterAttrThickName");c.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(c); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);c=Entry.createElement("div");c.addClass("paintAttrThickTop");n.appendChild(c);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(c=1;10>=c;c++)d=Entry.createElement("option"),d.value=c,d.innerHTML=c,e.appendChild(d);n.appendChild(e); -c=Entry.createElement("div","entryPainterShapeLineColor");c.addClass("painterAttrShapeLineColor");d=Entry.createElement("div","entryPainterShapeInnerBackground");d.addClass("painterAttrShapeInnerBackground");c.appendChild(d);n.appendChild(c);this.attrThickArea.painterAttrShapeLineColor=c;n.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);c=Entry.createElement("fieldset","entryPainterAttrbackground");c.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(c);d=Entry.createElement("div");d.addClass("paintAttrBackgroundTop");c.appendChild(d);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;d.appendChild(q);var r=!1;q.bindOnClick(function(a){n.style.zIndex= -"1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);c=Entry.createElement("div");c.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(c);c=Entry.createElement("legend");c.addClass("panterAttrFontTitle");c.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(c=0;c=c;c++)d=Entry.createElement("option"),d.value=c,d.innerHTML=c,k.appendChild(d);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(c);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(c=0;cthis.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var m=Entry.createElement("div");m.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(m);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); +Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});m.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){n.style.zIndex= +"1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", +"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d":h=b-c;break;case ">=":h=b+1-c}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var c=0;c":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.LogicalExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.LogicalOperator=function(){return["||","&&"]};b.MemberExpression=function(a){var b= -a.object,c=a.property;console.log(b.type);b=this[b.type](b);console.log(b);c=this[c.type](c,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=c;if(!b)throw{message:c+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +a.object,d=a.property;console.log(b.type);b=this[b.type](b);console.log(b);d=this[d.type](d,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=d;if(!b)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.CallExpression=function(a){a=a.callee;return{type:this[a.type](a)}};b.NewExpression=function(a){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:a};};b.SequenceExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],c=0;c=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:c})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; -(function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var c=acorn.parse(a),b=this._parser.Program(c)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, -clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,d){1===d&&(a+="\n");return(-1=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; +(function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, +clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){1===c&&(a+="\n");return(-1=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,c=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(c).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,c=b.firstChild;c?b.insertBefore(this.svgGroup,c):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Workspace=function(b){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var a=b.blockMenu;a&&(this.blockMenu=new Entry.BlockMenu(a.dom,a.align,a.categoryData,a.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(a=b.board)a.workspace=this,this.board=new Entry.Board(a),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); +"white"))})};b.updateDragBlock=function(){var a=this.board.dragBlock,b=this.dragBlockObserver;b&&(b.destroy(),this.dragBlockObserver=null);a?this.dragBlockObserver=a.observe(this,"checkBlock",["x","y"]):(this.isOver&&this.dragBlock&&!this.dragBlock.block.getPrevBlock()&&(this.dragBlock.block.doDestroyBelow(!0),createjs.Sound.play("entryDelete")),this.tAnimation(!1));this.dragBlock=a};b.checkBlock=function(){var a=this.dragBlock;if(a&&a.block.isDeletable()){var b=this.board.offset(),d=this.getPosition(), +e=d.x+b.left,b=d.y+b.top,f,g;if(a=a.dragInstance)f=a.offsetX,g=a.offsetY;this.tAnimation(f>=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, +rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Workspace=function(b){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var a=b.blockMenu;a&&(this.blockMenu=new Entry.BlockMenu(a.dom,a.align,a.categoryData,a.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(a=b.board)a.workspace=this,this.board=new Entry.Board(a),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); if(a=b.vimBoard)this.vimBoard=new Entry.Vim(a.dom),this.vimBoard.workspace=this;this.board&&this.vimBoard&&this.vimBoard.hide();Entry.GlobalSvg.createDom();this.mode=Entry.Workspace.MODE_BOARD;Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl);this.changeEvent=new Entry.Event(this);Entry.commander.setCurrentEditor("board",this.board);this.textType=Entry.Vim.TEXT_TYPE_PY};Entry.Workspace.MODE_BOARD=0;Entry.Workspace.MODE_VIMBOARD=1;Entry.Workspace.MODE_OVERLAYBOARD=2; (function(b){b.schema={selectedBlockView:null,selectedBoard:null};b.getBoard=function(){return this.board};b.getSelectedBoard=function(){return this.selectedBoard};b.getBlockMenu=function(){return this.blockMenu};b.getVimBoard=function(){return this.vimBoard};b.getMode=function(){return this.mode};b.setMode=function(a,b){"number"===typeof a?this.mode=a:(this.mode=a.boardType,this.runType=a.runType,this.textType=a.textType);switch(this.mode){case this.oldMode:return;case Entry.Workspace.MODE_VIMBOARD:try{this.board&& -this.board.hide(),this.overlayBoard&&this.overlayBoard.hide(),this.set({selectedBoard:this.vimBoard}),this.vimBoard.show(),this.codeToText(this.board.code,a),this.blockMenu.renderText(function(){this.blockMenu.reDraw()}.bind(this)),this.board.clear(),this.oldTextType=this.textType}catch(c){}break;case Entry.Workspace.MODE_BOARD:try{this.board.show(),this.set({selectedBoard:this.board}),this.textToCode(this.oldMode,this.oldTextType),this.vimBoard&&this.vimBoard.hide(),this.overlayBoard&&this.overlayBoard.hide(), -this.blockMenu.renderBlock(function(){this.blockMenu.reDraw()}.bind(this)),this.oldTextType=this.textType}catch(c){this.board&&this.board.hide(),this.set({selectedBoard:this.vimBoard}),this.mode=Entry.Workspace.MODE_VIMBOARD,this.oldTextType==Entry.Vim.PARSER_TYPE_JS_TO_BLOCK?(a.boardType=Entry.Workspace.MODE_VIMBOARD,a.textType=Entry.Vim.TEXT_TYPE_JS,a.runType=Entry.Vim.MAZE_MODE,this.oldTextType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK,Entry.dispatchEvent("changeMode",a),Ntry.dispatchEvent("textError", +this.board.hide(),this.overlayBoard&&this.overlayBoard.hide(),this.set({selectedBoard:this.vimBoard}),this.vimBoard.show(),this.codeToText(this.board.code,a),this.blockMenu.renderText(function(){this.blockMenu.reDraw()}.bind(this)),this.board.clear(),this.oldTextType=this.textType}catch(d){}break;case Entry.Workspace.MODE_BOARD:try{this.board.show(),this.set({selectedBoard:this.board}),this.textToCode(this.oldMode,this.oldTextType),this.vimBoard&&this.vimBoard.hide(),this.overlayBoard&&this.overlayBoard.hide(), +this.blockMenu.renderBlock(function(){this.blockMenu.reDraw()}.bind(this)),this.oldTextType=this.textType}catch(d){this.board&&this.board.hide(),this.set({selectedBoard:this.vimBoard}),this.mode=Entry.Workspace.MODE_VIMBOARD,this.oldTextType==Entry.Vim.PARSER_TYPE_JS_TO_BLOCK?(a.boardType=Entry.Workspace.MODE_VIMBOARD,a.textType=Entry.Vim.TEXT_TYPE_JS,a.runType=Entry.Vim.MAZE_MODE,this.oldTextType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK,Entry.dispatchEvent("changeMode",a),Ntry.dispatchEvent("textError", a)):this.oldTextType==Entry.Vim.PARSER_TYPE_PY_TO_BLOCK&&(a.boardType=Entry.Workspace.MODE_VIMBOARD,a.textType=Entry.Vim.TEXT_TYPE_PY,a.runType=Entry.Vim.WORKSPACE_MODE,this.oldTextType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK,Entry.dispatchEvent("changeMode",a))}Entry.commander.setCurrentEditor("board",this.board);break;case Entry.Workspace.MODE_OVERLAYBOARD:this.overlayBoard||this.initOverlayBoard(),this.overlayBoard.show(),this.set({selectedBoard:this.overlayBoard}),Entry.commander.setCurrentEditor("board", this.overlayBoard)}this.oldMode=this.mode;this.changeEvent.notify(b)};b.changeBoardCode=function(a){this._syncTextCode();this.board.changeCode(a);this.mode===Entry.Workspace.MODE_VIMBOARD&&this.codeToText(this.board.code)};b.changeOverlayBoardCode=function(a){this.overlayBoard&&this.overlayBoard.changeCode(a)};b.changeBlockMenuCode=function(a){this.blockMenu.changeCode(a)};b.textToCode=function(a,b){if(a==Entry.Workspace.MODE_VIMBOARD){var c=this;a=this.vimBoard.textToCode(b);b=this.board;var e=b.code; e.load(a);e.createView(b);this.board.reDraw();setTimeout(function(){c.board.alignThreads()},0)}};b.codeToText=function(a,b){return this.vimBoard.codeToText(a,b)};b.getCodeToText=function(a){return this.vimBoard.getCodeToText(a)};b._setSelectedBlockView=function(){this.set({selectedBlockView:this.board.selectedBlockView||this.blockMenu.selectedBlockView||(this.overlayBoard?this.overlayBoard.selectedBlockView:null)})};b.initOverlayBoard=function(){this.overlayBoard=new Entry.Board({dom:this.board.view, -workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};b._keyboardControl=function(a){var b=a.keyCode||a.which,c=a.ctrlKey;if(!Entry.Utils.isInInput(a)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==b||46==b?(Entry.do("destroyBlock",e.block),a.preventDefault()):c&&(67==b?e.block.copyToClipboard():88==b&&(a=e.block,a.copyToClipboard(), -a.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));c&&86==b&&(b=this.selectedBoard)&&b instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};b._handleChangeBoard=function(){var a=this.selectedBoard;a&&a.constructor===Entry.Board&&this.trashcan.setBoard(a)};b._syncTextCode=function(){if(this.mode===Entry.Workspace.MODE_VIMBOARD){var a=this.vimBoard.textToCode(this.textType),b=this.board,c=b.code;c.load(a);c.createView(b);this.board.alignThreads()}}; +workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};b._keyboardControl=function(a){var b=a.keyCode||a.which,d=a.ctrlKey;if(!Entry.Utils.isInInput(a)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==b||46==b?(Entry.do("destroyBlock",e.block),a.preventDefault()):d&&(67==b?e.block.copyToClipboard():88==b&&(a=e.block,a.copyToClipboard(), +a.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==b&&(b=this.selectedBoard)&&b instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};b._handleChangeBoard=function(){var a=this.selectedBoard;a&&a.constructor===Entry.Board&&this.trashcan.setBoard(a)};b._syncTextCode=function(){if(this.mode===Entry.Workspace.MODE_VIMBOARD){var a=this.vimBoard.textToCode(this.textType),b=this.board,d=b.code;d.load(a);d.createView(b);this.board.alignThreads()}}; b.addVimBoard=function(a){this.vimBoard||(this.vimBoard=new Entry.Vim(a),this.vimBoard.workspace=this,this.vimBoard.hide())}})(Entry.Workspace.prototype);Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var c={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return c;for(var e=0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,d=0,c=a.length;df+55)&&a>40+b*(g-f)&&(g=d.getNextScene())&&(g=$(g.view),$(document).trigger("mouseup"), +scaleX:.3154574132492113,scaleY:.3154574132492113,rotation:0,direction:90,width:284,height:350,visible:!0},lock:!1,active:!0}],speed:60}};Entry.Reporter=function(b){this.projectId=this.userId=null;this.isRealTime=b;this.activities=[]};Entry.Reporter.prototype.start=function(b,a,c){this.isRealTime&&(-1d+55)&&a>40+b*(g-d)&&(g=c.getNextScene())&&(g=$(g.view),$(document).trigger("mouseup"), g.trigger("mousedown"))}),b=Entry.createElement("ul"),b.addClass("entrySceneListWorkspace"),Entry.sceneEditable&&$&&$(b).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){a=b.item.data("start_pos");b=b.item.index();Entry.scene.moveScene(a,b)},axis:"x",tolerance:"pointer"}),this.view_.appendChild(b),this.listView_=b,Entry.sceneEditable&&(b=Entry.createElement("span"),b.addClass("entrySceneElementWorkspace"),b.addClass("entrySceneAddButtonWorkspace"), b.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(b),this.addButton_=b))}; -Entry.Scene.prototype.generateElement=function(b){var a=this,d=Entry.createElement("li",b.id);d.addClass("entrySceneElementWorkspace");d.addClass("entrySceneButtonWorkspace");d.addClass("minValue");$(d).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var c=Entry.createElement("input");c.addClass("entrySceneFieldWorkspace");c.value=b.name;Entry.sceneEditable||(c.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -d.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);d.appendChild(f);b.inputWrapper=f;c.onkeyup=function(d){d=d.keyCode;Entry.isArrowOrBackspace(d)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==d&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),d=0;d=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var d=b.length-1;0<=d;d--)Entry.container.addCloneObject(b[d],a.id)}}; -Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,d=b[0];if(0!==b.length&&d){var c=$(d.view).offset().left,d=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-c,f=0,g;for(g in b){var c=b[g],h=c.view;h.addClass("minValue");$(c.inputWrapper).width(Entry.computeInputWidth(c.name));h=$(h);f=f+h.width()+d}if(f>e)for(g in e-=$(a.view).width(),d=e/(b.length-1)-(Entry.Scene.viewBasicWidth+d),b)c=b[g],a.id!=c.id?(c.view.removeClass("minValue"),$(c.inputWrapper).width(d)): -c.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,d){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");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));d instanceof Entry.Script&& -(this.parentScript=d);b=b.childNodes;for(a=0;a=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; +Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"),$(d.inputWrapper).width(c)): +d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};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=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));c instanceof Entry.Script&& +(this.parentScript=c);b=b.childNodes;for(a=0;a"==a||"<"==a||">="==a||"<="==a||"+"==a||"-"==a||"*"==a||"/"==a?!0:!1};b.binaryOperatorConvert= -function(a){switch(a){case "==":a="EQUAL";break;case ">":a="GREATER";break;case "<":a="LESS";break;case ">=":a="GREATER_OR_EQUAL";break;case "<=":a="LESS_OR_EQUAL";break;case "+":a="PLUS";break;case "-":a="MINUS";break;case "*":a="MULTIFLY";break;case "/":a="DIVIDE";break}return a};b.logicalExpressionConvert=function(a){switch(a){case "&&":a=null;break;case "||":a=null;break}return a};b.dropdownDynamicValueConvertor=function(a,b){var c=b.options,e;for(e in c){var f=c[e];if("null"==f[1])return c={}; -if("mouse"==a||"wall"==a||"wall_up"==a||"wall_down"==a||"wall_right"==a||"wall_left"==a)return a;if(a==f[1])return console.log("dropdownDynamicValueConvertor value",a,f[1]),c=f[0]}c=a;if("variables"==b.menuName){var g=Entry.variableContainer.variables_,h;for(h in g){var k=g[h];if(k.id_==a){c=k.name_;break}}}else if("lists"==b.menuName)for(h in g=Entry.variableContainer.lists,g){if(k=g[h],k.id_==a){c=k.name_;break}}else if("pictures"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b= -h[g],b=b.pictures,b){if(e=b[k],e.id==a)return c=e.name}else if("sounds"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b=h[g],b=b.sounds,b)if(e=b[k],e.id==a)return c=e.name;return c};b.binaryOperatorValueConvertor=function(a){switch(a){case "EQUAL":a="==";break;case "GREATER":a=">";break;case "LESS":a="<";break;case "GREATER_OR_EQUAL":a=">=";break;case "LESS_OR_EQUAL":a="<=";break;case "\uadf8\ub9ac\uace0":a="&&";break;case "\ub610\ub294":a="||";break;case "PLUS":a="+";break;case "MINUS":a= -"-";break;case "MULTI":a="*";break;case "DIVIDE":a="/";break}return a};b.variableFilter=function(a,b,c){var e=c;a=a.data.type;"change_variable"==a||"set_variable"==a||"get_variable"==a?1==b&&(e=eval(c)):"length_of_list"==a||"is_included_in_list"==a?2==b&&(e=eval(c)):"value_of_index_from_list"==a?2==b?e=eval(c):4==b&&this.isNumeric(c)&&(e=c-1):"remove_value_from_list"==a?2==b?e=eval(c):1==b&&this.isNumeric(c)&&(e=c-1):"insert_value_to_list"==a?2==b?e=eval(c):3==b&&this.isNumeric(c)&&(e=c-1):"change_value_list_index"== -a?1==b?e=eval(c):2==b&&this.isNumeric(c)&&(e=c-1):"add_value_to_list"==a&&2==b&&(e=eval(c));return e};b.isGlobalVariableExisted=function(a){var b=Entry.variableContainer.variables_,c;for(c in b){var e=b[c];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalVariable=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){variable={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,value:b,name:a,isCloud:f.isClud_};f.syncModel_(variable); -Entry.variableContainer.updateList();break}}};b.createGlobalVariable=function(a,b){this.isGlobalVariableExisted(a)||(Entry.variableContainer.addVariable({name:a,value:b,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariableExisted=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalVariable=function(a,b,c){var e=Entry.variableContainer.variables_,f;for(f in e){var g=e[f];if(g.object_=== -c.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,value:b,name:a,isCloud:g.isClud_});Entry.variableContainer.updateList();break}}};b.createLocalVariable=function(a,b,c){this.isLocalVariableExisted(a,c)||(Entry.variableContainer.addVariable({name:a,value:b,object:c.id,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariable=function(a){var b=Entry.playground.object,c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_==b.id&&f.id_== -a)return!0}return!1};b.isGlobalListExisted=function(a){var b=Entry.variableContainer.lists_,c;for(c in b){var e=b[c];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalList=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){list={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,name:a,isCloud:f.isClud_,width:f.width_,height:f.height_,array:b};f.syncModel_(list);f.updateView();Entry.variableContainer.updateList();break}}};b.createGlobalList= -function(a,b){this.isGlobalListExisted(a)||(Entry.variableContainer.addList({name:a,array:b,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalListExisted=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalList=function(a,b,c){var e=Entry.variableContainer.lists_,f;for(f in e){var g=e[f];if(g.object_===c.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,name:a,isCloud:g.isClud_, -width:g.width_,height:g.height_,array:b});g.updateView();Entry.variableContainer.updateList();break}}};b.createLocalList=function(a,b,c){this.isLocalListExisted(a,c)||(Entry.variableContainer.addList({name:a,array:b,object:c.id,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalList=function(a){var b=Entry.playground.object,c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_==b.id&&f.id_==a)return!0}return!1};b.isLocalType=function(a,b){if("get_variable"==a.data.type|| +function(a){switch(a){case "==":a="EQUAL";break;case ">":a="GREATER";break;case "<":a="LESS";break;case ">=":a="GREATER_OR_EQUAL";break;case "<=":a="LESS_OR_EQUAL";break;case "+":a="PLUS";break;case "-":a="MINUS";break;case "*":a="MULTIFLY";break;case "/":a="DIVIDE"}return a};b.logicalExpressionConvert=function(a){switch(a){case "&&":a=null;break;case "||":a=null}return a};b.dropdownDynamicValueConvertor=function(a,b){var c=b.options,e;for(e in c){var f=c[e];if("null"==f[1])return c={};if("mouse"== +a||"wall"==a||"wall_up"==a||"wall_down"==a||"wall_right"==a||"wall_left"==a)return a;if(a==f[1])return console.log("dropdownDynamicValueConvertor value",a,f[1]),c=f[0]}c=a;if("variables"==b.menuName){var g=Entry.variableContainer.variables_,h;for(h in g){var k=g[h];if(k.id_==a){c=k.name_;break}}}else if("lists"==b.menuName)for(h in g=Entry.variableContainer.lists,g){if(k=g[h],k.id_==a){c=k.name_;break}}else if("pictures"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b=h[g],b=b.pictures, +b){if(e=b[k],e.id==a)return c=e.name}else if("sounds"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b=h[g],b=b.sounds,b)if(e=b[k],e.id==a)return c=e.name;return c};b.binaryOperatorValueConvertor=function(a){switch(a){case "EQUAL":a="==";break;case "GREATER":a=">";break;case "LESS":a="<";break;case "GREATER_OR_EQUAL":a=">=";break;case "LESS_OR_EQUAL":a="<=";break;case "\uadf8\ub9ac\uace0":a="&&";break;case "\ub610\ub294":a="||";break;case "PLUS":a="+";break;case "MINUS":a="-";break; +case "MULTI":a="*";break;case "DIVIDE":a="/"}return a};b.variableFilter=function(a,b,d){var c=d;a=a.data.type;"change_variable"==a||"set_variable"==a||"get_variable"==a?1==b&&(c=eval(d)):"length_of_list"==a||"is_included_in_list"==a?2==b&&(c=eval(d)):"value_of_index_from_list"==a?2==b?c=eval(d):4==b&&this.isNumeric(d)&&(c=d-1):"remove_value_from_list"==a?2==b?c=eval(d):1==b&&this.isNumeric(d)&&(c=d-1):"insert_value_to_list"==a?2==b?c=eval(d):3==b&&this.isNumeric(d)&&(c=d-1):"change_value_list_index"== +a?1==b?c=eval(d):2==b&&this.isNumeric(d)&&(c=d-1):"add_value_to_list"==a&&2==b&&(c=eval(d));return c};b.isGlobalVariableExisted=function(a){var b=Entry.variableContainer.variables_,d;for(d in b){var e=b[d];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalVariable=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){variable={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,value:b,name:a,isCloud:f.isClud_};f.syncModel_(variable); +Entry.variableContainer.updateList();break}}};b.createGlobalVariable=function(a,b){this.isGlobalVariableExisted(a)||(Entry.variableContainer.addVariable({name:a,value:b,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariableExisted=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalVariable=function(a,b,d){var c=Entry.variableContainer.variables_,f;for(f in c){var g=c[f];if(g.object_=== +d.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,value:b,name:a,isCloud:g.isClud_});Entry.variableContainer.updateList();break}}};b.createLocalVariable=function(a,b,d){this.isLocalVariableExisted(a,d)||(Entry.variableContainer.addVariable({name:a,value:b,object:d.id,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariable=function(a){var b=Entry.playground.object,d=Entry.variableContainer.variables_,e;for(e in d){var f=d[e];if(f.object_==b.id&&f.id_== +a)return!0}return!1};b.isGlobalListExisted=function(a){var b=Entry.variableContainer.lists_,d;for(d in b){var e=b[d];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalList=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){list={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,name:a,isCloud:f.isClud_,width:f.width_,height:f.height_,array:b};f.syncModel_(list);f.updateView();Entry.variableContainer.updateList();break}}};b.createGlobalList= +function(a,b){this.isGlobalListExisted(a)||(Entry.variableContainer.addList({name:a,array:b,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalListExisted=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalList=function(a,b,d){var c=Entry.variableContainer.lists_,f;for(f in c){var g=c[f];if(g.object_===d.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,name:a,isCloud:g.isClud_, +width:g.width_,height:g.height_,array:b});g.updateView();Entry.variableContainer.updateList();break}}};b.createLocalList=function(a,b,d){this.isLocalListExisted(a,d)||(Entry.variableContainer.addList({name:a,array:b,object:d.id,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalList=function(a){var b=Entry.playground.object,d=Entry.variableContainer.lists_,e;for(e in d){var f=d[e];if(f.object_==b.id&&f.id_==a)return!0}return!1};b.isLocalType=function(a,b){if("get_variable"==a.data.type|| "set_variable"==a.data.type||"change_variable"==a.data.type){if(this.isLocalVariable(b))return!0}else if(("value_of_index_from_list"==a.data.type||"add_value_to_list"==a.data.type||"remove_value_from_list"==a.data.type||"insert_value_to_list"==a.data.type||"change_value_list_index"==a.data.type||"length_of_list"==a.data.type||"is_included_in_list"==a.data.type)&&this.isLocalList(b))return!0};b.isEventBlock=function(a){a=a.data.type;return"when_run_button_click"==a||"when_some_key_pressed"==a||"mouse_clicked"== -a||"mouse_click_cancled"==a||"when_object_click"==a||"when_object_click_canceled"==a||"when_message_cast"==a||"when_scene_start"==a||"when_clone_start"==a?!0:!1};b.makeDefinition=function(a){var b=/(%.)/mi;a=Entry.block[a.data.type].syntax.py[0].split(b);for(var c="",e=0;e":b="BIGGER";break;case ">=":b="BIGGER_EQUAL";break;case "==":b="EQUAL";break;case "<":b="SMALLER"; break;case "<=":b="SMALLER_EQUAL"}return b};b.radarVariableConvertor=function(a){return a.split("_")[1].toUpperCase()};b.tTobDropdownValueConvertor=function(a){return"stone"==a?"OBSTACLE":"wall"==a?a.toUpperCase():"item"==a?a.toUpperCase():a}})(Entry.TextCodingUtil.prototype);Entry.BlockToJsParser=function(b){this.syntax=b;this._iterVariableCount=0;this._iterVariableChunk=["i","j","k"]}; -(function(b){b.Code=function(a,b){this._parseMode=b;if(a instanceof Entry.Block)return this.Block(a);b="";a=a._data;for(var c=0;c":h=b-c;break;case ">=":h=b+1-c}return this.BasicIteration(a,h,f)};b.BlockStatement= -function(a){var b=[];a=a.body;for(var c=0;c":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement= +function(a){var b=[];a=a.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; -b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.BinaryExpression=function(a){var b,c={};b=String(a.operator);var e=a.left.name;switch(b){case "==":var f="object_up"==e||"object_right"==e||"object_down"==e?"ai_boolean_object":"radar_up"==e||"radar_right"==e||"radar_down"==e?"ai_boolean_distance": +b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.BinaryExpression=function(a){var b,d={};b=String(a.operator);var e=a.left.name;switch(b){case "==":var f="object_up"==e||"object_right"==e||"object_down"==e?"ai_boolean_object":"radar_up"==e||"radar_right"==e||"radar_down"==e?"ai_boolean_distance": null;break;case "<":f="ai_boolean_distance";break;case "<=":f="ai_boolean_distance";break;case ">":f="ai_boolean_distance";break;case ">=":f="ai_boolean_distance"}if(f){e=[];b=a.left;if("Literal"==b.type||"Identifier"==b.type){arguments=[];arguments.push(b);b=Entry.block[f].params;for(var g in b){var h=b[g].type;"Indicator"==h?(h={raw:null,type:"Literal",value:null},g":f="(%1 %2boolean_compare# %3)";break;case ">=":f= +a);return a};b.UnaryExpression=function(a){console.log("UnaryExpression component",a);var b;a.prefix&&(b=a.operator,a=a.argument,console.log("UnaryExpression operator",b),a.value=Number(b.concat(a.value)),b=this[a.type](a),console.log("UnaryExpression data",b));a=b;console.log("UnaryExpression result",a);return a};b.LogicalExpression=function(a){console.log("LogicalExpression component",a);var b;b={};var d=String(a.operator);switch(d){case "&&":var e="(%1 and %3)";break;case "||":e="(%1 or %3)";break; +default:e="(%1 and %3)"}var e=this.getBlockType(e),f=[],d=a.left;if("Literal"==d.type||"Identifier"==d.type){arguments=[];arguments.push(d);var d=Entry.block[e].params,g=Entry.block[e].def.params;console.log("LogicalExpression paramsMeta",d);console.log("LogicalExpression paramsDefMeta",g);for(var h in d){var k=d[h].type;"Indicator"==k?(k={raw:null,type:"Literal",value:null},h":f="(%1 %2boolean_compare# %3)";break;case ">=":f= "(%1 %2boolean_compare# %3)";break;case "+":f="(%1 %2calc_basic# %3)";break;case "-":f="(%1 %2calc_basic# %3)";break;case "*":f="(%1 %2calc_basic# %3)";break;case "/":f="(%1 %2calc_basic# %3)"}console.log("BinaryExpression operator",e);console.log("BinaryExpression syntax",f);if(f=this.getBlockType(f)){console.log("BinaryExpression type",f);b=[];e=a.left;console.log("BinaryExpression left",e);if("Literal"==e.type||"Identifier"==e.type){arguments=[];arguments.push(e);var e=Entry.block[f].params,g= Entry.block[f].def.params;console.log("BinaryExpression paramsMeta",e);console.log("BinaryExpression paramsDefMeta",g);for(var h in e){var k=e[h].type;"Indicator"==k?(k={raw:null,type:"Literal",value:null},h=b.keyCode||167==b.keyCode||190==b.keyCode)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});break;case "blockJs":this._parser=new Entry.BlockToJsParser(this.syntax);c=this.syntax;break;case "blockPy":this._parser= -new Entry.BlockToPyParser(this.syntax),c=this.syntax}}; -(function(b){b.setParser=function(a,b,c){this._mode=a;this._type=b;this._cm=c;this.syntax=this.mappingSyntax(a);switch(b){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:this._parser=new Entry.JsToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:this._parser=new Entry.PyToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:this._parser=new Entry.BlockToJsParser(this.syntax); -a=this.syntax;var e={},f;for(f in a.Scope)e[f+"();\n"]=a.Scope[f];c.on("keydown",function(a,b){var d=b.keyCode;(65<=d&&95>=d||167==d||!b.shiftKey&&190==d)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:this._parser=new Entry.BlockToPyParser(this.syntax),c.setOption("mode",{name:"python",globalVars:!0}),c.markText({line:0,ch:0},{line:5},{readOnly:!0}),this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY}}; +function(a){this._isEditing!==a&&(this._isEditing=a)}})(Entry.Console.prototype);Entry.Parser=function(b,a,c,d){this._mode=b;this.syntax={};this.codeMirror=c;this._lang=d||"js";this._type=a;this.availableCode=[];Entry.Parser.PARSE_GENERAL=0;Entry.Parser.PARSE_SYNTAX=1;Entry.Parser.PARSE_VARIABLE=2;Entry.Parser.BLOCK_SKELETON_BASIC="basic";Entry.Parser.BLOCK_SKELETON_BASIC_LOOP="basic_loop";Entry.Parser.BLOCK_SKELETON_BASIC_DOUBLE_LOOP="basic_double_loop";this._console=new Entry.Console;switch(this._lang){case "js":this._parser=new Entry.JsToBlockParser(this.syntax);break;case "py":this._parser= +new Entry.PyToBlockParser(this.syntax);d=this.syntax;var e={},f;for(f in d.Scope)e[f+"();\n"]=d.Scope[f];"BasicIf"in d&&(e.front="BasicIf");CodeMirror.commands.javascriptComplete=function(a){CodeMirror.showHint(a,null,{globalScope:e})};c.on("keyup",function(a,b){(65<=b.keyCode&&95>=b.keyCode||167==b.keyCode||190==b.keyCode)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});break;case "blockJs":this._parser=new Entry.BlockToJsParser(this.syntax);d=this.syntax;break;case "blockPy":this._parser= +new Entry.BlockToPyParser(this.syntax),d=this.syntax}}; +(function(b){b.setParser=function(a,b,d){this._mode=a;this._type=b;this._cm=d;this.syntax=this.mappingSyntax(a);switch(b){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:this._parser=new Entry.JsToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:this._parser=new Entry.PyToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:this._parser=new Entry.BlockToJsParser(this.syntax); +a=this.syntax;var c={},f;for(f in a.Scope)c[f+"();\n"]=a.Scope[f];d.on("keydown",function(a,b){var d=b.keyCode;(65<=d&&95>=d||167==d||!b.shiftKey&&190==d)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:c})});this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:this._parser=new Entry.BlockToPyParser(this.syntax),d.setOption("mode",{name:"python",globalVars:!0}),d.markText({line:0,ch:0},{line:5},{readOnly:!0}),this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY}}; b.parse=function(a,b){var c=null;switch(this._type){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:try{var e=[];e.push(a);var f=[],g;for(g in e){var h=e[g],h=h.trim(),k=acorn.parse(h);f.push(k)}c=this._parser.Program(f)}catch(q){if(this.codeMirror){q instanceof SyntaxError?(a={from:{line:q.loc.line-1,ch:0},to:{line:q.loc.line-1,ch:q.loc.column}},q.message="\ubb38\ubc95(Syntax) \uc624\ub958\uc785\ub2c8\ub2e4.",q.type=1):(a=this.getLineNumber(q.node.start,q.node.end),a.message=q.message,a.severity="converting error", q.type=2);this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a,clearOnEnter:!0});a=q.title?q.title:"\ubb38\ubc95 \uc624\ub958";if(2==q.type&&q.message)var l=q.message;else 2!=q.type||q.message?1==q.type&&(l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694."):l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694.";Entry.toast.alert(a,l);l={};l.boardType=Entry.Workspace.MODE_BOARD; l.textType=Entry.Vim.TEXT_TYPE_JS;l.runType=Entry.Vim.MAZE_MODE;Ntry.dispatchEvent("textError",l);throw q;}c=[]}break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:try{var m=new Entry.PyAstGenerator,e=a.split("\n\n"),n;for(n in e)h=e[n],-1!=h.search("import")?e[n]="":(h=Entry.TextCodingUtil.prototype.entryEventFuncFilter(h),e[n]=h);f=[];for(g in e)h=e[g],k=m.generate(h),"Program"==k.type&&0!=k.body.length&&f.push(k);c=this._parser.Program(f);this._parser._variableMap.clear()}catch(q){if(this.codeMirror)throw q instanceof SyntaxError?(a={from:{line:q.loc.line-1,ch:q.loc.column-2},to:{line:q.loc.line-1,ch:q.loc.column+1}},q.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(q.node.start,q.node.end),a.message=q.message,a.severity="error"),l=parseInt(a.to.line)+1,a.from.line=l-1,a.to.line=l,this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a,clearOnEnter:!0}),a=q.title?q.title:"\ubb38\ubc95 \uc624\ub958",l=q.message&&l?q.message+" (line: "+l+")":"\ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694", Entry.toast.alert(a,l),q;c=[]}break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:c=l=this._parser.Code(a,b);break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:l=this._parser.Code(a,b),this._pyHinter||(this._pyHinter=new Entry.PyHint),c=l}return c};b.getLineNumber=function(a,b){var c=this.codeMirror.getValue(),e={from:{},to:{}};a=c.substring(0,a).split(/\n/gi);e.from.line=a.length-1;e.from.ch=a[a.length-1].length;b=c.substring(0,b).split(/\n/gi);e.to.line=b.length-1;e.to.ch=b[b.length-1].length;return e};b.mappingSyntax= -function(a){for(var b=Object.keys(Entry.block),c={},e=0;e":b=a.operator;break;case ">=":b=a.operator;break;case "<<":b=a.operator;break;case ">>":b=a.operator;break;case ">>>":b=a.operator;break;case "+":b=a.operator;break;case "-":b=a.operator;break;case "*":b=a.operator;break;case "/":b=a.operator;break;case "%":b=a.operator;break;case "|":b=a.operator;break;case "^":b=a.operator;break;case "|":b=a.operator;break; -case "&":b=a.operator;break;case "in":b=a.operator;break;case "instanceof":b=a.operator;break;default:b=null}var c=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b,left:c,right:e}};b.AssignmentExpression=function(a){console.log("AssignmentExpression",a);var b;switch(a.operator){case "=":b=a.operator;break;case "+=":b=a.operator;break;case "-=":b=a.operator;break;case "*=":b=a.operator;break;case "/=":b=a.operator;break;case "%=":b=a.operator;break;case "<<=":b= -a.operator;break;case ">>=":b=a.operator;break;case "|=":b=a.operator;break;case "^=":b=a.operator;break;case "&=":b=a.operator;break;default:b=null}var c;c=a.left;var e=this[a.right.type](a.right);return{type:a.type,operator:b,left:c,right:e}};b.LogicalExpression=function(a){console.log("LogicalExpression",a);var b;switch(a.operator){case "||":b=a.operator;break;case "&&":b=a.operator;break;default:b=null}var c=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b, -left:c,right:e}};b.MemberExpression=function(a){console.log("MemberExpression",a);var b=this[a.object.type](a.object),c=this[a.property.type](a.property),e=a.computed;console.log("object",b);console.log("property",c);return{type:a.type,object:b,property:c,computed:e}};b.ConditionalExpression=function(a){console.log("ConditionalExpression",a);var b=this[a.callee.type](a.callee),c;for(c in a.arguments){var e=a.arguments[c],e=this[e.type](e);(void 0).push(e)}return{type:a.type,callee:b,arguments:void 0}}; -b.CallExpression=function(a){console.log("CallExpression",a);var b=this[a.callee.type](a.callee),c=[],e;for(e in a.arguments){var f=a.arguments[e],f=this[f.type](f);c.push(f)}console.log("callee",b);console.log("arguments",c);return{type:a.type,callee:b,arguments:c}};b.NewExpression=function(a){console.log("NewExpression",a);return{type:a.type}};b.SequenceExpression=function(a){console.log("SequenceExpression",a);for(var b in a.expressions){var c=a.expressions[b],c=this[c.type](c);(void 0).push(c)}return{type:a.type, +case "&":b=a.operator;break;case "in":b=a.operator;break;case "instanceof":b=a.operator;break;default:b=null}var d=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b,left:d,right:e}};b.AssignmentExpression=function(a){console.log("AssignmentExpression",a);var b;switch(a.operator){case "=":b=a.operator;break;case "+=":b=a.operator;break;case "-=":b=a.operator;break;case "*=":b=a.operator;break;case "/=":b=a.operator;break;case "%=":b=a.operator;break;case "<<=":b= +a.operator;break;case ">>=":b=a.operator;break;case "|=":b=a.operator;break;case "^=":b=a.operator;break;case "&=":b=a.operator;break;default:b=null}var d;d=a.left;var e=this[a.right.type](a.right);return{type:a.type,operator:b,left:d,right:e}};b.LogicalExpression=function(a){console.log("LogicalExpression",a);var b;switch(a.operator){case "||":b=a.operator;break;case "&&":b=a.operator;break;default:b=null}var d=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b, +left:d,right:e}};b.MemberExpression=function(a){console.log("MemberExpression",a);var b=this[a.object.type](a.object),d=this[a.property.type](a.property),e=a.computed;console.log("object",b);console.log("property",d);return{type:a.type,object:b,property:d,computed:e}};b.ConditionalExpression=function(a){console.log("ConditionalExpression",a);var b=this[a.callee.type](a.callee),d;for(d in a.arguments){var e=a.arguments[d],e=this[e.type](e);(void 0).push(e)}return{type:a.type,callee:b,arguments:void 0}}; +b.CallExpression=function(a){console.log("CallExpression",a);var b=this[a.callee.type](a.callee),d=[],e;for(e in a.arguments){var f=a.arguments[e],f=this[f.type](f);d.push(f)}console.log("callee",b);console.log("arguments",d);return{type:a.type,callee:b,arguments:d}};b.NewExpression=function(a){console.log("NewExpression",a);return{type:a.type}};b.SequenceExpression=function(a){console.log("SequenceExpression",a);for(var b in a.expressions){var d=a.expressions[b],d=this[d.type](d);(void 0).push(d)}return{type:a.type, expressions:void 0}}})(Entry.PyToBlockParserTemp.prototype);Entry.Toast=function(){this.toasts_=[];var b=document.getElementById("entryToastContainer");b&&document.body.removeChild(b);this.body_=Entry.createElement("div","entryToastContainer");this.body_.addClass("entryToastContainer");document.body.appendChild(this.body_)}; -Entry.Toast.prototype.warning=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastWarning");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= -1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.removeElement(c));c.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastSuccess");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= -1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.removeElement(c));c.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastAlert");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= -1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.toast.body_.removeChild(c));c.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +Entry.Toast.prototype.warning=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastWarning");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(b){b.visible=!1;b._hideEvent=null;b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(a){a.stopPropagation()});Entry.Utils.disableContextmenu(this.dom)};b.show=function(a,b,c){this._hideEvent=Entry.documentMousedown.attach(this,function(){this.hide()});this.dom||this.createDom();if(0!==a.length){var e=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var f=this.dom;f.empty();for(var g=0,h=a.length;g< -h;g++){var k=a[g],l=k.text,m=!1!==k.enable,n=Entry.Dom("li",{parent:f});if(k.divider)b="divider";else{b=m?"menuAble":"menuDisable";var q=Entry.Dom("span",{parent:n});q.text(l);m&&k.callback&&function(a,b){a.mousedown(function(a){a.preventDefault();e.hide();b(a)})}(q,k.callback)}n.addClass(b)}f.removeClass("entryRemove");this.visible=!0;this.position(c||Entry.mouseCoordinate)}};b.position=function(a){var b=this.dom;b.css({left:0,top:0});var c=b.width(),e=b.height(),f=$(window),g=f.width(),f=f.height(); -a.x+c>g&&(a.x-=c+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className);this._hideEvent&&(Entry.documentMousedown.detach(this._hideEvent),this._hideEvent=null)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0,loaded:!1};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(this.totalCount=0,this.handleLoad())};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Loader.isLoaded=function(){return!this.queueCount&&!this.totalCount}; +(function(b){b.visible=!1;b._hideEvent=null;b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(a){a.stopPropagation()});Entry.Utils.disableContextmenu(this.dom)};b.show=function(a,b,d){this._hideEvent=Entry.documentMousedown.attach(this,function(){this.hide()});this.dom||this.createDom();if(0!==a.length){var c=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var f=this.dom;f.empty();for(var g=0,h=a.length;g< +h;g++){var k=a[g],l=k.text,m=!1!==k.enable,n=Entry.Dom("li",{parent:f});if(k.divider)b="divider";else{b=m?"menuAble":"menuDisable";var q=Entry.Dom("span",{parent:n});q.text(l);m&&k.callback&&function(a,b){a.mousedown(function(a){a.preventDefault();c.hide();b(a)})}(q,k.callback)}n.addClass(b)}f.removeClass("entryRemove");this.visible=!0;this.position(d||Entry.mouseCoordinate)}};b.position=function(a){var b=this.dom;b.css({left:0,top:0});var d=b.width(),e=b.height(),f=$(window),g=f.width(),f=f.height(); +a.x+d>g&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className);this._hideEvent&&(Entry.documentMousedown.detach(this._hideEvent),this._hideEvent=null)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0,loaded:!1};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(this.totalCount=0,this.handleLoad())};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Loader.isLoaded=function(){return!this.queueCount&&!this.totalCount}; Entry.Loader.handleLoad=function(){this.loaded||(this.loaded=!0,Entry.dispatchEvent("loadComplete"))};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;this._valueWidth=this._nameWidth=null;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type?(this.setMinValue(b.minValue),this.setMaxValue(b.maxValue)):"list"==this.type&&(this.array_=b.array? b.array:[]);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.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", -function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var d=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= -4;this.textView_.y=1;this.view_.addChild(this.textView_);this.valueView_=new createjs.Text("value","10pt NanumGothic","#ffffff");this.valueView_.textBaseline="alphabetic";this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)})});this.view_.on("pressmove",function(a){"workspace"!=Entry.type||d.isAdjusting||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}); +function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= +4;this.textView_.y=1;this.view_.addChild(this.textView_);this.valueView_=new createjs.Text("value","10pt NanumGothic","#ffffff");this.valueView_.textBaseline="alphabetic";this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)})});this.view_.on("pressmove",function(a){"workspace"!=Entry.type||c.isAdjusting||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}); this.view_.visible=this.visible_;this.view_.addChild(this.valueView_);a=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26;a=Math.max(a,90);this.maxWidth=a-20;this.slideBar_=new createjs.Shape;this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5);this.view_.addChild(this.slideBar_);a=this.getSlidePosition(this.maxWidth);this.valueSetter_=new createjs.Shape;this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a,10.5,3);this.valueSetter_.cursor= -"pointer";this.valueSetter_.on("mousedown",function(a){Entry.engine.isState("run")&&(d.isAdjusting=!0,this.offsetX=-(this.x-.75*a.stageX+240))});this.valueSetter_.on("pressmove",function(a){if(Entry.engine.isState("run")){var b=this.offsetX;this.offsetX=-(this.x-.75*a.stageX+240);b!==this.offsetX&&(a=d.getX(),d.setSlideCommandX(a+10>this.offsetX?0:a+d.maxWidth+10>this.offsetX?this.offsetX-a:d.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){d.isAdjusting=!1});this.view_.addChild(this.valueSetter_); +"pointer";this.valueSetter_.on("mousedown",function(a){Entry.engine.isState("run")&&(c.isAdjusting=!0,this.offsetX=-(this.x-.75*a.stageX+240))});this.valueSetter_.on("pressmove",function(a){if(Entry.engine.isState("run")){var b=this.offsetX;this.offsetX=-(this.x-.75*a.stageX+240);b!==this.offsetX&&(a=c.getX(),c.setSlideCommandX(a+10>this.offsetX?0:a+c.maxWidth+10>this.offsetX?this.offsetX-a:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(),y:.75*a.stageY- this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(a){this.cursor= @@ -1634,7 +1640,7 @@ b=this.textView_.text,a=this.object_?(a=Entry.container.getObject(this.object_)) b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, --2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ad.length?d+"..":d;this.elementView.valueView.text=d;d=this.elementView.clone(!0);d.y=20*(a-this.scrollPosition)+23;this.view_.addChild(d)}}else"answer"==this.type? +-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type? (this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.rect_.graphics.clear().f("#ffffff").ss(1, 2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""): this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1,2,0).s("orange").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7));Entry.requestUpdate=!0}};Entry.Variable.prototype.getName=function(){return this.name_}; @@ -1646,174 +1652,174 @@ Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_& Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1d&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b=b||0;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; -Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var d=Entry.createElement("table");d.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(d);var c=Entry.createElement("tr");d.appendChild(c);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");c.appendChild(e);c.appendChild(this.createSelectButton("variable",Entry.variableEnable));c.appendChild(this.createSelectButton("message",Entry.messageEnable));c=Entry.createElement("tr"); -c.appendChild(this.createSelectButton("list",Entry.listEnable));c.appendChild(this.createSelectButton("func",Entry.functionEnable));d.appendChild(c);d=Entry.createElement("ul");d.addClass("entryVariableListWorkspace");this.view_.appendChild(d);this.listView_=d;d=Entry.createElement("li");d.addClass("entryVariableAddWorkspace");d.addClass("entryVariableListElementWorkspace");d.innerHTML="+ "+Lang.Workspace.variable_add;var f=this;this.variableAddButton_=d;d.bindOnClick(function(b){b=f.variableAddPanel; -var d=b.view.name.value.trim();b.isOpen?d&&0!==d.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();d=Entry.createElement("li");d.addClass("entryVariableAddWorkspace");d.addClass("entryVariableListElementWorkspace");d.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=d;d.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});d=Entry.createElement("li");d.addClass("entryVariableAddWorkspace");d.addClass("entryVariableListElementWorkspace");d.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=d;d.bindOnClick(function(b){b=f.listAddPanel;var d=b.view.name.value.trim();b.isOpen?d&&0!==d.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});d=Entry.createElement("li");d.addClass("entryVariableAddWorkspace");d.addClass("entryVariableListElementWorkspace");d.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=d;d.bindOnClick(function(b){b=a._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=b.lastSelector&&b.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var d=this;void 0===a&&(a=!0);var c=Entry.createElement("td");c.addClass("entryVariableSelectButtonWorkspace",b);c.innerHTML=Lang.Workspace[b];a?c.bindOnClick(function(a){d.selectFilter(b);this.addClass("selected")}):c.addClass("disable");return c}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),d=0;db.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,d=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var d=a.info;b={name:b,isCloud:d.isCloud,object:d.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& +Entry.VariableContainer.prototype.renderMessageReference=function(b){for(var a=this,c=this._messageRefs,d=b.id,e=[],f=0;fb.x_&&a.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; -Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),d=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,d);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,d)}; +Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:d.isCloud,object:d.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", +Entry.VariableContainer.prototype.createMessageView=function(b){var a=this,c=Entry.createElement("li");c.addClass("entryVariableListElementWorkspace");c.addClass("entryMessageElementWorkspace");c.bindOnClick(function(c){a.select(b)});var d=Entry.createElement("button");d.addClass("entryVariableListElementDeleteWorkspace");d.bindOnClick(function(c){c.stopPropagation();a.removeMessage(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementEditWorkspace");e.bindOnClick(function(a){a.stopPropagation(); +g.removeAttribute("disabled");g.focus();f.removeClass("entryRemove");this.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.addClass("entryRemove");f.bindOnClick(function(a){a.stopPropagation();g.blur();e.removeClass("entryRemove");this.addClass("entryRemove")});var g=Entry.createElement("input");g.addClass("entryVariableListElementNameWorkspace");g.value=b.name;g.bindOnClick(function(a){a.stopPropagation()});g.onblur=function(c){(c= +this.value.trim())&&0!==c.length?(a.changeMessageName(b,this.value),e.removeClass("entryRemove"),f.addClass("entryRemove"),g.setAttribute("disabled","disabled")):(Entry.toast.alert(Lang.Msgs.warn,Lang.Msgs.sign_can_not_space),this.value=b.name)};g.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=g;c.appendChild(g);c.appendChild(e);c.appendChild(f);c.appendChild(d);b.listElement=c}; +Entry.VariableContainer.prototype.addList=function(b){if(!b){var a=this.listAddPanel;b=a.view.name.value.trim();b&&0!==b.length||(b=Lang.Workspace.list);var c=a.info;b.length>this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; -Entry.VariableContainer.prototype.createListView=function(b){var a=this,d=Entry.createElement("li"),c=Entry.createElement("div");c.addClass("entryVariableListElementWrapperWorkspace");d.appendChild(c);d.addClass("entryVariableListElementWorkspace");b.object_?d.addClass("entryListLocalElementWorkspace"):b.isCloud_?d.addClass("entryListCloudElementWorkspace"):d.addClass("entryListGlobalElementWorkspace");d.bindOnClick(function(d){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); -e.bindOnClick(function(d){d.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(d){d.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});d.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); -g.bindOnClick(function(d){d.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});d.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(d){(d=this.value.trim())&&0!==d.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, -Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};d.nameField=h;c.appendChild(h);c.appendChild(f);c.appendChild(g);c.appendChild(e);b.listElement=d};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var d=this.variables_.length,c=0;cd.getValue()&&d.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +Entry.VariableContainer.prototype.generateVariableSettingView=function(){var b=this,a=Entry.createElement("div");a.bindOnClick(function(a){a.stopPropagation()});this.variableSettingView=a;a.addClass("entryVariableSettingWorkspace");this.listView_.appendChild(a);a.addClass("entryRemove");var c=Entry.createElement("div");c.addClass("entryVariableSettingVisibleWrapperWorkspace");c.bindOnClick(function(a){a=b.selectedVariable;var c=b.variableSettingView.visibleCheck;a.setVisible(!a.isVisible());a.isVisible()? +c.addClass("entryVariableSettingChecked"):c.removeClass("entryVariableSettingChecked")});a.appendChild(c);var d=Entry.createElement("span");d.innerHTML=Lang.Workspace.show_variable;c.appendChild(d);d=Entry.createElement("span");d.addClass("entryVariableSettingCheckWorkspace");a.visibleCheck=d;c.appendChild(d);c=Entry.createElement("div");c.addClass("entryVariableSettingInitValueWrapperWorkspace");a.appendChild(c);d=Entry.createElement("span");d.innerHTML=Lang.Workspace.default_value;c.appendChild(d); +d=Entry.createElement("input");d.addClass("entryVariableSettingInitValueInputWorkspace");a.initValueInput=d;d.value=0;d.onkeyup=function(a){b.selectedVariable.setValue(this.value)};d.onblur=function(a){b.selectedVariable.setValue(this.value)};a.initValueInput=d;c.appendChild(d);c=Entry.createElement("div");c.addClass("entryVariableSettingSplitterWorkspace");a.appendChild(c);c=Entry.createElement("div");c.addClass("entryVariableSettingSlideWrapperWorkspace");a.appendChild(c);d=Entry.createElement("span"); +d.innerHTML=Lang.Workspace.slide;c.appendChild(d);d=Entry.createElement("span");d.addClass("entryVariableSettingCheckWorkspace");a.slideCheck=d;c.appendChild(d);c.bindOnClick(function(a){var c;a=b.selectedVariable;var d=b.variables_,f=a.getType();"variable"==f?(c=a.toJSON(),c.variableType="slide",c=new Entry.Variable(c),d.splice(d.indexOf(a),0,c),0>c.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],d=this;this.mapVariable(function(b,d){b.object_&&b.object_==d&&a.push(b)},b);a.map(function(a){d.removeVariable(a)})}; +Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; -Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var d={object:a.getCode().object,block:a};a.funcBlock&&(d.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(d);if("_functionRefs"==b){b=a.type.substr(5);for(var c=Entry.variableContainer.functions_[b].content.getBlockList(),e=0;ethis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&ethis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&ea.x||0>a.y){d.leftWheel=20;d.rightWheel= --20;break}a.initialized=!0}d=b.toRadian(a.theta);0==b.controlAngle(d,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX; -delete a.targetY;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1;a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();d.leftWheel=0;d.rightWheel=0;return a}},albert_set_orientation_on_board:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["0"]},null],type:"albert_set_orientation_on_board"},paramsKeyMap:{ORIENTATION:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var d=Entry.hw.portData,c=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=d.orientation;switch(a.boardState){case 1:var d=c.toRadian(a.theta),e=c.toRadian(a.targetTheta);0==c.controlAngle(d,e)&&(a.boardState=2);break;case 2:d=c.toRadian(a.theta),e=c.toRadian(a.targetTheta),0==c.controlAngleFine(d,e)&&(b.leftWheel=0, -b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState;delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");c.clear();b.leftWheel=0;b.rightWheel=0;return a}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye, +size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"albert_move_to_x_y_on_board"},paramsKeyMap:{X:0,Y:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;b=Entry.Albert.controller;if(a.isStart){if(a.isMoving){0<=d.positionX&&(a.x=d.positionX);0<=d.positionY&&(a.y=d.positionY);a.theta=d.orientation;switch(a.boardState){case 1:if(0==a.initialized){if(0>a.x||0>a.y){c.leftWheel=20;c.rightWheel= +-20;break}a.initialized=!0}c=b.toRadian(a.theta);0==b.controlAngle(c,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(c.leftWheel=0,c.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX; +delete a.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1;a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();c.leftWheel=0;c.rightWheel=0;return a}},albert_set_orientation_on_board:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["0"]},null],type:"albert_set_orientation_on_board"},paramsKeyMap:{ORIENTATION:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta);0==d.controlAngle(c,e)&&(a.boardState=2);break;case 2:c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta),0==d.controlAngleFine(c,e)&&(b.leftWheel=0, +b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState;delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");d.clear();b.leftWheel=0;b.rightWheel=0;return a}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye, "RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.ALBERT_color_red,"4"],[Lang.Blocks.ALBERT_color_yellow,"6"],[Lang.Blocks.ALBERT_color_green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.Blocks.ALBERT_color_blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.Blocks.ALBERT_color_white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"}, -paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a),c=Number(a.getField("COLOR",a));"LEFT"==d?b.leftEye=c:("RIGHT"!=d&&(b.leftEye=c),b.rightEye=c);return a.callReturn()},syntax:{js:[],py:["Albert.set_eye(%1, %2)"]}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes, -"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"},paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a);"LEFT"==d?b.leftEye=0:("RIGHT"!=d&&(b.leftEye=0),b.rightEye=0);return a.callReturn()},syntax:{js:[],py:["Albert.clear_eye(%1)"]}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", +paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"LEFT"==c?b.leftEye=d:("RIGHT"!=c&&(b.leftEye=d),b.rightEye=d);return a.callReturn()},syntax:{js:[],py:["Albert.set_eye(%1, %2)"]}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes, +"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"},paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"LEFT"==c?b.leftEye=0:("RIGHT"!=c&&(b.leftEye=0),b.rightEye=0);return a.callReturn()},syntax:{js:[],py:["Albert.clear_eye(%1)"]}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.bodyLed=1:b.bodyLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.body_led(%1)"]}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[], params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.frontLed=1:b.frontLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.front_led(%1)"]}},albert_beep:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(d)},200);Entry.Albert.timeouts.push(d); -return a},syntax:{js:[],py:["Albert.beep()"]}},albert_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"albert_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+d:d;b.note=0;return a.callReturn()}, +skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c); +return a},syntax:{js:[],py:["Albert.beep()"]}},albert_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"albert_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+c:c;b.note=0;return a.callReturn()}, syntax:{js:[],py:["Albert.change_buzzer(%1)"]}},albert_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["1000"]},null],type:"albert_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;b.buzzer=a.getNumberValue("VALUE");b.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.set_buzzer(%1)"]}}, albert_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_clear_buzzer"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;b.buzzer=0;b.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_buzzer()"]}},albert_play_note_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_note_c+"","4"], [Lang.Blocks.ALBERT_note_c+"#","5"],[Lang.Blocks.ALBERT_note_d+"","6"],[Lang.Blocks.ALBERT_note_e+"b","7"],[Lang.Blocks.ALBERT_note_e+"","8"],[Lang.Blocks.ALBERT_note_f+"","9"],[Lang.Blocks.ALBERT_note_f+"#","10"],[Lang.Blocks.ALBERT_note_g+"","11"],[Lang.Blocks.ALBERT_note_g+"#","12"],[Lang.Blocks.ALBERT_note_a+"","13"],[Lang.Blocks.ALBERT_note_b+"b","14"],[Lang.Blocks.ALBERT_note_b+"","15"]],value:"4",fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6", -"6"],["7","7"]],value:"1",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.note=0;return a.callReturn()}b=a.getNumberField("NOTE", -a);var c=a.getNumberField("OCTAVE",a),e=6E4*a.getNumberValue("VALUE",a)/Entry.Albert.tempo;a.isStart=!0;a.timeFlag=1;d.buzzer=0;d.note=b+12*(c-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.change_tempo(%1)"]}},albert_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE"); 1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.set_tempo(%1)"]}},albert_move_forward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.leftWheel= 30;b.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_forward()"]}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return b.leftWheel=-30,b.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart= !0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_backward()"]}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_left,"LEFT"],[Lang.Blocks.ALBERT_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1== a.timeFlag)return b.leftWheel=a.leftValue,b.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}b="LEFT"==a.getField("DIRECTION",a);a.leftValue=b?-30:30;a.rightValue=b?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.turn_around()"]}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"],[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_red,"4"],[Lang.Blocks.HAMSTER_color_yellow,"6"],[Lang.Blocks.HAMSTER_color_green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.Blocks.HAMSTER_color_blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.Blocks.HAMSTER_color_white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a),c=Number(a.getField("COLOR",a));"FRONT"==d?(b.leftEye=c,b.rightEye=c):"LEFT"==d?b.leftEye=c:b.rightEye=c;return a.callReturn()},syntax:{js:[],py:["Albert.set_led(%1, %2)"]}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"], -[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION",a);"FRONT"==d?(b.leftEye=0,b.rightEye=0):"LEFT"==d?b.leftEye=0:b.rightEye=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_led(%1)"]}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel, -"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var d=Entry.hw.portData,c=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==c?b.leftWheel=void 0!=b.leftWheel?b.leftWheel+e:d.leftWheel+e:("RIGHT"!=c&&(b.leftWheel=void 0!= -b.leftWheel?b.leftWheel+e:d.leftWheel+e),b.rightWheel=void 0!=b.rightWheel?b.rightWheel+e:d.rightWheel+e);return a.callReturn()},syntax:{js:[],py:["Albert.change_wheels(%1, %2)"]}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("DIRECTION"),c=a.getNumberValue("VALUE");"LEFT"==d?b.leftWheel=c:("RIGHT"!=d&&(b.leftWheel=c),b.rightWheel=c);return a.callReturn()},syntax:{js:[],py:["Albert.set_wheels(%1, %2)"]}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}, -syntax:{js:[],py:["%1arduino_text#"]}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);var d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(b));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()},syntax:{js:[],py:["Arduino.send(%1)"]}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field", +size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"FRONT"==c?(b.leftEye=d,b.rightEye=d):"LEFT"==c?b.leftEye=d:b.rightEye=d;return a.callReturn()},syntax:{js:[],py:["Albert.set_led(%1, %2)"]}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"], +[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"FRONT"==c?(b.leftEye=0,b.rightEye=0):"LEFT"==c?b.leftEye=0:b.rightEye=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_led(%1)"]}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel, +"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?b.leftWheel=void 0!=b.leftWheel?b.leftWheel+e:c.leftWheel+e:("RIGHT"!=d&&(b.leftWheel=void 0!= +b.leftWheel?b.leftWheel+e:c.leftWheel+e),b.rightWheel=void 0!=b.rightWheel?b.rightWheel+e:c.rightWheel+e);return a.callReturn()},syntax:{js:[],py:["Albert.change_wheels(%1, %2)"]}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION"),d=a.getNumberValue("VALUE");"LEFT"==c?b.leftWheel=d:("RIGHT"!=c&&(b.leftWheel=d),b.rightWheel=d);return a.callReturn()},syntax:{js:[],py:["Albert.set_wheels(%1, %2)"]}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}, +syntax:{js:[],py:["%1arduino_text#"]}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(b));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()},syntax:{js:[],py:["Arduino.send(%1)"]}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field", statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return Number(a.responseText)},syntax:{js:[],py:["Arduino.number(%1)"]}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return a.responseText},syntax:{js:[],py:["Arduino.string(%1)"]}},arduino_get_sensor_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}], events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]}, paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_pwm_port_number#"]}}, arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){b=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(b[1])},syntax:{js:[],py:["Arduino.sensor_value(%1)"]}},arduino_get_digital_value:{color:"#00979D",fontColor:"#fff", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(b)},syntax:{js:[],py:["Arduino.digital_value(%1)"]}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("VALUE");var d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==d?255:0);return a.callReturn()}, -syntax:{js:[],py:["Arduino.toggle_led(%1, %2)"]}},arduino_toggle_pwm:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("PORT");var d= -a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(b,d);return a.callReturn()},syntax:{js:[],py:["Arduino.toggle_pwm(%1, %2)"]}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value", -params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var d=a.getNumberValue("VALUE1",a),c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(c>e)var f=c,c= -e,e=f;b>a&&(f=b,b=a,a=f);d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)},syntax:{js:[],py:["Arduino.convert_scale(%1, %2, %3, %4, %5)"]}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet", -isNotFor:["ArduinoExt"],func:function(b,a){b=a.getField("PORT",a);var d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),c=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(c&&c===a.stamp||64e)var f=d,d= +e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)},syntax:{js:[],py:["Arduino.convert_scale(%1, %2, %3, %4, %5)"]}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet", +isNotFor:["ArduinoExt"],func:function(b,a){b=a.getField("PORT",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64=e[0]?1:0;throw new Entry.Utils.AsyncError;}a.isStart=!0;a.stamp=d;Entry.hw.sendQueue.TIME=d;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("STATUS",a);var d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),c=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(c&&c===a.stamp||64e[1]?1:0:800>=e[1]?1:0;throw new Entry.Utils.AsyncError; -}a.isStart=!0;a.stamp=d;Entry.hw.sendQueue.TIME=d;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7, -"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);if(10>b){var d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),c=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.DIGITAL;if(a.isStart){if(c&&c===a.stamp||64e[b-14]?1:0;throw new Entry.Utils.AsyncError;}a.isStart= -!0;a.stamp=d;Entry.hw.sendQueue.TIME=d;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:b-14};throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19, -"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"},paramsKeyMap:{DIRECTION:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("DIRECTION",a);var d=0,c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0;a=a.executor.scope;var f=Entry.hw.portData.ANALOG;"LEFT"==b||"RIGHT"==b?d=3:"FRONT"==b||"REAR"==b?d=4:"REVERSE"==b&&(d=5);if(a.isStart)if(e&& -e===a.stamp){delete a.isStart;delete a.stamp;d=f[d];d=Math.min(90,180/137*(d-265)+-90);d=Math.max(-90,d);d=Math.round(d);if("LEFT"==b||"REAR"==b)return-30>d?1:0;if("RIGHT"==b||"FRONT"==b)return 30d?1:0}else if(64d?1:0;if("RIGHT"==b||"FRONT"==b)return 30d?1:0}else throw new Entry.Utils.AsyncError; -else throw a.isStart=!0,a.stamp=c,Entry.hw.sendQueue.TIME=c,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(),Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:d},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0}, -"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);var d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),c=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(c&&c===a.stamp||64=e[0]?1:0;throw new Entry.Utils.AsyncError;}a.isStart=!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT", +fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("STATUS",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64e[1]?1:0:800>=e[1]?1:0;throw new Entry.Utils.AsyncError;}a.isStart= +!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7, +"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);if(10>b){var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.DIGITAL;if(a.isStart){if(d&&d===a.stamp||64e[b-14]?1:0;throw new Entry.Utils.AsyncError;}a.isStart= +!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:b-14};throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19, +"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"},paramsKeyMap:{DIRECTION:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("DIRECTION",a);var c=0,d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0;a=a.executor.scope;var f=Entry.hw.portData.ANALOG;"LEFT"==b||"RIGHT"==b?c=3:"FRONT"==b||"REAR"==b?c=4:"REVERSE"==b&&(c=5);if(a.isStart)if(e&& +e===a.stamp){delete a.isStart;delete a.stamp;c=f[c];c=Math.min(90,180/137*(c-265)+-90);c=Math.max(-90,c);c=Math.round(c);if("LEFT"==b||"REAR"==b)return-30>c?1:0;if("RIGHT"==b||"FRONT"==b)return 30c?1:0}else if(64c?1:0;if("RIGHT"==b||"FRONT"==b)return 30c?1:0}else throw new Entry.Utils.AsyncError; +else throw a.isStart=!0,a.stamp=d,Entry.hw.sendQueue.TIME=d,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(),Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:c},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0}, +"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64e)var f=c,c=e,e=f;b>a&&(f=b,b=a,a=f);d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)}},CODEino_set_rgb_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791", -"19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getNumberField("PORT",a),c=a.getNumberValue("VALUE",a),c=Math.min(255,c),c=Math.max(0,c);17==d?CODEINO_RED=c:18==d?CODEINO_GREEN=c:CODEINO_BLUE=c;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); -b.SET||(b.SET={});b.SET[d]={type:4,data:c};return a.callReturn()}},CODEino_set_rgb_add_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791","19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_add_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b, -a){b=Entry.hw.sendQueue;var d=a.getNumberField("PORT",a),c=a.getNumberValue("VALUE",a),c=Math.min(255,c),c=Math.max(0,c);17==d&&(CODEINO_RED+=c,CODEINO_RED=Math.min(255,CODEINO_RED),c=CODEINO_RED=Math.max(0,CODEINO_RED));18==d&&(CODEINO_GREEN+=c,CODEINO_GREEN=Math.min(255,CODEINO_GREEN),c=CODEINO_GREEN=Math.max(0,CODEINO_GREEN));19==d&&(CODEINO_BLUE+=c,CODEINO_BLUE=Math.min(255,CODEINO_BLUE),c=CODEINO_BLUE=Math.max(0,CODEINO_BLUE));b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); -b.SET||(b.SET={});b.SET[d]={type:4,data:c};return a.callReturn()}},CODEino_rgb_set_color:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_rgb_set_color"},paramsKeyMap:{VALUE:0},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=a.getStringField("VALUE");CODEINO_RED=parseInt(b.substr(1,2),16);CODEINO_GREEN=parseInt(b.substr(3,2),16);CODEINO_BLUE=parseInt(b.substr(5, -2),16);b=Entry.hw.sendQueue;var d=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_RED};b=Entry.hw.sendQueue;d=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;d=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_BLUE};return a.callReturn()}}, -CODEino_set_rgb_off:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_set_rgb_off"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;CODEINO_GREEN=CODEINO_BLUE=CODEINO_RED=0;var d=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:0};b=Entry.hw.sendQueue;d=18;b.TIME=Entry.ArduinoExt.getSensorTime(4); -b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:0};b=Entry.hw.sendQueue;d=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:0};return a.callReturn()}},CODEino_set__led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", -params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"CODEino_set__led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){CODEINO_RED=a.getNumberValue("rValue");CODEINO_GREEN=a.getNumberValue("gValue");CODEINO_BLUE=a.getNumberValue("bValue");b=Entry.hw.sendQueue;var d=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_RED}; -b=Entry.hw.sendQueue;d=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;d=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:CODEINO_BLUE};return a.callReturn()}},CODEino_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], -type:"CODEino_led_by_value"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var d=17;CODEINO_BLUE=CODEINO_GREEN=CODEINO_RED=100;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:100};b=Entry.hw.sendQueue;d=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:100};b=Entry.hw.sendQueue;d=19;b.TIME=Entry.ArduinoExt.getSensorTime(4); -b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[d]={type:4,data:100};return a.callReturn()}},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["hw.CODEino_get_number_sensor_value(%1)"]}},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null], +"class":"CODEino_extmode",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}},CODEino_set_rgb_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791", +"19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberField("PORT",a),d=a.getNumberValue("VALUE",a),d=Math.min(255,d),d=Math.max(0,d);17==c?CODEINO_RED=d:18==c?CODEINO_GREEN=d:CODEINO_BLUE=d;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); +b.SET||(b.SET={});b.SET[c]={type:4,data:d};return a.callReturn()}},CODEino_set_rgb_add_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791","19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_add_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b, +a){b=Entry.hw.sendQueue;var c=a.getNumberField("PORT",a),d=a.getNumberValue("VALUE",a),d=Math.min(255,d),d=Math.max(0,d);17==c&&(CODEINO_RED+=d,CODEINO_RED=Math.min(255,CODEINO_RED),d=CODEINO_RED=Math.max(0,CODEINO_RED));18==c&&(CODEINO_GREEN+=d,CODEINO_GREEN=Math.min(255,CODEINO_GREEN),d=CODEINO_GREEN=Math.max(0,CODEINO_GREEN));19==c&&(CODEINO_BLUE+=d,CODEINO_BLUE=Math.min(255,CODEINO_BLUE),d=CODEINO_BLUE=Math.max(0,CODEINO_BLUE));b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); +b.SET||(b.SET={});b.SET[c]={type:4,data:d};return a.callReturn()}},CODEino_rgb_set_color:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_rgb_set_color"},paramsKeyMap:{VALUE:0},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=a.getStringField("VALUE");CODEINO_RED=parseInt(b.substr(1,2),16);CODEINO_GREEN=parseInt(b.substr(3,2),16);CODEINO_BLUE=parseInt(b.substr(5, +2),16);b=Entry.hw.sendQueue;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_RED};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}}, +CODEino_set_rgb_off:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_set_rgb_off"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;CODEINO_GREEN=CODEINO_BLUE=CODEINO_RED=0;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4); +b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};return a.callReturn()}},CODEino_set__led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", +params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"CODEino_set__led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){CODEINO_RED=a.getNumberValue("rValue");CODEINO_GREEN=a.getNumberValue("gValue");CODEINO_BLUE=a.getNumberValue("bValue");b=Entry.hw.sendQueue;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_RED}; +b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}},CODEino_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], +type:"CODEino_led_by_value"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var c=17;CODEINO_BLUE=CODEINO_GREEN=CODEINO_RED=100;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4); +b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};return a.callReturn()}},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["hw.CODEino_get_number_sensor_value(%1)"]}},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null], type:"CODEino_toggle_led"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_led(%1)"]}},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_pwm(%1, %2)"]}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12", params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field", statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff", skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){b=a.getNumberField("PORT",a);return 14a?1:0;if("RIGHT"==b||"FRONT"==b)return 30a?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var d=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),c=265,e=402;b=-90;a=90;if(c>e)var f=c,c=e,e=f;b>a&&(f=b,b=a,a=f);d=(a-b)/(e-c)* -(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b].value},syntax:{js:[], +skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),d=265,e=402;b=-90;a=90;if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)* +(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b].value},syntax:{js:[], py:["Bitbrick.sensor_value(%1)"]}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value},syntax:{js:[],py:["Bitbrick.is_touch_pressed(%1)"]}},bitbrick_turn_off_color_led:{color:"#00979D", skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_color_led()"]}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("rValue");var d=a.getNumberValue("gValue"),c=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin, -f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(d,0,255);f.LEDB=e(c,0,255);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_rgb(%1, %2, %3)"]}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("VALUE"); +{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("rValue");var c=a.getNumberValue("gValue"),d=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin, +f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_rgb(%1, %2, %3)"]}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("VALUE"); Entry.hw.sendQueue.LEDR=parseInt(b.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(b.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(b.substr(5,2),16);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_picker(%1)"]}},bitbrick_turn_on_color_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"}, -paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("VALUE");var d,c,e;b%=200;67>b?(d=200-3*b,c=3*b,e=0):134>b?(b-=67,d=0,c=200-3*b,e=3*b):201>b&&(b-=134,d=3*b,c=0,e=200-3*b);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=c;Entry.hw.sendQueue.LEDB=e;return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_value(%1)"]}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("VALUE");var c,d,e;b%=200;67>b?(c=200-3*b,d=3*b,e=0):134>b?(b-=67,c=0,d=200-3*b,e=3*b):201>b&&(b-=134,c=3*b,d=0,e=200-3*b);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_value(%1)"]}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();b=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=b;a.isStart=!0;return a},syntax:{js:[],py:["Bitbrick.buzzer(%1)"]}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){d[a[1]]=0});b.dcList().map(function(a){d[a[1]]=128});return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_all_motors()"]}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList}, +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){c[a[1]]=0});b.dcList().map(function(a){c[a[1]]=128});return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_all_motors()"]}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList}, {type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("VALUE");b=Math.min(b,Entry.Bitbrick.dcMaxValue);b=Math.max(b,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b+128;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_speed(%1, %2)"]}}, bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0, -DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b="CW"===a.getStringField("DIRECTION");var d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?d+128:128-d;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_direction_speed(%1, %2, %3)"]}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList}, +DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b="CW"===a.getStringField("DIRECTION");var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?c+128:128-c;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_direction_speed(%1, %2, %3)"]}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList}, {type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1);b=Math.min(b,Entry.Bitbrick.servoMaxValue);b=Math.max(b,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b;return a.callReturn()},syntax:{js:[], py:["Bitbrick.servomotor_angle(%1, %2)"]}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}], -type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberField("PORT");var d=Entry.hw.portData[b].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}d=(a-b)/(e-c)*(d-c);d+=b;d=Math.min(a,d);d=Math.max(b,d);return Math.round(d)},syntax:{js:[],py:["Bitbrick.convert_scale(%1, %2, %3, %4, %5)"]}}, +type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberField("PORT");var c=Entry.hw.portData[b].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)},syntax:{js:[],py:["Bitbrick.convert_scale(%1, %2, %3, %4, %5)"]}}, cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("potenmeter")}}, cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread1")}},cobl_read_irread2:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread2")}}, cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyy")}}, @@ -1980,30 +1986,30 @@ cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",t class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getAnalogPortValue("temps1");if(2==b)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE", a);if(1==b)return Entry.hw.getAnalogPortValue("light1");if(2==b)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getDigitalPortValue("btn1"); if(2==b)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["\ube68\uac15","Red"],["\uc8fc\ud669","Orange"],["\ub178\ub791","Yellow"],["\ucd08\ub85d","Green"],["\ud30c\ub791","Blue"],["\ub0a8\uc0c9","Dark Blue"],["\ubcf4\ub77c","Purple"],["\ud770\uc0c9","White"]],fontSize:11}, -{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var d=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+b,d);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+b];return a.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165) %2", +{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+b,c);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+b];return a.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165) %2", params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("VALUE");b=Math.round(b);b=Math.max(b,15);b=Math.min(b,165);Entry.hw.setDigitalPortValue("Servo1",b);Entry.hw.update();delete Entry.hw.sendQueue.Servo1;return a.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1 ,%2", params:[{type:"Dropdown",options:[["((\ub0ae\uc740)\uc194","L_So"],["(\ub0ae\uc740)\uc194#","L_So#"],["(\ub0ae\uc740)\ub77c","L_La"],["(\ub0ae\uc740)\ub77c#","L_La#"],["(\ub0ae\uc740)\uc2dc","L_Ti"],["\ub3c4","Do"],["\ub3c4#","Do#"],["\ub808","Re"],["\ub808#","Re#"],["\ubbf8","Mi"],["\ud30c","Fa"],["\ud30c#","Fa#"],["\uc194","So"],["\uc194#","So#"],["\ub77c","La"],["\ub77c#","La#"],["\uc2dc","Ti"],["(\ub192\uc740)\ub3c4","H_Do"],["(\ub192\uc740)\ub3c4#","H_Do#"],["(\ub192\uc740)\ub808","H_Re"],["(\ub192\uc740)\ub808#", "H_Re#"],["(\ub192\uc740)\ubbf8#","H_Mi"],["(\ub192\uc740)\ud30c","H_Fa"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["Do"],type:"cobl_melody"},paramsKeyMap:{MELODY:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("MELODY");Entry.hw.setDigitalPortValue("Melody",b);Entry.hw.update();delete Entry.hw.sendQueue.Melody;return a.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3 %4", params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.\uc2dc\uacc4\ubc29\ud5a5","1"],["2.\ubc18\uc2dc\uacc4\ubc29\ud5a5","2"],["3.\uc815\uc9c0","3"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:1,SPEED:2},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("MOTOR"); -var d=a.getStringField("DIRECTION"),c=a.getStringField("SPEED");1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",d),Entry.hw.setDigitalPortValue("DC1_SPEED",c),Entry.hw.update(),delete Entry.hw.sendQueue.DC1_DIR,delete Entry.hw.sendQueue.DC1_SPEED);2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",d),Entry.hw.setDigitalPortValue("DC2_SPEED",c),Entry.hw.update(),delete Entry.hw.sendQueue.DC2_DIR,delete Entry.hw.sendQueue.DC2_SPEED);return a.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff", -skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","0"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var d=a.getStringField("LEVEL");1==b&&(Entry.hw.setDigitalPortValue("EXUSB1", -d),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB1);2==b&&(Entry.hw.setDigitalPortValue("EXUSB2",d),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB2);return a.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4 %5",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown", +var c=a.getStringField("DIRECTION"),d=a.getStringField("SPEED");1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC1_DIR,delete Entry.hw.sendQueue.DC1_SPEED);2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC2_DIR,delete Entry.hw.sendQueue.DC2_SPEED);return a.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff", +skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","0"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var c=a.getStringField("LEVEL");1==b&&(Entry.hw.setDigitalPortValue("EXUSB1", +c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB1);2==b&&(Entry.hw.setDigitalPortValue("EXUSB2",c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB2);return a.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4 %5",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown", options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:1,GREEN:2,BLUE:3},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("LED"); -var d=a.getStringField("RED"),c=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",d);Entry.hw.setDigitalPortValue("ELED_G",c);Entry.hw.setDigitalPortValue("ELED_B",e);Entry.hw.update();delete Entry.hw.sendQueue.ELED_IDX;delete Entry.hw.sendQueue.ELED_R;delete Entry.hw.sendQueue.ELED_G;delete Entry.hw.sendQueue.ELED_B;return a.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999) %2", +var c=a.getStringField("RED"),d=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);Entry.hw.update();delete Entry.hw.sendQueue.ELED_IDX;delete Entry.hw.sendQueue.ELED_R;delete Entry.hw.sendQueue.ELED_G;delete Entry.hw.sendQueue.ELED_B;return a.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999) %2", params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("VALUE");Entry.hw.setDigitalPortValue("7SEG",b);Entry.hw.update();delete Entry.hw.sendQueue["7SEG"];return a.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"}, "class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.start_drawing()"]}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop= -!0);return a.callReturn()},syntax:{js:[],py:["Entry.stop_drawing()"]}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var d=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(d=Entry.hex2rgb(d),b.brush.rgb=d,b.brush.endStroke(),b.brush.beginStroke("rgba("+ -d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color(%1)"]}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var d=Entry.generateRgb();b.brush.rgb= -d;b.brush.endStroke();b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color_random()"]}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness", -isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=d,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_size(%1)"]}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}], -events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=d,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_size(%1)"]}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity+d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/ -100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0); -b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(b, -a){var d=b.brush;if(d){var c=d._stroke.style,e=d._strokeStyle.width;d.clear().setStrokeStyle(e).beginStroke(c);d.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()},syntax:{js:[],py:["Entry.clear_drawing()"]}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(b, -a){b.parent.addStampEntity(b);return a.callReturn()},syntax:{js:[],py:["Entry.stamp()"]}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), -b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity-d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_transparency(%1)"]}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[], +!0);return a.callReturn()},syntax:{js:[],py:["Entry.stop_drawing()"]}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+ +c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color(%1)"]}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb= +c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color_random()"]}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness", +isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_size(%1)"]}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}], +events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_size(%1)"]}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/ +100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0); +b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(b, +a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()},syntax:{js:[],py:["Entry.clear_drawing()"]}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(b, +a){b.parent.addStampEntity(b);return a.callReturn()},syntax:{js:[],py:["Entry.stamp()"]}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), +b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_transparency(%1)"]}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{}, +def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[], py:["Entry.set_brush_transparency(%1)"]}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0,syntax:{js:["Scope","%1"],py:["%1number#"]}},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}, syntax:{js:[],py:["%1angle#"]}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()},syntax:{js:[],py:[""]}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()},syntax:{js:[],py:[""]}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))},syntax:{js:[],py:[""]}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value, @@ -2012,10 +2018,10 @@ color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse", return Math.sqrt(Math.pow(b.getX()-a.getX(),2)+Math.pow(b.getY()-a.getY(),2))},syntax:{js:[],py:["Entry.value_of_distance(%2)"]}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null, null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1},"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)},syntax:{js:[],py:["Entry.coordinate_of_mouse(%2)"]}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, {type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], -events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);b="self"==d?b:Entry.container.getEntity(d);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1)); +events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1)); case "picture_name":return a=b.parent,a=a.pictures,a[a.indexOf(b.picture)].name}},syntax:{js:[],py:["Entry.value_of(%2, %4)"]}},calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"}, defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){b=a.getField("OPERATOR", -a);var d=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?d+a:"MINUS"==b?d-a:"MULTI"==b?d*a:d/a},syntax:{js:[],py:["(%1 %2calc_basic# %3)"]}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND", +a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?c+a:"MINUS"==b?c-a:"MULTI"==b?c*a:c/a},syntax:{js:[],py:["(%1 %2calc_basic# %3)"]}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND", a);return b+a},syntax:{js:[],py:[""]}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b-a},syntax:{js:[],py:[""]}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b*a},syntax:{js:[],py:[""]}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0, RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b/a},syntax:{js:[],py:[""]}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0, @@ -2025,19 +2031,19 @@ null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",is "floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getField("VALUE",a); if(-1<["asin_radian","acos_radian"].indexOf(a)&&(1b))throw Error("x range exceeded");a.indexOf("_")&&(a=a.split("_")[0]);-1<["sin","cos","tan"].indexOf(a)&&(b=Entry.toRadian(b));switch(a){case "square":a=b*b;break;case "factorial":a=Entry.factorial(b);break;case "root":a=Math.sqrt(b);break;case "log":a=Math.log(b)/Math.LN10;break;case "ln":a=Math.log(b);break;case "asin":case "acos":case "atan":a=Entry.toDegrees(Math[a](b));break;case "unnatural":a=b-Math.floor(b);0>b&&(a=1-a);break;default:a= Math[a](b)}return a},syntax:{js:[],py:["Entry.value_of_math_operation(%2, %4)"]}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]}, -null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var d=Math.min(b,a),c=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(c-d)+d).toFixed(2):Math.floor(Math.random()*(c-d+1)+d)},syntax:{js:[],py:["random.randint(%2, %4)"]}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"}, +null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var c=Math.min(b,a),d=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)},syntax:{js:[],py:["random.randint(%2, %4)"]}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"}, {type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date", isNotFor:[],func:function(b,a){b=a.getField("VALUE",a);a=new Date;return"YEAR"==b?a.getFullYear():"MONTH"==b?a.getMonth()+1:"DAY"==b?a.getDate():"HOUR"==b?a.getHours():"MINUTE"==b?a.getMinutes():a.getSeconds()},syntax:{js:[],py:["Entry.value_of_date_time(%2)"]}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(b,a){a=a.getField("VALUE",a);b=b.parent.sounds;for(var d=0;da||a>b.length-1)throw Error();return b[a]},syntax:{js:[],py:["Entry.string_index_of(%2, %4)"]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"}, {type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length},syntax:{js:[],py:["Entry.string_length(%2)"]}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"}, {type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string", -isNotFor:[],func:function(b,a){b=a.getStringValue("STRING",a);var d=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var c=b.length-1;if(0>d||0>a||d>c||a>c)throw Error();return b.substring(Math.min(d,a),Math.max(d,a)+1)},syntax:{js:[],py:["Entry.string_substring(%2, %4, %6)"]}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2, +isNotFor:[],func:function(b,a){b=a.getStringValue("STRING",a);var c=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var d=b.length-1;if(0>c||0>a||c>d||a>d)throw Error();return b.substring(Math.min(c,a),Math.max(c,a)+1)},syntax:{js:[],py:["Entry.string_substring(%2, %4, %6)"]}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2, color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b, a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))},syntax:{js:[],py:["Entry.string_replace(%2, %4, %6)"]}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1, "toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()},syntax:{js:[],py:["Entry.string_case(%2, %4)"]}}, @@ -2046,23 +2052,23 @@ paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:fun {type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){b=a.getStringValue("VALUE1",a);a=a.getStringValue("VALUE2",a);return b+a},syntax:{js:[],py:["Entry.string_concat(%2, %4)"]}},get_sound_volume:{color:"#FFD974", skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100*createjs.Sound.getVolume()},syntax:{js:[],py:["Entry.value_of_sound()"]}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"}, {type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2,"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null], -type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);var d=a.getNumberValue("RIGHTHAND",a);if(isNaN(b)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(b/d):b%d},syntax:{js:[],py:["Entry.value_div(%2, %4, %6)"]}},choose_project_timer_action:{color:"#FFD974",vimModeFontColor:"#000",skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1, +type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);var c=a.getNumberValue("RIGHTHAND",a);if(isNaN(b)||isNaN(c))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(b/c):b%c},syntax:{js:[],py:["Entry.value_div(%2, %4, %6)"]}},choose_project_timer_action:{color:"#FFD974",vimModeFontColor:"#000",skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1, color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png",size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}], -dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){b=a.getField("ACTION");var d=Entry.engine,c=d.projectTimer;"START"==b?c.isInit?c.isInit&&c.isPaused&&(c.pauseStart&&(c.pausedTime+=(new Date).getTime()-c.pauseStart),delete c.pauseStart,c.isPaused=!1):d.startProjectTimer():"STOP"==b?c.isInit&&!c.isPaused&&(c.isPaused=!0,c.pauseStart= -(new Date).getTime()):"RESET"==b&&c.isInit&&(c.setValue(0),c.start=(new Date).getTime(),c.pausedTime=0,delete c.pauseStart);return a.callReturn()},syntax:{js:[],py:["Entry.timer(%2)"]}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay",isNotFor:[],func:function(b,a){if(a.isStart){if(1== +dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){b=a.getField("ACTION");var c=Entry.engine,d=c.projectTimer;"START"==b?d.isInit?d.isInit&&d.isPaused&&(d.pauseStart&&(d.pausedTime+=(new Date).getTime()-d.pauseStart),delete d.pauseStart,d.isPaused=!1):c.startProjectTimer():"STOP"==b?d.isInit&&!d.isPaused&&(d.isPaused=!0,d.pauseStart= +(new Date).getTime()):"RESET"==b&&d.isInit&&(d.setValue(0),d.start=(new Date).getTime(),d.pausedTime=0,delete d.pauseStart);return a.callReturn()},syntax:{js:[],py:["Entry.timer(%2)"]}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay",isNotFor:[],func:function(b,a){if(a.isStart){if(1== a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*b*1E3);return a},syntax:{js:[],py:["Entry.wait_for_seconds(%1)"]}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]}, null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){if(!a.isLooped){a.isLooped=!0;b=a.getNumberValue("VALUE",a);if(0>b)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(b)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)},syntax:{js:[],py:["for i in range(%1):\n$1"]}},repeat_inf:{color:"#498deb",skeleton:"basic_loop", statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")},syntax:{js:[],py:["while True:\n$1"]}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b, a){return this.executor.breakLoop()},syntax:{js:[],py:["break"]}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a},syntax:{js:[],py:["Entry.wait_until(%1)"]}},_if:{color:"#498deb",skeleton:"basic_loop", statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()},syntax:{js:[],py:["if %1:\n$1"]}},if_else:{color:"#498deb",skeleton:"basic_double_loop", statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();b=a.getBooleanValue("BOOL",a);a.isCondition=!0;return b?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE", -a)},syntax:{js:[],py:["if %1:\n$1\nelse:\n$2"]}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);a=a.callReturn();"self"==d?b.parent.addCloneEntity(b.parent,b,null): -Entry.container.getObject(d).addCloneEntity(b.parent,null,null);return a},syntax:{js:[],py:["Entry.create_clone(%1)"]}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()},syntax:{js:[],py:["Entry.remove_clone()"]}},when_clone_start:{color:"#498deb", +a)},syntax:{js:[],py:["if %1:\n$1\nelse:\n$2"]}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);a=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null): +Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return a},syntax:{js:[],py:["Entry.create_clone(%1)"]}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()},syntax:{js:[],py:["Entry.remove_clone()"]}},when_clone_start:{color:"#498deb", skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start",syntax:{js:[],py:["def entry_event_clone_create():"]}},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b, a){return Entry.engine.toggleStop()},syntax:{js:[],py:[""]}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"}, paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){b=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(b=!b);return(a.isLooped=b)?a.getStatement("DO",a):a.callReturn()},syntax:{js:[],py:["not yet supported in textcoding"]}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread, -"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var d=a.getField("TARGET",a),c=Entry.container;switch(d){case "all":return c.mapObject(function(a){a.script.clearExecutors()},null),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":d=this.executor;b=b.parent.script;for(var c=b.executors,e=0;ea.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,b.leftWheel=45+.25*d,b.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;b.leftWheel=45+.25*d;b.rightWheel=45-.25*d;a.boardState=3;var c=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(c)},250);Entry.Hamster.timeouts.push(c);break;case 3:d= -d.leftFloor-d.rightFloor;b.leftWheel=45+.25*d;b.rightWheel=45-.25*d;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a},syntax:{js:[],py:["Hamster.move_forward()"]}},hamster_turn_once:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2> -a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState= -3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,b.leftWheel=45+.25*c,b.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;a.boardState=3;var d=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c= +c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a},syntax:{js:[],py:["Hamster.move_forward()"]}},hamster_turn_once:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2> +a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.rightFloor&&(a.boardState= +3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.add_tempo(%1)"]}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b, a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.set_tempo(%1)"]}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output, -"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("PORT",a),c=Number(a.getField("MODE",a));"A"==d?b.ioModeA=c:("B"!=d&&(b.ioModeA=c),b.ioModeB=c);return a.callReturn()},syntax:{js:[],py:["Hamster.set_port(%1, %2)"]}}, +"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT",a),d=Number(a.getField("MODE",a));"A"==c?b.ioModeA=d:("B"!=c&&(b.ioModeA=d),b.ioModeB=d);return a.callReturn()},syntax:{js:[],py:["Hamster.set_port(%1, %2)"]}}, hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b, -a){b=Entry.hw.sendQueue;var d=a.getField("PORT"),c=a.getNumberValue("VALUE");"A"==d?b.outputA=void 0!=b.outputA?b.outputA+c:c:("B"!=d&&(b.outputA=void 0!=b.outputA?b.outputA+c:c),b.outputB=void 0!=b.outputB?b.outputB+c:c);return a.callReturn()},syntax:{js:[],py:["Hamster.add_output(%1, %2)"]}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]], -value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var d=a.getField("PORT"),c=a.getNumberValue("VALUE");"A"==d?b.outputA=c:("B"!=d&&(b.outputA=c),b.outputB=c);return a.callReturn()},syntax:{js:[],py:["Hamster.set_output(%1, %2)"]}}, +a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=void 0!=b.outputA?b.outputA+d:d:("B"!=c&&(b.outputA=void 0!=b.outputA?b.outputA+d:d),b.outputB=void 0!=b.outputB?b.outputB+d:d);return a.callReturn()},syntax:{js:[],py:["Hamster.add_output(%1, %2)"]}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]], +value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=d:("B"!=c&&(b.outputA=d),b.outputB=d);return a.callReturn()},syntax:{js:[],py:["Hamster.set_output(%1, %2)"]}}, is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"},"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick},syntax:{js:[],py:["Entry.is_mouse_clicked()"]}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2, color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){b=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(b)},syntax:{js:[],py:["Entry.is_pressed(%1)"]}},reach_something:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var d=a.getField("VALUE",a);a=b.object;var c=/wall/.test(d),e=ndgmr.checkPixelCollision;if(c)switch(b=Entry.stage.wall,d){case "wall":return!!(e(a,b.up,.2,!0)||e(a,b.down,.2,!0)||e(a,b.left,.2,!0)||e(a,b.right, -.2,!0));case "wall_up":return!!e(a,b.up,.2,!0);case "wall_down":return!!e(a,b.down,.2,!0);case "wall_right":return!!e(a,b.right,.2,!0);case "wall_left":return!!e(a,b.left,.2,!0)}else{if("mouse"==d)return e=Entry.stage.canvas,e=a.globalToLocal(e.mouseX,e.mouseY),a.hitTest(e.x,e.y);d=Entry.container.getEntity(d);if("textBox"==d.type||"textBox"==b.type){e=d.object.getTransformedBounds();a=a.getTransformedBounds();if(Entry.checkCollisionRect(a,e))return!0;b=d.parent.clonedEntities;d=0;for(c=b.length;d< -c;d++){var f=b[d];if(!f.isStamp&&f.getVisible()&&Entry.checkCollisionRect(a,f.object.getTransformedBounds()))return!0}}else{if(d.getVisible()&&e(a,d.object,.2,!0))return!0;b=d.parent.clonedEntities;d=0;for(c=b.length;d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){b=a.getField("OPERATOR",a);var d=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?d==a:"BIGGER"==b?d>a:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?c==a:"BIGGER"==b?c>a:c", color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b>a},syntax:{js:[],py:[""]}},boolean_smaller:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"}, {type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text", params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text", -params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getField("OPERATOR",a);var d=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return d==a;case "GREATER":return Number(d)>Number(a);case "LESS":return Number(d)=Number(a);case "LESS_OR_EQUAL":return Number(d)<= +params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getField("OPERATOR",a);var c=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return c==a;case "GREATER":return Number(c)>Number(a);case "LESS":return Number(c)=Number(a);case "LESS_OR_EQUAL":return Number(c)<= Number(a)}},syntax:{js:[],py:["(%1 %2boolean_compare# %3)"]}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show()"]}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"}, "class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()},syntax:{js:[],py:["Entry.hide()"]}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]}, -{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var d=a.getNumberValue("SECOND",a),c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;c||"number"==typeof c||(c=" ");c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*d)}if(0==a.timeFlag)return delete a.timeFlag, -delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),c||"number"==typeof c||(c=" "),c=Entry.convertToRoundedDecimals(c,3),new Entry.Dialog(b,c,e),b.syncDialogVisible(b.getVisible()));return a},syntax:{js:[],py:["Entry.print_for_seconds(%1, %2, %3)"]}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var d=a.getStringValue("VALUE",a);d||"number"==typeof d||(d=" ");var c=a.getField("OPTION",a),d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,c);b.syncDialogVisible(b.getVisible());return a.callReturn()},syntax:{js:[], +{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}if(0==a.timeFlag)return delete a.timeFlag, +delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(b,d,e),b.syncDialogVisible(b.getVisible()));return a},syntax:{js:[],py:["Entry.print_for_seconds(%1, %2, %3)"]}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()},syntax:{js:[], py:["Entry.print(%1)"]}},remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()},syntax:{js:[],py:["Entry.print_remove()"]}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator", -img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),d=b.parent.getPicture(d);b.setImage(d);return a.callReturn()},syntax:{js:[],py:[""]}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var d;d="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_shape_of(%1)"]}},set_effect_volume:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a); -"color"==d?b.effect.hue=c+b.effect.hue:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c+b.effect.brightness:"blur"!=d&&"opacity"==d&&(b.effect.alpha+=c/100));b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:["Entry.add_effect(%1, %2)"]}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c:"blur"!=d&&"opacity"==d&&(b.effect.alpha=c/100));b.applyFilter(!0); +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()},syntax:{js:[],py:[""]}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_shape_of(%1)"]}},set_effect_volume:{color:"#EC4466",skeleton:"basic", +statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a); +"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:["Entry.add_effect(%1, %2)"]}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter(!0); return a.callReturn()},syntax:{js:[],py:["Entry.set_effect(%1, %2)"]}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()},syntax:{js:[],py:["Entry.clear_effect()"]}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*d);b.setScaleY(b.getScaleY()*d);return a.callReturn()},syntax:{js:[],py:[""]}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a)/100,c=b.snapshot_;b.setScaleX(d*c.scaleX);b.setScaleY(d*c.scaleY);return a.callReturn()},syntax:{js:[],py:[""]}},change_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+d);return a.callReturn()},syntax:{js:[],py:["Entry.add_size(%1)"]}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0}, -"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_size(%1)"]}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()},syntax:{js:[],py:["Entry.flip_vertical()"]}},flip_x:{color:"#EC4466",skeleton:"basic", +{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()},syntax:{js:[],py:[""]}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()},syntax:{js:[],py:[""]}},change_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()},syntax:{js:[],py:["Entry.add_size(%1)"]}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0}, +"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_size(%1)"]}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()},syntax:{js:[],py:["Entry.flip_vertical()"]}},flip_x:{color:"#EC4466",skeleton:"basic", statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()},syntax:{js:[],py:["Entry.flip_horizontal()"]}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"set_object_order"},paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);b=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1b)throw Error("object is not available for current scene");switch(c){case "FRONT":d= -0;break;case "FORWARD":d=Math.max(0,b-1);break;case "BACKWARD":d=Math.min(e,b+1);break;case "BACK":d=e}Entry.container.moveElementByBlock(b,d);return a.callReturn()},syntax:{js:[],py:["Entry.set_layer(%1)"]}},move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[], -func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move(%1)"]}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_x(%1)"]}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null], -type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(b.getY()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_y(%1)"]}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function d(){var d=a.x-b.getX(),c=a.y-b.getY(),d=d/a.frameCount,c=c/a.frameCount;b.setX(b.getX()+d);b.setY(b.getY()+c);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount= -Math.max(Math.floor(c*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"}, -paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+d);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0}, -"class":"ebs",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(d));return a.callReturn()},syntax:{js:[],py:[""]}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d); -return a.callReturn()},syntax:{js:[],py:[""]}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var d=a.getField("VALUE",a),c=Entry.container.getEntity(d),d=c.getX()-b.getX(),c=c.getY()-b.getY();0<=d?b.setRotation(Math.atan(c/d)/Math.PI*180+90):b.setRotation(Math.atan(c/d)/Math.PI* -180+270);return a.callReturn()},syntax:{js:[],py:[""]}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE1",a),c=a.getNumberValue("VALUE2",a); -b.setX(d);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_xy(%1, %2)"]}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(d); -b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_x(%1)"]}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(d);b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_y(%1)"]}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),c;"mouse"== -d?(d=Entry.stage.mouseCoordinate.x,c=Entry.stage.mouseCoordinate.y):(c=Entry.container.getEntity(d),d=c.getX(),c=c.getY());b.setX(Number(d));b.setY(Number(c));b.brush&&!b.brush.stop&&b.brush.lineTo(d,-1*c);return a.callReturn()},syntax:{js:[],py:["Entry.set_location(%1)"]}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function d(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount= -Math.max(Math.floor(c*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"}, -paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:[""]}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var d=b.parent.getRotateMethod(),c="free"==d?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>c&&0<=c||360>c&&270<=c){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+ -180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>c&&90<=c&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision= -Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360> -c&&180<=c?(e=b.collision==Entry.Utils.COLLISION.LEFT,c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"== -d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>c&&0<=c&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT, -c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()},syntax:{js:[],py:["Entry.bounce_wall()"]}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]}, +a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"brightness"==c?b.effect.brightness=d:"transparency"==c&&(b.effect.alpha=1-d/100);b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:[""]}},change_object_index:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_object_index_sub_1,"FRONT"],[Lang.Blocks.LOOKS_change_object_index_sub_2,"FORWARD"],[Lang.Blocks.LOOKS_change_object_index_sub_3,"BACKWARD"], +[Lang.Blocks.LOOKS_change_object_index_sub_4,"BACK"]],value:"FRONT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_object_index"},paramsKeyMap:{LOCATION:0},"class":"z-index",isNotFor:[],func:function(b,a){var c,d=a.getField("LOCATION",a),e=Entry.container.getCurrentObjects();b=e.indexOf(b.parent);e=e.length-1;if(0>b)throw Error("object is not available for current scene");switch(d){case "FRONT":c= +0;break;case "FORWARD":c=Math.max(0,b-1);break;case "BACKWARD":c=Math.min(e,b+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(b,c);return a.callReturn()},syntax:{js:[],py:["Entry.set_layer(%1)"]}},move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[], +func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move(%1)"]}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_x(%1)"]}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null], +type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_y(%1)"]}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, +def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount= +Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"}, +paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0}, +"class":"ebs",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()},syntax:{js:[],py:[""]}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c); +return a.callReturn()},syntax:{js:[],py:[""]}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI* +180+270);return a.callReturn()},syntax:{js:[],py:[""]}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a); +b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_xy(%1, %2)"]}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c); +b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_x(%1)"]}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&& +b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_y(%1)"]}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func: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(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()},syntax:{js:[],py:["Entry.set_location(%1)"]}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, +def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount= +Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"}, +paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:[""]}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+ +180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision= +Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360> +d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"== +c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()},syntax:{js:[],py:["Entry.bounce_wall()"]}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]}, func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()},syntax:{js:[],py:[""]}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()},syntax:{js:[],py:[""]}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),c=b.getX(),e=b.getY();if(b.parent.id==d)return a.callReturn();"mouse"==d?(d=Entry.stage.mouseCoordinate.y,c=Entry.stage.mouseCoordinate.x-c,e=d-e):(d=Entry.container.getEntity(d),c=d.getX()-c,e=d.getY()-e);e=0===c&&0===e? -b.getDirection()+b.getRotation():0<=c?-Math.atan(e/c)/Math.PI*180+90:-Math.atan(e/c)/Math.PI*180+270;c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-c);return a.callReturn()},syntax:{js:[],py:["Entry.look_at_object(%1)"]}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a),c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+d-c);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b, -a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()},syntax:{js:[],py:[""]}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0, -TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var d,c,e;c=a.getField("TARGET",a);d=a.getNumberValue("VALUE",a);d=Math.floor(d*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=d)"mouse"==c?(c=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(c),c=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=d,a.dX=c/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==c?(c=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(c),c=e.getX(),e=e.getY()),b.setX(c), +fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e? +b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()},syntax:{js:[],py:["Entry.look_at_object(%1)"]}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, +"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b, +a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()},syntax:{js:[],py:[""]}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0, +TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;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=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)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_location_for_seconds(%1, %2)"]}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_rotation(%1)"]}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"}, -paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d+b.getRotation());return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation(%1)"]}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[], -func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_direction(%1)"]}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection()); -return a.callReturn()},syntax:{js:[],py:["Entry.add_direction(%1)"]}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a),c=a.getNumberValue("ANGLE", -a);b.setX(b.getX()+d*Math.cos((c-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((c-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_degree(%1, %2)"]}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"}, -paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function d(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(c*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation_for_seconds(%1, %2)"]}},direction_relative_duration:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function d(){b.setDirection(b.getDirection()+a.dDirection);a.frameCount--}if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(c*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()},syntax:{js:[],py:["Entry.add_direction_for_seconds(%1, %2)"]}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"], +size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_rotation(%1)"]}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"}, +paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation(%1)"]}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[], +func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_direction(%1)"]}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection()); +return a.callReturn()},syntax:{js:[],py:["Entry.add_direction(%1)"]}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE", +a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_degree(%1, %2)"]}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"}, +paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation_for_seconds(%1, %2)"]}},direction_relative_duration:{color:"#A751E3", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT", +a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()},syntax:{js:[],py:["Entry.add_direction_for_seconds(%1, %2)"]}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"], ["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b]},syntax:{js:[],py:["Neobot.sensor_value(%1)"]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){b=a.getStringField("PORT");b=Entry.hw.portData[b];var d=a.getNumberValue("OMIN",a),c=a.getNumberValue("OMAX",a),e=a.getNumberValue("MIN",a);a=a.getNumberValue("MAX",a);if(d>c)var f=d,d=c,c=f;e>a&&(f=e,e=a,a=f);b=Math.min(a,(a-e)/(c-d)*(b-d)+e);b=Math.max(e,b);return Math.round(b)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", +paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){b=a.getStringField("PORT");b=Entry.hw.portData[b];var c=a.getNumberValue("OMIN",a),d=a.getNumberValue("OMAX",a),e=a.getNumberValue("MIN",a);a=a.getNumberValue("MAX",a);if(c>d)var f=c,c=d,d=f;e>a&&(f=e,e=a,a=f);b=Math.min(a,(a-e)/(d-c)*(b-c)+e);b=Math.max(e,b);return Math.round(b)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+d;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_left(%1, %2)"]}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], +null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_left(%1, %2)"]}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()},syntax:{js:[],py:["Neobot.stop_left()"]}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown", -options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var d= -a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+d;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_right(%1, %2)"]}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}, +options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var c= +a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_right(%1, %2)"]}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}, syntax:{js:[],py:["Neobot.stop_right()"]}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30", "6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"}, -paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}b=a.getNumberField("SPEED");var d=a.getNumberField("DIRECTION"),c=a.getNumberValue("DURATION");0>c&&(c=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=16+b;break;case 2:Entry.hw.sendQueue.DCL=32+b; -Entry.hw.sendQueue.DCR=32+b;break;case 3:Entry.hw.sendQueue.DCL=32+b;Entry.hw.sendQueue.DCR=16+b;break;case 4:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=32+b;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+b;break;case 6:Entry.hw.sendQueue.DCL=16+b,Entry.hw.sendQueue.DCR=0}if(0===c)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*c);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1", +paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION"),d=a.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=16+b;break;case 2:Entry.hw.sendQueue.DCL=32+b; +Entry.hw.sendQueue.DCR=32+b;break;case 3:Entry.hw.sendQueue.DCL=32+b;Entry.hw.sendQueue.DCR=16+b;break;case 4:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=32+b;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+b;break;case 6:Entry.hw.sendQueue.DCL=16+b,Entry.hw.sendQueue.DCR=0}if(0===d)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*d);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1", params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return a.callReturn()},syntax:{js:[],py:["Neobot.run_motor(%1, %2, %3, %4)"]}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1", -"1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("PORT");var d=a.getNumberValue("DEGREE");0>d?d=0:180c?c=0:180d?d=0:255c?c=0:255b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address= +func:function(b,a){b=a.executor.scope;if(!b.isStart){b.isStart=!0;b.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=a.getStringField("SIZE");"BYTE"==e?d=1:"WORD"==e?d=2:"DWORD"==e&&(d=4);a=a.getNumberValue("VALUE");Entry.Robotis_carCont.setRobotisData([[c,a,d,0,d]]);Entry.Robotis_carCont.update();b.data_default_address=a;throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address= void 0;return a},syntax:{js:[],py:["Robotis.opencm70_cm_custom_value(%1, %2)"]}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"}, -paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.executor.scope;if(!b.isStart){b.isStart=!0;b.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,c=0,e=0,f=0,g=0;a=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==a&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -f+=0*g;Entry.Robotis_carCont.setRobotisData([[d,c,e,0,g]]);Entry.Robotis_carCont.update();b.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return a},syntax:{js:[],py:["Robotis.opencm70_sensor_value(%1)"]}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3", +paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.executor.scope;if(!b.isStart){b.isStart=!0;b.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0;a=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): +"CM_SOUND_DETECTING"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==a&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); +f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();b.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return a},syntax:{js:[],py:["Robotis.opencm70_sensor_value(%1)"]}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3", "PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"], [Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.executor.scope; -if(!b.isStart){b.isStart=!0;b.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,c=0,e=0,f=0,g=a.getStringField("PORT");a=a.getStringField("SENSOR");var h=0;"PORT_3"==g?h=2:"PORT_4"==g?h=3:"PORT_5"==g?h=4:"PORT_6"==g&&(h=5);"AUX_SERVO_POSITION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], -c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], -c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]): -"AUX_ULTRASONIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], -c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==a&&(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],c=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);e+=h*f;Entry.Robotis_carCont.setRobotisData([[d,e,c,0,f]]);Entry.Robotis_carCont.update(); -b.data_default_address=e;console.log(e);throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;d=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return d},syntax:{js:[],py:["Robotis.opencm70_aux_sensor_value(%1, %2)"]}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"], +if(!b.isStart){b.isStart=!0;b.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=a.getStringField("PORT");a=a.getStringField("SENSOR");var h=0;"PORT_3"==g?h=2:"PORT_4"==g?h=3:"PORT_5"==g?h=4:"PORT_6"==g&&(h=5);"AUX_SERVO_POSITION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]): +"AUX_ULTRASONIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==a&&(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);e+=h*f;Entry.Robotis_carCont.setRobotisData([[c,e,d,0,f]]);Entry.Robotis_carCont.update(); +b.data_default_address=e;console.log(e);throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;c=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return c},syntax:{js:[],py:["Robotis.opencm70_aux_sensor_value(%1, %2)"]}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"], [Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"], [Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+ "(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+ "#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b= -a.getField("CM_BUZZER_INDEX",a);var d=a.getNumberValue("CM_BUZZER_TIME",a),c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*d);50d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_servo_position(%1, %2)"]}},robotis_openCM70_aux_led_module:{color:"#00979D", +isNotFor:["robotis_openCM70"],func:function(b,a){b=a.getField("PORT",a);var c=a.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_servo_position(%1, %2)"]}},robotis_openCM70_aux_led_module:{color:"#00979D", skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+ -Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.getField("PORT",a);var d=a.getField("LED_MODULE",a),c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; -return Entry.Robotis_carCont.postCallReturn(a,[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_led_module(%1, %2)"]}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.getField("PORT",a);var d=a.getNumberValue("VALUE"),c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a, -[[c,e+(b-1)*f,f,d]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_custom(%1, %2)"]}},robotis_openCM70_cm_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom", -isNotFor:["robotis_openCM70"],func:function(b,a){b=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var d,c;d=a.getNumberValue("ADDRESS");c=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[b,d,65535b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()},syntax:{js:[],py:["Entry.add_volume(%1)"]}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"}, paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){b=a.getNumberValue("VALUE",a)/100;1b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()},syntax:{js:[],py:["Entry.set_volume(%1)"]}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}, syntax:{js:[],py:["Entry.stop_sound()"]}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")},syntax:{js:[],py:["%1get_sounds#"]}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var d=a.getStringValue("VALUE",a);(b=b.parent.getSound(d))&&createjs.Sound.play(b.id);return a.callReturn()},syntax:{js:[],py:["Entry.play_sound(%1)"]}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(b,a){var d=a.getStringValue("VALUE",a),c=a.getNumberValue("SECOND",a);(b=b.parent.getSound(d))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*c});return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_for_seconds(%1, %2)"]}}, -sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b= -b.parent.getSound(d))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a},syntax:{js:[],py:["Entry.play_sound_and_wait(%1)"]}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"}, -paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var c=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){c.stop();a.playState=0},1E3*b);c.addEventListener("complete",function(a){})}return a},syntax:{js:[],py:["Entry.play_sound_for_seconds_and_wait(%1, %2)"]}}, -sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var d= -1E3*a.getNumberValue("START",a),c=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(d,c),duration:Math.max(d,c)-Math.min(d,c)})}return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_from_to_seconds(%1, %2, %3)"]}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(b=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),d=Math.min(c,e),c=Math.max(c,e)-d;createjs.Sound.play(b.id,{startTime:d, -duration:c});setTimeout(function(){a.playState=0},c)}return a},syntax:{js:[],py:["Entry.play_sound_from_to_seconds_and_wait(%1, %2, %3)"]}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start",syntax:{js:[],py:["def entry_event_start():"]}},press_some_key:{color:"#3BBD70", +{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id);return a.callReturn()},syntax:{js:[],py:["Entry.play_sound(%1)"]}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block", +accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*d});return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_for_seconds(%1, %2)"]}}, +sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b= +b.parent.getSound(c))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a},syntax:{js:[],py:["Entry.play_sound_and_wait(%1)"]}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"}, +paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*b);d.addEventListener("complete",function(a){})}return a},syntax:{js:[],py:["Entry.play_sound_for_seconds_and_wait(%1, %2)"]}}, +sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var c= +1E3*a.getNumberValue("START",a),d=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_from_to_seconds(%1, %2, %3)"]}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, +{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(b.id,{startTime:c, +duration:d});setTimeout(function(){a.playState=0},d)}return a},syntax:{js:[],py:["Entry.play_sound_from_to_seconds_and_wait(%1, %2, %3)"]}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start",syntax:{js:[],py:["def entry_event_start():"]}},press_some_key:{color:"#3BBD70", skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator", img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1},func:function(b,a){return a.callReturn()},syntax:{js:[],py:[""]}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b, a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["def entry_event_key(%2):"]}},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked",syntax:{js:[],py:["def entry_event_mouse_down():"]}},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event", @@ -2300,35 +2306,35 @@ type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return syntax:{js:[],py:["def entry_event_object_up():"]}},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["Entry.on_key_press_down(%1)"]}},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17, position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b,a){return a.callReturn()},event:"when_message_cast",syntax:{js:[], py:["def entry_event_signal(%2):"]}},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"},paramsKeyMap:{VALUE:0}, -"class":"message",isNotFor:["message"],func:function(b,a){b=a.getField("VALUE",a);var d=Entry.isExist(b,"id",Entry.variableContainer.messages_);if("null"==b||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",b]);return a.callReturn()},syntax:{js:[],py:["Entry.send_signal(%1)"]}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){b=a.runningScript;for(var d=b.length,c=0;cb.array_.length)throw Error("can not remove value from array");b.array_.splice(c-1,1);b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.pop(%1)"]}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);if(!b.array_||isNaN(e)||0== -e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:c});b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.insert(%3, %1)"]}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);if(!b.array_||isNaN(e)|| -e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=c;b.updateView();return a.callReturn()},syntax:{js:[],py:["%1[%2] = %3"]}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2, +paramsKeyMap:{VALUE:0,LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a);b=Entry.variableContainer.getList(c,b);b.array_||(b.array_=[]);b.array_.push({data:d});b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.append(%1)"]}},remove_value_from_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, +{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"number",params:["1"]},null,null],type:"remove_value_from_list"},paramsKeyMap:{VALUE:0,LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a);b=Entry.variableContainer.getList(c, +b);if(!b.array_||isNaN(d)||d>b.array_.length)throw Error("can not remove value from array");b.array_.splice(d-1,1);b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.pop(%1)"]}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= +Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||0== +e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:d});b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.insert(%3, %1)"]}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= +Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)|| +e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=d;b.updateView();return a.callReturn()},syntax:{js:[],py:["%1[%2] = %3"]}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2, color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b, -a){var d=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(d,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data},syntax:{js:[],py:["%2[%4]"]}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, +a){var c=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data},syntax:{js:[],py:["%2[%4]"]}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, {type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){a=a.getField("LIST",a);return Entry.variableContainer.getList(a,b).array_.length},syntax:{js:[],py:["len(%2)"]}}, show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility", isNotFor:["list","listNotExist"],func:function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show_list(%1)"]}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", @@ -2336,55 +2342,55 @@ b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_var "FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)},syntax:{js:[],py:[""]}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.answer_mode(%1)"]}}, is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer; -a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a);a=a.getStringValue("DATA",a);b=Entry.variableContainer.getList(d,b);if(!b)return!1;b=b.array_;for(var d=0,c=b.length;dh&&(h=Math.round(h-155),f=-h,g=0,Entry.dplay.vel_value=f);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5, -0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(d,g),Entry.hw.setDigitalPortValue(c,f),Entry.hw.setDigitalPortValue(e,g),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var k=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(k)},50);Entry.dplay.timeouts.push(k);return a}},syntax:{js:[],py:["Dplay.dc_motor_speed(%1, %2)"]}}, +VALUE:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var c=b=0,d=0,e=0,f=0,g=0,h=0,h=a.getField("PORT");"1"==h?(b=3,c=5):"2"==h?(b=11,c=6):"3"==h&&(b=3,c=5,d=11,e=6);h=a.getNumberValue("VALUE",a);h=Math.max(h,-100);h=Math.min(h,100);0==h?(g=f=0,Entry.dplay.vel_value=g):0h&&(h=Math.round(h-155),f=-h,g=0,Entry.dplay.vel_value=f);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5, +0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,f),Entry.hw.setDigitalPortValue(e,g),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var k=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(k)},50);Entry.dplay.timeouts.push(k);return a}},syntax:{js:[],py:["Dplay.dc_motor_speed(%1, %2)"]}}, dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30",params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown", options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= -!1;return a.callReturn()}b=a.getNumberField("NOTE",a);var d=a.getNumberField("OCTAVE",a),c=a.getNumberValue("VALUE"),d=b+12*(d-1),c=6E4*c/60;a.isStart=!0;a.timeFlag=1;100==b?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100n?(l=Math.round(n-155),f=-l,g=0,Entry.dplay.Left_value=f):0==n&&(g=f=0,Entry.dplay.Left_value=0));"2"==m&&(c=6,e=11,0n?(l=Math.round(n-155),h=-l,k=0,Entry.dplay.Right_value=h):0==n&&(k=h=0,Entry.dplay.Right_value=h));"3"==m&&(b=3,d=5,c=6,e=11,0n?(l=Math.round(n-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==n&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(d,g),Entry.hw.setDigitalPortValue(c,k),Entry.hw.setDigitalPortValue(e, +params:["1"]},null,null],type:"dplay_Robot_run_sec"},paramsKeyMap:{VALUE:0,PORT:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=b=0,d=0,e=0,f=Entry.dplay.Left_value,g=Entry.dplay.Right_value,h=a.getField("PORT");if(a.isStart){if(1==a.timeFlag)return"1"==h?(b=0,c=f,d=g,e=0):"2"==h?(b=f,d=c=0,e=g):"3"==h?(b=0,c=f,e=d=0):"4"==h&&(c=b=0,d=g,e=0),Entry.hw.setDigitalPortValue(3,b),Entry.hw.setDigitalPortValue(5,c),Entry.hw.setDigitalPortValue(6,d),Entry.hw.setDigitalPortValue(11,e), +a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;e=d=c=b=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b=1E3*a.getNumberValue("VALUE");var k=setTimeout(function(){a.timeFlag=0;Entry.dplay.removeTimeout(k)},b);Entry.dplay.timeouts.push(k);return a},syntax:{js:[],py:["Dplay.robot_run_sec(%1, %2)"]}},dplay_robot_speed_sel:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 \ubc14\ud034 \uc18d\ub3c4\ub97c %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Dropdown", +options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=b=0,d=0,e=0,f=0,g=0,h=0,k=0,l=0,m=a.getField("PORT"),n=a.getNumberValue("VALUE", +a),n=Math.max(n,-100),n=Math.min(n,100);"1"==m&&(b=3,c=5,0n?(l=Math.round(n-155),f=-l,g=0,Entry.dplay.Left_value=f):0==n&&(g=f=0,Entry.dplay.Left_value=0));"2"==m&&(d=6,e=11,0n?(l=Math.round(n-155),h=-l,k=0,Entry.dplay.Right_value=h):0==n&&(k=h=0,Entry.dplay.Right_value=h));"3"==m&&(b=3,c=5,d=6,e=11,0n?(l=Math.round(n-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==n&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,k),Entry.hw.setDigitalPortValue(e, h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var q=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(q)},50);Entry.dplay.timeouts.push(q);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var d=b=0,c=0,e=0,f=0,f=0,f=a.getNumberValue("L_VALUE",a),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),b=-f,d=0,Entry.dplay.Left_value=b):0==f&&(d=b=0,Entry.dplay.Left_value= -0);f=a.getNumberValue("R_VALUE",a);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),c=-f,e=0,Entry.dplay.Right_value=c):0==f&&(e=c=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,b),Entry.hw.setDigitalPortValue(5,d), -Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,c),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var g=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return a}},syntax:{js:[],py:["Dplay.robot_speed_sel(%1, %2)"]}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator", +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=b=0,d=0,e=0,f=0,f=0,f=a.getNumberValue("L_VALUE",a),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),b=-f,c=0,Entry.dplay.Left_value=b):0==f&&(c=b=0,Entry.dplay.Left_value= +0);f=a.getNumberValue("R_VALUE",a);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),d=-f,e=0,Entry.dplay.Right_value=d):0==f&&(e=d=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,b),Entry.hw.setDigitalPortValue(5,c), +Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,d),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var g=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return a}},syntax:{js:[],py:["Dplay.robot_speed_sel(%1, %2)"]}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()},syntax:{js:[],py:["Dplay.robot_stop()"]}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], type:"nemoino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["Nemoino.sensor_value(%1)"]}},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value",syntax:{js:[],py:["Nemoino.digital_value(%1)"]}},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"}, "class":"arduino_set",syntax:{js:[],py:["Nemoino.toggle_led(%1)"]}},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set",syntax:{js:[],py:["Nemoino.toggle_pwm(%1, %2)"]}},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, @@ -2433,57 +2439,57 @@ isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",para joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, "wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}},ai_move_right:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","move"],params:[{type:"Image",img:"/img/assets/week/blocks/moveStep.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return Entry.STATIC.BREAK;delete a.isAction;delete a.isStart}else{a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id, -Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.EAST;var d=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO,animateValue:0});d.x++;return Entry.STATIC.BREAK}}},ai_move_up:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","up"],params:[{type:"Image",img:"/img/assets/week/blocks/ai_move_up.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return a;delete a.isAction;delete a.isStart; -return a.callReturn()}a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id,Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.NORTH;var d=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO,animateValue:-45});d.x++;d.y--;return a}},ai_move_down:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","down"],params:[{type:"Image", -img:"/img/assets/week/blocks/ai_move_down.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return a;delete a.isAction;delete a.isStart;return a.callReturn()}a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id,Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.SOUTH;var d=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO, -animateValue:45});d.x++;d.y++;return a}},ai_repeat_until_reach:{skeleton:"basic_loop",mode:"maze",color:"#498DEB",syntax:["BasicWhile","true"],statements:[{accept:"basic"}],params:[{type:"Image",img:"/img/assets/week/blocks/for.png",size:24}],func:function(){var b=this.block.statements[0];if(0!==b.getBlocks().length)return this.executor.stepInto(b)}},ai_if_else_1:{skeleton:"basic_double_loop",mode:"maze",color:"#498DEB",syntax:["BasicIf","front == 'stone'"],statements:[{accept:"basic"},{accept:"basic"}], -params:[{type:"Image",img:"/img/assets/ntry/bitmap/ai/obstacle_1.png",size:24},{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"LineBreak"}],func:function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR);var d=this.block.statements,c=1;a.isLooped=!0;b.center.type==Ntry.STATIC.AI_METEO&&1==b.center.distance&&(c=0);this.executor.stepInto(d[c]);return Entry.STATIC.BREAK}},ai_boolean_distance:{skeleton:"basic_boolean_field", -mode:"maze",color:"#2fc9f0",fontColor:"#fff",syntax:["Scope","radar_%1 %2 %3#"],params:[{type:"Dropdown",options:[[Lang.Menus.ai_above,"UP"],[Lang.Menus.ai_front,"RIGHT"],[Lang.Menus.ai_under,"DOWN"]],value:"RIGHT",fontSize:11},{type:"Dropdown",options:[[">","BIGGER"],[">=","BIGGER_EQUAL"],["=","EQUAL"],["<","SMALLER"],["<=","SMALLER_EQUAL"]],value:"BIGGER",fontSize:11},{type:"Block",accept:"string"}],func:function(b,a){b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR);var d=this.block.params; -a=d[0];var d=d[1],c=this.getParam(2),e;switch(a){case "UP":e=b.left;break;case "RIGHT":e=b.center;break;case "DOWN":e=b.right}e=e.type==Ntry.STATIC.AI_GOAL?Number.MAX_VALUE:e.distance;switch(d){case "BIGGER":return e>c;case "BIGGER_EQUAL":return e>=c;case "EQUAL":return e==c;case "SMALLER":return e","BIGGER"],[">=","BIGGER_EQUAL"],["=","EQUAL"],["<","SMALLER"],["<=","SMALLER_EQUAL"]],value:"BIGGER",fontSize:11},{type:"Block",accept:"string"}],func:function(b,a){b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR);var c=this.block.params; +a=c[0];var c=c[1],d=this.getParam(2),e;switch(a){case "UP":e=b.left;break;case "RIGHT":e=b.center;break;case "DOWN":e=b.right}e=e.type==Ntry.STATIC.AI_GOAL?Number.MAX_VALUE:e.distance;switch(c){case "BIGGER":return e>d;case "BIGGER_EQUAL":return e>=d;case "EQUAL":return e==d;case "SMALLER":return e=d?d=0:720<=d&&(d=720);var c=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:d,power:"CW"==c?50:-50};return a.callReturn()}},ev3_motor_power:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c \ucd9c\ub825 %3",params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,{type:"number",params:["50"]}],type:"ev3_motor_power"},paramsKeyMap:{PORT:0,VALUE:1},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);var d=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};return a.callReturn()}},ev3_motor_power_on_time:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \ucd08 \ub3d9\uc548 %3 \uc73c\ub85c \ucd9c\ub825 %4", +options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11},{type:"Dropdown",options:[["RGB","RGB"],["R","R"],["G","G"],["B","B"]],value:"RGB",fontSize:11}],events:{},def:{params:[null,null],type:"ev3_color_sensor"},paramsKeyMap:{PORT:0,RGB:1},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);b=a.getStringField("RGB",a);a=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c="";if(a.type==Entry.EV3.deviceTypes.Color)if(0==a.siValue)c="";else switch(b){case "RGB":c= +Entry.EV3.colorSensorValue[a.siValue];break;case "R":c=Entry.EV3.colorSensorValue[a.siValue].substring(0,2);break;case "G":c=Entry.EV3.colorSensorValue[a.siValue].substring(2,4);break;case "B":c=Entry.EV3.colorSensorValue[a.siValue].substring(4,6)}else c="\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return c}},ev3_get_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc758 \uac12",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4", +"4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_get_sensor_value"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c;$.isPlainObject(b)&&(c=b.siValue||0);return c}},ev3_motor_degrees:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c %3 \ub3c4 \ub9cc\ud07c \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["A", +"A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Dropdown",options:[["\uc2dc\uacc4\ubc29\ud5a5","CW"],["\ubc18\uc2dc\uacc4\ubc29\ud5a5","CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"angle"}],type:"ev3_motor_degrees"},paramsKeyMap:{PORT:0,DIRECTION:1,DEGREE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("DEGREE", +a);0>=c?c=0:720<=c&&(c=720);var d=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==d?50:-50};return a.callReturn()}},ev3_motor_power:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c \ucd9c\ub825 %3",params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,{type:"number",params:["50"]}],type:"ev3_motor_power"},paramsKeyMap:{PORT:0,VALUE:1},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}},ev3_motor_power_on_time:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \ucd08 \ub3d9\uc548 %3 \uc73c\ub85c \ucd9c\ub825 %4", params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["2"]},{type:"number",params:["50"]}],type:"ev3_motor_power_on_time"},paramsKeyMap:{PORT:0,TIME:1,VALUE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a; -delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var d=a.getValue("TIME",a),c=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};var e=setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(e)},1E3*d);Entry.EV3.timeouts.push(e);return a}},ev3_touch_sensor:{color:"#00979D", +delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),d=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};var e=setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(e)},1E3*c);Entry.EV3.timeouts.push(e);return a}},ev3_touch_sensor:{color:"#00979D", fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"%1 \uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_touch_sensor"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));a=!1;b.type==Entry.EV3.deviceTypes.Touch&& 1<=Number(b.siValue)&&(a=!0);return a}},roduino_on_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_on_block"},paramsKeyMap:{},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){return"1"}},roduino_off_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_off_block"}, paramsKeyMap:{},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){return"0"}},roduino_get_analog_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},roduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field", statements:[],params:[{type:"Dropdown",options:[["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"2",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},roduino_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"roduino_get_analog_number"}],type:"roduino_get_analog_value"}, paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=parseInt(a.getValue("VALUE",a));Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.ANALOG_READ,b]);return Entry.hw.getAnalogPortValue(b)}},roduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"roduino_get_port_number"}],type:"roduino_get_digital_value"},paramsKeyMap:{VALUE:0}, "class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_READ,b]);return Entry.hw.portData[b-2]}},roduino_get_color:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_color_red,"red"],[Lang.Blocks.roborobo_color_green,"green"],[Lang.Blocks.roborobo_color_blue,"blue"],[Lang.Blocks.roborobo_color_yellow, -"yellow"]],value:"red",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null],type:"roduino_get_color"},paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=0;a=a.getField("VALUE",a);var d=[Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2]-2]];switch(a){case "red":1==d[0]&&0==d[1]&&0==d[2]&&(b=1);break;case "green":0== -d[0]&&1==d[1]&&0==d[2]&&(b=1);break;case "blue":0==d[0]&&0==d[1]&&1==d[2]&&(b=1);break;case "yellow":1==d[0]&&1==d[1]&&1==d[2]&&(b=1)}return b}},roduino_set_digital:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"roduino_get_port_number"}, -null,null],type:"roduino_set_digital"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);var d=a.getField("OPERATOR");Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE,b,"on"==d?1:0]);return a.callReturn()}},roduino_motor:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]], +"yellow"]],value:"red",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null],type:"roduino_get_color"},paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=0;a=a.getField("VALUE",a);var c=[Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2]-2]];switch(a){case "red":1==c[0]&&0==c[1]&&0==c[2]&&(b=1);break;case "green":0== +c[0]&&1==c[1]&&0==c[2]&&(b=1);break;case "blue":0==c[0]&&0==c[1]&&1==c[2]&&(b=1);break;case "yellow":1==c[0]&&1==c[1]&&1==c[2]&&(b=1)}return b}},roduino_set_digital:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"roduino_get_port_number"}, +null,null],type:"roduino_set_digital"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);var c=a.getField("OPERATOR");Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE,b,"on"==c?1:0]);return a.callReturn()}},roduino_motor:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]], value:"motor1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor_CW,"cw"],[Lang.Blocks.roborobo_motor_CCW,"ccw"],[Lang.Blocks.roborobo_motor_stop,"stop"]],value:"cw",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"roduino_motor"},paramsKeyMap:{MODE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){pin2= -0;var d;value2=0;b=a.getField("MODE");d=a.getField("OPERATOR");"motor1"==b?(b=9,pin2=10):(b=11,pin2=12);"cw"==d?(d=1,value2=0):"ccw"==d?(d=0,value2=1):value2=d=0;Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR,b,d,pin2,value2]);return a.callReturn()}},roduino_set_color_pin:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["3"]},{type:"number",params:["4"]},null],type:"roduino_set_color_pin"},paramsKeyMap:{RED:0,GREEN:1,BLUE:2},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("RED",a);var d=a.getNumberValue("GREEN",a),c=a.getNumberValue("BLUE",a);Entry.Roborobo_Roduino.ColorPin=[b,d,c];Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR,b,d,c]);return a.callReturn()}}, +0;var c;value2=0;b=a.getField("MODE");c=a.getField("OPERATOR");"motor1"==b?(b=9,pin2=10):(b=11,pin2=12);"cw"==c?(c=1,value2=0):"ccw"==c?(c=0,value2=1):value2=c=0;Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR,b,c,pin2,value2]);return a.callReturn()}},roduino_set_color_pin:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["3"]},{type:"number",params:["4"]},null],type:"roduino_set_color_pin"},paramsKeyMap:{RED:0,GREEN:1,BLUE:2},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("RED",a);var c=a.getNumberValue("GREEN",a),d=a.getNumberValue("BLUE",a);Entry.Roborobo_Roduino.ColorPin=[b,c,d];Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR,b,c,d]);return a.callReturn()}}, schoolkit_on_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"schoolkit_on_block"},paramsKeyMap:{},"class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){return"1"}},schoolkit_off_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"schoolkit_off_block"},paramsKeyMap:{}, "class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){return"0"}},schoolkit_get_out_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["OUT1",2],["OUT2",3],["OUT3",4],["OUT4",5],["OUT5",6]],value:2,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getNumberField("PORT")}},schoolkit_get_in_port_number:{color:"#00979D",skeleton:"basic_string_field", statements:[],params:[{type:"Dropdown",options:[["IN1",7],["IN2",8],["IN3",9],["IN4",10],["IN5",11],["IN6",12],["IN7",13]],value:7,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getNumberField("PORT")}},schoolkit_set_output:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},null,null],type:"schoolkit_set_output"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("VALUE",a);var d=a.getField("OPERATOR");Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE,b,"on"==d?1:0]);return a.callReturn()}},schoolkit_get_input_value:{color:"#00979D", +arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},null,null],type:"schoolkit_set_output"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("VALUE",a);var c=a.getField("OPERATOR");Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE,b,"on"==c?1:0]);return a.callReturn()}},schoolkit_get_input_value:{color:"#00979D", fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"schoolkit_get_in_port_number"}],type:"schoolkit_get_input_value"},paramsKeyMap:{VALUE:0},"class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("VALUE",a);Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_READ,b]);return Entry.hw.portData[b-7]}},schoolkit_motor:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]],value:"motor1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor_CW,"cw"],[Lang.Blocks.roborobo_motor_CCW,"ccw"],[Lang.Blocks.roborobo_motor_stop,"stop"]],value:"cw",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,{type:"number",params:["0"]},null,null],type:"schoolkit_motor"},paramsKeyMap:{MODE:0,VALUE:1,OPERATOR:2},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){var d;d=a.getField("MODE");b=a.getField("OPERATOR");var c=a.getNumberValue("VALUE");d="motor1"==d?7:8;255c&&(c=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,d,c]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, -2,d,c]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,d,c]);return a.callReturn()}},schoolkit_set_servo_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},{type:"number",params:["0"]},null],type:"schoolkit_set_servo_value"},paramsKeyMap:{PIN:0,VALUE:1},"class":"schoolkit_set", -isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("PIN",a);var d=a.getNumberValue("VALUE");0>d?d=0:180d&&(d=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,c,d]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, +2,c,d]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,c,d]);return a.callReturn()}},schoolkit_set_servo_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},{type:"number",params:["0"]},null],type:"schoolkit_set_servo_value"},paramsKeyMap:{PIN:0,VALUE:1},"class":"schoolkit_set", +isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("PIN",a);var c=a.getNumberValue("VALUE");0>c?c=0:180b&& -(c=0);255b&&(d=2+d,b*=-1);b=Math.round(b/30);Entry.hw.setDigitalPortValue(14,128+(d<<5)+b);return a.callReturn()}},codestar_light:{color:"#00979D", +params:[{type:"Dropdown",options:[["D3","D3"],["D5","D5"],["D6","D6"],["D9","D9"],["D10","D10"],["D11","D11"]]},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["D3",{type:"number",params:[90]},null],type:"codestar_servo"},paramsKeyMap:{PORT:0,VALUE:1},class:"codestar_motor",isNotFor:["codestar"],func:function(b,a){b=a.getNumberValue("VALUE");var c=Entry.hw.sendQueue;c.outport=a.getField("PORT");c.value=0;if(!isNaN(b)){var d=b;0>b&& +(d=0);255b&&(c=2+c,b*=-1);b=Math.round(b/30);Entry.hw.setDigitalPortValue(14,128+(c<<5)+b);return a.callReturn()}},codestar_light:{color:"#00979D", fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ubc1d\uae30\uc13c\uc11c",params:[],events:{},def:{params:[],type:"codestar_light"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("6")}},codestar_button:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ubc84\ud2bc",params:[],events:{},def:{params:[],type:"codestar_button"},paramsKeyMap:{},class:"codestar_input_sensor", isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("12")}},codestar_ir:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["0"],type:"codestar_ir"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){b=a.getField("PORT");return Entry.hw.getAnalogPortValue(b)}},codestar_sonar:{color:"#00979D", fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ucd08\uc74c\ud30c",params:[],events:{},def:{params:[],type:"codestar_sonar"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.sonar}},codestar_variable_R:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\uac00\ubcc0\uc800\ud56d %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["1"], @@ -2491,212 +2497,212 @@ type:"codestar_variable_R"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor", fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\uc628\ub3c4",params:[],events:{},def:{params:[],type:"codestar_temperature"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.temperature}},codestar_gyroscope:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc790\uc774\ub85c %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator", size:11}],events:{},def:{params:["x",null],type:"codestar_gyroscope"},paramsKeyMap:{AXIS:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("gyro_"+axis)}},codestar_geomagnetic:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc9c0\uc790\uae30 %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator",size:11}],events:{},def:{params:["x",null],type:"codestar_geomagnetic"}, paramsKeyMap:{AXIS:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){b=a.getField("AXIS");return Entry.hw.getAnalogPortValue("geo_"+b)}},codestar_irR:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR \ub9ac\ubaa8\ucf58",params:[],events:{},def:{params:[],type:"codestar_irR"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("4")}},codestar_tilt:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ud2f8\ud2b8",params:[],events:{},def:{params:[],type:"codestar_tilt"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("6")}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var d=function(){};d.prototype=Entry.block[a.parent];var d=new d,c;for(c in a)d[c]=a[c];Entry.block[b]=d}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,d,c){Entry.Model(this,!1);this._align=a||"CENTER";this.setAlign(this._align);this._scroll=void 0!==c?c:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=d;this._generateView(d);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId); -Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);d&&this._generateCategoryCodes(d);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this), +fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ud2f8\ud2b8",params:[],events:{},def:{params:[],type:"codestar_tilt"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("6")}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this.setAlign(this._align);this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId); +Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this), this._addControl(b));Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,c=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){c._scroller&& -c._scroller.setOpacity(1);a=c.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=c.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(c._scroller&&c._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){c.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.workspace.getMode();this.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD? +(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& +d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, +200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.workspace.getMode();this.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD? a.mode&&"code"!==a.mode||this.renderText():"text"===a.mode&&this.renderBlock();this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw(); -a=b.getThreads();for(var b=10,c="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&& +Entry.Code&&(b=this._categoryCodes[a]=new Entry.Code(b)),this.changeCode(b));this.lastSelector=a}else this.align()};b._generateCategoryCodes=function(a){this._categoryCodes={};for(var b=0;bthis._bannedClass.indexOf(a)&& this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){a=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b; -for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var c=a[b];c.constructor==Entry.Code&&c.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a);this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;bb&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b; +for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a);this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var d=e.dragInstance; -e.scroll(a.pageY-d.offsetY);d.set({offsetY:a.pageY})}function c(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",c);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",c);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,d){var c=this;Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];if(void 0===this._schema)this.block.destroy(!1,!1);else{this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var e=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements= -[];this.magnet={};this._paramMap={};e.magnets&&e.magnets(this).next&&(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;this.mouseHandler=function(){var a=c.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(c)});c.onMouseDown.apply(c,arguments)};this._startRender(b,d);this._observers.push(this.block.observe(this,"_setMovable", +function(){var a=this.board,b=a.svgBlockGroup.getBoundingClientRect(),d=a.blockMenuContainer.height(),a=a.offset();this.vRatio=b=(b.height+(b.top-a.top)+10)/d;1>=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var b=e.dragInstance; +e.scroll(a.pageY-b.offsetY);b.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", +b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){var d=this;Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];if(void 0===this._schema)this.block.destroy(!1,!1);else{this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var e=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements= +[];this.magnet={};this._paramMap={};e.magnets&&e.magnets(this).next&&(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;this.mouseHandler=function(){var a=d.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(d)});d.onMouseDown.apply(d,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable", ["movable"]));this._observers.push(this.block.observe(this,"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow", ["shadow"]));this._observers.push(this.observe(this,"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})}};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; (function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var c=this;a=this._skeleton;this.svgGroup.attr({class:"block"});var e=a.classes;e&&0!==e.length&&e.forEach(function(a){c.svgGroup.addClass(a)});e=a.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& ($(this._path).mouseenter(function(a){c._mouseEnable&&c._changeFill(!0)}),$(this._path).mouseleave(function(a){c._mouseEnable&&c._changeFill(!1)}));var f=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(f=Entry.Utils.colorLighten(f));this._fillColor=f;e={d:e,fill:f,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)f=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+f+")"});else if(this.magnet.string||this.magnet.boolean)e.stroke= a.outerLine;a.outerLine&&(e["stroke-width"]="0.6");this._path.attr(e);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var c=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(c),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(),f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,d),a= -!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),d=f.dragInstance,f._moveBy(c.pageX-d.offsetX,c.pageY-d.offsetY,!1),d.set({offsetX:c.pageX,offsetY:c.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function c(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block");f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove(); +this.set({animating:!1})};b._setPosition=function(a){this.svgGroup.attr("transform","translate("+this.x+","+this.y+")")};b._toLocalCoordinate=function(a){this._moveTo(0,0,!1);a.appendChild(this.svgGroup)};b._toGlobalCoordinate=function(a){a=this.getAbsoluteCoordinate(a);this._moveTo(a.x,a.y,!1);this.getBoard().svgBlockGroup.appendChild(this.svgGroup)};b._moveTo=function(a,b,d){this.set({x:a,y:b});this._lazyUpdatePos();this.visible&&this.display&&this._setPosition(d)};b._moveBy=function(a,b,d){return this._moveTo(this.x+ +a,this.y+b,d)};b._addControl=function(){var a=this;this._mouseEnable=!0;$(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown",a.mouseHandler);var b=a.block.events;b&&b.dblclick&&$(this.svgGroup).dblclick(function(){b.dblclick.forEach(function(b){b&&b(a)})})};b.removeControl=function(){this._mouseEnable=!1;$(this.svgGroup).unbind(".blockViewMousedown")};b.onMouseDown=function(a){function c(a){a.stopPropagation();var c=g.workspace.getMode(),d;c===Entry.Workspace.MODE_VIMBOARD&& +b.vimBoardEvent(a,"dragOver");d=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var h=f.mouseDownCoordinate,h=Math.sqrt(Math.pow(d.pageX-h.x,2)+Math.pow(d.pageY-h.y,2));if(f.dragMode==Entry.DRAG_MODE_DRAG||h>Entry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(),f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),a= +!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block");f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove(); delete this.mouseDownCoordinate;delete f.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var h=a.type,k;k=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate={x:k.pageX, -y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",d);l.bind("mouseup.block touchend.block",c);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,c(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&&this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& -a&&(vimBoard=$(".entryVimBoard>.CodeMirror")[0],document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event)))}};b.vimBoardEvent=function(a,b,c){a&&(a=Entry.Utils.createMouseEvent(b,a),c&&(a.block=c),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),c=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE; -if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(c===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=c, -b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;c=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(), -f instanceof Entry.Board?this._moveTo(c.x,c.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var c in this.magnet)if(b="next"===c?this.getBoard().getNearestMagnet(this.x, -this.y+this.getBelowHeight(),c):this.getBoard().getNearestMagnet(this.x,this.y,c))return a.setMagnetedBlock(b.view,c);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers(); -var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var c=this.block;a=c.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(c)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); +y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&&this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& +a&&(vimBoard=$(".entryVimBoard>.CodeMirror")[0],document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event)))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE; +if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d, +b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(), +f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b="next"===d?this.getBoard().getNearestMagnet(this.x, +this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers(); +var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -c=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(c.x+e.x)+","+(c.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(c.x+e.x)+","+(c.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, +d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var c=this;a=a||15;b?window.setTimeout(function(){c._moveBy(a,a,!1)},b):c._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g, -">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0); +this.alignContent(!1)};b._destroyObservers=function(){for(var a=this._observers;a.length;)a.pop().destroy()};b._changeFill=function(a){var b=this.getBoard();if(b.patternRect&&!b.dragBlock){var d=this._fillColor,e=this._path,b=this.getBoard();a?(b.setPatternRectFill(d),d="url(#blockHoverPattern_"+this.getBoard().suffix+")"):b.disablePattern();e.attr({fill:d})}};b.addActivated=function(){this.svgGroup.addClass("activated")};b.removeActivated=function(){this.svgGroup.removeClass("activated")};b.reDraw= +function(){if(this.visible){var a=this.block;requestAnimFrame(this._updateContents.bind(this));var b=a.params;if(b)for(var d=0;d\s+/g, +">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0); a=this._skeleton.box(this);var l=b?1:1.5,m=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),u= -0;ub&&(c+="...");return c};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; -var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var c=b.workspace.selectedBlockView;if(!c||b!=c.getBoard())return!1;b=a.getSvgRoot();return b==c.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| -[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(b,a,d,c,e){Entry.Model(this,!1);this._blockView=a;this._block=a.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=d;this.contentIndex=e;this._content=b;this.acceptType=b.accept;this._restoreCurrent=b.restore;this.view=this;this.svgGroup=null;this._position=b.position;this.box.observe(a,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(a.getBoard(),c)}; +(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.command()};b._attachDisposeEvent=function(a){var b=this;b.disposeEvent=Entry.disposeEvent.attach(b,a||function(){b.destroyOption()})};b.align=function(a,b,d){var c=this.svgGroup;this._position&&(this._position.x&&(a=this._position.x),this._position.y&&(b=this._position.y));var f="translate("+a+","+b+")";void 0===d||d?c.animate({transform:f},300,mina.easeinout): +c.attr({transform:f});this.box.set({x:a,y:b})};b.getAbsolutePosFromBoard=function(){var a=this._block.view,b=a.getContentPos(),a=a.getAbsoluteCoordinate();return{x:a.x+this.box.x+b.x,y:a.y+this.box.y+b.y}};b.getAbsolutePosFromDocument=function(){var a=this._block.view,b=a.getContentPos(),d=a.getAbsoluteCoordinate(),a=a.getBoard().svgDom.offset();return{x:d.x+this.box.x+b.x+a.left,y:d.y+this.box.y+b.y+a.top}};b.getRelativePos=function(){var a=this._block.view.getContentPos(),b=this.box;return{x:b.x+ +a.x,y:b.y+a.y}};b.truncate=function(){var a=String(this.getValue()),b=this.TEXT_LIMIT_LENGTH,d=a.substring(0,b);a.length>b&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; +var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| +[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(b,a,c,d,e){Entry.Model(this,!1);this._blockView=a;this._block=a.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=b;this.acceptType=b.accept;this._restoreCurrent=b.restore;this.view=this;this.svgGroup=null;this._position=b.position;this.box.observe(a,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(a.getBoard(),d)}; Entry.Utils.inherit(Entry.Field,Entry.FieldBlock); -(function(b){b.schema={magneting:!1};b.renderStart=function(a,b){this.svgGroup=this._blockView.contentSvgGroup.elem("g");this.view=this;this._nextGroup=this.svgGroup;this.box.set({x:0,y:0,width:0,height:20});var c=this.getValue();c&&!c.view&&(c.setThread(this),c.createView(a,b),c.getThread().view.setParent(this));this.updateValueBlock(c);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};b.align=function(a,b,c){var e=this.svgGroup;this._position&&(this._position.x&& -(a=this._position.x),this._position.y&&(b=this._position.y));var f=this._valueBlock;f&&(b=-.5*f.view.height);f="translate("+a+","+b+")";void 0===c||c?e.animate({transform:f},300,mina.easeinout):e.attr({transform:f});this.box.set({x:a,y:b})};b.calcWH=function(){var a=this._valueBlock;a?(a=a.view,this.box.set({width:a.width,height:a.height})):this.box.set({width:15,height:20})};b.calcHeight=b.calcWH;b.destroy=function(){};b.inspectBlock=function(){var a=null;if(this._originBlock)a=this._originBlock.type, +(function(b){b.schema={magneting:!1};b.renderStart=function(a,b){this.svgGroup=this._blockView.contentSvgGroup.elem("g");this.view=this;this._nextGroup=this.svgGroup;this.box.set({x:0,y:0,width:0,height:20});var c=this.getValue();c&&!c.view&&(c.setThread(this),c.createView(a,b),c.getThread().view.setParent(this));this.updateValueBlock(c);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};b.align=function(a,b,d){var c=this.svgGroup;this._position&&(this._position.x&& +(a=this._position.x),this._position.y&&(b=this._position.y));var f=this._valueBlock;f&&(b=-.5*f.view.height);f="translate("+a+","+b+")";void 0===d||d?c.animate({transform:f},300,mina.easeinout):c.attr({transform:f});this.box.set({x:a,y:b})};b.calcWH=function(){var a=this._valueBlock;a?(a=a.view,this.box.set({width:a.width,height:a.height})):this.box.set({width:15,height:20})};b.calcHeight=b.calcWH;b.destroy=function(){};b.inspectBlock=function(){var a=null;if(this._originBlock)a=this._originBlock.type, delete this._originBlock;else switch(this.acceptType){case "boolean":a="True";break;case "string":a="text";break;case "param":a="function_field_label"}return this._createBlockByType(a)};b._setValueBlock=function(a){this._restoreCurrent&&(this._originBlock=this._valueBlock);a||(a=this.inspectBlock());this._valueBlock=a;this.setValue(a);a.setThread(this);a.getThread().view.setParent(this);return this._valueBlock};b.getValueBlock=function(){return this._valueBlock};b.updateValueBlock=function(a){a instanceof Entry.Block||(a=void 0);this._destroyObservers();a=this._setValueBlock(a).view;a.bindPrev(this);this._blockView.alignContent();this._posObserver=a.observe(this,"updateValueBlock",["x","y"],!1);this._sizeObserver=a.observe(this,"calcWH",["width","height"]);a=this._blockView.getBoard();a.constructor===Entry.Board&&a.generateCodeMagnetMap()};b._destroyObservers=function(){this._sizeObserver&&this._sizeObserver.destroy();this._posObserver&&this._posObserver.destroy()};b.getPrevBlock=function(a){return this._valueBlock=== a?this:null};b.getNextBlock=function(){return null};b.requestAbsoluteCoordinate=function(a){a=this._blockView;var b=a.contentPos;a=a.getAbsoluteCoordinate();a.x+=this.box.x+b.x;a.y+=this.box.y+b.y;return a};b.dominate=function(){this._blockView.dominate()};b.isGlobal=function(){return!1};b.separate=function(a){this.getCode().createThread([a]);this.calcWH();this.changeEvent.notify()};b.getCode=function(){return this._block.thread.getCode()};b.cut=function(a){return this._valueBlock===a?[a]:null};b.replace= function(a){"string"===typeof a&&(a=this._createBlockByType(a));var b=this._valueBlock;Entry.block[b.type].isPrimitive?(b.doNotSplice=!0,b.destroy()):"param"===this.acceptType?(this._destroyObservers(),b.view._toGlobalCoordinate(),a.getTerminateOutputBlock().view._contents[1].replace(b)):(this._destroyObservers(),b.view._toGlobalCoordinate(),this.separate(b),b.view.bumpAway(30,150));this.updateValueBlock(a);a.view._toLocalCoordinate(this.svgGroup);this.calcWH();this.changeEvent.notify()};b.setParent= -function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var c=b.workspace,e;c&&(e=c.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, -transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.Scroller=function(b,a,d){this._horizontal=void 0===a?!0:a;this._vertical=void 0===d?!0:d;this.board=b;this.svgGroup=null;this.vRatio=this.vY=this.vWidth=this.hRatio=this.hX=this.hWidth=0;this._visible=!0;this._opacity=-1;this.createScrollBar();this.setOpacity(0);this._bindEvent();this._scrollCommand=_.debounce(Entry.do,200)};Entry.Scroller.RADIUS=7; -(function(b){b.createScrollBar=function(){var a=Entry.Scroller.RADIUS,b=this;this.svgGroup=this.board.svg.elem("g").attr({class:"boardScrollbar"});this._horizontal&&(this.hScrollbar=this.svgGroup.elem("rect",{height:2*a,rx:a,ry:a}),this.hScrollbar.mousedown=function(a){function e(a){a.stopPropagation();a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll((a.pageX-c.offsetX)/b.hRatio,0);c.set({offsetX:a.pageX,offsetY:a.pageY})}function f(a){$(document).unbind(".scroll"); -delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",e);g.bind("mouseup.scroll",f);g.bind("touchmove.scroll",e);g.bind("touchend.scroll",f);b.dragInstance=new Entry.DragInstance({startX:a.pageX,startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}a.stopPropagation()});this._vertical&&(this.vScrollbar=this.svgGroup.elem("rect",{width:2*a,rx:a,ry:a}),this.vScrollbar.mousedown=function(a){function e(a){a.stopPropagation(); -a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll(0,(a.pageY-c.offsetY)/b.vRatio);c.set({offsetX:a.pageX,offsetY:a.pageY})}function f(a){$(document).unbind(".scroll");delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",e);g.bind("mouseup.scroll",f);g.bind("touchmove.scroll",e);g.bind("touchend.scroll",f);b.dragInstance=new Entry.DragInstance({startX:a.pageX, +function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var d=b.workspace,e;d&&(e=d.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, +transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.Scroller=function(b,a,c){this._horizontal=void 0===a?!0:a;this._vertical=void 0===c?!0:c;this.board=b;this.svgGroup=null;this.vRatio=this.vY=this.vWidth=this.hRatio=this.hX=this.hWidth=0;this._visible=!0;this._opacity=-1;this.createScrollBar();this.setOpacity(0);this._bindEvent();this._scrollCommand=_.debounce(Entry.do,200)};Entry.Scroller.RADIUS=7; +(function(b){b.createScrollBar=function(){var a=Entry.Scroller.RADIUS,b=this;this.svgGroup=this.board.svg.elem("g").attr({class:"boardScrollbar"});this._horizontal&&(this.hScrollbar=this.svgGroup.elem("rect",{height:2*a,rx:a,ry:a}),this.hScrollbar.mousedown=function(a){function c(a){a.stopPropagation();a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll((a.pageX-c.offsetX)/b.hRatio,0);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".scroll"); +delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",c);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll",c);g.bind("touchend.scroll",d);b.dragInstance=new Entry.DragInstance({startX:a.pageX,startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}a.stopPropagation()});this._vertical&&(this.vScrollbar=this.svgGroup.elem("rect",{width:2*a,rx:a,ry:a}),this.vScrollbar.mousedown=function(a){function c(a){a.stopPropagation(); +a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll(0,(a.pageY-c.offsetY)/b.vRatio);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",c);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll",c);g.bind("touchend.scroll",d);b.dragInstance=new Entry.DragInstance({startX:a.pageX, startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}a.stopPropagation()})};b.updateScrollBar=function(a,b){this._horizontal&&(this.hX+=a*this.hRatio,this.hScrollbar.attr({x:this.hX}));this._vertical&&(this.vY+=b*this.vRatio,this.vScrollbar.attr({y:this.vY}))};b.scroll=function(a,b){if(this.board.code){var c=this.board.svgBlockGroup.getBoundingClientRect(),e=this.board.svgDom,f=c.left-this.board.offset().left,g=c.top-this.board.offset().top,h=c.height;a=Math.max(-c.width+Entry.BOARD_PADDING-f,a);b=Math.max(-h+ Entry.BOARD_PADDING-g,b);a=Math.min(e.width()-Entry.BOARD_PADDING-f,a);b=Math.min(e.height()-Entry.BOARD_PADDING-g,b);this._scroll(a,b);this._diffs||(this._diffs=[0,0]);this._diffs[0]+=a;this._diffs[1]+=b;this._scrollCommand("scrollBoard",this._diffs[0],this._diffs[1],!0)}};b._scroll=function(a,b){this.board.code.moveBy(a,b);this.updateScrollBar(a,b)};b.setVisible=function(a){a!=this.isVisible()&&(this._visible=a,this.svgGroup.attr({display:!0===a?"block":"none"}))};b.isVisible=function(){return this._visible}; -b.setOpacity=function(a){this._opacity!=a&&(this.hScrollbar.attr({opacity:a}),this.vScrollbar.attr({opacity:a}),this._opacity=a)};b.resizeScrollBar=function(){if(this._visible){var a=this.board,b=a.svgBlockGroup.getBoundingClientRect(),c=a.svgDom,e=c.width(),c=c.height(),f=b.left-a.offset().left,a=b.top-a.offset().top,g=b.width,b=b.height;if(this._horizontal){var h=-g+Entry.BOARD_PADDING,k=e-Entry.BOARD_PADDING,g=(e+2*Entry.Scroller.RADIUS)*g/(k-h+g);isNaN(g)&&(g=0);this.hX=(f-h)/(k-h)*(e-g-2*Entry.Scroller.RADIUS); -this.hScrollbar.attr({width:g,x:this.hX,y:c-2*Entry.Scroller.RADIUS});this.hRatio=(e-g-2*Entry.Scroller.RADIUS)/(k-h)}this._vertical&&(f=-b+Entry.BOARD_PADDING,g=c-Entry.BOARD_PADDING,b=(c+2*Entry.Scroller.RADIUS)*b/(g-f+b),this.vY=(a-f)/(g-f)*(c-b-2*Entry.Scroller.RADIUS),this.vScrollbar.attr({height:b,y:this.vY,x:e-2*Entry.Scroller.RADIUS}),this.vRatio=(c-b-2*Entry.Scroller.RADIUS)/(g-f))}};b._bindEvent=function(){var a=_.debounce(this.resizeScrollBar,200);this.board.changeEvent.attach(this,a); +b.setOpacity=function(a){this._opacity!=a&&(this.hScrollbar.attr({opacity:a}),this.vScrollbar.attr({opacity:a}),this._opacity=a)};b.resizeScrollBar=function(){if(this._visible){var a=this.board,b=a.svgBlockGroup.getBoundingClientRect(),d=a.svgDom,e=d.width(),d=d.height(),f=b.left-a.offset().left,a=b.top-a.offset().top,g=b.width,b=b.height;if(this._horizontal){var h=-g+Entry.BOARD_PADDING,k=e-Entry.BOARD_PADDING,g=(e+2*Entry.Scroller.RADIUS)*g/(k-h+g);isNaN(g)&&(g=0);this.hX=(f-h)/(k-h)*(e-g-2*Entry.Scroller.RADIUS); +this.hScrollbar.attr({width:g,x:this.hX,y:d-2*Entry.Scroller.RADIUS});this.hRatio=(e-g-2*Entry.Scroller.RADIUS)/(k-h)}this._vertical&&(f=-b+Entry.BOARD_PADDING,g=d-Entry.BOARD_PADDING,b=(d+2*Entry.Scroller.RADIUS)*b/(g-f+b),this.vY=(a-f)/(g-f)*(d-b-2*Entry.Scroller.RADIUS),this.vScrollbar.attr({height:b,y:this.vY,x:e-2*Entry.Scroller.RADIUS}),this.vRatio=(d-b-2*Entry.Scroller.RADIUS)/(g-f))}};b._bindEvent=function(){var a=_.debounce(this.resizeScrollBar,200);this.board.changeEvent.attach(this,a); Entry.windowResized&&Entry.windowResized.attach(this,a)}})(Entry.Scroller.prototype);Entry.Board=function(b){Entry.Model(this,!1);this.changeEvent=new Entry.Event(this);this.createView(b);this.updateOffset();this.scroller=new Entry.Scroller(this,!0,!0);this._magnetMap={};Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING=100;this._initContextOptions();Entry.Utils.disableContextmenu(this.svgDom);this._addControl();this._bindEvent()};Entry.Board.OPTION_PASTE=0;Entry.Board.OPTION_ALIGN=1;Entry.Board.OPTION_CLEAR=2;Entry.Board.OPTION_DOWNLOAD=3;Entry.Board.DRAG_RADIUS=5; (function(b){b.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};b.createView=function(a){var b=a.dom,b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this._svgId="play"+(new Date).getTime();this.workspace=a.workspace;this._activatedBlockView=null;this.wrapper=Entry.Dom("div",{parent:b,class:"entryBoardWrapper"});this.svgDom=Entry.Dom($(''), -{parent:this.wrapper});this.visible=!0;var c=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){c.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, +{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var c=b.scroller;c&&(a.mouseenter(function(a){c.setOpacity(1)}),a.mouseleave(function(a){c.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var d=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-d.x,2)+Math.pow(a.pageY-d.y,2))a&&(f=f+e+10,e=0,c=15);e=Math.max(e,k.width);l=c+15;h._moveTo(f,l,!1);c=c+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()}; -b.updateOffset=function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),c=this._offset;this.relativeOffset={top:c.top-b,left:c.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(c.width/2-65)+","+(c.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var c=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});c.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33, -class:"entryFunctionButtonText"});e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(c).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD, -"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var c=this._getCodeBlocks(a,b);c.sort(function(a,b){return a.point-b.point});c.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=c[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE; -c[e-1].endPoint=f.point}this._magnetMap[b]=c}};b._getCodeBlocks=function(a,b){a=a.getThreads();var c=[],e;switch(b){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fc.endPoint)f=h+1;else{e=c.blocks;for(f=0;fa&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()}; +b.updateOffset=function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33, +class:"entryFunctionButtonText"});e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD, +"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE; +d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){a=a.getThreads();var c=[],e;switch(b){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fd.endPoint)f=h+1;else{c=d.blocks;for(f=0;fa||b.splice(a,1))};b.raiseEvent=function(a,b,c){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fa||b.splice(a,1)};b.doDestroyThread=function(a,b){b=this._data;a=b.indexOf(a);0>a||b.splice(a,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a=this.getThreads(),b=[],c=0,e=a.length;ca||b.splice(a,1))};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var c=[];if(void 0!==a){for(var f=0;fa||b.splice(a,1)};b.doDestroyThread=function(a,b){b=this._data;a=b.indexOf(a);0>a||b.splice(a,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a=this.getThreads(),b=[],d=0,e=a.length;db;b+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0=== b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/2;b.y=b.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+b.x+","+b.y+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()};b._updateByCoord= -function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var d=b[0]-a[0];a=b[1]-a[1]-49-1;b=Math.atan(-a/d);b=Entry.toDegrees(b);b=90-b;0>d?b+=180:0Math.PI?1:0;this._fillPath=this.svgOptionGroup.elem("path",{d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X",b).replace("%Y",c).replace("%LARGE",a),class:"entry-angle-fill-area"});this.svgOptionGroup.appendChild(this._dividerGroup);this._indicator&&this._indicator.remove();this._indicator=this.svgOptionGroup.elem("line",{x1:0,y1:0,x2:b,y2:c});this._indicator.attr({class:"entry-angle-indicator"})};b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)|| +function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var c=b[0]-a[0];a=b[1]-a[1]-49-1;b=Math.atan(-a/c);b=Entry.toDegrees(b);b=90-b;0>c?b+=180:0Math.PI?1:0;this._fillPath=this.svgOptionGroup.elem("path",{d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X",b).replace("%Y",d).replace("%LARGE",a),class:"entry-angle-fill-area"});this.svgOptionGroup.appendChild(this._dividerGroup);this._indicator&&this._indicator.remove();this._indicator=this.svgOptionGroup.elem("line",{x1:0,y1:0,x2:b,y2:d});this._indicator.attr({class:"entry-angle-indicator"})};b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)|| ""===a||(a=this.modValue(a),this.setValue(a),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(a),this.resize())};b.resize=function(){var a=this.getTextWidth();this._header.attr({width:a});this.optionGroup&&this.optionGroup.css({width:a});this.box.set({width:a});this._block.view.alignContent()};b.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+8:8};b.getText=function(){return this.getValue()+"\u00b0"};b.modValue= -function(a){return a%360};b.destroyOption=function(){this.disposeEvent&&(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.svgOptionGroup&&(this.svgOptionGroup.remove(),delete this.svgOptionGroup);this.textElement.textContent=this.getText();this.command()}})(Entry.FieldAngle.prototype);Entry.FieldColor=function(b,a,d){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=b;this._index=d;this._position=b.position;this.key=b.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(a)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._CONTENT_HEIGHT,b=this._CONTENT_WIDTH,c=this._position,e;c?(e=c.x||0,c=c.y||0):(e=0,c=-a/2);this._header=this.svgGroup.elem("rect",{x:e,y:c,width:b,height:a,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:c,width:b,height:a})};b.renderOptions=function(){var a=this;this._attachDisposeEvent();var b=Entry.FieldColor.getWidgetColorList(); -this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var c=0;c'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; b.setView=function(a,b){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=b,b!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};b.draw=function(){var a=this._view;this._svg&&this.remove();var b=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);b&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, {duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};b.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};b.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,b=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,b=-1*b+1;this._offsetX=a;this._offsetY=b;this.svgGroup.attr({transform:"translate("+a+","+b+ -")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,c=a.getBoard(),e=c.workspace.blockMenu,f=e.offset().left,g=e.offset().top, -h=e.visible?e.svgDom.width():0;return b.y>c.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var c=a.pageX;a=a.pageY;var d=e.left+(c-e._startX),f=e.top+(a-e._startY);e.svgDom.css({transform:"translate3d("+d+"px,"+f+"px, 0px)"});e._startX=c;e._startY=a;e.left=d;e.top=f}function c(a){$(document).unbind(".block")}this._startY=a.pageY; -var e=this;a.stopPropagation();a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",c);f.bind("touchmove.block",b);f.bind("touchend.block",c);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){a=Entry.block[a];void 0===a.changeEvent&&(a.changeEvent=new Entry.Event);a.template=b.template;a.params=b.params;a.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= +")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, +h=e.visible?e.svgDom.width():0;return b.y>d.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var b=a.pageX;a=a.pageY;var c=e.left+(b-e._startX),d=e.top+(a-e._startY);e.svgDom.css({transform:"translate3d("+c+"px,"+d+"px, 0px)"});e._startX=b;e._startY=a;e.left=c;e.top=d}function d(a){$(document).unbind(".block")}this._startY=a.pageY; +var e=this;a.stopPropagation();a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",d);f.bind("touchmove.block",b);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){a=Entry.block[a];void 0===a.changeEvent&&(a.changeEvent=new Entry.Event);a.template=b.template;a.params=b.params;a.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; (function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,c="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e + + + diff --git a/src/hw.js b/src/hw.js index 1101bbfd17..3267e500f1 100644 --- a/src/hw.js +++ b/src/hw.js @@ -69,67 +69,91 @@ p.initSocket = function() { this.connectTrial++; if(location.protocol.indexOf('https') > -1) { - socketSecurity = new WebSocket("wss://hardware.play-entry.org:23518"); + socketSecurity = io('https://hardware.play-entry.org:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); } else { try{ - socket = new WebSocket("ws://127.0.0.1:23518"); - socket.binaryType = "arraybuffer"; - - socket.onopen = (function() - { + socket = io('https://127.0.0.1:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); + socket.on('connect', function() { + socketSecurity.close(); hw.socketType = 'WebSocket'; hw.initHardware(socket); - }).bind(this); + }); + + socket.on('mode', function (mode) { + socket.mode = mode; + }); + + socket.on('message', function(msg) { + if(msg.data && typeof msg.data === 'string') { + var data = JSON.parse(msg.data); + hw.checkDevice(data); + hw.updatePortData(data); + } + }); - socket.onmessage = (function (evt) - { - var data = JSON.parse(evt.data); - hw.checkDevice(data); - hw.updatePortData(data); - }).bind(this); + socket.on('disconnect reconnecting', function() { + if(hw.socketType === 'WebSocket') { + hw.socket = null; + hw.initSocket(); + } + }); - socket.onclose = function() - { + socket.on('reconnecting', function() { if(hw.socketType === 'WebSocket') { - this.socket = null; + hw.socket = null; hw.initSocket(); } - }; + }); } catch(e) {} try{ - socketSecurity = new WebSocket("wss://hardware.play-entry.org:23518"); + socketSecurity = io('https://hardware.play-entry.org:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); } catch(e) { } } - socketSecurity.binaryType = "arraybuffer"; - socketSecurity.onopen = function() - { - hw.socketType = 'WebSocketSecurity'; + + socketSecurity.on('connect', function() { + socket.close(); + hw.socketType = 'WebSocket'; hw.initHardware(socketSecurity); - }; + }); - socketSecurity.onmessage = function (evt) - { - var data = JSON.parse(evt.data); - hw.checkDevice(data); - hw.updatePortData(data); - }; + socketSecurity.on('mode', function (mode) { + socketSecurity.mode = mode; + }); - socketSecurity.onclose = function() - { - if(hw.socketType === 'WebSocketSecurity') { - this.socket = null; + socketSecurity.on('message', function(msg) { + if(msg.data && typeof msg.data === 'string') { + var data = JSON.parse(msg.data); + hw.checkDevice(data); + hw.updatePortData(data); + } + }); + + socketSecurity.on('disconnect', function() { + if(hw.socketType === 'WebSocket') { + hw.socket = null; hw.initSocket(); } - }; + }); + socketSecurity.on('reconnecting', function() { + if(hw.socketType === 'WebSocket') { + hw.socket = null; + hw.initSocket(); + } + }); Entry.dispatchEvent("hwChanged"); } catch(e) {} }; p.retryConnect = function() { - this.connectTrial = 0; - this.initSocket(); + if(this.socket) { + this.executeHardware(); + } else { + this.executeHardware(); + this.connectTrial = 0; + this.initSocket(); + } }; p.initHardware = function(socket) { @@ -203,11 +227,11 @@ p.update = function() { return; } - if(this.socket.readyState != 1) { - return; - } + // if(this.socket.readyState != 1) { + // return; + // } - this.socket.send(JSON.stringify(this.sendQueue)); + this.socket.emit('message', {data:JSON.stringify(this.sendQueue), mode: this.socket.mode, type:'utf8'}); }; p.updatePortData = function(data) { @@ -297,3 +321,169 @@ p.banHW = function() { Entry.playground.mainWorkspace.blockMenu.banClass(hwOptions[i].name, true); }; + +p.executeHardware = function() { + + var executeIeCustomLauncher = { + _bNotInstalled : false, + init : function(sUrl, fpCallback) { + var width = 1; + var height = 1; + var left = window.screenLeft; + var top = window.screenTop; + var settings = 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left; + this._w = window.open('', "comic_viewer_launcher", settings); + var fnInterval = null; + fnInterval = setTimeout(function() { + executeIeCustomLauncher.runViewer(sUrl, fpCallback); + clearInterval(fnInterval); + }, 1000); + }, + runViewer : function(sUrl, fpCallback) { + this._w.document.write(""); + var nCounter = 0; + var bNotInstalled = false; + var nInterval = null; + nInterval = setInterval((function() { + try { + this._w.location.href; + } + catch(e) { + this._bNotInstalled = true; + } + + if(bNotInstalled || nCounter > 10) { + clearInterval(nInterval); + var nCloseCounter = 0; + var nCloseInterval = null; + nCloseInterval = setInterval((function() { + nCloseCounter++; + if(this._w.closed || nCloseCounter > 2) { + clearInterval(nCloseInterval); + } else { + this._w.close(); + } + this._bNotInstalled = false; + nCounter = 0; + }).bind(this), 5000); + fpCallback(!this._bNotInstalled); + } + nCounter++; + }).bind(this), 100); + }, + set : function() { + this._bNotInstalled = true; + } + }; + var clientId = (this.socket) ? this.socket.id : ''; + var entryHardwareUrl = 'entryhw://-clientId:' + clientId; + + if(navigator.userAgent.indexOf("MSIE") > 0 || navigator.userAgent.indexOf("Trident") > 0){ + if (navigator.msLaunchUri != undefined) { + executeIe(entryHardwareUrl); + } else { + var ieVersion; + if(document.documentMode > 0) { + ieVersion = document.documentMode; + } else { + ieVersion = navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]; + } + + if (ieVersion < 9) { + alert("지원하지 않는 브라우저입니다."); + } else { + executeIeCustomLauncher.init(entryHardwareUrl, + function(bInstalled) { + if (bInstalled == false) { + alert('설치안됬엉'); + // window.open(VIWER_DOWNLOAD_URL, "comic_viewer_download", "width=530, height=400, resizable=yes"); + } + } + ); + } + } + } + else if(navigator.userAgent.indexOf("Firefox") > 0 ) { + executeFirefox(entryHardwareUrl); + } + else if(navigator.userAgent.indexOf("Chrome") > 0 || navigator.userAgent.indexOf("Safari") > 0) { + executeChrome(entryHardwareUrl); + } else { + alert("지원하지 않는 브라우저입니다."); + } + + function executeIe(customUrl) { + navigator.msLaunchUri(customUrl, + function() { + }, + function() { + alert('설치안됬엉'); + // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=510, height=360, resizable=yes"); + // if(window.focus){ + // setTimeout(function(){ + // popup.focus(); + // }, 500); + // } + } + ); + } + + function executeFirefox(customUrl) { + var iFrame = document.createElement('iframe'); + iFrame.src = "about:blank"; + iFrame.style = "display:none"; + document.getElementsByTagName("body")[0].appendChild(iFrame); + var fnTimeout = null; + fnTimeout = setTimeout(function() { + var isInstalled = false; + try{ + iFrame.contentWindow.location.href = customUrl; + isInstalled = true; + }catch(e){ + if (e.name == "NS_ERROR_UNKNOWN_PROTOCOL"){ + isInstalled = false; + } + } + + if(!isInstalled) { + alert('설치안됬엉'); + // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=510, height=360, resizable=yes"); + // if(window.focus){ + // setTimeout(function(){ + // if (popup == null || typeof(popup)=='undefined') { + // alert("Firefox 설정에 팝업 창 차단을 해제해주세요."); + // } else { + // popup.focus(); + // } + // }, 500); + // } + } + + document.getElementsByTagName("body")[0].removeChild(iFrame); + clearTimeout(fnTimeout); + }, 500); + } + + function executeChrome(customUrl) { + var isInstalled = false; + window.focus(); + window.onblur = function() { + isInstalled = true; + }; + + location.assign(encodeURI(customUrl)); + setTimeout(function() { + if (isInstalled == false || navigator.userAgent.indexOf("Edge") > 0) { + alert('설치 안됬엉'); + // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=530, height=400, resizable=yes"); + // if(window.focus){ + // setTimeout(function(){ + // popup.focus(); + // }, 500); + // } + } + window.onblur = null; + }, 1500); + } +} + diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 205fe1e513..0a6a9da1a7 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -2879,7 +2879,7 @@ Entry.block = { "arduino_reconnect": { "skeleton": "basic_button", "color": "#eee", - "isNotFor": ["arduinoDisconnected"], + "isNotFor": [""], "params": [ { "type": "Text", From 10673188e5e8cdca1e6d3ceaf0f548cb8d2d2784 Mon Sep 17 00:00:00 2001 From: jykim Date: Thu, 13 Oct 2016 19:04:01 +0900 Subject: [PATCH 02/17] =?UTF-8?q?sessionStrage=EC=97=90=20roomid=EC=83=9D?= =?UTF-8?q?=EC=84=B1.=20=ED=81=B4=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8?= =?UTF-8?q?=EB=93=A4=EC=9D=80=20=ED=95=B4=EB=8B=B9=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gruntfile.js | 1 + dist/entry.js | 49 +++++++++++++++----------- example/example.html | 2 +- src/hw.js | 84 +++++++++++++++++++++++++++++++------------- 4 files changed, 90 insertions(+), 46 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b8f85c7184..77d588fd50 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -113,6 +113,7 @@ module.exports = function(grunt) { ]); grunt.registerTask('development', [ + 'watch', 'closureCompiler:targetName', 'karma', 'concurrent' diff --git a/dist/entry.js b/dist/entry.js index f11775d0bb..1272870725 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -10139,6 +10139,8 @@ Entry.HWMonitor = function(a) { }; })(Entry.HWMonitor.prototype); Entry.HW = function() { + this.sessionRoomId = sessionStorage.getItem("entryhwRoomId"); + this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), sessionStorage.setItem("entryhwRoomId", this.sessionRoomId)); this.connectTrial = 0; this.isFirstConnect = !0; this.initSocket(); @@ -10153,6 +10155,12 @@ Entry.HW = function() { }; Entry.HW.TRIAL_LIMIT = 1; p = Entry.HW.prototype; +p.createRandomRoomId = function() { + return "xxxxxxxxyx".replace(/[xy]/g, function(a) { + var b = 16 * Math.random() | 0; + return ("x" == a ? b : b & 3 | 8).toString(16); + }); +}; p.initSocket = function() { try { if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { @@ -10160,12 +10168,11 @@ p.initSocket = function() { } else { var a = this, b, c; this.connected = !1; - this.connectTrial++; if (-1 < location.protocol.indexOf("https")) { - c = io("https://hardware.play-entry.org:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}); + c = io("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); } else { try { - b = io("https://127.0.0.1:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}), b.on("connect", function() { + b = io("https://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}), b.on("connect", function() { c.close(); a.socketType = "WebSocket"; a.initHardware(b); @@ -10173,23 +10180,25 @@ p.initSocket = function() { b.mode = a; }), b.on("message", function(b) { b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); - }), b.on("disconnect reconnecting", function() { - "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); - }), b.on("reconnecting", function() { + }), b.on("disconnect", function() { "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); }); } catch (d) { } try { - c = io("https://hardware.play-entry.org:23518", {reconnectionAttempts:Entry.HW.TRIAL_LIMIT, query:{client:!0}}); + c = io("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); } catch (d) { } } c.on("connect", function() { + console.log("connect", c.id); b.close(); a.socketType = "WebSocket"; a.initHardware(c); }); + c.on("matched", function(b) { + c.emit("matchTarget", {target:b}); + }); c.on("mode", function(b) { c.mode = b; }); @@ -10197,9 +10206,7 @@ p.initSocket = function() { b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); }); c.on("disconnect", function() { - "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); - }); - c.on("reconnecting", function() { + console.log("disconnect"); "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); }); Entry.dispatchEvent("hwChanged"); @@ -10208,7 +10215,7 @@ p.initSocket = function() { } }; p.retryConnect = function() { - this.socket ? this.executeHardware() : (this.executeHardware(), this.connectTrial = 0, this.initSocket()); + this.socket ? (console.log("retry execHardware"), this.executeHardware()) : (console.log("retry initSocket"), this.executeHardware(), this.connectTrial = 0, this.initSocket()); }; p.initHardware = function(a) { this.socket = a; @@ -10350,7 +10357,7 @@ p.executeHardware = function() { }.bind(this), 100); }, set:function() { this._bNotInstalled = !0; - }}, e = "entryhw://-clientId:" + (this.socket ? this.socket.id : ""); + }}, e = "entryhw://-roomId:" + this.sessionRoomId; 0 < navigator.userAgent.indexOf("MSIE") || 0 < navigator.userAgent.indexOf("Trident") ? void 0 != navigator.msLaunchUri ? a(e) : 9 > (0 < document.documentMode ? document.documentMode : navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]) ? alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4.") : d.init(e, function(b) { 0 == b && alert("\uc124\uce58\uc548\ub42c\uc5c9"); }) : 0 < navigator.userAgent.indexOf("Firefox") ? b(e) : 0 < navigator.userAgent.indexOf("Chrome") || 0 < navigator.userAgent.indexOf("Safari") ? c(e) : alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4."); @@ -25495,10 +25502,10 @@ Entry.GlobalSvg = {}; this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); }; a.align = function() { - var a = this._view.getSkeleton().box(this._view).offsetX || 0, c = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, c = -1 * c + 1; - this._offsetX = a; - this._offsetY = c; - this.svgGroup.attr({transform:"translate(" + a + "," + c + ")"}); + var b = this._view.getSkeleton().box(this._view).offsetX || 0, a = this._view.getSkeleton().box(this._view).offsetY || 0, b = -1 * b + 1, a = -1 * a + 1; + this._offsetX = b; + this._offsetY = a; + this.svgGroup.attr({transform:"translate(" + b + "," + a + ")"}); }; a.show = function() { this._container.removeClass("entryRemove"); @@ -25507,11 +25514,11 @@ Entry.GlobalSvg = {}; this._container.addClass("entryRemove"); }; a.position = function() { - var a = this._view; - if (a) { - var c = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); - this.left = c.x + a.left - this._offsetX; - this.top = c.y + a.top - this._offsetY; + var b = this._view; + if (b) { + var a = b.getAbsoluteCoordinate(), b = b.getBoard().offset(); + this.left = a.x + b.left - this._offsetX; + this.top = a.y + b.top - this._offsetY; this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); } }; diff --git a/example/example.html b/example/example.html index 6d6bc14ef5..6a8ede47ff 100644 --- a/example/example.html +++ b/example/example.html @@ -53,7 +53,7 @@ - + diff --git a/src/hw.js b/src/hw.js index 3267e500f1..1e9b46d4ee 100644 --- a/src/hw.js +++ b/src/hw.js @@ -6,6 +6,12 @@ goog.require("Entry.HWMontior"); Entry.HW = function() { + this.sessionRoomId = sessionStorage.getItem('entryhwRoomId'); + if(!this.sessionRoomId) { + this.sessionRoomId = this.createRandomRoomId(); + sessionStorage.setItem('entryhwRoomId', this.sessionRoomId); + } + this.connectTrial = 0; this.isFirstConnect = true; @@ -51,6 +57,13 @@ Entry.HW.TRIAL_LIMIT = 1; var p = Entry.HW.prototype; +p.createRandomRoomId = function() { + return 'xxxxxxxxyx'.replace(/[xy]/g, function(c) { + var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); + return v.toString(16); + }); +} + p.initSocket = function() { try{ if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { @@ -61,18 +74,17 @@ p.initSocket = function() { this.isFirstConnect = false; return; } - var hw = this; + var hw = this; var socket, socketSecurity; var protocol = ''; this.connected = false; - this.connectTrial++; - + if(location.protocol.indexOf('https') > -1) { - socketSecurity = io('https://hardware.play-entry.org:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); + socketSecurity = io('https://hardware.play-entry.org:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); } else { try{ - socket = io('https://127.0.0.1:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); + socket = io('https://127.0.0.1:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); socket.on('connect', function() { socketSecurity.close(); hw.socketType = 'WebSocket'; @@ -91,32 +103,46 @@ p.initSocket = function() { } }); - socket.on('disconnect reconnecting', function() { + socket.on('disconnect', function() { if(hw.socketType === 'WebSocket') { hw.socket = null; hw.initSocket(); } }); - socket.on('reconnecting', function() { - if(hw.socketType === 'WebSocket') { - hw.socket = null; - hw.initSocket(); - } - }); + // socket.on('reconnecting', function() { + // console.log('reconnecting', hw.connectTrial++); + // if (hw.connectTrial >= Entry.HW.TRIAL_LIMIT) { + // if (!hw.isFirstConnect) + // Entry.toast.alert(Lang.Menus.connect_hw, + // Lang.Menus.connect_fail, + // false); + // hw.isFirstConnect = false; + // socket.close(); + // } else if(hw.socketType === 'WebSocket') { + // // hw.socket = null; + // } + // }); } catch(e) {} try{ - socketSecurity = io('https://hardware.play-entry.org:23518', {reconnectionAttempts: Entry.HW.TRIAL_LIMIT, query:{'client': true}}); + socketSecurity = io('https://hardware.play-entry.org:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); } catch(e) { } } socketSecurity.on('connect', function() { + console.log('connect', socketSecurity.id); socket.close(); hw.socketType = 'WebSocket'; hw.initHardware(socketSecurity); }); + socketSecurity.on('matched', function (target) { + socketSecurity.emit('matchTarget', { + target: target, + }); + }); + socketSecurity.on('mode', function (mode) { socketSecurity.mode = mode; }); @@ -130,17 +156,26 @@ p.initSocket = function() { }); socketSecurity.on('disconnect', function() { + console.log('disconnect'); if(hw.socketType === 'WebSocket') { hw.socket = null; hw.initSocket(); } - }); - socketSecurity.on('reconnecting', function() { - if(hw.socketType === 'WebSocket') { - hw.socket = null; - hw.initSocket(); - } - }); + }); + + // socketSecurity.on('reconnecting', function() { + // console.log('reconnecting', hw.connectTrial++); + // if (hw.connectTrial >= Entry.HW.TRIAL_LIMIT) { + // if (!hw.isFirstConnect) + // Entry.toast.alert(Lang.Menus.connect_hw, + // Lang.Menus.connect_fail, + // false); + // hw.isFirstConnect = false; + // socketSecurity.close(); + // } else if(hw.socketType === 'WebSocket') { + // // hw.socket = null; + // } + // }); Entry.dispatchEvent("hwChanged"); } catch(e) {} @@ -148,8 +183,10 @@ p.initSocket = function() { p.retryConnect = function() { if(this.socket) { + console.log('retry execHardware'); this.executeHardware(); } else { + console.log('retry initSocket'); this.executeHardware(); this.connectTrial = 0; this.initSocket(); @@ -184,8 +221,9 @@ p.getDigitalPortValue = function(port) { if (this.portData[port] !== undefined) { return this.portData[port]; } - else + else { return 0; + } }; p.setPortReadable = function(port) { @@ -323,7 +361,6 @@ p.banHW = function() { }; p.executeHardware = function() { - var executeIeCustomLauncher = { _bNotInstalled : false, init : function(sUrl, fpCallback) { @@ -375,8 +412,7 @@ p.executeHardware = function() { this._bNotInstalled = true; } }; - var clientId = (this.socket) ? this.socket.id : ''; - var entryHardwareUrl = 'entryhw://-clientId:' + clientId; + var entryHardwareUrl = 'entryhw://-roomId:' + this.sessionRoomId; if(navigator.userAgent.indexOf("MSIE") > 0 || navigator.userAgent.indexOf("Trident") > 0){ if (navigator.msLaunchUri != undefined) { From b1e0468bbe2cced0c59964528c796f2f6ac09b2e Mon Sep 17 00:00:00 2001 From: jykim Date: Fri, 14 Oct 2016 17:56:42 +0900 Subject: [PATCH 03/17] =?UTF-8?q?socket=20=EC=9D=B4=EB=B2=A4=ED=8A=B8?= =?UTF-8?q?=EB=B0=8F=20=EC=B2=98=EB=A6=AC=20=EB=B0=A9=EC=8B=9D=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 151 ++++++++++++++----------- src/hw.js | 251 +++++++++++++++++++++--------------------- src/hw_monitor.js | 181 ++++++++++++------------------ src/property_panel.js | 19 +++- 4 files changed, 301 insertions(+), 301 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 1272870725..db36ab21fd 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -10153,7 +10153,7 @@ Entry.HW = function() { Entry.addEventListener("stop", this.setZero); this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino, "10.1":Entry.Roborobo_Roduino, "10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3, "B.1":Entry.Codestar}; }; -Entry.HW.TRIAL_LIMIT = 1; +Entry.HW.TRIAL_LIMIT = 2; p = Entry.HW.prototype; p.createRandomRoomId = function() { return "xxxxxxxxyx".replace(/[xy]/g, function(a) { @@ -10161,61 +10161,65 @@ p.createRandomRoomId = function() { return ("x" == a ? b : b & 3 | 8).toString(16); }); }; +p.connectWebSocket = function(a, b) { + var c = this, d = io(a, b); + d.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); + d.io.reconnectionDelayMax(1E3); + d.io.timeout(1E3); + d.on("connect", function() { + console.log("connect"); + c.socketType = "WebSocket"; + c.initHardware(d); + }); + d.on("matched", function(b) { + d.emit("matchTarget", {target:b}); + }); + d.on("mode", function(b) { + d.mode = b; + }); + d.on("message", function(b) { + if (b.data && "string" === typeof b.data) { + b = JSON.parse(b.data), c.checkDevice(b), c.updatePortData(b); + } else { + if ("string" === typeof b) { + switch(console.log(b), b) { + case "disconnectHardware": + c.disconnectHardware(); + } + } + } + }); + d.on("disconnect", function() { + console.log("disconnect"); + c.aaa ? (c.aaa = !1, c.initSocket()) : "WebSocket" === c.socketType && c.disconnectedSocket(); + }); + return d; +}; p.initSocket = function() { try { - if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; + this.connected = !1; + if (-1 < location.protocol.indexOf("https")) { + this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); } else { - var a = this, b, c; - this.connected = !1; - if (-1 < location.protocol.indexOf("https")) { - c = io("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); - } else { - try { - b = io("https://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}), b.on("connect", function() { - c.close(); - a.socketType = "WebSocket"; - a.initHardware(b); - }), b.on("mode", function(a) { - b.mode = a; - }), b.on("message", function(b) { - b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); - }), b.on("disconnect", function() { - "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); - }); - } catch (d) { - } - try { - c = io("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); - } catch (d) { - } + try { + this.socketIo = this.connectWebSocket("https://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } catch (a) { + } + try { + this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } catch (a) { } - c.on("connect", function() { - console.log("connect", c.id); - b.close(); - a.socketType = "WebSocket"; - a.initHardware(c); - }); - c.on("matched", function(b) { - c.emit("matchTarget", {target:b}); - }); - c.on("mode", function(b) { - c.mode = b; - }); - c.on("message", function(b) { - b.data && "string" === typeof b.data && (b = JSON.parse(b.data), a.checkDevice(b), a.updatePortData(b)); - }); - c.on("disconnect", function() { - console.log("disconnect"); - "WebSocket" === a.socketType && (a.socket = null, a.initSocket()); - }); - Entry.dispatchEvent("hwChanged"); } - } catch (d) { + window.a = this.tlsSocketIo; + window.b = this.socketIo; + Entry.dispatchEvent("hwChanged"); + } catch (a) { } }; p.retryConnect = function() { - this.socket ? (console.log("retry execHardware"), this.executeHardware()) : (console.log("retry initSocket"), this.executeHardware(), this.connectTrial = 0, this.initSocket()); + this.aaa = !0; + Entry.HW.TRIAL_LIMIT = 5; + this.socket ? this.executeHardware() : (this.executeHardware(), this.initSocket()); }; p.initHardware = function(a) { this.socket = a; @@ -10224,6 +10228,23 @@ p.initHardware = function(a) { Entry.dispatchEvent("hwChanged"); Entry.playground && Entry.playground.object && Entry.playground.setMenu(Entry.playground.object.objectType); }; +p.disconnectHardware = function() { + Entry.propertyPanel.removeMode("hw"); + this.hwModule = this.selectedDevice = void 0; + Entry.dispatchEvent("hwChanged"); + Entry.toast.alert("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc885\ub8cc", "\ud558\ub4dc\uc6e8\uc5b4\uc758 \uc5f0\uacb0\uc774 \uc885\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", !1); +}; +p.disconnectedSocket = function() { + this.tlsSocketIo.close(); + this.socketIo && this.socketIo.close(); + Entry.propertyPanel.removeMode("hw"); + this.socket = void 0; + this.connectTrial = 0; + this.connected = !1; + this.hwModule = this.selectedDevice = void 0; + Entry.dispatchEvent("hwChanged"); + Entry.toast.alert("\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8 \uc5f0\uacb0 \uc885\ub8cc", "\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8\uacfc \uc0ac\uc774\uc758 \uc5f0\uacb0\uc774 \uc885\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", !1); +}; p.setDigitalPortValue = function(a, b) { this.sendQueue[a] = b; this.removePortReadable(a); @@ -10262,7 +10283,7 @@ p.removePortReadable = function(a) { } }; p.update = function() { - this.socket && this.socket.emit("message", {data:JSON.stringify(this.sendQueue), mode:this.socket.mode, type:"utf8"}); + this.socket && (this.socket.disconnected || this.socket.emit("message", {data:JSON.stringify(this.sendQueue), mode:this.socket.mode, type:"utf8"})); }; p.updatePortData = function(a) { this.portData = a; @@ -10284,7 +10305,7 @@ p.setZero = function() { Entry.hw.hwModule && Entry.hw.hwModule.setZero(); }; p.checkDevice = function(a) { - void 0 !== a.company && (a = [Entry.Utils.convertIntToHex(a.company), ".", Entry.Utils.convertIntToHex(a.model)].join(""), a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], Entry.dispatchEvent("hwChanged"), Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5", "\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.", !0), this.hwModule.monitorTemplate && + void 0 !== a.company && (a = [Entry.Utils.convertIntToHex(a.company), ".", Entry.Utils.convertIntToHex(a.model)].join(""), a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], Entry.dispatchEvent("hwChanged"), Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5", "\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.", !1), this.hwModule.monitorTemplate && (this.hwMonitor ? (this.hwMonitor._hwModule = this.hwModule, this.hwMonitor.initView()) : this.hwMonitor = new Entry.HWMonitor(this.hwModule), Entry.propertyPanel.addMode("hw", this.hwMonitor), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); }; p.banHW = function() { @@ -10386,6 +10407,10 @@ Entry.PropertyPanel = function() { Entry.dispatchEvent("hwModeChange"); }); }; + a.removeMode = function(b) { + this.modes[b] && (this.modes[b].tabDom.remove(), this.modes[b].contentDom.remove(), "hw" == b && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); + (b = Object.keys(this.modes)) && 0 < b.length && this.select(b[0]); + }; a.resize = function(b) { this._view.css({width:b + "px", top:9 * b / 16 + 123 - 22 + "px"}); 430 <= b ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); @@ -25522,15 +25547,15 @@ Entry.GlobalSvg = {}; this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); } }; - a.terminateDrag = function(a) { - var b = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; - return b.y > d.offset().top - 20 && b.x > f + h ? this.DONE : b.y > g && b.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + a.terminateDrag = function(b) { + var a = Entry.mouseCoordinate, d = b.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; + return a.y > d.offset().top - 20 && a.x > f + h ? this.DONE : a.y > g && a.x > f && e.visible ? b.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; }; - a.addControl = function(a) { + a.addControl = function(b) { this.onMouseDown.apply(this, arguments); }; - a.onMouseDown = function(a) { - function b(a) { + a.onMouseDown = function(b) { + function a(a) { var b = a.pageX; a = a.pageY; var c = e.left + (b - e._startX), d = e.top + (a - e._startY); @@ -25543,17 +25568,17 @@ Entry.GlobalSvg = {}; function d(a) { $(document).unbind(".block"); } - this._startY = a.pageY; + this._startY = b.pageY; var e = this; - a.stopPropagation(); - a.preventDefault(); + b.stopPropagation(); + b.preventDefault(); var f = $(document); - f.bind("mousemove.block", b); + f.bind("mousemove.block", a); f.bind("mouseup.block", d); - f.bind("touchmove.block", b); + f.bind("touchmove.block", a); f.bind("touchend.block", d); - this._startX = a.pageX; - this._startY = a.pageY; + this._startX = b.pageX; + this._startY = b.pageY; }; })(Entry.GlobalSvg); Entry.Mutator = function() { diff --git a/src/hw.js b/src/hw.js index 1e9b46d4ee..7b127e10f1 100644 --- a/src/hw.js +++ b/src/hw.js @@ -53,7 +53,7 @@ Entry.HW = function() { }; }; -Entry.HW.TRIAL_LIMIT = 1; +Entry.HW.TRIAL_LIMIT = 2; var p = Entry.HW.prototype; @@ -64,131 +64,112 @@ p.createRandomRoomId = function() { }); } +p.connectWebSocket = function(url, option) { + var hw = this; + var socket = io(url, option); + socket.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); + socket.io.reconnectionDelayMax(1000); + socket.io.timeout(1000); + socket.on('connect', function() { + console.log('connect'); + hw.socketType = 'WebSocket'; + hw.initHardware(socket); + }); + + socket.on('matched', function (target) { + socket.emit('matchTarget', { + target: target, + }); + }); + + socket.on('mode', function (mode) { + socket.mode = mode; + }); + + socket.on('message', function(msg) { + if(msg.data && typeof msg.data === 'string') { + var data = JSON.parse(msg.data); + hw.checkDevice(data); + hw.updatePortData(data); + } else if(typeof msg === 'string') { + console.log(msg); + switch(msg) { + case 'disconnectHardware': { + hw.disconnectHardware(); + break; + } + } + } + }); + + socket.on('disconnect', function() { + console.log('disconnect'); + if(hw.aaa) { + hw.aaa = false; + hw.initSocket(); + } else if(hw.socketType === 'WebSocket') { + hw.disconnectedSocket(); + } + }); + + // socketSecurity.on('reconnecting', function() { + // console.log('reconnecting', hw.connectTrial++); + // if (hw.connectTrial >= Entry.HW.TRIAL_LIMIT) { + // if (!hw.isFirstConnect) + // Entry.toast.alert(Lang.Menus.connect_hw, + // Lang.Menus.connect_fail, + // false); + // hw.isFirstConnect = false; + // socketSecurity.close(); + // } else if(hw.socketType === 'WebSocket') { + // // hw.socket = null; + // } + // }); + + return socket; +} + p.initSocket = function() { try{ - if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - if (!this.isFirstConnect) - Entry.toast.alert(Lang.Menus.connect_hw, - Lang.Menus.connect_fail, - false); - this.isFirstConnect = false; - return; - } + // if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { + // if (!this.isFirstConnect) + // Entry.toast.alert(Lang.Menus.connect_hw, + // Lang.Menus.connect_fail, + // false); + // this.isFirstConnect = false; + // return; + // } var hw = this; - var socket, socketSecurity; var protocol = ''; this.connected = false; if(location.protocol.indexOf('https') > -1) { - socketSecurity = io('https://hardware.play-entry.org:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); + this.tlsSocketIo = this.connectWebSocket('https://hardware.play-entry.org:23518', { query:{ 'client': true, 'roomId' : this.sessionRoomId } }); } else { try{ - socket = io('https://127.0.0.1:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); - socket.on('connect', function() { - socketSecurity.close(); - hw.socketType = 'WebSocket'; - hw.initHardware(socket); - }); - - socket.on('mode', function (mode) { - socket.mode = mode; - }); - - socket.on('message', function(msg) { - if(msg.data && typeof msg.data === 'string') { - var data = JSON.parse(msg.data); - hw.checkDevice(data); - hw.updatePortData(data); - } - }); + this.socketIo = this.connectWebSocket('https://127.0.0.1:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); + } catch(e) { } - socket.on('disconnect', function() { - if(hw.socketType === 'WebSocket') { - hw.socket = null; - hw.initSocket(); - } - }); - - // socket.on('reconnecting', function() { - // console.log('reconnecting', hw.connectTrial++); - // if (hw.connectTrial >= Entry.HW.TRIAL_LIMIT) { - // if (!hw.isFirstConnect) - // Entry.toast.alert(Lang.Menus.connect_hw, - // Lang.Menus.connect_fail, - // false); - // hw.isFirstConnect = false; - // socket.close(); - // } else if(hw.socketType === 'WebSocket') { - // // hw.socket = null; - // } - // }); - } catch(e) {} try{ - socketSecurity = io('https://hardware.play-entry.org:23518', {query:{'client': true, 'roomId' : this.sessionRoomId}}); - } catch(e) { - } + this.tlsSocketIo = this.connectWebSocket('https://hardware.play-entry.org:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); + } catch(e) { } } - socketSecurity.on('connect', function() { - console.log('connect', socketSecurity.id); - socket.close(); - hw.socketType = 'WebSocket'; - hw.initHardware(socketSecurity); - }); - - socketSecurity.on('matched', function (target) { - socketSecurity.emit('matchTarget', { - target: target, - }); - }); - - socketSecurity.on('mode', function (mode) { - socketSecurity.mode = mode; - }); - - socketSecurity.on('message', function(msg) { - if(msg.data && typeof msg.data === 'string') { - var data = JSON.parse(msg.data); - hw.checkDevice(data); - hw.updatePortData(data); - } - }); - - socketSecurity.on('disconnect', function() { - console.log('disconnect'); - if(hw.socketType === 'WebSocket') { - hw.socket = null; - hw.initSocket(); - } - }); - - // socketSecurity.on('reconnecting', function() { - // console.log('reconnecting', hw.connectTrial++); - // if (hw.connectTrial >= Entry.HW.TRIAL_LIMIT) { - // if (!hw.isFirstConnect) - // Entry.toast.alert(Lang.Menus.connect_hw, - // Lang.Menus.connect_fail, - // false); - // hw.isFirstConnect = false; - // socketSecurity.close(); - // } else if(hw.socketType === 'WebSocket') { - // // hw.socket = null; - // } - // }); + window.a = this.tlsSocketIo; + window.b = this.socketIo; Entry.dispatchEvent("hwChanged"); } catch(e) {} }; p.retryConnect = function() { + this.aaa = true; + Entry.HW.TRIAL_LIMIT = 5; if(this.socket) { - console.log('retry execHardware'); this.executeHardware(); } else { - console.log('retry initSocket'); this.executeHardware(); - this.connectTrial = 0; this.initSocket(); } }; @@ -196,21 +177,53 @@ p.retryConnect = function() { p.initHardware = function(socket) { this.socket = socket; this.connectTrial = 0; - this.connected = true; Entry.dispatchEvent("hwChanged"); - if (Entry.playground && Entry.playground.object) + if (Entry.playground && Entry.playground.object) { Entry.playground.setMenu(Entry.playground.object.objectType); + } }; +p.disconnectHardware = function() { + Entry.propertyPanel.removeMode("hw"); + this.selectedDevice = undefined; + this.hwModule = undefined; + Entry.dispatchEvent("hwChanged"); + Entry.toast.alert( + "하드웨어 연결 종료", + "하드웨어의 연결이 종료되었습니다.", + false + ); +} +p.disconnectedSocket = function() { + this.tlsSocketIo.close(); + if(this.socketIo) { + this.socketIo.close(); + } + + Entry.propertyPanel.removeMode("hw"); + this.socket = undefined; + this.connectTrial = 0; + this.connected = false; + this.selectedDevice = undefined; + this.hwModule = undefined; + Entry.dispatchEvent("hwChanged"); + Entry.toast.alert( + "하드웨어 프로그램 연결 종료", + "하드웨어 프로그램과 사이의 연결이 종료되었습니다.", + false + ); +} + p.setDigitalPortValue = function(port, value) { this.sendQueue[port] = value; this.removePortReadable(port); }; p.getAnalogPortValue = function(port) { - if (!this.connected) + if (!this.connected) { return 0; + } return this.portData['a'+port]; }; @@ -227,8 +240,9 @@ p.getDigitalPortValue = function(port) { }; p.setPortReadable = function(port) { - if (!this.sendQueue.readablePorts) + if (!this.sendQueue.readablePorts) { this.sendQueue.readablePorts = []; + } var isPass = false; for(var i in this.sendQueue.readablePorts) { @@ -264,18 +278,15 @@ p.update = function() { if (!this.socket) { return; } - - // if(this.socket.readyState != 1) { - // return; - // } - - this.socket.emit('message', {data:JSON.stringify(this.sendQueue), mode: this.socket.mode, type:'utf8'}); + if(this.socket.disconnected) { + return; + } + this.socket.emit('message', { data:JSON.stringify(this.sendQueue), mode: this.socket.mode, type:'utf8' }); }; p.updatePortData = function(data) { this.portData = data; - if (this.hwMonitor - && Entry.propertyPanel.selected == 'hw') { + if (this.hwMonitor && Entry.propertyPanel.selected == 'hw') { this.hwMonitor.update(); } }; @@ -321,23 +332,18 @@ p.checkDevice = function(data) { Entry.dispatchEvent("hwChanged"); Entry.toast.success( "하드웨어 연결 성공", - /* Lang.Menus.connect_message.replace( - "%1", - Lang.Device[Entry.hw.hwModule.name] - ) +*/ "하드웨어 아이콘을 더블클릭하면, 센서값만 확인할 수 있습니다.", - true + "하드웨어 아이콘을 더블클릭하면, 센서값만 확인할 수 있습니다.", + false ); if (this.hwModule.monitorTemplate) { - if(!this.hwMonitor) { - this.hwMonitor =new Entry.HWMonitor(this.hwModule); + this.hwMonitor = new Entry.HWMonitor(this.hwModule); } else { this.hwMonitor._hwModule = this.hwModule; this.hwMonitor.initView(); } Entry.propertyPanel.addMode("hw", this.hwMonitor); var mt = this.hwModule.monitorTemplate; - if(mt.mode == "both") { mt.mode = "list"; this.hwMonitor.generateListView(); @@ -349,7 +355,6 @@ p.checkDevice = function(data) { } else { this.hwMonitor.generateView(); } - } }; diff --git a/src/hw_monitor.js b/src/hw_monitor.js index 5fede3dead..0b4f8a24d1 100644 --- a/src/hw_monitor.js +++ b/src/hw_monitor.js @@ -4,7 +4,7 @@ goog.provide("Entry.HWMontior"); goog.require("Entry.Utils"); Entry.HWMonitor = function(hwModule) { - this.svgDom = Entry.Dom( + this.svgDom = Entry.Dom( $('') ); @@ -16,27 +16,27 @@ Entry.HWMonitor = function(hwModule) { if(mode == 'both'){ that.resize(); that.resizeList(); - }if(mode == 'list') { + } + + if(mode == 'list') { that.resizeList(); } else { that.resize(); } - }); - Entry.addEventListener('hwModeChange', function() { - that.changeMode(); - }); + }); + Entry.addEventListener('hwModeChange', function() { + that.changeMode(); + }); this.changeOffset = 0; // 0 : off 1: on this.scale = 0.5; this._listPortViews = {}; }; (function(p) { - /** - */ - p.initView =function() { + p.initView = function() { this.svgDom = Entry.Dom( $('') - ); + ); }; p.generateView = function() { this.snap = Entry.SVG('hwMonitor'); @@ -48,8 +48,6 @@ Entry.HWMonitor = function(hwModule) { w: [] }; - - var monitorTemplate = this._hwModule.monitorTemplate; var imgObj = { @@ -87,16 +85,12 @@ Entry.HWMonitor = function(hwModule) { portsTemp.map(function(v) { var degree = (Math.atan2(-v.box.y, v.box.x)/Math.PI + 2) % 2; var map; - /* - if (degree >= 0.25 && degree < 0.75) map = portMap.n; - else if (degree >= 0.75 && degree < 1.25) map = portMap.w; - else if (degree >= 1.25 && degree < 1.75) map = portMap.s; - else map = portMap.e; - */ - if (degree < 1) + + if (degree < 1) { map = portMap.n; - else + } else { map = portMap.s; + } map.push(v); }); @@ -114,9 +108,9 @@ Entry.HWMonitor = function(hwModule) { $(this._svglistGroup).remove(); - if(this._svgGroup) + if(this._svgGroup) { $(this._svgGroup).remove(); - + } $(this._pathGroup).remove(); this._hwModule.monitorTemplate.mode = 'list'; @@ -133,10 +127,11 @@ Entry.HWMonitor = function(hwModule) { this.generateView(); } }; - p.setHwmonitor = function(module){ + p.setHwmonitor = function(module) { this._hwmodule = module; } + p.changeMode = function(e) { if(this._hwModule.monitorTemplate.mode == 'both') { this.toggleMode('list'); @@ -147,23 +142,26 @@ Entry.HWMonitor = function(hwModule) { } }; - p.addPortEle = function(listPort , ports ) { - if(typeof ports != 'object') + if(typeof ports != 'object') { return listPort; + } - for (var item in ports) + for (var item in ports) { listPort[item] = ports[item]; + } return listPort; }; p.removePortEle = function(listPort, ports) { - if(typeof ports != 'object') + if(typeof ports != 'object'){ return listPort; + } - for(var item in ports) + for(var item in ports) { delete listPort[item] + } return listPort; } @@ -211,7 +209,6 @@ Entry.HWMonitor = function(hwModule) { "stroke-width": 3 }); - var wrapperRect = svgGroup.elem("rect").attr({ "x" : 0, "y" : 0, @@ -345,11 +342,15 @@ Entry.HWMonitor = function(hwModule) { }; p.resize = function() { - if(this.hwView) - this.hwView.attr({ "transform" : "scale(" + this.scale + ")" }); + if(this.hwView) { + this.hwView.attr({ + "transform" : "scale(" + this.scale + ")" + }); + } - if(this.svgDom) + if(this.svgDom) { var bRect = this.svgDom.get(0).getBoundingClientRect(); + } var mode = this._hwModule.monitorTemplate.mode; @@ -359,52 +360,18 @@ Entry.HWMonitor = function(hwModule) { this._rect = bRect; - if(this._template.height <=0 || bRect.height <=0) + if(this._template.height <=0 || bRect.height <=0) { return; -// this.scale = (this._template.height/100 *(bRect.height /1000)); - this.scale = (this._template.height *(bRect.height /this._template.height))/1000; - var temp = (1-this.scale)/2; - - //if(this.scale + (this.scale/2) < 1) - // this.scale += (this.scale/2); - /* if((this._template.height * (this.scale + temp) > bRect.height)) { - this.scale += temp; - }else { - this.scale -= temp; - } -*/ - // if(this.scale < 0) - // this.scale = 0.1; - /* else { - this.scale -= temp/2; - - if(this.scale < 0.1) - this.scale = 0.1; } - */ - // var temp = (this._template.height - bRect.height)/bRect.height; -/* if(this._template.height*this.scale > bRect.height) { - this.scale = (bRect.height/this._template.height - temp/2); - this.scale = this.scale <0 ? -this.scale : this.scale; - - } -*/ - //if(mode == 'both'){ - // var imageBoxHeight = this._svgGroup.getBBox().height; - // var listHeight = this._svglistGroup.getBBox().height; - // var height = imageBoxHeight + (listHeight*0.565); - //// if(bRect.height < height) - // this.toastmsg.warning('알립니다!' ,"하드웨어아이콘을 더블클릭하면, 센서값만 확인할 수 있습니다. "); - // } + this.scale = (this._template.height * (bRect.height /this._template.height)) / 1000; + var temp = (1-this.scale)/2; this.align(); }; p.resizeList = function() { var bRect = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({ - "transform" : "translate(" + bRect.width / 2 + "," + bRect.height / 2 + ")" - }); + this._svglistGroup.attr({ "transform" : "translate(" + bRect.width / 2 + "," + bRect.height / 2 + ")" }); this._rect = bRect; this.alignList(); }; @@ -427,8 +394,6 @@ Entry.HWMonitor = function(hwModule) { }; p.alignList = function() { - //for (var direction in this._portMap) { - //var ports = this._portMap[direction]; var mode = this._hwModule.monitorTemplate.mode; var ports = {}; ports = this._hwModule.monitorTemplate.listPorts; @@ -437,8 +402,7 @@ Entry.HWMonitor = function(hwModule) { var port = ports[i]; port.group.attr({ - "transform" : "translate(" + this._template.width * (i / length - 0.5) + "," + - (- this._template.width/2 - 30) + ")" + "transform" : "translate(" + this._template.width * (i / length - 0.5) + "," + (- this._template.width/2 - 30) + ")" }); } @@ -457,50 +421,47 @@ Entry.HWMonitor = function(hwModule) { listVLine = 0, mode = this._hwModule.monitorTemplate; - for(var i=0; i < length; i++) { - wholeHeight += ports[i].height + 5; - } - - if (wholeHeight < bP - tP) { - bP = wholeHeight / 2 + 3; - tP = - wholeHeight / 2 - 3; - } - - while (length > 1) { - var tPort = ports.shift(), - bPort = ports.pop(), - prevTP = tP, - prevBP = bP, - gapTemp = gap; - if (wholeWidth <= bP - tP) { - tP += tPort.width + 5; - bP -= bPort.width + 5; - gapTemp = 0; - } else if (ports.length === 0) { - tP = (tP + bP) / 2 - 3; - bP = tP + 6; - } else { - tP = Math.max(tP, - width / 2 + tPort.width) + 15; - bP = Math.min(bP, width / 2 - bPort.width) - 15; - } + for(var i=0; i < length; i++) { + wholeHeight += ports[i].height + 5; + } - wholeWidth -= tPort.width + bPort.width + 10; - xCursor += gapTemp; - }; + if (wholeHeight < bP - tP) { + bP = wholeHeight / 2 + 3; + tP = - wholeHeight / 2 - 3; + } + while (length > 1) { + var tPort = ports.shift(), + bPort = ports.pop(), + prevTP = tP, + prevBP = bP, + gapTemp = gap; + if (wholeWidth <= bP - tP) { + tP += tPort.width + 5; + bP -= bPort.width + 5; + gapTemp = 0; + } else if (ports.length === 0) { + tP = (tP + bP) / 2 - 3; + bP = tP + 6; + } else { + tP = Math.max(tP, - width / 2 + tPort.width) + 15; + bP = Math.min(bP, width / 2 - bPort.width) - 15; + } - // + wholeWidth -= tPort.width + bPort.width + 10; + xCursor += gapTemp; + }; if (ports.length) { ports[0].group.attr({ "transform" : "translate(" + xCursor + "," + 60 + ")" }); } + if(tPort && rPort) { this._movePort(tPort, xCursor, tP, prevTP); this._movePort(rPort, xCursor, bP, prevBP); } - }; p._alignNS = function(ports, yCursor, gap) { @@ -550,11 +511,6 @@ Entry.HWMonitor = function(hwModule) { if (ports.length) { this._movePort(ports[0], (rP + lP - ports[0].width) / 2, yCursor, 100); }; - - - - - }; p._alignNSList = function(ports, yCursor) { @@ -566,8 +522,9 @@ Entry.HWMonitor = function(hwModule) { wholeWidth = 0, listLine = 0; - for (var i = 0; i < ports.length; i++) + for (var i = 0; i < ports.length; i++) { wholeWidth += ports[i].width; // 전체 width + } var lineIndent = 0; var currentWidth = 0; @@ -594,7 +551,6 @@ Entry.HWMonitor = function(hwModule) { initX = tempXpos; currentWidth = 0; } - } }; @@ -605,7 +561,6 @@ Entry.HWMonitor = function(hwModule) { var portX = port.box.x * this.scale, portY = port.box.y * this.scale; - if (x > prevPointer) { // left side groupX = x - port.width; if (x > portX && portX > prevPointer) diff --git a/src/property_panel.js b/src/property_panel.js index c2dfea123d..7058b84614 100644 --- a/src/property_panel.js +++ b/src/property_panel.js @@ -69,7 +69,6 @@ Entry.PropertyPanel = function() { } } - this.modes[mode] = { obj: contentObj, tabDom: tabDom, @@ -81,7 +80,23 @@ Entry.PropertyPanel = function() { Entry.dispatchEvent('hwModeChange'); })); } - }; + }; + + p.removeMode = function(mode) { + if (this.modes[mode]) { + this.modes[mode].tabDom.remove(); + this.modes[mode].contentDom.remove(); + if(mode == 'hw'){ + $(this.modes).removeClass('.propertyTabhw'); + $('.propertyTabhw').unbind('dblclick'); + } + } + + var keys = Object.keys(this.modes); + if(keys && keys.length > 0) { + this.select(keys[0]); + } + } p.resize = function(canvasSize) { var canvasHeight = canvasSize*9/16; From fe26922367e4f42014b879c7b98a17bcabb5057f Mon Sep 17 00:00:00 2001 From: jykim Date: Mon, 17 Oct 2016 18:58:02 +0900 Subject: [PATCH 04/17] =?UTF-8?q?=EC=9E=AC=EC=97=B0=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=ED=95=98=EB=93=9C=EC=9B=A8=EC=96=B4=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EB=9E=A8=20=EC=8B=A4=ED=96=89=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 31 ++++++++++--------- extern/util/static.js | 1 + src/hw.js | 60 +++++++++++++++++++----------------- src/workspace/block_entry.js | 24 ++++++++++++++- 4 files changed, 72 insertions(+), 44 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index db36ab21fd..92631470f2 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -10139,8 +10139,9 @@ Entry.HWMonitor = function(a) { }; })(Entry.HWMonitor.prototype); Entry.HW = function() { - this.sessionRoomId = sessionStorage.getItem("entryhwRoomId"); - this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), sessionStorage.setItem("entryhwRoomId", this.sessionRoomId)); + this.sessionRoomId = localStorage.getItem("entryhwRoomId"); + this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), localStorage.setItem("entryhwRoomId", this.sessionRoomId)); + console.log(this.sessionRoomId); this.connectTrial = 0; this.isFirstConnect = !0; this.initSocket(); @@ -10179,25 +10180,26 @@ p.connectWebSocket = function(a, b) { }); d.on("message", function(b) { if (b.data && "string" === typeof b.data) { - b = JSON.parse(b.data), c.checkDevice(b), c.updatePortData(b); - } else { - if ("string" === typeof b) { - switch(console.log(b), b) { - case "disconnectHardware": - c.disconnectHardware(); - } + switch(b.data) { + case "disconnectHardware": + c.disconnectHardware(); + break; + default: + b = JSON.parse(b.data), c.checkDevice(b), c.updatePortData(b); } } }); d.on("disconnect", function() { console.log("disconnect"); - c.aaa ? (c.aaa = !1, c.initSocket()) : "WebSocket" === c.socketType && c.disconnectedSocket(); + c.isOpenHardware ? (c.isOpenHardware = !1, c.initSocket()) : "WebSocket" === c.socketType && c.disconnectedSocket(); }); return d; }; p.initSocket = function() { try { this.connected = !1; + this.tlsSocketIo && this.tlsSocketIo.removeAllListeners(); + this.socketIo && this.socketIo.removeAllListeners(); if (-1 < location.protocol.indexOf("https")) { this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); } else { @@ -10210,14 +10212,16 @@ p.initSocket = function() { } catch (a) { } } - window.a = this.tlsSocketIo; - window.b = this.socketIo; Entry.dispatchEvent("hwChanged"); } catch (a) { } }; p.retryConnect = function() { - this.aaa = !0; + Entry.HW.TRIAL_LIMIT = 5; + this.initSocket(); +}; +p.openHardwareProgram = function() { + this.isOpenHardware = !0; Entry.HW.TRIAL_LIMIT = 5; this.socket ? this.executeHardware() : (this.executeHardware(), this.initSocket()); }; @@ -10232,7 +10236,6 @@ p.disconnectHardware = function() { Entry.propertyPanel.removeMode("hw"); this.hwModule = this.selectedDevice = void 0; Entry.dispatchEvent("hwChanged"); - Entry.toast.alert("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc885\ub8cc", "\ud558\ub4dc\uc6e8\uc5b4\uc758 \uc5f0\uacb0\uc774 \uc885\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", !1); }; p.disconnectedSocket = function() { this.tlsSocketIo.close(); diff --git a/extern/util/static.js b/extern/util/static.js index 75fe0a8b50..26326b6013 100644 --- a/extern/util/static.js +++ b/extern/util/static.js @@ -272,6 +272,7 @@ EntryStatic.getAllBlocks = function() { "arduino_download_source", "arduino_connected", "arduino_reconnect", + "arduino_open", "arduino_get_number_sensor_value", "arduino_get_digital_value", "arduino_toggle_led", diff --git a/src/hw.js b/src/hw.js index 7b127e10f1..17514525b4 100644 --- a/src/hw.js +++ b/src/hw.js @@ -6,11 +6,12 @@ goog.require("Entry.HWMontior"); Entry.HW = function() { - this.sessionRoomId = sessionStorage.getItem('entryhwRoomId'); + this.sessionRoomId = localStorage.getItem('entryhwRoomId'); if(!this.sessionRoomId) { this.sessionRoomId = this.createRandomRoomId(); - sessionStorage.setItem('entryhwRoomId', this.sessionRoomId); + localStorage.setItem('entryhwRoomId', this.sessionRoomId); } + console.log(this.sessionRoomId); this.connectTrial = 0; this.isFirstConnect = true; @@ -88,24 +89,25 @@ p.connectWebSocket = function(url, option) { socket.on('message', function(msg) { if(msg.data && typeof msg.data === 'string') { - var data = JSON.parse(msg.data); - hw.checkDevice(data); - hw.updatePortData(data); - } else if(typeof msg === 'string') { - console.log(msg); - switch(msg) { + switch(msg.data) { case 'disconnectHardware': { hw.disconnectHardware(); break; } + default: { + var data = JSON.parse(msg.data); + hw.checkDevice(data); + hw.updatePortData(data); + break; + } } } }); socket.on('disconnect', function() { console.log('disconnect'); - if(hw.aaa) { - hw.aaa = false; + if(hw.isOpenHardware) { + hw.isOpenHardware = false; hw.initSocket(); } else if(hw.socketType === 'WebSocket') { hw.disconnectedSocket(); @@ -131,18 +133,16 @@ p.connectWebSocket = function(url, option) { p.initSocket = function() { try{ - // if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - // if (!this.isFirstConnect) - // Entry.toast.alert(Lang.Menus.connect_hw, - // Lang.Menus.connect_fail, - // false); - // this.isFirstConnect = false; - // return; - // } - var hw = this; var protocol = ''; this.connected = false; + + if(this.tlsSocketIo) { + this.tlsSocketIo.removeAllListeners(); + } + if(this.socketIo) { + this.socketIo.removeAllListeners(); + } if(location.protocol.indexOf('https') > -1) { this.tlsSocketIo = this.connectWebSocket('https://hardware.play-entry.org:23518', { query:{ 'client': true, 'roomId' : this.sessionRoomId } }); @@ -156,15 +156,17 @@ p.initSocket = function() { } catch(e) { } } - window.a = this.tlsSocketIo; - window.b = this.socketIo; - Entry.dispatchEvent("hwChanged"); } catch(e) {} }; p.retryConnect = function() { - this.aaa = true; + Entry.HW.TRIAL_LIMIT = 5; + this.initSocket(); +}; + +p.openHardwareProgram = function() { + this.isOpenHardware = true; Entry.HW.TRIAL_LIMIT = 5; if(this.socket) { this.executeHardware(); @@ -172,7 +174,7 @@ p.retryConnect = function() { this.executeHardware(); this.initSocket(); } -}; +} p.initHardware = function(socket) { this.socket = socket; @@ -189,11 +191,11 @@ p.disconnectHardware = function() { this.selectedDevice = undefined; this.hwModule = undefined; Entry.dispatchEvent("hwChanged"); - Entry.toast.alert( - "하드웨어 연결 종료", - "하드웨어의 연결이 종료되었습니다.", - false - ); + // Entry.toast.alert( + // "하드웨어 연결 종료", + // "하드웨어의 연결이 종료되었습니다.", + // false + // ); } p.disconnectedSocket = function() { this.tlsSocketIo.close(); diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 0a6a9da1a7..7d7849b512 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -2879,7 +2879,7 @@ Entry.block = { "arduino_reconnect": { "skeleton": "basic_button", "color": "#eee", - "isNotFor": [""], + "isNotFor": ["arduinoDisconnected"], "params": [ { "type": "Text", @@ -2896,6 +2896,28 @@ Entry.block = { ] } }, + "arduino_open": { + "skeleton": "basic_button", + "color": "#eee", + "isNotFor": [""], + "template": '%1', + "params": [ + { + "type": "Text", + //TODO: 다국어 적용 + "text": '하드웨어 프로그램 열기', + "color": "#333", + "align": "center" + } + ], + "events": { + "mousedown": [ + function() { + Entry.hw.openHardwareProgram(); + } + ] + } + }, //2016-09-23 added start "CODEino_get_sensor_number": { "color": "#00979D", From 962d8e7c24d4bae59b947f80c893197e7caf0300 Mon Sep 17 00:00:00 2001 From: jykim Date: Tue, 18 Oct 2016 18:21:14 +0900 Subject: [PATCH 05/17] =?UTF-8?q?single=20=EB=AA=A8=EB=93=9C=EC=97=90?= =?UTF-8?q?=EC=84=9C=20multi=EB=AA=A8=EB=93=9C=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=8B=9C=20=ED=95=98=EB=93=9C=EC=9B=A8=EC=96=B4=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EC=9E=A0=EC=8B=9C=20=EC=A2=85=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 1 + src/hw.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/dist/entry.js b/dist/entry.js index 92631470f2..ce2339b24f 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -10176,6 +10176,7 @@ p.connectWebSocket = function(a, b) { d.emit("matchTarget", {target:b}); }); d.on("mode", function(b) { + 0 === d.mode && 1 === b && c.disconnectHardware(); d.mode = b; }); d.on("message", function(b) { diff --git a/src/hw.js b/src/hw.js index 17514525b4..d35540f510 100644 --- a/src/hw.js +++ b/src/hw.js @@ -84,6 +84,9 @@ p.connectWebSocket = function(url, option) { }); socket.on('mode', function (mode) { + if(socket.mode === 0 && mode === 1) { + hw.disconnectHardware(); + } socket.mode = mode; }); From 08de1bbf25777cd58db6ab7d2de8ea5343dffd81 Mon Sep 17 00:00:00 2001 From: jykim Date: Fri, 21 Oct 2016 11:35:04 +0900 Subject: [PATCH 06/17] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.css | 1 + dist/entry.js | 37231 ++++++++++++++++---------------- dist/entry.min.js | 3769 ++-- src/css/components/popup.less | 1 + src/hw.js | 204 +- src/popup_helper.js | 65 +- 6 files changed, 20653 insertions(+), 20618 deletions(-) diff --git a/dist/entry.css b/dist/entry.css index 64ba1e04db..b38a1da1f3 100644 --- a/dist/entry.css +++ b/dist/entry.css @@ -5222,6 +5222,7 @@ input.entryObjectNameWorkspace:-moz-read-only { background-color: rgba(0, 0, 0, 0.6); } .entryPopup.popupHelper { + position: fixed; display: -webkit-box; display: -moz-box; display: -ms-flexbox; diff --git a/dist/entry.js b/dist/entry.js index ce2339b24f..0e5663e523 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1,14 +1,14 @@ -var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(a) { - a || (a = Entry.getStartProject(Entry.mediaFilePath)); +var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) { + b || (b = Entry.getStartProject(Entry.mediaFilePath)); "workspace" == this.type && Entry.stateManager.startIgnore(); - Entry.projectId = a._id; - Entry.variableContainer.setVariables(a.variables); - Entry.variableContainer.setMessages(a.messages); - Entry.scene.addScenes(a.scenes); + Entry.projectId = b._id; + Entry.variableContainer.setVariables(b.variables); + Entry.variableContainer.setMessages(b.messages); + Entry.scene.addScenes(b.scenes); Entry.stage.initObjectContainers(); - Entry.variableContainer.setFunctions(a.functions); - Entry.container.setObjects(a.objects); - Entry.FPS = a.speed ? a.speed : 60; + Entry.variableContainer.setFunctions(b.functions); + Entry.container.setObjects(b.objects); + Entry.FPS = b.speed ? b.speed : 60; createjs.Ticker.setFPS(Entry.FPS); "workspace" == this.type && setTimeout(function() { Entry.stateManager.endIgnore(); @@ -17,37 +17,35 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: 0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer(); Entry.start(); Entry.Loader.isLoaded() && Entry.Loader.handleLoad(); - return a; -}, exportProject:function(a) { - a || (a = {}); + return b; +}, exportProject:function(b) { + b || (b = {}); Entry.engine.isState("stop") || Entry.engine.toggleStop(); Entry.Func && Entry.Func.workspace && Entry.Func.workspace.visible && Entry.Func.cancelEdit(); - a.objects = Entry.container.toJSON(); - a.scenes = Entry.scene.toJSON(); - a.variables = Entry.variableContainer.getVariableJSON(); - a.messages = Entry.variableContainer.getMessageJSON(); - a.functions = Entry.variableContainer.getFunctionJSON(); - a.scenes = Entry.scene.toJSON(); - a.speed = Entry.FPS; - return a; -}, setBlockByText:function(a, b) { - a = []; - b = jQuery.parseXML(b).getElementsByTagName("category"); - for (var c = 0;c < b.length;c++) { - for (var d = b[c], e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes, f = 0;f < d.length;f++) { - var g = d[f]; - !g.tagName || "BLOCK" != g.tagName.toUpperCase() && "BTN" != g.tagName.toUpperCase() || e.blocks.push(g.getAttribute("type")); - } - a.push(e); - } - Entry.playground.setBlockMenu(a); -}, setBlock:function(a, b) { - Entry.playground.setMenuBlock(a, b); + b.objects = Entry.container.toJSON(); + b.scenes = Entry.scene.toJSON(); + b.variables = Entry.variableContainer.getVariableJSON(); + b.messages = Entry.variableContainer.getMessageJSON(); + b.functions = Entry.variableContainer.getFunctionJSON(); + b.scenes = Entry.scene.toJSON(); + b.speed = Entry.FPS; + return b; +}, setBlockByText:function(b, a) { + for (var d = [], c = jQuery.parseXML(a).getElementsByTagName("category"), e = 0;e < c.length;e++) { + for (var f = c[e], g = {category:f.getAttribute("id"), blocks:[]}, f = f.childNodes, h = 0;h < f.length;h++) { + var k = f[h]; + !k.tagName || "BLOCK" != k.tagName.toUpperCase() && "BTN" != k.tagName.toUpperCase() || g.blocks.push(k.getAttribute("type")); + } + d.push(g); + } + Entry.playground.setBlockMenu(d); +}, setBlock:function(b, a) { + Entry.playground.setMenuBlock(b, a); }, enableArduino:function() { -}, initSound:function(a) { - a.path = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/" + a.filename + a.ext; - Entry.soundQueue.loadFile({id:a.id, src:a.path, type:createjs.LoadQueue.SOUND}); -}, beforeUnload:function(a) { +}, initSound:function(b) { + b.path = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/" + b.filename + b.ext; + Entry.soundQueue.loadFile({id:b.id, src:b.path, type:createjs.LoadQueue.SOUND}); +}, beforeUnload:function(b) { Entry.hw.closeConnection(); Entry.variableContainer.updateCloudVariables(); if ("workspace" == Entry.type && (localStorage && Entry.interfaceState && localStorage.setItem("workspace-interface", JSON.stringify(Entry.interfaceState)), !Entry.stateManager.isSaved())) { @@ -56,178 +54,177 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }, loadInterfaceState:function() { if ("workspace" == Entry.type) { if (localStorage && localStorage.getItem("workspace-interface")) { - var a = localStorage.getItem("workspace-interface"); - this.resizeElement(JSON.parse(a)); + var b = localStorage.getItem("workspace-interface"); + this.resizeElement(JSON.parse(b)); } else { this.resizeElement({menuWidth:280, canvasWidth:480}); } } -}, resizeElement:function(a) { +}, resizeElement:function(b) { if ("workspace" == Entry.type) { - var b = this.interfaceState; - !a.canvasWidth && b.canvasWidth && (a.canvasWidth = b.canvasWidth); - !a.menuWidth && this.interfaceState.menuWidth && (a.menuWidth = b.menuWidth); + var a = this.interfaceState; + !b.canvasWidth && a.canvasWidth && (b.canvasWidth = a.canvasWidth); + !b.menuWidth && this.interfaceState.menuWidth && (b.menuWidth = a.menuWidth); Entry.engine.speedPanelOn && Entry.engine.toggleSpeedPanel(); - (b = a.canvasWidth) ? 325 > b ? b = 325 : 720 < b && (b = 720) : b = 400; - a.canvasWidth = b; - var c = 9 * b / 16; - Entry.engine.view_.style.width = b + "px"; - Entry.engine.view_.style.height = c + "px"; + (a = b.canvasWidth) ? 325 > a ? a = 325 : 720 < a && (a = 720) : a = 400; + b.canvasWidth = a; + var d = 9 * a / 16; + Entry.engine.view_.style.width = a + "px"; + Entry.engine.view_.style.height = d + "px"; Entry.engine.view_.style.top = "40px"; - Entry.stage.canvas.canvas.style.width = b + "px"; - 400 <= b ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); - Entry.playground.view_.style.left = b + .5 + "px"; - Entry.propertyPanel.resize(b); - var d = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; - d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * b + "px") : d.style.display = "none"); - if (d = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b - 4 + "px"); - } - if (d = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b + "px"); - } - (b = a.menuWidth) ? 244 > b ? b = 244 : 400 < b && (b = 400) : b = 264; - a.menuWidth = b; - $(".blockMenuContainer").css({width:b - 64 + "px"}); - $(".blockMenuContainer>svg").css({width:b - 64 + "px"}); + Entry.stage.canvas.canvas.style.width = a + "px"; + 400 <= a ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); + Entry.playground.view_.style.left = a + .5 + "px"; + Entry.propertyPanel.resize(a); + var c = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; + c && (Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.width = .7 * a + "px") : c.style.display = "none"); + if (c = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { + Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.left = .7 * a + "px", c.style.width = .3 * a + "px") : (c.style.left = "2px", c.style.top = d + 24 + "px", c.style.width = a - 4 + "px"); + } + if (c = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { + Entry.objectAddable ? (c.style.top = d + 24 + "px", c.style.left = .7 * a + "px", c.style.width = .3 * a + "px") : (c.style.left = "2px", c.style.top = d + 24 + "px", c.style.width = a + "px"); + } + (a = b.menuWidth) ? 244 > a ? a = 244 : 400 < a && (a = 400) : a = 264; + b.menuWidth = a; + $(".blockMenuContainer").css({width:a - 64 + "px"}); + $(".blockMenuContainer>svg").css({width:a - 64 + "px"}); Entry.playground.mainWorkspace.blockMenu.setWidth(); - $(".entryWorkspaceBoard").css({left:b + "px"}); - Entry.playground.resizeHandle_.style.left = b + "px"; - Entry.playground.variableViewWrapper_.style.width = b + "px"; - this.interfaceState = a; + $(".entryWorkspaceBoard").css({left:a + "px"}); + Entry.playground.resizeHandle_.style.left = a + "px"; + Entry.playground.variableViewWrapper_.style.width = a + "px"; + this.interfaceState = b; } Entry.windowResized.notify(); }, getUpTime:function() { return (new Date).getTime() - this.startTime; -}, addActivity:function(a) { - Entry.stateManager && Entry.stateManager.addActivity(a); +}, addActivity:function(b) { + Entry.stateManager && Entry.stateManager.addActivity(b); }, startActivityLogging:function() { Entry.reporter && Entry.reporter.start(Entry.projectId, window.user ? window.user._id : null, Entry.startTime); }, getActivityLog:function() { - var a = {}; - Entry.stateManager && (a.activityLog = Entry.stateManager.activityLog_); - return a; -}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(a) { - var b = Entry.playground.object; - if (b) { - var c = a.target, d = 0 !== $(b.view_).find(c).length, c = c.tagName.toUpperCase(); - a = a.type; - !b.isEditing || "INPUT" === c && d || "touchstart" === a || b.editObjectValues(!1); + var b = {}; + Entry.stateManager && (b.activityLog = Entry.stateManager.activityLog_); + return b; +}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(b) { + var a = Entry.playground.object; + if (a) { + var d = b.target, c = 0 !== $(a.view_).find(d).length, d = d.tagName.toUpperCase(); + b = b.type; + !a.isEditing || "INPUT" === d && c || "touchstart" === b || a.editObjectValues(!1); } -}, generateFunctionSchema:function(a) { - a = "func_" + a; - if (!Entry.block[a]) { - var b = function() { +}, generateFunctionSchema:function(b) { + b = "func_" + b; + if (!Entry.block[b]) { + var a = function() { }; - b.prototype = Entry.block.function_general; - b = new b; - b.changeEvent = new Entry.Event; - b.template = Lang.template.function_general; - Entry.block[a] = b; + a.prototype = Entry.block.function_general; + a = new a; + a.changeEvent = new Entry.Event; + a.template = Lang.template.function_general; + Entry.block[b] = a; } }}; window.Entry = Entry; Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() { - var a = Entry.Albert.PORT_MAP, b = Entry.hw.sendQueue, c; - for (c in a) { - b[c] = a[c]; + var b = Entry.Albert.PORT_MAP, a = Entry.hw.sendQueue, d; + for (d in b) { + a[d] = b[d]; } Entry.hw.update(); - a = Entry.Albert; - a.tempo = 60; - a.removeAllTimeouts(); + b = Entry.Albert; + b.tempo = 60; + b.removeAllTimeouts(); }, monitorTemplate:{imgPath:"hw/albert.png", width:387, height:503, listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.ALBERT_sensor_acceleration_y, type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.ALBERT_sensor_acceleration_z, type:"input", pos:{x:0, y:0}}, frontOid:{name:Lang.Blocks.ALBERT_sensor_front_oid, type:"input", pos:{x:0, y:0}}, backOid:{name:Lang.Blocks.ALBERT_sensor_back_oid, type:"input", pos:{x:0, y:0}}, positionX:{name:Lang.Blocks.ALBERT_sensor_position_x, type:"input", pos:{x:0, y:0}}, positionY:{name:Lang.Blocks.ALBERT_sensor_position_y, type:"input", pos:{x:0, y:0}}, orientation:{name:Lang.Blocks.ALBERT_sensor_orientation, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_left_proximity, type:"input", pos:{x:178, y:401}}, rightProximity:{name:Lang.Blocks.ALBERT_sensor_right_proximity, type:"input", pos:{x:66, y:359}}, battery:{name:Lang.Blocks.ALBERT_sensor_battery, type:"input", pos:{x:88, y:368}}, light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input", pos:{x:127, y:391}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:299, y:406}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:22, y:325}}, leftEye:{name:Lang.Hw.leftEye, type:"output", pos:{x:260, y:26}}, -rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{name:Lang.Hw.body + " " + Lang.Hw.led_en, type:"output", pos:{x:367, y:308}}, frontLed:{name:Lang.Hw.front + " " + Lang.Hw.led_en, pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(a) { - clearTimeout(a); - var b = this.timeouts; - a = b.indexOf(a); - 0 <= a && b.splice(a, 1); +rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{name:Lang.Hw.body + " " + Lang.Hw.led_en, type:"output", pos:{x:367, y:308}}, frontLed:{name:Lang.Hw.front + " " + Lang.Hw.led_en, pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); }, removeAllTimeouts:function() { - var a = this.timeouts, b; - for (b in a) { - clearTimeout(a[b]); + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); } this.timeouts = []; }, controller:{PI:3.14159265, PI2:6.2831853, prevDirection:0, prevDirectionFine:0, directionFineCount:0, positionCount:0, finalPositionCount:0, GAIN_ANGLE:30, GAIN_ANGLE_FINE:30, GAIN_POSITION_FINE:30, STRAIGHT_SPEED:20, MAX_BASE_SPEED:20, GAIN_BASE_SPEED:1, GAIN_POSITION:35, POSITION_TOLERANCE_FINE:3, POSITION_TOLERANCE_FINE_LARGE:5, POSITION_TOLERANCE_ROUGH:5, POSITION_TOLERANCE_ROUGH_LARGE:10, ORIENTATION_TOLERANCE_FINE:.08, ORIENTATION_TOLERANCE_ROUGH:.09, ORIENTATION_TOLERANCE_ROUGH_LARGE:.18, MINIMUM_WHEEL_SPEED:18, MINIMUM_WHEEL_SPEED_FINE:15, clear:function() { this.finalPositionCount = this.positionCount = this.directionFineCount = this.prevDirectionFine = this.prevDirection = 0; -}, controlAngleFine:function(a, b) { - var c = Entry.hw.sendQueue; - a = this.validateRadian(b - a); - b = Math.abs(a); - if (b < this.ORIENTATION_TOLERANCE_FINE) { +}, controlAngleFine:function(b, a) { + var d = Entry.hw.sendQueue, c = this.validateRadian(a - b), e = Math.abs(c); + if (e < this.ORIENTATION_TOLERANCE_FINE) { return !1; } - var d = 0 < a ? 1 : -1; - if (0 > d * this.prevDirectionFine && 5 < ++this.directionFineCount) { + var f = 0 < c ? 1 : -1; + if (0 > f * this.prevDirectionFine && 5 < ++this.directionFineCount) { return !1; } - this.prevDirectionFine = d; - 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE_FINE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE_FINE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); - a = parseInt(a); - c.leftWheel = -a; - c.rightWheel = a; + this.prevDirectionFine = f; + f = 0; + 0 < c ? (f = Math.log(1 + e) * this.GAIN_ANGLE_FINE, f < this.MINIMUM_WHEEL_SPEED && (f = this.MINIMUM_WHEEL_SPEED)) : (f = -Math.log(1 + e) * this.GAIN_ANGLE_FINE, f > -this.MINIMUM_WHEEL_SPEED && (f = -this.MINIMUM_WHEEL_SPEED)); + f = parseInt(f); + d.leftWheel = -f; + d.rightWheel = f; return !0; -}, controlAngle:function(a, b) { - var c = Entry.hw.sendQueue; - a = this.validateRadian(b - a); - b = Math.abs(a); - if (b < this.ORIENTATION_TOLERANCE_ROUGH) { +}, controlAngle:function(b, a) { + var d = Entry.hw.sendQueue, c = this.validateRadian(a - b), e = Math.abs(c); + if (e < this.ORIENTATION_TOLERANCE_ROUGH) { return !1; } - var d = 0 < a ? 1 : -1; - if (b < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && 0 > d * this.prevDirection) { + var f = 0 < c ? 1 : -1; + if (e < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && 0 > f * this.prevDirection) { return !1; } - this.prevDirection = d; - 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); - a = parseInt(a); - c.leftWheel = -a; - c.rightWheel = a; + this.prevDirection = f; + f = 0; + 0 < c ? (f = Math.log(1 + e) * this.GAIN_ANGLE, f < this.MINIMUM_WHEEL_SPEED && (f = this.MINIMUM_WHEEL_SPEED)) : (f = -Math.log(1 + e) * this.GAIN_ANGLE, f > -this.MINIMUM_WHEEL_SPEED && (f = -this.MINIMUM_WHEEL_SPEED)); + f = parseInt(f); + d.leftWheel = -f; + d.rightWheel = f; return !0; -}, controlPositionFine:function(a, b, c, d, e) { +}, controlPositionFine:function(b, a, d, c, e) { var f = Entry.hw.sendQueue; - c = this.validateRadian(Math.atan2(e - b, d - a) - c); - var g = Math.abs(c); - a = d - a; - b = e - b; - b = Math.sqrt(a * a + b * b); - if (b < this.POSITION_TOLERANCE_FINE) { + d = this.validateRadian(Math.atan2(e - a, c - b) - d); + var g = Math.abs(d); + b = c - b; + a = e - a; + a = Math.sqrt(b * b + a * a); + if (a < this.POSITION_TOLERANCE_FINE) { return !1; } - if (b < this.POSITION_TOLERANCE_FINE_LARGE && 5 < ++this.finalPositionCount) { + if (a < this.POSITION_TOLERANCE_FINE_LARGE && 5 < ++this.finalPositionCount) { return this.finalPositionCount = 0, !1; } - c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION_FINE : -Math.log(1 + g) * this.GAIN_POSITION_FINE; - c = parseInt(c); - f.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - c; - f.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + c; + a = 0; + a = 0 < d ? Math.log(1 + g) * this.GAIN_POSITION_FINE : -Math.log(1 + g) * this.GAIN_POSITION_FINE; + a = parseInt(a); + f.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - a; + f.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + a; return !0; -}, controlPosition:function(a, b, c, d, e) { +}, controlPosition:function(b, a, d, c, e) { var f = Entry.hw.sendQueue; - c = this.validateRadian(Math.atan2(e - b, d - a) - c); - var g = Math.abs(c); - a = d - a; - b = e - b; - b = Math.sqrt(a * a + b * b); - if (b < this.POSITION_TOLERANCE_ROUGH) { + d = this.validateRadian(Math.atan2(e - a, c - b) - d); + var g = Math.abs(d); + b = c - b; + a = e - a; + a = Math.sqrt(b * b + a * a); + if (a < this.POSITION_TOLERANCE_ROUGH) { return !1; } - if (b < this.POSITION_TOLERANCE_ROUGH_LARGE) { + if (a < this.POSITION_TOLERANCE_ROUGH_LARGE) { if (10 < ++this.positionCount) { return this.positionCount = 0, !1; } } else { this.positionCount = 0; } - .01 > g ? (f.leftWheel = this.STRAIGHT_SPEED, f.rightWheel = this.STRAIGHT_SPEED) : (b = (this.MINIMUM_WHEEL_SPEED + .5 / g) * this.GAIN_BASE_SPEED, b > this.MAX_BASE_SPEED && (b = this.MAX_BASE_SPEED), c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION : -Math.log(1 + g) * this.GAIN_POSITION, b = parseInt(b), c = parseInt(c), f.leftWheel = b - c, f.rightWheel = b + c); + .01 > g ? (f.leftWheel = this.STRAIGHT_SPEED, f.rightWheel = this.STRAIGHT_SPEED) : (a = (this.MINIMUM_WHEEL_SPEED + .5 / g) * this.GAIN_BASE_SPEED, a > this.MAX_BASE_SPEED && (a = this.MAX_BASE_SPEED), e = 0, e = 0 < d ? Math.log(1 + g) * this.GAIN_POSITION : -Math.log(1 + g) * this.GAIN_POSITION, a = parseInt(a), e = parseInt(e), f.leftWheel = a - e, f.rightWheel = a + e); return !0; -}, validateRadian:function(a) { - return a > this.PI ? a - this.PI2 : a < -this.PI ? a + this.PI2 : a; -}, toRadian:function(a) { - return 3.14159265 * a / 180; +}, validateRadian:function(b) { + return b > this.PI ? b - this.PI2 : b < -this.PI ? b + this.PI2 : b; +}, toRadian:function(b) { + return 3.14159265 * b / 180; }}, name:"albert"}; Blockly.Blocks.albert_hand_found = {init:function() { this.setColour("#00979D"); @@ -235,9 +232,9 @@ Blockly.Blocks.albert_hand_found = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.albert_hand_found = function(a, b) { - a = Entry.hw.portData; - return 40 < a.leftProximity || 40 < a.rightProximity; +Entry.block.albert_hand_found = function(b, a) { + var d = Entry.hw.portData; + return 40 < d.leftProximity || 40 < d.rightProximity; }; Blockly.Blocks.albert_is_oid_value = {init:function() { this.setColour("#00979D"); @@ -247,11 +244,9 @@ Blockly.Blocks.albert_is_oid_value = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.albert_is_oid_value = function(a, b) { - a = Entry.hw.portData; - var c = b.getField("OID", b); - b = b.getNumberValue("VALUE"); - return "FRONT" == c ? a.frontOid == b : a.backOid == b; +Entry.block.albert_is_oid_value = function(b, a) { + var d = Entry.hw.portData, c = a.getField("OID", a), e = a.getNumberValue("VALUE"); + return "FRONT" == c ? d.frontOid == e : d.backOid == e; }; Blockly.Blocks.albert_value = {init:function() { this.setColour("#00979D"); @@ -260,10 +255,9 @@ Blockly.Blocks.albert_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.albert_value = function(a, b) { - a = Entry.hw.portData; - b = b.getField("DEVICE"); - return a[b]; +Entry.block.albert_value = function(b, a) { + var d = Entry.hw.portData, c = a.getField("DEVICE"); + return d[c]; }; Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -274,30 +268,29 @@ Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_forward_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_move_forward_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.leftWheel = 30; - a.rightWheel = 30; - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + d.leftWheel = 30; + d.rightWheel = 30; + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Albert.removeTimeout(c); - }, a); + }, d); Entry.Albert.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -308,30 +301,29 @@ Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_backward_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_move_backward_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.leftWheel = -30; - a.rightWheel = -30; - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + d.leftWheel = -30; + d.rightWheel = -30; + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Albert.removeTimeout(c); - }, a); + }, d); Entry.Albert.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.albert_turn_for_secs = {init:function() { this.setColour("#00979D"); @@ -342,29 +334,28 @@ Blockly.Blocks.albert_turn_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_turn_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_turn_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + "LEFT" == a.getField("DIRECTION", a) ? (d.leftWheel = -30, d.rightWheel = 30) : (d.leftWheel = 30, d.rightWheel = -30); + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Albert.removeTimeout(c); - }, a); + }, d); Entry.Albert.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -377,12 +368,11 @@ Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_both_wheels_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); - a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; - a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; - return b.callReturn(); +Entry.block.albert_change_both_wheels_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); + d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + c : c; + d.rightWheel = void 0 != d.rightWheel ? d.rightWheel + e : e; + return a.callReturn(); }; Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -395,11 +385,11 @@ Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_both_wheels_to = function(a, b) { - a = Entry.hw.sendQueue; - a.leftWheel = b.getNumberValue("LEFT"); - a.rightWheel = b.getNumberValue("RIGHT"); - return b.callReturn(); +Entry.block.albert_set_both_wheels_to = function(b, a) { + var d = Entry.hw.sendQueue; + d.leftWheel = a.getNumberValue("LEFT"); + d.rightWheel = a.getNumberValue("RIGHT"); + return a.callReturn(); }; Blockly.Blocks.albert_change_wheel_by = {init:function() { this.setColour("#00979D"); @@ -410,11 +400,10 @@ Blockly.Blocks.albert_change_wheel_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_wheel_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); - "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); - return b.callReturn(); +Entry.block.albert_change_wheel_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); + "LEFT" == c ? d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + e : e : ("RIGHT" != c && (d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + e : e), d.rightWheel = void 0 != d.rightWheel ? d.rightWheel + e : e); + return a.callReturn(); }; Blockly.Blocks.albert_set_wheel_to = {init:function() { this.setColour("#00979D"); @@ -425,11 +414,10 @@ Blockly.Blocks.albert_set_wheel_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_wheel_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); - "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); - return b.callReturn(); +Entry.block.albert_set_wheel_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); + "LEFT" == c ? d.leftWheel = e : ("RIGHT" != c && (d.leftWheel = e), d.rightWheel = e); + return a.callReturn(); }; Blockly.Blocks.albert_stop = {init:function() { this.setColour("#00979D"); @@ -438,11 +426,11 @@ Blockly.Blocks.albert_stop = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_stop = function(a, b) { - a = Entry.hw.sendQueue; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); +Entry.block.albert_stop = function(b, a) { + var d = Entry.hw.sendQueue; + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); }; Blockly.Blocks.albert_set_pad_size_to = {init:function() { this.setColour("#00979D"); @@ -455,11 +443,11 @@ Blockly.Blocks.albert_set_pad_size_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_pad_size_to = function(a, b) { - a = Entry.hw.sendQueue; - a.padWidth = b.getNumberValue("WIDTH"); - a.padHeight = b.getNumberValue("HEIGHT"); - return b.callReturn(); +Entry.block.albert_set_pad_size_to = function(b, a) { + var d = Entry.hw.sendQueue; + d.padWidth = a.getNumberValue("WIDTH"); + d.padHeight = a.getNumberValue("HEIGHT"); + return a.callReturn(); }; Blockly.Blocks.albert_move_to_x_y_on_board = {init:function() { this.setColour("#00979D"); @@ -472,62 +460,61 @@ Blockly.Blocks.albert_move_to_x_y_on_board = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_to_x_y_on_board = function(a, b) { - var c = Entry.hw.sendQueue, d = Entry.hw.portData; - a = Entry.Albert.controller; - if (b.isStart) { - if (b.isMoving) { - 0 <= d.positionX && (b.x = d.positionX); - 0 <= d.positionY && (b.y = d.positionY); - b.theta = d.orientation; - switch(b.boardState) { +Entry.block.albert_move_to_x_y_on_board = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.hw.portData, e = Entry.Albert.controller; + if (a.isStart) { + if (a.isMoving) { + 0 <= c.positionX && (a.x = c.positionX); + 0 <= c.positionY && (a.y = c.positionY); + a.theta = c.orientation; + switch(a.boardState) { case 1: - if (0 == b.initialized) { - if (0 > b.x || 0 > b.y) { - c.leftWheel = 20; - c.rightWheel = -20; + if (0 == a.initialized) { + if (0 > a.x || 0 > a.y) { + d.leftWheel = 20; + d.rightWheel = -20; break; } - b.initialized = !0; + a.initialized = !0; } - c = a.toRadian(b.theta); - 0 == a.controlAngle(c, Math.atan2(b.targetY - b.y, b.targetX - b.x)) && (b.boardState = 2); + d = e.toRadian(a.theta); + 0 == e.controlAngle(d, Math.atan2(a.targetY - a.y, a.targetX - a.x)) && (a.boardState = 2); break; case 2: - 0 == a.controlPosition(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (b.boardState = 3); + 0 == e.controlPosition(a.x, a.y, e.toRadian(a.theta), a.targetX, a.targetY) && (a.boardState = 3); break; case 3: - 0 == a.controlPositionFine(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (c.leftWheel = 0, c.rightWheel = 0, b.isMoving = !1); + 0 == e.controlPositionFine(a.x, a.y, e.toRadian(a.theta), a.targetX, a.targetY) && (d.leftWheel = 0, d.rightWheel = 0, a.isMoving = !1); } - return b; + return a; } - delete b.isStart; - delete b.isMoving; - delete b.initialized; - delete b.boardState; - delete b.x; - delete b.y; - delete b.theta; - delete b.targetX; - delete b.targetY; + delete a.isStart; + delete a.isMoving; + delete a.initialized; + delete a.boardState; + delete a.x; + delete a.y; + delete a.theta; + delete a.targetX; + delete a.targetY; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.isMoving = !0; - b.initialized = !1; - b.boardState = 1; - b.x = -1; - b.y = -1; - b.theta = -200; - b.targetX = b.getNumberValue("X"); - b.targetY = b.getNumberValue("Y"); - a.clear(); - c.leftWheel = 0; - c.rightWheel = 0; - return b; + a.isStart = !0; + a.isMoving = !0; + a.initialized = !1; + a.boardState = 1; + a.x = -1; + a.y = -1; + a.theta = -200; + a.targetX = a.getNumberValue("X"); + a.targetY = a.getNumberValue("Y"); + e.clear(); + d.leftWheel = 0; + d.rightWheel = 0; + return a; }; Blockly.Blocks.albert_set_orientation_on_board = {init:function() { this.setColour("#00979D"); @@ -538,41 +525,40 @@ Blockly.Blocks.albert_set_orientation_on_board = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_orientation_on_board = function(a, b) { - a = Entry.hw.sendQueue; - var c = Entry.hw.portData, d = Entry.Albert.controller; - if (b.isStart) { - if (b.isMoving) { - b.theta = c.orientation; - switch(b.boardState) { +Entry.block.albert_set_orientation_on_board = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.hw.portData, e = Entry.Albert.controller; + if (a.isStart) { + if (a.isMoving) { + a.theta = c.orientation; + switch(a.boardState) { case 1: - var c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta); - 0 == d.controlAngle(c, e) && (b.boardState = 2); + var c = e.toRadian(a.theta), f = e.toRadian(a.targetTheta); + 0 == e.controlAngle(c, f) && (a.boardState = 2); break; case 2: - c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta), 0 == d.controlAngleFine(c, e) && (a.leftWheel = 0, a.rightWheel = 0, b.isMoving = !1); + c = e.toRadian(a.theta), f = e.toRadian(a.targetTheta), 0 == e.controlAngleFine(c, f) && (d.leftWheel = 0, d.rightWheel = 0, a.isMoving = !1); } - return b; + return a; } - delete b.isStart; - delete b.isMoving; - delete b.boardState; - delete b.theta; - delete b.targetTheta; + delete a.isStart; + delete a.isMoving; + delete a.boardState; + delete a.theta; + delete a.targetTheta; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.isMoving = !0; - b.boardState = 1; - b.theta = -200; - b.targetTheta = b.getNumberValue("ORIENTATION"); - d.clear(); - a.leftWheel = 0; - a.rightWheel = 0; - return b; + a.isStart = !0; + a.isMoving = !0; + a.boardState = 1; + a.theta = -200; + a.targetTheta = a.getNumberValue("ORIENTATION"); + e.clear(); + d.leftWheel = 0; + d.rightWheel = 0; + return a; }; Blockly.Blocks.albert_set_eye_to = {init:function() { this.setColour("#00979D"); @@ -582,11 +568,10 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_eye_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); - "LEFT" == c ? a.leftEye = d : ("RIGHT" != c && (a.leftEye = d), a.rightEye = d); - return b.callReturn(); +Entry.block.albert_set_eye_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + "LEFT" == c ? d.leftEye = e : ("RIGHT" != c && (d.leftEye = e), d.rightEye = e); + return a.callReturn(); }; Blockly.Blocks.albert_clear_eye = {init:function() { this.setColour("#00979D"); @@ -595,11 +580,10 @@ Blockly.Blocks.albert_clear_eye = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_clear_eye = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION", b); - "LEFT" == c ? a.leftEye = 0 : ("RIGHT" != c && (a.leftEye = 0), a.rightEye = 0); - return b.callReturn(); +Entry.block.albert_clear_eye = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION", a); + "LEFT" == c ? d.leftEye = 0 : ("RIGHT" != c && (d.leftEye = 0), d.rightEye = 0); + return a.callReturn(); }; Blockly.Blocks.albert_body_led = {init:function() { this.setColour("#00979D"); @@ -608,10 +592,10 @@ Blockly.Blocks.albert_body_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_body_led = function(a, b) { - a = Entry.hw.sendQueue; - "ON" == b.getField("STATE", b) ? a.bodyLed = 1 : a.bodyLed = 0; - return b.callReturn(); +Entry.block.albert_body_led = function(b, a) { + var d = Entry.hw.sendQueue; + "ON" == a.getField("STATE", a) ? d.bodyLed = 1 : d.bodyLed = 0; + return a.callReturn(); }; Blockly.Blocks.albert_front_led = {init:function() { this.setColour("#00979D"); @@ -620,10 +604,10 @@ Blockly.Blocks.albert_front_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_front_led = function(a, b) { - a = Entry.hw.sendQueue; - "ON" == b.getField("STATE", b) ? a.frontLed = 1 : a.frontLed = 0; - return b.callReturn(); +Entry.block.albert_front_led = function(b, a) { + var d = Entry.hw.sendQueue; + "ON" == a.getField("STATE", a) ? d.frontLed = 1 : d.frontLed = 0; + return a.callReturn(); }; Blockly.Blocks.albert_beep = {init:function() { this.setColour("#00979D"); @@ -632,28 +616,28 @@ Blockly.Blocks.albert_beep = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_beep = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_beep = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.buzzer = 0; - return b.callReturn(); + d.buzzer = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.buzzer = 440; - a.note = 0; + a.isStart = !0; + a.timeFlag = 1; + d.buzzer = 440; + d.note = 0; var c = setTimeout(function() { - b.timeFlag = 0; + a.timeFlag = 0; Entry.Albert.removeTimeout(c); }, 200); Entry.Albert.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -664,12 +648,11 @@ Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_buzzer_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getNumberValue("VALUE"); - a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; - a.note = 0; - return b.callReturn(); +Entry.block.albert_change_buzzer_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getNumberValue("VALUE"); + d.buzzer = void 0 != d.buzzer ? d.buzzer + c : c; + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -680,11 +663,11 @@ Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_buzzer_to = function(a, b) { - a = Entry.hw.sendQueue; - a.buzzer = b.getNumberValue("VALUE"); - a.note = 0; - return b.callReturn(); +Entry.block.albert_set_buzzer_to = function(b, a) { + var d = Entry.hw.sendQueue; + d.buzzer = a.getNumberValue("VALUE"); + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -693,11 +676,11 @@ Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_clear_buzzer = function(a, b) { - a = Entry.hw.sendQueue; - a.buzzer = 0; - a.note = 0; - return b.callReturn(); +Entry.block.albert_clear_buzzer = function(b, a) { + var d = Entry.hw.sendQueue; + d.buzzer = 0; + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.albert_play_note_for = {init:function() { this.setColour("#00979D"); @@ -709,37 +692,36 @@ Blockly.Blocks.albert_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_play_note_for = function(a, b) { - var c = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_play_note_for = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - c.note = 0; - return b.callReturn(); + d.note = 0; + return a.callReturn(); } - a = b.getNumberField("NOTE", b); - var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Albert.tempo; - b.isStart = !0; - b.timeFlag = 1; - c.buzzer = 0; - c.note = a + 12 * (d - 1); - if (100 < e) { - var f = setTimeout(function() { - c.note = 0; - Entry.Albert.removeTimeout(f); - }, e - 100); - Entry.Albert.timeouts.push(f); - } - var g = setTimeout(function() { - b.timeFlag = 0; - Entry.Albert.removeTimeout(g); - }, e); - Entry.Albert.timeouts.push(g); - return b; + var c = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Albert.tempo, f = 6E4 * f / g; + a.isStart = !0; + a.timeFlag = 1; + d.buzzer = 0; + d.note = c + 12 * (e - 1); + if (100 < f) { + var h = setTimeout(function() { + d.note = 0; + Entry.Albert.removeTimeout(h); + }, f - 100); + Entry.Albert.timeouts.push(h); + } + var k = setTimeout(function() { + a.timeFlag = 0; + Entry.Albert.removeTimeout(k); + }, f); + Entry.Albert.timeouts.push(k); + return a; }; Blockly.Blocks.albert_rest_for = {init:function() { this.setColour("#00979D"); @@ -750,28 +732,28 @@ Blockly.Blocks.albert_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_rest_for = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.albert_rest_for = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - return b.callReturn(); + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Albert.tempo; - a.buzzer = 0; - a.note = 0; - var d = setTimeout(function() { - b.timeFlag = 0; - Entry.Albert.removeTimeout(d); + a.isStart = !0; + a.timeFlag = 1; + var c = a.getNumberValue("VALUE"), c = 6E4 * c / Entry.Albert.tempo; + d.buzzer = 0; + d.note = 0; + var e = setTimeout(function() { + a.timeFlag = 0; + Entry.Albert.removeTimeout(e); }, c); - Entry.Albert.timeouts.push(d); - return b; + Entry.Albert.timeouts.push(e); + return a; }; Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -782,10 +764,10 @@ Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_tempo_by = function(a, b) { - Entry.Albert.tempo += b.getNumberValue("VALUE"); +Entry.block.albert_change_tempo_by = function(b, a) { + Entry.Albert.tempo += a.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -796,15 +778,15 @@ Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_tempo_to = function(a, b) { - Entry.Albert.tempo = b.getNumberValue("VALUE"); +Entry.block.albert_set_tempo_to = function(b, a) { + Entry.Albert.tempo = a.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return b.callReturn(); + return a.callReturn(); }; Entry.Arduino = {name:"arduino", setZero:function() { Entry.hw.sendQueue.readablePorts = []; - for (var a = 0;20 > a;a++) { - Entry.hw.sendQueue[a] = 0, Entry.hw.sendQueue.readablePorts.push(a); + for (var b = 0;20 > b;b++) { + Entry.hw.sendQueue[b] = 0, Entry.hw.sendQueue.readablePorts.push(b); } Entry.hw.update(); }, monitorTemplate:{imgPath:"hw/arduino.png", width:605, height:434, listPorts:{2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 5:{name:Lang.Hw.port_en + " 5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 6:{name:Lang.Hw.port_en + " 6 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 7:{name:Lang.Hw.port_en + @@ -812,16 +794,16 @@ Entry.Arduino = {name:"arduino", setZero:function() { Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a0:{name:Lang.Hw.port_en + " A0 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a1:{name:Lang.Hw.port_en + " A1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a2:{name:Lang.Hw.port_en + " A2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a3:{name:Lang.Hw.port_en + " A3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a4:{name:Lang.Hw.port_en + " A4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a5:{name:Lang.Hw.port_en + " A5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}}, mode:"both"}}; Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { - return "xxxxxxxx".replace(/[xy]/g, function(a) { - var b = 16 * Math.random() | 0; - return ("x" == a ? b : b & 0 | 0).toString(16); + return "xxxxxxxx".replace(/[xy]/g, function(b) { + var a = 16 * Math.random() | 0; + return ("x" == b ? a : a & 0 | 0).toString(16); }).toUpperCase(); -}, getSensorTime:function(a) { - return (new Date).getTime() + a; +}, getSensorTime:function(b) { + return (new Date).getTime() + b; }, setZero:function() { - Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(a) { - Entry.hw.sendQueue.SET[a].data = 0; - Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[a].type); + Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(b) { + Entry.hw.sendQueue.SET[b].data = 0; + Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[b].type); Entry.hw.sendQueue.KEY = Entry.ArduinoExt.getSensorKey(); }) : Entry.hw.sendQueue = {SET:{0:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 1:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 2:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 3:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 4:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 5:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 6:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 7:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 8:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 9:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 10:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 11:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 12:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 13:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}}, TIME:Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL), KEY:Entry.ArduinoExt.getSensorKey()}; @@ -830,15 +812,15 @@ Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { 1661, 3322, 6645], 10:[55, 110, 220, 440, 880, 1760, 3520, 7040], 11:[58, 117, 233, 466, 932, 1865, 3729, 7459], 12:[62, 123, 247, 494, 988, 1976, 3951, 7902]}, BlockState:{}}; Entry.SensorBoard = {name:"sensorBoard", setZero:Entry.Arduino.setZero}; Entry.ardublock = {name:"ardublock", setZero:Entry.Arduino.setZero}; -Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(a) { - clearTimeout(a); - var b = this.timeouts; - a = b.indexOf(a); - 0 <= a && b.splice(a, 1); +Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); }, removeAllTimeouts:function() { - var a = this.timeouts, b; - for (b in a) { - clearTimeout(a[b]); + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); } this.timeouts = []; }, monitorTemplate:{imgPath:"hw/dplay.png", width:500, height:600, listPorts:{2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 5:{name:Lang.Hw.port_en + " 5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 6:{name:Lang.Hw.port_en + " 6 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 7:{name:Lang.Hw.port_en + @@ -848,16 +830,16 @@ Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}}, mode:"both"}}; Entry.nemoino = {name:"nemoino", setZero:Entry.Arduino.setZero}; Entry.joystick = {name:"joystick", setZero:Entry.Arduino.setZero}; Entry.CODEino = {name:"CODEino", getSensorKey:function() { - return "xxxxxxxx".replace(/[xy]/g, function(a) { - var b = 16 * Math.random() | 0; - return ("x" == a ? b : b & 0 | 0).toString(16); + return "xxxxxxxx".replace(/[xy]/g, function(b) { + var a = 16 * Math.random() | 0; + return ("x" == b ? a : a & 0 | 0).toString(16); }).toUpperCase(); -}, getSensorTime:function(a) { - return (new Date).getTime() + a; +}, getSensorTime:function(b) { + return (new Date).getTime() + b; }, monitorTemplate:Entry.Arduino.monitorTemplate, setZero:function() { - Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(a) { - Entry.hw.sendQueue.SET[a].data = 0; - Entry.hw.sendQueue.TIME = Entry.CODEino.getSensorTime(Entry.hw.sendQueue.SET[a].type); + Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(b) { + Entry.hw.sendQueue.SET[b].data = 0; + Entry.hw.sendQueue.TIME = Entry.CODEino.getSensorTime(Entry.hw.sendQueue.SET[b].type); Entry.hw.sendQueue.KEY = Entry.CODEino.getSensorKey(); }) : Entry.hw.sendQueue = {SET:{0:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 1:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 2:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 3:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 4:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 5:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 6:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 7:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 8:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 9:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 10:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 11:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 12:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}, 13:{type:Entry.CODEino.sensorTypes.DIGITAL, data:0}}, TIME:Entry.CODEino.getSensorTime(Entry.CODEino.sensorTypes.DIGITAL), KEY:Entry.CODEino.getSensorKey()}; @@ -869,8 +851,8 @@ Blockly.Blocks.arduino_text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.arduino_text = function(a, b) { - return b.getStringField("NAME"); +Entry.block.arduino_text = function(b, a) { + return a.getStringField("NAME"); }; Blockly.Blocks.arduino_send = {init:function() { this.setColour("#00979D"); @@ -881,13 +863,12 @@ Blockly.Blocks.arduino_send = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_send = function(a, b) { - a = b.getValue("VALUE", b); - var c = new XMLHttpRequest; +Entry.block.arduino_send = function(b, a) { + var d = a.getValue("VALUE", a), c = new XMLHttpRequest; c.open("POST", "http://localhost:23518/arduino/", !1); - c.send(String(a)); + c.send(String(d)); Entry.assert(200 == c.status, "arduino is not connected"); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.arduino_get_string = {init:function() { this.setColour("#00979D"); @@ -897,13 +878,12 @@ Blockly.Blocks.arduino_get_string = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_number = function(a, b) { - a = b.getValue("VALUE", b); - b = new XMLHttpRequest; - b.open("POST", "http://localhost:23518/arduino/", !1); - b.send(String(a)); - Entry.assert(200 == b.status, "arduino is not connected"); - return Number(b.responseText); +Entry.block.arduino_get_number = function(b, a) { + var d = a.getValue("VALUE", a), c = new XMLHttpRequest; + c.open("POST", "http://localhost:23518/arduino/", !1); + c.send(String(d)); + Entry.assert(200 == c.status, "arduino is not connected"); + return +c.responseText; }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -913,13 +893,12 @@ Blockly.Blocks.arduino_get_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_string = function(a, b) { - a = b.getValue("VALUE", b); - b = new XMLHttpRequest; - b.open("POST", "http://localhost:23518/arduino/", !1); - b.send(String(a)); - Entry.assert(200 == b.status, "arduino is not connected"); - return b.responseText; +Entry.block.arduino_get_string = function(b, a) { + var d = a.getValue("VALUE", a), c = new XMLHttpRequest; + c.open("POST", "http://localhost:23518/arduino/", !1); + c.send(String(d)); + Entry.assert(200 == c.status, "arduino is not connected"); + return c.responseText; }; Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setColour("#00979D"); @@ -928,8 +907,8 @@ Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_sensor_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.arduino_get_sensor_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.arduino_get_port_number = {init:function() { this.setColour("#00979D"); @@ -938,8 +917,8 @@ Blockly.Blocks.arduino_get_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_port_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.arduino_get_port_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setColour("#00979D"); @@ -948,8 +927,8 @@ Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_pwm_port_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.arduino_get_pwm_port_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setColour("#00979D"); @@ -959,9 +938,9 @@ Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.arduino_get_number_sensor_value = function(a, b) { - a = b.getValue("VALUE", b); - return Entry.hw.getAnalogPortValue(a[1]); +Entry.block.arduino_get_number_sensor_value = function(b, a) { + var d = a.getValue("VALUE", a); + return Entry.hw.getAnalogPortValue(d[1]); }; Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setColour("#00979D"); @@ -971,9 +950,9 @@ Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.arduino_get_digital_value = function(a, b) { - a = b.getNumberValue("VALUE", b); - return Entry.hw.getDigitalPortValue(a); +Entry.block.arduino_get_digital_value = function(b, a) { + var d = a.getNumberValue("VALUE", a); + return Entry.hw.getDigitalPortValue(d); }; Blockly.Blocks.arduino_toggle_led = {init:function() { this.setColour("#00979D"); @@ -985,11 +964,10 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_led = function(a, b) { - a = b.getNumberValue("VALUE"); - var c = b.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); - return b.callReturn(); +Entry.block.arduino_toggle_led = function(b, a) { + var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 255 : 0; + Entry.hw.setDigitalPortValue(d, c); + return a.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setColour("#00979D"); @@ -1003,11 +981,10 @@ Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_pwm = function(a, b) { - a = b.getNumberValue("PORT"); - var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 255); - Entry.hw.setDigitalPortValue(a, c); - return b.callReturn(); +Entry.block.arduino_toggle_pwm = function(b, a) { + var d = a.getNumberValue("PORT"), c = a.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 255); + Entry.hw.setDigitalPortValue(d, c); + return a.callReturn(); }; Blockly.Blocks.arduino_convert_scale = {init:function() { this.setColour("#00979D"); @@ -1026,19 +1003,18 @@ Blockly.Blocks.arduino_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_convert_scale = function(a, b) { - var c = b.getNumberValue("VALUE1", b), d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); - a = b.getNumberValue("VALUE4", b); - b = b.getNumberValue("VALUE5", b); - if (d > e) { - var f = d, d = e, e = f +Entry.block.arduino_convert_scale = function(b, a) { + var d = a.getNumberValue("VALUE1", a), c = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); + if (c > e) { + var h = c, c = e, e = h } - a > b && (f = a, a = b, b = f); - c = (b - a) / (e - d) * (c - d); - c += a; - c = Math.min(b, c); - c = Math.max(a, c); - return Math.round(c); + f > g && (h = f, f = g, g = h); + d -= c; + d *= (g - f) / (e - c); + d += f; + d = Math.min(g, d); + d = Math.max(f, d); + return Math.round(d); }; Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { this.setColour("#00979D"); @@ -1046,8 +1022,8 @@ Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.sensorBoard_get_named_sensor_value = function(a, b) { - return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); +Entry.block.sensorBoard_get_named_sensor_value = function(b, a) { + return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); }; Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -1056,8 +1032,8 @@ Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.sensorBoard_is_button_pressed = function(a, b) { - return Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); +Entry.block.sensorBoard_is_button_pressed = function(b, a) { + return Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)); }; Blockly.Blocks.sensorBoard_led = {init:function() { this.setColour("#00979D"); @@ -1066,9 +1042,9 @@ Blockly.Blocks.sensorBoard_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.sensorBoard_led = function(a, b) { - Entry.hw.setDigitalPortValue(b.getField("PORT"), b.getNumberField("OPERATOR")); - return b.callReturn(); +Entry.block.sensorBoard_led = function(b, a) { + Entry.hw.setDigitalPortValue(a.getField("PORT"), a.getNumberField("OPERATOR")); + return a.callReturn(); }; Entry.block.arduino_download_connector = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -1097,8 +1073,8 @@ Blockly.Blocks.CODEino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_sensor_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.CODEino_get_sensor_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setColour("#00979D"); @@ -1106,8 +1082,8 @@ Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_named_sensor_value = function(a, b) { - return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); +Entry.block.CODEino_get_named_sensor_value = function(b, a) { + return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); }; Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setColour("#00979D"); @@ -1115,8 +1091,8 @@ Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_sound_status = function(a, b) { - return "GREAT" == b.getField("STATUS", b) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; +Entry.block.CODEino_get_sound_status = function(b, a) { + return "GREAT" == a.getField("STATUS", a) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; }; Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1124,8 +1100,8 @@ Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_light_status = function(a, b) { - return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.CODEino_get_light_status = function(b, a) { + return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -1133,9 +1109,9 @@ Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_is_button_pressed = function(a, b) { - a = b.getNumberField("PORT", b); - return 14 < a ? !Entry.hw.getAnalogPortValue(a - 14) : !Entry.hw.getDigitalPortValue(a); +Entry.block.CODEino_is_button_pressed = function(b, a) { + var d = a.getNumberField("PORT", a); + return 14 < d ? !Entry.hw.getAnalogPortValue(d - 14) : !Entry.hw.getDigitalPortValue(d); }; Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setColour("#00979D"); @@ -1144,22 +1120,23 @@ Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_accelerometer_direction = function(a, b) { - a = b.getField("DIRECTION", b); - b = 0; - "LEFT" == a || "RIGHT" == a ? b = 3 : "FRONT" == a || "REAR" == a ? b = 4 : "REVERSE" == a && (b = 5); - b = Entry.hw.getAnalogPortValue(b) - 265; - b = Math.min(90, 180 / 137 * b + -90); - b = Math.max(-90, b); - b = Math.round(b); - if ("LEFT" == a || "REAR" == a) { - return -30 > b ? 1 : 0; +Entry.block.CODEino_get_accelerometer_direction = function(b, a) { + var d = a.getField("DIRECTION", a), c = 0; + "LEFT" == d || "RIGHT" == d ? c = 3 : "FRONT" == d || "REAR" == d ? c = 4 : "REVERSE" == d && (c = 5); + c = Entry.hw.getAnalogPortValue(c); + c = 180 / 137 * (c - 265); + c += -90; + c = Math.min(90, c); + c = Math.max(-90, c); + c = Math.round(c); + if ("LEFT" == d || "REAR" == d) { + return -30 > c ? 1 : 0; } - if ("RIGHT" == a || "FRONT" == a) { - return 30 < b ? 1 : 0; + if ("RIGHT" == d || "FRONT" == d) { + return 30 < c ? 1 : 0; } - if ("REVERSE" == a) { - return -50 > b ? 1 : 0; + if ("REVERSE" == d) { + return -50 > c ? 1 : 0; } }; Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { @@ -1168,19 +1145,17 @@ Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_accelerometer_value = function(a, b) { - var c = Entry.hw.getAnalogPortValue(b.getField("PORT", b)), d = 265, e = 402; - a = -90; - b = 90; - if (d > e) { - var f = d, d = e, e = f +Entry.block.CODEino_get_accelerometer_value = function(b, a) { + var d = 265, c = 402, e = -90, f = 90, g = Entry.hw.getAnalogPortValue(a.getField("PORT", a)); + if (d > c) { + var h = d, d = c, c = h } - a > b && (f = a, a = b, b = f); - c = (b - a) / (e - d) * (c - d); - c += a; - c = Math.min(b, c); - c = Math.max(a, c); - return Math.round(c); + e > f && (h = e, e = f, f = h); + g = (f - e) / (c - d) * (g - d); + g += e; + g = Math.min(f, g); + g = Math.max(e, g); + return Math.round(g); }; Blockly.Blocks.dplay_select_led = {init:function() { this.setColour("#00979D"); @@ -1192,13 +1167,12 @@ Blockly.Blocks.dplay_select_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_select_led = function(a, b) { - var c = b.getField("PORT"); - a = 7; - "7" == c ? a = 7 : "8" == c ? a = 8 : "9" == c ? a = 9 : "10" == c && (a = 10); - c = b.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); - return b.callReturn(); +Entry.block.dplay_select_led = function(b, a) { + var d = a.getField("PORT"), c = 7; + "7" == d ? c = 7 : "8" == d ? c = 8 : "9" == d ? c = 9 : "10" == d && (c = 10); + d = "on" == a.getField("OPERATOR") ? 255 : 0; + Entry.hw.setDigitalPortValue(c, d); + return a.callReturn(); }; Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setColour("#00979D"); @@ -1208,11 +1182,10 @@ Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_switch_status = function(a, b) { - a = b.getField("PORT"); - var c = 2; - "2" == a ? c = 2 : "4" == a && (c = 4); - return "OFF" == b.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(c) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(c) ? 1 : 0; +Entry.block.dplay_get_switch_status = function(b, a) { + var d = a.getField("PORT"), c = 2; + "2" == d ? c = 2 : "4" == d && (c = 4); + return "OFF" == a.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(c) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(c) ? 1 : 0; }; Blockly.Blocks.dplay_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1220,8 +1193,8 @@ Blockly.Blocks.dplay_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_light_status = function(a, b) { - return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.dplay_get_light_status = function(b, a) { + return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.dplay_get_value = {init:function() { this.setColour("#00979D"); @@ -1233,9 +1206,9 @@ Blockly.Blocks.dplay_get_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.dplay_get_value = function(a, b) { - a = b.getValue("VALUE", b); - return Entry.hw.getAnalogPortValue(a[1]); +Entry.block.dplay_get_value = function(b, a) { + var d = a.getValue("VALUE", a); + return Entry.hw.getAnalogPortValue(d[1]); }; Blockly.Blocks.dplay_get_tilt = {init:function() { this.setColour("#00979D"); @@ -1243,8 +1216,8 @@ Blockly.Blocks.dplay_get_tilt = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_tilt = function(a, b) { - return "LIGHT" == b.getField("STATUS", b) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; +Entry.block.dplay_get_tilt = function(b, a) { + return "LIGHT" == a.getField("STATUS", a) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; }; Blockly.Blocks.dplay_DCmotor = {init:function() { this.setColour("#00979D"); @@ -1255,15 +1228,14 @@ Blockly.Blocks.dplay_DCmotor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_DCmotor = function(a, b) { - a = b.getField("PORT"); - var c = 0; - "3" == a ? c = 5 : "6" == a && (c = 11); - var d = b.getField("OPERATOR"), e = 0, f = 0; - "FRONT" == d ? (e = 255, f = 0) : "REAR" == d ? (e = 0, f = 255) : "OFF" == d && (f = e = 0); - Entry.hw.setDigitalPortValue(a, e); - Entry.hw.setDigitalPortValue(c, f); - return b.callReturn(); +Entry.block.dplay_DCmotor = function(b, a) { + var d = a.getField("PORT"), c = 0; + "3" == d ? c = 5 : "6" == d && (c = 11); + var e = a.getField("OPERATOR"), f = 0, g = 0; + "FRONT" == e ? (f = 255, g = 0) : "REAR" == e ? (f = 0, g = 255) : "OFF" == e && (g = f = 0); + Entry.hw.setDigitalPortValue(d, f); + Entry.hw.setDigitalPortValue(c, g); + return a.callReturn(); }; Blockly.Blocks.dplay_buzzer = {init:function() { this.setColour("#00979D"); @@ -1277,16 +1249,15 @@ Blockly.Blocks.dplay_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_buzzer = function(a, b) { - var c = b.getField("PORT"); - a = 2; - "1" == c ? a = 2 : "2" == c ? a = 4 : "3" == c && (a = 7); - c = b.getNumberValue("VALUE"); - c = Math.round(c); - c = Math.max(c, 0); - c = Math.min(c, 100); - Entry.hw.setDigitalPortValue(a, c); - return b.callReturn(); +Entry.block.dplay_buzzer = function(b, a) { + var d = a.getField("PORT"), c = 2; + "1" == d ? c = 2 : "2" == d ? c = 4 : "3" == d && (c = 7); + d = a.getNumberValue("VALUE"); + d = Math.round(d); + d = Math.max(d, 0); + d = Math.min(d, 100); + Entry.hw.setDigitalPortValue(c, d); + return a.callReturn(); }; Blockly.Blocks.dplay_servo = {init:function() { this.setColour("#00979D"); @@ -1298,42 +1269,39 @@ Blockly.Blocks.dplay_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_servo = function(a, b) { - a = b.getNumberValue("VALUE"); - a = Math.round(a); - a = Math.max(a, 0); - a = Math.min(a, 180); - Entry.hw.setDigitalPortValue(9, a); - return b.callReturn(); +Entry.block.dplay_servo = function(b, a) { + var d = a.getNumberValue("VALUE"), d = Math.round(d), d = Math.max(d, 0), d = Math.min(d, 180); + Entry.hw.setDigitalPortValue(9, d); + return a.callReturn(); }; Entry.Bitbrick = {SENSOR_MAP:{1:"light", 2:"IR", 3:"touch", 4:"potentiometer", 5:"MIC", 21:"UserSensor", 11:"UserInput", 20:"LED", 19:"SERVO", 18:"DC"}, PORT_MAP:{buzzer:2, 5:4, 6:6, 7:8, 8:10, LEDR:12, LEDG:14, LEDB:16}, sensorList:function() { - for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { - var d = b[c]; - d && (d.value || 0 === d.value) && a.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); + for (var b = [], a = Entry.hw.portData, d = 1;5 > d;d++) { + var c = a[d]; + c && (c.value || 0 === c.value) && b.push([d + " - " + Lang.Blocks["BITBRICK_" + c.type], d.toString()]); } - return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; + return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; }, touchList:function() { - for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { - var d = b[c]; - d && "touch" === d.type && a.push([c.toString(), c.toString()]); + for (var b = [], a = Entry.hw.portData, d = 1;5 > d;d++) { + var c = a[d]; + c && "touch" === c.type && b.push([d.toString(), d.toString()]); } - return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; + return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; }, servoList:function() { - for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { - var d = b[c]; - d && "SERVO" === d.type && a.push(["ABCD"[c - 5], c.toString()]); + for (var b = [], a = Entry.hw.portData, d = 5;9 > d;d++) { + var c = a[d]; + c && "SERVO" === c.type && b.push(["ABCD"[d - 5], d.toString()]); } - return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; + return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; }, dcList:function() { - for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { - var d = b[c]; - d && "DC" === d.type && a.push(["ABCD"[c - 5], c.toString()]); + for (var b = [], a = Entry.hw.portData, d = 5;9 > d;d++) { + var c = a[d]; + c && "DC" === c.type && b.push(["ABCD"[d - 5], d.toString()]); } - return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; + return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; }, setZero:function() { - var a = Entry.hw.sendQueue, b; - for (b in Entry.Bitbrick.PORT_MAP) { - a[b] = 0; + var b = Entry.hw.sendQueue, a; + for (a in Entry.Bitbrick.PORT_MAP) { + b[a] = 0; } Entry.hw.update(); }, name:"bitbrick", servoMaxValue:181, servoMinValue:1, dcMaxValue:100, dcMinValue:-100, monitorTemplate:{keys:["value"], imgPath:"hw/bitbrick.png", width:400, height:400, listPorts:{1:{name:Lang.Hw.port_en + " 1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, @@ -1344,9 +1312,9 @@ Blockly.Blocks.bitbrick_sensor_value = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_sensor_value = function(a, b) { - a = b.getStringField("PORT"); - return Entry.hw.portData[a].value; +Entry.block.bitbrick_sensor_value = function(b, a) { + var d = a.getStringField("PORT"); + return Entry.hw.portData[d].value; }; Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setColour("#00979D"); @@ -1354,8 +1322,8 @@ Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_is_touch_pressed = function(a, b) { - return 0 === Entry.hw.portData[b.getStringField("PORT")].value; +Entry.block.bitbrick_is_touch_pressed = function(b, a) { + return 0 === Entry.hw.portData[a.getStringField("PORT")].value; }; Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setColour("#00979D"); @@ -1364,11 +1332,11 @@ Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_color_led = function(a, b) { +Entry.block.bitbrick_turn_off_color_led = function(b, a) { Entry.hw.sendQueue.LEDR = 0; Entry.hw.sendQueue.LEDG = 0; Entry.hw.sendQueue.LEDB = 0; - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setColour("#00979D"); @@ -1383,13 +1351,12 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_rgb = function(a, b) { - a = b.getNumberValue("rValue"); - var c = b.getNumberValue("gValue"), d = b.getNumberValue("bValue"), e = Entry.adjustValueWithMaxMin, f = Entry.hw.sendQueue; - f.LEDR = e(a, 0, 255); - f.LEDG = e(c, 0, 255); - f.LEDB = e(d, 0, 255); - return b.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_rgb = function(b, a) { + var d = a.getNumberValue("rValue"), c = a.getNumberValue("gValue"), e = a.getNumberValue("bValue"), f = Entry.adjustValueWithMaxMin, g = Entry.hw.sendQueue; + g.LEDR = f(d, 0, 255); + g.LEDG = f(c, 0, 255); + g.LEDB = f(e, 0, 255); + return a.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setColour("#00979D"); @@ -1398,12 +1365,12 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_picker = function(a, b) { - a = b.getStringField("VALUE"); - Entry.hw.sendQueue.LEDR = parseInt(a.substr(1, 2), 16); - Entry.hw.sendQueue.LEDG = parseInt(a.substr(3, 2), 16); - Entry.hw.sendQueue.LEDB = parseInt(a.substr(5, 2), 16); - return b.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_picker = function(b, a) { + var d = a.getStringField("VALUE"); + Entry.hw.sendQueue.LEDR = parseInt(d.substr(1, 2), 16); + Entry.hw.sendQueue.LEDG = parseInt(d.substr(3, 2), 16); + Entry.hw.sendQueue.LEDB = parseInt(d.substr(5, 2), 16); + return a.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setColour("#00979D"); @@ -1414,15 +1381,13 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_value = function(a, b) { - a = b.getNumberValue("VALUE"); - var c, d, e; - a %= 200; - 67 > a ? (c = 200 - 3 * a, d = 3 * a, e = 0) : 134 > a ? (a -= 67, c = 0, d = 200 - 3 * a, e = 3 * a) : 201 > a && (a -= 134, c = 3 * a, d = 0, e = 200 - 3 * a); +Entry.block.bitbrick_turn_on_color_led_by_value = function(b, a) { + var d = a.getNumberValue("VALUE"), c, e, f, d = d % 200; + 67 > d ? (c = 200 - 3 * d, e = 3 * d, f = 0) : 134 > d ? (d -= 67, c = 0, e = 200 - 3 * d, f = 3 * d) : 201 > d && (d -= 134, c = 3 * d, e = 0, f = 200 - 3 * d); Entry.hw.sendQueue.LEDR = c; - Entry.hw.sendQueue.LEDG = d; - Entry.hw.sendQueue.LEDB = e; - return b.callReturn(); + Entry.hw.sendQueue.LEDG = e; + Entry.hw.sendQueue.LEDB = f; + return a.callReturn(); }; Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setColour("#00979D"); @@ -1433,14 +1398,14 @@ Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_buzzer = function(a, b) { - if (b.isStart) { - return Entry.hw.sendQueue.buzzer = 0, delete b.isStart, b.callReturn(); +Entry.block.bitbrick_buzzer = function(b, a) { + if (a.isStart) { + return Entry.hw.sendQueue.buzzer = 0, delete a.isStart, a.callReturn(); } - a = b.getNumberValue("VALUE"); - Entry.hw.sendQueue.buzzer = a; - b.isStart = !0; - return b; + var d = a.getNumberValue("VALUE"); + Entry.hw.sendQueue.buzzer = d; + a.isStart = !0; + return a; }; Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setColour("#00979D"); @@ -1449,16 +1414,15 @@ Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_all_motors = function(a, b) { - var c = Entry.hw.sendQueue; - a = Entry.Bitbrick; - a.servoList().map(function(b) { - c[b[1]] = 0; +Entry.block.bitbrick_turn_off_all_motors = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.Bitbrick; + c.servoList().map(function(a) { + d[a[1]] = 0; }); - a.dcList().map(function(b) { - c[b[1]] = 128; + c.dcList().map(function(a) { + d[a[1]] = 128; }); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setColour("#00979D"); @@ -1469,12 +1433,10 @@ Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_speed = function(a, b) { - a = b.getNumberValue("VALUE"); - a = Math.min(a, Entry.Bitbrick.dcMaxValue); - a = Math.max(a, Entry.Bitbrick.dcMinValue); - Entry.hw.sendQueue[b.getStringField("PORT")] = a + 128; - return b.callReturn(); +Entry.block.bitbrick_dc_speed = function(b, a) { + var d = a.getNumberValue("VALUE"), d = Math.min(d, Entry.Bitbrick.dcMaxValue), d = Math.max(d, Entry.Bitbrick.dcMinValue); + Entry.hw.sendQueue[a.getStringField("PORT")] = d + 128; + return a.callReturn(); }; Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setColour("#00979D"); @@ -1485,11 +1447,10 @@ Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_direction_speed = function(a, b) { - a = "CW" === b.getStringField("DIRECTION"); - var c = b.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, 0); - Entry.hw.sendQueue[b.getStringField("PORT")] = a ? c + 128 : 128 - c; - return b.callReturn(); +Entry.block.bitbrick_dc_direction_speed = function(b, a) { + var d = "CW" === a.getStringField("DIRECTION"), c = a.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, 0); + Entry.hw.sendQueue[a.getStringField("PORT")] = d ? c + 128 : 128 - c; + return a.callReturn(); }; Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setColour("#00979D"); @@ -1500,12 +1461,10 @@ Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_servomotor_angle = function(a, b) { - a = b.getNumberValue("VALUE") + 1; - a = Math.min(a, Entry.Bitbrick.servoMaxValue); - a = Math.max(a, Entry.Bitbrick.servoMinValue); - Entry.hw.sendQueue[b.getStringField("PORT")] = a; - return b.callReturn(); +Entry.block.bitbrick_servomotor_angle = function(b, a) { + var d = a.getNumberValue("VALUE") + 1, d = Math.min(d, Entry.Bitbrick.servoMaxValue), d = Math.max(d, Entry.Bitbrick.servoMinValue); + Entry.hw.sendQueue[a.getStringField("PORT")] = d; + return a.callReturn(); }; Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setColour("#00979D"); @@ -1522,20 +1481,16 @@ Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_convert_scale = function(a, b) { - a = b.getNumberField("PORT"); - var c = Entry.hw.portData[a].value, d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); - a = b.getNumberValue("VALUE4", b); - b = b.getNumberValue("VALUE5", b); - if (a > b) { - var f = a; - a = b; - b = f; +Entry.block.bitbrick_convert_scale = function(b, a) { + var d = a.getNumberField("PORT"), c = Entry.hw.portData[d].value, d = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); + if (f > g) { + var h = f, f = g, g = h } - c = (b - a) / (e - d) * (c - d); - c += a; - c = Math.min(b, c); - c = Math.max(a, c); + c -= d; + c *= (g - f) / (e - d); + c += f; + c = Math.min(g, c); + c = Math.max(f, c); return Math.round(c); }; var categoryColor = "#FF9E20"; @@ -1546,11 +1501,11 @@ Blockly.Blocks.start_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.start_drawing = function(a, b) { - a.brush ? a.brush.stop = !1 : Entry.setBasicBrush(a); +Entry.block.start_drawing = function(b, a) { + b.brush ? b.brush.stop = !1 : Entry.setBasicBrush(b); Entry.stage.sortZorder(); - a.brush.moveTo(a.getX(), -1 * a.getY()); - return b.callReturn(); + b.brush.moveTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.stop_drawing = {init:function() { this.setColour(categoryColor); @@ -1559,9 +1514,9 @@ Blockly.Blocks.stop_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_drawing = function(a, b) { - a.brush && a.shape && (a.brush.stop = !0); - return b.callReturn(); +Entry.block.stop_drawing = function(b, a) { + b.brush && b.shape && (b.brush.stop = !0); + return a.callReturn(); }; Blockly.Blocks.set_color = {init:function() { this.setColour(categoryColor); @@ -1572,11 +1527,11 @@ Blockly.Blocks.set_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_color = function(a, b) { - var c = b.getField("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (c = Entry.hex2rgb(c), a.brush.rgb = c, a.brush.endStroke(), a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.set_color = function(b, a) { + var d = a.getField("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + b.brush && (d = Entry.hex2rgb(d), b.brush.rgb = d, b.brush.endStroke(), b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.set_random_color = {init:function() { this.setColour(categoryColor); @@ -1585,16 +1540,16 @@ Blockly.Blocks.set_random_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_random_color = function(a, b) { - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - if (a.brush) { - var c = Entry.generateRgb(); - a.brush.rgb = c; - a.brush.endStroke(); - a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"); - a.brush.moveTo(a.getX(), -1 * a.getY()); +Entry.block.set_random_color = function(b, a) { + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + if (b.brush) { + var d = Entry.generateRgb(); + b.brush.rgb = d; + b.brush.endStroke(); + b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + b.brush.opacity / 100 + ")"); + b.brush.moveTo(b.getX(), -1 * b.getY()); } - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.change_thickness = {init:function() { this.setColour(categoryColor); @@ -1605,11 +1560,11 @@ Blockly.Blocks.change_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_thickness = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.thickness += c, 1 > a.brush.thickness && (a.brush.thickness = 1), a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.change_thickness = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + b.brush && (b.brush.thickness += d, 1 > b.brush.thickness && (b.brush.thickness = 1), b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.set_thickness = {init:function() { this.setColour(categoryColor); @@ -1620,11 +1575,11 @@ Blockly.Blocks.set_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_thickness = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.thickness = c, a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.set_thickness = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + b.brush && (b.brush.thickness = d, b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.change_opacity = {init:function() { this.setColour(categoryColor); @@ -1635,12 +1590,12 @@ Blockly.Blocks.change_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_opacity = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(a.brush.opacity + c, 0, 100); - a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.change_opacity = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + d = Entry.adjustValueWithMaxMin(b.brush.opacity + d, 0, 100); + b.brush && (b.brush.opacity = d, b.brush.endStroke(), d = b.brush.rgb, b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.set_opacity = {init:function() { this.setColour(categoryColor); @@ -1651,11 +1606,11 @@ Blockly.Blocks.set_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_opacity = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.set_opacity = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(d, 0, 100), b.brush.endStroke(), d = b.brush.rgb, b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.brush_erase_all = {init:function() { this.setColour(categoryColor); @@ -1664,19 +1619,19 @@ Blockly.Blocks.brush_erase_all = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_erase_all = function(a, b) { - var c = a.brush; - if (c) { - var d = c._stroke.style, e = c._strokeStyle.width; - c.clear().setStrokeStyle(e).beginStroke(d); - c.moveTo(a.getX(), -1 * a.getY()); +Entry.block.brush_erase_all = function(b, a) { + var d = b.brush; + if (d) { + var c = d._stroke.style, e = d._strokeStyle.width; + d.clear().setStrokeStyle(e).beginStroke(c); + d.moveTo(b.getX(), -1 * b.getY()); } - a = a.parent.getStampEntities(); - a.map(function(b) { - b.removeClone(); + d = b.parent.getStampEntities(); + d.map(function(a) { + a.removeClone(); }); - a = null; - return b.callReturn(); + d = null; + return a.callReturn(); }; Blockly.Blocks.brush_stamp = {init:function() { this.setColour(categoryColor); @@ -1685,9 +1640,9 @@ Blockly.Blocks.brush_stamp = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_stamp = function(a, b) { - a.parent.addStampEntity(a); - return b.callReturn(); +Entry.block.brush_stamp = function(b, a) { + b.parent.addStampEntity(b); + return a.callReturn(); }; Blockly.Blocks.change_brush_transparency = {init:function() { this.setColour(categoryColor); @@ -1698,12 +1653,12 @@ Blockly.Blocks.change_brush_transparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_brush_transparency = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(a.brush.opacity - c, 0, 100); - a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.change_brush_transparency = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + d = Entry.adjustValueWithMaxMin(b.brush.opacity - d, 0, 100); + b.brush && (b.brush.opacity = d, b.brush.endStroke(), d = b.brush.rgb, b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; Blockly.Blocks.set_brush_tranparency = {init:function() { this.setColour(categoryColor); @@ -1714,11 +1669,11 @@ Blockly.Blocks.set_brush_tranparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_brush_tranparency = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); - a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - a.brush.opacity / 100) + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); - return b.callReturn(); +Entry.block.set_brush_tranparency = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); + b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(d, 0, 100), b.brush.endStroke(), d = b.brush.rgb, b.brush.beginStroke("rgba(" + d.r + "," + d.g + "," + d.b + "," + (1 - b.brush.opacity / 100) + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); + return a.callReturn(); }; var calcArrowColor = "#e8b349", calcBlockColor = "#FFD974", calcFontColor = "#3D3D3D"; Blockly.Blocks.number = {init:function() { @@ -1727,8 +1682,8 @@ Blockly.Blocks.number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.number = function(a, b) { - return b.getField("NUM", b); +Entry.block.number = function(b, a) { + return a.getField("NUM", a); }; Blockly.Blocks.angle = {init:function() { this.setColour(calcBlockColor); @@ -1736,8 +1691,8 @@ Blockly.Blocks.angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.angle = function(a, b) { - return b.getNumberField("ANGLE"); +Entry.block.angle = function(b, a) { + return a.getNumberField("ANGLE"); }; Blockly.Blocks.get_x_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1745,8 +1700,8 @@ Blockly.Blocks.get_x_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_x_coordinate = function(a, b) { - return a.getX(); +Entry.block.get_x_coordinate = function(b, a) { + return b.getX(); }; Blockly.Blocks.get_y_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1754,8 +1709,8 @@ Blockly.Blocks.get_y_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_y_coordinate = function(a, b) { - return a.getY(); +Entry.block.get_y_coordinate = function(b, a) { + return b.getY(); }; Blockly.Blocks.get_angle = {init:function() { this.setColour(calcBlockColor); @@ -1763,8 +1718,8 @@ Blockly.Blocks.get_angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_angle = function(a, b) { - return parseFloat(a.getRotation().toFixed(1)); +Entry.block.get_angle = function(b, a) { + return parseFloat(b.getRotation().toFixed(1)); }; Blockly.Blocks.get_rotation_direction = {init:function() { this.setColour(calcBlockColor); @@ -1773,8 +1728,8 @@ Blockly.Blocks.get_rotation_direction = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_rotation_direction = function(a, b) { - return "DIRECTION" == b.getField("OPERATOR", b).toUpperCase() ? parseFloat(a.getDirection().toFixed(1)) : parseFloat(a.getRotation().toFixed(1)); +Entry.block.get_rotation_direction = function(b, a) { + return "DIRECTION" == a.getField("OPERATOR", a).toUpperCase() ? parseFloat(b.getDirection().toFixed(1)) : parseFloat(b.getRotation().toFixed(1)); }; Blockly.Blocks.distance_something = {init:function() { this.setColour(calcBlockColor); @@ -1782,13 +1737,13 @@ Blockly.Blocks.distance_something = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.distance_something = function(a, b) { - b = b.getField("VALUE", b); - if ("mouse" == b) { - return b = Entry.stage.mouseCoordinate, Math.sqrt(Math.pow(a.getX() - b.x, 2) + Math.pow(a.getY() - b.y, 2)); +Entry.block.distance_something = function(b, a) { + var d = a.getField("VALUE", a); + if ("mouse" == d) { + return d = Entry.stage.mouseCoordinate, Math.sqrt(Math.pow(b.getX() - d.x, 2) + Math.pow(b.getY() - d.y, 2)); } - b = Entry.container.getEntity(b); - return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2)); + d = Entry.container.getEntity(d); + return Math.sqrt(Math.pow(b.getX() - d.getX(), 2) + Math.pow(b.getY() - d.getY(), 2)); }; Blockly.Blocks.coordinate_mouse = {init:function() { this.setColour(calcBlockColor); @@ -1796,8 +1751,8 @@ Blockly.Blocks.coordinate_mouse = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.coordinate_mouse = function(a, b) { - return "x" === b.getField("VALUE", b) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); +Entry.block.coordinate_mouse = function(b, a) { + return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1806,24 +1761,24 @@ Blockly.Blocks.coordinate_object = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.coordinate_object = function(a, b) { - var c = b.getField("VALUE", b); - a = "self" == c ? a : Entry.container.getEntity(c); - switch(b.getField("COORDINATE", b)) { +Entry.block.coordinate_object = function(b, a) { + var d = a.getField("VALUE", a), d = "self" == d ? b : Entry.container.getEntity(d); + switch(a.getField("COORDINATE", a)) { case "x": - return a.getX(); + return d.getX(); case "y": - return a.getY(); + return d.getY(); case "rotation": - return a.getRotation(); + return d.getRotation(); case "direction": - return a.getDirection(); + return d.getDirection(); case "picture_index": - return b = a.parent, b = b.pictures, b.indexOf(a.picture) + 1; + var c = d.parent, c = c.pictures; + return c.indexOf(d.picture) + 1; case "size": - return Number(a.getSize().toFixed(1)); + return +d.getSize().toFixed(1); case "picture_name": - return b = a.parent, b = b.pictures, b[b.indexOf(a.picture)].name; + return c = d.parent, c = c.pictures, c[c.indexOf(d.picture)].name; } }; Blockly.Blocks.calc_basic = {init:function() { @@ -1834,11 +1789,9 @@ Blockly.Blocks.calc_basic = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_basic = function(a, b) { - a = b.getField("OPERATOR", b); - var c = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return "PLUS" == a ? c + b : "MINUS" == a ? c - b : "MULTI" == a ? c * b : c / b; +Entry.block.calc_basic = function(b, a) { + var d = a.getField("OPERATOR", a), c = a.getNumberValue("LEFTHAND", a), e = a.getNumberValue("RIGHTHAND", a); + return "PLUS" == d ? c + e : "MINUS" == d ? c - e : "MULTI" == d ? c * e : c / e; }; Blockly.Blocks.calc_plus = {init:function() { this.setColour(calcBlockColor); @@ -1848,10 +1801,9 @@ Blockly.Blocks.calc_plus = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_plus = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a + b; +Entry.block.calc_plus = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d + c; }; Blockly.Blocks.calc_minus = {init:function() { this.setColour(calcBlockColor); @@ -1861,10 +1813,9 @@ Blockly.Blocks.calc_minus = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_minus = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a - b; +Entry.block.calc_minus = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d - c; }; Blockly.Blocks.calc_times = {init:function() { this.setColour(calcBlockColor); @@ -1874,10 +1825,9 @@ Blockly.Blocks.calc_times = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_times = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a * b; +Entry.block.calc_times = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d * c; }; Blockly.Blocks.calc_divide = {init:function() { this.setColour(calcBlockColor); @@ -1887,10 +1837,9 @@ Blockly.Blocks.calc_divide = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_divide = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a / b; +Entry.block.calc_divide = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d / c; }; Blockly.Blocks.calc_mod = {init:function() { this.setColour(calcBlockColor); @@ -1902,10 +1851,9 @@ Blockly.Blocks.calc_mod = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_mod = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a % b; +Entry.block.calc_mod = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d % c; }; Blockly.Blocks.calc_share = {init:function() { this.setColour(calcBlockColor); @@ -1917,10 +1865,9 @@ Blockly.Blocks.calc_share = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_share = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return Math.floor(a / b); +Entry.block.calc_share = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return Math.floor(d / c); }; Blockly.Blocks.calc_operation = {init:function() { this.setColour(calcBlockColor); @@ -1933,45 +1880,45 @@ Blockly.Blocks.calc_operation = {init:function() { this.appendDummyInput().appendField(" "); this.setInputsInline(!0); }}; -Entry.block.calc_operation = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getField("VALUE", b); - if (-1 < ["asin_radian", "acos_radian"].indexOf(b) && (1 < a || -1 > a)) { +Entry.block.calc_operation = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getField("VALUE", a); + if (-1 < ["asin_radian", "acos_radian"].indexOf(c) && (1 < d || -1 > d)) { throw Error("x range exceeded"); } - b.indexOf("_") && (b = b.split("_")[0]); - -1 < ["sin", "cos", "tan"].indexOf(b) && (a = Entry.toRadian(a)); - switch(b) { + c.indexOf("_") && (c = c.split("_")[0]); + -1 < ["sin", "cos", "tan"].indexOf(c) && (d = Entry.toRadian(d)); + var e = 0; + switch(c) { case "square": - b = a * a; + e = d * d; break; case "factorial": - b = Entry.factorial(a); + e = Entry.factorial(d); break; case "root": - b = Math.sqrt(a); + e = Math.sqrt(d); break; case "log": - b = Math.log(a) / Math.LN10; + e = Math.log(d) / Math.LN10; break; case "ln": - b = Math.log(a); + e = Math.log(d); break; case "asin": ; case "acos": ; case "atan": - b = Entry.toDegrees(Math[b](a)); + e = Entry.toDegrees(Math[c](d)); break; case "unnatural": - b = a - Math.floor(a); - 0 > a && (b = 1 - b); + e = d - Math.floor(d); + 0 > d && (e = 1 - e); break; default: - b = Math[b](a); + e = Math[c](d); } - return Math.round(1E3 * b) / 1E3; + return Math.round(1E3 * e) / 1E3; }; Blockly.Blocks.calc_rand = {init:function() { this.setColour(calcBlockColor); @@ -1983,12 +1930,9 @@ Blockly.Blocks.calc_rand = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_rand = function(a, b) { - a = b.getStringValue("LEFTHAND", b); - b = b.getStringValue("RIGHTHAND", b); - var c = Math.min(a, b), d = Math.max(a, b); - a = Entry.isFloat(a); - return Entry.isFloat(b) || a ? (Math.random() * (d - c) + c).toFixed(2) : Math.floor(Math.random() * (d - c + 1) + c); +Entry.block.calc_rand = function(b, a) { + var d = a.getStringValue("LEFTHAND", a), c = a.getStringValue("RIGHTHAND", a), e = Math.min(d, c), f = Math.max(d, c), d = Entry.isFloat(d); + return Entry.isFloat(c) || d ? (Math.random() * (f - e) + e).toFixed(2) : Math.floor(Math.random() * (f - e + 1) + e); }; Blockly.Blocks.get_date = {init:function() { this.setColour(calcBlockColor); @@ -1997,10 +1941,9 @@ Blockly.Blocks.get_date = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_date = function(a, b) { - a = b.getField("VALUE", b); - b = new Date; - return "YEAR" == a ? b.getFullYear() : "MONTH" == a ? b.getMonth() + 1 : "DAY" == a ? b.getDate() : "HOUR" == a ? b.getHours() : "MINUTE" == a ? b.getMinutes() : b.getSeconds(); +Entry.block.get_date = function(b, a) { + var d = a.getField("VALUE", a), c = new Date; + return "YEAR" == d ? c.getFullYear() : "MONTH" == d ? c.getMonth() + 1 : "DAY" == d ? c.getDate() : "HOUR" == d ? c.getHours() : "MINUTE" == d ? c.getMinutes() : c.getSeconds(); }; Blockly.Blocks.get_sound_duration = {init:function() { this.setColour(calcBlockColor); @@ -2010,12 +1953,10 @@ Blockly.Blocks.get_sound_duration = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_duration = function(a, b) { - b = b.getField("VALUE", b); - a = a.parent.sounds; - for (var c = 0;c < a.length;c++) { - if (a[c].id == b) { - return a[c].duration; +Entry.block.get_sound_duration = function(b, a) { + for (var d = a.getField("VALUE", a), c = b.parent.sounds, e = 0;e < c.length;e++) { + if (c[e].id == d) { + return c[e].duration; } } }; @@ -2027,12 +1968,12 @@ Blockly.Blocks.reset_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(a) { - Entry.engine && Entry.engine.hideProjectTimer(a); +}, whenRemove:function(b) { + Entry.engine && Entry.engine.hideProjectTimer(b); }}; -Entry.block.reset_project_timer = function(a, b) { +Entry.block.reset_project_timer = function(b, a) { Entry.engine.updateProjectTimer(0); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.set_visible_project_timer = {init:function() { this.setColour(calcBlockColor); @@ -2044,14 +1985,13 @@ Blockly.Blocks.set_visible_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(a) { - Entry.engine && Entry.engine.hideProjectTimer(a); +}, whenRemove:function(b) { + Entry.engine && Entry.engine.hideProjectTimer(b); }}; -Entry.block.set_visible_project_timer = function(a, b) { - a = b.getField("ACTION", b); - var c = Entry.engine.projectTimer; - "SHOW" == a ? c.setVisible(!0) : c.setVisible(!1); - return b.callReturn(); +Entry.block.set_visible_project_timer = function(b, a) { + var d = a.getField("ACTION", a), c = Entry.engine.projectTimer; + "SHOW" == d ? c.setVisible(!0) : c.setVisible(!1); + return a.callReturn(); }; Blockly.Blocks.timer_variable = {init:function() { this.setColour(calcBlockColor); @@ -2059,7 +1999,7 @@ Blockly.Blocks.timer_variable = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.timer_variable = function(a, b) { +Entry.block.timer_variable = function(b, a) { return Entry.container.inputValue.getValue(); }; Blockly.Blocks.get_project_timer_value = {init:function() { @@ -2069,10 +2009,10 @@ Blockly.Blocks.get_project_timer_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(a) { - Entry.engine && Entry.engine.hideProjectTimer(a); +}, whenRemove:function(b) { + Entry.engine && Entry.engine.hideProjectTimer(b); }}; -Entry.block.get_project_timer_value = function(a, b) { +Entry.block.get_project_timer_value = function(b, a) { return Entry.engine.projectTimer.getValue(); }; Blockly.Blocks.char_at = {init:function() { @@ -2085,13 +2025,12 @@ Blockly.Blocks.char_at = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_char_at_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.char_at = function(a, b) { - a = b.getStringValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b) - 1; - if (0 > b || b > a.length - 1) { +Entry.block.char_at = function(b, a) { + var d = a.getStringValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a) - 1; + if (0 > c || c > d.length - 1) { throw Error(); } - return a[b]; + return d[c]; }; Blockly.Blocks.length_of_string = {init:function() { this.setColour(calcBlockColor); @@ -2101,8 +2040,8 @@ Blockly.Blocks.length_of_string = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_string = function(a, b) { - return b.getStringValue("STRING", b).length; +Entry.block.length_of_string = function(b, a) { + return a.getStringValue("STRING", a).length; }; Blockly.Blocks.substring = {init:function() { this.setColour(calcBlockColor); @@ -2116,15 +2055,12 @@ Blockly.Blocks.substring = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.substring = function(a, b) { - a = b.getStringValue("STRING", b); - var c = b.getNumberValue("START", b) - 1; - b = b.getNumberValue("END", b) - 1; - var d = a.length - 1; - if (0 > c || 0 > b || c > d || b > d) { +Entry.block.substring = function(b, a) { + var d = a.getStringValue("STRING", a), c = a.getNumberValue("START", a) - 1, e = a.getNumberValue("END", a) - 1, f = d.length - 1; + if (0 > c || 0 > e || c > f || e > f) { throw Error(); } - return a.substring(Math.min(c, b), Math.max(c, b) + 1); + return d.substring(Math.min(c, e), Math.max(c, e) + 1); }; Blockly.Blocks.replace_string = {init:function() { this.setColour(calcBlockColor); @@ -2138,8 +2074,8 @@ Blockly.Blocks.replace_string = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.replace_string = function(a, b) { - return b.getStringValue("STRING", b).replace(new RegExp(b.getStringValue("OLD_WORD", b), "gm"), b.getStringValue("NEW_WORD", b)); +Entry.block.replace_string = function(b, a) { + return a.getStringValue("STRING", a).replace(new RegExp(a.getStringValue("OLD_WORD", a), "gm"), a.getStringValue("NEW_WORD", a)); }; Blockly.Blocks.change_string_case = {init:function() { this.setColour(calcBlockColor); @@ -2151,8 +2087,8 @@ Blockly.Blocks.change_string_case = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.change_string_case = function(a, b) { - return b.getStringValue("STRING", b)[b.getField("CASE", b)](); +Entry.block.change_string_case = function(b, a) { + return a.getStringValue("STRING", a)[a.getField("CASE", a)](); }; Blockly.Blocks.index_of_string = {init:function() { this.setColour(calcBlockColor); @@ -2164,11 +2100,9 @@ Blockly.Blocks.index_of_string = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.index_of_string = function(a, b) { - a = b.getStringValue("LEFTHAND", b); - b = b.getStringValue("RIGHTHAND", b); - b = a.indexOf(b); - return -1 < b ? b + 1 : 0; +Entry.block.index_of_string = function(b, a) { + var d = a.getStringValue("LEFTHAND", a), c = a.getStringValue("RIGHTHAND", a), d = d.indexOf(c); + return -1 < d ? d + 1 : 0; }; Blockly.Blocks.combine_something = {init:function() { this.setColour(calcBlockColor); @@ -2180,10 +2114,9 @@ Blockly.Blocks.combine_something = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "String"); }}; -Entry.block.combine_something = function(a, b) { - a = b.getStringValue("VALUE1", b); - b = b.getStringValue("VALUE2", b); - return a + b; +Entry.block.combine_something = function(b, a) { + var d = a.getStringValue("VALUE1", a), c = a.getStringValue("VALUE2", a); + return d + c; }; Blockly.Blocks.get_sound_volume = {init:function() { this.setColour(calcBlockColor); @@ -2191,7 +2124,7 @@ Blockly.Blocks.get_sound_volume = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_volume = function(a, b) { +Entry.block.get_sound_volume = function(b, a) { return 100 * createjs.Sound.getVolume(); }; Blockly.Blocks.quotient_and_mod = {init:function() { @@ -2203,13 +2136,12 @@ Blockly.Blocks.quotient_and_mod = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.quotient_and_mod = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - var c = b.getNumberValue("RIGHTHAND", b); - if (isNaN(a) || isNaN(c)) { +Entry.block.quotient_and_mod = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + if (isNaN(d) || isNaN(c)) { throw Error(); } - return "QUOTIENT" == b.getField("OPERATOR", b) ? Math.floor(a / c) : a % c; + return "QUOTIENT" == a.getField("OPERATOR", a) ? Math.floor(d / c) : d % c; }; Blockly.Blocks.choose_project_timer_action = {init:function() { this.setColour(calcBlockColor); @@ -2220,18 +2152,17 @@ Blockly.Blocks.choose_project_timer_action = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(a) { - Entry.engine && Entry.engine.hideProjectTimer(a); +}, whenRemove:function(b) { + Entry.engine && Entry.engine.hideProjectTimer(b); }}; -Entry.block.choose_project_timer_action = function(a, b) { - a = b.getField("ACTION"); - var c = Entry.engine, d = c.projectTimer; - "START" == a ? d.isInit ? d.isInit && d.isPaused && (d.pauseStart && (d.pausedTime += (new Date).getTime() - d.pauseStart), delete d.pauseStart, d.isPaused = !1) : c.startProjectTimer() : "STOP" == a ? d.isInit && !d.isPaused && (d.isPaused = !0, d.pauseStart = (new Date).getTime()) : "RESET" == a && d.isInit && (d.setValue(0), d.start = (new Date).getTime(), d.pausedTime = 0, delete d.pauseStart); - return b.callReturn(); +Entry.block.choose_project_timer_action = function(b, a) { + var d = a.getField("ACTION"), c = Entry.engine, e = c.projectTimer; + "START" == d ? e.isInit ? e.isInit && e.isPaused && (e.pauseStart && (e.pausedTime += (new Date).getTime() - e.pauseStart), delete e.pauseStart, e.isPaused = !1) : c.startProjectTimer() : "STOP" == d ? e.isInit && !e.isPaused && (e.isPaused = !0, e.pauseStart = (new Date).getTime()) : "RESET" == d && e.isInit && (e.setValue(0), e.start = (new Date).getTime(), e.pausedTime = 0, delete e.pauseStart); + return a.callReturn(); }; Entry.Cobl = {name:"cobl", setZero:function() { - for (var a = 0;14 > a;a++) { - Entry.hw.sendQueue[a] = 0; + for (var b = 0;14 > b;b++) { + Entry.hw.sendQueue[b] = 0; } Entry.hw.update(); }}; @@ -2241,7 +2172,7 @@ Blockly.Blocks.cobl_read_ultrason = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_ultrason = function(a, b) { +Entry.block.cobl_read_ultrason = function(b, a) { return Entry.hw.getAnalogPortValue("ultrason"); }; Blockly.Blocks.cobl_read_potenmeter = {init:function() { @@ -2250,7 +2181,7 @@ Blockly.Blocks.cobl_read_potenmeter = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_potenmeter = function(a, b) { +Entry.block.cobl_read_potenmeter = function(b, a) { console.log("cobl_read_potenmeter"); return Entry.hw.getAnalogPortValue("potenmeter"); }; @@ -2260,7 +2191,7 @@ Blockly.Blocks.cobl_read_irread1 = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_irread1 = function(a, b) { +Entry.block.cobl_read_irread1 = function(b, a) { return Entry.hw.getAnalogPortValue("potenmeter"); }; Blockly.Blocks.cobl_read_irread2 = {init:function() { @@ -2269,8 +2200,8 @@ Blockly.Blocks.cobl_read_irread2 = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_irread2 = function(a, b) { - b.getValue("irread2", b); +Entry.block.cobl_read_irread2 = function(b, a) { + a.getValue("irread2", a); return Entry.hw.getAnalogPortValue("irread2"); }; Blockly.Blocks.cobl_read_joyx = {init:function() { @@ -2279,7 +2210,7 @@ Blockly.Blocks.cobl_read_joyx = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_joyx = function(a, b) { +Entry.block.cobl_read_joyx = function(b, a) { return Entry.hw.getAnalogPortValue("joyx"); }; Blockly.Blocks.cobl_read_joyy = {init:function() { @@ -2288,7 +2219,7 @@ Blockly.Blocks.cobl_read_joyy = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_joyy = function(a, b) { +Entry.block.cobl_read_joyy = function(b, a) { return Entry.hw.getAnalogPortValue("joyy"); }; Blockly.Blocks.cobl_read_sens1 = {init:function() { @@ -2297,7 +2228,7 @@ Blockly.Blocks.cobl_read_sens1 = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_sens1 = function(a, b) { +Entry.block.cobl_read_sens1 = function(b, a) { return Entry.hw.getAnalogPortValue("sens1"); }; Blockly.Blocks.cobl_read_sens2 = {init:function() { @@ -2306,7 +2237,7 @@ Blockly.Blocks.cobl_read_sens2 = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_sens2 = function(a, b) { +Entry.block.cobl_read_sens2 = function(b, a) { return Entry.hw.getAnalogPortValue("sens2"); }; Blockly.Blocks.cobl_read_tilt = {init:function() { @@ -2315,7 +2246,7 @@ Blockly.Blocks.cobl_read_tilt = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_tilt = function(a, b) { +Entry.block.cobl_read_tilt = function(b, a) { return Entry.hw.getAnalogPortValue("tilt"); }; Blockly.Blocks.cobl_get_port_number = {init:function() { @@ -2325,8 +2256,8 @@ Blockly.Blocks.cobl_get_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.cobl_get_port_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.cobl_get_port_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.cobl_read_temps = {init:function() { this.setColour("#00979D"); @@ -2335,12 +2266,12 @@ Blockly.Blocks.cobl_read_temps = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_temps = function(a, b) { - a = b.getValue("VALUE", b); - if (1 == a) { +Entry.block.cobl_read_temps = function(b, a) { + var d = a.getValue("VALUE", a); + if (1 == d) { return Entry.hw.getAnalogPortValue("temps1"); } - if (2 == a) { + if (2 == d) { return Entry.hw.getAnalogPortValue("temps2"); } }; @@ -2351,12 +2282,12 @@ Blockly.Blocks.cobl_read_light = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.cobl_read_light = function(a, b) { - a = b.getValue("VALUE", b); - if (1 == a) { +Entry.block.cobl_read_light = function(b, a) { + var d = a.getValue("VALUE", a); + if (1 == d) { return Entry.hw.getAnalogPortValue("light1"); } - if (2 == a) { + if (2 == d) { return Entry.hw.getAnalogPortValue("light2"); } }; @@ -2367,12 +2298,12 @@ Blockly.Blocks.cobl_read_btn = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.cobl_read_btn = function(a, b) { - a = b.getValue("VALUE", b); - if (1 == a) { +Entry.block.cobl_read_btn = function(b, a) { + var d = a.getValue("VALUE", a); + if (1 == d) { return Entry.hw.getDigitalPortValue("btn1"); } - if (2 == a) { + if (2 == d) { return Entry.hw.getDigitalPortValue("btn2"); } }; @@ -2386,12 +2317,11 @@ Blockly.Blocks.cobl_led_control = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_led_control = function(a, b) { - a = b.getStringField("PORT"); - var c = b.getStringField("OPERATOR"); - Entry.hw.setDigitalPortValue("RainBowLED_IDX", a); +Entry.block.cobl_led_control = function(b, a) { + var d = a.getStringField("PORT"), c = a.getStringField("OPERATOR"); + Entry.hw.setDigitalPortValue("RainBowLED_IDX", d); Entry.hw.setDigitalPortValue("RainBowLED_COL", c); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.cobl_text = {init:function() { this.setColour("#00979D"); @@ -2399,8 +2329,8 @@ Blockly.Blocks.cobl_text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.cobl_text = function(a, b) { - return b.getStringField("NAME"); +Entry.block.cobl_text = function(b, a) { + return a.getStringField("NAME"); }; Blockly.Blocks.cobl_servo_angle_control = {init:function() { this.setColour("#00979D"); @@ -2413,13 +2343,12 @@ Blockly.Blocks.cobl_servo_angle_control = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_servo_angle_control = function(a, b) { +Entry.block.cobl_servo_angle_control = function(b, a) { console.log("servo - test"); - a = b.getNumberValue("PORT"); - var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 15), c = Math.min(c, 165); - 1 == a && (console.log("servo 1 degree " + c), Entry.hw.setDigitalPortValue("Servo1", c)); - 2 == a && (console.log("servo 2 degree " + c), Entry.hw.setDigitalPortValue("Servo2", c)); - return b.callReturn(); + var d = a.getNumberValue("PORT"), c = a.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 15), c = Math.min(c, 165); + 1 == d && (console.log("servo 1 degree " + c), Entry.hw.setDigitalPortValue("Servo1", c)); + 2 == d && (console.log("servo 2 degree " + c), Entry.hw.setDigitalPortValue("Servo2", c)); + return a.callReturn(); }; Blockly.Blocks.cobl_melody = {init:function() { this.setColour("#00979D"); @@ -2429,11 +2358,11 @@ Blockly.Blocks.cobl_melody = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_melody = function(a, b) { - a = b.getStringField("MELODY"); - console.log("cobl_melody" + a); - Entry.hw.setDigitalPortValue("Melody", a); - return b.callReturn(); +Entry.block.cobl_melody = function(b, a) { + var d = a.getStringField("MELODY"); + console.log("cobl_melody" + d); + Entry.hw.setDigitalPortValue("Melody", d); + return a.callReturn(); }; Blockly.Blocks.cobl_dcmotor = {init:function() { this.setColour("#00979D"); @@ -2447,13 +2376,12 @@ Blockly.Blocks.cobl_dcmotor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_dcmotor = function(a, b) { - a = b.getStringField("MOTOR"); - var c = b.getStringField("DIRECTION"), d = b.getStringField("SPEED"); - console.log("MOTOR" + a + " Direction" + c + " speed" + d); - 1 == a && (Entry.hw.setDigitalPortValue("DC1_DIR", c), Entry.hw.setDigitalPortValue("DC1_SPEED", d)); - 2 == a && (Entry.hw.setDigitalPortValue("DC2_DIR", c), Entry.hw.setDigitalPortValue("DC2_SPEED", d)); - return b.callReturn(); +Entry.block.cobl_dcmotor = function(b, a) { + var d = a.getStringField("MOTOR"), c = a.getStringField("DIRECTION"), e = a.getStringField("SPEED"); + console.log("MOTOR" + d + " Direction" + c + " speed" + e); + 1 == d && (Entry.hw.setDigitalPortValue("DC1_DIR", c), Entry.hw.setDigitalPortValue("DC1_SPEED", e)); + 2 == d && (Entry.hw.setDigitalPortValue("DC2_DIR", c), Entry.hw.setDigitalPortValue("DC2_SPEED", e)); + return a.callReturn(); }; Blockly.Blocks.cobl_extention_port = {init:function() { this.setColour("#00979D"); @@ -2465,12 +2393,11 @@ Blockly.Blocks.cobl_extention_port = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_extention_port = function(a, b) { - a = b.getStringField("PORT"); - var c = b.getStringField("LEVEL"); - 1 == a && Entry.hw.setDigitalPortValue("EXUSB1", c); - 2 == a && Entry.hw.setDigitalPortValue("EXUSB2", c); - return b.callReturn(); +Entry.block.cobl_extention_port = function(b, a) { + var d = a.getStringField("PORT"), c = a.getStringField("LEVEL"); + 1 == d && Entry.hw.setDigitalPortValue("EXUSB1", c); + 2 == d && Entry.hw.setDigitalPortValue("EXUSB2", c); + return a.callReturn(); }; Blockly.Blocks.cobl_external_led = {init:function() { this.setColour("#00979D"); @@ -2487,14 +2414,13 @@ Blockly.Blocks.cobl_external_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_external_led = function(a, b) { - a = b.getNumberValue("LED"); - var c = b.getStringField("RED"), d = b.getStringField("GREEN"), e = b.getStringField("BLUE"); - Entry.hw.setDigitalPortValue("ELED_IDX", a); +Entry.block.cobl_external_led = function(b, a) { + var d = a.getNumberValue("LED"), c = a.getStringField("RED"), e = a.getStringField("GREEN"), f = a.getStringField("BLUE"); + Entry.hw.setDigitalPortValue("ELED_IDX", d); Entry.hw.setDigitalPortValue("ELED_R", c); - Entry.hw.setDigitalPortValue("ELED_G", d); - Entry.hw.setDigitalPortValue("ELED_B", e); - return b.callReturn(); + Entry.hw.setDigitalPortValue("ELED_G", e); + Entry.hw.setDigitalPortValue("ELED_B", f); + return a.callReturn(); }; Blockly.Blocks.cobl_7_segment = {init:function() { this.setColour("#00979D"); @@ -2505,35 +2431,35 @@ Blockly.Blocks.cobl_7_segment = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.cobl_7_segment = function(a, b) { - a = b.getNumberValue("VALUE"); - Entry.hw.setDigitalPortValue("7SEG", a); - return b.callReturn(); +Entry.block.cobl_7_segment = function(b, a) { + var d = a.getNumberValue("VALUE"); + Entry.hw.setDigitalPortValue("7SEG", d); + return a.callReturn(); }; Entry.Codestar = {name:"codestar", setZero:function() { Entry.hw.sendQueue.readablePorts = []; - for (var a = 0;20 > a;a++) { - Entry.hw.sendQueue[a] = 0, Entry.hw.sendQueue.readablePorts.push(a); + for (var b = 0;20 > b;b++) { + Entry.hw.sendQueue[b] = 0, Entry.hw.sendQueue.readablePorts.push(b); } Entry.hw.update(); }, monitorTemplate:{imgPath:"hw/codestar.png", width:333, height:409, listPorts:{13:{name:"\uc9c4\ub3d9\ubaa8\ud130", type:"output", pos:{x:0, y:0}}, 6:{name:"\uc9c4\ub3d9\uc13c\uc11c", type:"input", pos:{x:0, y:0}}}, ports:{7:{name:"\ube68\uac04\uc0c9", type:"output", pos:{x:238, y:108}}, 8:{name:"\ud30c\ub780\uc0c9", type:"output", pos:{x:265, y:126}}, 9:{name:"3\uc0c9 \ube68\uac04\uc0c9", type:"output", pos:{x:292, y:34}}, 10:{name:"3\uc0c9 \ub179\uc0c9", type:"output", pos:{x:292, y:34}}, 11:{name:"3\uc0c9 \ud30c\ub780\uc0c9", type:"output", pos:{x:292, y:34}}, 12:{name:"\ubc84\ud2bc", type:"input", pos:{x:248, y:142}}, a0:{name:"\uc67c\ucabd \ubcbd\uac10\uc9c0", type:"input", pos:{x:24, y:231}}, a2:{name:"\ub9c8\uc774\ud06c", type:"input", pos:{x:225, y:67}}, a3:{name:"\ubd80\uc800", type:"output", pos:{x:283, y:105}}, a4:{name:"\uc67c\ucabd \ub77c\uc778\uac10\uc9c0", type:"input", pos:{x:37, y:353}}, a5:{name:"\uc624\ub978\ucabd \ub77c\uc778\uac10\uc9c0", type:"input", pos:{x:50, y:368}}, a6:{name:"\uc870\ub3c4\uc13c\uc11c", type:"input", pos:{x:273, y:22}}, a7:{name:"\uc624\ub978\ucabd \ubcbd\uac10\uc9c0", type:"input", pos:{x:103, y:381}}, temperature:{name:"\uc628\ub3c4\uc13c\uc11c", type:"input", pos:{x:311, y:238}}, sonar:{name:"\ucd08\uc74c\ud30c", type:"input", pos:{x:7, y:277}}, leftwheel:{name:"\uc67c\ucabd \ubc14\ud034", type:"output", pos:{x:177, y:370}}, rightwheel:{name:"\uc624\ub978\ucabd \ubc14\ud034", type:"output", pos:{x:83, y:218}}}, mode:"both"}}; -Entry.EV3 = {PORT_MAP:{A:0, B:0, C:0, D:0, 1:void 0, 2:void 0, 3:void 0, 4:void 0}, motorMovementTypes:{Degrees:0, Power:1}, deviceTypes:{NxtTouch:1, NxtLight:2, NxtSound:3, NxtColor:4, NxtUltrasonic:5, NxtTemperature:6, LMotor:7, MMotor:8, Touch:16, Color:29, Ultrasonic:30, Gyroscope:32, Infrared:33, Initializing:125, Empty:126, WrongPort:127, Unknown:255}, colorSensorValue:" 000000 0000FF 00FF00 FFFF00 FF0000 FFFFFF A52A2A".split(" "), timeouts:[], removeTimeout:function(a) { - clearTimeout(a); - var b = this.timeouts; - a = b.indexOf(a); - 0 <= a && b.splice(a, 1); +Entry.EV3 = {PORT_MAP:{A:0, B:0, C:0, D:0, 1:void 0, 2:void 0, 3:void 0, 4:void 0}, motorMovementTypes:{Degrees:0, Power:1}, deviceTypes:{NxtTouch:1, NxtLight:2, NxtSound:3, NxtColor:4, NxtUltrasonic:5, NxtTemperature:6, LMotor:7, MMotor:8, Touch:16, Color:29, Ultrasonic:30, Gyroscope:32, Infrared:33, Initializing:125, Empty:126, WrongPort:127, Unknown:255}, colorSensorValue:" 000000 0000FF 00FF00 FFFF00 FF0000 FFFFFF A52A2A".split(" "), timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); }, removeAllTimeouts:function() { - var a = this.timeouts, b; - for (b in a) { - clearTimeout(a[b]); + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); } this.timeouts = []; }, setZero:function() { - var a = this.PORT_MAP; - Object.keys(a).forEach(function(b) { - /[A-D]/i.test(b) ? Entry.hw.sendQueue[b] = {type:Entry.EV3.motorMovementTypes.Power, power:0} : Entry.hw.sendQueue[b] = a[b]; + var b = this.PORT_MAP; + Object.keys(b).forEach(function(a) { + /[A-D]/i.test(a) ? Entry.hw.sendQueue[a] = {type:Entry.EV3.motorMovementTypes.Power, power:0} : Entry.hw.sendQueue[a] = b[a]; }); Entry.hw.update(); }, name:"EV3"}; @@ -2543,11 +2469,10 @@ Blockly.Blocks.ev3_get_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.ev3_get_sensor_value = function(a, b) { - b.getStringField("PORT", b); - a = Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); - var c; - $.isPlainObject(a) && (c = a.siValue || 0); +Entry.block.ev3_get_sensor_value = function(b, a) { + a.getStringField("PORT", a); + var d = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), c; + $.isPlainObject(d) && (c = d.siValue || 0); return c; }; Blockly.Blocks.ev3_touch_sensor = {init:function() { @@ -2556,12 +2481,11 @@ Blockly.Blocks.ev3_touch_sensor = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.ev3_touch_sensor = function(a, b) { - b.getStringField("PORT", b); - a = Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); - b = !1; - a.type == Entry.EV3.deviceTypes.Touch && 1 <= Number(a.siValue) && (b = !0); - return b; +Entry.block.ev3_touch_sensor = function(b, a) { + a.getStringField("PORT", a); + var d = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), c = !1; + d.type == Entry.EV3.deviceTypes.Touch && 1 <= +d.siValue && (c = !0); + return c; }; Blockly.Blocks.ev3_color_sensor = {init:function() { this.setColour("#00979D"); @@ -2569,33 +2493,31 @@ Blockly.Blocks.ev3_color_sensor = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.ev3_color_sensor = function(a, b) { - b.getStringField("PORT", b); - a = b.getStringField("RGB", b); - b = Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); - var c = ""; - if (b.type == Entry.EV3.deviceTypes.Color) { - if (0 == b.siValue) { - c = ""; +Entry.block.ev3_color_sensor = function(b, a) { + a.getStringField("PORT", a); + var d = a.getStringField("RGB", a), c = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), e = ""; + if (c.type == Entry.EV3.deviceTypes.Color) { + if (0 == c.siValue) { + e = ""; } else { - switch(a) { + switch(d) { case "RGB": - c = Entry.EV3.colorSensorValue[b.siValue]; + e = Entry.EV3.colorSensorValue[c.siValue]; break; case "R": - c = Entry.EV3.colorSensorValue[b.siValue].substring(0, 2); + e = Entry.EV3.colorSensorValue[c.siValue].substring(0, 2); break; case "G": - c = Entry.EV3.colorSensorValue[b.siValue].substring(2, 4); + e = Entry.EV3.colorSensorValue[c.siValue].substring(2, 4); break; case "B": - c = Entry.EV3.colorSensorValue[b.siValue].substring(4, 6); + e = Entry.EV3.colorSensorValue[c.siValue].substring(4, 6); } } } else { - c = "\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8"; + e = "\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8"; } - return c; + return e; }; Blockly.Blocks.ev3_motor_power = {init:function() { this.setColour("#00979D"); @@ -2606,11 +2528,10 @@ Blockly.Blocks.ev3_motor_power = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.ev3_motor_power = function(a, b) { - a = b.getStringField("PORT", b); - var c = b.getValue("VALUE", b); - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:c}; - return b.callReturn(); +Entry.block.ev3_motor_power = function(b, a) { + var d = a.getStringField("PORT", a), c = a.getValue("VALUE", a); + Entry.hw.sendQueue[d] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:c}; + return a.callReturn(); }; Blockly.Blocks.ev3_motor_power_on_time = {init:function() { this.setColour("#00979D"); @@ -2623,28 +2544,28 @@ Blockly.Blocks.ev3_motor_power_on_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.ev3_motor_power_on_time = function(a, b) { - a = b.getStringField("PORT", b); - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.ev3_motor_power_on_time = function(b, a) { + var d = a.getStringField("PORT", a); + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:0}; - return b.callReturn(); + Entry.hw.sendQueue[d] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:0}; + return a.callReturn(); } - var c = b.getValue("TIME", b), d = b.getValue("VALUE", b); - b.isStart = !0; - b.timeFlag = 1; - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:d}; - var e = setTimeout(function() { - b.timeFlag = 0; - Entry.EV3.removeTimeout(e); + var c = a.getValue("TIME", a), e = a.getValue("VALUE", a); + a.isStart = !0; + a.timeFlag = 1; + Entry.hw.sendQueue[d] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:e}; + var f = setTimeout(function() { + a.timeFlag = 0; + Entry.EV3.removeTimeout(f); }, 1E3 * c); - Entry.EV3.timeouts.push(e); - return b; + Entry.EV3.timeouts.push(f); + return a; }; Blockly.Blocks.ev3_motor_degrees = {init:function() { this.setColour("#00979D"); @@ -2655,13 +2576,12 @@ Blockly.Blocks.ev3_motor_degrees = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.ev3_motor_degrees = function(a, b) { - a = b.getStringField("PORT", b); - var c = b.getValue("DEGREE", b); +Entry.block.ev3_motor_degrees = function(b, a) { + var d = a.getStringField("PORT", a), c = a.getValue("DEGREE", a); 0 >= c ? c = 0 : 720 <= c && (c = 720); - var d = b.getStringField("DIRECTION", b); - Entry.hw.sendQueue[a] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Degrees, degree:c, power:"CW" == d ? 50 : -50}; - return b.callReturn(); + var e = a.getStringField("DIRECTION", a); + Entry.hw.sendQueue[d] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Degrees, degree:c, power:"CW" == e ? 50 : -50}; + return a.callReturn(); }; Blockly.Blocks.wait_second = {init:function() { this.setColour("#498deb"); @@ -2672,23 +2592,23 @@ Blockly.Blocks.wait_second = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_second = function(a, b) { - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.wait_second = function(b, a) { + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.timeFlag; - delete b.isStart; + delete a.timeFlag; + delete a.isStart; Entry.engine.isContinue = !1; - return b.callReturn(); + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a = b.getNumberValue("SECOND", b); + a.isStart = !0; + a.timeFlag = 1; + var d = a.getNumberValue("SECOND", a), d = 60 / (Entry.FPS || 60) * d * 1E3; setTimeout(function() { - b.timeFlag = 0; - }, 60 / (Entry.FPS || 60) * a * 1E3); - return b; + a.timeFlag = 0; + }, d); + return a; }; Blockly.Blocks.repeat_basic = {init:function() { this.setColour("#498deb"); @@ -2700,20 +2620,21 @@ Blockly.Blocks.repeat_basic = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_basic = function(a, b) { - if (!b.isLooped) { - b.isLooped = !0; - a = b.getNumberValue("VALUE", b); - if (0 > a) { +Entry.block.repeat_basic = function(b, a) { + var d; + if (!a.isLooped) { + a.isLooped = !0; + d = a.getNumberValue("VALUE", a); + if (0 > d) { throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg); } - b.iterCount = Math.floor(a); + a.iterCount = Math.floor(d); } - if (0 == b.iterCount || 0 > b.iterCount) { - return delete b.isLooped, delete b.iterCount, b.callReturn(); + if (0 == a.iterCount || 0 > a.iterCount) { + return delete a.isLooped, delete a.iterCount, a.callReturn(); } - b.iterCount--; - return b.getStatement("DO", b); + a.iterCount--; + return a.getStatement("DO", a); }; Blockly.Blocks.repeat_inf = {init:function() { this.setColour("#498deb"); @@ -2723,9 +2644,9 @@ Blockly.Blocks.repeat_inf = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_inf = function(a, b) { - b.isLooped = !0; - return b.getStatement("DO"); +Entry.block.repeat_inf = function(b, a) { + a.isLooped = !0; + return a.getStatement("DO"); }; Blockly.Blocks.stop_repeat = {init:function() { this.setColour("#498deb"); @@ -2734,7 +2655,7 @@ Blockly.Blocks.stop_repeat = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_repeat = function(a, b) { +Entry.block.stop_repeat = function(b, a) { return this.executor.break(); }; Blockly.Blocks.wait_until_true = {init:function() { @@ -2746,8 +2667,8 @@ Blockly.Blocks.wait_until_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_until_true = function(a, b) { - return b.getBooleanValue("BOOL", b) ? b.callReturn() : b; +Entry.block.wait_until_true = function(b, a) { + return a.getBooleanValue("BOOL", a) ? a.callReturn() : a; }; Blockly.Blocks._if = {init:function() { this.setColour("#498deb"); @@ -2759,8 +2680,8 @@ Blockly.Blocks._if = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block._if = function(a, b) { - return b.isLooped ? (delete b.isLooped, b.callReturn()) : b.getBooleanValue("BOOL", b) ? (b.isLooped = !0, b.getStatement("STACK", b)) : b.callReturn(); +Entry.block._if = function(b, a) { + return a.isLooped ? (delete a.isLooped, a.callReturn()) : a.getBooleanValue("BOOL", a) ? (a.isLooped = !0, a.getStatement("STACK", a)) : a.callReturn(); }; Blockly.Blocks.if_else = {init:function() { this.setColour("#498deb"); @@ -2774,13 +2695,13 @@ Blockly.Blocks.if_else = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.if_else = function(a, b) { - if (b.isLooped) { - return delete b.isLooped, b.callReturn(); +Entry.block.if_else = function(b, a) { + if (a.isLooped) { + return delete a.isLooped, a.callReturn(); } - a = b.getBooleanValue("BOOL", b); - b.isLooped = !0; - return a ? b.getStatement("STACK_IF", b) : b.getStatement("STACK_ELSE", b); + var d = a.getBooleanValue("BOOL", a); + a.isLooped = !0; + return d ? a.getStatement("STACK_IF", a) : a.getStatement("STACK_ELSE", a); }; Blockly.Blocks.create_clone = {init:function() { this.setColour("#498deb"); @@ -2791,11 +2712,10 @@ Blockly.Blocks.create_clone = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.create_clone = function(a, b) { - var c = b.getField("VALUE", b); - b = b.callReturn(); - "self" == c ? a.parent.addCloneEntity(a.parent, a, null) : Entry.container.getObject(c).addCloneEntity(a.parent, null, null); - return b; +Entry.block.create_clone = function(b, a) { + var d = a.getField("VALUE", a), c = a.callReturn(); + "self" == d ? b.parent.addCloneEntity(b.parent, b, null) : Entry.container.getObject(d).addCloneEntity(b.parent, null, null); + return c; }; Blockly.Blocks.delete_clone = {init:function() { this.setColour("#498deb"); @@ -2803,11 +2723,11 @@ Blockly.Blocks.delete_clone = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.delete_clone = function(a, b) { - if (!a.isClone) { - return b.callReturn(); +Entry.block.delete_clone = function(b, a) { + if (!b.isClone) { + return a.callReturn(); } - a.removeClone(); + b.removeClone(); }; Blockly.Blocks.when_clone_start = {init:function() { this.setColour("#498deb"); @@ -2815,8 +2735,8 @@ Blockly.Blocks.when_clone_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_clone_start = function(a, b) { - return b.callReturn(); +Entry.block.when_clone_start = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.stop_run = {init:function() { this.setColour("#498deb"); @@ -2825,7 +2745,7 @@ Blockly.Blocks.stop_run = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_run = function(a, b) { +Entry.block.stop_run = function(b, a) { return Entry.engine.toggleStop(); }; Blockly.Blocks.repeat_while_true = {init:function() { @@ -2837,10 +2757,10 @@ Blockly.Blocks.repeat_while_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_while_true = function(a, b) { - a = b.getBooleanValue("BOOL", b); - "until" == b.getField("OPTION", b) && (a = !a); - return (b.isLooped = a) ? b.getStatement("DO", b) : b.callReturn(); +Entry.block.repeat_while_true = function(b, a) { + var d = a.getBooleanValue("BOOL", a); + "until" == a.getField("OPTION", a) && (d = !d); + return (a.isLooped = d) ? a.getStatement("DO", a) : a.callReturn(); }; Blockly.Blocks.stop_object = {init:function() { this.setColour("#498deb"); @@ -2851,18 +2771,17 @@ Blockly.Blocks.stop_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_object = function(a, b) { - b = b.getField("TARGET", b); - var c = Entry.container; - switch(b) { +Entry.block.stop_object = function(b, a) { + var d = a.getField("TARGET", a), c = Entry.container; + switch(d) { case "all": return c.clearRunningState(), this.die(); case "thisOnly": - return a.parent.script.clearExecutorsByEntity(a), this.die(); + return b.parent.script.clearExecutorsByEntity(b), this.die(); case "thisThread": return this.die(); case "otherThread": - a.parent.script.clearExecutors(), a.parent.script.addExecutor(this.executor); + b.parent.script.clearExecutors(), b.parent.script.addExecutor(this.executor); } }; Blockly.Blocks.restart_project = {init:function() { @@ -2871,7 +2790,7 @@ Blockly.Blocks.restart_project = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.restart_project = function(a, b) { +Entry.block.restart_project = function(b, a) { Entry.engine.toggleStop(); Entry.engine.toggleRun(); }; @@ -2882,13 +2801,13 @@ Blockly.Blocks.remove_all_clones = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_all_clones = function(a, b) { - a = a.parent.getClonedEntities(); - a.map(function(b) { - b.removeClone(); +Entry.block.remove_all_clones = function(b, a) { + var d = b.parent.getClonedEntities(); + d.map(function(a) { + a.removeClone(); }); - a = null; - return b.callReturn(); + d = null; + return a.callReturn(); }; Entry.block.functionAddButton = {skeleton:"basic_button", color:"#eee", isNotFor:["functionInit"], template:"%1", params:[{type:"Text", text:"\ud568\uc218 \ucd94\uac00", color:"#333", align:"center"}], events:{mousedown:[function() { Entry.variableContainer.createFunction(); @@ -2922,18 +2841,18 @@ Blockly.Blocks.function_param_string = {init:function() { this.setColour("#FFD974"); this.setOutput(!0, ["String", "Number"]); this.setInputsInline(!0); -}, domToMutation:function(a) { - a.getElementsByTagName("field"); - this.hashId = a.getAttribute("hashid"); - (a = Entry.Func.targetFunc.stringHash[this.hashId]) || (a = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + a), ""); +}, domToMutation:function(b) { + b.getElementsByTagName("field"); + this.hashId = b.getAttribute("hashid"); + (b = Entry.Func.targetFunc.stringHash[this.hashId]) || (b = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + b), ""); }, mutationToDom:function() { - var a = document.createElement("mutation"); - a.setAttribute("hashid", this.hashId); - return a; + var b = document.createElement("mutation"); + b.setAttribute("hashid", this.hashId); + return b; }}; -Entry.block.function_param_string = function(a, b, c) { - return b.register[b.hashId].run(); +Entry.block.function_param_string = function(b, a, d) { + return a.register[a.hashId].run(); }; Entry.block.function_param_string = {skeleton:"basic_string_field", color:"#ffd974", template:"\ubb38\uc790/\uc22b\uc790\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2943,18 +2862,18 @@ Blockly.Blocks.function_param_boolean = {init:function() { this.setColour("#AEB8FF"); this.setOutput(!0, "Boolean"); this.setInputsInline(!0); -}, domToMutation:function(a) { - a.getElementsByTagName("field"); - this.hashId = a.getAttribute("hashid"); - (a = Entry.Func.targetFunc.booleanHash[this.hashId]) || (a = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + a), ""); +}, domToMutation:function(b) { + b.getElementsByTagName("field"); + this.hashId = b.getAttribute("hashid"); + (b = Entry.Func.targetFunc.booleanHash[this.hashId]) || (b = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + b), ""); }, mutationToDom:function() { - var a = document.createElement("mutation"); - a.setAttribute("hashid", this.hashId); - return a; + var b = document.createElement("mutation"); + b.setAttribute("hashid", this.hashId); + return b; }}; -Entry.block.function_param_boolean = function(a, b, c) { - return b.register[b.hashId].run(); +Entry.block.function_param_boolean = function(b, a, d) { + return a.register[a.hashId].run(); }; Entry.block.function_param_boolean = {skeleton:"basic_boolean_field", color:"#aeb8ff", template:"\ud310\ub2e8\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2967,8 +2886,8 @@ Blockly.Blocks.function_create = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.function_create = function(a, b) { - return b.callReturn(); +Entry.block.function_create = function(b, a) { + return a.callReturn(); }; Entry.block.function_create = {skeleton:"basic", color:"#cc7337", event:"funcDef", template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2", params:[{type:"Block", accept:"paramMagnet", value:{type:"function_field_label"}}, {type:"Indicator", img:"/lib/entryjs/images/block_icon/function_03.png", size:12}], func:function() { }}; @@ -2977,15 +2896,15 @@ Blockly.Blocks.function_general = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, domToMutation:function(a) { - var b = a.getElementsByTagName("field"); +}, domToMutation:function(b) { + var a = b.getElementsByTagName("field"); this.appendDummyInput().appendField(""); - b.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); - for (var c = 0;c < b.length;c++) { - var d = b[c], e = d.getAttribute("hashid"); - switch(d.getAttribute("type").toLowerCase()) { + a.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); + for (var d = 0;d < a.length;d++) { + var c = a[d], e = c.getAttribute("hashid"); + switch(c.getAttribute("type").toLowerCase()) { case "label": - this.appendDummyInput().appendField(d.getAttribute("content")); + this.appendDummyInput().appendField(c.getAttribute("content")); break; case "string": this.appendValueInput(e).setCheck(["String", "Number"]); @@ -2994,46 +2913,46 @@ Blockly.Blocks.function_general = {init:function() { this.appendValueInput(e).setCheck(["Boolean"]); } } - this.hashId = a.getAttribute("hashid"); + this.hashId = b.getAttribute("hashid"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/function_03.png", "*")); }, mutationToDom:function() { - for (var a = document.createElement("mutation"), b = 1;b < this.inputList.length;b++) { - var c = this.inputList[b]; - if (c.fieldRow[0] && c.fieldRow[0] instanceof Blockly.FieldLabel) { - var c = c.fieldRow[0], d = document.createElement("field"); - d.setAttribute("type", "label"); - d.setAttribute("content", c.text_); + for (var b = document.createElement("mutation"), a = 1;a < this.inputList.length;a++) { + var d = this.inputList[a]; + if (d.fieldRow[0] && d.fieldRow[0] instanceof Blockly.FieldLabel) { + var d = d.fieldRow[0], c = document.createElement("field"); + c.setAttribute("type", "label"); + c.setAttribute("content", d.text_); } else { - c.connection && "String" == c.connection.check_[0] ? (d = document.createElement("field"), d.setAttribute("type", "string"), d.setAttribute("hashid", c.name)) : c.connection && "Boolean" == c.connection.check_[0] && (d = document.createElement("field"), d.setAttribute("type", "boolean"), d.setAttribute("hashid", c.name)); + d.connection && "String" == d.connection.check_[0] ? (c = document.createElement("field"), c.setAttribute("type", "string"), c.setAttribute("hashid", d.name)) : d.connection && "Boolean" == d.connection.check_[0] && (c = document.createElement("field"), c.setAttribute("type", "boolean"), c.setAttribute("hashid", d.name)); } - a.appendChild(d); + b.appendChild(c); } - a.setAttribute("hashid", this.hashId); - return a; + b.setAttribute("hashid", this.hashId); + return b; }}; -Entry.block.function_general = function(a, b) { - if (!b.thread) { - var c = Entry.variableContainer.getFunction(b.hashId); - b.thread = new Entry.Script(a); - b.thread.register = b.values; - for (var d = 0;d < c.content.childNodes.length;d++) { - "function_create" == c.content.childNodes[d].getAttribute("type") && b.thread.init(c.content.childNodes[d]); +Entry.block.function_general = function(b, a) { + if (!a.thread) { + var d = Entry.variableContainer.getFunction(a.hashId); + a.thread = new Entry.Script(b); + a.thread.register = a.values; + for (var c = 0;c < d.content.childNodes.length;c++) { + "function_create" == d.content.childNodes[c].getAttribute("type") && a.thread.init(d.content.childNodes[c]); } } - if (a = Entry.Engine.computeThread(a, b.thread)) { - return b.thread = a, b; + if (d = Entry.Engine.computeThread(b, a.thread)) { + return a.thread = d, a; } - delete b.thread; - return b.callReturn(); + delete a.thread; + return a.callReturn(); }; -Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(a) { +Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(b) { if (!this.initiated) { this.initiated = !0; - var b = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); - this.funcCode = b.content; - this.funcExecutor = this.funcCode.raiseEvent("funcDef", a)[0]; + var a = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); + this.funcCode = a.content; + this.funcExecutor = this.funcCode.raiseEvent("funcDef", b)[0]; this.funcExecutor.register.params = this.getParams(); - this.funcExecutor.register.paramMap = b.paramMap; + this.funcExecutor.register.paramMap = a.paramMap; } this.funcExecutor.execute(); if (!this.funcExecutor.isEnd()) { @@ -3041,31 +2960,31 @@ Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud } }}; Entry.Hamster = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, outputA:0, outputB:0, leftLed:0, rightLed:0, note:0, lineTracerMode:0, lineTracerModeId:0, lineTracerSpeed:5, ioModeA:0, ioModeB:0}, setZero:function() { - var a = Entry.Hamster.PORT_MAP, b = Entry.hw.sendQueue, c; - for (c in a) { - b[c] = a[c]; + var b = Entry.Hamster.PORT_MAP, a = Entry.hw.sendQueue, d; + for (d in b) { + a[d] = b[d]; } Entry.hw.update(); - a = Entry.Hamster; - a.lineTracerModeId = 0; - a.lineTracerStateId = -1; - a.tempo = 60; - a.removeAllTimeouts(); -}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(a) { - clearTimeout(a); - var b = this.timeouts; - a = b.indexOf(a); - 0 <= a && b.splice(a, 1); + b = Entry.Hamster; + b.lineTracerModeId = 0; + b.lineTracerStateId = -1; + b.tempo = 60; + b.removeAllTimeouts(); +}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); }, removeAllTimeouts:function() { - var a = this.timeouts, b; - for (b in a) { - clearTimeout(a[b]); + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); } this.timeouts = []; -}, setLineTracerMode:function(a, b) { +}, setLineTracerMode:function(b, a) { this.lineTracerModeId = this.lineTracerModeId + 1 & 255; - a.lineTracerMode = b; - a.lineTracerModeId = this.lineTracerModeId; + b.lineTracerMode = a; + b.lineTracerModeId = this.lineTracerModeId; }, name:"hamster", monitorTemplate:{imgPath:"hw/hamster.png", width:256, height:256, listPorts:{temperature:{name:Lang.Blocks.HAMSTER_sensor_temperature, type:"input", pos:{x:0, y:0}}, inputA:{name:Lang.Blocks.HAMSTER_sensor_input_a, type:"input", pos:{x:0, y:0}}, inputB:{name:Lang.Blocks.HAMSTER_sensor_input_b, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.HAMSTER_sensor_acceleration_x, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.HAMSTER_sensor_acceleration_y, type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.HAMSTER_sensor_acceleration_z, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}, outputA:{name:Lang.Hw.output + "A", type:"output", pos:{x:0, y:0}}, outputB:{name:Lang.Hw.output + "B", type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.HAMSTER_sensor_left_proximity, type:"input", pos:{x:122, y:156}}, rightProximity:{name:Lang.Blocks.HAMSTER_sensor_right_proximity, type:"input", pos:{x:10, y:108}}, leftFloor:{name:Lang.Blocks.HAMSTER_sensor_left_floor, type:"input", pos:{x:100, y:234}}, rightFloor:{name:Lang.Blocks.HAMSTER_sensor_right_floor, type:"input", pos:{x:13, y:180}}, light:{name:Lang.Blocks.HAMSTER_sensor_light, type:"input", pos:{x:56, y:189}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:209, y:115}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:98, y:30}}, leftLed:{name:Lang.Hw.left + " " + Lang.Hw.led_en, type:"output", @@ -3076,9 +2995,9 @@ Blockly.Blocks.hamster_hand_found = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.hamster_hand_found = function(a, b) { - a = Entry.hw.portData; - return 50 < a.leftProximity || 50 < a.rightProximity; +Entry.block.hamster_hand_found = function(b, a) { + var d = Entry.hw.portData; + return 50 < d.leftProximity || 50 < d.rightProximity; }; Blockly.Blocks.hamster_value = {init:function() { this.setColour("#00979D"); @@ -3087,10 +3006,9 @@ Blockly.Blocks.hamster_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.hamster_value = function(a, b) { - a = Entry.hw.portData; - b = b.getField("DEVICE"); - return a[b]; +Entry.block.hamster_value = function(b, a) { + var d = Entry.hw.portData, c = a.getField("DEVICE"); + return d[c]; }; Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setColour("#00979D"); @@ -3099,53 +3017,52 @@ Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_once = function(a, b) { - a = Entry.hw.sendQueue; - var c = Entry.hw.portData; - if (b.isStart) { - if (b.isMoving) { - switch(b.boardState) { +Entry.block.hamster_move_forward_once = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.hw.portData; + if (a.isStart) { + if (a.isMoving) { + switch(a.boardState) { case 1: - 2 > b.count ? (50 > c.leftFloor && 50 > c.rightFloor ? b.count++ : b.count = 0, c = c.leftFloor - c.rightFloor, a.leftWheel = 45 + .25 * c, a.rightWheel = 45 - .25 * c) : (b.count = 0, b.boardState = 2); + 2 > a.count ? (50 > c.leftFloor && 50 > c.rightFloor ? a.count++ : a.count = 0, c = c.leftFloor - c.rightFloor, d.leftWheel = 45 + .25 * c, d.rightWheel = 45 - .25 * c) : (a.count = 0, a.boardState = 2); break; case 2: c = c.leftFloor - c.rightFloor; - a.leftWheel = 45 + .25 * c; - a.rightWheel = 45 - .25 * c; - b.boardState = 3; - var d = setTimeout(function() { - b.boardState = 4; - Entry.Hamster.removeTimeout(d); + d.leftWheel = 45 + .25 * c; + d.rightWheel = 45 - .25 * c; + a.boardState = 3; + var e = setTimeout(function() { + a.boardState = 4; + Entry.Hamster.removeTimeout(e); }, 250); - Entry.Hamster.timeouts.push(d); + Entry.Hamster.timeouts.push(e); break; case 3: c = c.leftFloor - c.rightFloor; - a.leftWheel = 45 + .25 * c; - a.rightWheel = 45 - .25 * c; + d.leftWheel = 45 + .25 * c; + d.rightWheel = 45 - .25 * c; break; case 4: - a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1; + d.leftWheel = 0, d.rightWheel = 0, a.boardState = 0, a.isMoving = !1; } - return b; + return a; } - delete b.isStart; - delete b.isMoving; - delete b.count; - delete b.boardState; + delete a.isStart; + delete a.isMoving; + delete a.count; + delete a.boardState; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.isMoving = !0; - b.count = 0; - b.boardState = 1; - a.leftWheel = 45; - a.rightWheel = 45; - Entry.Hamster.setLineTracerMode(a, 0); - return b; + a.isStart = !0; + a.isMoving = !0; + a.count = 0; + a.boardState = 1; + d.leftWheel = 45; + d.rightWheel = 45; + Entry.Hamster.setLineTracerMode(d, 0); + return a; }; Blockly.Blocks.hamster_turn_once = {init:function() { this.setColour("#00979D"); @@ -3154,65 +3071,64 @@ Blockly.Blocks.hamster_turn_once = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_once = function(a, b) { - a = Entry.hw.sendQueue; - var c = Entry.hw.portData; - if (b.isStart) { - if (b.isMoving) { - if (b.isLeft) { - switch(b.boardState) { +Entry.block.hamster_turn_once = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.hw.portData; + if (a.isStart) { + if (a.isMoving) { + if (a.isLeft) { + switch(a.boardState) { case 1: - 2 > b.count ? 50 < c.leftFloor && b.count++ : (b.count = 0, b.boardState = 2); + 2 > a.count ? 50 < c.leftFloor && a.count++ : (a.count = 0, a.boardState = 2); break; case 2: - 20 > c.leftFloor && (b.boardState = 3); + 20 > c.leftFloor && (a.boardState = 3); break; case 3: - 2 > b.count ? 20 > c.leftFloor && b.count++ : (b.count = 0, b.boardState = 4); + 2 > a.count ? 20 > c.leftFloor && a.count++ : (a.count = 0, a.boardState = 4); break; case 4: - 50 < c.leftFloor && (b.boardState = 5); + 50 < c.leftFloor && (a.boardState = 5); break; case 5: - c = c.leftFloor - c.rightFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * c, a.rightWheel = .5 * -c); + c = c.leftFloor - c.rightFloor, -15 < c ? (d.leftWheel = 0, d.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (d.leftWheel = .5 * c, d.rightWheel = .5 * -c); } } else { - switch(b.boardState) { + switch(a.boardState) { case 1: - 2 > b.count ? 50 < c.rightFloor && b.count++ : (b.count = 0, b.boardState = 2); + 2 > a.count ? 50 < c.rightFloor && a.count++ : (a.count = 0, a.boardState = 2); break; case 2: - 20 > c.rightFloor && (b.boardState = 3); + 20 > c.rightFloor && (a.boardState = 3); break; case 3: - 2 > b.count ? 20 > c.rightFloor && b.count++ : (b.count = 0, b.boardState = 4); + 2 > a.count ? 20 > c.rightFloor && a.count++ : (a.count = 0, a.boardState = 4); break; case 4: - 50 < c.rightFloor && (b.boardState = 5); + 50 < c.rightFloor && (a.boardState = 5); break; case 5: - c = c.rightFloor - c.leftFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * -c, a.rightWheel = .5 * c); + c = c.rightFloor - c.leftFloor, -15 < c ? (d.leftWheel = 0, d.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (d.leftWheel = .5 * -c, d.rightWheel = .5 * c); } } - return b; + return a; } - delete b.isStart; - delete b.isMoving; - delete b.count; - delete b.boardState; - delete b.isLeft; + delete a.isStart; + delete a.isMoving; + delete a.count; + delete a.boardState; + delete a.isLeft; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.isMoving = !0; - b.count = 0; - b.boardState = 1; - "LEFT" == b.getField("DIRECTION", b) ? (b.isLeft = !0, a.leftWheel = -45, a.rightWheel = 45) : (b.isLeft = !1, a.leftWheel = 45, a.rightWheel = -45); - Entry.Hamster.setLineTracerMode(a, 0); - return b; + a.isStart = !0; + a.isMoving = !0; + a.count = 0; + a.boardState = 1; + "LEFT" == a.getField("DIRECTION", a) ? (a.isLeft = !0, d.leftWheel = -45, d.rightWheel = 45) : (a.isLeft = !1, d.leftWheel = 45, d.rightWheel = -45); + Entry.Hamster.setLineTracerMode(d, 0); + return a; }; Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -3223,31 +3139,30 @@ Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_move_forward_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.leftWheel = 30; - a.rightWheel = 30; - Entry.Hamster.setLineTracerMode(a, 0); - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + d.leftWheel = 30; + d.rightWheel = 30; + Entry.Hamster.setLineTracerMode(d, 0); + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Hamster.removeTimeout(c); - }, a); + }, d); Entry.Hamster.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -3258,31 +3173,30 @@ Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_backward_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_move_backward_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.leftWheel = -30; - a.rightWheel = -30; - Entry.Hamster.setLineTracerMode(a, 0); - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + d.leftWheel = -30; + d.rightWheel = -30; + Entry.Hamster.setLineTracerMode(d, 0); + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Hamster.removeTimeout(c); - }, a); + }, d); Entry.Hamster.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.hamster_turn_for_secs = {init:function() { this.setColour("#00979D"); @@ -3293,30 +3207,29 @@ Blockly.Blocks.hamster_turn_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_for_secs = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_turn_for_secs = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.leftWheel = 0; - a.rightWheel = 0; - return b.callReturn(); + d.leftWheel = 0; + d.rightWheel = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); - Entry.Hamster.setLineTracerMode(a, 0); - a = 1E3 * b.getNumberValue("VALUE"); - var c = setTimeout(function() { - b.timeFlag = 0; + a.isStart = !0; + a.timeFlag = 1; + "LEFT" == a.getField("DIRECTION", a) ? (d.leftWheel = -30, d.rightWheel = 30) : (d.leftWheel = 30, d.rightWheel = -30); + Entry.Hamster.setLineTracerMode(d, 0); + var d = 1E3 * a.getNumberValue("VALUE"), c = setTimeout(function() { + a.timeFlag = 0; Entry.Hamster.removeTimeout(c); - }, a); + }, d); Entry.Hamster.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -3329,13 +3242,12 @@ Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_both_wheels_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); - a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; - a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; - Entry.Hamster.setLineTracerMode(a, 0); - return b.callReturn(); +Entry.block.hamster_change_both_wheels_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); + d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + c : c; + d.rightWheel = void 0 != d.rightWheel ? d.rightWheel + e : e; + Entry.Hamster.setLineTracerMode(d, 0); + return a.callReturn(); }; Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -3348,12 +3260,12 @@ Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_both_wheels_to = function(a, b) { - a = Entry.hw.sendQueue; - a.leftWheel = b.getNumberValue("LEFT"); - a.rightWheel = b.getNumberValue("RIGHT"); - Entry.Hamster.setLineTracerMode(a, 0); - return b.callReturn(); +Entry.block.hamster_set_both_wheels_to = function(b, a) { + var d = Entry.hw.sendQueue; + d.leftWheel = a.getNumberValue("LEFT"); + d.rightWheel = a.getNumberValue("RIGHT"); + Entry.Hamster.setLineTracerMode(d, 0); + return a.callReturn(); }; Blockly.Blocks.hamster_change_wheel_by = {init:function() { this.setColour("#00979D"); @@ -3364,12 +3276,11 @@ Blockly.Blocks.hamster_change_wheel_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_wheel_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); - "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); - Entry.Hamster.setLineTracerMode(a, 0); - return b.callReturn(); +Entry.block.hamster_change_wheel_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); + "LEFT" == c ? d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + e : e : ("RIGHT" != c && (d.leftWheel = void 0 != d.leftWheel ? d.leftWheel + e : e), d.rightWheel = void 0 != d.rightWheel ? d.rightWheel + e : e); + Entry.Hamster.setLineTracerMode(d, 0); + return a.callReturn(); }; Blockly.Blocks.hamster_set_wheel_to = {init:function() { this.setColour("#00979D"); @@ -3380,12 +3291,11 @@ Blockly.Blocks.hamster_set_wheel_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_wheel_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); - "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); - Entry.Hamster.setLineTracerMode(a, 0); - return b.callReturn(); +Entry.block.hamster_set_wheel_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); + "LEFT" == c ? d.leftWheel = e : ("RIGHT" != c && (d.leftWheel = e), d.rightWheel = e); + Entry.Hamster.setLineTracerMode(d, 0); + return a.callReturn(); }; Blockly.Blocks.hamster_follow_line_using = {init:function() { this.setColour("#00979D"); @@ -3395,15 +3305,14 @@ Blockly.Blocks.hamster_follow_line_using = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_follow_line_using = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("COLOR"), d = b.getField("DIRECTION"), e = 1; - "RIGHT" == d ? e = 2 : "BOTH" == d && (e = 3); - "WHITE" == c && (e += 7); - a.leftWheel = 0; - a.rightWheel = 0; - Entry.Hamster.setLineTracerMode(a, e); - return b.callReturn(); +Entry.block.hamster_follow_line_using = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("COLOR"), e = a.getField("DIRECTION"), f = 1; + "RIGHT" == e ? f = 2 : "BOTH" == e && (f = 3); + "WHITE" == c && (f += 7); + d.leftWheel = 0; + d.rightWheel = 0; + Entry.Hamster.setLineTracerMode(d, f); + return a.callReturn(); }; Blockly.Blocks.hamster_follow_line_until = {init:function() { this.setColour("#00979D"); @@ -3413,19 +3322,18 @@ Blockly.Blocks.hamster_follow_line_until = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_follow_line_until = function(a, b) { - a = Entry.hw.sendQueue; - var c = Entry.hw.portData, d = b.getField("COLOR"), e = b.getField("DIRECTION"), f = 4; - "RIGHT" == e ? f = 5 : "FRONT" == e ? f = 6 : "REAR" == e && (f = 7); - "WHITE" == d && (f += 7); - if (b.isStart) { - if (d = Entry.Hamster, c.lineTracerStateId != d.lineTracerStateId && (d.lineTracerStateId = c.lineTracerStateId, 64 == c.lineTracerState)) { - return delete b.isStart, Entry.engine.isContinue = !1, d.setLineTracerMode(a, 0), b.callReturn(); +Entry.block.hamster_follow_line_until = function(b, a) { + var d = Entry.hw.sendQueue, c = Entry.hw.portData, e = a.getField("COLOR"), f = a.getField("DIRECTION"), g = 4; + "RIGHT" == f ? g = 5 : "FRONT" == f ? g = 6 : "REAR" == f && (g = 7); + "WHITE" == e && (g += 7); + if (a.isStart) { + if (e = Entry.Hamster, c.lineTracerStateId != e.lineTracerStateId && (e.lineTracerStateId = c.lineTracerStateId, 64 == c.lineTracerState)) { + return delete a.isStart, Entry.engine.isContinue = !1, e.setLineTracerMode(d, 0), a.callReturn(); } } else { - b.isStart = !0, a.leftWheel = 0, a.rightWheel = 0, Entry.Hamster.setLineTracerMode(a, f); + a.isStart = !0, d.leftWheel = 0, d.rightWheel = 0, Entry.Hamster.setLineTracerMode(d, g); } - return b; + return a; }; Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setColour("#00979D"); @@ -3434,9 +3342,9 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_following_speed_to = function(a, b) { - Entry.hw.sendQueue.lineTracerSpeed = Number(b.getField("SPEED", b)); - return b.callReturn(); +Entry.block.hamster_set_following_speed_to = function(b, a) { + Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); + return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { this.setColour("#00979D"); @@ -3445,12 +3353,12 @@ Blockly.Blocks.hamster_stop = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_stop = function(a, b) { - a = Entry.hw.sendQueue; - a.leftWheel = 0; - a.rightWheel = 0; - Entry.Hamster.setLineTracerMode(a, 0); - return b.callReturn(); +Entry.block.hamster_stop = function(b, a) { + var d = Entry.hw.sendQueue; + d.leftWheel = 0; + d.rightWheel = 0; + Entry.Hamster.setLineTracerMode(d, 0); + return a.callReturn(); }; Blockly.Blocks.hamster_set_led_to = {init:function() { this.setColour("#00979D"); @@ -3460,11 +3368,10 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_led_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); - "LEFT" == c ? a.leftLed = d : ("RIGHT" != c && (a.leftLed = d), a.rightLed = d); - return b.callReturn(); +Entry.block.hamster_set_led_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + "LEFT" == c ? d.leftLed = e : ("RIGHT" != c && (d.leftLed = e), d.rightLed = e); + return a.callReturn(); }; Blockly.Blocks.hamster_clear_led = {init:function() { this.setColour("#00979D"); @@ -3473,11 +3380,10 @@ Blockly.Blocks.hamster_clear_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_clear_led = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("DIRECTION", b); - "LEFT" == c ? a.leftLed = 0 : ("RIGHT" != c && (a.leftLed = 0), a.rightLed = 0); - return b.callReturn(); +Entry.block.hamster_clear_led = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("DIRECTION", a); + "LEFT" == c ? d.leftLed = 0 : ("RIGHT" != c && (d.leftLed = 0), d.rightLed = 0); + return a.callReturn(); }; Blockly.Blocks.hamster_beep = {init:function() { this.setColour("#00979D"); @@ -3486,28 +3392,28 @@ Blockly.Blocks.hamster_beep = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_beep = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_beep = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - a.buzzer = 0; - return b.callReturn(); + d.buzzer = 0; + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - a.buzzer = 440; - a.note = 0; + a.isStart = !0; + a.timeFlag = 1; + d.buzzer = 440; + d.note = 0; var c = setTimeout(function() { - b.timeFlag = 0; + a.timeFlag = 0; Entry.Hamster.removeTimeout(c); }, 200); Entry.Hamster.timeouts.push(c); - return b; + return a; }; Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -3518,12 +3424,11 @@ Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_buzzer_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getNumberValue("VALUE"); - a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; - a.note = 0; - return b.callReturn(); +Entry.block.hamster_change_buzzer_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getNumberValue("VALUE"); + d.buzzer = void 0 != d.buzzer ? d.buzzer + c : c; + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -3534,11 +3439,11 @@ Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_buzzer_to = function(a, b) { - a = Entry.hw.sendQueue; - a.buzzer = b.getNumberValue("VALUE"); - a.note = 0; - return b.callReturn(); +Entry.block.hamster_set_buzzer_to = function(b, a) { + var d = Entry.hw.sendQueue; + d.buzzer = a.getNumberValue("VALUE"); + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -3547,11 +3452,11 @@ Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_clear_buzzer = function(a, b) { - a = Entry.hw.sendQueue; - a.buzzer = 0; - a.note = 0; - return b.callReturn(); +Entry.block.hamster_clear_buzzer = function(b, a) { + var d = Entry.hw.sendQueue; + d.buzzer = 0; + d.note = 0; + return a.callReturn(); }; Blockly.Blocks.hamster_play_note_for = {init:function() { this.setColour("#00979D"); @@ -3563,37 +3468,36 @@ Blockly.Blocks.hamster_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_play_note_for = function(a, b) { - var c = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_play_note_for = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - c.note = 0; - return b.callReturn(); + d.note = 0; + return a.callReturn(); } - a = b.getNumberField("NOTE", b); - var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Hamster.tempo; - b.isStart = !0; - b.timeFlag = 1; - c.buzzer = 0; - c.note = a + 12 * (d - 1); - if (100 < e) { - var f = setTimeout(function() { - c.note = 0; - Entry.Hamster.removeTimeout(f); - }, e - 100); - Entry.Hamster.timeouts.push(f); - } - var g = setTimeout(function() { - b.timeFlag = 0; - Entry.Hamster.removeTimeout(g); - }, e); - Entry.Hamster.timeouts.push(g); - return b; + var c = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Hamster.tempo, f = 6E4 * f / g; + a.isStart = !0; + a.timeFlag = 1; + d.buzzer = 0; + d.note = c + 12 * (e - 1); + if (100 < f) { + var h = setTimeout(function() { + d.note = 0; + Entry.Hamster.removeTimeout(h); + }, f - 100); + Entry.Hamster.timeouts.push(h); + } + var k = setTimeout(function() { + a.timeFlag = 0; + Entry.Hamster.removeTimeout(k); + }, f); + Entry.Hamster.timeouts.push(k); + return a; }; Blockly.Blocks.hamster_rest_for = {init:function() { this.setColour("#00979D"); @@ -3604,28 +3508,28 @@ Blockly.Blocks.hamster_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_rest_for = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.hamster_rest_for = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.isStart; - delete b.timeFlag; + delete a.isStart; + delete a.timeFlag; Entry.engine.isContinue = !1; - return b.callReturn(); + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Hamster.tempo; - a.buzzer = 0; - a.note = 0; - var d = setTimeout(function() { - b.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + a.isStart = !0; + a.timeFlag = 1; + var c = a.getNumberValue("VALUE"), c = 6E4 * c / Entry.Hamster.tempo; + d.buzzer = 0; + d.note = 0; + var e = setTimeout(function() { + a.timeFlag = 0; + Entry.Hamster.removeTimeout(e); }, c); - Entry.Hamster.timeouts.push(d); - return b; + Entry.Hamster.timeouts.push(e); + return a; }; Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -3636,10 +3540,10 @@ Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_tempo_by = function(a, b) { - Entry.Hamster.tempo += b.getNumberValue("VALUE"); +Entry.block.hamster_change_tempo_by = function(b, a) { + Entry.Hamster.tempo += a.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -3650,10 +3554,10 @@ Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_tempo_to = function(a, b) { - Entry.Hamster.tempo = b.getNumberValue("VALUE"); +Entry.block.hamster_set_tempo_to = function(b, a) { + Entry.Hamster.tempo = a.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.hamster_set_port_to = {init:function() { this.setColour("#00979D"); @@ -3663,11 +3567,10 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_port_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("PORT", b), d = Number(b.getField("MODE", b)); - "A" == c ? a.ioModeA = d : ("B" != c && (a.ioModeA = d), a.ioModeB = d); - return b.callReturn(); +Entry.block.hamster_set_port_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("PORT", a), e = +a.getField("MODE", a); + "A" == c ? d.ioModeA = e : ("B" != c && (d.ioModeA = e), d.ioModeB = e); + return a.callReturn(); }; Blockly.Blocks.hamster_change_output_by = {init:function() { this.setColour("#00979D"); @@ -3678,11 +3581,10 @@ Blockly.Blocks.hamster_change_output_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_output_by = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); - "A" == c ? a.outputA = void 0 != a.outputA ? a.outputA + d : d : ("B" != c && (a.outputA = void 0 != a.outputA ? a.outputA + d : d), a.outputB = void 0 != a.outputB ? a.outputB + d : d); - return b.callReturn(); +Entry.block.hamster_change_output_by = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("PORT"), e = a.getNumberValue("VALUE"); + "A" == c ? d.outputA = void 0 != d.outputA ? d.outputA + e : e : ("B" != c && (d.outputA = void 0 != d.outputA ? d.outputA + e : e), d.outputB = void 0 != d.outputB ? d.outputB + e : e); + return a.callReturn(); }; Blockly.Blocks.hamster_set_output_to = {init:function() { this.setColour("#00979D"); @@ -3693,11 +3595,10 @@ Blockly.Blocks.hamster_set_output_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_output_to = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); - "A" == c ? a.outputA = d : ("B" != c && (a.outputA = d), a.outputB = d); - return b.callReturn(); +Entry.block.hamster_set_output_to = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getField("PORT"), e = a.getNumberValue("VALUE"); + "A" == c ? d.outputA = e : ("B" != c && (d.outputA = e), d.outputB = e); + return a.callReturn(); }; Blockly.Blocks.is_clicked = {init:function() { this.setColour("#AEB8FF"); @@ -3705,7 +3606,7 @@ Blockly.Blocks.is_clicked = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_clicked = function(a, b) { +Entry.block.is_clicked = function(b, a) { return Entry.stage.isClick; }; Blockly.Blocks.is_press_some_key = {init:function() { @@ -3715,9 +3616,9 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_press_some_key = function(a, b) { - a = Number(b.getField("VALUE", b)); - return 0 <= Entry.pressedKeys.indexOf(a); +Entry.block.is_press_some_key = function(b, a) { + var d = +a.getField("VALUE", a); + return 0 <= Entry.pressedKeys.indexOf(d); }; Blockly.Blocks.reach_something = {init:function() { this.setColour("#AEB8FF"); @@ -3727,68 +3628,64 @@ Blockly.Blocks.reach_something = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.reach_something = function(a, b) { - if (!a.getVisible()) { +Entry.block.reach_something = function(b, a) { + if (!b.getVisible()) { return !1; } - var c = b.getField("VALUE", b); - b = a.object; - var d = /wall/.test(c), e = ndgmr.checkPixelCollision; - if (d) { - switch(a = Entry.stage.wall, c) { + var d = a.getField("VALUE", a), c = b.object, e = /wall/.test(d), f = ndgmr.checkPixelCollision; + if (e) { + switch(e = Entry.stage.wall, d) { case "wall": - if (e(b, a.up, .2, !0) || e(b, a.down, .2, !0) || e(b, a.left, .2, !0) || e(b, a.right, .2, !0)) { + if (f(c, e.up, .2, !0) || f(c, e.down, .2, !0) || f(c, e.left, .2, !0) || f(c, e.right, .2, !0)) { return !0; } break; case "wall_up": - if (e(b, a.up, .2, !0)) { + if (f(c, e.up, .2, !0)) { return !0; } break; case "wall_down": - if (e(b, a.down, .2, !0)) { + if (f(c, e.down, .2, !0)) { return !0; } break; case "wall_right": - if (e(b, a.right, .2, !0)) { + if (f(c, e.right, .2, !0)) { return !0; } break; case "wall_left": - if (e(b, a.left, .2, !0)) { + if (f(c, e.left, .2, !0)) { return !0; } ; } } else { - if ("mouse" == c) { - return e = Entry.stage.canvas, e = b.globalToLocal(e.mouseX, e.mouseY), b.hitTest(e.x, e.y); - } - c = Entry.container.getEntity(c); - if ("textBox" == c.type || "textBox" == a.type) { - e = c.object.getTransformedBounds(); - b = b.getTransformedBounds(); - if (Entry.checkCollisionRect(b, e)) { + if ("mouse" == d) { + return f = Entry.stage.canvas, f = c.globalToLocal(f.mouseX, f.mouseY), c.hitTest(f.x, f.y); + } + d = Entry.container.getEntity(d); + if ("textBox" == d.type || "textBox" == b.type) { + f = d.object.getTransformedBounds(); + c = c.getTransformedBounds(); + if (Entry.checkCollisionRect(c, f)) { return !0; } - a = c.parent.clonedEntities; - c = 0; - for (d = a.length;c < d;c++) { - var f = a[c]; - if (!f.isStamp && f.getVisible() && Entry.checkCollisionRect(b, f.object.getTransformedBounds())) { + for (var d = d.parent.clonedEntities, e = 0, g = d.length;e < g;e++) { + var h = d[e]; + if (!h.isStamp && h.getVisible() && Entry.checkCollisionRect(c, h.object.getTransformedBounds())) { return !0; } } } else { - if (c.getVisible() && e(b, c.object, .2, !0)) { + if (d.getVisible() && f(c, d.object, .2, !0)) { return !0; } - a = c.parent.clonedEntities; - c = 0; - for (d = a.length;c < d;c++) { - if (f = a[c], !f.isStamp && f.getVisible() && e(b, f.object, .2, !0)) { + d = d.parent.clonedEntities; + e = 0; + for (g = d.length;e < g;e++) { + if (h = d[e], !h.isStamp && h.getVisible() && f(c, h.object, .2, !0)) { return !0; } } @@ -3804,11 +3701,9 @@ Blockly.Blocks.boolean_comparison = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_comparison = function(a, b) { - a = b.getField("OPERATOR", b); - var c = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return "EQUAL" == a ? c == b : "BIGGER" == a ? c > b : c < b; +Entry.block.boolean_comparison = function(b, a) { + var d = a.getField("OPERATOR", a), c = a.getNumberValue("LEFTHAND", a), e = a.getNumberValue("RIGHTHAND", a); + return "EQUAL" == d ? c == e : "BIGGER" == d ? c > e : c < e; }; Blockly.Blocks.boolean_equal = {init:function() { this.setColour("#AEB8FF"); @@ -3818,10 +3713,9 @@ Blockly.Blocks.boolean_equal = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_equal = function(a, b) { - a = b.getStringValue("LEFTHAND", b); - b = b.getStringValue("RIGHTHAND", b); - return a == b; +Entry.block.boolean_equal = function(b, a) { + var d = a.getStringValue("LEFTHAND", a), c = a.getStringValue("RIGHTHAND", a); + return d == c; }; Blockly.Blocks.boolean_bigger = {init:function() { this.setColour("#AEB8FF"); @@ -3831,10 +3725,9 @@ Blockly.Blocks.boolean_bigger = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_bigger = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a > b; +Entry.block.boolean_bigger = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d > c; }; Blockly.Blocks.boolean_smaller = {init:function() { this.setColour("#AEB8FF"); @@ -3844,10 +3737,9 @@ Blockly.Blocks.boolean_smaller = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_smaller = function(a, b) { - a = b.getNumberValue("LEFTHAND", b); - b = b.getNumberValue("RIGHTHAND", b); - return a < b; +Entry.block.boolean_smaller = function(b, a) { + var d = a.getNumberValue("LEFTHAND", a), c = a.getNumberValue("RIGHTHAND", a); + return d < c; }; Blockly.Blocks.boolean_and_or = {init:function() { this.setColour("#AEB8FF"); @@ -3857,11 +3749,9 @@ Blockly.Blocks.boolean_and_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and_or = function(a, b) { - a = b.getField("OPERATOR", b); - var c = b.getBooleanValue("LEFTHAND", b); - b = b.getBooleanValue("RIGHTHAND", b); - return "AND" == a ? c && b : c || b; +Entry.block.boolean_and_or = function(b, a) { + var d = a.getField("OPERATOR", a), c = a.getBooleanValue("LEFTHAND", a), e = a.getBooleanValue("RIGHTHAND", a); + return "AND" == d ? c && e : c || e; }; Blockly.Blocks.boolean_and = {init:function() { this.setColour("#AEB8FF"); @@ -3871,10 +3761,9 @@ Blockly.Blocks.boolean_and = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and = function(a, b) { - a = b.getBooleanValue("LEFTHAND", b); - b = b.getBooleanValue("RIGHTHAND", b); - return a && b; +Entry.block.boolean_and = function(b, a) { + var d = a.getBooleanValue("LEFTHAND", a), c = a.getBooleanValue("RIGHTHAND", a); + return d && c; }; Blockly.Blocks.boolean_or = {init:function() { this.setColour("#AEB8FF"); @@ -3884,10 +3773,9 @@ Blockly.Blocks.boolean_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_or = function(a, b) { - a = b.getBooleanValue("LEFTHAND", b); - b = b.getBooleanValue("RIGHTHAND", b); - return a || b; +Entry.block.boolean_or = function(b, a) { + var d = a.getBooleanValue("LEFTHAND", a), c = a.getBooleanValue("RIGHTHAND", a); + return d || c; }; Blockly.Blocks.boolean_not = {init:function() { this.setColour("#AEB8FF"); @@ -3898,8 +3786,8 @@ Blockly.Blocks.boolean_not = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_not = function(a, b) { - return !b.getBooleanValue("VALUE"); +Entry.block.boolean_not = function(b, a) { + return !a.getBooleanValue("VALUE"); }; Blockly.Blocks.true_or_false = {init:function() { this.setColour("#AEB8FF"); @@ -3908,8 +3796,8 @@ Blockly.Blocks.true_or_false = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.true_or_false = function(a, b) { - return "true" == b.children[0].textContent; +Entry.block.true_or_false = function(b, a) { + return "true" == a.children[0].textContent; }; Blockly.Blocks.True = {init:function() { this.setColour("#AEB8FF"); @@ -3917,7 +3805,7 @@ Blockly.Blocks.True = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.True = function(a, b) { +Entry.block.True = function(b, a) { return !0; }; Blockly.Blocks.False = {init:function() { @@ -3926,7 +3814,7 @@ Blockly.Blocks.False = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.False = function(a, b) { +Entry.block.False = function(b, a) { return !1; }; Blockly.Blocks.boolean_basic_operator = {init:function() { @@ -3937,21 +3825,19 @@ Blockly.Blocks.boolean_basic_operator = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_basic_operator = function(a, b) { - a = b.getField("OPERATOR", b); - var c = b.getStringValue("LEFTHAND", b); - b = b.getStringValue("RIGHTHAND", b); - switch(a) { +Entry.block.boolean_basic_operator = function(b, a) { + var d = a.getField("OPERATOR", a), c = a.getStringValue("LEFTHAND", a), e = a.getStringValue("RIGHTHAND", a); + switch(d) { case "EQUAL": - return c == b; + return c == e; case "GREATER": - return Number(c) > Number(b); + return +c > +e; case "LESS": - return Number(c) < Number(b); + return +c < +e; case "GREATER_OR_EQUAL": - return Number(c) >= Number(b); + return +c >= +e; case "LESS_OR_EQUAL": - return Number(c) <= Number(b); + return +c <= +e; } }; Blockly.Blocks.show = {init:function() { @@ -3961,9 +3847,9 @@ Blockly.Blocks.show = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show = function(a, b) { - a.setVisible(!0); - return b.callReturn(); +Entry.block.show = function(b, a) { + b.setVisible(!0); + return a.callReturn(); }; Blockly.Blocks.hide = {init:function() { this.setColour("#EC4466"); @@ -3972,9 +3858,9 @@ Blockly.Blocks.hide = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide = function(a, b) { - a.setVisible(!1); - return b.callReturn(); +Entry.block.hide = function(b, a) { + b.setVisible(!1); + return a.callReturn(); }; Blockly.Blocks.dialog_time = {init:function() { this.setColour("#EC4466"); @@ -3989,20 +3875,20 @@ Blockly.Blocks.dialog_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog_time = function(a, b) { - if (!b.isStart) { - var c = b.getNumberValue("SECOND", b), d = b.getStringValue("VALUE", b), e = b.getField("OPTION", b); - b.isStart = !0; - b.timeFlag = 1; - d || "number" == typeof d || (d = " "); - d = Entry.convertToRoundedDecimals(d, 3); - new Entry.Dialog(a, d, e); - a.syncDialogVisible(a.getVisible()); +Entry.block.dialog_time = function(b, a) { + if (!a.isStart) { + var d = a.getNumberValue("SECOND", a), c = a.getStringValue("VALUE", a), e = a.getField("OPTION", a); + a.isStart = !0; + a.timeFlag = 1; + c || "number" == typeof c || (c = " "); + c = Entry.convertToRoundedDecimals(c, 3); + new Entry.Dialog(b, c, e); + b.syncDialogVisible(b.getVisible()); setTimeout(function() { - b.timeFlag = 0; - }, 1E3 * c); + a.timeFlag = 0; + }, 1E3 * d); } - return 0 == b.timeFlag ? (delete b.timeFlag, delete b.isStart, a.dialog && a.dialog.remove(), b.callReturn()) : b; + return 0 == a.timeFlag ? (delete a.timeFlag, delete a.isStart, b.dialog && b.dialog.remove(), a.callReturn()) : a; }; Blockly.Blocks.dialog = {init:function() { this.setColour("#EC4466"); @@ -4015,13 +3901,13 @@ Blockly.Blocks.dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog = function(a, b) { - var c = b.getStringValue("VALUE", b); - c || "number" == typeof c || (c = " "); - var d = b.getField("OPTION", b), c = Entry.convertToRoundedDecimals(c, 3); - new Entry.Dialog(a, c, d); - a.syncDialogVisible(a.getVisible()); - return b.callReturn(); +Entry.block.dialog = function(b, a) { + var d = a.getStringValue("VALUE", a); + d || "number" == typeof d || (d = " "); + var c = a.getField("OPTION", a), d = Entry.convertToRoundedDecimals(d, 3); + new Entry.Dialog(b, d, c); + b.syncDialogVisible(b.getVisible()); + return a.callReturn(); }; Blockly.Blocks.remove_dialog = {init:function() { this.setColour("#EC4466"); @@ -4030,9 +3916,9 @@ Blockly.Blocks.remove_dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_dialog = function(a, b) { - a.dialog && a.dialog.remove(); - return b.callReturn(); +Entry.block.remove_dialog = function(b, a) { + b.dialog && b.dialog.remove(); + return a.callReturn(); }; Blockly.Blocks.change_to_nth_shape = {init:function() { this.setColour("#EC4466"); @@ -4043,10 +3929,10 @@ Blockly.Blocks.change_to_nth_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_nth_shape = function(a, b) { - var c = b.getField("VALUE", b), c = a.parent.getPicture(c); - a.setImage(c); - return b.callReturn(); +Entry.block.change_to_nth_shape = function(b, a) { + var d = a.getField("VALUE", a), d = b.parent.getPicture(d); + b.setImage(d); + return a.callReturn(); }; Blockly.Blocks.change_to_next_shape = {init:function() { this.setColour("#EC4466"); @@ -4055,11 +3941,11 @@ Blockly.Blocks.change_to_next_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_next_shape = function(a, b) { - var c; - c = b.fields && "prev" === b.getStringField("DRIECTION") ? a.parent.getPrevPicture(a.picture.id) : a.parent.getNextPicture(a.picture.id); - a.setImage(c); - return b.callReturn(); +Entry.block.change_to_next_shape = function(b, a) { + var d; + d = a.fields && "prev" === a.getStringField("DRIECTION") ? b.parent.getPrevPicture(b.picture.id) : b.parent.getNextPicture(b.picture.id); + b.setImage(d); + return a.callReturn(); }; Blockly.Blocks.set_effect_volume = {init:function() { this.setColour("#EC4466"); @@ -4072,11 +3958,11 @@ Blockly.Blocks.set_effect_volume = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_volume = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hue = d + a.effect.hue : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d + a.effect.brightness : "blur" != c && "opacity" == c && (a.effect.alpha += d / 100)); - a.applyFilter(); - return b.callReturn(); +Entry.block.set_effect_volume = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hue = c + b.effect.hue : "lens" != d && "swriling" != d && "pixel" != d && "mosaic" != d && ("brightness" == d ? b.effect.brightness = c + b.effect.brightness : "blur" != d && "opacity" == d && (b.effect.alpha += c / 100)); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.set_effect = {init:function() { this.setColour("#EC4466"); @@ -4089,11 +3975,11 @@ Blockly.Blocks.set_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hue = d : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d : "blur" != c && "opacity" == c && (a.effect.alpha = d / 100)); - a.applyFilter(); - return b.callReturn(); +Entry.block.set_effect = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hue = c : "lens" != d && "swriling" != d && "pixel" != d && "mosaic" != d && ("brightness" == d ? b.effect.brightness = c : "blur" != d && "opacity" == d && (b.effect.alpha = c / 100)); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.erase_all_effects = {init:function() { this.setColour("#EC4466"); @@ -4102,9 +3988,9 @@ Blockly.Blocks.erase_all_effects = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.erase_all_effects = function(a, b) { - a.resetFilter(); - return b.callReturn(); +Entry.block.erase_all_effects = function(b, a) { + b.resetFilter(); + return a.callReturn(); }; Blockly.Blocks.change_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -4115,11 +4001,11 @@ Blockly.Blocks.change_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_percent = function(a, b) { - var c = (b.getNumberValue("VALUE", b) + 100) / 100; - a.setScaleX(a.getScaleX() * c); - a.setScaleY(a.getScaleY() * c); - return b.callReturn(); +Entry.block.change_scale_percent = function(b, a) { + var d = (a.getNumberValue("VALUE", a) + 100) / 100; + b.setScaleX(b.getScaleX() * d); + b.setScaleY(b.getScaleY() * d); + return a.callReturn(); }; Blockly.Blocks.set_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -4130,11 +4016,11 @@ Blockly.Blocks.set_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_percent = function(a, b) { - var c = b.getNumberValue("VALUE", b) / 100, d = a.snapshot_; - a.setScaleX(c * d.scaleX); - a.setScaleY(c * d.scaleY); - return b.callReturn(); +Entry.block.set_scale_percent = function(b, a) { + var d = a.getNumberValue("VALUE", a) / 100, c = b.snapshot_; + b.setScaleX(d * c.scaleX); + b.setScaleY(d * c.scaleY); + return a.callReturn(); }; Blockly.Blocks.change_scale_size = {init:function() { this.setColour("#EC4466"); @@ -4145,10 +4031,10 @@ Blockly.Blocks.change_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_size = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setSize(a.getSize() + c); - return b.callReturn(); +Entry.block.change_scale_size = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setSize(b.getSize() + d); + return a.callReturn(); }; Blockly.Blocks.set_scale_size = {init:function() { this.setColour("#EC4466"); @@ -4159,10 +4045,10 @@ Blockly.Blocks.set_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_size = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setSize(c); - return b.callReturn(); +Entry.block.set_scale_size = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setSize(d); + return a.callReturn(); }; Blockly.Blocks.flip_y = {init:function() { this.setColour("#EC4466"); @@ -4171,9 +4057,9 @@ Blockly.Blocks.flip_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_y = function(a, b) { - a.setScaleX(-1 * a.getScaleX()); - return b.callReturn(); +Entry.block.flip_y = function(b, a) { + b.setScaleX(-1 * b.getScaleX()); + return a.callReturn(); }; Blockly.Blocks.flip_x = {init:function() { this.setColour("#EC4466"); @@ -4182,9 +4068,9 @@ Blockly.Blocks.flip_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_x = function(a, b) { - a.setScaleY(-1 * a.getScaleY()); - return b.callReturn(); +Entry.block.flip_x = function(b, a) { + b.setScaleY(-1 * b.getScaleY()); + return a.callReturn(); }; Blockly.Blocks.set_object_order = {init:function() { this.setColour("#EC4466"); @@ -4195,11 +4081,10 @@ Blockly.Blocks.set_object_order = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_object_order = function(a, b) { - var c = b.getField("VALUE", b); - a = Entry.container.getCurrentObjects().indexOf(a.parent); - if (-1 < a) { - return Entry.container.moveElementByBlock(a, c), b.callReturn(); +Entry.block.set_object_order = function(b, a) { + var d = a.getField("VALUE", a), c = Entry.container.getCurrentObjects().indexOf(b.parent); + if (-1 < c) { + return Entry.container.moveElementByBlock(c, d), a.callReturn(); } throw Error("object is not available"); }; @@ -4211,8 +4096,8 @@ Blockly.Blocks.get_pictures = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_pictures = function(a, b) { - return b.getStringField("VALUE"); +Entry.block.get_pictures = function(b, a) { + return a.getStringField("VALUE"); }; Blockly.Blocks.change_to_some_shape = {init:function() { this.setColour("#EC4466"); @@ -4223,12 +4108,12 @@ Blockly.Blocks.change_to_some_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_some_shape = function(a, b) { - var c = b.getStringValue("VALUE"); - Entry.parseNumber(c); - c = a.parent.getPicture(c); - a.setImage(c); - return b.callReturn(); +Entry.block.change_to_some_shape = function(b, a) { + var d = a.getStringValue("VALUE"); + Entry.parseNumber(d); + d = b.parent.getPicture(d); + b.setImage(d); + return a.callReturn(); }; Blockly.Blocks.add_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -4241,11 +4126,11 @@ Blockly.Blocks.add_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.add_effect_amount = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hsv = d + a.effect.hsv : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); - a.applyFilter(); - return b.callReturn(); +Entry.block.add_effect_amount = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hsv = c + b.effect.hsv : "brightness" == d ? b.effect.brightness = c + b.effect.brightness : "transparency" == d && (b.effect.alpha -= c / 100); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.change_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -4258,11 +4143,11 @@ Blockly.Blocks.change_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_effect_amount = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hsv = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); - a.applyFilter(); - return b.callReturn(); +Entry.block.change_effect_amount = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hsv = c : "brightness" == d ? b.effect.brightness = c : "transparency" == d && (b.effect.alpha = 1 - c / 100); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.set_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -4275,11 +4160,11 @@ Blockly.Blocks.set_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_amount = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hue = d + a.effect.hue : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); - a.applyFilter(); - return b.callReturn(); +Entry.block.set_effect_amount = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hue = c + b.effect.hue : "brightness" == d ? b.effect.brightness = c + b.effect.brightness : "transparency" == d && (b.effect.alpha -= c / 100); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.set_entity_effect = {init:function() { this.setColour("#EC4466"); @@ -4292,11 +4177,11 @@ Blockly.Blocks.set_entity_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_entity_effect = function(a, b) { - var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); - "color" == c ? a.effect.hue = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); - a.applyFilter(); - return b.callReturn(); +Entry.block.set_entity_effect = function(b, a) { + var d = a.getField("EFFECT", a), c = a.getNumberValue("VALUE", a); + "color" == d ? b.effect.hue = c : "brightness" == d ? b.effect.brightness = c : "transparency" == d && (b.effect.alpha = 1 - c / 100); + b.applyFilter(); + return a.callReturn(); }; Blockly.Blocks.change_object_index = {init:function() { this.setColour("#EC4466"); @@ -4306,28 +4191,26 @@ Blockly.Blocks.change_object_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_object_index = function(a, b) { - var c, d = b.getField("LOCATION", b), e = Entry.container.getCurrentObjects(); - a = e.indexOf(a.parent); - e = e.length - 1; - if (0 > a) { +Entry.block.change_object_index = function(b, a) { + var d, c = a.getField("LOCATION", a), e = Entry.container.getCurrentObjects(), f = e.indexOf(b.parent), e = e.length - 1; + if (0 > f) { throw Error("object is not available for current scene"); } - switch(d) { + switch(c) { case "FRONT": - c = 0; + d = 0; break; case "FORWARD": - c = Math.max(0, a - 1); + d = Math.max(0, f - 1); break; case "BACKWARD": - c = Math.min(e, a + 1); + d = Math.min(e, f + 1); break; case "BACK": - c = e; + d = e; } - Entry.container.moveElementByBlock(a, c); - return b.callReturn(); + Entry.container.moveElementByBlock(f, d); + return a.callReturn(); }; Blockly.Blocks.move_direction = {init:function() { this.setColour("#A751E3"); @@ -4338,12 +4221,12 @@ Blockly.Blocks.move_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_direction = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setX(a.getX() + c * Math.cos((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); - a.setY(a.getY() - c * Math.sin((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.move_direction = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setX(b.getX() + d * Math.cos((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); + b.setY(b.getY() - d * Math.sin((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.move_x = {init:function() { this.setColour("#A751E3"); @@ -4354,11 +4237,11 @@ Blockly.Blocks.move_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_x = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setX(a.getX() + c); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.move_x = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setX(b.getX() + d); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.move_y = {init:function() { this.setColour("#A751E3"); @@ -4369,11 +4252,11 @@ Blockly.Blocks.move_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_y = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setY(a.getY() + c); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.move_y = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setY(b.getY() + d); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.locate_xy_time = {init:function() { this.setColour("#A751E3"); @@ -4388,29 +4271,29 @@ Blockly.Blocks.locate_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy_time = function(a, b) { - if (!b.isStart) { - var c; - c = b.getNumberValue("VALUE1", b); - b.isStart = !0; - b.frameCount = Math.floor(c * Entry.FPS); - b.x = b.getNumberValue("VALUE2", b); - b.y = b.getNumberValue("VALUE3", b); - } - if (0 != b.frameCount) { - c = b.x - a.getX(); - var d = b.y - a.getY(); - c /= b.frameCount; - d /= b.frameCount; - a.setX(a.getX() + c); - a.setY(a.getY() + d); - b.frameCount--; - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b; +Entry.block.locate_xy_time = function(b, a) { + if (!a.isStart) { + var d; + d = a.getNumberValue("VALUE1", a); + a.isStart = !0; + a.frameCount = Math.floor(d * Entry.FPS); + a.x = a.getNumberValue("VALUE2", a); + a.y = a.getNumberValue("VALUE3", a); + } + if (0 != a.frameCount) { + d = a.x - b.getX(); + var c = a.y - b.getY(); + d /= a.frameCount; + c /= a.frameCount; + b.setX(b.getX() + d); + b.setY(b.getY() + c); + a.frameCount--; + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a; } - delete b.isStart; - delete b.frameCount; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + return a.callReturn(); }; Blockly.Blocks.rotate_by_angle = {init:function() { this.setColour("#A751E3"); @@ -4421,10 +4304,10 @@ Blockly.Blocks.rotate_by_angle = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_angle = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setRotation(a.getRotation() + c); - return b.callReturn(); +Entry.block.rotate_by_angle = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setRotation(b.getRotation() + d); + return a.callReturn(); }; Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { this.setColour("#A751E3"); @@ -4434,10 +4317,10 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_angle_dropdown = function(a, b) { - var c = b.getField("VALUE", b); - a.setRotation(a.getRotation() + Number(c)); - return b.callReturn(); +Entry.block.rotate_by_angle_dropdown = function(b, a) { + var d = a.getField("VALUE", a); + b.setRotation(b.getRotation() + +d); + return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { this.setColour("#A751E3"); @@ -4448,10 +4331,10 @@ Blockly.Blocks.see_angle = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setDirection(c); - return b.callReturn(); +Entry.block.see_angle = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setDirection(d); + return a.callReturn(); }; Blockly.Blocks.see_direction = {init:function() { this.setColour("#A751E3"); @@ -4462,10 +4345,10 @@ Blockly.Blocks.see_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_direction = function(a, b) { - var c = b.getField("VALUE", b), d = Entry.container.getEntity(c), c = d.getX() - a.getX(), d = d.getY() - a.getY(); - 0 <= c ? a.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : a.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); - return b.callReturn(); +Entry.block.see_direction = function(b, a) { + var d = a.getField("VALUE", a), c = Entry.container.getEntity(d), d = c.getX() - b.getX(), c = c.getY() - b.getY(); + 0 <= d ? b.setRotation(Math.atan(c / d) / Math.PI * 180 + 90) : b.setRotation(Math.atan(c / d) / Math.PI * 180 + 270); + return a.callReturn(); }; Blockly.Blocks.locate_xy = {init:function() { this.setColour("#A751E3"); @@ -4478,13 +4361,13 @@ Blockly.Blocks.locate_xy = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy = function(a, b) { - var c = b.getNumberValue("VALUE1", b); - a.setX(c); - c = b.getNumberValue("VALUE2", b); - a.setY(c); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.locate_xy = function(b, a) { + var d = a.getNumberValue("VALUE1", a); + b.setX(d); + d = a.getNumberValue("VALUE2", a); + b.setY(d); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.locate_x = {init:function() { this.setColour("#A751E3"); @@ -4495,11 +4378,11 @@ Blockly.Blocks.locate_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_x = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setX(c); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.locate_x = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setX(d); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.locate_y = {init:function() { this.setColour("#A751E3"); @@ -4510,11 +4393,11 @@ Blockly.Blocks.locate_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_y = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setY(c); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.locate_y = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setY(d); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.locate = {init:function() { this.setColour("#A751E3"); @@ -4525,13 +4408,13 @@ Blockly.Blocks.locate = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate = function(a, b) { - var c = b.getField("VALUE", b), d; - "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); - a.setX(Number(c)); - a.setY(Number(d)); - a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d); - return b.callReturn(); +Entry.block.locate = function(b, a) { + var d = a.getField("VALUE", a), c; + "mouse" == d ? (d = Entry.stage.mouseCoordinate.x, c = Entry.stage.mouseCoordinate.y) : (c = Entry.container.getEntity(d), d = c.getX(), c = c.getY()); + b.setX(+d); + b.setY(+c); + b.brush && !b.brush.stop && b.brush.lineTo(d, -1 * c); + return a.callReturn(); }; Blockly.Blocks.move_xy_time = {init:function() { this.setColour("#A751E3"); @@ -4546,22 +4429,22 @@ Blockly.Blocks.move_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_xy_time = function(a, b) { - if (!b.isStart) { - var c; - c = b.getNumberValue("VALUE1", b); - var d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); - b.isStart = !0; - b.frameCount = Math.floor(c * Entry.FPS); - b.dX = d / b.frameCount; - b.dY = e / b.frameCount; +Entry.block.move_xy_time = function(b, a) { + if (!a.isStart) { + var d; + d = a.getNumberValue("VALUE1", a); + var c = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a); + a.isStart = !0; + a.frameCount = Math.floor(d * Entry.FPS); + a.dX = c / a.frameCount; + a.dY = e / a.frameCount; } - if (0 != b.frameCount) { - return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; + if (0 != a.frameCount) { + return b.setX(b.getX() + a.dX), b.setY(b.getY() + a.dY), a.frameCount--, b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a; } - delete b.isStart; - delete b.frameCount; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + return a.callReturn(); }; Blockly.Blocks.locate_time = {init:function() { this.setColour("#A751E3"); @@ -4585,21 +4468,21 @@ Blockly.Blocks.rotate_by_angle_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_angle_time = function(a, b) { - if (!b.isStart) { - var c; - c = b.getNumberValue("VALUE", b); - var d = b.getNumberField("VALUE", b); - b.isStart = !0; - b.frameCount = Math.floor(c * Entry.FPS); - b.dAngle = d / b.frameCount; +Entry.block.rotate_by_angle_time = function(b, a) { + if (!a.isStart) { + var d; + d = a.getNumberValue("VALUE", a); + var c = a.getNumberField("VALUE", a); + a.isStart = !0; + a.frameCount = Math.floor(d * Entry.FPS); + a.dAngle = c / a.frameCount; } - if (0 != b.frameCount) { - return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; + if (0 != a.frameCount) { + return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; } - delete b.isStart; - delete b.frameCount; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + return a.callReturn(); }; Blockly.Blocks.bounce_when = {init:function() { this.setColour("#A751E3"); @@ -4617,23 +4500,22 @@ Blockly.Blocks.bounce_wall = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bounce_wall = function(a, b) { - var c = a.parent.getRotateMethod(), d = "free" == c ? (a.getRotation() + a.getDirection()).mod(360) : a.getDirection(), e; - if (90 > d && 0 <= d || 360 > d && 270 <= d) { - e = a.collision == Entry.Utils.COLLISION.UP; - var f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1); - !f && e && (a.collision = Entry.Utils.COLLISION.NONE); +Entry.block.bounce_wall = function(b, a) { + var d = b.parent.getRotateMethod(), c = "free" == d ? (b.getRotation() + b.getDirection()).mod(360) : b.getDirection(), e = Entry.Utils.COLLISION.NONE; + if (90 > c && 0 <= c || 360 > c && 270 <= c) { + var e = b.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, b.object, 0, !1); + !f && e && (b.collision = Entry.Utils.COLLISION.NONE); f && e && (f = !1); - f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP) : (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = + f ? ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.UP) : (e = b.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, b.object, 0, !1), !f && e && (b.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.DOWN)); } else { - 270 > d && 90 <= d && (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN) : (e = a.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1), - !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP))); + 270 > c && 90 <= c && (e = b.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, b.object, 0, !1), !f && e && (b.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.DOWN) : (e = b.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, b.object, 0, !1), + !f && e && (b.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.UP))); } - 360 > d && 180 <= d ? (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT) : (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && - e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT) : (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT))); - return b.callReturn(); + 360 > c && 180 <= c ? (e = b.collision == Entry.Utils.COLLISION.LEFT, c = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !c && e && (b.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c ? ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT) : (e = b.collision == Entry.Utils.COLLISION.RIGHT, c = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !c && + e && (b.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c && ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > c && 0 <= c && (e = b.collision == Entry.Utils.COLLISION.RIGHT, c = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !c && e && (b.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c ? ("free" == d ? b.setRotation(-b.getRotation() - + 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT) : (e = b.collision == Entry.Utils.COLLISION.LEFT, c = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !c && e && (b.collision = Entry.Utils.COLLISION.NONE), c && e && (c = !1), c && ("free" == d ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT))); + return a.callReturn(); }; Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setColour("#A751E3"); @@ -4642,9 +4524,9 @@ Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_horizontal = function(a, b) { - a.setDirection(a.getDirection() + 180); - return b.callReturn(); +Entry.block.flip_arrow_horizontal = function(b, a) { + b.setDirection(b.getDirection() + 180); + return a.callReturn(); }; Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setColour("#A751E3"); @@ -4653,9 +4535,9 @@ Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_vertical = function(a, b) { - a.setDirection(a.getDirection() + 180); - return b.callReturn(); +Entry.block.flip_arrow_vertical = function(b, a) { + b.setDirection(b.getDirection() + 180); + return a.callReturn(); }; Blockly.Blocks.see_angle_object = {init:function() { this.setColour("#A751E3"); @@ -4666,16 +4548,16 @@ Blockly.Blocks.see_angle_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_object = function(a, b) { - var c = b.getField("VALUE", b), d = a.getX(), e = a.getY(); - if (a.parent.id == c) { - return b.callReturn(); +Entry.block.see_angle_object = function(b, a) { + var d = a.getField("VALUE", a), c = b.getX(), e = b.getY(); + if (b.parent.id == d) { + return a.callReturn(); } - "mouse" == c ? (c = Entry.stage.mouseCoordinate.y, d = Entry.stage.mouseCoordinate.x - d, e = c - e) : (c = Entry.container.getEntity(c), d = c.getX() - d, e = c.getY() - e); - e = 0 === d && 0 === e ? a.getDirection() + a.getRotation() : 0 <= d ? -Math.atan(e / d) / Math.PI * 180 + 90 : -Math.atan(e / d) / Math.PI * 180 + 270; - d = a.getDirection() + a.getRotation(); - a.setRotation(a.getRotation() + e - d); - return b.callReturn(); + "mouse" == d ? (d = Entry.stage.mouseCoordinate.y, c = Entry.stage.mouseCoordinate.x - c, e = d - e) : (d = Entry.container.getEntity(d), c = d.getX() - c, e = d.getY() - e); + e = 0 === c && 0 === e ? b.getDirection() + b.getRotation() : 0 <= c ? -Math.atan(e / c) / Math.PI * 180 + 90 : -Math.atan(e / c) / Math.PI * 180 + 270; + c = b.getDirection() + b.getRotation(); + b.setRotation(b.getRotation() + e - c); + return a.callReturn(); }; Blockly.Blocks.see_angle_direction = {init:function() { this.setColour("#A751E3"); @@ -4686,10 +4568,10 @@ Blockly.Blocks.see_angle_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_direction = function(a, b) { - var c = b.getNumberValue("VALUE", b), d = a.getDirection() + a.getRotation(); - a.setRotation(a.getRotation() + c - d); - return b.callReturn(); +Entry.block.see_angle_direction = function(b, a) { + var d = a.getNumberValue("VALUE", a), c = b.getDirection() + b.getRotation(); + b.setRotation(b.getRotation() + d - c); + return a.callReturn(); }; Blockly.Blocks.rotate_direction = {init:function() { this.setColour("#A751E3"); @@ -4700,10 +4582,10 @@ Blockly.Blocks.rotate_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_direction = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setDirection(c + a.getDirection()); - return b.callReturn(); +Entry.block.rotate_direction = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setDirection(d + b.getDirection()); + return a.callReturn(); }; Blockly.Blocks.locate_object_time = {init:function() { this.setColour("#A751E3"); @@ -4716,25 +4598,25 @@ Blockly.Blocks.locate_object_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_object_time = function(a, b) { - if (!b.isStart) { - var c, d, e; - d = b.getField("TARGET", b); - c = b.getNumberValue("VALUE", b); - c = Math.floor(c * Entry.FPS); +Entry.block.locate_object_time = function(b, a) { + if (!a.isStart) { + var d, c, e; + c = a.getField("TARGET", a); + d = a.getNumberValue("VALUE", a); + d = Math.floor(d * Entry.FPS); e = Entry.stage.mouseCoordinate; - if (0 != c) { - "mouse" == d ? (d = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = c, b.dX = d / b.frameCount, b.dY = e / b.frameCount; + if (0 != d) { + "mouse" == c ? (c = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(c), c = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = d, a.dX = c / a.frameCount, a.dY = e / a.frameCount; } else { - return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.callReturn(); + return "mouse" == c ? (c = +e.x, e = +e.y) : (e = Entry.container.getEntity(c), c = e.getX(), e = e.getY()), b.setX(c), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); } } - if (0 != b.frameCount) { - return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; + if (0 != a.frameCount) { + return b.setX(b.getX() + a.dX), b.setY(b.getY() + a.dY), a.frameCount--, b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a; } - delete b.isStart; - delete b.frameCount; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + return a.callReturn(); }; Blockly.Blocks.rotate_absolute = {init:function() { this.setColour("#A751E3"); @@ -4745,10 +4627,10 @@ Blockly.Blocks.rotate_absolute = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_absolute = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setRotation(c); - return b.callReturn(); +Entry.block.rotate_absolute = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setRotation(d); + return a.callReturn(); }; Blockly.Blocks.rotate_relative = {init:function() { this.setColour("#A751E3"); @@ -4759,10 +4641,10 @@ Blockly.Blocks.rotate_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_relative = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setRotation(c + a.getRotation()); - return b.callReturn(); +Entry.block.rotate_relative = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setRotation(d + b.getRotation()); + return a.callReturn(); }; Blockly.Blocks.direction_absolute = {init:function() { this.setColour("#A751E3"); @@ -4773,10 +4655,10 @@ Blockly.Blocks.direction_absolute = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_absolute = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setDirection(c); - return b.callReturn(); +Entry.block.direction_absolute = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setDirection(d); + return a.callReturn(); }; Blockly.Blocks.direction_relative = {init:function() { this.setColour("#A751E3"); @@ -4787,10 +4669,10 @@ Blockly.Blocks.direction_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative = function(a, b) { - var c = b.getNumberValue("VALUE", b); - a.setDirection(c + a.getDirection()); - return b.callReturn(); +Entry.block.direction_relative = function(b, a) { + var d = a.getNumberValue("VALUE", a); + b.setDirection(d + b.getDirection()); + return a.callReturn(); }; Blockly.Blocks.move_to_angle = {init:function() { this.setColour("#A751E3"); @@ -4803,12 +4685,12 @@ Blockly.Blocks.move_to_angle = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_to_angle = function(a, b) { - var c = b.getNumberValue("VALUE", b), d = b.getNumberValue("ANGLE", b); - a.setX(a.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); - a.setY(a.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); - a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); - return b.callReturn(); +Entry.block.move_to_angle = function(b, a) { + var d = a.getNumberValue("VALUE", a), c = a.getNumberValue("ANGLE", a); + b.setX(b.getX() + d * Math.cos((c - 90) / 180 * Math.PI)); + b.setY(b.getY() - d * Math.sin((c - 90) / 180 * Math.PI)); + b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); + return a.callReturn(); }; Blockly.Blocks.rotate_by_time = {init:function() { this.setColour("#A751E3"); @@ -4822,21 +4704,21 @@ Blockly.Blocks.rotate_by_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_time = function(a, b) { - if (!b.isStart) { - var c; - c = b.getNumberValue("VALUE", b); - var d = b.getNumberValue("ANGLE", b); - b.isStart = !0; - b.frameCount = Math.floor(c * Entry.FPS); - b.dAngle = d / b.frameCount; +Entry.block.rotate_by_time = function(b, a) { + if (!a.isStart) { + var d; + d = a.getNumberValue("VALUE", a); + var c = a.getNumberValue("ANGLE", a); + a.isStart = !0; + a.frameCount = Math.floor(d * Entry.FPS); + a.dAngle = c / a.frameCount; } - if (0 != b.frameCount) { - return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; + if (0 != a.frameCount) { + return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; } - delete b.isStart; - delete b.frameCount; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + return a.callReturn(); }; Blockly.Blocks.direction_relative_duration = {init:function() { this.setColour("#A751E3"); @@ -4849,26 +4731,26 @@ Blockly.Blocks.direction_relative_duration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative_duration = function(a, b) { - if (!b.isStart) { - var c; - c = b.getNumberValue("DURATION", b); - var d = b.getNumberValue("AMOUNT", b); - b.isStart = !0; - b.frameCount = Math.floor(c * Entry.FPS); - b.dDirection = d / b.frameCount; +Entry.block.direction_relative_duration = function(b, a) { + if (!a.isStart) { + var d; + d = a.getNumberValue("DURATION", a); + var c = a.getNumberValue("AMOUNT", a); + a.isStart = !0; + a.frameCount = Math.floor(d * Entry.FPS); + a.dDirection = c / a.frameCount; } - if (0 != b.frameCount) { - return a.setDirection(a.getDirection() + b.dDirection), b.frameCount--, b; + if (0 != a.frameCount) { + return b.setDirection(b.getDirection() + a.dDirection), a.frameCount--, a; } - delete b.isStart; - delete b.frameCount; - delete b.dDirection; - return b.callReturn(); + delete a.isStart; + delete a.frameCount; + delete a.dDirection; + return a.callReturn(); }; Entry.Neobot = {name:"neobot", LOCAL_MAP:["IN1", "IN2", "IN3", "IR", "BAT"], REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "), setZero:function() { - for (var a in Entry.Neobot.REMOTE_MAP) { - Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[a]] = 0; + for (var b in Entry.Neobot.REMOTE_MAP) { + Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]] = 0; } Entry.hw.update(); }, name:"neobot", monitorTemplate:{imgPath:"hw/neobot.png", width:700, height:700, listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8", type:"input", pos:{x:0, y:0}}, BAT:{name:"\ubca0\ud130\ub9ac", type:"input", pos:{x:0, y:0}}, SND:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, FND:{name:"FND", type:"output", pos:{x:0, y:0}}}, ports:{IN1:{name:"IN1", type:"input", pos:{x:270, y:200}}, IN2:{name:"IN2", type:"input", pos:{x:325, y:200}}, IN3:{name:"IN3", type:"input", pos:{x:325, y:500}}, DCL:{name:"L-Motor", @@ -4879,9 +4761,9 @@ Blockly.Blocks.neobot_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.neobot_sensor_value = function(a, b) { - a = b.getStringField("PORT"); - return Entry.hw.portData[a]; +Entry.block.neobot_sensor_value = function(b, a) { + var d = a.getStringField("PORT"); + return Entry.hw.portData[d]; }; Blockly.Blocks.neobot_left_motor = {init:function() { this.setColour("#00979D"); @@ -4891,11 +4773,10 @@ Blockly.Blocks.neobot_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_left_motor = function(a, b) { - a = b.getNumberField("SPEED"); - var c = b.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCL = a + c; - return b.callReturn(); +Entry.block.neobot_left_motor = function(b, a) { + var d = a.getNumberField("SPEED"), c = a.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCL = d + c; + return a.callReturn(); }; Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setColour("#00979D"); @@ -4904,9 +4785,9 @@ Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_left_motor = function(a, b) { +Entry.block.neobot_stop_left_motor = function(b, a) { Entry.hw.sendQueue.DCL = 0; - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.neobot_right_motor = {init:function() { this.setColour("#00979D"); @@ -4916,11 +4797,10 @@ Blockly.Blocks.neobot_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_right_motor = function(a, b) { - a = b.getNumberField("SPEED"); - var c = b.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCR = a + c; - return b.callReturn(); +Entry.block.neobot_right_motor = function(b, a) { + var d = a.getNumberField("SPEED"), c = a.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCR = d + c; + return a.callReturn(); }; Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setColour("#00979D"); @@ -4929,9 +4809,9 @@ Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_right_motor = function(a, b) { +Entry.block.neobot_stop_right_motor = function(b, a) { Entry.hw.sendQueue.DCR = 0; - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.neobot_all_motor = {init:function() { this.setColour("#00979D"); @@ -4942,34 +4822,34 @@ Blockly.Blocks.neobot_all_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_all_motor = function(a, b) { - b.getNumberField("TYPE"); - a = b.getNumberField("SPEED"); - switch(b.getNumberField("DIRECTION")) { +Entry.block.neobot_all_motor = function(b, a) { + a.getNumberField("TYPE"); + var d = a.getNumberField("SPEED"); + switch(a.getNumberField("DIRECTION")) { case 1: - Entry.hw.sendQueue.DCL = 16 + a; - Entry.hw.sendQueue.DCR = 16 + a; + Entry.hw.sendQueue.DCL = 16 + d; + Entry.hw.sendQueue.DCR = 16 + d; break; case 2: - Entry.hw.sendQueue.DCL = 32 + a; - Entry.hw.sendQueue.DCR = 32 + a; + Entry.hw.sendQueue.DCL = 32 + d; + Entry.hw.sendQueue.DCR = 32 + d; break; case 3: - Entry.hw.sendQueue.DCL = 32 + a; - Entry.hw.sendQueue.DCR = 16 + a; + Entry.hw.sendQueue.DCL = 32 + d; + Entry.hw.sendQueue.DCR = 16 + d; break; case 4: - Entry.hw.sendQueue.DCL = 16 + a; - Entry.hw.sendQueue.DCR = 32 + a; + Entry.hw.sendQueue.DCL = 16 + d; + Entry.hw.sendQueue.DCR = 32 + d; break; case 5: Entry.hw.sendQueue.DCL = 0; - Entry.hw.sendQueue.DCR = 16 + a; + Entry.hw.sendQueue.DCR = 16 + d; break; case 6: - Entry.hw.sendQueue.DCL = 16 + a, Entry.hw.sendQueue.DCR = 0; + Entry.hw.sendQueue.DCL = 16 + d, Entry.hw.sendQueue.DCR = 0; } - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.neobot_set_servo = {init:function() { this.setColour("#00979D"); @@ -4979,13 +4859,12 @@ Blockly.Blocks.neobot_set_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_servo = function(a, b) { - a = b.getNumberField("PORT"); - var c = b.getNumberField("DEGREE"); - Entry.hw.sendQueue["OUT" + a] = c; - 3 === a && (a = 4); - Entry.hw.sendQueue.OPT |= a; - return b.callReturn(); +Entry.block.neobot_set_servo = function(b, a) { + var d = a.getNumberField("PORT"), c = a.getNumberField("DEGREE"); + Entry.hw.sendQueue["OUT" + d] = c; + 3 === d && (d = 4); + Entry.hw.sendQueue.OPT |= d; + return a.callReturn(); }; Blockly.Blocks.neobot_set_output = {init:function() { this.setColour("#00979D"); @@ -4996,14 +4875,13 @@ Blockly.Blocks.neobot_set_output = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_output = function(a, b) { - a = b.getStringField("PORT", b); - var c = b.getNumberValue("VALUE", b), d = a; +Entry.block.neobot_set_output = function(b, a) { + var d = a.getStringField("PORT", a), c = a.getNumberValue("VALUE", a), e = d; 0 > c ? c = 0 : 255 < c && (c = 255); - 3 === d && (d = 4); - Entry.hw.sendQueue["OUT" + a] = c; - Entry.hw.sendQueue.OPT &= ~d; - return b.callReturn(); + 3 === e && (e = 4); + Entry.hw.sendQueue["OUT" + d] = c; + Entry.hw.sendQueue.OPT &= ~e; + return a.callReturn(); }; Blockly.Blocks.neobot_set_fnd = {init:function() { this.setColour("#00979D"); @@ -5014,11 +4892,11 @@ Blockly.Blocks.neobot_set_fnd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_fnd = function(a, b) { - a = b.getNumberValue("VALUE", b); - 255 < a ? a = 255 : 0 > a && (a = 0); - Entry.hw.sendQueue.FND = a; - return b.callReturn(); +Entry.block.neobot_set_fnd = function(b, a) { + var d = a.getNumberValue("VALUE", a); + 255 < d ? d = 255 : 0 > d && (d = 0); + Entry.hw.sendQueue.FND = d; + return a.callReturn(); }; Blockly.Blocks.neobot_play_note_for = {init:function() { this.setColour("#00979D"); @@ -5029,56 +4907,56 @@ Blockly.Blocks.neobot_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_play_note_for = function(a, b) { - a = Entry.hw.sendQueue; - if (b.isStart) { - if (1 == b.timeFlag) { - return b; +Entry.block.neobot_play_note_for = function(b, a) { + var d = Entry.hw.sendQueue; + if (a.isStart) { + if (1 == a.timeFlag) { + return a; } - delete b.timeFlag; - delete b.isStart; + delete a.timeFlag; + delete a.isStart; Entry.hw.sendQueue.SND = 0; Entry.engine.isContinue = !1; - return b.callReturn(); + return a.callReturn(); } - var c = b.getNumberField("NOTE", b), d = b.getNumberField("OCTAVE", b), e = b.getNumberField("DURATION", b), c = c + 12 * d; - b.isStart = !0; - b.timeFlag = 1; + var c = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberField("DURATION", a), c = c + 12 * e; + a.isStart = !0; + a.timeFlag = 1; 65 < c && (c = 65); - a.SND = c; + d.SND = c; setTimeout(function() { - b.timeFlag = 0; - }, 1 / e * 2E3); - return b; + a.timeFlag = 0; + }, 1 / f * 2E3); + return a; }; Entry.Roborobo_Roduino = {name:"roborobo_roduino", INSTRUCTION:{DIGITAL_READ:1, DIGITAL_SET_MODE:2, DIGITAL_WRITE:3, ANALOG_WRITE:4, ANALOG_READ:5, MOTOR:6, COLOR:7}, setZero:function() { - for (var a = 0;5 > a;a++) { - Entry.hw.sendQueue[a] = 0; + for (var b = 0;5 > b;b++) { + Entry.hw.sendQueue[b] = 0; } this.ColorPin = [0, 0, 0]; Entry.hw.update(); -}, setSendData:function(a) { - Entry.hw.sendQueue = a; +}, setSendData:function(b) { + Entry.hw.sendQueue = b; Entry.hw.update(); this.wait(32); -}, wait:function(a) { - for (var b = (new Date).getTime(), c = b;c < b + a;) { - c = (new Date).getTime(); +}, wait:function(b) { + for (var a = (new Date).getTime(), d = a;d < a + b;) { + d = (new Date).getTime(); } }, ColorPin:[0, 0, 0]}; Entry.Roborobo_SchoolKit = {name:"roborobo_schoolkit", INSTRUCTION:{DIGITAL_READ:1, DIGITAL_WRITE:2, MOTOR:3, COLOR:4, SERVO:5}, setZero:function() { - for (var a = 0;5 > a;a++) { - Entry.hw.sendQueue[a] = 0; + for (var b = 0;5 > b;b++) { + Entry.hw.sendQueue[b] = 0; } this.ColorPin = [0, 0, 0]; Entry.hw.update(); -}, setSendData:function(a) { - Entry.hw.sendQueue = a; +}, setSendData:function(b) { + Entry.hw.sendQueue = b; Entry.hw.update(); this.wait(32); -}, wait:function(a) { - for (var b = (new Date).getTime(), c = b;c < b + a;) { - c = (new Date).getTime(); +}, wait:function(b) { + for (var a = (new Date).getTime(), d = a;d < a + b;) { + d = (new Date).getTime(); } }, ColorPin:[0, 0, 0]}; Blockly.Blocks.roduino_on_block = {init:function() { @@ -5087,7 +4965,7 @@ Blockly.Blocks.roduino_on_block = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.roduino_on_block = function(a, b) { +Entry.block.roduino_on_block = function(b, a) { return "1"; }; Blockly.Blocks.roduino_off_block = {init:function() { @@ -5096,7 +4974,7 @@ Blockly.Blocks.roduino_off_block = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.roduino_off_block = function(a, b) { +Entry.block.roduino_off_block = function(b, a) { return "0"; }; Blockly.Blocks.roduino_get_analog_number = {init:function() { @@ -5106,8 +4984,8 @@ Blockly.Blocks.roduino_get_analog_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.roduino_get_analog_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.roduino_get_analog_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.roduino_get_port_number = {init:function() { this.setColour("#00979D"); @@ -5116,8 +4994,8 @@ Blockly.Blocks.roduino_get_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.roduino_get_port_number = function(a, b) { - return b.getStringField("PORT"); +Entry.block.roduino_get_port_number = function(b, a) { + return a.getStringField("PORT"); }; Blockly.Blocks.roduino_get_analog_value = {init:function() { this.setColour("#00979D"); @@ -5127,10 +5005,10 @@ Blockly.Blocks.roduino_get_analog_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.roduino_get_analog_value = function(a, b) { - a = parseInt(b.getValue("VALUE", b)); - Entry.Roduino.setSendData([Entry.Roduino.INSTRUCTION.ANALOG_READ, a]); - return Entry.hw.getAnalogPortValue(a); +Entry.block.roduino_get_analog_value = function(b, a) { + var d = parseInt(a.getValue("VALUE", a)); + Entry.Roduino.setSendData([Entry.Roduino.INSTRUCTION.ANALOG_READ, d]); + return Entry.hw.getAnalogPortValue(d); }; Blockly.Blocks.roduino_get_digital_value = {init:function() { this.setColour("#00979D"); @@ -5140,10 +5018,10 @@ Blockly.Blocks.roduino_get_digital_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.roduino_get_digital_value = function(a, b) { - a = b.getNumberValue("VALUE"); - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_READ, a]); - return Entry.hw.portData[a - 2]; +Entry.block.roduino_get_digital_value = function(b, a) { + var d = a.getNumberValue("VALUE"); + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_READ, d]); + return Entry.hw.portData[d - 2]; }; Blockly.Blocks.roduino_get_color = {init:function() { this.setColour("#00979D"); @@ -5151,24 +5029,22 @@ Blockly.Blocks.roduino_get_color = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.roduino_get_color = function(a, b) { - a = 0; - b = b.getField("VALUE", b); - var c = [Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2] - 2]]; - switch(b) { +Entry.block.roduino_get_color = function(b, a) { + var d = 0, c = a.getField("VALUE", a), e = [Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1] - 2], Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2] - 2]]; + switch(c) { case "red": - 1 == c[0] && 0 == c[1] && 0 == c[2] && (a = 1); + 1 == e[0] && 0 == e[1] && 0 == e[2] && (d = 1); break; case "green": - 0 == c[0] && 1 == c[1] && 0 == c[2] && (a = 1); + 0 == e[0] && 1 == e[1] && 0 == e[2] && (d = 1); break; case "blue": - 0 == c[0] && 0 == c[1] && 1 == c[2] && (a = 1); + 0 == e[0] && 0 == e[1] && 1 == e[2] && (d = 1); break; case "yellow": - 1 == c[0] && 1 == c[1] && 1 == c[2] && (a = 1); + 1 == e[0] && 1 == e[1] && 1 == e[2] && (d = 1); } - return a; + return d; }; Blockly.Blocks.roduino_set_digital = {init:function() { this.setColour("#00979D"); @@ -5180,11 +5056,10 @@ Blockly.Blocks.roduino_set_digital = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.roduino_set_digital = function(a, b) { - a = b.getNumberValue("VALUE"); - var c = b.getField("OPERATOR"); - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, a, "on" == c ? 1 : 0]); - return b.callReturn(); +Entry.block.roduino_set_digital = function(b, a) { + var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 1 : 0; + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE, d, c]); + return a.callReturn(); }; Blockly.Blocks.roduino_motor = {init:function() { this.setColour("#00979D"); @@ -5194,16 +5069,12 @@ Blockly.Blocks.roduino_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.roduino_motor = function(a, b) { - pin2 = 0; - var c; - value2 = 0; - a = b.getField("MODE"); - c = b.getField("OPERATOR"); - "motor1" == a ? (a = 9, pin2 = 10) : (a = 11, pin2 = 12); +Entry.block.roduino_motor = function(b, a) { + var d = pin2 = 0, c = value2 = 0, d = a.getField("MODE"), c = a.getField("OPERATOR"); + "motor1" == d ? (d = 9, pin2 = 10) : (d = 11, pin2 = 12); "cw" == c ? (c = 1, value2 = 0) : "ccw" == c ? (c = 0, value2 = 1) : value2 = c = 0; - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR, a, c, pin2, value2]); - return b.callReturn(); + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR, d, c, pin2, value2]); + return a.callReturn(); }; Blockly.Blocks.roduino_set_color_pin = {init:function() { this.setColour("#00979D"); @@ -5218,12 +5089,11 @@ Blockly.Blocks.roduino_set_color_pin = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.roduino_set_color_pin = function(a, b) { - a = b.getNumberValue("RED", b); - var c = b.getNumberValue("GREEN", b), d = b.getNumberValue("BLUE", b); - Entry.Roborobo_Roduino.ColorPin = [a, c, d]; - Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR, a, c, d]); - return b.callReturn(); +Entry.block.roduino_set_color_pin = function(b, a) { + var d = a.getNumberValue("RED", a), c = a.getNumberValue("GREEN", a), e = a.getNumberValue("BLUE", a); + Entry.Roborobo_Roduino.ColorPin = [d, c, e]; + Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR, d, c, e]); + return a.callReturn(); }; Blockly.Blocks.schoolkit_on_block = {init:function() { this.setColour("#00979D"); @@ -5231,7 +5101,7 @@ Blockly.Blocks.schoolkit_on_block = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.schoolkit_on_block = function(a, b) { +Entry.block.schoolkit_on_block = function(b, a) { return "1"; }; Blockly.Blocks.schoolkit_off_block = {init:function() { @@ -5240,7 +5110,7 @@ Blockly.Blocks.schoolkit_off_block = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.schoolkit_off_block = function(a, b) { +Entry.block.schoolkit_off_block = function(b, a) { return "0"; }; Blockly.Blocks.schoolkit_get_out_port_number = {init:function() { @@ -5250,8 +5120,8 @@ Blockly.Blocks.schoolkit_get_out_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.schoolkit_get_out_port_number = function(a, b) { - return b.getNumberField("PORT"); +Entry.block.schoolkit_get_out_port_number = function(b, a) { + return a.getNumberField("PORT"); }; Blockly.Blocks.schoolkit_set_output = {init:function() { this.setColour("#00979D"); @@ -5263,11 +5133,10 @@ Blockly.Blocks.schoolkit_set_output = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.schoolkit_set_output = function(a, b) { - a = b.getNumberValue("VALUE"); - var c = b.getField("OPERATOR"); - Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, a, "on" == c ? 1 : 0]); - return b.callReturn(); +Entry.block.schoolkit_set_output = function(b, a) { + var d = a.getNumberValue("VALUE"), c = "on" == a.getField("OPERATOR") ? 1 : 0; + Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE, d, c]); + return a.callReturn(); }; Blockly.Blocks.schoolkit_get_in_port_number = {init:function() { this.setColour("#00979D"); @@ -5276,8 +5145,8 @@ Blockly.Blocks.schoolkit_get_in_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.schoolkit_get_in_port_number = function(a, b) { - return b.getNumberField("PORT"); +Entry.block.schoolkit_get_in_port_number = function(b, a) { + return a.getNumberField("PORT"); }; Blockly.Blocks.schoolkit_get_input_value = {init:function() { this.setColour("#00979D"); @@ -5287,10 +5156,10 @@ Blockly.Blocks.schoolkit_get_input_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.schoolkit_get_input_value = function(a, b) { - a = b.getNumberValue("VALUE"); - Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_READ, a]); - return Entry.hw.portData[a - 7]; +Entry.block.schoolkit_get_input_value = function(b, a) { + var d = a.getNumberValue("VALUE"); + Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_READ, d]); + return Entry.hw.portData[d - 7]; }; Blockly.Blocks.schoolkit_motor = {init:function() { this.setColour("#00979D"); @@ -5301,15 +5170,11 @@ Blockly.Blocks.schoolkit_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.schoolkit_motor = function(a, b) { - var c; - c = b.getField("MODE"); - a = b.getField("OPERATOR"); - var d = b.getNumberValue("VALUE"); - c = "motor1" == c ? 7 : 8; - 255 < d ? d = 255 : 0 > d && (d = 0); - "cw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, c, d]) : "ccw" == a ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, c, d]) : "stop" == a && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 0, c, d]); - return b.callReturn(); +Entry.block.schoolkit_motor = function(b, a) { + var d = 0, c = 0, d = a.getField("MODE"), e = a.getField("OPERATOR"), f = a.getNumberValue("VALUE"), d = "motor1" == d ? 7 : 8; + 255 < f ? f = 255 : 0 > f && (f = 0); + "cw" == e ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 1, d, f]) : "ccw" == e ? Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, 2, d, f]) : "stop" == e && Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, c, d, f]); + return a.callReturn(); }; Blockly.Blocks.schoolkit_set_servo_value = {init:function() { this.setColour("#00979D"); @@ -5324,12 +5189,11 @@ Blockly.Blocks.schoolkit_set_servo_value = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.schoolkit_set_servo_value = function(a, b) { - a = b.getNumberValue("PIN"); - var c = b.getNumberValue("VALUE"); +Entry.block.schoolkit_set_servo_value = function(b, a) { + var d = a.getNumberValue("PIN"), c = a.getNumberValue("VALUE"); 0 > c ? c = 0 : 180 < c && (c = 180); - Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.SERVO, a, c]); - return b.callReturn(); + Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.SERVO, d, c]); + return a.callReturn(); }; Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED:[67, 1], CM_SPRING_RIGHT:[69, 1, 69, 2], CM_SPRING_LEFT:[70, 1, 69, 2], CM_SWITCH:[71, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_IR_LEFT:[91, 2, 91, 4], CM_IR_RIGHT:[93, 2, 91, 4], CM_CALIBRATION_LEFT:[95, 2], CM_CALIBRATION_RIGHT:[97, 2], AUX_MOTOR_SPEED_LEFT:[152, 2], AUX_MOTOR_SPEED_RIGHT:[154, 2]}, setZero:function() { Entry.hw.sendQueue.setZero = [1]; @@ -5339,47 +5203,47 @@ Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{C this.update(); this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0], [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0]]); this.update(); -}, name:"robotis_carCont", delay:40, postCallReturn:function(a, b, c) { - if (0 >= c) { - return this.setRobotisData(b), this.update(), a.callReturn(); +}, name:"robotis_carCont", delay:40, postCallReturn:function(b, a, d) { + if (0 >= d) { + return this.setRobotisData(a), this.update(), b.callReturn(); } - if (a.isStart) { - if (1 == a.timeFlag) { - return this.setRobotisData(null), a; + if (b.isStart) { + if (1 == b.timeFlag) { + return this.setRobotisData(null), b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.engine.isContinue = !1; this.update(); - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - this.setRobotisData(b); + b.isStart = !0; + b.timeFlag = 1; + this.setRobotisData(a); setTimeout(function() { - a.timeFlag = 0; - }, c); - return a; -}, wait:function(a, b) { - Entry.hw.socket.send(JSON.stringify(a)); - for (var c = a = (new Date).getTime();c < a + b;) { + b.timeFlag = 0; + }, d); + return b; +}, wait:function(b, a) { + Entry.hw.socket.send(JSON.stringify(b)); + for (var d = (new Date).getTime(), c = d;c < d + a;) { c = (new Date).getTime(); } }, update:function() { Entry.hw.update(); - var a = Entry.hw.sendQueue.ROBOTIS_DATA; - a && a.forEach(function(b) { - b.send = !0; + var b = Entry.hw.sendQueue.ROBOTIS_DATA; + b && b.forEach(function(a) { + a.send = !0; }); this.setRobotisData(null); }, filterSendData:function() { - var a = Entry.hw.sendQueue.ROBOTIS_DATA; - return a ? a.filter(function(b) { - return !0 !== b.send; + var b = Entry.hw.sendQueue.ROBOTIS_DATA; + return b ? b.filter(function(a) { + return !0 !== a.send; }) : null; -}, setRobotisData:function(a) { - var b = this.filterSendData(); - Entry.hw.sendQueue.ROBOTIS_DATA = null == a ? b : b ? b.concat(a) : a; +}, setRobotisData:function(b) { + var a = this.filterSendData(); + Entry.hw.sendQueue.ROBOTIS_DATA = null == b ? a : a ? a.concat(b) : b; }}; Entry.Robotis_openCM70 = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED_R:[79, 1], CM_LED_G:[80, 1], CM_LED_B:[81, 1], CM_BUZZER_INDEX:[84, 1], CM_BUZZER_TIME:[85, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_USER_BUTTON:[26, 1], CM_MOTION:[66, 1], AUX_SERVO_POSITION:[152, 2], AUX_IR:[168, 2], AUX_TOUCH:[202, 1], AUX_TEMPERATURE:[234, 1], AUX_ULTRASONIC:[242, 1], AUX_MAGNETIC:[250, 1], AUX_MOTION_DETECTION:[258, 1], AUX_COLOR:[266, 1], AUX_CUSTOM:[216, 2], AUX_BRIGHTNESS:[288, 2], AUX_HYDRO_THEMO_HUMIDITY:[274, 1], AUX_HYDRO_THEMO_TEMPER:[282, 1], AUX_SERVO_MODE:[126, 1], AUX_SERVO_SPEED:[136, 2], AUX_MOTOR_SPEED:[136, 2], AUX_LED_MODULE:[210, 1]}, setZero:function() { @@ -5403,14 +5267,13 @@ Blockly.Blocks.robotis_openCM70_cm_custom_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_openCM70_cm_custom_value = function(a, b) { - a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var c = 0, d = b.getStringField("SIZE"); - "BYTE" == d ? c = 1 : "WORD" == d ? c = 2 : "DWORD" == d && (c = 4); - b = b.getNumberValue("VALUE"); - Entry.Robotis_carCont.setRobotisData([[a, b, c, 0, c]]); +Entry.block.robotis_openCM70_cm_custom_value = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.READ, c = 0, e = 0, f = 0, c = a.getStringField("SIZE"); + "BYTE" == c ? e = 1 : "WORD" == c ? e = 2 : "DWORD" == c && (e = 4); + f = c = a.getNumberValue("VALUE"); + Entry.Robotis_carCont.setRobotisData([[d, c, e, 0, e]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[b]; + return Entry.hw.portData[f]; }; Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setColour("#00979D"); @@ -5420,22 +5283,20 @@ Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, sensorList:function() { - var a = []; - a.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); - a.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); - a.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); - return a; + var b = []; + b.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); + b.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); + b.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); + return b; }}; -Entry.block.robotis_openCM70_sensor_value = function(a, b) { - a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var c = 0, d = 0, e = 0, f = 0; - b = b.getStringField("SENSOR"); - "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], - d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); - e += 0 * f; - Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); +Entry.block.robotis_openCM70_sensor_value = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.READ, c = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); + "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], + e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == h && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); + f += 0 * g; + Entry.Robotis_carCont.setRobotisData([[d, c, e, 0, g]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[e]; + return Entry.hw.portData[f]; }; Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setColour("#00979D"); @@ -5447,46 +5308,43 @@ Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, portList:function() { - var a = []; - a.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); - a.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); - a.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); - a.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); - return a; + var b = []; + b.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); + b.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); + b.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); + b.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); + return b; }, sensorList:function() { - var a = []; - a.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); - a.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); - a.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); - a.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); - a.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); - a.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); - a.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); - a.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); - a.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); - a.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); - a.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); - a.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); - return a; + var b = []; + b.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); + b.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); + b.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); + b.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); + b.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); + b.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); + b.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); + b.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); + b.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); + b.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); + b.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); + b.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); + return b; }}; -Entry.block.robotis_openCM70_aux_sensor_value = function(a, b) { - a = Entry.Robotis_openCM70.INSTRUCTION.READ; - var c = 0, d = 0, e = 0, f = 0, g = b.getStringField("PORT"); - b = b.getStringField("SENSOR"); - var h = 0; - "PORT_3" == g ? h = 2 : "PORT_4" == g ? h = 3 : "PORT_5" == g ? h = 4 : "PORT_6" == g && (h = 5); - "AUX_SERVO_POSITION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : - "AUX_TOUCH" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : - "AUX_BRIGHTNESS" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], - c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], - c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], - c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); - e += h * f; - 0 != h && (d = 6 * f); - Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); +Entry.block.robotis_openCM70_aux_sensor_value = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.READ, c = 0, e = 0, f = 0, g = 0, h = a.getStringField("PORT"), k = a.getStringField("SENSOR"), l = 0; + "PORT_3" == h ? l = 2 : "PORT_4" == h ? l = 3 : "PORT_5" == h ? l = 4 : "PORT_6" == h && (l = 5); + "AUX_SERVO_POSITION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : + "AUX_TOUCH" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : + "AUX_BRIGHTNESS" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == k && (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); + f += l * g; + 0 != l && (e = 6 * g); + Entry.Robotis_carCont.setRobotisData([[d, c, e, 0, g]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[e]; + return Entry.hw.portData[f]; }; Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setColour("#00979D"); @@ -5503,14 +5361,12 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_index = function(a, b) { - a = b.getField("CM_BUZZER_INDEX", b); - var c = b.getNumberValue("CM_BUZZER_TIME", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f, g; - e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0]; - f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1]; - g = parseInt(10 * c); - 50 < g && (g = 50); - return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g], [d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3 * c); +Entry.block.robotis_openCM70_cm_buzzer_index = function(b, a) { + var d = a.getField("CM_BUZZER_INDEX", a), c = a.getNumberValue("CM_BUZZER_TIME", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, k = 0, l = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], h = parseInt(10 * c); + 50 < h && (h = 50); + k = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0]; + l = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h], [e, k, l, d]], 1E3 * c); }; Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setColour("#00979D"); @@ -5523,10 +5379,9 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_melody = function(a, b) { - a = b.getField("CM_BUZZER_MELODY", b); - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - return Entry.Robotis_carCont.postCallReturn(b, [[c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], 255], [c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3); +Entry.block.robotis_openCM70_cm_buzzer_melody = function(b, a) { + var d = a.getField("CM_BUZZER_MELODY", a), c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0, g = 0, h = 0, e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[c, e, f, 255], [c, g, h, d]], 1E3); }; Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -5535,8 +5390,9 @@ Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_sound_detected_clear = function(a, b) { - return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_openCM70.INSTRUCTION.WRITE, Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_sound_detected_clear = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, c = 0, e = 0, c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[d, c, e, 0]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setColour("#00979D"); @@ -5546,11 +5402,10 @@ Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_led = function(a, b) { - a = b.getField("CM_LED", b); - var c = b.getField("VALUE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0; - "CM_LED_R" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == a && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); - return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, c]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_led = function(b, a) { + var d = a.getField("CM_LED", a), c = a.getField("VALUE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0; + "CM_LED_R" == d ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == d ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == d && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); + return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setColour("#00979D"); @@ -5562,13 +5417,9 @@ Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_motion = function(a, b) { - a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - var c, d, e; - c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0]; - d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1]; - e = b.getNumberValue("VALUE", b); - return Entry.Robotis_carCont.postCallReturn(b, [[a, c, d, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_motion = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, c = 0, e = 0, f = 0, c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1], f = a.getNumberValue("VALUE", a); + return Entry.Robotis_carCont.postCallReturn(a, [[d, c, e, f]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -5579,13 +5430,10 @@ Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_motor_speed = function(a, b) { - a = b.getField("PORT", b); - var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0]; - g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; - "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_motor_speed = function(b, a) { + var d = a.getField("PORT", a), c = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; + "CW" == c ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); + return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (d - 1) * h, h, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setColour("#00979D"); @@ -5595,12 +5443,9 @@ Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_mode = function(a, b) { - a = b.getField("PORT", b); - var c = b.getField("MODE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0]; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_mode = function(b, a) { + var d = a.getField("PORT", a), c = a.getField("MODE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (d - 1) * g, g, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setColour("#00979D"); @@ -5611,13 +5456,10 @@ Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_speed = function(a, b) { - a = b.getField("PORT", b); - var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0]; - g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; - "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_speed = function(b, a) { + var d = a.getField("PORT", a), c = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; + "CW" == c ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); + return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (d - 1) * h, h, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setColour("#00979D"); @@ -5628,13 +5470,10 @@ Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_position = function(a, b) { - a = b.getField("PORT", b); - var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0]; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; +Entry.block.robotis_openCM70_aux_servo_position = function(b, a) { + var d = a.getField("PORT", a), c = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; 1023 < c ? c = 1023 : 0 > c && (c = 0); - return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); + return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (d - 1) * g, g, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setColour("#00979D"); @@ -5645,12 +5484,9 @@ Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_led_module = function(a, b) { - a = b.getField("PORT", b); - var c = b.getField("LED_MODULE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0]; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_led_module = function(b, a) { + var d = a.getField("PORT", a), c = a.getField("LED_MODULE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (d - 1) * g, g, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setColour("#00979D"); @@ -5661,12 +5497,9 @@ Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_custom = function(a, b) { - a = b.getField("PORT", b); - var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0]; - f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; - return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_custom = function(b, a) { + var d = a.getField("PORT", a), c = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (d - 1) * g, g, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setColour("#00979D"); @@ -5681,12 +5514,9 @@ Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_custom = function(a, b) { - a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; - var c, d; - c = b.getNumberValue("ADDRESS"); - d = b.getNumberValue("VALUE"); - return Entry.Robotis_carCont.postCallReturn(b, [[a, c, 65535 < d ? 4 : 255 < d ? 2 : 1, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_custom = function(b, a) { + var d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, c = 0, e = 0, c = a.getNumberValue("ADDRESS"), e = a.getNumberValue("VALUE"); + return Entry.Robotis_carCont.postCallReturn(a, [[d, c, 65535 < e ? 4 : 255 < e ? 2 : 1, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setColour("#00979D"); @@ -5695,19 +5525,17 @@ Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_carCont_sensor_value = function(a, b) { - a = Entry.Robotis_carCont.INSTRUCTION.READ; - var c = 0, d = 0, e = 0, f = 0; - b = b.getStringField("SENSOR"); - "CM_SPRING_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : - "CM_SWITCH" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : - "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : - "CM_IR_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : - "CM_CALIBRATION_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == b && (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], - d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); - Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); +Entry.block.robotis_carCont_sensor_value = function(b, a) { + var d = Entry.Robotis_carCont.INSTRUCTION.READ, c = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); + "CM_SPRING_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : + "CM_SWITCH" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : + "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : + "CM_IR_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : + "CM_CALIBRATION_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == h && (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], + e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); + Entry.Robotis_carCont.setRobotisData([[d, c, e, 0, g]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[e]; + return Entry.hw.portData[f]; }; Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setColour("#00979D"); @@ -5716,14 +5544,11 @@ Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_led = function(a, b) { - a = b.getField("VALUE_LEFT", b); - var c = b.getField("VALUE_RIGHT", b), d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e, f, g = 0; - e = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0]; - f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; - 1 == a && 1 == c ? g = 9 : 1 == a && 0 == c && (g = 8); - 0 == a && 1 == c && (g = 1); - return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_led = function(b, a) { + var d = a.getField("VALUE_LEFT", a), c = a.getField("VALUE_RIGHT", a), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; + 1 == d && 1 == c ? h = 9 : 1 == d && 0 == c && (h = 8); + 0 == d && 1 == c && (h = 1); + return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -5732,8 +5557,9 @@ Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_sound_detected_clear = function(a, b) { - return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_carCont.INSTRUCTION.WRITE, Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_sound_detected_clear = function(b, a) { + var d = Entry.Robotis_carCont.INSTRUCTION.WRITE, c = 0, e = 0, c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]; + return Entry.Robotis_carCont.postCallReturn(a, [[d, c, e, 0]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -5744,13 +5570,11 @@ Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_aux_motor_speed = function(a, b) { - var c = b.getField("DIRECTION", b); - a = b.getField("DIRECTION_ANGLE", b); - var d = b.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f; - "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); - "CW" == a ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); - return Entry.Robotis_carCont.postCallReturn(b, [[e, c, f, d]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_aux_motor_speed = function(b, a) { + var d = a.getField("DIRECTION", a), c = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_carCont.INSTRUCTION.WRITE, g = 0, h = 0; + "LEFT" == d ? (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); + "CW" == c ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); + return Entry.Robotis_carCont.postCallReturn(a, [[f, g, h, e]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setColour("#00979D"); @@ -5761,12 +5585,10 @@ Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_calibration = function(a, b) { - var c = b.getField("DIRECTION", b); - a = b.getNumberValue("VALUE"); - var d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e; - "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); - return Entry.Robotis_carCont.postCallReturn(b, [[d, c, e, a]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_calibration = function(b, a) { + var d = a.getField("DIRECTION", a), c = a.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0; + "LEFT" == d ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); + return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, c]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.when_scene_start = {init:function() { this.setColour("#3BBD70"); @@ -5774,8 +5596,8 @@ Blockly.Blocks.when_scene_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_scene_start = function(a, b) { - return b.callReturn(); +Entry.block.when_scene_start = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.start_scene = {init:function() { this.setColour("#3BBD70"); @@ -5784,10 +5606,10 @@ Blockly.Blocks.start_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_scene = function(a, b) { - a = b.getField("VALUE", b); - if (a = Entry.scene.getSceneById(a)) { - Entry.scene.selectScene(a), Entry.engine.fireEvent("when_scene_start"); +Entry.block.start_scene = function(b, a) { + var d = a.getField("VALUE", a); + if (d = Entry.scene.getSceneById(d)) { + Entry.scene.selectScene(d), Entry.engine.fireEvent("when_scene_start"); } return null; }; @@ -5798,11 +5620,9 @@ Blockly.Blocks.start_neighbor_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_neighbor_scene = function(a, b) { - var c = Entry.scene.selectedScene; - a = Entry.scene.getScenes(); - c = a.indexOf(c); - "next" == b.getField("OPERATOR", b) ? c + 1 < a.length && (b = Entry.scene.getSceneById(a[c + 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (b = Entry.scene.getSceneById(a[c - 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")); +Entry.block.start_neighbor_scene = function(b, a) { + var d = Entry.scene.selectedScene, c = Entry.scene.getScenes(), d = c.indexOf(d); + "next" == a.getField("OPERATOR", a) ? d + 1 < c.length && (c = Entry.scene.getSceneById(c[d + 1].id)) && (Entry.scene.selectScene(c), Entry.engine.fireEvent("when_scene_start")) : 0 < d && (c = Entry.scene.getSceneById(c[d - 1].id)) && (Entry.scene.selectScene(c), Entry.engine.fireEvent("when_scene_start")); return null; }; Blockly.Blocks.sound_something = {init:function() { @@ -5814,10 +5634,10 @@ Blockly.Blocks.sound_something = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something = function(a, b) { - var c = b.getField("VALUE", b); - Entry.isExist(c, "id", a.parent.sounds) && createjs.Sound.play(c); - return b.callReturn(); +Entry.block.sound_something = function(b, a) { + var d = a.getField("VALUE", a); + Entry.isExist(d, "id", b.parent.sounds) && createjs.Sound.play(d); + return a.callReturn(); }; Blockly.Blocks.sound_something_second = {init:function() { this.setColour("#A4D01D"); @@ -5830,15 +5650,15 @@ Blockly.Blocks.sound_something_second = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second = function(a, b) { - var c = b.getField("VALUE", b), d = b.getNumberValue("SECOND", b); - if (Entry.isExist(c, "id", a.parent.sounds)) { - var e = createjs.Sound.play(c); +Entry.block.sound_something_second = function(b, a) { + var d = a.getField("VALUE", a), c = a.getNumberValue("SECOND", a); + if (Entry.isExist(d, "id", b.parent.sounds)) { + var e = createjs.Sound.play(d); setTimeout(function() { e.stop(); - }, 1E3 * d); + }, 1E3 * c); } - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.sound_something_wait = {init:function() { this.setColour("#A4D01D"); @@ -5849,22 +5669,22 @@ Blockly.Blocks.sound_something_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait = function(a, b) { - if (b.isPlay) { - if (1 == b.playState) { - return b; +Entry.block.sound_something_wait = function(b, a) { + if (a.isPlay) { + if (1 == a.playState) { + return a; } - delete b.playState; - delete b.isPlay; - return b.callReturn(); + delete a.playState; + delete a.isPlay; + return a.callReturn(); } - b.isPlay = !0; - b.playState = 1; - var c = b.getField("VALUE", b), d = a.parent.getSound(c); - Entry.isExist(c, "id", a.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { - b.playState = 0; - }, 1E3 * d.duration)); - return b; + a.isPlay = !0; + a.playState = 1; + var d = a.getField("VALUE", a), c = b.parent.getSound(d); + Entry.isExist(d, "id", b.parent.sounds) && (createjs.Sound.play(d), setTimeout(function() { + a.playState = 0; + }, 1E3 * c.duration)); + return a; }; Blockly.Blocks.sound_something_second_wait = {init:function() { this.setColour("#A4D01D"); @@ -5877,29 +5697,28 @@ Blockly.Blocks.sound_something_second_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait = function(a, b) { - if (b.isPlay) { - if (1 == b.playState) { - return b; +Entry.block.sound_something_second_wait = function(b, a) { + if (a.isPlay) { + if (1 == a.playState) { + return a; } - delete b.isPlay; - delete b.playState; - return b.callReturn(); + delete a.isPlay; + delete a.playState; + return a.callReturn(); } - b.isPlay = !0; - b.playState = 1; - var c = b.getField("VALUE", b); - if (Entry.isExist(c, "id", a.parent.sounds)) { - var d = createjs.Sound.play(c); - a = b.getNumberValue("SECOND", b); + a.isPlay = !0; + a.playState = 1; + var d = a.getField("VALUE", a); + if (Entry.isExist(d, "id", b.parent.sounds)) { + var c = createjs.Sound.play(d), d = a.getNumberValue("SECOND", a); setTimeout(function() { - d.stop(); - b.playState = 0; - }, 1E3 * a); - d.addEventListener("complete", function(b) { + c.stop(); + a.playState = 0; + }, 1E3 * d); + c.addEventListener("complete", function(a) { }); } - return b; + return a; }; Blockly.Blocks.sound_volume_change = {init:function() { this.setColour("#A4D01D"); @@ -5910,13 +5729,12 @@ Blockly.Blocks.sound_volume_change = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_change = function(a, b) { - a = b.getNumberValue("VALUE", b) / 100; - a += createjs.Sound.getVolume(); - 1 < a && (a = 1); - 0 > a && (a = 0); - createjs.Sound.setVolume(a); - return b.callReturn(); +Entry.block.sound_volume_change = function(b, a) { + var d = a.getNumberValue("VALUE", a) / 100, d = d + createjs.Sound.getVolume(); + 1 < d && (d = 1); + 0 > d && (d = 0); + createjs.Sound.setVolume(d); + return a.callReturn(); }; Blockly.Blocks.sound_volume_set = {init:function() { this.setColour("#A4D01D"); @@ -5927,12 +5745,12 @@ Blockly.Blocks.sound_volume_set = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_set = function(a, b) { - a = b.getNumberValue("VALUE", b) / 100; - 1 < a && (a = 1); - 0 > a && (a = 0); - createjs.Sound.setVolume(a); - return b.callReturn(); +Entry.block.sound_volume_set = function(b, a) { + var d = a.getNumberValue("VALUE", a) / 100; + 1 < d && (d = 1); + 0 > d && (d = 0); + createjs.Sound.setVolume(d); + return a.callReturn(); }; Blockly.Blocks.sound_silent_all = {init:function() { this.setColour("#A4D01D"); @@ -5941,9 +5759,9 @@ Blockly.Blocks.sound_silent_all = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_silent_all = function(a, b) { +Entry.block.sound_silent_all = function(b, a) { createjs.Sound.stop(); - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.get_sounds = {init:function() { this.setColour("#A4D01D"); @@ -5953,8 +5771,8 @@ Blockly.Blocks.get_sounds = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_sounds = function(a, b) { - return b.getStringField("VALUE"); +Entry.block.get_sounds = function(b, a) { + return a.getStringField("VALUE"); }; Blockly.Blocks.sound_something_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5965,10 +5783,10 @@ Blockly.Blocks.sound_something_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_with_block = function(a, b) { - var c = b.getStringValue("VALUE", b); - (a = a.parent.getSound(c)) && createjs.Sound.play(a.id); - return b.callReturn(); +Entry.block.sound_something_with_block = function(b, a) { + var d = a.getStringValue("VALUE", a); + (d = b.parent.getSound(d)) && createjs.Sound.play(d.id); + return a.callReturn(); }; Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5981,10 +5799,10 @@ Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_with_block = function(a, b) { - var c = b.getStringValue("VALUE", b), d = b.getNumberValue("SECOND", b); - (a = a.parent.getSound(c)) && createjs.Sound.play(a.id, {startTime:0, duration:1E3 * d}); - return b.callReturn(); +Entry.block.sound_something_second_with_block = function(b, a) { + var d = a.getStringValue("VALUE", a), c = a.getNumberValue("SECOND", a); + (d = b.parent.getSound(d)) && createjs.Sound.play(d.id, {startTime:0, duration:1E3 * c}); + return a.callReturn(); }; Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5995,24 +5813,24 @@ Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait_with_block = function(a, b) { - if (b.isPlay) { - if (1 == b.playState) { - return b; +Entry.block.sound_something_wait_with_block = function(b, a) { + if (a.isPlay) { + if (1 == a.playState) { + return a; } - delete b.playState; - delete b.isPlay; - return b.callReturn(); + delete a.playState; + delete a.isPlay; + return a.callReturn(); } - b.isPlay = !0; - b.playState = 1; - var c = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(c)) { - createjs.Sound.play(a.id), setTimeout(function() { - b.playState = 0; - }, 1E3 * a.duration); + a.isPlay = !0; + a.playState = 1; + var d = a.getStringValue("VALUE", a); + if (d = b.parent.getSound(d)) { + createjs.Sound.play(d.id), setTimeout(function() { + a.playState = 0; + }, 1E3 * d.duration); } - return b; + return a; }; Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -6025,29 +5843,28 @@ Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait_with_block = function(a, b) { - if (b.isPlay) { - if (1 == b.playState) { - return b; +Entry.block.sound_something_second_wait_with_block = function(b, a) { + if (a.isPlay) { + if (1 == a.playState) { + return a; } - delete b.isPlay; - delete b.playState; - return b.callReturn(); + delete a.isPlay; + delete a.playState; + return a.callReturn(); } - b.isPlay = !0; - b.playState = 1; - var c = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(c)) { - var d = createjs.Sound.play(a.id); - a = b.getNumberValue("SECOND", b); + a.isPlay = !0; + a.playState = 1; + var d = a.getStringValue("VALUE", a); + if (d = b.parent.getSound(d)) { + var c = createjs.Sound.play(d.id), d = a.getNumberValue("SECOND", a); setTimeout(function() { - d.stop(); - b.playState = 0; - }, 1E3 * a); - d.addEventListener("complete", function(b) { + c.stop(); + a.playState = 0; + }, 1E3 * d); + c.addEventListener("complete", function(a) { }); } - return b; + return a; }; Blockly.Blocks.sound_from_to = {init:function() { this.setColour("#A4D01D"); @@ -6062,13 +5879,13 @@ Blockly.Blocks.sound_from_to = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to = function(a, b) { - var c = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(c)) { - var c = 1E3 * b.getNumberValue("START", b), d = 1E3 * b.getNumberValue("END", b); - createjs.Sound.play(a.id, {startTime:Math.min(c, d), duration:Math.max(c, d) - Math.min(c, d)}); +Entry.block.sound_from_to = function(b, a) { + var d = a.getStringValue("VALUE", a); + if (d = b.parent.getSound(d)) { + var c = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a); + createjs.Sound.play(d.id, {startTime:Math.min(c, e), duration:Math.max(c, e) - Math.min(c, e)}); } - return b.callReturn(); + return a.callReturn(); }; Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setColour("#A4D01D"); @@ -6083,26 +5900,26 @@ Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to_and_wait = function(a, b) { - if (b.isPlay) { - if (1 == b.playState) { - return b; +Entry.block.sound_from_to_and_wait = function(b, a) { + if (a.isPlay) { + if (1 == a.playState) { + return a; } - delete b.isPlay; - delete b.playState; - return b.callReturn(); + delete a.isPlay; + delete a.playState; + return a.callReturn(); } - b.isPlay = !0; - b.playState = 1; - var c = b.getStringValue("VALUE", b); - if (a = a.parent.getSound(c)) { - var d = 1E3 * b.getNumberValue("START", b), e = 1E3 * b.getNumberValue("END", b), c = Math.min(d, e), d = Math.max(d, e) - c; - createjs.Sound.play(a.id, {startTime:c, duration:d}); + a.isPlay = !0; + a.playState = 1; + var d = a.getStringValue("VALUE", a); + if (d = b.parent.getSound(d)) { + var c = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a), f = Math.min(c, e), c = Math.max(c, e) - f; + createjs.Sound.play(d.id, {startTime:f, duration:c}); setTimeout(function() { - b.playState = 0; - }, d); + a.playState = 0; + }, c); } - return b; + return a; }; Blockly.Blocks.when_run_button_click = {init:function() { this.setColour("#3BBD70"); @@ -6110,8 +5927,8 @@ Blockly.Blocks.when_run_button_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_run_button_click = function(a, b) { - return b.callReturn(); +Entry.block.when_run_button_click = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.press_some_key = {init:function() { this.setColour("#3BBD70"); @@ -6120,8 +5937,8 @@ Blockly.Blocks.press_some_key = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.press_some_key = function(a, b) { - return b.callReturn(); +Entry.block.press_some_key = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.when_some_key_pressed = {init:function() { this.setColour("#3BBD70"); @@ -6129,8 +5946,8 @@ Blockly.Blocks.when_some_key_pressed = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_pressed = function(a, b) { - return b.callReturn(); +Entry.block.when_some_key_pressed = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.mouse_clicked = {init:function() { this.setColour("#3BBD70"); @@ -6138,8 +5955,8 @@ Blockly.Blocks.mouse_clicked = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_clicked = function(a, b) { - return b.callReturn(); +Entry.block.mouse_clicked = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.mouse_click_cancled = {init:function() { this.setColour("#3BBD70"); @@ -6147,8 +5964,8 @@ Blockly.Blocks.mouse_click_cancled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_click_cancled = function(a, b) { - return b.callReturn(); +Entry.block.mouse_click_cancled = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.when_object_click = {init:function() { this.setColour("#3BBD70"); @@ -6156,8 +5973,8 @@ Blockly.Blocks.when_object_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click = function(a, b) { - return b.callReturn(); +Entry.block.when_object_click = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.when_object_click_canceled = {init:function() { this.setColour("#3BBD70"); @@ -6165,8 +5982,8 @@ Blockly.Blocks.when_object_click_canceled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click_canceled = function(a, b) { - return b.callReturn(); +Entry.block.when_object_click_canceled = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.when_some_key_click = {init:function() { this.setColour("#3BBD70"); @@ -6174,23 +5991,23 @@ Blockly.Blocks.when_some_key_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_click = function(a, b) { - return b.callReturn(); +Entry.block.when_some_key_click = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.when_message_cast = {init:function() { this.setColour("#3BBD70"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/start_icon_signal.png", "*", "start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"), "VALUE").appendField(Lang.Blocks.START_when_message_cast_2); this.setInputsInline(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_messageRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_messageRefs", a); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_messageRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_messageRefs", b); }}; -Entry.block.when_message_cast = function(a, b) { - return b.callReturn(); +Entry.block.when_message_cast = function(b, a) { + return a.callReturn(); }; Blockly.Blocks.message_cast = {init:function() { this.setColour("#3BBD70"); @@ -6199,21 +6016,20 @@ Blockly.Blocks.message_cast = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_messageRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_messageRefs", a); -}}; -Entry.block.message_cast = function(a, b) { - a = b.getField("VALUE", b); - var c = Entry.isExist(a, "id", Entry.variableContainer.messages_); - if ("null" == a || !c) { +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_messageRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_messageRefs", b); +}}; +Entry.block.message_cast = function(b, a) { + var d = a.getField("VALUE", a), c = Entry.isExist(d, "id", Entry.variableContainer.messages_); + if ("null" == d || !c) { throw Error("value can not be null or undefined"); } - Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); - return b.callReturn(); + Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", d]); + return a.callReturn(); }; Blockly.Blocks.message_cast_wait = {init:function() { this.setColour("#3BBD70"); @@ -6221,33 +6037,32 @@ Blockly.Blocks.message_cast_wait = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_messageRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_messageRefs", a); -}}; -Entry.block.message_cast_wait = function(a, b) { - if (b.runningScript) { - a = b.runningScript; - for (var c = a.length, d = 0;d < c;d++) { - var e = a.shift(); - e && !e.isEnd() && a.push(e); - } - return a.length ? b : b.callReturn(); - } - a = b.getField("VALUE", b); - e = Entry.isExist(a, "id", Entry.variableContainer.messages_); - if ("null" == a || !e) { +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_messageRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_messageRefs", b); +}}; +Entry.block.message_cast_wait = function(b, a) { + if (a.runningScript) { + for (var d = a.runningScript, c = d.length, e = 0;e < c;e++) { + var f = d.shift(); + f && !f.isEnd() && d.push(f); + } + return d.length ? a : a.callReturn(); + } + d = a.getField("VALUE", a); + f = Entry.isExist(d, "id", Entry.variableContainer.messages_); + if ("null" == d || !f) { throw Error("value can not be null or undefined"); } - c = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); - for (a = [];c.length;) { - (e = c.shift()) && (a = a.concat(e)); + c = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", d]); + for (d = [];c.length;) { + (f = c.shift()) && (d = d.concat(f)); } - b.runningScript = a; - return b; + a.runningScript = d; + return a; }; var colour = "#FFCA36"; Blockly.Blocks.text = {init:function() { @@ -6256,8 +6071,8 @@ Blockly.Blocks.text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.text = function(a, b) { - return b.getField("NAME", b); +Entry.block.text = function(b, a) { + return a.getField("NAME", a); }; Blockly.Blocks.text_write = {init:function() { this.setColour(colour); @@ -6268,10 +6083,10 @@ Blockly.Blocks.text_write = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_write = function(a, b) { - var c = b.getStringValue("VALUE", b), c = Entry.convertToRoundedDecimals(c, 3); - a.setText(c); - return b.callReturn(); +Entry.block.text_write = function(b, a) { + var d = a.getStringValue("VALUE", a), d = Entry.convertToRoundedDecimals(d, 3); + b.setText(d); + return a.callReturn(); }; Blockly.Blocks.text_append = {init:function() { this.setColour(colour); @@ -6282,10 +6097,10 @@ Blockly.Blocks.text_append = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_append = function(a, b) { - var c = b.getStringValue("VALUE", b); - a.setText(Entry.convertToRoundedDecimals(a.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); - return b.callReturn(); +Entry.block.text_append = function(b, a) { + var d = a.getStringValue("VALUE", a); + b.setText(Entry.convertToRoundedDecimals(b.getText(), 3) + Entry.convertToRoundedDecimals(d, 3)); + return a.callReturn(); }; Blockly.Blocks.text_prepend = {init:function() { this.setColour(colour); @@ -6296,10 +6111,10 @@ Blockly.Blocks.text_prepend = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_prepend = function(a, b) { - var c = b.getStringValue("VALUE", b); - a.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(a.getText(), 3)); - return b.callReturn(); +Entry.block.text_prepend = function(b, a) { + var d = a.getStringValue("VALUE", a); + b.setText(Entry.convertToRoundedDecimals(d, 3) + Entry.convertToRoundedDecimals(b.getText(), 3)); + return a.callReturn(); }; Blockly.Blocks.text_flush = {init:function() { this.setColour(colour); @@ -6308,9 +6123,9 @@ Blockly.Blocks.text_flush = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_flush = function(a, b) { - a.setText(""); - return b.callReturn(); +Entry.block.text_flush = function(b, a) { + b.setText(""); + return a.callReturn(); }; Entry.block.variableAddButton = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\ubcc0\uc218 \ucd94\uac00", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -6330,22 +6145,22 @@ Blockly.Blocks.change_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); -}}; -Entry.block.change_variable = function(a, b) { - var c = b.getField("VARIABLE", b), d = b.getNumberValue("VALUE", b), d = Entry.parseNumber(d); - if (0 == d && "boolean" == typeof d) { +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); +}}; +Entry.block.change_variable = function(b, a) { + var d = a.getField("VARIABLE", a), c = a.getNumberValue("VALUE", a), e = 0, c = Entry.parseNumber(c); + if (0 == c && "boolean" == typeof c) { throw Error("Type is not correct"); } - c = Entry.variableContainer.getVariable(c, a); - a = Entry.getMaxFloatPoint([d, c.getValue()]); - c.setValue((d + c.getValue()).toFixed(a)); - return b.callReturn(); + d = Entry.variableContainer.getVariable(d, b); + e = Entry.getMaxFloatPoint([c, d.getValue()]); + d.setValue((c + d.getValue()).toFixed(e)); + return a.callReturn(); }; Blockly.Blocks.set_variable = {init:function() { this.setColour("#E457DC"); @@ -6357,17 +6172,17 @@ Blockly.Blocks.set_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); -}}; -Entry.block.set_variable = function(a, b) { - var c = b.getField("VARIABLE", b), d = b.getValue("VALUE", b); - Entry.variableContainer.getVariable(c, a).setValue(d); - return b.callReturn(); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); +}}; +Entry.block.set_variable = function(b, a) { + var d = a.getField("VARIABLE", a), c = a.getValue("VALUE", a); + Entry.variableContainer.getVariable(d, b).setValue(c); + return a.callReturn(); }; Blockly.Blocks.show_variable = {init:function() { this.setColour("#E457DC"); @@ -6376,19 +6191,18 @@ Blockly.Blocks.show_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); -}}; -Entry.block.show_variable = function(a, b) { - var c = b.getField("VARIABLE", b); - a = Entry.variableContainer.getVariable(c, a); - a.setVisible(!0); - a.updateView(); - return b.callReturn(); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); +}}; +Entry.block.show_variable = function(b, a) { + var d = a.getField("VARIABLE", a), d = Entry.variableContainer.getVariable(d, b); + d.setVisible(!0); + d.updateView(); + return a.callReturn(); }; Blockly.Blocks.hide_variable = {init:function() { this.setColour("#E457DC"); @@ -6397,17 +6211,17 @@ Blockly.Blocks.hide_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); -}}; -Entry.block.hide_variable = function(a, b) { - var c = b.getField("VARIABLE", b); - Entry.variableContainer.getVariable(c, a).setVisible(!1); - return b.callReturn(); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); +}}; +Entry.block.hide_variable = function(b, a) { + var d = a.getField("VARIABLE", a); + Entry.variableContainer.getVariable(d, b).setVisible(!1); + return a.callReturn(); }; Blockly.Blocks.get_y = {init:function() { this.setColour(230); @@ -6420,16 +6234,16 @@ Blockly.Blocks.get_variable = {init:function() { this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("variables"), "VARIABLE").appendField(Lang.Blocks.VARIABLE_get_variable_2); this.setOutput(!0, "Number"); this.setInputsInline(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); }}; -Entry.block.get_variable = function(a, b) { - b = b.getField("VARIABLE", b); - return Entry.variableContainer.getVariable(b, a).getValue(); +Entry.block.get_variable = function(b, a) { + var d = a.getField("VARIABLE", a); + return Entry.variableContainer.getVariable(d, b).getValue(); }; Blockly.Blocks.ask_and_wait = {init:function() { this.setColour("#E457DC"); @@ -6441,30 +6255,30 @@ Blockly.Blocks.ask_and_wait = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(a) { - Entry.container && Entry.container.hideProjectAnswer(a); +}, whenRemove:function(b) { + Entry.container && Entry.container.hideProjectAnswer(b); }}; -Entry.block.ask_and_wait = function(a, b) { - var c = Entry.container.inputValue, d = Entry.stage.inputField, e = b.getValue("VALUE", b); +Entry.block.ask_and_wait = function(b, a) { + var d = Entry.container.inputValue, c = Entry.stage.inputField, e = a.getValue("VALUE", a); if (!e) { throw Error("message can not be empty"); } - if (c.sprite == a && d && !d._isHidden) { - return b; + if (d.sprite == b && c && !c._isHidden) { + return a; } - if (c.sprite != a && b.isInit) { - return a.dialog && a.dialog.remove(), delete b.isInit, b.callReturn(); + if (d.sprite != b && a.isInit) { + return b.dialog && b.dialog.remove(), delete a.isInit, a.callReturn(); } - if (c.complete && c.sprite == a && d._isHidden && b.isInit) { - return a.dialog && a.dialog.remove(), delete c.complete, delete b.isInit, b.callReturn(); + if (d.complete && d.sprite == b && c._isHidden && a.isInit) { + return b.dialog && b.dialog.remove(), delete d.complete, delete a.isInit, a.callReturn(); } e = Entry.convertToRoundedDecimals(e, 3); - new Entry.Dialog(a, e, "speak"); + new Entry.Dialog(b, e, "speak"); Entry.stage.showInputField(); - c.script = b; - c.sprite = a; - b.isInit = !0; - return b; + d.script = a; + d.sprite = b; + a.isInit = !0; + return a; }; Blockly.Blocks.get_canvas_input_value = {init:function() { this.setColour("#E457DC"); @@ -6474,10 +6288,10 @@ Blockly.Blocks.get_canvas_input_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(a) { - Entry.container && Entry.container.hideProjectAnswer(a); +}, whenRemove:function(b) { + Entry.container && Entry.container.hideProjectAnswer(b); }}; -Entry.block.get_canvas_input_value = function(a, b) { +Entry.block.get_canvas_input_value = function(b, a) { return Entry.container.getInputValue(); }; Blockly.Blocks.add_value_to_list = {init:function() { @@ -6490,20 +6304,19 @@ Blockly.Blocks.add_value_to_list = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(a) { - var b = Entry.variableContainer; - b && b.addRef("_variableRefs", a); -}, whenRemove:function(a) { - var b = Entry.variableContainer; - b && b.removeRef("_variableRefs", a); -}}; -Entry.block.add_value_to_list = function(a, b) { - var c = b.getField("LIST", b), d = b.getValue("VALUE", b); - a = Entry.variableContainer.getList(c, a); - a.array_ || (a.array_ = []); - a.array_.push({data:d}); - a.updateView(); - return b.callReturn(); +}, whenAdd:function(b) { + var a = Entry.variableContainer; + a && a.addRef("_variableRefs", b); +}, whenRemove:function(b) { + var a = Entry.variableContainer; + a && a.removeRef("_variableRefs", b); +}}; +Entry.block.add_value_to_list = function(b, a) { + var d = a.getField("LIST", a), c = a.getValue("VALUE", a), d = Entry.variableContainer.getList(d, b); + d.array_ || (d.array_ = []); + d.array_.push({data:c}); + d.updateView(); + return a.callReturn(); }; Blockly.Blocks.remove_value_from_list = {init:function() { this.setColour("#E457DC"); @@ -6516,15 +6329,14 @@ Blockly.Blocks.remove_value_from_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_value_from_list = function(a, b) { - var c = b.getField("LIST", b), d = b.getValue("VALUE", b); - a = Entry.variableContainer.getList(c, a); - if (!a.array_ || isNaN(d) || d > a.array_.length) { +Entry.block.remove_value_from_list = function(b, a) { + var d = a.getField("LIST", a), c = a.getValue("VALUE", a), d = Entry.variableContainer.getList(d, b); + if (!d.array_ || isNaN(c) || c > d.array_.length) { throw Error("can not remove value from array"); } - a.array_.splice(d - 1, 1); - a.updateView(); - return b.callReturn(); + d.array_.splice(c - 1, 1); + d.updateView(); + return a.callReturn(); }; Blockly.Blocks.insert_value_to_list = {init:function() { this.setColour("#E457DC"); @@ -6539,15 +6351,14 @@ Blockly.Blocks.insert_value_to_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.insert_value_to_list = function(a, b) { - var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(c, a); - if (!a.array_ || isNaN(e) || 0 == e || e > a.array_.length + 1) { +Entry.block.insert_value_to_list = function(b, a) { + var d = a.getField("LIST", a), c = a.getValue("DATA", a), e = a.getValue("INDEX", a), d = Entry.variableContainer.getList(d, b); + if (!d.array_ || isNaN(e) || 0 == e || e > d.array_.length + 1) { throw Error("can not insert value to array"); } - a.array_.splice(e - 1, 0, {data:d}); - a.updateView(); - return b.callReturn(); + d.array_.splice(e - 1, 0, {data:c}); + d.updateView(); + return a.callReturn(); }; Blockly.Blocks.change_value_list_index = {init:function() { this.setColour("#E457DC"); @@ -6562,15 +6373,14 @@ Blockly.Blocks.change_value_list_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_value_list_index = function(a, b) { - var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(c, a); - if (!a.array_ || isNaN(e) || e > a.array_.length) { +Entry.block.change_value_list_index = function(b, a) { + var d = a.getField("LIST", a), c = a.getValue("DATA", a), e = a.getValue("INDEX", a), d = Entry.variableContainer.getList(d, b); + if (!d.array_ || isNaN(e) || e > d.array_.length) { throw Error("can not insert value to array"); } - a.array_[e - 1].data = d; - a.updateView(); - return b.callReturn(); + d.array_[e - 1].data = c; + d.updateView(); + return a.callReturn(); }; Blockly.Blocks.value_of_index_from_list = {init:function() { this.setColour("#E457DC"); @@ -6582,15 +6392,12 @@ Blockly.Blocks.value_of_index_from_list = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.value_of_index_from_list = function(a, b) { - var c = b.getField("LIST", b); - b = b.getValue("INDEX", b); - a = Entry.variableContainer.getList(c, a); - b = Entry.getListRealIndex(b, a); - if (!a.array_ || isNaN(b) || b > a.array_.length) { +Entry.block.value_of_index_from_list = function(b, a) { + var d = a.getField("LIST", a), c = a.getValue("INDEX", a), d = Entry.variableContainer.getList(d, b), c = Entry.getListRealIndex(c, d); + if (!d.array_ || isNaN(c) || c > d.array_.length) { throw Error("can not insert value to array"); } - return a.array_[b - 1].data; + return d.array_[c - 1].data; }; Blockly.Blocks.length_of_list = {init:function() { this.setColour("#E457DC"); @@ -6600,9 +6407,9 @@ Blockly.Blocks.length_of_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_list = function(a, b) { - a = b.getField("LIST", b); - return Entry.variableContainer.getList(a).array_.length; +Entry.block.length_of_list = function(b, a) { + var d = a.getField("LIST", a); + return Entry.variableContainer.getList(d).array_.length; }; Blockly.Blocks.show_list = {init:function() { this.setColour("#E457DC"); @@ -6612,10 +6419,10 @@ Blockly.Blocks.show_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show_list = function(a, b) { - a = b.getField("LIST", b); - Entry.variableContainer.getList(a).setVisible(!0); - return b.callReturn(); +Entry.block.show_list = function(b, a) { + var d = a.getField("LIST", a); + Entry.variableContainer.getList(d).setVisible(!0); + return a.callReturn(); }; Blockly.Blocks.hide_list = {init:function() { this.setColour("#E457DC"); @@ -6625,10 +6432,10 @@ Blockly.Blocks.hide_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide_list = function(a, b) { - a = b.getField("LIST", b); - Entry.variableContainer.getList(a).setVisible(!1); - return b.callReturn(); +Entry.block.hide_list = function(b, a) { + var d = a.getField("LIST", a); + Entry.variableContainer.getList(d).setVisible(!1); + return a.callReturn(); }; Blockly.Blocks.options_for_list = {init:function() { this.setColour("#E457DC"); @@ -6638,8 +6445,8 @@ Blockly.Blocks.options_for_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.options_for_list = function(a, b) { - return b.getField("OPERATOR", b); +Entry.block.options_for_list = function(b, a) { + return a.getField("OPERATOR", a); }; Blockly.Blocks.set_visible_answer = {init:function() { this.setColour("#E457DC"); @@ -6651,12 +6458,12 @@ Blockly.Blocks.set_visible_answer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(a) { - Entry.container && Entry.container.hideProjectAnswer(a); +}, whenRemove:function(b) { + Entry.container && Entry.container.hideProjectAnswer(b); }}; -Entry.block.set_visible_answer = function(a, b) { - "HIDE" == b.getField("BOOL", b) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); - return b.callReturn(); +Entry.block.set_visible_answer = function(b, a) { + "HIDE" == a.getField("BOOL", a) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); + return a.callReturn(); }; Blockly.Blocks.is_included_in_list = {init:function() { this.setColour("#E457DC"); @@ -6668,37 +6475,34 @@ Blockly.Blocks.is_included_in_list = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_included_in_list = function(a, b) { - a = b.getField("LIST", b); - b = b.getStringValue("DATA", b); - a = Entry.variableContainer.getList(a); - if (!a) { +Entry.block.is_included_in_list = function(b, a) { + var d = a.getField("LIST", a), c = a.getStringValue("DATA", a), d = Entry.variableContainer.getList(d); + if (!d) { return !1; } - a = a.array_; - for (var c = 0, d = a.length;c < d;c++) { - if (a[c].data.toString() == b.toString()) { + for (var d = d.array_, e = 0, f = d.length;e < f;e++) { + if (d[e].data.toString() == c.toString()) { return !0; } } return !1; }; Entry.Xbot = {PORT_MAP:{rightWheel:0, leftWheel:0, head:90, armR:90, armL:90, analogD5:127, analogD6:127, D4:0, D7:0, D12:0, D13:0, ledR:0, ledG:0, ledB:0, lcdNum:0, lcdTxt:" ", note:262, duration:0}, setZero:function() { - var a = Entry.Xbot.PORT_MAP, b = Entry.hw.sendQueue, c; - for (c in a) { - b[c] = a[c]; + var b = Entry.Xbot.PORT_MAP, a = Entry.hw.sendQueue, d; + for (d in b) { + a[d] = b[d]; } Entry.hw.update(); Entry.Xbot.removeAllTimeouts(); -}, timeouts:[], removeTimeout:function(a) { - clearTimeout(a); - var b = this.timeouts; - a = b.indexOf(a); - 0 <= a && b.splice(a, 1); +}, timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); }, removeAllTimeouts:function() { - var a = this.timeouts, b; - for (b in a) { - clearTimeout(a[b]); + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); } this.timeouts = []; }, name:"xbot_epor_edge"}; @@ -6708,10 +6512,9 @@ Blockly.Blocks.xbot_digitalInput = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.xbot_digitalInput = function(a, b) { - a = Entry.hw.portData; - b = b.getField("DEVICE"); - return a[b]; +Entry.block.xbot_digitalInput = function(b, a) { + var d = Entry.hw.portData, c = a.getField("DEVICE"); + return d[c]; }; Blockly.Blocks.xbot_analogValue = {init:function() { this.setColour("#00979D"); @@ -6719,10 +6522,9 @@ Blockly.Blocks.xbot_analogValue = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.xbot_analogValue = function(a, b) { - a = Entry.hw.portData; - b = b.getField("DEVICE"); - return a[b]; +Entry.block.xbot_analogValue = function(b, a) { + var d = Entry.hw.portData, c = a.getField("DEVICE"); + return d[c]; }; Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setColour("#00979D"); @@ -6732,14 +6534,13 @@ Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_digitalOutput = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getStringField("DEVICE", b), d = b.getStringField("VALUE", b); - a.D13 = "D13" == c && "HIGH" == d ? 1 : 0; - a.D4 = "D4" == c && "HIGH" == d ? 1 : 0; - a.D7 = "D7" == c && "HIGH" == d ? 1 : 0; - a.D12 = "D12" == c && "HIGH" == d ? 1 : 0; - return b.callReturn(); +Entry.block.xbot_digitalOutput = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getStringField("DEVICE", a), e = a.getStringField("VALUE", a); + d.D13 = "D13" == c && "HIGH" == e ? 1 : 0; + d.D4 = "D4" == c && "HIGH" == e ? 1 : 0; + d.D7 = "D7" == c && "HIGH" == e ? 1 : 0; + d.D12 = "D12" == c && "HIGH" == e ? 1 : 0; + return a.callReturn(); }; Blockly.Blocks.xbot_analogOutput = {init:function() { this.setColour("#00979D"); @@ -6750,11 +6551,10 @@ Blockly.Blocks.xbot_analogOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_analogOutput = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); - "analogD5" == c ? a.analogD5 = d : "analogD6" == c && (a.analogD6 = d); - return b.callReturn(); +Entry.block.xbot_analogOutput = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); + "analogD5" == c ? d.analogD5 = e : "analogD6" == c && (d.analogD6 = e); + return a.callReturn(); }; Blockly.Blocks.xbot_servo = {init:function() { this.setColour("#00979D"); @@ -6765,11 +6565,10 @@ Blockly.Blocks.xbot_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_servo = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); - "head" == c ? a.head = d : "right" == c ? a.armR = d : "left" == c && (a.armL = d); - return b.callReturn(); +Entry.block.xbot_servo = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); + "head" == c ? d.head = e : "right" == c ? d.armR = e : "left" == c && (d.armL = e); + return a.callReturn(); }; Blockly.Blocks.xbot_oneWheel = {init:function() { this.setColour("#00979D"); @@ -6780,11 +6579,10 @@ Blockly.Blocks.xbot_oneWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_oneWheel = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); - "rightWheel" == c ? a.rightWheel = d : "leftWheel" == c ? a.leftWheel = d : a.rightWheel = a.leftWheel = d; - return b.callReturn(); +Entry.block.xbot_oneWheel = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); + "rightWheel" == c ? d.rightWheel = e : "leftWheel" == c ? d.leftWheel = e : d.rightWheel = d.leftWheel = e; + return a.callReturn(); }; Blockly.Blocks.xbot_twoWheel = {init:function() { this.setColour("#00979D"); @@ -6797,11 +6595,11 @@ Blockly.Blocks.xbot_twoWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_twoWheel = function(a, b) { - a = Entry.hw.sendQueue; - a.rightWheel = b.getNumberValue("rightWheel"); - a.leftWheel = b.getNumberValue("leftWheel"); - return b.callReturn(); +Entry.block.xbot_twoWheel = function(b, a) { + var d = Entry.hw.sendQueue; + d.rightWheel = a.getNumberValue("rightWheel"); + d.leftWheel = a.getNumberValue("leftWheel"); + return a.callReturn(); }; Blockly.Blocks.xbot_rgb = {init:function() { this.setColour("#00979D"); @@ -6816,12 +6614,12 @@ Blockly.Blocks.xbot_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb = function(a, b) { - a = Entry.hw.sendQueue; - a.ledR = b.getNumberValue("ledR"); - a.ledG = b.getNumberValue("ledG"); - a.ledB = b.getNumberValue("ledB"); - return b.callReturn(); +Entry.block.xbot_rgb = function(b, a) { + var d = Entry.hw.sendQueue; + d.ledR = a.getNumberValue("ledR"); + d.ledG = a.getNumberValue("ledG"); + d.ledB = a.getNumberValue("ledB"); + return a.callReturn(); }; Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setColour("#00979D"); @@ -6830,13 +6628,12 @@ Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb_picker = function(a, b) { - a = b.getStringField("VALUE"); - var c = Entry.hw.sendQueue; - c.ledR = parseInt(.3 * parseInt(a.substr(1, 2), 16)); - c.ledG = parseInt(.3 * parseInt(a.substr(3, 2), 16)); - c.ledB = parseInt(.3 * parseInt(a.substr(5, 2), 16)); - return b.callReturn(); +Entry.block.xbot_rgb_picker = function(b, a) { + var d = a.getStringField("VALUE"), c = Entry.hw.sendQueue; + c.ledR = parseInt(.3 * parseInt(d.substr(1, 2), 16)); + c.ledG = parseInt(.3 * parseInt(d.substr(3, 2), 16)); + c.ledB = parseInt(.3 * parseInt(d.substr(5, 2), 16)); + return a.callReturn(); }; Blockly.Blocks.xbot_buzzer = {init:function() { this.setColour("#00979D"); @@ -6847,13 +6644,12 @@ Blockly.Blocks.xbot_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_buzzer = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getStringField("NOTE", b), d = b.getStringField("OCTAVE", b), e = b.getNumberValue("VALUE", b), c = c + d; - a.note = "C2" == c ? 65 : "D2" == c ? 73 : "E2" == c ? 82 : "F2" == c ? 87 : "G2" == c ? 98 : "A2" == c ? 110 : "B2" == c ? 123 : "C3" == c ? 131 : "D3" == c ? 147 : "E3" == c ? 165 : "F3" == c ? 175 : "G3" == c ? 196 : "A3" == c ? 220 : "B3" == c ? 247 : "C4" == c ? 262 : "D4" == c ? 294 : "E4" == c ? 330 : "F4" == c ? 349 : "G4" == c ? 392 : "A4" == c ? 440 : "B4" == c ? 494 : "C5" == c ? 523 : "D5" == c ? 587 : "E5" == c ? 659 : "F5" == c ? 698 : "G5" == c ? 784 : "A5" == c ? 880 : "B5" == c ? +Entry.block.xbot_buzzer = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getStringField("NOTE", a), e = a.getStringField("OCTAVE", a), f = a.getNumberValue("VALUE", a), c = c + e; + d.note = "C2" == c ? 65 : "D2" == c ? 73 : "E2" == c ? 82 : "F2" == c ? 87 : "G2" == c ? 98 : "A2" == c ? 110 : "B2" == c ? 123 : "C3" == c ? 131 : "D3" == c ? 147 : "E3" == c ? 165 : "F3" == c ? 175 : "G3" == c ? 196 : "A3" == c ? 220 : "B3" == c ? 247 : "C4" == c ? 262 : "D4" == c ? 294 : "E4" == c ? 330 : "F4" == c ? 349 : "G4" == c ? 392 : "A4" == c ? 440 : "B4" == c ? 494 : "C5" == c ? 523 : "D5" == c ? 587 : "E5" == c ? 659 : "F5" == c ? 698 : "G5" == c ? 784 : "A5" == c ? 880 : "B5" == c ? 988 : "C6" == c ? 1047 : "D6" == c ? 1175 : "E6" == c ? 1319 : "F6" == c ? 1397 : "G6" == c ? 1568 : "A6" == c ? 1760 : "B6" == c ? 1976 : "C7" == c ? 2093 : "D7" == c ? 2349 : "E7" == c ? 2637 : "F7" == c ? 2794 : "G7" == c ? 3136 : "A7" == c ? 3520 : "B7" == c ? 3951 : 262; - a.duration = 40 * e; - return b.callReturn(); + d.duration = 40 * f; + return a.callReturn(); }; Blockly.Blocks.xbot_lcd = {init:function() { this.setColour("#00979D"); @@ -6864,5617 +6660,3709 @@ Blockly.Blocks.xbot_lcd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_lcd = function(a, b) { - a = Entry.hw.sendQueue; - var c = b.getNumberField("LINE", b), d = b.getStringValue("VALUE", b); - 0 == c ? (a.lcdNum = 0, a.lcdTxt = d) : 1 == c && (a.lcdNum = 1, a.lcdTxt = d); - return b.callReturn(); +Entry.block.xbot_lcd = function(b, a) { + var d = Entry.hw.sendQueue, c = a.getNumberField("LINE", a), e = a.getStringValue("VALUE", a); + 0 == c ? (d.lcdNum = 0, d.lcdTxt = e) : 1 == c && (d.lcdNum = 1, d.lcdTxt = e); + return a.callReturn(); }; -Entry.Collection = function(a) { +Entry.Collection = function(b) { this.length = 0; this._hashMap = {}; this._observers = []; - this.set(a); + this.set(b); }; -(function(a, b) { - a.set = function(a) { +(function(b, a) { + b.set = function(b) { for (;this.length;) { - b.pop.call(this); + a.pop.call(this); } var c = this._hashMap, e; for (e in c) { delete c[e]; } - if (void 0 !== a) { + if (void 0 !== b) { e = 0; - for (var f = a.length;e < f;e++) { - var g = a[e]; + for (var f = b.length;e < f;e++) { + var g = b[e]; c[g.id] = g; - b.push.call(this, g); + a.push.call(this, g); } } }; - a.push = function(a) { - this._hashMap[a.id] = a; - b.push.call(this, a); + b.push = function(b) { + this._hashMap[b.id] = b; + a.push.call(this, b); }; - a.unshift = function() { - for (var a = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = a.length - 1;0 <= e;e--) { - var f = a[e]; - b.unshift.call(this, f); - d[f.id] = f; + b.unshift = function() { + for (var b = Array.prototype.slice.call(arguments, 0), c = this._hashMap, e = b.length - 1;0 <= e;e--) { + var f = b[e]; + a.unshift.call(this, f); + c[f.id] = f; } }; - a.insert = function(a, d) { - b.splice.call(this, d, 0, a); - this._hashMap[a.id] = a; + b.insert = function(b, c) { + a.splice.call(this, c, 0, b); + this._hashMap[b.id] = b; }; - a.has = function(b) { - return !!this._hashMap[b]; + b.has = function(a) { + return !!this._hashMap[a]; }; - a.get = function(b) { - return this._hashMap[b]; + b.get = function(a) { + return this._hashMap[a]; }; - a.at = function(b) { - return this[b]; + b.at = function(a) { + return this[a]; }; - a.getAll = function() { - for (var b = this.length, a = [], e = 0;e < b;e++) { - a.push(this[e]); + b.getAll = function() { + for (var a = this.length, b = [], e = 0;e < a;e++) { + b.push(this[e]); } - return a; + return b; }; - a.indexOf = function(a) { - return b.indexOf.call(this, a); + b.indexOf = function(b) { + return a.indexOf.call(this, b); }; - a.find = function(b) { - for (var a = [], c, f = 0, g = this.length;f < g;f++) { - c = !0; + b.find = function(a) { + for (var b = [], e, f = 0, g = this.length;f < g;f++) { + e = !0; var h = this[f], k; - for (k in b) { - if (b[k] != h[k]) { - c = !1; + for (k in a) { + if (a[k] != h[k]) { + e = !1; break; } } - c && a.push(h); + e && b.push(h); } - return a; + return b; }; - a.pop = function() { - var a = b.pop.call(this); - delete this._hashMap[a.id]; - return a; + b.pop = function() { + var b = a.pop.call(this); + delete this._hashMap[b.id]; + return b; }; - a.shift = function() { - var a = b.shift.call(this); - delete this._hashMap[a.id]; - return a; + b.shift = function() { + var b = a.shift.call(this); + delete this._hashMap[b.id]; + return b; }; - a.slice = function(a, d) { - a = b.slice.call(this, a, d); - d = this._hashMap; - for (var c in a) { - delete d[a[c].id]; + b.slice = function(b, c) { + var e = a.slice.call(this, b, c), f = this._hashMap, g; + for (g in e) { + delete f[e[g].id]; } - return a; + return e; }; - a.remove = function(b) { - var a = this.indexOf(b); - -1 < a && (delete this._hashMap[b.id], this.splice(a, 1)); + b.remove = function(a) { + var b = this.indexOf(a); + -1 < b && (delete this._hashMap[a.id], this.splice(b, 1)); }; - a.splice = function(a, d) { - var c = b.slice.call(arguments, 2), f = this._hashMap; - d = void 0 === d ? this.length - a : d; - for (var g = b.splice.call(this, a, d), h = 0, k = g.length;h < k;h++) { + b.splice = function(b, c) { + var e = a.slice.call(arguments, 2), f = this._hashMap; + c = void 0 === c ? this.length - b : c; + for (var g = a.splice.call(this, b, c), h = 0, k = g.length;h < k;h++) { delete f[g[h].id]; } h = 0; - for (k = c.length;h < k;h++) { - f = c[h], b.splice.call(this, a++, 0, f), this._hashMap[f.id] = f; + for (k = e.length;h < k;h++) { + f = e[h], a.splice.call(this, b++, 0, f), this._hashMap[f.id] = f; } return g; }; - a.clear = function() { + b.clear = function() { for (;this.length;) { - b.pop.call(this); + a.pop.call(this); } this._hashMap = {}; }; - a.map = function(b, a) { - for (var c = [], d = 0, g = this.length;d < g;d++) { - c.push(b(this[d], a)); + b.map = function(a, b) { + for (var e = [], f = 0, g = this.length;f < g;f++) { + e.push(a(this[f], b)); } - return c; + return e; }; - a.moveFromTo = function(a, d) { - var c = this.length - 1; - 0 > a || 0 > d || a > c || d > c || b.splice.call(this, d, 0, b.splice.call(this, a, 1)[0]); + b.moveFromTo = function(b, c) { + var e = this.length - 1; + 0 > b || 0 > c || b > e || c > e || a.splice.call(this, c, 0, a.splice.call(this, b, 1)[0]); }; - a.sort = function() { + b.sort = function() { }; - a.fromJSON = function() { + b.fromJSON = function() { }; - a.toJSON = function() { - for (var b = [], a = 0, e = this.length;a < e;a++) { - b.push(this[a].toJSON()); + b.toJSON = function() { + for (var a = [], b = 0, e = this.length;b < e;b++) { + a.push(this[b].toJSON()); } - return b; + return a; }; - a.observe = function() { + b.observe = function() { }; - a.unobserve = function() { + b.unobserve = function() { }; - a.notify = function() { + b.notify = function() { }; - a.destroy = function() { + b.destroy = function() { }; })(Entry.Collection.prototype, Array.prototype); -Entry.Event = function(a) { - this._sender = a; +Entry.Event = function(b) { + this._sender = b; this._listeners = []; }; -(function(a) { - a.attach = function(b, a) { - var c = this; - b = {obj:b, fn:a, destroy:function() { +(function(b) { + b.attach = function(a, b) { + var c = this, e = {obj:a, fn:b, destroy:function() { c.detach(this); }}; - this._listeners.push(b); - return b; + this._listeners.push(e); + return e; }; - a.detach = function(b) { - var a = this._listeners; - b = a.indexOf(b); - if (-1 < b) { - return a.splice(b, 1); + b.detach = function(a) { + var b = this._listeners; + a = b.indexOf(a); + if (-1 < a) { + return b.splice(a, 1); } }; - a.clear = function() { - for (var b = this._listeners;b.length;) { - b.pop(); + b.clear = function() { + for (var a = this._listeners;a.length;) { + a.pop(); } }; - a.notify = function() { - var b = arguments; - this._listeners.slice().forEach(function(a) { - a.fn.apply(a.obj, b); + b.notify = function() { + var a = arguments; + this._listeners.slice().forEach(function(b) { + b.fn.apply(b.obj, a); }); }; })(Entry.Event.prototype); -Entry.Utils = {}; -Entry.overridePrototype = function() { - Number.prototype.mod = function(a) { - return (this % a + a) % a; +Entry.Observer = function(b, a, d, c) { + this.parent = b; + this.object = a; + this.funcName = d; + this.attrs = c; + b.push(this); +}; +(function(b) { + b.destroy = function() { + var a = this.parent, b = a.indexOf(this); + -1 < b && a.splice(b, 1); + return this; }; +})(Entry.Observer.prototype); +Entry.Container = function() { + this.objects_ = []; + this.cachedPicture = {}; + this.inputValue = {}; + this.currentObjects_ = this.copiedObject = null; }; -Entry.Utils.generateId = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.Utils.intersectArray = function(a, b) { - for (var c = [], d = 0;d < a.length;d++) { - for (var e = 0;e < b.length;e++) { - if (a[d] == b[e]) { - c.push(a[d]); - break; - } +Entry.Container.prototype.generateView = function(b, a) { + var d = this; + this._view = b; + this._view.addClass("entryContainer"); + this._view.addClass("entryContainerWorkspace"); + this._view.setAttribute("id", "entryContainerWorkspaceId"); + var c = Entry.createElement("div"); + c.addClass("entryAddObjectWorkspace"); + c.innerHTML = Lang.Workspace.add_object; + c.bindOnClick(function(a) { + Entry.dispatchEvent("openSpriteManager"); + }); + var c = Entry.createElement("div"), e = "entryContainerListWorkspaceWrapper"; + Entry.isForLecture && (e += " lecture"); + c.addClass(e); + Entry.Utils.disableContextmenu(c); + $(c).bind("mousedown touchstart", function(a) { + function b(a) { + q && 5 < Math.sqrt(Math.pow(a.pageX - q.x, 2) + Math.pow(a.pageY - q.y, 2)) && e && (clearTimeout(e), e = null); } - } - return c; + function c(a) { + a.stopPropagation(); + l.unbind(".container"); + e && (clearTimeout(e), e = null); + } + var e = null, l = $(document), m = a.type, n = !1; + if (Entry.Utils.isRightButton(a)) { + d._rightClick(a), n = !0; + } else { + var q = {x:a.clientX, y:a.clientY}; + "touchstart" !== m || n || (a.stopPropagation(), a = Entry.Utils.convertMouseEvent(a), e = setTimeout(function() { + e && (e = null, d._rightClick(a)); + }, 1E3), l.bind("mousemove.container touchmove.container", b), l.bind("mouseup.container touchend.container", c)); + } + }); + this._view.appendChild(c); + e = Entry.createElement("ul"); + e.addClass("entryContainerListWorkspace"); + c.appendChild(e); + this.listView_ = e; + this.enableSort(); }; -Entry.Utils.isPointInMatrix = function(a, b, c) { - c = void 0 === c ? 0 : c; - var d = a.offsetX ? a.x + a.offsetX : a.x, e = a.offsetY ? a.y + a.offsety : a.y; - return d - c <= b.x && d + a.width + c >= b.x && e - c <= b.y && e + a.height + c >= b.y; +Entry.Container.prototype.enableSort = function() { + $ && $(this.listView_).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + var d = a.item.data("start_pos"), c = a.item.index(); + Entry.container.moveElement(d, c); + }, axis:"y", cancel:"input.selectedEditingObject"}); }; -Entry.Utils.colorDarken = function(a, b) { - function c(b) { - 2 != b.length && (b = "0" + b); - return b; - } - var d, e; - 7 === a.length ? (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); - b = void 0 === b ? .7 : b; - d = c(Math.floor(d * b).toString(16)); - e = c(Math.floor(e * b).toString(16)); - a = c(Math.floor(a * b).toString(16)); - return "#" + d + e + a; -}; -Entry.Utils.colorLighten = function(a, b) { - b = 0 === b ? 0 : b || 20; - a = Entry.Utils.hexToHsl(a); - a.l += b / 100; - a.l = Math.min(1, Math.max(0, a.l)); - return Entry.Utils.hslToHex(a); -}; -Entry.Utils.bound01 = function(a, b) { - var c = a; - "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (a = "100%"); - c = "string" === typeof a && -1 != a.indexOf("%"); - a = Math.min(b, Math.max(0, parseFloat(a))); - c && (a = parseInt(a * b, 10) / 100); - return 1E-6 > Math.abs(a - b) ? 1 : a % b / parseFloat(b); -}; -Entry.Utils.hexToHsl = function(a) { - var b, c; - 7 === a.length ? (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); - b = Entry.Utils.bound01(b, 255); - c = Entry.Utils.bound01(c, 255); - a = Entry.Utils.bound01(a, 255); - var d = Math.max(b, c, a), e = Math.min(b, c, a), f, g = (d + e) / 2; - if (d == e) { - f = e = 0; - } else { - var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); - switch(d) { - case b: - f = (c - a) / h + (c < a ? 6 : 0); - break; - case c: - f = (a - b) / h + 2; - break; - case a: - f = (b - c) / h + 4; +Entry.Container.prototype.disableSort = function() { + $ && $(this.listView_).sortable("destroy"); +}; +Entry.Container.prototype.updateListView = function() { + if (this.listView_) { + for (var b = this.listView_;b.hasChildNodes();) { + b.removeChild(b.lastChild); } - f /= 6; + var a = this.getCurrentObjects(), d; + for (d in a) { + b.appendChild(a[d].view_); + } + Entry.stage.sortZorder(); } - return {h:360 * f, s:e, l:g}; }; -Entry.Utils.hslToHex = function(a) { - function b(b, a, c) { - 0 > c && (c += 1); - 1 < c && --c; - return c < 1 / 6 ? b + 6 * (a - b) * c : .5 > c ? a : c < 2 / 3 ? b + (a - b) * (2 / 3 - c) * 6 : b; - } - function c(b) { - return 1 == b.length ? "0" + b : "" + b; - } - var d, e; - e = Entry.Utils.bound01(a.h, 360); - d = Entry.Utils.bound01(a.s, 1); - a = Entry.Utils.bound01(a.l, 1); - if (0 === d) { - d = a = e = a; - } else { - var f = .5 > a ? a * (1 + d) : a + d - a * d, g = 2 * a - f; - d = b(g, f, e + 1 / 3); - a = b(g, f, e); - e = b(g, f, e - 1 / 3); +Entry.Container.prototype.setObjects = function(b) { + for (var a in b) { + var d = new Entry.EntryObject(b[a]); + this.objects_.push(d); + d.generateView(); + d.pictures.map(function(a) { + Entry.playground.generatePictureElement(a); + }); + d.sounds.map(function(a) { + Entry.playground.generateSoundElement(a); + }); } - a *= 255; - e *= 255; - return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(a).toString(16)), c(Math.round(e).toString(16))].join(""); -}; -Entry.Utils.bindGlobalEvent = function(a) { - var b = $(document); - void 0 === a && (a = "resize mousedown mousemove keydown keyup dispose".split(" ")); - -1 < a.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(b) { - Entry.windowResized.notify(b); - })); - -1 < a.indexOf("mousedown") && (Entry.documentMousedown && (b.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), b.on("mousedown", function(b) { - Entry.documentMousedown.notify(b); - })); - -1 < a.indexOf("mousemove") && (Entry.documentMousemove && (b.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), b.on("touchmove mousemove", function(b) { - b.originalEvent && b.originalEvent.touches && (b = b.originalEvent.touches[0]); - Entry.documentMousemove.notify(b); - Entry.mouseCoordinate.x = b.clientX; - Entry.mouseCoordinate.y = b.clientY; - })); - -1 < a.indexOf("keydown") && (Entry.keyPressed && (b.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), b.on("keydown", function(b) { - var a = b.keyCode; - 0 > Entry.pressedKeys.indexOf(a) && Entry.pressedKeys.push(a); - Entry.keyPressed.notify(b); - })); - -1 < a.indexOf("keyup") && (Entry.keyUpped && (b.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), b.on("keyup", function(b) { - var a = Entry.pressedKeys.indexOf(b.keyCode); - -1 < a && Entry.pressedKeys.splice(a, 1); - Entry.keyUpped.notify(b); - })); - -1 < a.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(b) { - Entry.disposeEvent.notify(b); - })); -}; -Entry.Utils.makeActivityReporter = function() { - Entry.activityReporter = new Entry.ActivityReporter; - Entry.commander && Entry.commander.addReporter(Entry.activityReporter); - return Entry.activityReporter; -}; -Entry.Utils.initEntryEvent_ = function() { - Entry.events_ || (Entry.events_ = []); + this.updateObjectsOrder(); + this.updateListView(); + Entry.stage.sortZorder(); + Entry.variableContainer.updateViews(); + b = Entry.type; + ("workspace" == b || "phone" == b) && (b = this.getCurrentObjects()[0]) && this.selectObject(b.id); }; -Entry.sampleColours = []; -Entry.assert = function(a, b) { - if (!a) { - throw Error(b || "Assert failed"); +Entry.Container.prototype.getPictureElement = function(b, a) { + var d = this.getObject(a).getPicture(b); + if (d) { + return d.view; } + throw Error("No picture found"); }; -Entry.parseTexttoXML = function(a) { - var b; - window.ActiveXObject ? (b = new ActiveXObject("Microsoft.XMLDOM"), b.async = "false", b.loadXML(a)) : b = (new DOMParser).parseFromString(a, "text/xml"); - return b; -}; -Entry.createElement = function(a, b) { - a = a instanceof HTMLElement ? a : document.createElement(a); - b && (a.id = b); - a.hasClass = function(b) { - return this.className.match(new RegExp("(\\s|^)" + b + "(\\s|$)")); - }; - a.addClass = function(b) { - for (var a = 0;a < arguments.length;a++) { - b = arguments[a], this.hasClass(b) || (this.className += " " + b); - } - }; - a.removeClass = function(b) { - for (var a = 0;a < arguments.length;a++) { - b = arguments[a], this.hasClass(b) && (this.className = this.className.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); +Entry.Container.prototype.setPicture = function(b) { + var a = this.getObject(b.objectId), d; + for (d in a.pictures) { + if (b.id === a.pictures[d].id) { + var c = {}; + c.dimension = b.dimension; + c.id = b.id; + c.filename = b.filename; + c.fileurl = b.fileurl; + c.name = b.name; + c.view = a.pictures[d].view; + a.pictures[d] = c; + return; } - }; - a.bindOnClick = function(b) { - $(this).on("click tab", function(a) { - a.stopImmediatePropagation(); - b.call(this, a); - }); - }; - return a; + } + throw Error("No picture found"); }; -Entry.makeAutolink = function(a) { - return a ? a.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; +Entry.Container.prototype.selectPicture = function(b, a) { + var d = this.getObject(a), c = d.getPicture(b); + if (c) { + return d.selectedPicture = c, d.entity.setImage(c), d.updateThumbnailView(), d.id; + } + throw Error("No picture found"); }; -Entry.generateHash = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +Entry.Container.prototype.addObject = function(b, a) { + var d = new Entry.EntryObject(b); + d.name = Entry.getOrderedName(d.name, this.objects_); + Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, d); + d.scene || (d.scene = Entry.scene.selectedScene); + "number" == typeof a ? b.sprite.category && "background" == b.sprite.category.main ? (d.setLock(!0), this.objects_.push(d)) : this.objects_.splice(a, 0, d) : b.sprite.category && "background" == b.sprite.category.main ? this.objects_.push(d) : this.objects_.unshift(d); + d.generateView(); + d.pictures.map(function(a) { + Entry.playground.generatePictureElement(a); + }); + d.sounds.map(function(a) { + Entry.playground.generateSoundElement(a); + }); + this.setCurrentObjects(); + this.updateObjectsOrder(); + this.updateListView(); + this.selectObject(d.id); + Entry.variableContainer.updateViews(); + return new Entry.State(this, this.removeObject, d); +}; +Entry.Container.prototype.addCloneObject = function(b, a) { + var d = b.toJSON(), c = Entry.generateHash(); + Entry.variableContainer.addCloneLocalVariables({objectId:d.id, newObjectId:c, json:d}); + d.id = c; + d.scene = a || Entry.scene.selectedScene; + this.addObject(d); +}; +Entry.Container.prototype.removeObject = function(b) { + var a = this.objects_.indexOf(b), d = b.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, d, a); + d = new Entry.State(this.addObject, d, a); + b.destroy(); + this.objects_.splice(a, 1); + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); + Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg); + Entry.variableContainer.removeLocalVariables(b.id); + Entry.playground.reloadPlayground(); + return d; }; -Entry.addEventListener = function(a, b) { - this.events_ || (this.events_ = {}); - this.events_[a] || (this.events_[a] = []); - b instanceof Function && this.events_[a].push(b); - return !0; +Entry.Container.prototype.selectObject = function(b, a) { + var d = this.getObject(b); + a && d && Entry.scene.selectScene(d.scene); + this.mapObjectOnScene(function(a) { + a.view_ && a.view_.removeClass("selectedObject"); + a.isSelected_ = !1; + }); + d && (d.view_ && d.view_.addClass("selectedObject"), d.isSelected_ = !0); + Entry.playground && Entry.playground.injectObject(d); + "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(d); }; -Entry.dispatchEvent = function(a, b) { - this.events_ || (this.events_ = {}); - if (this.events_[a]) { - for (var c = 0, d = this.events_[a].length;c < d;c++) { - this.events_[a][c].call(window, b); - } - } +Entry.Container.prototype.getAllObjects = function() { + return this.objects_; }; -Entry.removeEventListener = function(a, b) { - if (this.events_[a]) { - for (var c = 0, d = this.events_[a].length;c < d;c++) { - if (this.events_[a][c] === b) { - this.events_[a].splice(c, 1); - break; - } +Entry.Container.prototype.getObject = function(b) { + !b && Entry.playground && Entry.playground.object && (b = Entry.playground.object.id); + for (var a = this.objects_.length, d = 0;d < a;d++) { + var c = this.objects_[d]; + if (c.id == b) { + return c; } } }; -Entry.removeAllEventListener = function(a) { - this.events_ && this.events_[a] && delete this.events_[a]; -}; -Entry.addTwoNumber = function(a, b) { - if (isNaN(a) || isNaN(b)) { - return a + b; +Entry.Container.prototype.getEntity = function(b) { + if (b = this.getObject(b)) { + return b.entity; } - a += ""; - b += ""; - var c = a.indexOf("."), d = b.indexOf("."), e = 0, f = 0; - 0 < c && (e = a.length - c - 1); - 0 < d && (f = b.length - d - 1); - return 0 < e || 0 < f ? e >= f ? (parseFloat(a) + parseFloat(b)).toFixed(e) : (parseFloat(a) + parseFloat(b)).toFixed(f) : parseInt(a) + parseInt(b); -}; -Entry.hex2rgb = function(a) { - return (a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a)) ? {r:parseInt(a[1], 16), g:parseInt(a[2], 16), b:parseInt(a[3], 16)} : null; -}; -Entry.rgb2hex = function(a, b, c) { - return "#" + (16777216 + (a << 16) + (b << 8) + c).toString(16).slice(1); -}; -Entry.generateRgb = function() { - return {r:Math.floor(256 * Math.random()), g:Math.floor(256 * Math.random()), b:Math.floor(256 * Math.random())}; -}; -Entry.adjustValueWithMaxMin = function(a, b, c) { - return a > c ? c : a < b ? b : a; + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0); }; -Entry.isExist = function(a, b, c) { - for (var d = 0;d < c.length;d++) { - if (c[d][b] == a) { - return c[d]; +Entry.Container.prototype.getVariable = function(b) { + for (var a = 0;a < this.variables_.length;a++) { + var d = this.variables_[a]; + if (d.getId() == b || d.getName() == b) { + return d; } } - return !1; }; -Entry.getColourCodes = function() { - return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); +Entry.Container.prototype.moveElement = function(b, a, d) { + var c; + c = this.getCurrentObjects(); + b = this.getAllObjects().indexOf(c[b]); + a = this.getAllObjects().indexOf(c[a]); + !d && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, a, b, !0); + this.objects_.splice(a, 0, this.objects_.splice(b, 1)[0]); + this.setCurrentObjects(); + Entry.container.updateListView(); + Entry.requestUpdate = !0; + return new Entry.State(Entry.container, Entry.container.moveElement, a, b, !0); }; -Entry.removeElement = function(a) { - a && a.parentNode && a.parentNode.removeChild(a); +Entry.Container.prototype.moveElementByBlock = function(b, a) { + var d = this.getCurrentObjects().splice(b, 1)[0]; + this.getCurrentObjects().splice(a, 0, d); + Entry.stage.sortZorder(); + this.updateListView(); }; -Entry.getElementsByClassName = function(a) { - for (var b = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { - -1 < (" " + c[d].className + " ").indexOf(" " + a + " ") && b.push(c[d]); +Entry.Container.prototype.getDropdownList = function(b, a) { + var d = []; + switch(b) { + case "sprites": + for (var c = this.getCurrentObjects(), e = c.length, f = 0;f < e;f++) { + a = c[f], d.push([a.name, a.id]); + } + break; + case "spritesWithMouse": + c = this.getCurrentObjects(); + e = c.length; + for (f = 0;f < e;f++) { + a = c[f], d.push([a.name, a.id]); + } + d.push([Lang.Blocks.mouse_pointer, "mouse"]); + break; + case "spritesWithSelf": + c = this.getCurrentObjects(); + e = c.length; + for (f = 0;f < e;f++) { + a = c[f], d.push([a.name, a.id]); + } + d.push([Lang.Blocks.self, "self"]); + break; + case "collision": + d.push([Lang.Blocks.mouse_pointer, "mouse"]); + c = this.getCurrentObjects(); + e = c.length; + for (f = 0;f < e;f++) { + a = c[f], d.push([a.name, a.id]); + } + d.push([Lang.Blocks.wall, "wall"]); + d.push([Lang.Blocks.wall_up, "wall_up"]); + d.push([Lang.Blocks.wall_down, "wall_down"]); + d.push([Lang.Blocks.wall_right, "wall_right"]); + d.push([Lang.Blocks.wall_left, "wall_left"]); + break; + case "pictures": + a = Entry.playground.object || a; + if (!a) { + break; + } + c = a.pictures; + for (f = 0;f < c.length;f++) { + e = c[f], d.push([e.name, e.id]); + } + break; + case "messages": + c = Entry.variableContainer.messages_; + for (f = 0;f < c.length;f++) { + e = c[f], d.push([e.name, e.id]); + } + break; + case "variables": + c = Entry.variableContainer.variables_; + for (f = 0;f < c.length;f++) { + e = c[f], e.object_ && Entry.playground.object && e.object_ != Entry.playground.object.id || d.push([e.getName(), e.getId()]); + } + d && 0 !== d.length || d.push([Lang.Blocks.VARIABLE_variable, "null"]); + break; + case "lists": + a = Entry.playground.object || a; + c = Entry.variableContainer.lists_; + for (f = 0;f < c.length;f++) { + e = c[f], e.object_ && a && e.object_ != a.id || d.push([e.getName(), e.getId()]); + } + d && 0 !== d.length || d.push([Lang.Blocks.VARIABLE_list, "null"]); + break; + case "scenes": + c = Entry.scene.scenes_; + for (f = 0;f < c.length;f++) { + e = c[f], d.push([e.name, e.id]); + } + break; + case "sounds": + a = Entry.playground.object || a; + if (!a) { + break; + } + c = a.sounds; + for (f = 0;f < c.length;f++) { + e = c[f], d.push([e.name, e.id]); + } + break; + case "clone": + d.push([Lang.Blocks.oneself, "self"]); + e = this.objects_.length; + for (f = 0;f < e;f++) { + a = this.objects_[f], d.push([a.name, a.id]); + } + break; + case "objectSequence": + for (e = this.getCurrentObjects().length, f = 0;f < e;f++) { + d.push([(f + 1).toString(), f.toString()]); + } + ; } - return b; + d.length || (d = [[Lang.Blocks.no_target, "null"]]); + return d; }; -Entry.parseNumber = function(a) { - return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a); +Entry.Container.prototype.clearRunningState = function() { + this.mapObject(function(b) { + b.clearExecutor(); + for (var a = b.clonedEntities.length;0 < a;a--) { + b.clonedEntities[a - 1].removeClone(); + } + b.clonedEntities = []; + }); }; -Entry.countStringLength = function(a) { - var b, c = 0; - for (b = 0;b < a.length;b++) { - 255 < a.charCodeAt(b) ? c += 2 : c++; +Entry.Container.prototype.mapObject = function(b, a) { + for (var d = this.objects_.length, c = [], e = 0;e < d;e++) { + c.push(b(this.objects_[e], a)); } return c; }; -Entry.cutStringByLength = function(a, b) { - var c, d = 0; - for (c = 0;d < b && c < a.length;c++) { - 255 < a.charCodeAt(c) ? d += 2 : d++; +Entry.Container.prototype.mapObjectOnScene = function(b, a) { + for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { + e.push(b(d[f], a)); } - return a.substr(0, c); + return e; }; -Entry.isChild = function(a, b) { - if (!b) { - for (;b.parentNode;) { - if ((b = b.parentNode) == a) { - return !0; - } +Entry.Container.prototype.clearRunningStateOnScene = function() { + this.mapObjectOnScene(function(b) { + b.clearExecutor(); + for (var a = b.clonedEntities.length;0 < a;a--) { + b.clonedEntities[a - 1].removeClone(); } + b.clonedEntities = []; + }); +}; +Entry.Container.prototype.mapEntity = function(b, a) { + for (var d = this.objects_.length, c = [], e = 0;e < d;e++) { + c.push(b(this.objects_[e].entity, a)); } - return !1; + return c; }; -Entry.launchFullScreen = function(a) { - a.requestFullscreen ? a.requestFullscreen() : a.mozRequestFulScreen ? a.mozRequestFulScreen() : a.webkitRequestFullscreen ? a.webkitRequestFullscreen() : a.msRequestFullScreen && a.msRequestFullScreen(); -}; -Entry.exitFullScreen = function() { - document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); +Entry.Container.prototype.mapEntityOnScene = function(b, a) { + for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { + e.push(b(d[f].entity, a)); + } + return e; }; -Entry.isPhone = function() { - return !1; +Entry.Container.prototype.mapEntityIncludeClone = function(b, a) { + for (var d = this.objects_, c = d.length, e = [], f = 0;f < c;f++) { + var g = d[f], h = g.clonedEntities.length; + e.push(b(g.entity, a)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(b(l, a)); + } + } + return e; }; -Entry.getKeyCodeMap = function() { - return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", - 13:Lang.Blocks.START_press_some_key_enter}; +Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(b, a) { + for (var d = this.getCurrentObjects(), c = d.length, e = [], f = 0;f < c;f++) { + var g = d[f], h = g.clonedEntities.length; + e.push(b(g.entity, a)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(b(l, a)); + } + } + return e; }; -Entry.checkCollisionRect = function(a, b) { - return !(a.y + a.height < b.y || a.y > b.y + b.height || a.x + a.width < b.x || a.x > b.x + b.width); +Entry.Container.prototype.getCachedPicture = function(b) { + Entry.assert("string" == typeof b, "pictureId must be string"); + return this.cachedPicture[b]; }; -Entry.bindAnimationCallback = function(a, b) { - a.addEventListener("webkitAnimationEnd", b, !1); - a.addEventListener("animationend", b, !1); - a.addEventListener("oanimationend", b, !1); +Entry.Container.prototype.cachePicture = function(b, a) { + this.cachedPicture[b] = a; }; -Entry.cloneSimpleObject = function(a) { - var b = {}, c; - for (c in a) { - b[c] = a[c]; +Entry.Container.prototype.toJSON = function() { + for (var b = [], a = this.objects_.length, d = 0;d < a;d++) { + b.push(this.objects_[d].toJSON()); } return b; }; -Entry.nodeListToArray = function(a) { - for (var b = Array(a.length), c = -1, d = a.length;++c !== d;b[c] = a[c]) { +Entry.Container.prototype.takeSequenceSnapshot = function() { + for (var b = this.objects_.length, a = this.objects_, d = 0;d < b;d++) { + a[d].index = d; } - return b; }; -Entry.computeInputWidth = function(a) { - var b = document.createElement("span"); - b.className = "tmp-element"; - b.innerHTML = a.replace(/&/g, "&").replace(//g, ">"); - document.body.appendChild(b); - a = b.offsetWidth; - document.body.removeChild(b); - return Number(a + 10) + "px"; +Entry.Container.prototype.loadSequenceSnapshot = function() { + for (var b = this.objects_.length, a = Array(b), d = 0;d < b;d++) { + var c = this.objects_[d]; + a[c.index || d] = c; + delete c.index; + } + this.objects_ = a; + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.updateListView(); }; -Entry.isArrowOrBackspace = function(a) { - return -1 < [37, 38, 39, 40, 8].indexOf(a); +Entry.Container.prototype.getInputValue = function() { + return this.inputValue.getValue(); }; -Entry.hexStringToBin = function(a) { - for (var b = [], c = 0;c < a.length - 1;c += 2) { - b.push(parseInt(a.substr(c, 2), 16)); - } - return String.fromCharCode.apply(String, b); +Entry.Container.prototype.setInputValue = function(b) { + this.inputValue.complete || (b ? this.inputValue.setValue(b) : this.inputValue.setValue(0), Entry.stage.hideInputField(), Entry.console && Entry.console.stopInput(b), this.inputValue.complete = !0); }; -Entry.findObjsByKey = function(a, b, c) { - for (var d = [], e = 0;e < a.length;e++) { - a[e][b] == c && d.push(a[e]); - } - return d; +Entry.Container.prototype.resetSceneDuringRun = function() { + this.mapEntityOnScene(function(b) { + b.loadSnapshot(); + b.object.filters = []; + b.resetFilter(); + b.dialog && b.dialog.remove(); + b.shape && b.removeBrush(); + }); + this.clearRunningStateOnScene(); }; -Entry.factorials = []; -Entry.factorial = function(a) { - return 0 === a || 1 == a ? 1 : 0 < Entry.factorials[a] ? Entry.factorials[a] : Entry.factorials[a] = Entry.factorial(a - 1) * a; +Entry.Container.prototype.setCopiedObject = function(b) { + this.copiedObject = b; }; -Entry.getListRealIndex = function(a, b) { - if (isNaN(a)) { - switch(a) { - case "FIRST": - a = 1; - break; - case "LAST": - a = b.array_.length; - break; - case "RANDOM": - a = Math.floor(Math.random() * b.array_.length) + 1; +Entry.Container.prototype.updateObjectsOrder = function() { + for (var b = Entry.scene.getScenes(), a = [], d = 0;d < b.length;d++) { + for (var c = this.getSceneObjects(b[d]), e = 0;e < c.length;e++) { + a.push(c[e]); } } - return a; -}; -Entry.toRadian = function(a) { - return a * Math.PI / 180; + this.objects_ = a; }; -Entry.toDegrees = function(a) { - return 180 * a / Math.PI; -}; -Entry.getPicturesJSON = function(a) { - for (var b = [], c = 0, d = a.length;c < d;c++) { - var e = a[c], f = {}; - f._id = e._id; - f.id = e.id; - f.dimension = e.dimension; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - f.scale = e.scale; - b.push(f); +Entry.Container.prototype.getSceneObjects = function(b) { + b = b || Entry.scene.selectedScene; + for (var a = [], d = this.getAllObjects(), c = 0;c < d.length;c++) { + b.id == d[c].scene.id && a.push(d[c]); } - return b; + return a; }; -Entry.getSoundsJSON = function(a) { - for (var b = [], c = 0, d = a.length;c < d;c++) { - var e = a[c], f = {}; - f._id = e._id; - f.duration = e.duration; - f.ext = e.ext; - f.id = e.id; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - b.push(f); - } - return b; +Entry.Container.prototype.setCurrentObjects = function() { + this.currentObjects_ = this.getSceneObjects(); }; -Entry.cutDecimal = function(a) { - return Math.round(100 * a) / 100; +Entry.Container.prototype.getCurrentObjects = function() { + var b = this.currentObjects_; + b && 0 !== b.length || this.setCurrentObjects(); + return this.currentObjects_; }; -Entry.getBrowserType = function() { - if (Entry.userAgent) { - return Entry.userAgent; - } - var a = navigator.userAgent, b, c = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if (/trident/i.test(c[1])) { - return b = /\brv[ :]+(\d+)/g.exec(a) || [], "IE " + (b[1] || ""); - } - if ("Chrome" === c[1] && (b = a.match(/\b(OPR|Edge)\/(\d+)/), null != b)) { - return b.slice(1).join(" ").replace("OPR", "Opera"); - } - c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; - null != (b = a.match(/version\/(\d+)/i)) && c.splice(1, 1, b[1]); - a = c.join(" "); - return Entry.userAgent = a; -}; -Entry.setBasicBrush = function(a) { - var b = new createjs.Graphics; - b.thickness = 1; - b.rgb = Entry.hex2rgb("#ff0000"); - b.opacity = 100; - b.setStrokeStyle(1); - b.beginStroke("rgba(255,0,0,1)"); - var c = new createjs.Shape(b); - Entry.stage.selectedObjectContainer.addChild(c); - a.brush && (a.brush = null); - a.brush = b; - a.shape && (a.shape = null); - a.shape = c; -}; -Entry.setCloneBrush = function(a, b) { - var c = new createjs.Graphics; - c.thickness = b.thickness; - c.rgb = b.rgb; - c.opacity = b.opacity; - c.setStrokeStyle(c.thickness); - c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); - b = new createjs.Shape(c); - Entry.stage.selectedObjectContainer.addChild(b); - a.brush && (a.brush = null); - a.brush = c; - a.shape && (a.shape = null); - a.shape = b; -}; -Entry.isFloat = function(a) { - return /\d+\.{1}\d+$/.test(a); -}; -Entry.getStringIndex = function(a) { - if (!a) { - return ""; - } - for (var b = {string:a, index:1}, c = 0, d = [], e = a.length - 1;0 < e;--e) { - var f = a.charAt(e); - if (isNaN(f)) { - break; - } else { - d.unshift(f), c = e; - } - } - 0 < c && (b.string = a.substring(0, c), b.index = parseInt(d.join("")) + 1); +Entry.Container.prototype.getProjectWithJSON = function(b) { + b.objects = Entry.container.toJSON(); + b.variables = Entry.variableContainer.getVariableJSON(); + b.messages = Entry.variableContainer.getMessageJSON(); + b.scenes = Entry.scene.toJSON(); return b; }; -Entry.getOrderedName = function(a, b, c) { - if (!a) { - return "untitled"; - } - if (!b || 0 === b.length) { - return a; - } - c || (c = "name"); - for (var d = 0, e = Entry.getStringIndex(a), f = 0, g = b.length;f < g;f++) { - var h = Entry.getStringIndex(b[f][c]); - e.string === h.string && h.index > d && (d = h.index); - } - return 0 < d ? e.string + d : a; +Entry.Container.prototype.blurAllInputs = function() { + this.getSceneObjects().map(function(b) { + b = b.view_.getElementsByTagName("input"); + for (var a = 0, d = b.length;a < d;a++) { + b[a].blur(); + } + }); }; -Entry.changeXmlHashId = function(a) { - if (/function_field/.test(a.getAttribute("type"))) { - for (var b = a.getElementsByTagName("mutation"), c = 0, d = b.length;c < d;c++) { - b[c].setAttribute("hashid", Entry.generateHash()); +Entry.Container.prototype.showProjectAnswer = function() { + var b = this.inputValue; + b && b.setVisible(!0); +}; +Entry.Container.prototype.hideProjectAnswer = function(b) { + if ((b = this.inputValue) && b.isVisible() && !Entry.engine.isState("run")) { + for (var a = Entry.container.getAllObjects(), d = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], c = 0, e = a.length;c < e;c++) { + for (var f = a[c].script, g = 0;g < d.length;g++) { + if (f.hasBlockType(d[g])) { + return; + } + } } + b.setVisible(!1); } - return a; }; -Entry.getMaxFloatPoint = function(a) { - for (var b = 0, c = 0, d = a.length;c < d;c++) { - var e = String(a[c]), f = e.indexOf("."); - -1 !== f && (e = e.length - (f + 1), e > b && (b = e)); - } - return Math.min(b, 20); +Entry.Container.prototype.getView = function() { + return this._view; }; -Entry.convertToRoundedDecimals = function(a, b) { - return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b); +Entry.Container.prototype.resize = function() { }; -Entry.attachEventListener = function(a, b, c) { - setTimeout(function() { - a.addEventListener(b, c); - }, 0); +Entry.Container.prototype._rightClick = function(b) { + b.stopPropagation && b.stopPropagation(); + var a = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + Entry.ContextMenu.show(a, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); }; -Entry.deAttachEventListener = function(a, b, c) { - a.removeEventListener(b, c); +Entry.Container.prototype.removeFuncBlocks = function(b) { + this.objects_.forEach(function(a) { + a.script.removeBlocksByType(b); + }); }; -Entry.isEmpty = function(a) { - if (!a) { - return !0; +Entry.db = {data:{}, typeMap:{}}; +(function(b) { + b.add = function(a) { + this.data[a.id] = a; + var b = a.type; + void 0 === this.typeMap[b] && (this.typeMap[b] = {}); + this.typeMap[b][a.id] = a; + }; + b.has = function(a) { + return this.data.hasOwnProperty(a); + }; + b.remove = function(a) { + this.has(a) && (delete this.typeMap[this.data[a].type][a], delete this.data[a]); + }; + b.get = function(a) { + return this.data[a]; + }; + b.find = function() { + }; + b.clear = function() { + this.data = {}; + this.typeMap = {}; + }; +})(Entry.db); +Entry.Dom = function(b, a) { + var d = /<(\w+)>/, c; + c = b instanceof HTMLElement ? $(b) : b instanceof jQuery ? b : d.test(b) ? $(b) : $("<" + b + ">"); + if (void 0 === a) { + return c; } - for (var b in a) { - if (a.hasOwnProperty(b)) { - return !1; + a.id && c.attr("id", a.id); + a.class && c.addClass(a.class); + a.classes && a.classes.map(function(a) { + c.addClass(a); + }); + a.src && c.attr("src", a.src); + a.parent && a.parent.append(c); + c.bindOnClick = function() { + var a, b, d = function(a) { + a.stopImmediatePropagation(); + a.handled || (a.handled = !0, b.call(this, a)); + }; + 1 < arguments.length ? (b = arguments[1] instanceof Function ? arguments[1] : function() { + }, a = "string" === typeof arguments[0] ? arguments[0] : "") : b = arguments[0] instanceof Function ? arguments[0] : function() { + }; + if (a) { + $(this).on("click tab", a, d); + } else { + $(this).on("click tab", d); } - } - return !0; + }; + return c; +}; +Entry.SVG = function(b) { + b = document.getElementById(b); + return Entry.SVG.createElement(b); }; -Entry.Utils.disableContextmenu = function(a) { +Entry.SVG.NS = "http://www.w3.org/2000/svg"; +Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; +Entry.SVG.createElement = function(b, a) { + var d; + d = "string" === typeof b ? document.createElementNS(Entry.SVG.NS, b) : b; if (a) { - $(a).on("contextmenu", function(b) { - b.stopPropagation(); - b.preventDefault(); - return !1; - }); + a.href && (d.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); + for (var c in a) { + d.setAttribute(c, a[c]); + } } + this instanceof SVGElement && this.appendChild(d); + d.elem = Entry.SVG.createElement; + d.attr = Entry.SVG.attr; + d.addClass = Entry.SVG.addClass; + d.removeClass = Entry.SVG.removeClass; + d.hasClass = Entry.SVG.hasClass; + d.remove = Entry.SVG.remove; + d.removeAttr = Entry.SVG.removeAttr; + return d; }; -Entry.Utils.isRightButton = function(a) { - return 2 == a.button || a.ctrlKey; -}; -Entry.Utils.isTouchEvent = function(a) { - return "mousedown" !== a.type.toLowerCase(); +Entry.SVG.attr = function(b, a) { + if ("string" === typeof b) { + var d = {}; + d[b] = a; + b = d; + } + if (b) { + b.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href); + for (var c in b) { + this.setAttribute(c, b[c]); + } + } + return this; }; -Entry.Utils.inherit = function(a, b) { - function c() { +Entry.SVG.addClass = function(b) { + for (var a = this.getAttribute("class"), d = 0;d < arguments.length;d++) { + b = arguments[d], this.hasClass(b) || (a += " " + b); } - c.prototype = a.prototype; - b.prototype = new c; - return b; + this.setAttribute("class", a); + return this; }; -Entry.bindAnimationCallbackOnce = function(a, b) { - a.one("webkitAnimationEnd animationendo animationend", b); +Entry.SVG.removeClass = function(b) { + for (var a = this.getAttribute("class"), d = 0;d < arguments.length;d++) { + b = arguments[d], this.hasClass(b) && (a = a.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); + } + this.setAttribute("class", a); + return this; }; -Entry.Utils.isInInput = function(a) { - return "textarea" == a.target.type || "text" == a.target.type; +Entry.SVG.hasClass = function(b) { + var a = this.getAttribute("class"); + return a ? a.match(new RegExp("(\\s|^)" + b + "(\\s|$)")) : !1; }; -Entry.Utils.isFunction = function(a) { - return "function" === typeof a; +Entry.SVG.remove = function() { + this.parentNode && this.parentNode.removeChild(this); }; -Entry.Utils.addFilters = function(a, b) { - a = a.elem("defs"); - var c = a.elem("filter", {id:"entryTrashcanFilter_" + b}); - c.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); - c.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); - c = c.elem("feMerge"); - c.elem("feMergeNode", {"in":"offsetBlur"}); - c.elem("feMergeNode", {"in":"SourceGraphic"}, c); - c = a.elem("filter", {id:"entryBlockShadowFilter_" + b, height:"200%"}); - c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); - c.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"}); - c.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); - b = a.elem("filter", {id:"entryBlockHighlightFilter_" + b}); - b.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); - b.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.SVG.removeAttr = function(b) { + this.removeAttribute(b); }; -Entry.Utils.addBlockPattern = function(a, b) { - a = a.elem("pattern", {id:"blockHoverPattern_" + b, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}); - b = a.elem("g"); - for (var c = b.elem("rect", {x:0, y:0, width:125, height:33}), d = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { - b.elem("image", {class:"pattern" + e, href:d.replace("(order)", e), x:0, y:0, width:125, height:33}); - } - return {pattern:a, rect:c}; +Entry.Dialog = function(b, a, d, c) { + b.dialog && b.dialog.remove(); + b.dialog = this; + this.parent = b; + this.padding = 10; + this.border = 2; + "number" == typeof a && (a = String(a)); + Entry.console && Entry.console.print(a, d); + this.message_ = a = a.match(/.{1,15}/g).join("\n"); + this.mode_ = d; + "speak" !== d && "ask" !== d || this.generateSpeak(); + c || Entry.stage.loadDialog(this); }; -Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; -Entry.Utils.createMouseEvent = function(a, b) { - var c = document.createEvent("MouseEvent"); - c.initMouseEvent(a, !0, !0, window, 0, 0, 0, b.clientX, b.clientY, !1, !1, !1, !1, 0, null); - return c; +Entry.Dialog.prototype.generateSpeak = function() { + this.object = new createjs.Container; + var b = new createjs.Text; + b.font = "15px NanumGothic"; + b.textBaseline = "top"; + b.textAlign = "left"; + b.text = this.message_; + var a = b.getTransformedBounds(), d = a.height, a = 10 <= a.width ? a.width : 17, c = new createjs.Shape; + c.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, a + 2 * this.padding, d + 2 * this.padding, this.padding); + this.object.addChild(c); + this.object.regX = a / 2; + this.object.regY = d / 2; + this.width = a; + this.height = d; + this.notch = this.createSpeakNotch("ne"); + this.update(); + this.object.addChild(this.notch); + this.object.addChild(b); + Entry.requestUpdate = !0; }; -Entry.Utils.xmlToJsonData = function(a) { - a = $.parseXML(a); - var b = []; - a = a.childNodes[0].childNodes; - for (var c in a) { - var d = a[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); - } - b.push(e); +Entry.Dialog.prototype.update = function() { + var b = this.parent.object.getTransformedBounds(); + if (!b && "textBox" === this.parent.type) { + if (this._isNoContentTried) { + delete this._isNoContentTried; + return; } + this.parent.setText(" "); + b = this.parent.object.getTransformedBounds(); + this._isNoContentTried = !0; } - return b; -}; -Entry.Utils.stopProjectWithToast = function(a, b, c) { - var d = a.block; - b = b || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; - Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); - Entry.engine && Entry.engine.toggleStop(); - "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? d = a.block.funcBlock : a.funcExecutor && (d = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); - throw Error(b); + var a = ""; + -135 < b.y - this.height - 20 - this.border ? (this.object.y = b.y - this.height / 2 - 20 - this.padding, a += "n") : (this.object.y = b.y + b.height + this.height / 2 + 20 + this.padding, a += "s"); + 240 > b.x + b.width + this.width ? (this.object.x = b.x + b.width + this.width / 2, a += "e") : (this.object.x = b.x - this.width / 2, a += "w"); + this.notch.type != a && (this.object.removeChild(this.notch), this.notch = this.createSpeakNotch(a), this.object.addChild(this.notch)); + this._isNoContentTried && this.parent.setText(""); + Entry.requestUpdate = !0; }; -Entry.Utils.AsyncError = function(a) { - this.name = "AsyncError"; - this.message = a || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; +Entry.Dialog.prototype.createSpeakNotch = function(b) { + var a = new createjs.Shape; + a.type = b; + "ne" == b ? a.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(0, this.height + this.padding - 1.5).lt(-10, this.height + this.padding + 20).lt(20, this.height + this.padding - 1.5) : "nw" == b ? a.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(this.width, this.height + this.padding - 1.5).lt(this.width + 10, this.height + this.padding + 20).lt(this.width - 20, this.height + this.padding - 1.5) : "se" == b ? a.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(0, -this.padding + 1.5).lt(-10, + -this.padding - 20).lt(20, -this.padding + 1.5) : "sw" == b && a.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(this.width, -this.padding + 1.5).lt(this.width + 10, -this.padding - 20).lt(this.width - 20, -this.padding + 1.5); + return a; }; -Entry.Utils.AsyncError.prototype = Error(); -Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; -Entry.Utils.isChrome = function() { - return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); +Entry.Dialog.prototype.remove = function() { + Entry.stage.unloadDialog(this); + this.parent.dialog = null; + Entry.requestUpdate = !0; }; -Entry.Utils.waitForWebfonts = function(a, b) { - for (var c = 0, d = 0, e = a.length;d < e;++d) { - (function(d) { - function e() { - f && f.offsetWidth != k && (++c, f.parentNode.removeChild(f), f = null); - if (c >= a.length && (l && clearInterval(l), c == a.length)) { - return b(), !0; - } - } - var f = document.createElement("span"); - f.innerHTML = "giItT1WQy@!-/#"; - f.style.position = "absolute"; - f.style.left = "-10000px"; - f.style.top = "-10000px"; - f.style.fontSize = "300px"; - f.style.fontFamily = "sans-serif"; - f.style.fontVariant = "normal"; - f.style.fontStyle = "normal"; - f.style.fontWeight = "normal"; - f.style.letterSpacing = "0"; - document.body.appendChild(f); - var k = f.offsetWidth; - f.style.fontFamily = d; - var l; - e() || (l = setInterval(e, 50)); - })(a[d]); - } +Entry.DoneProject = function(b) { + this.generateView(b); }; -window.requestAnimFrame = function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) { - window.setTimeout(a, 1E3 / 60); - }; -}(); -Entry.isMobile = function() { - if (Entry.device) { - return "tablet" === Entry.device; - } - var a = window.platform; - if (a && a.type && ("tablet" === a.type || "mobile" === a.type)) { - return Entry.device = "tablet", !0; - } - Entry.device = "desktop"; - return !1; +var p = Entry.DoneProject.prototype; +p.init = function(b) { + this.projectId = b; }; -Entry.Utils.convertMouseEvent = function(a) { - return a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; +p.generateView = function(b) { + var a = Entry.createElement("div"); + a.addClass("entryContainerDoneWorkspace"); + this.doneContainer = a; + var d = Entry.createElement("iframe"); + d.setAttribute("id", "doneProjectframe"); + d.setAttribute("frameborder", 0); + d.setAttribute("src", "/api/iframe/project/" + b); + this.doneProjectFrame = d; + this.doneContainer.appendChild(d); + a.addClass("entryRemove"); }; -Entry.Utils.convertIntToHex = function(a) { - return a.toString(16).toUpperCase(); +p.getView = function() { + return this.doneContainer; }; -Entry.Utils.hasSpecialCharacter = function(a) { - return /!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(a); +p.resize = function() { + document.getElementById("entryContainerWorkspaceId"); + var b = document.getElementById("doneProjectframe"), a = this.doneContainer.offsetWidth; + b.width = a + "px"; + b.height = 9 * a / 16 + "px"; }; -Entry.Model = function(a, b) { - var c = Entry.Model; - c.generateSchema(a); - c.generateSetter(a); - c.generateObserve(a); - (void 0 === b || b) && Object.seal(a); - return a; +Entry.Engine = function() { + function b(a) { + var b = [37, 38, 39, 40, 32], c = a.keyCode || a.which, e = Entry.stage.inputField; + 32 == c && e && e.hasFocus() || -1 < b.indexOf(c) && a.preventDefault(); + } + this.state = "stop"; + this.popup = null; + this.isUpdating = !0; + this.speeds = [1, 15, 30, 45, 60]; + this._mouseMoved = !1; + Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); + Entry.addEventListener("canvasClick", function(a) { + Entry.engine.fireEvent("mouse_clicked"); + }); + Entry.addEventListener("canvasClickCanceled", function(a) { + Entry.engine.fireEvent("mouse_click_cancled"); + }); + Entry.addEventListener("entityClick", function(a) { + Entry.engine.fireEventOnEntity("when_object_click", a); + }); + Entry.addEventListener("entityClickCanceled", function(a) { + Entry.engine.fireEventOnEntity("when_object_click_canceled", a); + }); + "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(a) { + this._mouseMoved = !0; + }.bind(this)), Entry.addEventListener("stageMouseOut", function(a) { + Entry.engine.hideMouseView(); + })); + Entry.addEventListener("run", function() { + $(window).bind("keydown", b); + }); + Entry.addEventListener("stop", function() { + $(window).unbind("keydown", b); + }); + setInterval(function() { + this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); + }.bind(this), 100); }; -(function(a) { - a.generateSchema = function(b) { - var a = b.schema; - if (void 0 !== a) { - a = JSON.parse(JSON.stringify(a)); - b.data = {}; - for (var d in a) { - (function(c) { - b.data[c] = a[c]; - Object.defineProperty(b, c, {get:function() { - return b.data[c]; - }}); - })(d); - } - b._toJSON = this._toJSON; - } - }; - a.generateSetter = function(b) { - b.set = this.set; - }; - a.set = function(b, a) { - var c = {}, e; - for (e in this.data) { - void 0 !== b[e] && (b[e] === this.data[e] ? delete b[e] : (c[e] = this.data[e], this.data[e] = b[e] instanceof Array ? b[e].concat() : b[e])); - } - a || this.notify(Object.keys(b), c); - }; - a.generateObserve = function(b) { - b.observers = []; - b.observe = this.observe; - b.unobserve = this.unobserve; - b.notify = this.notify; - }; - a.observe = function(b, a, d, e) { - d = new Entry.Observer(this.observers, b, a, d); - if (!1 !== e) { - b[a]([]); +Entry.Engine.prototype.generateView = function(b, a) { + if (a && "workspace" != a) { + "minimize" == a ? (this.view_ = b, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { + Entry.engine.toggleFullscreen(); + }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(a) { + this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); + Entry.stage.toggleCoordinator(); + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { + this.blur(); + Entry.engine.toggleStop(); + }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(a) { + this.blur(); + Entry.engine.togglePause(); + }), this.mouseView = Entry.createElement("div"), this.mouseView.addClass("entryMouseViewMinimize"), this.mouseView.addClass("entryRemove"), this.view_.appendChild(this.mouseView), Entry.addEventListener("loadComplete", function() { + this.runButton = Entry.Dom("div", {class:"entryRunButtonBigMinimize", parent:$("#entryCanvasWrapper")}); + this.runButton.bindOnClick(function(a) { + Entry.engine.toggleRun(); + }); + }.bind(this))) : "phone" == a && (this.view_ = b, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { + Entry.engine.footerView_.addClass("entryRemove"); + Entry.engine.headerView_.addClass("entryRemove"); + Entry.launchFullScreen(Entry.engine.view_); + }), document.addEventListener("fullscreenchange", function(a) { + Entry.engine.exitFullScreen(); + }), document.addEventListener("webkitfullscreenchange", function(a) { + Entry.engine.exitFullScreen(); + }), document.addEventListener("mozfullscreenchange", function(a) { + Entry.engine.exitFullScreen(); + }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(a) { + Entry.engine.toggleRun(); + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { + Entry.engine.toggleStop(); + })); + } else { + this.view_ = b; + this.view_.addClass("entryEngine_w"); + this.view_.addClass("entryEngineWorkspace_w"); + var d = Entry.createElement("button"); + this.speedButton = d; + this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); + this.view_.appendChild(this.speedButton); + this.speedButton.bindOnClick(function(a) { + Entry.engine.toggleSpeedPanel(); + d.blur(); + }); + this.maximizeButton = Entry.createElement("button"); + this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); + this.view_.appendChild(this.maximizeButton); + this.maximizeButton.bindOnClick(function(a) { + Entry.engine.toggleFullscreen(); + this.blur(); + }); + var c = Entry.createElement("button"); + this.coordinateButton = c; + this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); + this.view_.appendChild(this.coordinateButton); + this.coordinateButton.bindOnClick(function(a) { + this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); + c.blur(); + this.blur(); + Entry.stage.toggleCoordinator(); + }); + this.addButton = Entry.createElement("button"); + this.addButton.addClass("entryEngineButtonWorkspace_w"); + this.addButton.addClass("entryAddButtonWorkspace_w"); + this.addButton.innerHTML = Lang.Workspace.add_object; + this.addButton.bindOnClick(function(a) { + Entry.dispatchEvent("openSpriteManager"); + this.blur(); + }); + this.view_.appendChild(this.addButton); + this.runButton = Entry.createElement("button"); + this.runButton.addClass("entryEngineButtonWorkspace_w"); + this.runButton.addClass("entryRunButtonWorkspace_w"); + this.runButton.innerHTML = Lang.Workspace.run; + this.view_.appendChild(this.runButton); + this.runButton.bindOnClick(function(a) { + Entry.engine.toggleRun(); + this.blur(); + }); + this.runButton2 = Entry.createElement("button"); + this.runButton2.addClass("entryEngineButtonWorkspace_w"); + this.runButton2.addClass("entryRunButtonWorkspace_w2"); + this.view_.appendChild(this.runButton2); + this.runButton2.bindOnClick(function(a) { + this.blur(); + Entry.engine.toggleRun(); + }); + this.stopButton = Entry.createElement("button"); + this.stopButton.addClass("entryEngineButtonWorkspace_w"); + this.stopButton.addClass("entryStopButtonWorkspace_w"); + this.stopButton.addClass("entryRemove"); + this.stopButton.innerHTML = Lang.Workspace.stop; + this.view_.appendChild(this.stopButton); + this.stopButton.bindOnClick(function(a) { + this.blur(); + Entry.engine.toggleStop(); + }); + this.stopButton2 = Entry.createElement("button"); + this.stopButton2.addClass("entryEngineButtonWorkspace_w"); + this.stopButton2.addClass("entryStopButtonWorkspace_w2"); + this.stopButton2.addClass("entryRemove"); + this.stopButton2.innerHTML = Lang.Workspace.stop; + this.view_.appendChild(this.stopButton2); + this.stopButton2.bindOnClick(function(a) { + this.blur(); + Entry.engine.toggleStop(); + }); + this.pauseButton = Entry.createElement("button"); + this.pauseButton.addClass("entryEngineButtonWorkspace_w"); + this.pauseButton.addClass("entryPauseButtonWorkspace_w"); + this.pauseButton.addClass("entryRemove"); + this.view_.appendChild(this.pauseButton); + this.pauseButton.bindOnClick(function(a) { + this.blur(); + Entry.engine.togglePause(); + }); + this.mouseView = Entry.createElement("div"); + this.mouseView.addClass("entryMouseViewWorkspace_w"); + this.mouseView.addClass("entryRemove"); + this.view_.appendChild(this.mouseView); + } +}; +Entry.Engine.prototype.toggleSpeedPanel = function() { + if (this.speedPanelOn) { + this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(a) { + $(this).remove(); + delete this.speedProgress_; + }), $(this.speedHandle_).remove(), delete this.speedHandle_; + } else { + this.speedPanelOn = !0; + $(Entry.stage.canvas.canvas).animate({top:"41px"}); + this.coordinateButton.addClass("entryRemove"); + this.maximizeButton.addClass("entryRemove"); + this.mouseView.addClass("entryRemoveElement"); + this.speedLabel_ = Entry.createElement("div", "entrySpeedLabelWorkspace"); + this.speedLabel_.innerHTML = Lang.Workspace.speed; + this.view_.insertBefore(this.speedLabel_, this.maximizeButton); + this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); + for (var b = Entry.createElement("tr"), a = this.speeds, d = 0;5 > d;d++) { + (function(d) { + var c = Entry.createElement("td", "progressCell" + d); + c.bindOnClick(function() { + Entry.engine.setSpeedMeter(a[d]); + }); + b.appendChild(c); + })(d); } - return d; - }; - a.unobserve = function(b) { - b.destroy(); - }; - a.notify = function(b, a) { - "string" === typeof b && (b = [b]); - var c = this; - c.observers.map(function(d) { - var e = b; - void 0 !== d.attrs && (e = Entry.Utils.intersectArray(d.attrs, b)); - if (e.length) { - d.object[d.funcName](e.map(function(b) { - return {name:b, object:c, oldValue:a[b]}; - })); + this.view_.insertBefore(this.speedProgress_, this.maximizeButton); + this.speedProgress_.appendChild(b); + this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); + var c = (Entry.interfaceState.canvasWidth - 84) / 5; + $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(a) { + function b(a) { + a.stopPropagation(); + a = Entry.Utils.convertMouseEvent(a); + a = Math.floor((a.clientX - 80) / (5 * c) * 5); + 0 > a || 4 < a || Entry.engine.setSpeedMeter(Entry.engine.speeds[a]); + } + function d(a) { + $(document).unbind(".speedPanel"); + } + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + Entry.Utils.convertMouseEvent(a), a = $(document), a.bind("mousemove.speedPanel touchmove.speedPanel", b), a.bind("mouseup.speedPanel touchend.speedPanel", d); } }); - }; - a._toJSON = function() { - var b = {}, a; - for (a in this.data) { - b[a] = this.data[a]; - } - return b; - }; -})(Entry.Model); -Entry.Observer = function(a, b, c, d) { - this.parent = a; - this.object = b; - this.funcName = c; - this.attrs = d; - a.push(this); -}; -(function(a) { - a.destroy = function() { - var b = this.parent, a = b.indexOf(this); - -1 < a && b.splice(a, 1); - return this; - }; -})(Entry.Observer.prototype); -Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3, COMMAND_TYPES:{addThread:101, destroyThread:102, destroyBlock:103, recoverBlock:104, insertBlock:105, separateBlock:106, moveBlock:107, cloneBlock:108, uncloneBlock:109, scrollBoard:110, setFieldValue:111, selectObject:201, "do":301, -undo:302, redo:303, editPicture:401, uneditPicture:402, processPicture:403, unprocessPicture:404}}; -Entry.Command = {}; -(function(a) { - a.do = {type:Entry.STATIC.COMMAND_TYPES["do"], log:function(b) { - return [a["do"].type]; - }}; - a.undo = {type:Entry.STATIC.COMMAND_TYPES.undo, log:function(b) { - return [a.undo.type]; - }}; - a.redo = {type:Entry.STATIC.COMMAND_TYPES.redo, log:function(b) { - return [a.redo.type]; - }}; -})(Entry.Command); -Entry.Commander = function(a) { - if ("workspace" == a || "phone" == a) { - Entry.stateManager = new Entry.StateManager; + this.view_.insertBefore(this.speedHandle_, this.maximizeButton); + this.setSpeedMeter(Entry.FPS); } - Entry.do = this.do.bind(this); - Entry.undo = this.undo.bind(this); - this.editor = {}; - this.reporters = []; - this._tempStorage = null; - Entry.Command.editor = this.editor; }; -(function(a) { - a.do = function(b) { - var a = this, d = Array.prototype.slice.call(arguments); - d.shift(); - var e = Entry.Command[b]; - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, e.undo].concat(e.state.apply(this, d))); - e = Entry.Command[b].do.apply(this, d); - setTimeout(function() { - a.report("do"); - a.report(b, d); - }, 0); - return {value:e, isPass:this.isPass.bind(this)}; - }; - a.undo = function() { - var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; - this.report("undo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, d.undo].concat(d.state.apply(this, b))); - return {value:Entry.Command[a].do.apply(this, b), isPass:this.isPass.bind(this)}; - }; - a.redo = function() { - var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; - that.report("redo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.undo, a].concat(d.state.apply(null, b))); - d.undo.apply(this, b); - }; - a.setCurrentEditor = function(b, a) { - this.editor[b] = a; - }; - a.isPass = function(b) { - b = void 0 === b ? !0 : b; - if (Entry.stateManager) { - var a = Entry.stateManager.getLastCommand(); - a && (a.isPass = b); - } - }; - a.addReporter = function(b) { - this.reporters.push(b); - }; - a.removeReporter = function(b) { - b = this.reporters.indexOf(b); - -1 < b && this.reporters.splice(b, 1); - }; - a.report = function(b, a) { - var c = this.reporters; - if (0 !== c.length) { - var e; - e = b && Entry.Command[b] && Entry.Command[b].log ? Entry.Command[b].log.apply(this, a) : a; - c.forEach(function(b) { - b.add(e); - }); - } - }; -})(Entry.Commander.prototype); -(function(a) { - a.addThread = {type:Entry.STATIC.COMMAND_TYPES.addThread, do:function(b) { - return this.editor.board.code.createThread(b); - }, state:function(b) { - b.length && (b[0].id = Entry.Utils.generateId()); - return [b]; - }, log:function(b) { - b = this.editor.board.code.getThreads().pop(); - return [a.addThread.type, ["thread", b.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyThread"}; - a.destroyThread = {type:Entry.STATIC.COMMAND_TYPES.destroyThread, do:function(b) { - this.editor.board.findById(b[0].id).destroy(!0, !0); - }, state:function(b) { - return [this.editor.board.findById(b[0].id).thread.toJSON()]; - }, log:function(b) { - b = b[0].id; - this.editor.board.findById(b); - return [a.destroyThread.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; - }, undo:"addThread"}; - a.destroyBlock = {type:Entry.STATIC.COMMAND_TYPES.destroyBlock, do:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - b.doDestroy(!0); - }, state:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - return [b.toJSON(), b.pointer()]; - }, log:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - return [a.destroyBlock.type, ["blockId", b.id], ["code", this.editor.board.code.stringify()]]; - }, undo:"recoverBlock"}; - a.recoverBlock = {type:Entry.STATIC.COMMAND_TYPES.recoverBlock, do:function(b, a) { - b = this.editor.board.code.createThread([b]).getFirstBlock(); - "string" === typeof b && (b = this.editor.board.findById(b)); - this.editor.board.insert(b, a); - }, state:function(b) { - "string" !== typeof b && (b = b.id); - return [b]; - }, log:function(b, c) { - b = this.editor.board.findById(b.id); - return [a.recoverBlock.type, ["block", b.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyBlock"}; - a.insertBlock = {type:Entry.STATIC.COMMAND_TYPES.insertBlock, do:function(b, a, d) { - "string" === typeof b && (b = this.editor.board.findById(b)); - this.editor.board.insert(b, a, d); - }, state:function(b, a) { - "string" === typeof b && (b = this.editor.board.findById(b)); - a = [b.id]; - var c = b.targetPointer(); - a.push(c); - "string" !== typeof b && "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); - return a; - }, log:function(b, c, d) { - "string" === typeof b && (b = this.editor.board.findById(b)); - return [a.insertBlock.type, ["blockId", b.id], ["targetPointer", b.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - a.separateBlock = {type:Entry.STATIC.COMMAND_TYPES.separateBlock, do:function(b) { - b.view && b.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); - b.doSeparate(); - }, state:function(b) { - var a = [b.id], d = b.targetPointer(); - a.push(d); - "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); - return a; - }, log:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - return [a.separateBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - a.moveBlock = {type:Entry.STATIC.COMMAND_TYPES.moveBlock, do:function(b, a, d) { - void 0 !== a ? (b = this.editor.board.findById(b), b.moveTo(a, d)) : b._updatePos(); - }, state:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - return [b.id, b.x, b.y]; - }, log:function(b, c, d) { - return [a.moveBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"moveBlock"}; - a.cloneBlock = {type:Entry.STATIC.COMMAND_TYPES.cloneBlock, do:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - this.editor.board.code.createThread(b.copy()); - }, state:function(b) { - "string" !== typeof b && (b = b.id); - return [b]; - }, log:function(b) { - "string" === typeof b && (b = this.editor.board.findById(b)); - var c = this.editor.board.code.getThreads().pop(); - return [a.cloneBlock.type, ["blockId", b.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"uncloneBlock"}; - a.uncloneBlock = {type:Entry.STATIC.COMMAND_TYPES.uncloneBlock, do:function(b) { - b = this.editor.board.code.getThreads().pop().getFirstBlock(); - this._tempStorage = b.id; - b.destroy(!0, !0); - }, state:function(b) { - return [b]; - }, log:function(b) { - b = this._tempStorage; - this._tempStorage = null; - return [a.uncloneBlock.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; - }, undo:"cloneBlock"}; - a.scrollBoard = {type:Entry.STATIC.COMMAND_TYPES.scrollBoard, do:function(b, a, d) { - d || this.editor.board.scroller._scroll(b, a); - delete this.editor.board.scroller._diffs; - }, state:function(b, a) { - return [-b, -a]; - }, log:function(b, c) { - return [a.scrollBoard.type, ["dx", b], ["dy", c]]; - }, undo:"scrollBoard"}; - a.setFieldValue = {type:Entry.STATIC.COMMAND_TYPES.setFieldValue, do:function(b, a, d, e, f) { - a.setValue(f, !0); - }, state:function(b, a, d, e, f) { - return [b, a, d, f, e]; - }, log:function(b, c, d, e, f) { - return [a.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; - }, undo:"setFieldValue"}; -})(Entry.Command); -(function(a) { - a.selectObject = {type:Entry.STATIC.COMMAND_TYPES.selectObject, do:function(b) { - return Entry.container.selectObject(b); - }, state:function(b) { - if ((b = Entry.playground) && b.object) { - return [b.object.id]; - } - }, log:function(b) { - return [b]; - }, undo:"selectObject"}; -})(Entry.Command); -(function(a) { - a.editPicture = {type:Entry.STATIC.COMMAND_TYPES.editPicture, do:function(b, a) { - Entry.playground.painter.lc.canRedo() && Entry.playground.painter.lc.redo(); - }, state:function(b) { - }, log:function(b) { - return [b]; - }, undo:"uneditPicture"}; - a.uneditPicture = {type:Entry.STATIC.COMMAND_TYPES.uneditPicture, do:function(b, a) { - Entry.playground.painter.lc.undo(); - }, state:function(b) { - }, log:function(b) { - return [b]; - }, undo:"editPicture"}; - a.processPicture = {type:Entry.STATIC.COMMAND_TYPES.processPicture, do:function(b, a) { - Entry.playground.painter.lc.canRedo() && Entry.playground.painter.lc.redo(); - }, state:function(b) { - }, log:function(b) { - return [b]; - }, undo:"unprocessPicture", isPass:!0}; - a.unprocessPicture = {type:Entry.STATIC.COMMAND_TYPES.unprocessPicture, do:function(b, a) { - Entry.playground.painter.lc.undo(); - }, state:function(b) { - }, log:function(b) { - return [b]; - }, undo:"processPicture", isPass:!0}; -})(Entry.Command); -Entry.Container = function() { - this.objects_ = []; - this.cachedPicture = {}; - this.inputValue = {}; - this.currentObjects_ = this.copiedObject = null; +Entry.Engine.prototype.setSpeedMeter = function(b) { + var a = this.speeds.indexOf(b); + 0 > a || (a = Math.min(4, a), a = Math.max(0, a), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * a + 1) + 80 - 9 + "px"), Entry.FPS != b && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / b)), Entry.FPS = b)); }; -Entry.Container.prototype.generateView = function(a, b) { - var c = this; - this._view = a; - this._view.addClass("entryContainer"); - this._view.addClass("entryContainerWorkspace"); - this._view.setAttribute("id", "entryContainerWorkspaceId"); - a = Entry.createElement("div"); - a.addClass("entryAddObjectWorkspace"); - a.innerHTML = Lang.Workspace.add_object; - a.bindOnClick(function(b) { - Entry.dispatchEvent("openSpriteManager"); - }); - a = Entry.createElement("div"); - b = "entryContainerListWorkspaceWrapper"; - Entry.isForLecture && (b += " lecture"); - a.addClass(b); - Entry.Utils.disableContextmenu(a); - $(a).bind("mousedown touchstart", function(b) { - function a(b) { - m && 5 < Math.sqrt(Math.pow(b.pageX - m.x, 2) + Math.pow(b.pageY - m.y, 2)) && g && (clearTimeout(g), g = null); - } - function d(b) { - b.stopPropagation(); - h.unbind(".container"); - g && (clearTimeout(g), g = null); - } - var g = null, h = $(document), k = b.type, l = !1; - if (Entry.Utils.isRightButton(b)) { - c._rightClick(b), l = !0; - } else { - var m = {x:b.clientX, y:b.clientY}; - "touchstart" !== k || l || (b.stopPropagation(), b = Entry.Utils.convertMouseEvent(b), g = setTimeout(function() { - g && (g = null, c._rightClick(b)); - }, 1E3), h.bind("mousemove.container touchmove.container", a), h.bind("mouseup.container touchend.container", d)); - } - }); - this._view.appendChild(a); - b = Entry.createElement("ul"); - b.addClass("entryContainerListWorkspace"); - a.appendChild(b); - this.listView_ = b; - this.enableSort(); +Entry.Engine.prototype.start = function(b) { + createjs.Ticker.setFPS(Entry.FPS); + this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS)); }; -Entry.Container.prototype.enableSort = function() { - $ && $(this.listView_).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.container.moveElement(a, b); - }, axis:"y", cancel:"input.selectedEditingObject"}); +Entry.Engine.prototype.stop = function() { + clearInterval(this.ticker); + this.ticker = null; }; -Entry.Container.prototype.disableSort = function() { - $ && $(this.listView_).sortable("destroy"); +Entry.Engine.prototype.update = function() { + Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update()); }; -Entry.Container.prototype.updateListView = function() { - if (this.listView_) { - for (var a = this.listView_;a.hasChildNodes();) { - a.removeChild(a.lastChild); - } - var b = this.getCurrentObjects(), c; - for (c in b) { - a.appendChild(b[c].view_); - } - Entry.stage.sortZorder(); - } +Entry.Engine.prototype.computeObjects = function() { + Entry.container.mapObjectOnScene(this.computeFunction); }; -Entry.Container.prototype.setObjects = function(a) { - for (var b in a) { - var c = new Entry.EntryObject(a[b]); - this.objects_.push(c); - c.generateView(); - c.pictures.map(function(b) { - Entry.playground.generatePictureElement(b); - }); - c.sounds.map(function(b) { - Entry.playground.generateSoundElement(b); - }); +Entry.Engine.prototype.computeFunction = function(b) { + b.script.tick(); +}; +Entry.Engine.computeThread = function(b, a) { + Entry.engine.isContinue = !0; + for (var d = !1;a && Entry.engine.isContinue && !d;) { + Entry.engine.isContinue = !a.isRepeat; + var c = a.run(), d = c && c === a; + a = c; } - this.updateObjectsOrder(); - this.updateListView(); - Entry.stage.sortZorder(); - Entry.variableContainer.updateViews(); - a = Entry.type; - ("workspace" == a || "phone" == a) && (a = this.getCurrentObjects()[0]) && this.selectObject(a.id); + return a; }; -Entry.Container.prototype.getPictureElement = function(a, b) { - if (a = this.getObject(b).getPicture(a)) { - return a.view; - } - throw Error("No picture found"); +Entry.Engine.prototype.isState = function(b) { + return -1 < this.state.indexOf(b); }; -Entry.Container.prototype.setPicture = function(a) { - var b = this.getObject(a.objectId), c; - for (c in b.pictures) { - if (a.id === b.pictures[c].id) { - var d = {}; - d.dimension = a.dimension; - d.id = a.id; - d.filename = a.filename; - d.fileurl = a.fileurl; - d.name = a.name; - d.view = b.pictures[c].view; - b.pictures[c] = d; - return; - } - } - throw Error("No picture found"); +Entry.Engine.prototype.run = function() { + this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun(); }; -Entry.Container.prototype.selectPicture = function(a, b) { - b = this.getObject(b); - if (a = b.getPicture(a)) { - return b.selectedPicture = a, b.entity.setImage(a), b.updateThumbnailView(), b.id; +Entry.Engine.prototype.toggleRun = function() { + if ("pause" === this.state) { + this.togglePause(); + } else { + if (Entry.playground && Entry.playground.mainWorkspace) { + var b = Entry.playground.mainWorkspace, a = b.mode; + a == Entry.Workspace.MODE_VIMBOARD && b.loadCodeFromText(a); + } + Entry.addActivity("run"); + "stop" == this.state && (Entry.container.mapEntity(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapVariable(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapList(function(a) { + a.takeSnapshot(); + }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")); + this.state = "run"; + "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"); + this.pauseButton.innerHTML = Lang.Workspace.pause; + this.runButton.addClass("run"); + this.runButton.addClass("entryRemove"); + this.stopButton.removeClass("entryRemove"); + this.pauseButton && this.pauseButton.removeClass("entryRemove"); + this.runButton2 && this.runButton2.addClass("entryRemove"); + this.stopButton2 && this.stopButton2.removeClass("entryRemove"); + this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0); + Entry.stage.selectObject(); + Entry.dispatchEvent("run"); } - throw Error("No picture found"); }; -Entry.Container.prototype.addObject = function(a, b) { - var c = new Entry.EntryObject(a); - c.name = Entry.getOrderedName(c.name, this.objects_); - Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); - c.scene || (c.scene = Entry.scene.selectedScene); - "number" == typeof b ? a.sprite.category && "background" == a.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(b, 0, c) : a.sprite.category && "background" == a.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); - c.generateView(); - c.pictures.map(function(b) { - Entry.playground.generatePictureElement(b); +Entry.Engine.prototype.toggleStop = function() { + Entry.addActivity("stop"); + var b = Entry.container, a = Entry.variableContainer; + b.mapEntity(function(a) { + a.loadSnapshot(); + a.object.filters = []; + a.resetFilter(); + a.dialog && a.dialog.remove(); + a.brush && a.removeBrush(); }); - c.sounds.map(function(b) { - Entry.playground.generateSoundElement(b); + a.mapVariable(function(a) { + a.loadSnapshot(); }); - this.setCurrentObjects(); - this.updateObjectsOrder(); - this.updateListView(); - this.selectObject(c.id); - Entry.variableContainer.updateViews(); - return new Entry.State(this, this.removeObject, c); -}; -Entry.Container.prototype.addCloneObject = function(a, b) { - a = a.toJSON(); - var c = Entry.generateHash(); - Entry.variableContainer.addCloneLocalVariables({objectId:a.id, newObjectId:c, json:a}); - a.id = c; - a.scene = b || Entry.scene.selectedScene; - this.addObject(a); -}; -Entry.Container.prototype.removeObject = function(a) { - var b = this.objects_.indexOf(a), c = a.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, b); - c = new Entry.State(this.addObject, c, b); - a.destroy(); - this.objects_.splice(b, 1); - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.objects_.length && 0 !== b ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === b ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); - Entry.toast.success(Lang.Workspace.remove_object, a.name + " " + Lang.Workspace.remove_object_msg); - Entry.variableContainer.removeLocalVariables(a.id); - Entry.playground.reloadPlayground(); - return c; -}; -Entry.Container.prototype.selectObject = function(a, b) { - a = this.getObject(a); - b && a && Entry.scene.selectScene(a.scene); - this.mapObjectOnScene(function(b) { - b.view_ && b.view_.removeClass("selectedObject"); - b.isSelected_ = !1; + a.mapList(function(a) { + a.loadSnapshot(); + a.updateView(); }); - a && (a.view_ && a.view_.addClass("selectedObject"), a.isSelected_ = !0); - Entry.playground && Entry.playground.injectObject(a); - "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(a); -}; -Entry.Container.prototype.getAllObjects = function() { - return this.objects_; + this.stopProjectTimer(); + b.clearRunningState(); + b.loadSequenceSnapshot(); + this.projectTimer.loadSnapshot(); + Entry.container.inputValue.loadSnapshot(); + Entry.scene.loadStartSceneSnapshot(); + Entry.Func.clearThreads(); + createjs.Sound.setVolume(1); + createjs.Sound.stop(); + this.view_.removeClass("entryEngineBlueWorkspace"); + this.runButton.removeClass("entryRemove"); + this.stopButton.addClass("entryRemove"); + this.pauseButton && this.pauseButton.addClass("entryRemove"); + this.runButton2 && this.runButton2.removeClass("entryRemove"); + this.stopButton2 && this.stopButton2.addClass("entryRemove"); + this.state = "stop"; + Entry.dispatchEvent("stop"); + Entry.stage.hideInputField(); }; -Entry.Container.prototype.getObject = function(a) { - !a && Entry.playground && Entry.playground.object && (a = Entry.playground.object.id); - for (var b = this.objects_.length, c = 0;c < b;c++) { - var d = this.objects_[c]; - if (d.id == a) { - return d; - } - } +Entry.Engine.prototype.togglePause = function() { + var b = Entry.engine.projectTimer; + "pause" == this.state ? (b.pausedTime += (new Date).getTime() - b.pauseStart, b.isPaused ? b.pauseStart = (new Date).getTime() : delete b.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", b.isPaused && (b.pausedTime += (new Date).getTime() - b.pauseStart), b.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, + this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); }; -Entry.Container.prototype.getEntity = function(a) { - if (a = this.getObject(a)) { - return a.entity; - } - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0); +Entry.Engine.prototype.fireEvent = function(b) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, b); }; -Entry.Container.prototype.getVariable = function(a) { - for (var b = 0;b < this.variables_.length;b++) { - var c = this.variables_[b]; - if (c.getId() == a || c.getName() == a) { - return c; - } - } +Entry.Engine.prototype.raiseEvent = function(b, a) { + b.parent.script.raiseEvent(a, b); }; -Entry.Container.prototype.moveElement = function(a, b, c) { - var d; - d = this.getCurrentObjects(); - a = this.getAllObjects().indexOf(d[a]); - b = this.getAllObjects().indexOf(d[b]); - !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, b, a, !0); - this.objects_.splice(b, 0, this.objects_.splice(a, 1)[0]); - this.setCurrentObjects(); - Entry.container.updateListView(); - Entry.requestUpdate = !0; - return new Entry.State(Entry.container, Entry.container.moveElement, b, a, !0); +Entry.Engine.prototype.fireEventOnEntity = function(b, a) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [a, b]); }; -Entry.Container.prototype.moveElementByBlock = function(a, b) { - a = this.getCurrentObjects().splice(a, 1)[0]; - this.getCurrentObjects().splice(b, 0, a); - Entry.stage.sortZorder(); - this.updateListView(); +Entry.Engine.prototype.raiseEventOnEntity = function(b, a) { + b === a[0] && b.parent.script.raiseEvent(a[1], b); }; -Entry.Container.prototype.getDropdownList = function(a, b) { - var c = []; - switch(a) { - case "sprites": - var d = this.getCurrentObjects(), e = d.length; - for (a = 0;a < e;a++) { - b = d[a], c.push([b.name, b.id]); - } - break; - case "spritesWithMouse": - d = this.getCurrentObjects(); - e = d.length; - for (a = 0;a < e;a++) { - b = d[a], c.push([b.name, b.id]); - } - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - break; - case "spritesWithSelf": - d = this.getCurrentObjects(); - e = d.length; - for (a = 0;a < e;a++) { - b = d[a], c.push([b.name, b.id]); - } - c.push([Lang.Blocks.self, "self"]); - break; - case "collision": - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - d = this.getCurrentObjects(); - e = d.length; - for (a = 0;a < e;a++) { - b = d[a], c.push([b.name, b.id]); - } - c.push([Lang.Blocks.wall, "wall"]); - c.push([Lang.Blocks.wall_up, "wall_up"]); - c.push([Lang.Blocks.wall_down, "wall_down"]); - c.push([Lang.Blocks.wall_right, "wall_right"]); - c.push([Lang.Blocks.wall_left, "wall_left"]); - break; - case "pictures": - b = Entry.playground.object || b; - if (!b) { - break; - } - b = b.pictures; - for (a = 0;a < b.length;a++) { - d = b[a], c.push([d.name, d.id]); - } - break; - case "messages": - b = Entry.variableContainer.messages_; - for (a = 0;a < b.length;a++) { - d = b[a], c.push([d.name, d.id]); - } - break; - case "variables": - b = Entry.variableContainer.variables_; - for (a = 0;a < b.length;a++) { - d = b[a], d.object_ && Entry.playground.object && d.object_ != Entry.playground.object.id || c.push([d.getName(), d.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); - break; - case "lists": - b = Entry.playground.object || b; - d = Entry.variableContainer.lists_; - for (a = 0;a < d.length;a++) { - e = d[a], e.object_ && b && e.object_ != b.id || c.push([e.getName(), e.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); - break; - case "scenes": - b = Entry.scene.scenes_; - for (a = 0;a < b.length;a++) { - d = b[a], c.push([d.name, d.id]); - } - break; - case "sounds": - b = Entry.playground.object || b; - if (!b) { - break; - } - b = b.sounds; - for (a = 0;a < b.length;a++) { - d = b[a], c.push([d.name, d.id]); - } - break; - case "clone": - c.push([Lang.Blocks.oneself, "self"]); - e = this.objects_.length; - for (a = 0;a < e;a++) { - b = this.objects_[a], c.push([b.name, b.id]); - } - break; - case "objectSequence": - for (e = this.getCurrentObjects().length, a = 0;a < e;a++) { - c.push([(a + 1).toString(), a.toString()]); - } - ; - } - c.length || (c = [[Lang.Blocks.no_target, "null"]]); - return c; +Entry.Engine.prototype.captureKeyEvent = function(b) { + var a = b.keyCode, d = Entry.type; + b.ctrlKey && "workspace" == d ? 83 == a ? (b.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == a ? (b.preventDefault(), Entry.engine.run()) : 90 == a && (b.preventDefault(), Entry.dispatchEvent(b.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", a]); + Entry.engine.isState("stop") && "workspace" === d && 37 <= a && 40 >= a && Entry.stage.moveSprite(b); }; -Entry.Container.prototype.clearRunningState = function() { - this.mapObject(function(a) { - a.clearExecutor(); - for (var b = a.clonedEntities.length;0 < b;b--) { - a.clonedEntities[b - 1].removeClone(); - } - a.clonedEntities = []; - }); +Entry.Engine.prototype.raiseKeyEvent = function(b, a) { + return b.parent.script.raiseEvent(a[0], b, String(a[1])); }; -Entry.Container.prototype.mapObject = function(a, b) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(a(this.objects_[e], b)); - } - return d; +Entry.Engine.prototype.updateMouseView = function() { + var b = Entry.stage.mouseCoordinate; + this.mouseView.textContent = "X : " + b.x + ", Y : " + b.y; + this.mouseView.removeClass("entryRemove"); }; -Entry.Container.prototype.mapObjectOnScene = function(a, b) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(a(c[f], b)); - } - return e; +Entry.Engine.prototype.hideMouseView = function() { + this.mouseView.addClass("entryRemove"); }; -Entry.Container.prototype.clearRunningStateOnScene = function() { - this.mapObjectOnScene(function(a) { - a.clearExecutor(); - for (var b = a.clonedEntities.length;0 < b;b--) { - a.clonedEntities[b - 1].removeClone(); +Entry.Engine.prototype.toggleFullscreen = function() { + if (this.popup) { + this.popup.remove(), this.popup = null; + } else { + this.popup = new Entry.Popup; + if ("workspace" != Entry.type) { + var b = $(document); + $(this.popup.body_).css("top", b.scrollTop()); + $("body").css("overflow", "hidden"); + popup.window_.appendChild(Entry.stage.canvas.canvas); + popup.window_.appendChild(Entry.engine.runButton[0]); } - a.clonedEntities = []; - }); -}; -Entry.Container.prototype.mapEntity = function(a, b) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(a(this.objects_[e].entity, b)); + popup.window_.appendChild(Entry.engine.view_); } - return d; + Entry.windowResized.notify(); }; -Entry.Container.prototype.mapEntityOnScene = function(a, b) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(a(c[f].entity, b)); - } - return e; +Entry.Engine.prototype.exitFullScreen = function() { + document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove")); + Entry.windowResized.notify(); }; -Entry.Container.prototype.mapEntityIncludeClone = function(a, b) { - for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(a(g.entity, b)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(a(l, b)); - } - } - return e; +Entry.Engine.prototype.showProjectTimer = function() { + Entry.engine.projectTimer && this.projectTimer.setVisible(!0); }; -Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(a, b) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(a(g.entity, b)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(a(l, b)); +Entry.Engine.prototype.hideProjectTimer = function() { + var b = this.projectTimer; + if (b && b.isVisible() && !this.isState("run")) { + for (var a = Entry.container.getAllObjects(), d = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], c = 0, e = a.length;c < e;c++) { + for (var f = a[c].script, g = 0;g < d.length;g++) { + if (f.hasBlockType(d[g])) { + return; + } + } } + b.setVisible(!1); } - return e; -}; -Entry.Container.prototype.getCachedPicture = function(a) { - Entry.assert("string" == typeof a, "pictureId must be string"); - return this.cachedPicture[a]; }; -Entry.Container.prototype.cachePicture = function(a, b) { - this.cachedPicture[a] = b; +Entry.Engine.prototype.clearTimer = function() { + clearInterval(this.ticker); + clearInterval(this.projectTimer.tick); }; -Entry.Container.prototype.toJSON = function() { - for (var a = [], b = this.objects_.length, c = 0;c < b;c++) { - a.push(this.objects_[c].toJSON()); - } - return a; +Entry.Engine.prototype.startProjectTimer = function() { + var b = this.projectTimer; + b && (b.start = (new Date).getTime(), b.isInit = !0, b.pausedTime = 0, b.tick = setInterval(function(a) { + Entry.engine.updateProjectTimer(); + }, 1E3 / 60)); }; -Entry.Container.prototype.takeSequenceSnapshot = function() { - for (var a = this.objects_.length, b = this.objects_, c = 0;c < a;c++) { - b[c].index = c; - } +Entry.Engine.prototype.stopProjectTimer = function() { + var b = this.projectTimer; + b && (this.updateProjectTimer(0), b.isPaused = !1, b.isInit = !1, b.pausedTime = 0, clearInterval(b.tick)); }; -Entry.Container.prototype.loadSequenceSnapshot = function() { - for (var a = this.objects_.length, b = Array(a), c = 0;c < a;c++) { - var d = this.objects_[c]; - b[d.index || c] = d; - delete d.index; +Entry.Engine.prototype.updateProjectTimer = function(b) { + var a = Entry.engine, d = a.projectTimer; + if (d) { + var c = (new Date).getTime(); + "undefined" == typeof b ? d.isPaused || a.isState("pause") || d.setValue((c - d.start - d.pausedTime) / 1E3) : (d.setValue(b), d.pausedTime = 0, d.start = c); } - this.objects_ = b; - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.updateListView(); -}; -Entry.Container.prototype.getInputValue = function() { - return this.inputValue.getValue(); }; -Entry.Container.prototype.setInputValue = function(a) { - this.inputValue.complete || (a ? this.inputValue.setValue(a) : this.inputValue.setValue(0), Entry.stage.hideInputField(), Entry.console && Entry.console.stopInput(a), this.inputValue.complete = !0); -}; -Entry.Container.prototype.resetSceneDuringRun = function() { - this.mapEntityOnScene(function(a) { - a.loadSnapshot(); - a.object.filters = []; - a.resetFilter(); - a.dialog && a.dialog.remove(); - a.shape && a.removeBrush(); +Entry.EntityObject = function(b) { + this.parent = b; + this.type = b.objectType; + this.flip = !1; + this.collision = Entry.Utils.COLLISION.NONE; + this.id = Entry.generateHash(); + "sprite" == this.type ? (this.object = new createjs.Bitmap, this.effect = {}, this.setInitialEffectValue()) : "textBox" == this.type && (this.object = new createjs.Container, this.textObject = new createjs.Text, this.textObject.font = "20px Nanum Gothic", this.textObject.textBaseline = "middle", this.textObject.textAlign = "center", this.bgObject = new createjs.Shape, this.bgObject.graphics.setStrokeStyle(1).beginStroke("#f00").drawRect(0, 0, 100, 100), this.object.addChild(this.bgObject), this.object.addChild(this.textObject), + this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); + this.object.entity = this; + this.object.cursor = "pointer"; + this.object.on("mousedown", function(a) { + var b = this.entity.parent.id; + Entry.dispatchEvent("entityClick", this.entity); + Entry.stage.isObjectClick = !0; + "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * a.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * a.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(b)); + }); + this.object.on("pressup", function(a) { + Entry.dispatchEvent("entityClickCanceled", this.entity); + this.cursor = "pointer"; + this.entity.checkCommand(); + }); + this.object.on("pressmove", function(a) { + "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * a.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * a.stageY - 135) - this.offset.y), Entry.stage.updateObject()); }); - this.clearRunningStateOnScene(); -}; -Entry.Container.prototype.setCopiedObject = function(a) { - this.copiedObject = a; }; -Entry.Container.prototype.updateObjectsOrder = function() { - for (var a = Entry.scene.getScenes(), b = [], c = 0;c < a.length;c++) { - for (var d = this.getSceneObjects(a[c]), e = 0;e < d.length;e++) { - b.push(d[e]); - } - } - this.objects_ = b; +Entry.EntityObject.prototype.injectModel = function(b, a) { + if ("sprite" == this.type) { + this.setImage(b); + } else { + if ("textBox" == this.type) { + var d = this.parent; + a.text = a.text || d.text || d.name; + this.setFont(a.font); + this.setBGColour(a.bgColor); + this.setColour(a.colour); + this.setUnderLine(a.underLine); + this.setStrike(a.strike); + this.setText(a.text); + } + } + a && this.syncModel_(a); +}; +Entry.EntityObject.prototype.syncModel_ = function(b) { + this.setX(b.x); + this.setY(b.y); + this.setRegX(b.regX); + this.setRegY(b.regY); + this.setScaleX(b.scaleX); + this.setScaleY(b.scaleY); + this.setRotation(b.rotation); + this.setDirection(b.direction, !0); + this.setLineBreak(b.lineBreak); + this.setWidth(b.width); + this.setHeight(b.height); + this.setText(b.text); + this.setTextAlign(b.textAlign); + this.setFontSize(b.fontSize || this.getFontSize()); + this.setVisible(b.visible); }; -Entry.Container.prototype.getSceneObjects = function(a) { - a = a || Entry.scene.selectedScene; - for (var b = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { - a.id == c[d].scene.id && b.push(c[d]); - } - return b; +Entry.EntityObject.prototype.initCommand = function() { + Entry.engine.isState("stop") && (this.isCommandValid = !1, Entry.stateManager && Entry.stateManager.addCommand("edit entity", this, this.restoreEntity, this.toJSON())); }; -Entry.Container.prototype.setCurrentObjects = function() { - this.currentObjects_ = this.getSceneObjects(); +Entry.EntityObject.prototype.doCommand = function() { + this.isCommandValid = !0; }; -Entry.Container.prototype.getCurrentObjects = function() { - var a = this.currentObjects_; - a && 0 !== a.length || this.setCurrentObjects(); - return this.currentObjects_; +Entry.EntityObject.prototype.checkCommand = function() { + Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand"); }; -Entry.Container.prototype.getProjectWithJSON = function(a) { - a.objects = Entry.container.toJSON(); - a.variables = Entry.variableContainer.getVariableJSON(); - a.messages = Entry.variableContainer.getMessageJSON(); - a.scenes = Entry.scene.toJSON(); - return a; +Entry.EntityObject.prototype.restoreEntity = function(b) { + var a = this.toJSON(); + this.syncModel_(b); + Entry.dispatchEvent("updateObject"); + Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, a); }; -Entry.Container.prototype.blurAllInputs = function() { - this.getSceneObjects().map(function(a) { - a = a.view_.getElementsByTagName("input"); - for (var b = 0, c = a.length;b < c;b++) { - a[b].blur(); - } - }); +Entry.EntityObject.prototype.setX = function(b) { + "number" == typeof b && (this.x = b, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; -Entry.Container.prototype.showProjectAnswer = function() { - var a = this.inputValue; - a && a.setVisible(!0); -}; -Entry.Container.prototype.hideProjectAnswer = function(a) { - if ((a = this.inputValue) && a.isVisible() && !Entry.engine.isState("run")) { - for (var b = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = b.length;d < e;d++) { - for (var f = b[d].script, g = 0;g < c.length;g++) { - if (f.hasBlockType(c[g])) { - return; - } - } - } - a.setVisible(!1); - } +Entry.EntityObject.prototype.getX = function() { + return this.x; }; -Entry.Container.prototype.getView = function() { - return this._view; +Entry.EntityObject.prototype.setY = function(b) { + "number" == typeof b && (this.y = b, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; -Entry.Container.prototype.resize = function() { +Entry.EntityObject.prototype.getY = function() { + return this.y; }; -Entry.Container.prototype._rightClick = function(a) { - a.stopPropagation && a.stopPropagation(); - var b = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(b, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); +Entry.EntityObject.prototype.getDirection = function() { + return this.direction; }; -Entry.Container.prototype.removeFuncBlocks = function(a) { - this.objects_.forEach(function(b) { - b.script.removeBlocksByType(a); - }); +Entry.EntityObject.prototype.setDirection = function(b, a) { + b || (b = 0); + "vertical" != this.parent.getRotateMethod() || a || (0 <= this.direction && 180 > this.direction) == (0 <= b && 180 > b) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); + this.direction = b.mod(360); + this.object.direction = this.direction; + this.isClone || this.parent.updateRotationView(); + Entry.dispatchEvent("updateObject"); + Entry.requestUpdate = !0; }; -Entry.db = {data:{}, typeMap:{}}; -(function(a) { - a.add = function(b) { - this.data[b.id] = b; - var a = b.type; - void 0 === this.typeMap[a] && (this.typeMap[a] = {}); - this.typeMap[a][b.id] = b; - }; - a.has = function(b) { - return this.data.hasOwnProperty(b); - }; - a.remove = function(b) { - this.has(b) && (delete this.typeMap[this.data[b].type][b], delete this.data[b]); - }; - a.get = function(b) { - return this.data[b]; - }; - a.find = function() { - }; - a.clear = function() { - this.data = {}; - this.typeMap = {}; - }; -})(Entry.db); -Entry.Dom = function(a, b) { - var c = /<(\w+)>/, d; - d = a instanceof HTMLElement ? $(a) : a instanceof jQuery ? a : c.test(a) ? $(a) : $("<" + a + ">"); - if (void 0 === b) { - return d; - } - b.id && d.attr("id", b.id); - b.class && d.addClass(b.class); - b.classes && b.classes.map(function(b) { - d.addClass(b); - }); - b.src && d.attr("src", b.src); - b.parent && b.parent.append(d); - d.bindOnClick = function() { - var b, a, c = function(b) { - b.stopImmediatePropagation(); - b.handled || (b.handled = !0, a.call(this, b)); - }; - 1 < arguments.length ? (a = arguments[1] instanceof Function ? arguments[1] : function() { - }, b = "string" === typeof arguments[0] ? arguments[0] : "") : a = arguments[0] instanceof Function ? arguments[0] : function() { - }; - if (b) { - $(this).on("click tab", b, c); - } else { - $(this).on("click tab", c); - } - }; - return d; +Entry.EntityObject.prototype.setRotation = function(b) { + "free" != this.parent.getRotateMethod() && (b = 0); + this.rotation = b.mod(360); + this.object.rotation = this.rotation; + this.updateDialog(); + this.isClone || this.parent.updateRotationView(); + Entry.dispatchEvent("updateObject"); + Entry.requestUpdate = !0; }; -Entry.SVG = function(a) { - a = document.getElementById(a); - return Entry.SVG.createElement(a); +Entry.EntityObject.prototype.getRotation = function() { + return this.rotation; }; -Entry.SVG.NS = "http://www.w3.org/2000/svg"; -Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; -Entry.SVG.createElement = function(a, b) { - a = "string" === typeof a ? document.createElementNS(Entry.SVG.NS, a) : a; - if (b) { - b.href && (a.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href); - for (var c in b) { - a.setAttribute(c, b[c]); - } - } - this instanceof SVGElement && this.appendChild(a); - a.elem = Entry.SVG.createElement; - a.attr = Entry.SVG.attr; - a.addClass = Entry.SVG.addClass; - a.removeClass = Entry.SVG.removeClass; - a.hasClass = Entry.SVG.hasClass; - a.remove = Entry.SVG.remove; - a.removeAttr = Entry.SVG.removeAttr; - return a; +Entry.EntityObject.prototype.setRegX = function(b) { + "textBox" == this.type && (b = 0); + this.regX = b; + this.object.regX = this.regX; + Entry.requestUpdate = !0; }; -Entry.SVG.attr = function(a, b) { - if ("string" === typeof a) { - var c = {}; - c[a] = b; - a = c; - } - if (a) { - a.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); - for (var d in a) { - this.setAttribute(d, a[d]); - } - } - return this; +Entry.EntityObject.prototype.getRegX = function() { + return this.regX; }; -Entry.SVG.addClass = function(a) { - for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - a = arguments[c], this.hasClass(a) || (b += " " + a); - } - this.setAttribute("class", b); - return this; +Entry.EntityObject.prototype.setRegY = function(b) { + "textBox" == this.type && (b = 0); + this.regY = b; + this.object.regY = this.regY; + Entry.requestUpdate = !0; }; -Entry.SVG.removeClass = function(a) { - for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - a = arguments[c], this.hasClass(a) && (b = b.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); - } - this.setAttribute("class", b); - return this; +Entry.EntityObject.prototype.getRegY = function() { + return this.regY; +}; +Entry.EntityObject.prototype.setScaleX = function(b) { + this.scaleX = b; + this.object.scaleX = this.scaleX; + this.parent.updateCoordinateView(); + this.updateDialog(); + Entry.requestUpdate = !0; }; -Entry.SVG.hasClass = function(a) { - var b = this.getAttribute("class"); - return b ? b.match(new RegExp("(\\s|^)" + a + "(\\s|$)")) : !1; +Entry.EntityObject.prototype.getScaleX = function() { + return this.scaleX; }; -Entry.SVG.remove = function() { - this.parentNode && this.parentNode.removeChild(this); +Entry.EntityObject.prototype.setScaleY = function(b) { + this.scaleY = b; + this.object.scaleY = this.scaleY; + this.parent.updateCoordinateView(); + this.updateDialog(); + Entry.requestUpdate = !0; }; -Entry.SVG.removeAttr = function(a) { - this.removeAttribute(a); +Entry.EntityObject.prototype.getScaleY = function() { + return this.scaleY; }; -Entry.Dialog = function(a, b, c, d) { - a.dialog && a.dialog.remove(); - a.dialog = this; - this.parent = a; - this.padding = 10; - this.border = 2; - "number" == typeof b && (b = String(b)); - Entry.console && Entry.console.print(b, c); - this.message_ = b = b.match(/.{1,15}/g).join("\n"); - this.mode_ = c; - "speak" !== c && "ask" !== c || this.generateSpeak(); - d || Entry.stage.loadDialog(this); +Entry.EntityObject.prototype.setSize = function(b) { + 1 > b && (b = 1); + b /= this.getSize(); + this.setScaleX(this.getScaleX() * b); + this.setScaleY(this.getScaleY() * b); + this.isClone || this.parent.updateCoordinateView(); + Entry.requestUpdate = !0; }; -Entry.Dialog.prototype.generateSpeak = function() { - this.object = new createjs.Container; - var a = new createjs.Text; - a.font = "15px NanumGothic"; - a.textBaseline = "top"; - a.textAlign = "left"; - a.text = this.message_; - var b = a.getTransformedBounds(), c = b.height, b = 10 <= b.width ? b.width : 17, d = new createjs.Shape; - d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, b + 2 * this.padding, c + 2 * this.padding, this.padding); - this.object.addChild(d); - this.object.regX = b / 2; - this.object.regY = c / 2; +Entry.EntityObject.prototype.getSize = function() { + return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2; +}; +Entry.EntityObject.prototype.setWidth = function(b) { this.width = b; - this.height = c; - this.notch = this.createSpeakNotch("ne"); - this.update(); - this.object.addChild(this.notch); - this.object.addChild(a); + this.object.width = this.width; + this.textObject && this.getLineBreak() && (this.textObject.lineWidth = this.width); + this.updateDialog(); + this.updateBG(); Entry.requestUpdate = !0; }; -Entry.Dialog.prototype.update = function() { - var a = this.parent.object.getTransformedBounds(); - if (!a && "textBox" === this.parent.type) { - if (this._isNoContentTried) { - delete this._isNoContentTried; - return; - } - this.parent.setText(" "); - a = this.parent.object.getTransformedBounds(); - this._isNoContentTried = !0; +Entry.EntityObject.prototype.getWidth = function() { + return this.width; +}; +Entry.EntityObject.prototype.setHeight = function(b) { + this.height = b; + this.textObject && (this.object.height = this.height, this.alignTextBox()); + this.updateDialog(); + this.updateBG(); + Entry.requestUpdate = !0; +}; +Entry.EntityObject.prototype.getHeight = function() { + return this.height; +}; +Entry.EntityObject.prototype.setColour = function(b) { + b || (b = "#000000"); + this.colour = b; + this.textObject && (this.textObject.color = this.colour); + Entry.requestUpdate = !0; +}; +Entry.EntityObject.prototype.getColour = function() { + return this.colour; +}; +Entry.EntityObject.prototype.setBGColour = function(b) { + b || (b = "transparent"); + this.bgColor = b; + this.updateBG(); + Entry.requestUpdate = !0; +}; +Entry.EntityObject.prototype.getBGColour = function() { + return this.bgColor; +}; +Entry.EntityObject.prototype.setUnderLine = function(b) { + void 0 === b && (b = !1); + this.underLine = b; + this.textObject.underLine = b; + Entry.requestUpdate = !0; +}; +Entry.EntityObject.prototype.getUnderLine = function() { + return this.underLine; +}; +Entry.EntityObject.prototype.setStrike = function(b) { + void 0 === b && (b = !1); + this.strike = b; + this.textObject.strike = b; + Entry.requestUpdate = !0; +}; +Entry.EntityObject.prototype.getStrike = function() { + return this.strike; +}; +Entry.EntityObject.prototype.getFont = function() { + var b = []; + this.fontBold && b.push("bold"); + this.fontItalic && b.push("italic"); + b.push(this.getFontSize() + "px"); + b.push(this.fontType); + return b.join(" "); +}; +Entry.EntityObject.prototype.setFont = function(b) { + if ("textBox" == this.parent.objectType && this.font !== b) { + b || (b = "20px Nanum Gothic"); + var a = b.split(" "), d = 0; + if (d = -1 < a.indexOf("bold")) { + a.splice(d - 1, 1), this.setFontBold(!0); + } + if (d = -1 < a.indexOf("italic")) { + a.splice(d - 1, 1), this.setFontItalic(!0); + } + d = parseInt(a.shift()); + this.setFontSize(d); + this.setFontType(a.join(" ")); + this.font = this.getFont(); + this.textObject.font = b; + Entry.stage.update(); + this.setWidth(this.textObject.getMeasuredWidth()); + this.updateBG(); + Entry.stage.updateObject(); } - var b = ""; - -135 < a.y - this.height - 20 - this.border ? (this.object.y = a.y - this.height / 2 - 20 - this.padding, b += "n") : (this.object.y = a.y + a.height + this.height / 2 + 20 + this.padding, b += "s"); - 240 > a.x + a.width + this.width ? (this.object.x = a.x + a.width + this.width / 2, b += "e") : (this.object.x = a.x - this.width / 2, b += "w"); - this.notch.type != b && (this.object.removeChild(this.notch), this.notch = this.createSpeakNotch(b), this.object.addChild(this.notch)); - this._isNoContentTried && this.parent.setText(""); +}; +Entry.EntityObject.prototype.setLineHeight = function() { + switch(this.getFontType()) { + case "Nanum Gothic Coding": + this.textObject.lineHeight = this.fontSize; + break; + default: + this.textObject.lineHeight = 0; + } +}; +Entry.EntityObject.prototype.syncFont = function() { + this.textObject.font = this.getFont(); + this.setLineHeight(); + Entry.stage.update(); + this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth()); + Entry.stage.updateObject(); Entry.requestUpdate = !0; }; -Entry.Dialog.prototype.createSpeakNotch = function(a) { - var b = new createjs.Shape; - b.type = a; - "ne" == a ? b.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(0, this.height + this.padding - 1.5).lt(-10, this.height + this.padding + 20).lt(20, this.height + this.padding - 1.5) : "nw" == a ? b.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(this.width, this.height + this.padding - 1.5).lt(this.width + 10, this.height + this.padding + 20).lt(this.width - 20, this.height + this.padding - 1.5) : "se" == a ? b.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(0, -this.padding + 1.5).lt(-10, - -this.padding - 20).lt(20, -this.padding + 1.5) : "sw" == a && b.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").mt(this.width, -this.padding + 1.5).lt(this.width + 10, -this.padding - 20).lt(this.width - 20, -this.padding + 1.5); - return b; +Entry.EntityObject.prototype.getFontType = function() { + return this.fontType; }; -Entry.Dialog.prototype.remove = function() { - Entry.stage.unloadDialog(this); - this.parent.dialog = null; +Entry.EntityObject.prototype.setFontType = function(b) { + "textBox" == this.parent.objectType && (this.fontType = b ? b : "Nanum Gothic", this.syncFont()); +}; +Entry.EntityObject.prototype.getFontSize = function(b) { + return this.fontSize; +}; +Entry.EntityObject.prototype.setFontSize = function(b) { + "textBox" == this.parent.objectType && this.fontSize != b && (this.fontSize = b ? b : 20, this.syncFont(), this.alignTextBox()); +}; +Entry.EntityObject.prototype.setFontBold = function(b) { + this.fontBold = b; Entry.requestUpdate = !0; }; -Entry.DoneProject = function(a) { - this.generateView(a); +Entry.EntityObject.prototype.toggleFontBold = function() { + this.fontBold = !this.fontBold; + this.syncFont(); + return this.fontBold; }; -var p = Entry.DoneProject.prototype; -p.init = function(a) { - this.projectId = a; +Entry.EntityObject.prototype.setFontItalic = function(b) { + this.fontItalic = b; + Entry.requestUpdate = !0; }; -p.generateView = function(a) { - var b = Entry.createElement("div"); - b.addClass("entryContainerDoneWorkspace"); - this.doneContainer = b; - var c = Entry.createElement("iframe"); - c.setAttribute("id", "doneProjectframe"); - c.setAttribute("frameborder", 0); - c.setAttribute("src", "/api/iframe/project/" + a); - this.doneProjectFrame = c; - this.doneContainer.appendChild(c); - b.addClass("entryRemove"); +Entry.EntityObject.prototype.toggleFontItalic = function() { + this.fontItalic = !this.fontItalic; + this.syncFont(); + return this.fontItalic; }; -p.getView = function() { - return this.doneContainer; +Entry.EntityObject.prototype.setFontName = function(b) { + for (var a = this.font.split(" "), d = [], c = 0, e = a.length;c < e;c++) { + ("bold" === a[c] || "italic" === a[c] || -1 < a[c].indexOf("px")) && d.push(a[c]); + } + this.setFont(d.join(" ") + " " + b); }; -p.resize = function() { - document.getElementById("entryContainerWorkspaceId"); - var a = document.getElementById("doneProjectframe"), b = this.doneContainer.offsetWidth; - a.width = b + "px"; - a.height = 9 * b / 16 + "px"; +Entry.EntityObject.prototype.getFontName = function() { + if ("textBox" == this.type) { + if (!this.font) { + return ""; + } + for (var b = this.font.split(" "), a = [], d = 0, c = b.length;d < c;d++) { + "bold" !== b[d] && "italic" !== b[d] && -1 === b[d].indexOf("px") && a.push(b[d]); + } + return a.join(" ").trim(); + } }; -Entry.Engine = function() { - function a(b) { - var a = b.keyCode || b.which, d = Entry.stage.inputField; - 32 == a && d && d.hasFocus() || -1 < [37, 38, 39, 40, 32].indexOf(a) && b.preventDefault(); +Entry.EntityObject.prototype.setText = function(b) { + "textBox" == this.parent.objectType && (void 0 === b && (b = ""), this.text = b, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); +}; +Entry.EntityObject.prototype.getText = function() { + return this.text; +}; +Entry.EntityObject.prototype.setTextAlign = function(b) { + "textBox" == this.parent.objectType && (void 0 === b && (b = Entry.TEXT_ALIGN_CENTER), this.textAlign = b, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); +}; +Entry.EntityObject.prototype.getTextAlign = function() { + return this.textAlign; +}; +Entry.EntityObject.prototype.setLineBreak = function(b) { + if ("textBox" == this.parent.objectType) { + void 0 === b && (b = !1); + var a = this.lineBreak; + this.lineBreak = b; + a && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !a && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); + Entry.stage.updateObject(); } - this.state = "stop"; - this.popup = null; - this.isUpdating = !0; - this.speeds = [1, 15, 30, 45, 60]; - this._mouseMoved = !1; - Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); - Entry.addEventListener("canvasClick", function(b) { - Entry.engine.fireEvent("mouse_clicked"); - }); - Entry.addEventListener("canvasClickCanceled", function(b) { - Entry.engine.fireEvent("mouse_click_cancled"); - }); - Entry.addEventListener("entityClick", function(b) { - Entry.engine.fireEventOnEntity("when_object_click", b); - }); - Entry.addEventListener("entityClickCanceled", function(b) { - Entry.engine.fireEventOnEntity("when_object_click_canceled", b); - }); - "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(b) { - this._mouseMoved = !0; - }.bind(this)), Entry.addEventListener("stageMouseOut", function(b) { - Entry.engine.hideMouseView(); - })); - Entry.addEventListener("run", function() { - $(window).bind("keydown", a); - }); - Entry.addEventListener("stop", function() { - $(window).unbind("keydown", a); +}; +Entry.EntityObject.prototype.getLineBreak = function() { + return this.lineBreak; +}; +Entry.EntityObject.prototype.setVisible = function(b) { + void 0 === b && (b = !0); + this.visible = b; + this.object.visible = this.visible; + this.dialog && this.syncDialogVisible(); + Entry.requestUpdate = !0; + return this.visible; +}; +Entry.EntityObject.prototype.getVisible = function() { + return this.visible; +}; +Entry.EntityObject.prototype.setImage = function(b) { + var a = this; + delete b._id; + Entry.assert("sprite" == this.type, "Set image is only for sprite object"); + b.id || (b.id = Entry.generateHash()); + this.picture = b; + var d = this.picture.dimension, c = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; + this.setWidth(d.width); + this.setHeight(d.height); + d.scaleX || (d.scaleX = this.getScaleX(), d.scaleY = this.getScaleY()); + this.setScaleX(this.scaleX); + this.setScaleY(this.scaleY); + this.setRegX(this.width / 2 + c); + this.setRegY(this.height / 2 + e); + var f = b.id + this.id, g = Entry.container.getCachedPicture(f); + g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, b.fileurl ? g.src = b.fileurl : (b = b.filename, g.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"), this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight()), g.onload = function(b) { + Entry.container.cachePicture(f, g); + Entry.image = g; + a.object.image = g; + a.object.cache(0, 0, a.getWidth(), a.getHeight()); + Entry.requestUpdate = !0; }); - setInterval(function() { - this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); - }.bind(this), 100); + Entry.dispatchEvent("updateObject"); }; -Entry.Engine.prototype.generateView = function(a, b) { - if (b && "workspace" != b) { - "minimize" == b ? (this.view_ = a, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { - Entry.engine.toggleFullscreen(); - }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(b) { - this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); - Entry.stage.toggleCoordinator(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { - this.blur(); - Entry.engine.toggleStop(); - }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(b) { - this.blur(); - Entry.engine.togglePause(); - }), this.mouseView = Entry.createElement("div"), this.mouseView.addClass("entryMouseViewMinimize"), this.mouseView.addClass("entryRemove"), this.view_.appendChild(this.mouseView), Entry.addEventListener("loadComplete", function() { - this.runButton = Entry.Dom("div", {class:"entryRunButtonBigMinimize", parent:$("#entryCanvasWrapper")}); - this.runButton.bindOnClick(function(b) { - Entry.engine.toggleRun(); - }); - }.bind(this))) : "phone" == b && (this.view_ = a, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { - Entry.engine.footerView_.addClass("entryRemove"); - Entry.engine.headerView_.addClass("entryRemove"); - Entry.launchFullScreen(Entry.engine.view_); - }), document.addEventListener("fullscreenchange", function(b) { - Entry.engine.exitFullScreen(); - }), document.addEventListener("webkitfullscreenchange", function(b) { - Entry.engine.exitFullScreen(); - }), document.addEventListener("mozfullscreenchange", function(b) { - Entry.engine.exitFullScreen(); - }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(b) { - Entry.engine.toggleRun(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { - Entry.engine.toggleStop(); - })); - } else { - this.view_ = a; - this.view_.addClass("entryEngine_w"); - this.view_.addClass("entryEngineWorkspace_w"); - var c = Entry.createElement("button"); - this.speedButton = c; - this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); - this.view_.appendChild(this.speedButton); - this.speedButton.bindOnClick(function(b) { - Entry.engine.toggleSpeedPanel(); - c.blur(); - }); - this.maximizeButton = Entry.createElement("button"); - this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); - this.view_.appendChild(this.maximizeButton); - this.maximizeButton.bindOnClick(function(b) { - Entry.engine.toggleFullscreen(); - this.blur(); - }); - var d = Entry.createElement("button"); - this.coordinateButton = d; - this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); - this.view_.appendChild(this.coordinateButton); - this.coordinateButton.bindOnClick(function(b) { - this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); - d.blur(); - this.blur(); - Entry.stage.toggleCoordinator(); - }); - this.addButton = Entry.createElement("button"); - this.addButton.addClass("entryEngineButtonWorkspace_w"); - this.addButton.addClass("entryAddButtonWorkspace_w"); - this.addButton.innerHTML = Lang.Workspace.add_object; - this.addButton.bindOnClick(function(b) { - Entry.dispatchEvent("openSpriteManager"); - this.blur(); - }); - this.view_.appendChild(this.addButton); - this.runButton = Entry.createElement("button"); - this.runButton.addClass("entryEngineButtonWorkspace_w"); - this.runButton.addClass("entryRunButtonWorkspace_w"); - this.runButton.innerHTML = Lang.Workspace.run; - this.view_.appendChild(this.runButton); - this.runButton.bindOnClick(function(b) { - Entry.engine.toggleRun(); - this.blur(); - }); - this.runButton2 = Entry.createElement("button"); - this.runButton2.addClass("entryEngineButtonWorkspace_w"); - this.runButton2.addClass("entryRunButtonWorkspace_w2"); - this.view_.appendChild(this.runButton2); - this.runButton2.bindOnClick(function(b) { - this.blur(); - Entry.engine.toggleRun(); - }); - this.stopButton = Entry.createElement("button"); - this.stopButton.addClass("entryEngineButtonWorkspace_w"); - this.stopButton.addClass("entryStopButtonWorkspace_w"); - this.stopButton.addClass("entryRemove"); - this.stopButton.innerHTML = Lang.Workspace.stop; - this.view_.appendChild(this.stopButton); - this.stopButton.bindOnClick(function(b) { - this.blur(); - Entry.engine.toggleStop(); - }); - this.stopButton2 = Entry.createElement("button"); - this.stopButton2.addClass("entryEngineButtonWorkspace_w"); - this.stopButton2.addClass("entryStopButtonWorkspace_w2"); - this.stopButton2.addClass("entryRemove"); - this.stopButton2.innerHTML = Lang.Workspace.stop; - this.view_.appendChild(this.stopButton2); - this.stopButton2.bindOnClick(function(b) { - this.blur(); - Entry.engine.toggleStop(); - }); - this.pauseButton = Entry.createElement("button"); - this.pauseButton.addClass("entryEngineButtonWorkspace_w"); - this.pauseButton.addClass("entryPauseButtonWorkspace_w"); - this.pauseButton.addClass("entryRemove"); - this.view_.appendChild(this.pauseButton); - this.pauseButton.bindOnClick(function(b) { - this.blur(); - Entry.engine.togglePause(); - }); - this.mouseView = Entry.createElement("div"); - this.mouseView.addClass("entryMouseViewWorkspace_w"); - this.mouseView.addClass("entryRemove"); - this.view_.appendChild(this.mouseView); - } -}; -Entry.Engine.prototype.toggleSpeedPanel = function() { - if (this.speedPanelOn) { - this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(b) { - $(this).remove(); - delete this.speedProgress_; - }), $(this.speedHandle_).remove(), delete this.speedHandle_; - } else { - this.speedPanelOn = !0; - $(Entry.stage.canvas.canvas).animate({top:"41px"}); - this.coordinateButton.addClass("entryRemove"); - this.maximizeButton.addClass("entryRemove"); - this.mouseView.addClass("entryRemoveElement"); - this.speedLabel_ = Entry.createElement("div", "entrySpeedLabelWorkspace"); - this.speedLabel_.innerHTML = Lang.Workspace.speed; - this.view_.insertBefore(this.speedLabel_, this.maximizeButton); - this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); - for (var a = Entry.createElement("tr"), b = this.speeds, c = 0;5 > c;c++) { - (function(c) { - var d = Entry.createElement("td", "progressCell" + c); - d.bindOnClick(function() { - Entry.engine.setSpeedMeter(b[c]); - }); - a.appendChild(d); - })(c); - } - this.view_.insertBefore(this.speedProgress_, this.maximizeButton); - this.speedProgress_.appendChild(a); - this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); - var d = (Entry.interfaceState.canvasWidth - 84) / 5; - $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(b) { - function a(b) { - b.stopPropagation(); - b = Entry.Utils.convertMouseEvent(b); - b = Math.floor((b.clientX - 80) / (5 * d) * 5); - 0 > b || 4 < b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); - } - function c(b) { - $(document).unbind(".speedPanel"); - } - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - Entry.Utils.convertMouseEvent(b), b = $(document), b.bind("mousemove.speedPanel touchmove.speedPanel", a), b.bind("mouseup.speedPanel touchend.speedPanel", c); +Entry.EntityObject.prototype.applyFilter = function(b) { + function a(a, b) { + for (var d in a) { + if (a[d] !== b[d]) { + return !1; } - }); - this.view_.insertBefore(this.speedHandle_, this.maximizeButton); - this.setSpeedMeter(Entry.FPS); + } + return !0; + } + var d = this.effect, c = this.object; + if (b || !a(d, this.getInitialEffectValue())) { + (function(a, b) { + var d = [], c = Entry.adjustValueWithMaxMin; + a.brightness = a.brightness; + var k = new createjs.ColorMatrix; + k.adjustColor(c(a.brightness, -100, 100), 0, 0, 0); + k = new createjs.ColorMatrixFilter(k); + d.push(k); + a.hue = a.hue.mod(360); + k = new createjs.ColorMatrix; + k.adjustColor(0, 0, 0, a.hue); + k = new createjs.ColorMatrixFilter(k); + d.push(k); + var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * a.hsv * Math.PI / 180, m = Math.cos(l), l = Math.sin(l), n = Math.abs(a.hsv / 100); + 1 < n && (n -= Math.floor(n)); + 0 < n && .33 >= n ? k = [1, 0, 0, 0, 0, 0, m, l, 0, 0, 0, -1 * l, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= n ? k = [m, 0, l, 0, 0, 0, 1, 0, 0, 0, l, 0, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= n && (k = [m, l, 0, 0, 0, -1 * l, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); + k = (new createjs.ColorMatrix).concat(k); + k = new createjs.ColorMatrixFilter(k); + d.push(k); + b.alpha = a.alpha = c(a.alpha, 0, 1); + b.filters = d; + })(d, c), c.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; } }; -Entry.Engine.prototype.setSpeedMeter = function(a) { - var b = this.speeds.indexOf(a); - 0 > b || (b = Math.min(4, b), b = Math.max(0, b), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * b + 1) + 80 - 9 + "px"), Entry.FPS != a && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / a)), Entry.FPS = a)); +Entry.EntityObject.prototype.resetFilter = function() { + "sprite" == this.parent.objectType && (this.object.filters = [], this.setInitialEffectValue(), this.object.alpha = this.effect.alpha, this.object.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0); }; -Entry.Engine.prototype.start = function(a) { - createjs.Ticker.setFPS(Entry.FPS); - this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS)); +Entry.EntityObject.prototype.updateDialog = function() { + this.dialog && this.dialog.update(); + Entry.requestUpdate = !0; }; -Entry.Engine.prototype.stop = function() { - clearInterval(this.ticker); - this.ticker = null; +Entry.EntityObject.prototype.takeSnapshot = function() { + this.snapshot_ = this.toJSON(); + this.collision = Entry.Utils.COLLISION.NONE; }; -Entry.Engine.prototype.update = function() { - Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update()); +Entry.EntityObject.prototype.loadSnapshot = function() { + this.snapshot_ && this.syncModel_(this.snapshot_); + "sprite" == this.parent.objectType && this.setImage(this.parent.getPicture()); + Entry.requestUpdate = !0; }; -Entry.Engine.prototype.computeObjects = function() { - Entry.container.mapObjectOnScene(this.computeFunction); +Entry.EntityObject.prototype.removeClone = function() { + if (this.isClone) { + this.dialog && this.dialog.remove(); + this.brush && this.removeBrush(); + Entry.stage.unloadEntity(this); + var b = this.parent.clonedEntities.indexOf(this); + this.parent.clonedEntities.splice(b, 1); + Entry.Utils.isFunction(this.clearExecutor) && this.clearExecutor(); + } }; -Entry.Engine.prototype.computeFunction = function(a) { - a.script.tick(); +Entry.EntityObject.prototype.clearExecutor = function() { + this.parent.script.clearExecutorsByEntity(this); }; -Entry.Engine.computeThread = function(a, b) { - Entry.engine.isContinue = !0; - for (a = !1;b && Entry.engine.isContinue && !a;) { - Entry.engine.isContinue = !b.isRepeat; - var c = b.run(); - a = c && c === b; - b = c; - } +Entry.EntityObject.prototype.toJSON = function() { + var b = {}; + b.x = Entry.cutDecimal(this.getX()); + b.y = Entry.cutDecimal(this.getY()); + b.regX = Entry.cutDecimal(this.getRegX()); + b.regY = Entry.cutDecimal(this.getRegY()); + b.scaleX = this.getScaleX(); + b.scaleY = this.getScaleY(); + b.rotation = Entry.cutDecimal(this.getRotation()); + b.direction = Entry.cutDecimal(this.getDirection()); + b.width = Entry.cutDecimal(this.getWidth()); + b.height = Entry.cutDecimal(this.getHeight()); + b.font = this.getFont(); + b.visible = this.getVisible(); + "textBox" == this.parent.objectType && (b.colour = this.getColour(), b.text = this.getText(), b.textAlign = this.getTextAlign(), b.lineBreak = this.getLineBreak(), b.bgColor = this.getBGColour(), b.underLine = this.getUnderLine(), b.strike = this.getStrike(), b.fontSize = this.getFontSize()); return b; }; -Entry.Engine.prototype.isState = function(a) { - return -1 < this.state.indexOf(a); +Entry.EntityObject.prototype.setInitialEffectValue = function() { + this.effect = this.getInitialEffectValue(); + Entry.requestUpdate = !0; }; -Entry.Engine.prototype.run = function() { - this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun(); +Entry.EntityObject.prototype.getInitialEffectValue = function() { + return {blur:0, hue:0, hsv:0, brightness:0, contrast:0, saturation:0, alpha:1}; }; -Entry.Engine.prototype.toggleRun = function() { - if ("pause" === this.state) { - this.togglePause(); - } else { - if (Entry.playground && Entry.playground.mainWorkspace) { - var a = Entry.playground.mainWorkspace, b = a.mode; - b == Entry.Workspace.MODE_VIMBOARD && a.loadCodeFromText(b); +Entry.EntityObject.prototype.removeBrush = function() { + Entry.stage.selectedObjectContainer.removeChild(this.shape); + this.shape = this.brush = null; +}; +Entry.EntityObject.prototype.updateBG = function() { + if (this.bgObject) { + this.bgObject.graphics.clear(); + var b = this.getWidth(), a = this.getHeight(); + this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b / 2, -a / 2, b, a); + if (this.getLineBreak()) { + this.bgObject.x = 0; + } else { + switch(this.getTextAlign()) { + case Entry.TEXT_ALIGN_LEFT: + this.bgObject.x = b / 2; + break; + case Entry.TEXT_ALIGN_CENTER: + this.bgObject.x = 0; + break; + case Entry.TEXT_ALIGN_RIGHT: + this.bgObject.x = -b / 2; + } } - Entry.addActivity("run"); - "stop" == this.state && (Entry.container.mapEntity(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapVariable(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapList(function(b) { - b.takeSnapshot(); - }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")); - this.state = "run"; - "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"); - this.pauseButton.innerHTML = Lang.Workspace.pause; - this.runButton.addClass("run"); - this.runButton.addClass("entryRemove"); - this.stopButton.removeClass("entryRemove"); - this.pauseButton && this.pauseButton.removeClass("entryRemove"); - this.runButton2 && this.runButton2.addClass("entryRemove"); - this.stopButton2 && this.stopButton2.removeClass("entryRemove"); - this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0); - Entry.stage.selectObject(); - Entry.dispatchEvent("run"); } }; -Entry.Engine.prototype.toggleStop = function() { - Entry.addActivity("stop"); - var a = Entry.container, b = Entry.variableContainer; - a.mapEntity(function(b) { - b.loadSnapshot(); - b.object.filters = []; - b.resetFilter(); - b.dialog && b.dialog.remove(); - b.brush && b.removeBrush(); - }); - b.mapVariable(function(b) { - b.loadSnapshot(); - }); - b.mapList(function(b) { - b.loadSnapshot(); - b.updateView(); - }); - this.stopProjectTimer(); - a.clearRunningState(); - a.loadSequenceSnapshot(); - this.projectTimer.loadSnapshot(); - Entry.container.inputValue.loadSnapshot(); - Entry.scene.loadStartSceneSnapshot(); - Entry.Func.clearThreads(); - createjs.Sound.setVolume(1); - createjs.Sound.stop(); - this.view_.removeClass("entryEngineBlueWorkspace"); - this.runButton.removeClass("entryRemove"); - this.stopButton.addClass("entryRemove"); - this.pauseButton && this.pauseButton.addClass("entryRemove"); - this.runButton2 && this.runButton2.removeClass("entryRemove"); - this.stopButton2 && this.stopButton2.addClass("entryRemove"); - this.state = "stop"; - Entry.dispatchEvent("stop"); - Entry.stage.hideInputField(); +Entry.EntityObject.prototype.alignTextBox = function() { + if ("textBox" == this.type) { + var b = this.textObject; + if (this.lineBreak) { + var a = b.getMeasuredLineHeight(); + b.y = a / 2 - this.getHeight() / 2; + switch(this.textAlign) { + case Entry.TEXT_ALIGN_CENTER: + b.x = 0; + break; + case Entry.TEXT_ALIGN_LEFT: + b.x = -this.getWidth() / 2; + break; + case Entry.TEXT_ALIGN_RIGHT: + b.x = this.getWidth() / 2; + } + b.maxHeight = this.getHeight(); + } else { + b.x = 0, b.y = 0; + } + } }; -Entry.Engine.prototype.togglePause = function() { - var a = Entry.engine.projectTimer; - "pause" == this.state ? (a.pausedTime += (new Date).getTime() - a.pauseStart, a.isPaused ? a.pauseStart = (new Date).getTime() : delete a.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", a.isPaused && (a.pausedTime += (new Date).getTime() - a.pauseStart), a.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, - this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); +Entry.EntityObject.prototype.syncDialogVisible = function() { + this.dialog && (this.dialog.object.visible = this.visible); }; -Entry.Engine.prototype.fireEvent = function(a) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, a); +Entry.Helper = function() { + this.visible = !1; }; -Entry.Engine.prototype.raiseEvent = function(a, b) { - a.parent.script.raiseEvent(b, a); +p = Entry.Helper.prototype; +p.generateView = function(b, a) { + if (!this.parentView_) { + this.parentView_ = b; + this.blockHelpData = EntryStatic.blockInfo; + var d = Entry.createElement("div", "entryBlockHelperWorkspace"); + this.view = d; + Entry.isForLecture && d.addClass("lecture"); + this.parentView_.appendChild(d); + var c = Entry.createElement("div", "entryBlockHelperContentWorkspace"); + c.addClass("entryBlockHelperIntro"); + Entry.isForLecture && c.addClass("lecture"); + d.appendChild(c); + this.blockHelperContent_ = c; + this.blockHelperView_ = d; + d = Entry.createElement("div", "entryBlockHelperBlockWorkspace"); + this.blockHelperContent_.appendChild(d); + c = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"); + this.blockHelperContent_.appendChild(c); + c.innerHTML = Lang.Helper.Block_click_msg; + this.blockHelperDescription_ = c; + this._renderView = new Entry.RenderView($(d), "LEFT"); + this.code = new Entry.Code([]); + this._renderView.changeCode(this.code); + this.first = !0; + } +}; +p.bindWorkspace = function(b) { + b && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = b, this._blockViewObserver = b.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); }; -Entry.Engine.prototype.fireEventOnEntity = function(a, b) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [b, a]); +p._updateSelectedBlock = function() { + var b = this.workspace.selectedBlockView; + if (b && this.visible && b != this._blockView) { + var a = b.block.type; + this._blockView = b; + this.renderBlock(a); + } }; -Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { - a === b[0] && a.parent.script.raiseEvent(b[1], a); +p.renderBlock = function(b) { + var a = Lang.Helper[b]; + if (b && this.visible && a && !Entry.block[b].isPrimitive) { + this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); + this.code.clear(); + var d = Entry.block[b].def, d = d || {type:b}; + this.code.createThread([d]); + this.code.board.align(); + this.code.board.resize(); + var d = this.code.getThreads()[0].getFirstBlock().view, c = d.svgGroup.getBBox(); + b = c.width; + c = c.height; + d = d.getSkeleton().box(d).offsetX; + isNaN(d) && (d = 0); + this.blockHelperDescription_.innerHTML = a; + this._renderView.align(); + $(this.blockHelperDescription_).css({top:c + 30}); + this._renderView.svgDom.css({"margin-left":-(b / 2) - 20 - d}); + } }; -Entry.Engine.prototype.captureKeyEvent = function(a) { - var b = a.keyCode, c = Entry.type; - a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); - Entry.engine.isState("stop") && "workspace" === c && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); +p.getView = function() { + return this.view; }; -Entry.Engine.prototype.raiseKeyEvent = function(a, b) { - return a.parent.script.raiseEvent(b[0], a, String(b[1])); -}; -Entry.Engine.prototype.updateMouseView = function() { - var a = Entry.stage.mouseCoordinate; - this.mouseView.textContent = "X : " + a.x + ", Y : " + a.y; - this.mouseView.removeClass("entryRemove"); -}; -Entry.Engine.prototype.hideMouseView = function() { - this.mouseView.addClass("entryRemove"); +p.resize = function() { }; -Entry.Engine.prototype.toggleFullscreen = function() { - if (this.popup) { - this.popup.remove(), this.popup = null; - } else { - this.popup = new Entry.Popup; - if ("workspace" != Entry.type) { - var a = $(document); - $(this.popup.body_).css("top", a.scrollTop()); - $("body").css("overflow", "hidden"); - popup.window_.appendChild(Entry.stage.canvas.canvas); - popup.window_.appendChild(Entry.engine.runButton[0]); +Entry.Activity = function(b, a) { + this.name = b; + this.timestamp = new Date; + var d = []; + if (void 0 !== a) { + for (var c = 0, e = a.length;c < e;c++) { + var f = a[c]; + d.push({key:f[0], value:f[1]}); } - popup.window_.appendChild(Entry.engine.view_); } - Entry.windowResized.notify(); -}; -Entry.Engine.prototype.exitFullScreen = function() { - document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove")); - Entry.windowResized.notify(); + this.data = d; }; -Entry.Engine.prototype.showProjectTimer = function() { - Entry.engine.projectTimer && this.projectTimer.setVisible(!0); +Entry.ActivityReporter = function() { + this._activities = []; }; -Entry.Engine.prototype.hideProjectTimer = function() { - var a = this.projectTimer; - if (a && a.isVisible() && !this.isState("run")) { - for (var b = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = b.length;d < e;d++) { - for (var f = b[d].script, g = 0;g < c.length;g++) { - if (f.hasBlockType(c[g])) { - return; - } +(function(b) { + b.add = function(a) { + if (a && 0 !== a.length) { + if (!(a instanceof Entry.Activity)) { + var b = a.shift(); + a = new Entry.Activity(b, a); } + this._activities.push(a); } - a.setVisible(!1); - } -}; -Entry.Engine.prototype.clearTimer = function() { - clearInterval(this.ticker); - clearInterval(this.projectTimer.tick); -}; -Entry.Engine.prototype.startProjectTimer = function() { - var a = this.projectTimer; - a && (a.start = (new Date).getTime(), a.isInit = !0, a.pausedTime = 0, a.tick = setInterval(function(b) { - Entry.engine.updateProjectTimer(); - }, 1E3 / 60)); -}; -Entry.Engine.prototype.stopProjectTimer = function() { - var a = this.projectTimer; - a && (this.updateProjectTimer(0), a.isPaused = !1, a.isInit = !1, a.pausedTime = 0, clearInterval(a.tick)); + }; + b.clear = function() { + this._activities = []; + }; + b.get = function() { + return this._activities; + }; + b.report = function() { + }; +})(Entry.ActivityReporter.prototype); +Entry.State = function(b, a, d, c) { + this.caller = a; + this.func = d; + 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); + this.message = b; + this.time = Entry.getUpTime(); + this.isPass = Entry.Command[b] ? Entry.Command[b].isPass : !1; }; -Entry.Engine.prototype.updateProjectTimer = function(a) { - var b = Entry.engine, c = b.projectTimer; - if (c) { - var d = (new Date).getTime(); - "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); - } +Entry.State.prototype.generateMessage = function() { }; -Entry.EntityObject = function(a) { - this.parent = a; - this.type = a.objectType; - this.flip = !1; - this.collision = Entry.Utils.COLLISION.NONE; - this.id = Entry.generateHash(); - "sprite" == this.type ? (this.object = new createjs.Bitmap, this.effect = {}, this.setInitialEffectValue()) : "textBox" == this.type && (this.object = new createjs.Container, this.textObject = new createjs.Text, this.textObject.font = "20px Nanum Gothic", this.textObject.textBaseline = "middle", this.textObject.textAlign = "center", this.bgObject = new createjs.Shape, this.bgObject.graphics.setStrokeStyle(1).beginStroke("#f00").drawRect(0, 0, 100, 100), this.object.addChild(this.bgObject), this.object.addChild(this.textObject), - this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); - this.object.entity = this; - this.object.cursor = "pointer"; - this.object.on("mousedown", function(b) { - var a = this.entity.parent.id; - Entry.dispatchEvent("entityClick", this.entity); - Entry.stage.isObjectClick = !0; - "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * b.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * b.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(a)); +Entry.StateManager = function() { + this.undoStack_ = []; + this.redoStack_ = []; + this.isIgnore = this.isRestore = !1; + Entry.addEventListener("cancelLastCommand", function(b) { + Entry.stateManager.cancelLastCommand(); }); - this.object.on("pressup", function(b) { - Entry.dispatchEvent("entityClickCanceled", this.entity); - this.cursor = "pointer"; - this.entity.checkCommand(); + Entry.addEventListener("run", function(b) { + Entry.stateManager.updateView(); }); - this.object.on("pressmove", function(b) { - "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * b.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * b.stageY - 135) - this.offset.y), Entry.stage.updateObject()); + Entry.addEventListener("stop", function(b) { + Entry.stateManager.updateView(); + }); + Entry.addEventListener("saveWorkspace", function(b) { + Entry.stateManager.addStamp(); + }); + Entry.addEventListener("undo", function(b) { + Entry.stateManager.undo(); + }); + Entry.addEventListener("redo", function(b) { + Entry.stateManager.redo(); }); }; -Entry.EntityObject.prototype.injectModel = function(a, b) { - "sprite" == this.type ? this.setImage(a) : "textBox" == this.type && (a = this.parent, b.text = b.text || a.text || a.name, this.setFont(b.font), this.setBGColour(b.bgColor), this.setColour(b.colour), this.setUnderLine(b.underLine), this.setStrike(b.strike), this.setText(b.text)); - b && this.syncModel_(b); -}; -Entry.EntityObject.prototype.syncModel_ = function(a) { - this.setX(a.x); - this.setY(a.y); - this.setRegX(a.regX); - this.setRegY(a.regY); - this.setScaleX(a.scaleX); - this.setScaleY(a.scaleY); - this.setRotation(a.rotation); - this.setDirection(a.direction, !0); - this.setLineBreak(a.lineBreak); - this.setWidth(a.width); - this.setHeight(a.height); - this.setText(a.text); - this.setTextAlign(a.textAlign); - this.setFontSize(a.fontSize || this.getFontSize()); - this.setVisible(a.visible); -}; -Entry.EntityObject.prototype.initCommand = function() { - Entry.engine.isState("stop") && (this.isCommandValid = !1, Entry.stateManager && Entry.stateManager.addCommand("edit entity", this, this.restoreEntity, this.toJSON())); -}; -Entry.EntityObject.prototype.doCommand = function() { - this.isCommandValid = !0; -}; -Entry.EntityObject.prototype.checkCommand = function() { - Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand"); -}; -Entry.EntityObject.prototype.restoreEntity = function(a) { - var b = this.toJSON(); - this.syncModel_(a); - Entry.dispatchEvent("updateObject"); - Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, b); -}; -Entry.EntityObject.prototype.setX = function(a) { - "number" == typeof a && (this.x = a, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); -}; -Entry.EntityObject.prototype.getX = function() { - return this.x; -}; -Entry.EntityObject.prototype.setY = function(a) { - "number" == typeof a && (this.y = a, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); -}; -Entry.EntityObject.prototype.getY = function() { - return this.y; -}; -Entry.EntityObject.prototype.getDirection = function() { - return this.direction; -}; -Entry.EntityObject.prototype.setDirection = function(a, b) { - a || (a = 0); - "vertical" != this.parent.getRotateMethod() || b || (0 <= this.direction && 180 > this.direction) == (0 <= a && 180 > a) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); - this.direction = a.mod(360); - this.object.direction = this.direction; - this.isClone || this.parent.updateRotationView(); - Entry.dispatchEvent("updateObject"); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.setRotation = function(a) { - "free" != this.parent.getRotateMethod() && (a = 0); - this.rotation = a.mod(360); - this.object.rotation = this.rotation; - this.updateDialog(); - this.isClone || this.parent.updateRotationView(); - Entry.dispatchEvent("updateObject"); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.getRotation = function() { - return this.rotation; -}; -Entry.EntityObject.prototype.setRegX = function(a) { - "textBox" == this.type && (a = 0); - this.regX = a; - this.object.regX = this.regX; - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.getRegX = function() { - return this.regX; -}; -Entry.EntityObject.prototype.setRegY = function(a) { - "textBox" == this.type && (a = 0); - this.regY = a; - this.object.regY = this.regY; - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.getRegY = function() { - return this.regY; +Entry.StateManager.prototype.generateView = function(b, a) { }; -Entry.EntityObject.prototype.setScaleX = function(a) { - this.scaleX = a; - this.object.scaleX = this.scaleX; - this.parent.updateCoordinateView(); - this.updateDialog(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.addCommand = function(b, a, d, c) { + if (!this.isIgnoring()) { + if (this.isRestoring()) { + var e = new Entry.State, f = Array.prototype.slice.call(arguments); + Entry.State.prototype.constructor.apply(e, f); + this.redoStack_.push(e); + Entry.reporter && Entry.reporter.report(e); + } else { + e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); + } + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } }; -Entry.EntityObject.prototype.getScaleX = function() { - return this.scaleX; +Entry.StateManager.prototype.cancelLastCommand = function() { + this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); }; -Entry.EntityObject.prototype.setScaleY = function(a) { - this.scaleY = a; - this.object.scaleY = this.scaleY; - this.parent.updateCoordinateView(); - this.updateDialog(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.getLastCommand = function() { + return this.undoStack_[this.undoStack_.length - 1]; }; -Entry.EntityObject.prototype.getScaleY = function() { - return this.scaleY; +Entry.StateManager.prototype.undo = function() { + if (this.canUndo() && !this.isRestoring()) { + this.addActivity("undo"); + for (this.startRestore();this.undoStack_.length;) { + var b = this.undoStack_.pop(); + b.func.apply(b.caller, b.params); + if (!0 !== b.isPass) { + break; + } + } + this.updateView(); + this.endRestore(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } }; -Entry.EntityObject.prototype.setSize = function(a) { - 1 > a && (a = 1); - a /= this.getSize(); - this.setScaleX(this.getScaleX() * a); - this.setScaleY(this.getScaleY() * a); - this.isClone || this.parent.updateCoordinateView(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.redo = function() { + if (this.canRedo() && !this.isRestoring()) { + for (this.addActivity("redo");this.redoStack_.length;) { + var b = this.redoStack_.pop(); + b.func.apply(b.caller, b.params); + if (!0 !== b.isPass) { + break; + } + } + this.updateView(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } }; -Entry.EntityObject.prototype.getSize = function() { - return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2; +Entry.StateManager.prototype.updateView = function() { + this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); }; -Entry.EntityObject.prototype.setWidth = function(a) { - this.width = a; - this.object.width = this.width; - this.textObject && this.getLineBreak() && (this.textObject.lineWidth = this.width); - this.updateDialog(); - this.updateBG(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.startRestore = function() { + this.isRestore = !0; }; -Entry.EntityObject.prototype.getWidth = function() { - return this.width; +Entry.StateManager.prototype.endRestore = function() { + this.isRestore = !1; }; -Entry.EntityObject.prototype.setHeight = function(a) { - this.height = a; - this.textObject && (this.object.height = this.height, this.alignTextBox()); - this.updateDialog(); - this.updateBG(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.isRestoring = function() { + return this.isRestore; }; -Entry.EntityObject.prototype.getHeight = function() { - return this.height; +Entry.StateManager.prototype.startIgnore = function() { + this.isIgnore = !0; }; -Entry.EntityObject.prototype.setColour = function(a) { - a || (a = "#000000"); - this.colour = a; - this.textObject && (this.textObject.color = this.colour); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.endIgnore = function() { + this.isIgnore = !1; }; -Entry.EntityObject.prototype.getColour = function() { - return this.colour; +Entry.StateManager.prototype.isIgnoring = function() { + return this.isIgnore; }; -Entry.EntityObject.prototype.setBGColour = function(a) { - a || (a = "transparent"); - this.bgColor = a; - this.updateBG(); - Entry.requestUpdate = !0; +Entry.StateManager.prototype.canUndo = function() { + return 0 < this.undoStack_.length && Entry.engine.isState("stop"); }; -Entry.EntityObject.prototype.getBGColour = function() { - return this.bgColor; +Entry.StateManager.prototype.canRedo = function() { + return 0 < this.redoStack_.length && Entry.engine.isState("stop"); }; -Entry.EntityObject.prototype.setUnderLine = function(a) { - void 0 === a && (a = !1); - this.underLine = a; - this.textObject.underLine = a; - Entry.requestUpdate = !0; +Entry.StateManager.prototype.addStamp = function() { + this.stamp = Entry.generateHash(); + this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); }; -Entry.EntityObject.prototype.getUnderLine = function() { - return this.underLine; +Entry.StateManager.prototype.isSaved = function() { + return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; }; -Entry.EntityObject.prototype.setStrike = function(a) { - void 0 === a && (a = !1); - this.strike = a; - this.textObject.strike = a; - Entry.requestUpdate = !0; +Entry.StateManager.prototype.addActivity = function(b) { + Entry.reporter && Entry.reporter.report(new Entry.State(b)); }; -Entry.EntityObject.prototype.getStrike = function() { - return this.strike; +Entry.EntryObject = function(b) { + var a = this; + if (b) { + this.id = b.id; + this.name = b.name || b.sprite.name; + this.text = b.text || this.name; + this.objectType = b.objectType; + this.objectType || (this.objectType = "sprite"); + this.script = new Entry.Code(b.script ? b.script : [], this); + this.pictures = b.sprite.pictures; + this.sounds = []; + this.sounds = b.sprite.sounds; + for (var d = 0;d < this.sounds.length;d++) { + this.sounds[d].id || (this.sounds[d].id = Entry.generateHash()), Entry.initSound(this.sounds[d]); + } + this.lock = b.lock ? b.lock : !1; + this.isEditing = !1; + "sprite" == this.objectType && (this.selectedPicture = b.selectedPictureId ? this.getPicture(b.selectedPictureId) : this.pictures[0]); + this.scene = Entry.scene.getSceneById(b.scene) || Entry.scene.selectedScene; + this.setRotateMethod(b.rotateMethod); + this.entity = new Entry.EntityObject(this); + this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, b.entity ? b.entity : this.initEntity(b)); + this.clonedEntities = []; + Entry.stage.loadObject(this); + for (d in this.pictures) { + (function(b) { + b.objectId = this.id; + b.id || (b.id = Entry.generateHash()); + var d = new Image; + if (b.fileurl) { + d.src = b.fileurl; + } else { + if (b.fileurl) { + d.src = b.fileurl; + } else { + var f = b.filename; + d.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png"; + } + } + Entry.Loader.addQueue(); + d.onload = function(d) { + Entry.container.cachePicture(b.id + a.entity.id, this); + Entry.requestUpdate = !0; + Entry.Loader.removeQueue(); + }; + d.onerror = function(a) { + Entry.Loader.removeQueue(); + }; + })(this.pictures[d]); + } + } }; -Entry.EntityObject.prototype.getFont = function() { - var a = []; - this.fontBold && a.push("bold"); - this.fontItalic && a.push("italic"); - a.push(this.getFontSize() + "px"); - a.push(this.fontType); - return a.join(" "); -}; -Entry.EntityObject.prototype.setFont = function(a) { - if ("textBox" == this.parent.objectType && this.font !== a) { - a || (a = "20px Nanum Gothic"); - var b = a.split(" "), c; - if (c = -1 < b.indexOf("bold")) { - b.splice(c - 1, 1), this.setFontBold(!0); - } - if (c = -1 < b.indexOf("italic")) { - b.splice(c - 1, 1), this.setFontItalic(!0); - } - c = parseInt(b.shift()); - this.setFontSize(c); - this.setFontType(b.join(" ")); - this.font = this.getFont(); - this.textObject.font = a; - Entry.stage.update(); - this.setWidth(this.textObject.getMeasuredWidth()); - this.updateBG(); - Entry.stage.updateObject(); +Entry.EntryObject.prototype.generateView = function() { + if ("workspace" == Entry.type) { + var b = Entry.createElement("li", this.id); + b.addClass("entryContainerListElementWorkspace"); + b.object = this; + Entry.Utils.disableContextmenu(b); + var a = this; + longPressTimer = null; + $(b).bind("mousedown touchstart", function(b) { + function d(a) { + a.stopPropagation(); + h && 5 < Math.sqrt(Math.pow(a.pageX - h.x, 2) + Math.pow(a.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + function c(a) { + a.stopPropagation(); + e.unbind(".object"); + longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + var e = $(document), f = b.type, g = !1; + if (Entry.Utils.isRightButton(b)) { + b.stopPropagation(), Entry.documentMousedown.notify(b), g = !0, a._rightClick(b); + } else { + var h = {x:b.clientX, y:b.clientY}; + "touchstart" !== f || g || (b.stopPropagation(), Entry.documentMousedown.notify(b), longPressTimer = setTimeout(function() { + longPressTimer && (longPressTimer = null, a._rightClick(b)); + }, 1E3), e.bind("mousemove.object touchmove.object", d), e.bind("mouseup.object touchend.object", c)); + } + }); + this.view_ = b; + var d = this, b = Entry.createElement("ul"); + b.addClass("objectInfoView"); + Entry.objectEditable || b.addClass("entryHide"); + var c = Entry.createElement("li"); + c.addClass("objectInfo_visible"); + this.entity.getVisible() || c.addClass("objectInfo_unvisible"); + c.bindOnClick(function(a) { + Entry.engine.isState("run") || (a = d.entity, a.setVisible(!a.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); + }); + var e = Entry.createElement("li"); + e.addClass("objectInfo_unlock"); + this.getLock() && e.addClass("objectInfo_lock"); + e.bindOnClick(function(a) { + Entry.engine.isState("run") || (a = d, a.setLock(!a.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), a.updateInputViews(a.getLock())); + }); + b.appendChild(c); + b.appendChild(e); + this.view_.appendChild(b); + b = Entry.createElement("div"); + b.addClass("entryObjectThumbnailWorkspace"); + this.view_.appendChild(b); + this.thumbnailView_ = b; + b = Entry.createElement("div"); + b.addClass("entryObjectWrapperWorkspace"); + this.view_.appendChild(b); + c = Entry.createElement("input"); + c.bindOnClick(function(a) { + a.preventDefault(); + Entry.container.selectObject(d.id); + this.readOnly || (this.focus(), this.select()); + }); + c.addClass("entryObjectNameWorkspace"); + b.appendChild(c); + this.nameView_ = c; + this.nameView_.entryObject = this; + c.setAttribute("readonly", !0); + var f = this; + this.nameView_.onblur = function(a) { + this.entryObject.name = this.value; + Entry.playground.reloadPlayground(); + }; + this.nameView_.onkeypress = function(a) { + 13 == a.keyCode && f.editObjectValues(!1); + }; + this.nameView_.value = this.name; + c = Entry.createElement("div"); + c.addClass("entryObjectEditWorkspace"); + c.object = this; + this.editView_ = c; + this.view_.appendChild(c); + $(c).mousedown(function(b) { + var d = a.isEditing; + b.stopPropagation(); + Entry.documentMousedown.notify(b); + Entry.engine.isState("run") || !1 !== d || (a.editObjectValues(!d), Entry.playground.object !== a && Entry.container.selectObject(a.id), a.nameView_.select()); + }); + c.blur = function(b) { + a.editObjectComplete(); + }; + Entry.objectEditable && Entry.objectDeletable && (c = Entry.createElement("div"), c.addClass("entryObjectDeleteWorkspace"), c.object = this, this.deleteView_ = c, this.view_.appendChild(c), c.bindOnClick(function(a) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })); + c = Entry.createElement("div"); + c.addClass("entryObjectInformationWorkspace"); + c.object = this; + this.isInformationToggle = !1; + b.appendChild(c); + this.informationView_ = c; + b = Entry.createElement("div"); + b.addClass("entryObjectRotationWrapperWorkspace"); + b.object = this; + this.view_.appendChild(b); + c = Entry.createElement("span"); + c.addClass("entryObjectCoordinateWorkspace"); + b.appendChild(c); + e = Entry.createElement("span"); + e.addClass("entryObjectCoordinateSpanWorkspace"); + e.innerHTML = "X:"; + var g = Entry.createElement("input"); + g.addClass("entryObjectCoordinateInputWorkspace"); + g.setAttribute("readonly", !0); + g.bindOnClick(function(a) { + a.stopPropagation(); + this.select(); + }); + var h = Entry.createElement("span"); + h.addClass("entryObjectCoordinateSpanWorkspace"); + h.innerHTML = "Y:"; + var k = Entry.createElement("input"); + k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); + k.bindOnClick(function(a) { + a.stopPropagation(); + this.select(); + }); + k.setAttribute("readonly", !0); + var l = Entry.createElement("span"); + l.addClass("entryObjectCoordinateSizeWorkspace"); + l.innerHTML = Lang.Workspace.Size + " : "; + var m = Entry.createElement("input"); + m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); + m.bindOnClick(function(a) { + a.stopPropagation(); + this.select(); + }); + m.setAttribute("readonly", !0); + c.appendChild(e); + c.appendChild(g); + c.appendChild(h); + c.appendChild(k); + c.appendChild(l); + c.appendChild(m); + c.xInput_ = g; + c.yInput_ = k; + c.sizeInput_ = m; + this.coordinateView_ = c; + d = this; + g.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }; + g.onblur = function(a) { + isNaN(g.value) || d.entity.setX(+g.value); + d.updateCoordinateView(); + Entry.stage.updateObject(); + }; + k.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }; + k.onblur = function(a) { + isNaN(k.value) || d.entity.setY(+k.value); + d.updateCoordinateView(); + Entry.stage.updateObject(); + }; + m.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }; + m.onblur = function(a) { + isNaN(m.value) || d.entity.setSize(+m.value); + d.updateCoordinateView(); + Entry.stage.updateObject(); + }; + c = Entry.createElement("div"); + c.addClass("entryObjectRotateLabelWrapperWorkspace"); + this.view_.appendChild(c); + this.rotateLabelWrapperView_ = c; + e = Entry.createElement("span"); + e.addClass("entryObjectRotateSpanWorkspace"); + e.innerHTML = Lang.Workspace.rotation + " : "; + var n = Entry.createElement("input"); + n.addClass("entryObjectRotateInputWorkspace"); + n.setAttribute("readonly", !0); + n.bindOnClick(function(a) { + a.stopPropagation(); + this.select(); + }); + this.rotateSpan_ = e; + this.rotateInput_ = n; + h = Entry.createElement("span"); + h.addClass("entryObjectDirectionSpanWorkspace"); + h.innerHTML = Lang.Workspace.direction + " : "; + var q = Entry.createElement("input"); + q.addClass("entryObjectDirectionInputWorkspace"); + q.setAttribute("readonly", !0); + q.bindOnClick(function(a) { + a.stopPropagation(); + this.select(); + }); + this.directionInput_ = q; + c.appendChild(e); + c.appendChild(n); + c.appendChild(h); + c.appendChild(q); + c.rotateInput_ = n; + c.directionInput_ = q; + d = this; + n.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }; + n.onblur = function(a) { + a = n.value; + -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); + isNaN(a) || d.entity.setRotation(+a); + d.updateRotationView(); + Entry.stage.updateObject(); + }; + q.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }; + q.onblur = function(a) { + a = q.value; + -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); + isNaN(a) || d.entity.setDirection(+a); + d.updateRotationView(); + Entry.stage.updateObject(); + }; + c = Entry.createElement("div"); + c.addClass("rotationMethodWrapper"); + b.appendChild(c); + this.rotationMethodWrapper_ = c; + b = Entry.createElement("span"); + b.addClass("entryObjectRotateMethodLabelWorkspace"); + c.appendChild(b); + b.innerHTML = Lang.Workspace.rotate_method + " : "; + b = Entry.createElement("div"); + b.addClass("entryObjectRotateModeWorkspace"); + b.addClass("entryObjectRotateModeAWorkspace"); + b.object = this; + this.rotateModeAView_ = b; + c.appendChild(b); + b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); + }); + b = Entry.createElement("div"); + b.addClass("entryObjectRotateModeWorkspace"); + b.addClass("entryObjectRotateModeBWorkspace"); + b.object = this; + this.rotateModeBView_ = b; + c.appendChild(b); + b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); + }); + b = Entry.createElement("div"); + b.addClass("entryObjectRotateModeWorkspace"); + b.addClass("entryObjectRotateModeCWorkspace"); + b.object = this; + this.rotateModeCView_ = b; + c.appendChild(b); + b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); + }); + this.updateThumbnailView(); + this.updateCoordinateView(); + this.updateRotateMethodView(); + this.updateInputViews(); + this.updateCoordinateView(!0); + this.updateRotationView(!0); + return this.view_; } -}; -Entry.EntityObject.prototype.setLineHeight = function() { - switch(this.getFontType()) { - case "Nanum Gothic Coding": - this.textObject.lineHeight = this.fontSize; - break; - default: - this.textObject.lineHeight = 0; + if ("phone" == Entry.type) { + return b = Entry.createElement("li", this.id), b.addClass("entryContainerListElementWorkspace"), b.object = this, b.bindOnClick(function(a) { + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + }), $ && (a = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(a) { + a.preventDefault(); + }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(b) { + b.preventDefault(); + Entry.container.addCloneObject(a); + }}, {text:Lang.Workspace.context_remove, href:"/", action:function(b) { + b.preventDefault(); + Entry.container.removeObject(a); + }}])), this.view_ = b, b = Entry.createElement("ul"), b.addClass("objectInfoView"), c = Entry.createElement("li"), c.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), b.appendChild(c), b.appendChild(e), this.view_.appendChild(b), b = Entry.createElement("div"), b.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(b), this.thumbnailView_ = b, b = Entry.createElement("div"), b.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(b), + c = Entry.createElement("input"), c.addClass("entryObjectNameWorkspace"), b.appendChild(c), this.nameView_ = c, this.nameView_.entryObject = this, this.nameView_.onblur = function() { + this.entryObject.name = this.value; + Entry.playground.reloadPlayground(); + }, this.nameView_.onkeypress = function(a) { + 13 == a.keyCode && d.editObjectValues(!1); + }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (c = Entry.createElement("div"), c.addClass("entryObjectDeletePhone"), c.object = this, this.deleteView_ = c, this.view_.appendChild(c), c.bindOnClick(function(a) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })), c = Entry.createElement("button"), c.addClass("entryObjectEditPhone"), c.object = this, c.bindOnClick(function(a) { + if (a = Entry.container.getObject(this.id)) { + Entry.container.selectObject(a.id), Entry.playground.injectObject(a); + } + }), this.view_.appendChild(c), c = Entry.createElement("div"), c.addClass("entryObjectInformationWorkspace"), c.object = this, this.isInformationToggle = !1, b.appendChild(c), this.informationView_ = c, c = Entry.createElement("div"), c.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(c), this.rotateLabelWrapperView_ = c, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", n = Entry.createElement("input"), + n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, c.appendChild(e), c.appendChild(n), c.appendChild(h), c.appendChild(q), c.rotateInput_ = n, c.directionInput_ = q, d = this, n.onkeypress = function(a) { + 13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || d.entity.setRotation(+a), d.updateRotationView(), n.blur()); + }, n.onblur = function(a) { + d.entity.setRotation(d.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) || d.entity.setDirection(+a), d.updateRotationView(), q.blur()); + }, q.onblur = function(a) { + d.entity.setDirection(d.entity.getDirection()); + Entry.stage.updateObject(); + }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), c = Entry.createElement("span"), c.addClass("entryObjectCoordinateWorkspace"), b.appendChild(c), 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, m = Entry.createElement("input"), m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), c.appendChild(e), c.appendChild(g), c.appendChild(h), c.appendChild(k), c.appendChild(l), c.appendChild(m), + c.xInput_ = g, c.yInput_ = k, c.sizeInput_ = m, this.coordinateView_ = c, d = this, g.onkeypress = function(a) { + 13 == a.keyCode && (isNaN(g.value) || d.entity.setX(+g.value), d.updateCoordinateView(), d.blur()); + }, g.onblur = function(a) { + d.entity.setX(d.entity.getX()); + Entry.stage.updateObject(); + }, k.onkeypress = function(a) { + 13 == a.keyCode && (isNaN(k.value) || d.entity.setY(+k.value), d.updateCoordinateView(), d.blur()); + }, k.onblur = function(a) { + d.entity.setY(d.entity.getY()); + Entry.stage.updateObject(); + }, c = Entry.createElement("div"), c.addClass("rotationMethodWrapper"), b.appendChild(c), this.rotationMethodWrapper_ = c, b = Entry.createElement("span"), b.addClass("entryObjectRotateMethodLabelWorkspace"), c.appendChild(b), b.innerHTML = Lang.Workspace.rotate_method + " : ", b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeAWorkspace"), b.object = this, this.rotateModeAView_ = b, c.appendChild(b), b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.setRotateMethod("free"); + }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeBWorkspace"), b.object = this, this.rotateModeBView_ = b, c.appendChild(b), b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); + }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeCWorkspace"), b.object = this, this.rotateModeCView_ = b, c.appendChild(b), b.bindOnClick(function(a) { + Entry.engine.isState("run") || this.object.setRotateMethod("none"); + }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; } }; -Entry.EntityObject.prototype.syncFont = function() { - this.textObject.font = this.getFont(); - this.setLineHeight(); - Entry.stage.update(); - this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth()); - Entry.stage.updateObject(); - Entry.requestUpdate = !0; +Entry.EntryObject.prototype.setName = function(b) { + Entry.assert("string" == typeof b, "object name must be string"); + this.name = b; + this.nameView_.value = b; }; -Entry.EntityObject.prototype.getFontType = function() { - return this.fontType; +Entry.EntryObject.prototype.setText = function(b) { + Entry.assert("string" == typeof b, "object text must be string"); + this.text = b; }; -Entry.EntityObject.prototype.setFontType = function(a) { - "textBox" == this.parent.objectType && (this.fontType = a ? a : "Nanum Gothic", this.syncFont()); +Entry.EntryObject.prototype.setScript = function(b) { + this.script = b; }; -Entry.EntityObject.prototype.getFontSize = function(a) { - return this.fontSize; +Entry.EntryObject.prototype.getScriptText = function() { + return JSON.stringify(this.script.toJSON()); }; -Entry.EntityObject.prototype.setFontSize = function(a) { - "textBox" == this.parent.objectType && this.fontSize != a && (this.fontSize = a ? a : 20, this.syncFont(), this.alignTextBox()); +Entry.EntryObject.prototype.initEntity = function(b) { + var a = {}; + a.x = a.y = 0; + a.rotation = 0; + a.direction = 90; + if ("sprite" == this.objectType) { + var d = b.sprite.pictures[0].dimension; + a.regX = d.width / 2; + a.regY = d.height / 2; + a.scaleX = a.scaleY = "background" == b.sprite.category.main || "new" == b.sprite.category.main ? Math.max(270 / d.height, 480 / d.width) : "new" == b.sprite.category.main ? 1 : 200 / (d.width + d.height); + a.width = d.width; + a.height = d.height; + } else { + if ("textBox" == this.objectType) { + if (a.regX = 25, a.regY = 12, a.scaleX = a.scaleY = 1.5, a.width = 50, a.height = 24, a.text = b.text, b.options) { + if (b = b.options, d = "", b.bold && (d += "bold "), b.italic && (d += "italic "), a.underline = b.underline, a.strike = b.strike, a.font = d + "20px " + b.font.family, a.colour = b.colour, a.bgColor = b.background, a.lineBreak = b.lineBreak) { + a.width = 256, a.height = .5625 * a.width, a.regX = a.width / 2, a.regY = a.height / 2; + } + } else { + a.underline = !1, a.strike = !1, a.font = "20px Nanum Gothic", a.colour = "#000000", a.bgColor = "#ffffff"; + } + } + } + return a; }; -Entry.EntityObject.prototype.setFontBold = function(a) { - this.fontBold = a; - Entry.requestUpdate = !0; +Entry.EntryObject.prototype.updateThumbnailView = function() { + if ("sprite" == this.objectType) { + if (this.entity.picture.fileurl) { + this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; + } else { + var b = this.entity.picture.filename; + this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/thumb/" + b + '.png")'; + } + } else { + "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); + } }; -Entry.EntityObject.prototype.toggleFontBold = function() { - this.fontBold = !this.fontBold; - this.syncFont(); - return this.fontBold; +Entry.EntryObject.prototype.updateCoordinateView = function(b) { + if ((this.isSelected() || b) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { + b = this.coordinateView_.xInput_.value; + var a = this.coordinateView_.yInput_.value, d = this.coordinateView_.sizeInput_.value, c = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); + b != c && (this.coordinateView_.xInput_.value = c); + a != e && (this.coordinateView_.yInput_.value = e); + d != f && (this.coordinateView_.sizeInput_.value = f); + } }; -Entry.EntityObject.prototype.setFontItalic = function(a) { - this.fontItalic = a; - Entry.requestUpdate = !0; +Entry.EntryObject.prototype.updateRotationView = function(b) { + if (this.isSelected() && this.view_ || b) { + b = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), b += this.entity.getRotation().toFixed(1), this.rotateInput_.value = b + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), b = "" + this.entity.getDirection().toFixed(1), b += "\u02da", this.directionInput_.value = b; + } }; -Entry.EntityObject.prototype.toggleFontItalic = function() { - this.fontItalic = !this.fontItalic; - this.syncFont(); - return this.fontItalic; +Entry.EntryObject.prototype.select = function(b) { + console.log(this); +}; +Entry.EntryObject.prototype.addPicture = function(b, a) { + Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, b.id); + b.objectId = this.id; + a || 0 === a ? (this.pictures.splice(a, 0, b), Entry.playground.injectPicture(this)) : this.pictures.push(b); + return new Entry.State(this, this.removePicture, b.id); }; -Entry.EntityObject.prototype.setFontName = function(a) { - for (var b = this.font.split(" "), c = [], d = 0, e = b.length;d < e;d++) { - ("bold" === b[d] || "italic" === b[d] || -1 < b[d].indexOf("px")) && c.push(b[d]); +Entry.EntryObject.prototype.removePicture = function(b) { + if (2 > this.pictures.length) { + return !1; } - this.setFont(c.join(" ") + " " + a); + b = this.getPicture(b); + var a = this.pictures.indexOf(b); + Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, b, a); + this.pictures.splice(a, 1); + b === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); + Entry.playground.injectPicture(this); + Entry.playground.reloadPlayground(); + return new Entry.State(this, this.addPicture, b, a); }; -Entry.EntityObject.prototype.getFontName = function() { - if ("textBox" == this.type) { - if (!this.font) { - return ""; +Entry.EntryObject.prototype.getPicture = function(b) { + if (!b) { + return this.selectedPicture; + } + b = b.trim(); + for (var a = this.pictures, d = a.length, c = 0;c < d;c++) { + if (a[c].id == b) { + return a[c]; } - for (var a = this.font.split(" "), b = [], c = 0, d = a.length;c < d;c++) { - "bold" !== a[c] && "italic" !== a[c] && -1 === a[c].indexOf("px") && b.push(a[c]); + } + for (c = 0;c < d;c++) { + if (a[c].name == b) { + return a[c]; } - return b.join(" ").trim(); } + b = Entry.parseNumber(b); + if ((!1 !== b || "boolean" != typeof b) && d >= b && 0 < b) { + return a[b - 1]; + } + throw Error("No picture found"); }; -Entry.EntityObject.prototype.setText = function(a) { - "textBox" == this.parent.objectType && (void 0 === a && (a = ""), this.text = a, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); +Entry.EntryObject.prototype.setPicture = function(b) { + for (var a in this.pictures) { + if (b.id === this.pictures[a].id) { + this.pictures[a] = b; + return; + } + } + throw Error("No picture found"); }; -Entry.EntityObject.prototype.getText = function() { - return this.text; +Entry.EntryObject.prototype.getPrevPicture = function(b) { + for (var a = this.pictures, d = a.length, c = 0;c < d;c++) { + if (a[c].id == b) { + return a[0 == c ? d - 1 : c - 1]; + } + } }; -Entry.EntityObject.prototype.setTextAlign = function(a) { - "textBox" == this.parent.objectType && (void 0 === a && (a = Entry.TEXT_ALIGN_CENTER), this.textAlign = a, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); +Entry.EntryObject.prototype.getNextPicture = function(b) { + for (var a = this.pictures, d = a.length, c = 0;c < d;c++) { + if (a[c].id == b) { + return a[c == d - 1 ? 0 : c + 1]; + } + } }; -Entry.EntityObject.prototype.getTextAlign = function() { - return this.textAlign; +Entry.EntryObject.prototype.selectPicture = function(b) { + var a = this.getPicture(b); + if (a) { + this.selectedPicture = a, this.entity.setImage(a), this.updateThumbnailView(); + } else { + throw Error("No picture with pictureId : " + b); + } +}; +Entry.EntryObject.prototype.addSound = function(b, a) { + b.id || (b.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, b.id); + Entry.initSound(b, a); + a || 0 === a ? (this.sounds.splice(a, 0, b), Entry.playground.injectSound(this)) : this.sounds.push(b); + return new Entry.State(this, this.removeSound, b.id); +}; +Entry.EntryObject.prototype.removeSound = function(b) { + var a; + a = this.getSound(b); + b = this.sounds.indexOf(a); + Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, a, b); + this.sounds.splice(b, 1); + Entry.playground.reloadPlayground(); + Entry.playground.injectSound(this); + return new Entry.State(this, this.addSound, a, b); }; -Entry.EntityObject.prototype.setLineBreak = function(a) { - if ("textBox" == this.parent.objectType) { - void 0 === a && (a = !1); - var b = this.lineBreak; - this.lineBreak = a; - b && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !b && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); - Entry.stage.updateObject(); - } +Entry.EntryObject.prototype.getRotateMethod = function() { + this.rotateMethod || (this.rotateMethod = "free"); + return this.rotateMethod; }; -Entry.EntityObject.prototype.getLineBreak = function() { - return this.lineBreak; +Entry.EntryObject.prototype.setRotateMethod = function(b) { + b || (b = "free"); + this.rotateMethod = b; + this.updateRotateMethodView(); + Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); }; -Entry.EntityObject.prototype.setVisible = function(a) { - void 0 === a && (a = !0); - this.visible = a; - this.object.visible = this.visible; - this.dialog && this.syncDialogVisible(); - Entry.requestUpdate = !0; - return this.visible; +Entry.EntryObject.prototype.initRotateValue = function(b) { + this.rotateMethod != b && (b = this.entity, b.rotation = 0, b.direction = 90, b.flip = !1); }; -Entry.EntityObject.prototype.getVisible = function() { - return this.visible; +Entry.EntryObject.prototype.updateRotateMethodView = function() { + var b = this.rotateMethod; + this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == b ? this.rotateModeAView_.addClass("selected") : "vertical" == b ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); }; -Entry.EntityObject.prototype.setImage = function(a) { - var b = this; - delete a._id; - Entry.assert("sprite" == this.type, "Set image is only for sprite object"); - a.id || (a.id = Entry.generateHash()); - this.picture = a; - var c = this.picture.dimension, d = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; - this.setWidth(c.width); - this.setHeight(c.height); - c.scaleX || (c.scaleX = this.getScaleX(), c.scaleY = this.getScaleY()); - this.setScaleX(this.scaleX); - this.setScaleY(this.scaleY); - this.setRegX(this.width / 2 + d); - this.setRegY(this.height / 2 + e); - var f = a.id + this.id, g = Entry.container.getCachedPicture(f); - g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight()), g.onload = function(a) { - Entry.container.cachePicture(f, g); - Entry.image = g; - b.object.image = g; - b.object.cache(0, 0, b.getWidth(), b.getHeight()); - Entry.requestUpdate = !0; - }); - Entry.dispatchEvent("updateObject"); -}; -Entry.EntityObject.prototype.applyFilter = function(a) { - function b(b, a) { - for (var c in b) { - if (b[c] !== a[c]) { - return !1; - } - } - return !0; - } - var c = this.effect, d = this.object; - if (a || !b(c, this.getInitialEffectValue())) { - (function(b, a) { - var c = [], d = Entry.adjustValueWithMaxMin; - b.brightness = b.brightness; - var e = new createjs.ColorMatrix; - e.adjustColor(d(b.brightness, -100, 100), 0, 0, 0); - e = new createjs.ColorMatrixFilter(e); - c.push(e); - b.hue = b.hue.mod(360); - e = new createjs.ColorMatrix; - e.adjustColor(0, 0, 0, b.hue); - e = new createjs.ColorMatrixFilter(e); - c.push(e); - var e = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], f = 10.8 * b.hsv * Math.PI / 180, m = Math.cos(f), f = Math.sin(f), n = Math.abs(b.hsv / 100); - 1 < n && (n -= Math.floor(n)); - 0 < n && .33 >= n ? e = [1, 0, 0, 0, 0, 0, m, f, 0, 0, 0, -1 * f, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= n ? e = [m, 0, f, 0, 0, 0, 1, 0, 0, 0, f, 0, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= n && (e = [m, f, 0, 0, 0, -1 * f, m, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); - e = (new createjs.ColorMatrix).concat(e); - e = new createjs.ColorMatrixFilter(e); - c.push(e); - a.alpha = b.alpha = d(b.alpha, 0, 1); - a.filters = c; - })(c, d), d.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; - } -}; -Entry.EntityObject.prototype.resetFilter = function() { - "sprite" == this.parent.objectType && (this.object.filters = [], this.setInitialEffectValue(), this.object.alpha = this.effect.alpha, this.object.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0); -}; -Entry.EntityObject.prototype.updateDialog = function() { - this.dialog && this.dialog.update(); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.takeSnapshot = function() { - this.snapshot_ = this.toJSON(); - this.collision = Entry.Utils.COLLISION.NONE; -}; -Entry.EntityObject.prototype.loadSnapshot = function() { - this.snapshot_ && this.syncModel_(this.snapshot_); - "sprite" == this.parent.objectType && this.setImage(this.parent.getPicture()); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.removeClone = function() { - if (this.isClone) { - this.dialog && this.dialog.remove(); - this.brush && this.removeBrush(); - Entry.stage.unloadEntity(this); - var a = this.parent.clonedEntities.indexOf(this); - this.parent.clonedEntities.splice(a, 1); - Entry.Utils.isFunction(this.clearExecutor) && this.clearExecutor(); - } +Entry.EntryObject.prototype.toggleInformation = function(b) { + this.setRotateMethod(this.getRotateMethod()); + void 0 === b && (b = this.isInformationToggle = !this.isInformationToggle); + b ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); }; -Entry.EntityObject.prototype.clearExecutor = function() { - this.parent.script.clearExecutorsByEntity(this); +Entry.EntryObject.prototype.addCloneEntity = function(b, a, d) { + this.clonedEntities.length > Entry.maxCloneLimit || (b = new Entry.EntityObject(this), a ? (b.injectModel(a.picture ? a.picture : null, a.toJSON()), b.snapshot_ = a.snapshot_, a.effect && (b.effect = Entry.cloneSimpleObject(a.effect), b.applyFilter()), a.brush && Entry.setCloneBrush(b, a.brush)) : (b.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(b)), b.snapshot_ = this.entity.snapshot_, this.entity.effect && (b.effect = Entry.cloneSimpleObject(this.entity.effect), + b.applyFilter()), this.entity.brush && Entry.setCloneBrush(b, this.entity.brush)), Entry.engine.raiseEventOnEntity(b, [b, "when_clone_start"]), b.isClone = !0, b.isStarted = !0, this.addCloneVariables(this, b, a ? a.variables : null, a ? a.lists : null), this.clonedEntities.push(b), Entry.stage.loadEntity(b)); }; -Entry.EntityObject.prototype.toJSON = function() { - var a = {}; - a.x = Entry.cutDecimal(this.getX()); - a.y = Entry.cutDecimal(this.getY()); - a.regX = Entry.cutDecimal(this.getRegX()); - a.regY = Entry.cutDecimal(this.getRegY()); - a.scaleX = this.getScaleX(); - a.scaleY = this.getScaleY(); - a.rotation = Entry.cutDecimal(this.getRotation()); - a.direction = Entry.cutDecimal(this.getDirection()); - a.width = Entry.cutDecimal(this.getWidth()); - a.height = Entry.cutDecimal(this.getHeight()); - a.font = this.getFont(); - a.visible = this.getVisible(); - "textBox" == this.parent.objectType && (a.colour = this.getColour(), a.text = this.getText(), a.textAlign = this.getTextAlign(), a.lineBreak = this.getLineBreak(), a.bgColor = this.getBGColour(), a.underLine = this.getUnderLine(), a.strike = this.getStrike(), a.fontSize = this.getFontSize()); - return a; +Entry.EntryObject.prototype.initializeSplitter = function(b) { + b.onmousedown = function(a) { + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; + }; + document.addEventListener("mousemove", function(a) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.x || a.clientX}); + }); + document.addEventListener("mouseup", function(a) { + Entry.container.splitterEnable = !1; + Entry.container.enableSort(); + }); }; -Entry.EntityObject.prototype.setInitialEffectValue = function() { - this.effect = this.getInitialEffectValue(); - Entry.requestUpdate = !0; +Entry.EntryObject.prototype.isSelected = function() { + return this.isSelected_; }; -Entry.EntityObject.prototype.getInitialEffectValue = function() { - return {blur:0, hue:0, hsv:0, brightness:0, contrast:0, saturation:0, alpha:1}; +Entry.EntryObject.prototype.toJSON = function() { + var b = {}; + b.id = this.id; + b.name = this.name; + "textBox" == this.objectType && (b.text = this.text); + b.script = this.getScriptText(); + "sprite" == this.objectType && (b.selectedPictureId = this.selectedPicture.id); + b.objectType = this.objectType; + b.rotateMethod = this.getRotateMethod(); + b.scene = this.scene.id; + b.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; + b.lock = this.lock; + b.entity = this.entity.toJSON(); + return b; }; -Entry.EntityObject.prototype.removeBrush = function() { - Entry.stage.selectedObjectContainer.removeChild(this.shape); - this.shape = this.brush = null; +Entry.EntryObject.prototype.destroy = function() { + Entry.stage.unloadEntity(this.entity); + this.view_ && Entry.removeElement(this.view_); }; -Entry.EntityObject.prototype.updateBG = function() { - if (this.bgObject) { - this.bgObject.graphics.clear(); - var a = this.getWidth(), b = this.getHeight(); - this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-a / 2, -b / 2, a, b); - if (this.getLineBreak()) { - this.bgObject.x = 0; - } else { - switch(this.getTextAlign()) { - case Entry.TEXT_ALIGN_LEFT: - this.bgObject.x = a / 2; - break; - case Entry.TEXT_ALIGN_CENTER: - this.bgObject.x = 0; - break; - case Entry.TEXT_ALIGN_RIGHT: - this.bgObject.x = -a / 2; - } +Entry.EntryObject.prototype.getSound = function(b) { + b = b.trim(); + for (var a = this.sounds, d = a.length, c = 0;c < d;c++) { + if (a[c].id == b) { + return a[c]; } } -}; -Entry.EntityObject.prototype.alignTextBox = function() { - if ("textBox" == this.type) { - var a = this.textObject; - if (this.lineBreak) { - var b = a.getMeasuredLineHeight(); - a.y = b / 2 - this.getHeight() / 2; - switch(this.textAlign) { - case Entry.TEXT_ALIGN_CENTER: - a.x = 0; - break; - case Entry.TEXT_ALIGN_LEFT: - a.x = -this.getWidth() / 2; - break; - case Entry.TEXT_ALIGN_RIGHT: - a.x = this.getWidth() / 2; - } - a.maxHeight = this.getHeight(); - } else { - a.x = 0, a.y = 0; + for (c = 0;c < d;c++) { + if (a[c].name == b) { + return a[c]; } } -}; -Entry.EntityObject.prototype.syncDialogVisible = function() { - this.dialog && (this.dialog.object.visible = this.visible); -}; -Entry.Func = function(a) { - this.id = a ? a.id : Entry.generateHash(); - this.content = a ? new Entry.Code(a.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); - this.blockMenuBlock = this.block = null; - this.hashMap = {}; - this.paramMap = {}; - Entry.generateFunctionSchema(this.id); - if (a) { - a = this.content._blockMap; - for (var b in a) { - Entry.Func.registerParamBlock(a[b].type); - } - Entry.Func.generateWsBlock(this); + b = Entry.parseNumber(b); + if ((!1 !== b || "boolean" != typeof b) && d >= b && 0 < b) { + return a[b - 1]; } - Entry.Func.registerFunction(this); - Entry.Func.updateMenu(); + throw Error("No Sound"); }; -Entry.Func.threads = {}; -Entry.Func.registerFunction = function(a) { - if (Entry.playground) { - var b = Entry.playground.mainWorkspace; - b && (this._targetFuncBlock = b.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + a.id}]), a.blockMenuBlock = this._targetFuncBlock); +Entry.EntryObject.prototype.addCloneVariables = function(b, a, d, c) { + a.variables = []; + a.lists = []; + d || (d = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", b.id)); + c || (c = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", b.id)); + for (b = 0;b < d.length;b++) { + a.variables.push(d[b].clone()); } -}; -Entry.Func.executeFunction = function(a) { - var b = this.threads[a]; - if (b = Entry.Engine.computeThread(b.entity, b)) { - return this.threads[a] = b, !0; + for (b = 0;b < c.length;b++) { + a.lists.push(c[b].clone()); } - delete this.threads[a]; - return !1; -}; -Entry.Func.clearThreads = function() { - this.threads = {}; -}; -Entry.Func.prototype.init = function(a) { - this.id = a.id; - this.content = Blockly.Xml.textToDom(a.content); - this.block = Blockly.Xml.textToDom("" + a.block + "").childNodes[0]; -}; -Entry.Func.prototype.destroy = function() { - this.blockMenuBlock.destroy(); -}; -Entry.Func.edit = function(a) { - this.cancelEdit(); - this.targetFunc = a; - this.initEditView(a.content); - this.bindFuncChangeEvent(); - this.updateMenu(); }; -Entry.Func.initEditView = function(a) { - this.menuCode || this.setupMenuCode(); - var b = Entry.playground.mainWorkspace; - b.setMode(Entry.Workspace.MODE_OVERLAYBOARD); - b.changeOverlayBoardCode(a); - a.recreateView(); - b.changeOverlayBoardCode(a); - a.view.board.alignThreads(); - this._workspaceStateEvent = b.changeEvent.attach(this, this.endEdit); -}; -Entry.Func.endEdit = function(a) { - this.unbindFuncChangeEvent(); - this._workspaceStateEvent.destroy(); - delete this._workspaceStateEvent; - switch(a) { - case "save": - this.save(); - case "cancelEdit": - this.cancelEdit(); - } +Entry.EntryObject.prototype.getLock = function() { + return this.lock; }; -Entry.Func.save = function() { - this.targetFunc.generateBlock(!0); - Entry.variableContainer.saveFunction(this.targetFunc); +Entry.EntryObject.prototype.setLock = function(b) { + this.lock = b; + Entry.stage.updateObject(); + return b; }; -Entry.Func.syncFuncName = function(a) { - var b = 0; - a = a.split(" "); - var c = "", d; - d = Blockly.mainWorkspace.getAllBlocks(); - for (var e = 0;e < d.length;e++) { - var f = d[e]; - if ("function_general" === f.type) { - for (var f = f.inputList, g = 0;g < f.length;g++) { - var h = f[g]; - 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_ && (c += h.fieldRow[0].text_, c += " "); - } - c = c.trim(); - if (c === this.srcFName && this.srcFName.split(" ").length == a.length) { - for (c = 0;c < f.length;c++) { - if (h = f[c], 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_) { - if (void 0 === a[b]) { - f.splice(c, 1); - break; - } else { - h.fieldRow[0].text_ = a[b]; - } - b++; - } - } - } - c = ""; - b = 0; +Entry.EntryObject.prototype.updateInputViews = function(b) { + b = b || this.getLock(); + var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (b && 1 != a[0].getAttribute("readonly")) { + for (b = 0;b < a.length;b++) { + a[b].removeClass("selectedEditingObject"), a[b].setAttribute("readonly", !1), this.isEditing = !1; } } - b = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); - Blockly.mainWorkspace.clear(); - Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, b); -}; -Entry.Func.cancelEdit = function() { - this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); }; -Entry.Func.getMenuXml = function() { - var a = []; - this.targetFunc || (a = a.concat(this.createBtn)); - if (this.targetFunc) { - var b = this.FIELD_BLOCK, b = b.replace("#1", Entry.generateHash()), b = b.replace("#2", Entry.generateHash()), b = Blockly.Xml.textToDom(b).childNodes, a = a.concat(Entry.nodeListToArray(b)) - } - for (var c in Entry.variableContainer.functions_) { - b = Entry.variableContainer.functions_[c], b === this.targetFunc ? (b = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), b.id).block, a.push(b)) : a.push(b.block); +Entry.EntryObject.prototype.editObjectValues = function(b) { + var a; + a = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (b) { + var d = this.nameView_; + $(a).removeClass("selectedNotEditingObject"); + $(d).removeClass("selectedNotEditingObject"); + window.setTimeout(function() { + $(d).removeAttr("readonly"); + d.addClass("selectedEditingObject"); + }); + for (b = 0;b < a.length;b++) { + $(a[b]).removeAttr("readonly"), a[b].addClass("selectedEditingObject"); + } + this.isEditing = !0; + } else { + for (b = 0;b < a.length;b++) { + a[b].blur(!0); + } + this.nameView_.blur(!0); + this.blurAllInput(); + this.isEditing = !1; } - return a; }; -Entry.Func.syncFunc = function() { - var a = Entry.Func; - if (a.targetFunc) { - var b = a.workspace.topBlocks_[0].toString(), c = a.workspace.topBlocks_.length; - (a.fieldText != b || a.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (a.updateMenu(), a.fieldText = b, a.workspaceLength = c); +Entry.EntryObject.prototype.blurAllInput = function() { + var b = document.getElementsByClassName("selectedEditingObject"); + $(b).removeClass("selectedEditingObject"); + for (var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], a = 0;a < b.length;a++) { + b[a].addClass("selectedNotEditingObject"), b[a].setAttribute("readonly", !0); } }; -Entry.Func.setupMenuCode = function() { - var a = Entry.playground.mainWorkspace; - a && (a = a.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = a.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = a.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = a.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = a); -}; -Entry.Func.refreshMenuCode = function() { - if (Entry.playground.mainWorkspace) { - this.menuCode || this.setupMenuCode(); - var a = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; - 2 < a && this._fieldString.params[0].changeType(this.requestParamBlock("string")); - a = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; - 2 < a && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); - } +Entry.EntryObject.prototype.addStampEntity = function(b) { + b = new Entry.StampEntity(this, b); + Entry.stage.loadEntity(b); + this.clonedEntities.push(b); + Entry.stage.sortZorder(); }; -Entry.Func.requestParamBlock = function(a) { - var b = Entry.generateHash(), c; - switch(a) { - case "string": - c = Entry.block.function_param_string; - break; - case "boolean": - c = Entry.block.function_param_boolean; - break; - default: - return null; - } - b = a + "Param_" + b; - a = Entry.Func.createParamBlock(b, c, a); - Entry.block[b] = a; +Entry.EntryObject.prototype.getClonedEntities = function() { + var b = []; + this.clonedEntities.map(function(a) { + a.isStamp || b.push(a); + }); return b; }; -Entry.Func.registerParamBlock = function(a) { - -1 < a.indexOf("stringParam") ? Entry.Func.createParamBlock(a, Entry.block.function_param_string, a) : -1 < a.indexOf("booleanParam") && Entry.Func.createParamBlock(a, Entry.block.function_param_boolean, a); -}; -Entry.Func.createParamBlock = function(a, b, c) { - var d = function() { - }; - c = "string" === c ? "function_param_string" : "function_param_boolean"; - d.prototype = b; - d = new d; - d.changeEvent = new Entry.Event; - d.template = Lang.template[c]; - return Entry.block[a] = d; +Entry.EntryObject.prototype.getStampEntities = function() { + var b = []; + this.clonedEntities.map(function(a) { + a.isStamp && b.push(a); + }); + return b; }; -Entry.Func.updateMenu = function() { - if (Entry.playground && Entry.playground.mainWorkspace) { - var a = Entry.playground.mainWorkspace.getBlockMenu(); - this.targetFunc ? (this.menuCode || this.setupMenuCode(), a.banClass("functionInit"), a.unbanClass("functionEdit")) : (a.unbanClass("functionInit"), a.banClass("functionEdit")); - a.reDraw(); - } +Entry.EntryObject.prototype.clearExecutor = function() { + this.script.clearExecutors(); }; -Entry.Func.prototype.edit = function() { - Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); +Entry.EntryObject.prototype._rightClick = function(b) { + var a = this, d = [{text:Lang.Workspace.context_rename, callback:function(b) { + b.stopPropagation(); + a.setLock(!1); + a.editObjectValues(!0); + a.nameView_.select(); + }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { + Entry.container.addCloneObject(a); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.container.removeObject(a); + }}, {text:Lang.Workspace.copy_file, callback:function() { + Entry.container.setCopiedObject(a); + }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + b = Entry.Utils.convertMouseEvent(b); + Entry.ContextMenu.show(d, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); }; -Entry.Func.generateBlock = function(a) { - a = Entry.block["func_" + a.id]; - var b = {template:a.template, params:a.params}, c = /(%\d)/mi, d = a.template.split(c), e = "", f = 0, g = 0, h; - for (h in d) { - var k = d[h]; - c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = a.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:b, description:e}; +Entry.Painter = function() { + this.toolbox = {selected:"cursor"}; + this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; + this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; + this.font = {name:"KoPub Batang", size:20, style:"normal"}; + this.selectArea = {}; + this.firstStatement = !1; }; -Entry.Func.prototype.generateBlock = function(a) { - a = Entry.Func.generateBlock(this); - this.block = a.block; - this.description = a.description; +Entry.Painter.prototype.initialize = function(b) { + this.generateView(b); + this.canvas = document.getElementById("entryPainterCanvas"); + this.canvas_ = document.getElementById("entryPainterCanvas_"); + this.stage = new createjs.Stage(this.canvas); + this.stage.autoClear = !0; + this.stage.enableDOMEvents(!0); + this.stage.enableMouseOver(10); + this.stage.mouseMoveOutside = !0; + createjs.Touch.enable(this.stage); + this.objectContainer = new createjs.Container; + this.objectContainer.name = "container"; + this.stage.addChild(this.objectContainer); + this.ctx = this.stage.canvas.getContext("2d"); + this.ctx.imageSmoothingEnabled = !1; + this.ctx.webkitImageSmoothingEnabled = !1; + this.ctx.mozImageSmoothingEnabled = !1; + this.ctx.msImageSmoothingEnabled = !1; + this.ctx.oImageSmoothingEnabled = !1; + this.ctx_ = this.canvas_.getContext("2d"); + this.initDashedLine(); + this.initPicture(); + this.initCoordinator(); + this.initHandle(); + this.initDraw(); + var a = this; + Entry.addEventListener("textUpdate", function() { + var b = a.inputField.value(); + "" === b ? (a.inputField.hide(), delete a.inputField) : (a.inputField.hide(), a.drawText(b), a.selectToolbox("cursor")); + }); + this.selectToolbox("cursor"); }; -Entry.Func.generateWsBlock = function(a) { - this.unbindFuncChangeEvent(); - a = a ? a : this.targetFunc; - for (var b = a.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = a.hashMap, h = a.paramMap;b;) { - var k = b.params[0]; - switch(b.type) { - case "function_field_label": - f = f + " " + k; - break; - case "function_field_boolean": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); - g[k.type] = !1; - h[k.type] = c + d; - c++; - e.push({type:"Block", accept:"boolean"}); - f += " %" + (c + d); - break; - case "function_field_string": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); - } - b = b.getOutputBlock(); - } - c++; - f += " %" + (c + d); - e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); - Entry.Mutator.mutate("func_" + a.id, {params:e, template:f}); - for (var l in g) { - g[l] ? (b = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:b})) : g[l] = !0; - } - this.bindFuncChangeEvent(a); -}; -Entry.Func.bindFuncChangeEvent = function(a) { - a = a ? a : this.targetFunc; - !this._funcChangeEvent && a.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = a.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); -}; -Entry.Func.unbindFuncChangeEvent = function() { - this._funcChangeEvent && this._funcChangeEvent.destroy(); - delete this._funcChangeEvent; +Entry.Painter.prototype.initHandle = function() { + this._handle = new createjs.Container; + this._handle.rect = new createjs.Shape; + this._handle.addChild(this._handle.rect); + var b = new createjs.Container; + b.name = "move"; + b.width = 90; + b.height = 90; + b.x = 90; + b.y = 90; + b.rect = new createjs.Shape; + var a = this; + b.rect.on("mousedown", function(d) { + "cursor" === a.toolbox.selected && (a.initCommand(), this.offset = {x:this.parent.x - this.x - d.stageX, y:this.parent.y - this.y - d.stageY}, this.parent.handleMode = "move", b.isSelectCenter = !1); + }); + b.rect.on("pressmove", function(d) { + "cursor" !== a.toolbox.selected || b.isSelectCenter || (a.doCommand(), this.parent.x = d.stageX + this.offset.x, this.parent.y = d.stageY + this.offset.y, a.updateImageHandle()); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + b.rect.cursor = "move"; + b.addChild(b.rect); + b.notch = new createjs.Shape; + b.addChild(b.notch); + b.NEHandle = this.generateCornerHandle(); + b.addChild(b.NEHandle); + b.NWHandle = this.generateCornerHandle(); + b.addChild(b.NWHandle); + b.SWHandle = this.generateCornerHandle(); + b.addChild(b.SWHandle); + b.SEHandle = this.generateCornerHandle(); + b.addChild(b.SEHandle); + b.EHandle = this.generateXHandle(); + b.addChild(b.EHandle); + b.WHandle = this.generateXHandle(); + b.addChild(b.WHandle); + b.NHandle = this.generateYHandle(); + b.addChild(b.NHandle); + b.SHandle = this.generateYHandle(); + b.addChild(b.SHandle); + b.RHandle = new createjs.Shape; + b.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); + b.RHandle.on("mousedown", function(b) { + a.initCommand(); + }); + b.RHandle.on("pressmove", function(b) { + a.doCommand(); + var c = b.stageX - this.parent.x; + b = b.stageY - this.parent.y; + this.parent.rotation = 0 <= c ? Math.atan(b / c) / Math.PI * 180 + 90 : Math.atan(b / c) / Math.PI * 180 + 270; + a.updateImageHandle(); + }); + b.RHandle.cursor = "crosshair"; + b.addChild(b.RHandle); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + b.visible = !1; + this.handle = b; + this.stage.addChild(b); + this.updateImageHandleCursor(); }; -Entry.Helper = function() { - this.visible = !1; +Entry.Painter.prototype.generateCornerHandle = function() { + var b = this, a = new createjs.Shape; + a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + a.on("mousedown", function(a) { + b.initCommand(); + this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}; + }); + a.on("pressmove", function(a) { + b.doCommand(); + var c = Math.sqrt(Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x * (a.stageY - this.parent.y + this.parent.regY) / this.offset.y)); + 10 < this.parent.width * c && 10 < this.parent.height * c && (this.parent.width *= c, this.parent.height *= c, this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}); + b.updateImageHandle(); + }); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + return a; }; -p = Entry.Helper.prototype; -p.generateView = function(a, b) { - this.parentView_ || (this.parentView_ = a, this.blockHelpData = EntryStatic.blockInfo, this.view = a = Entry.createElement("div", "entryBlockHelperWorkspace"), Entry.isForLecture && a.addClass("lecture"), this.parentView_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperContentWorkspace"), b.addClass("entryBlockHelperIntro"), Entry.isForLecture && b.addClass("lecture"), a.appendChild(b), this.blockHelperContent_ = b, this.blockHelperView_ = a, a = Entry.createElement("div", "entryBlockHelperBlockWorkspace"), - this.blockHelperContent_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"), this.blockHelperContent_.appendChild(b), b.innerHTML = Lang.Helper.Block_click_msg, this.blockHelperDescription_ = b, this._renderView = new Entry.RenderView($(a), "LEFT"), this.code = new Entry.Code([]), this._renderView.changeCode(this.code), this.first = !0); +Entry.Painter.prototype.generateXHandle = function() { + var b = this, a = new createjs.Shape; + a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + a.on("mousedown", function(a) { + b.initCommand(); + this.offset = {x:a.stageX - this.parent.x + this.parent.regX}; + }); + a.on("pressmove", function(a) { + b.doCommand(); + var c = Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x); + 10 < this.parent.width * c && (this.parent.width *= c, this.offset = {x:a.stageX - this.parent.x + this.parent.regX}); + b.updateImageHandle(); + }); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + return a; }; -p.bindWorkspace = function(a) { - a && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = a, this._blockViewObserver = a.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); +Entry.Painter.prototype.generateYHandle = function() { + var b = this, a = new createjs.Shape; + a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + a.on("mousedown", function(a) { + b.initCommand(); + this.offset = {y:a.stageY - this.parent.y + this.parent.regY}; + }); + a.on("pressmove", function(a) { + b.doCommand(); + var c = Math.abs((a.stageY - this.parent.y + this.parent.regY) / this.offset.y); + 10 < this.parent.height * c && (this.parent.height *= c, this.offset = {y:a.stageY - this.parent.y + this.parent.regY}); + b.updateImageHandle(); + }); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + return a; }; -p._updateSelectedBlock = function() { - var a = this.workspace.selectedBlockView; - if (a && this.visible && a != this._blockView) { - var b = a.block.type; - this._blockView = a; - this.renderBlock(b); +Entry.Painter.prototype.updateImageHandle = function() { + if (this.handle.visible) { + var b = this.handle, a = b.direction, d = b.width, c = b.height, e = b.regX, f = b.regY; + b.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-d / 2, -c / 2).lt(0, -c / 2).lt(0, -c / 2).lt(+d / 2, -c / 2).lt(+d / 2, +c / 2).lt(-d / 2, +c / 2).cp(); + b.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -c / 2).lt(0, -c / 2 - 20).cp(); + b.NEHandle.x = +b.width / 2; + b.NEHandle.y = -b.height / 2; + b.NWHandle.x = -b.width / 2; + b.NWHandle.y = -b.height / 2; + b.SWHandle.x = -b.width / 2; + b.SWHandle.y = +b.height / 2; + b.SEHandle.x = +b.width / 2; + b.SEHandle.y = +b.height / 2; + b.EHandle.x = +b.width / 2; + b.EHandle.y = 0; + b.WHandle.x = -b.width / 2; + b.WHandle.y = 0; + b.NHandle.x = 0; + b.NHandle.y = -b.height / 2; + b.SHandle.x = 0; + b.SHandle.y = +b.height / 2; + b.RHandle.x = -2; + b.RHandle.y = -b.height / 2 - 20 - 2; + this.handle.visible && (d = this.selectedObject, this.selectedObject.text ? (d.width = this.selectedObject.width, d.height = this.selectedObject.height) : (d.width = d.image.width, d.height = d.image.height), d.scaleX = b.width / d.width, d.scaleY = b.height / d.height, d.x = b.x, d.y = b.y, d.regX = d.width / 2 + e / d.scaleX, d.regY = d.height / 2 + f / d.scaleY, d.rotation = b.rotation, d.direction = a, this.selectArea.x1 = b.x - b.width / 2, this.selectArea.y1 = b.y - b.height / 2, this.selectArea.x2 = + b.width, this.selectArea.y2 = b.height, this.objectWidthInput.value = Math.abs(d.width * d.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(d.height * d.scaleY).toFixed(0), this.objectRotateInput.value = (1 * d.rotation).toFixed(0)); + this.updateImageHandleCursor(); + this.stage.update(); } }; -p.renderBlock = function(a) { - var b = Lang.Helper[a]; - if (a && this.visible && b && !Entry.block[a].isPrimitive) { - this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); - this.code.clear(); - var c = Entry.block[a].def, c = c || {type:a}; - this.code.createThread([c]); - this.code.board.align(); - this.code.board.resize(); - var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); - a = d.width; - d = d.height; - c = c.getSkeleton().box(c).offsetX; - isNaN(c) && (c = 0); - this.blockHelperDescription_.innerHTML = b; - this._renderView.align(); - $(this.blockHelperDescription_).css({top:d + 30}); - this._renderView.svgDom.css({"margin-left":-(a / 2) - 20 - c}); +Entry.Painter.prototype.updateImageHandleCursor = function() { + var b = this.handle; + b.rect.cursor = "move"; + b.RHandle.cursor = "crosshair"; + for (var a = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], d = Math.floor((b.rotation + 22.5) % 180 / 45), c = 0;c < d;c++) { + a.push(a.shift()); + } + b.NHandle.cursor = a[1]; + b.NEHandle.cursor = a[2]; + b.EHandle.cursor = a[3]; + b.SEHandle.cursor = a[0]; + b.SHandle.cursor = a[1]; + b.SWHandle.cursor = a[2]; + b.WHandle.cursor = a[3]; + b.NWHandle.cursor = a[0]; +}; +Entry.Painter.prototype.clearCanvas = function(b) { + this.clearHandle(); + b || this.initCommand(); + this.objectContainer.removeAllChildren(); + this.stage.update(); + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + b = 0; + for (var a = this.colorLayerData.data.length;b < a;b++) { + this.colorLayerData.data[b] = 255, this.colorLayerData.data[b + 1] = 255, this.colorLayerData.data[b + 2] = 255, this.colorLayerData.data[b + 3] = 255; } + this.reloadContext(); }; -p.getView = function() { - return this.view; -}; -p.resize = function() { +Entry.Painter.prototype.newPicture = function() { + var b = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; + b.id = Entry.generateHash(); + Entry.playground.addPicture(b, !0); }; -Entry.HWMontior = {}; -Entry.HWMonitor = function(a) { - this.svgDom = Entry.Dom($('')); - this._hwModule = a; +Entry.Painter.prototype.initPicture = function() { var b = this; - Entry.addEventListener("windowResized", function() { - var a = b._hwModule.monitorTemplate.mode; - "both" == a && (b.resize(), b.resizeList()); - "list" == a ? b.resizeList() : b.resize(); - }); - Entry.addEventListener("hwModeChange", function() { - b.changeMode(); - }); - this.changeOffset = 0; - this.scale = .5; - this._listPortViews = {}; -}; -(function(a) { - a.initView = function() { - this.svgDom = Entry.Dom($('')); - }; - a.generateView = function() { - this.snap = Entry.SVG("hwMonitor"); - this._svgGroup = this.snap.elem("g"); - this._portMap = {n:[], e:[], s:[], w:[]}; - var b = this._hwModule.monitorTemplate, a = {href:Entry.mediaFilePath + b.imgPath, x:-b.width / 2, y:-b.height / 2, width:b.width, height:b.height}; - this._portViews = {}; - this.hwView = this._svgGroup.elem("image"); - this.hwView = this.hwView.attr(a); - this._template = b; - b = b.ports; - this.pathGroup = null; - this.pathGroup = this._svgGroup.elem("g"); - var a = [], d; - for (d in b) { - var e = this.generatePortView(b[d], "_svgGroup"); - this._portViews[d] = e; - a.push(e); - } - a.sort(function(b, a) { - return b.box.x - a.box.x; - }); - var f = this._portMap; - a.map(function(b) { - (1 > (Math.atan2(-b.box.y, b.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(b); - }); - this.resize(); - }; - a.toggleMode = function(b) { - var a = this._hwModule.monitorTemplate; - "list" == b ? (a.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && - (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); - }; - a.setHwmonitor = function(b) { - this._hwmodule = b; - }; - a.changeMode = function(b) { - "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); - }; - a.addPortEle = function(b, a) { - if ("object" != typeof a) { - return b; - } - for (var c in a) { - b[c] = a[c]; - } - return b; - }; - a.removePortEle = function(b, a) { - if ("object" != typeof a) { - return b; - } - for (var c in a) { - delete b[c]; - } - return b; - }; - a.generateListView = function() { - this._portMapList = {n:[]}; - this._svglistGroup = null; - this.listsnap = Entry.SVG("hwMonitor"); - this._svglistGroup = this.listsnap.elem("g"); - var b = this._hwModule.monitorTemplate; - this._template = b; - b = b.listPorts; - this.pathGroup = this._svglistGroup.elem("g"); - var a = [], d; - for (d in b) { - var e = this.generatePortView(b[d], "_svglistGroup"); - this._listPortViews[d] = e; - a.push(e); - } - var f = this._portMapList; - a.map(function(b) { - f.n.push(b); - }); - this.resizeList(); - }; - a.generatePortView = function(b, a) { - a = this[a].elem("g"); - a.addClass("hwComponent"); - var c; - c = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === b.type ? "#00979d" : "#A751E3", "stroke-width":3}); - var e = a.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), f = a.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); - f.textContent = b.name; - f = f.getComputedTextLength(); - a.elem("rect").attr({x:f + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === b.type ? "#00979d" : "#A751E3"}); - var g = a.elem("text").attr({x:f + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); - g.textContent = 0; - f += 40; - e.attr({width:f}); - return {group:a, value:g, type:b.type, path:c, box:{x:b.pos.x - this._template.width / 2, y:b.pos.y - this._template.height / 2, width:f}, width:f}; - }; - a.getView = function() { - return this.svgDom; - }; - a.update = function() { - var b = Entry.hw.portData, a = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == d) { - f = this._listPortViews; - } else { - if ("both" == d) { - if (f = this._listPortViews, this._portViews) { - for (var g in this._portViews) { - f[g] = this._portViews[g]; - } - } - } else { - f = this._portViews; - } - } - if (a) { - for (g in a) { - 0 != a[g] && f[g] && (f[g].type = "output"); - } - } - for (var h in f) { - if (d = f[h], "input" == d.type) { - var k = b[h]; - 0 < e.length && $.each(e, function(b, a) { - if ($.isPlainObject(k)) { - k = k[a] || 0; - } else { - return !1; - } - }); - d.value.textContent = k ? k : 0; - d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); - } else { - k = a[h], 0 < e.length && $.each(e, function(b, a) { - if ($.isPlainObject(k)) { - k = k[a] || 0; - } else { - return !1; - } - }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); - } - } - }; - a.resize = function() { - this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); - if (this.svgDom) { - var b = this.svgDom.get(0).getBoundingClientRect() - } - this._svgGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 1.8 + ")"}); - this._rect = b; - 0 >= this._template.height || 0 >= b.height || (this.scale = b.height / this._template.height * this._template.height / 1E3, this.align()); - }; - a.resizeList = function() { - var b = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 2 + ")"}); - this._rect = b; - this.alignList(); - }; - a.align = function() { - var b; - b = this._portMap.s.concat(); - this._alignNS(b, this.scale / 3 * this._template.height + 5, 27); - b = this._portMap.n.concat(); - this._alignNS(b, -this._template.height * this.scale / 3 - 32, -27); - b = this._portMap.e.concat(); - this._alignEW(b, -this._template.width * this.scale / 3 - 5, -27); - b = this._portMap.w.concat(); - this._alignEW(b, this._template.width * this.scale / 3 - 32, -27); - }; - a.alignList = function() { - var b; - b = this._hwModule.monitorTemplate.listPorts; - for (var a = b.length, d = 0;d < b.length;d++) { - b[d].group.attr({transform:"translate(" + this._template.width * (d / a - .5) + "," + (-this._template.width / 2 - 30) + ")"}); - } - b = this._portMapList.n.concat(); - this._alignNSList(b, -this._template.width * this.scale / 2 - 32, -27); - }; - a._alignEW = function(b, a, d) { - var c = b.length, f = this._rect.height - 50; - tP = -f / 2; - bP = f / 2; - height = this._rect.height; - listVLine = wholeHeight = 0; - mode = this._hwModule.monitorTemplate; - for (f = 0;f < c;f++) { - wholeHeight += b[f].height + 5; - } - wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < c;) { - var g = b.shift(), f = b.pop(), h = tP, k = bP, l = d; - wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === b.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); - wholeWidth -= g.width + f.width + 10; - a += l; - } - b.length && b[0].group.attr({transform:"translate(" + a + ",60)"}); - g && rPort && (this._movePort(g, a, tP, h), this._movePort(rPort, a, bP, k)); - }; - a._alignNS = function(b, a, d) { - for (var c = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < b.length;k++) { - h += b[k].width + 5; - } - h < f - c && (f = h / 2 + 3, c = -h / 2 - 3); - for (;1 < b.length;) { - var k = b.shift(), l = b.pop(), m = c, n = f, q = d; - h <= f - c ? (c += k.width + 5, f -= l.width + 5, q = 0) : 0 === b.length ? (c = (c + f) / 2 - 3, f = c + 6) : (c = Math.max(c, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, c, a, m); - this._movePort(l, f, a, n); - h -= k.width + l.width + 10; - a += q; - } - b.length && this._movePort(b[0], (f + c - b[0].width) / 2, a, 100); - }; - a._alignNSList = function(b, a) { - a = this._rect.width; - initX = -this._rect.width / 2 + 10; - initY = -this._rect.height / 2 + 10; - for (var c = listLine = wholeWidth = 0;c < b.length;c++) { - wholeWidth += b[c].width; - } - for (var e = 0, f = 0, g = initX, h, k, l = 0, c = 0;c < b.length;c++) { - k = b[c], c != b.length - 1 && (l = b[c + 1]), f += k.width, lP = initX, h = initY + 30 * e, k.group.attr({transform:"translate(" + lP + "," + h + ")"}), initX += k.width + 10, f > a - (k.width + l.width / 2.2) && (e += 1, initX = g, f = 0); + Entry.addEventListener("pictureSelected", function(a) { + b.selectToolbox("cursor"); + if (b.file.id !== a.id) { + b.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (b.file_ = JSON.parse(JSON.stringify(b.file)), b.file_save(!0)); + b.file.modified = !1; + b.clearCanvas(!0); + var d = new Image; + d.id = a.id ? a.id : Entry.generateHash(); + b.file.id = d.id; + b.file.name = a.name; + b.file.mode = "edit"; + d.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; + d.onload = function(a) { + b.addImage(a.target); + }; } - }; - a._movePort = function(b, a, d, e) { - var c = a, g = b.box.x * this.scale, h = b.box.y * this.scale; - a > e ? (c = a - b.width, a = a > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (a + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : a = a < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + a) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; - b.group.attr({transform:"translate(" + c + "," + d + ")"}); - b.path.attr({d:a}); - }; -})(Entry.HWMonitor.prototype); -Entry.HW = function() { - this.sessionRoomId = localStorage.getItem("entryhwRoomId"); - this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), localStorage.setItem("entryhwRoomId", this.sessionRoomId)); - console.log(this.sessionRoomId); - this.connectTrial = 0; - this.isFirstConnect = !0; - this.initSocket(); - this.connected = !1; - this.portData = {}; - this.sendQueue = {}; - this.outputQueue = {}; - this.settingQueue = {}; - this.socketType = this.hwModule = this.selectedDevice = null; - Entry.addEventListener("stop", this.setZero); - this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino, "10.1":Entry.Roborobo_Roduino, "10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3, "B.1":Entry.Codestar}; -}; -Entry.HW.TRIAL_LIMIT = 2; -p = Entry.HW.prototype; -p.createRandomRoomId = function() { - return "xxxxxxxxyx".replace(/[xy]/g, function(a) { - var b = 16 * Math.random() | 0; - return ("x" == a ? b : b & 3 | 8).toString(16); }); -}; -p.connectWebSocket = function(a, b) { - var c = this, d = io(a, b); - d.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); - d.io.reconnectionDelayMax(1E3); - d.io.timeout(1E3); - d.on("connect", function() { - console.log("connect"); - c.socketType = "WebSocket"; - c.initHardware(d); + Entry.addEventListener("pictureImport", function(a) { + b.addPicture(a); }); - d.on("matched", function(b) { - d.emit("matchTarget", {target:b}); + Entry.addEventListener("pictureNameChanged", function(a) { + b.file.name = a.name; }); - d.on("mode", function(b) { - 0 === d.mode && 1 === b && c.disconnectHardware(); - d.mode = b; + Entry.addEventListener("pictureClear", function(a) { + b.file.modified = !1; + b.file.id = ""; + b.file.name = ""; + b.clearCanvas(); }); - d.on("message", function(b) { - if (b.data && "string" === typeof b.data) { - switch(b.data) { - case "disconnectHardware": - c.disconnectHardware(); - break; - default: - b = JSON.parse(b.data), c.checkDevice(b), c.updatePortData(b); - } - } +}; +Entry.Painter.prototype.initDraw = function() { + var b = this; + this.stage.on("stagemousedown", function(a) { + b.stagemousedown(a); }); - d.on("disconnect", function() { - console.log("disconnect"); - c.isOpenHardware ? (c.isOpenHardware = !1, c.initSocket()) : "WebSocket" === c.socketType && c.disconnectedSocket(); + this.stage.on("stagemouseup", function(a) { + b.stagemouseup(a); + }); + this.stage.on("stagemousemove", function(a) { + b.stagemousemove(a); }); - return d; }; -p.initSocket = function() { - try { - this.connected = !1; - this.tlsSocketIo && this.tlsSocketIo.removeAllListeners(); - this.socketIo && this.socketIo.removeAllListeners(); - if (-1 < location.protocol.indexOf("https")) { - this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); - } else { - try { - this.socketIo = this.connectWebSocket("https://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}); - } catch (a) { - } - try { - this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); - } catch (a) { - } - } - Entry.dispatchEvent("hwChanged"); - } catch (a) { - } +Entry.Painter.prototype.selectObject = function(b, a) { + this.selectedObject = b; + this.handle.visible = b.visible; + a ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = b.scaleX * b.image.width, this.handle.height = b.scaleY * b.image.height, this.handle.x = b.x, this.handle.y = b.y, this.handle.regX = +(b.regX - b.image.width / 2) * b.scaleX, this.handle.regY = +(b.regY - b.image.height / 2) * b.scaleY); + this.handle.rotation = b.rotation; + this.handle.direction = 0; + this.updateImageHandle(); }; -p.retryConnect = function() { - Entry.HW.TRIAL_LIMIT = 5; - this.initSocket(); +Entry.Painter.prototype.selectTextObject = function(b) { + this.selectedObject = b; + var a = b.getTransformedBounds(); + this.handle.visible = b.visible; + b.width || (this.selectedObject.width = a.width); + b.height || (this.selectedObject.height = a.height); + this.handle.width = b.scaleX * this.selectedObject.width; + this.handle.height = b.scaleY * this.selectedObject.height; + this.handle.x = b.x; + this.handle.y = b.y; + b.regX || (b.regX = b.width / 2); + b.regY || (b.regY = b.height / 2); + this.handle.regX = (b.regX - this.selectedObject.width / 2) * b.scaleX; + this.handle.regY = (b.regY - this.selectedObject.height / 2) * b.scaleY; + this.handle.rotation = b.rotation; + this.handle.direction = 0; + this.updateImageHandle(); }; -p.openHardwareProgram = function() { - this.isOpenHardware = !0; - Entry.HW.TRIAL_LIMIT = 5; - this.socket ? this.executeHardware() : (this.executeHardware(), this.initSocket()); +Entry.Painter.prototype.updateHandle = function() { + -1 < this.stage.getChildIndex(this._handle) && this.stage.removeChild(this._handle); + -1 === this.stage.getChildIndex(this.handle) && this.stage.addChild(this.handle); + var b = new createjs.Shape; + b.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.handle.rect.hitArea = b; + this.handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#000000").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 4); + this.stage.update(); }; -p.initHardware = function(a) { - this.socket = a; - this.connectTrial = 0; - this.connected = !0; - Entry.dispatchEvent("hwChanged"); - Entry.playground && Entry.playground.object && Entry.playground.setMenu(Entry.playground.object.objectType); +Entry.Painter.prototype.updateHandle_ = function() { + this.stage.getChildIndex(-1 < this._handle) && this.stage.addChild(this._handle); + this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); + this.stage.update(); }; -p.disconnectHardware = function() { - Entry.propertyPanel.removeMode("hw"); - this.hwModule = this.selectedDevice = void 0; - Entry.dispatchEvent("hwChanged"); +Entry.Painter.prototype.matchTolerance = function(b, a, d, c, e) { + var f = this.colorLayerData.data[b], g = this.colorLayerData.data[b + 1]; + b = this.colorLayerData.data[b + 2]; + return f >= a - e / 100 * a && f <= a + e / 100 * a && g >= d - e / 100 * d && g <= d + e / 100 * d && b >= c - e / 100 * c && b <= c + e / 100 * c; }; -p.disconnectedSocket = function() { - this.tlsSocketIo.close(); - this.socketIo && this.socketIo.close(); - Entry.propertyPanel.removeMode("hw"); - this.socket = void 0; - this.connectTrial = 0; - this.connected = !1; - this.hwModule = this.selectedDevice = void 0; - Entry.dispatchEvent("hwChanged"); - Entry.toast.alert("\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8 \uc5f0\uacb0 \uc885\ub8cc", "\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8\uacfc \uc0ac\uc774\uc758 \uc5f0\uacb0\uc774 \uc885\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", !1); +Entry.Painter.prototype.matchColorOnly = function(b, a, d, c) { + return a === this.colorLayerData.data[b] && d === this.colorLayerData.data[b + 1] && c === this.colorLayerData.data[b + 2] ? !0 : !1; }; -p.setDigitalPortValue = function(a, b) { - this.sendQueue[a] = b; - this.removePortReadable(a); +Entry.Painter.prototype.matchColor = function(b, a, d, c, e) { + return a === this.colorLayerData.data[b] && d === this.colorLayerData.data[b + 1] && c === this.colorLayerData.data[b + 2] && e === this.colorLayerData.data[b + 3] ? !0 : !1; }; -p.getAnalogPortValue = function(a) { - return this.connected ? this.portData["a" + a] : 0; +Entry.Painter.prototype.colorPixel = function(b, a, d, c, e) { + e || (e = 255); + this.stroke.transparent && (e = c = d = a = 0); + this.colorLayerData.data[b] = a; + this.colorLayerData.data[b + 1] = d; + this.colorLayerData.data[b + 2] = c; + this.colorLayerData.data[b + 3] = e; +}; +Entry.Painter.prototype.pickStrokeColor = function(b) { + b = 4 * (Math.round(b.stageY) * this.canvas.width + Math.round(b.stageX)); + this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[b], this.colorLayerData.data[b + 1], this.colorLayerData.data[b + 2]); + document.getElementById("entryPainterAttrCircle").style.backgroundColor = this.stroke.lineColor; + document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; }; -p.getDigitalPortValue = function(a) { - if (!this.connected) { - return 0; - } - this.setPortReadable(a); - return void 0 !== this.portData[a] ? this.portData[a] : 0; +Entry.Painter.prototype.drawText = function(b) { + var a = document.getElementById("entryPainterAttrFontStyle").value, d = document.getElementById("entryPainterAttrFontName").value, c = document.getElementById("entryPainterAttrFontSize").value; + b = new createjs.Text(b, a + " " + c + 'px "' + d + '"', this.stroke.lineColor); + b.textBaseline = "top"; + b.x = this.oldPt.x; + b.y = this.oldPt.y; + this.objectContainer.addChild(b); + this.selectTextObject(b); + this.file.modified = !0; }; -p.setPortReadable = function(a) { - this.sendQueue.readablePorts || (this.sendQueue.readablePorts = []); - var b = !1, c; - for (c in this.sendQueue.readablePorts) { - if (this.sendQueue.readablePorts[c] == a) { - b = !0; - break; - } - } - b || this.sendQueue.readablePorts.push(a); +Entry.Painter.prototype.addImage = function(b) { + var a = new createjs.Bitmap(b); + this.objectContainer.addChild(a); + a.x = this.stage.canvas.width / 2; + a.y = this.stage.canvas.height / 2; + a.regX = a.image.width / 2 | 0; + a.regY = a.image.height / 2 | 0; + if (540 < a.image.height) { + var d = 540 / a.image.height; + a.scaleX = d; + a.scaleY = d; + } + a.name = b.id; + a.id = b.id; + this.selectObject(a); + this.stage.update(); }; -p.removePortReadable = function(a) { - if (this.sendQueue.readablePorts || Array.isArray(this.sendQueue.readablePorts)) { - var b, c; - for (c in this.sendQueue.readablePorts) { - if (this.sendQueue.readablePorts[c] == a) { - b = Number(c); +Entry.Painter.prototype.createBrush = function() { + this.initCommand(); + this.brush = new createjs.Shape; + this.objectContainer.addChild(this.brush); + this.stage.update(); +}; +Entry.Painter.prototype.createEraser = function() { + this.initCommand(); + this.eraser = new createjs.Shape; + this.objectContainer.addChild(this.eraser); + this.stage.update(); +}; +Entry.Painter.prototype.clearHandle = function() { + this.handle.visible && (this.handle.visible = !1); + this.coordinator.visible && (this.coordinator.visible = !1); + this.stage.update(); +}; +Entry.Painter.prototype.initCommand = function() { + var b = !1; + this.handle.visible && (b = !0, this.handle.visible = !1); + var a = !1; + this.coordinator.visible && (a = !0, this.coordinator.visible = !1); + (b || a) && this.stage.update(); + this.isCommandValid = !1; + this.colorLayerModel = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + Entry.stateManager && this.firstStatement && Entry.stateManager.addCommand("edit sprite", this, this.restorePainter, this.colorLayerModel); + this.firstStatement = !0; + b && (this.handle.visible = !0); + a && (this.coordinator.visible = !0); + (b || a) && this.stage.update(); +}; +Entry.Painter.prototype.doCommand = function() { + this.isCommandValid = !0; +}; +Entry.Painter.prototype.checkCommand = function() { + this.isCommandValid || Entry.dispatchEvent("cancelLastCommand"); +}; +Entry.Painter.prototype.restorePainter = function(b) { + this.clearHandle(); + var a = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(b, 0, 0); + b = new Image; + b.src = this.canvas.toDataURL(); + var d = this; + b.onload = function(a) { + a = new createjs.Bitmap(a.target); + d.objectContainer.removeAllChildren(); + d.objectContainer.addChild(a); + }; + Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, a); +}; +Entry.Painter.prototype.platten = function() { + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.reloadContext(); +}; +Entry.Painter.prototype.fill = function() { + if (!this.stroke.locked) { + this.stroke.locked = !0; + this.initCommand(); + this.doCommand(); + this.clearHandle(); + var b = this.canvas.width, a = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, b, a); + var d = new createjs.Point(this.stage.mouseX, this.stage.mouseY); + d.x = Math.round(d.x); + d.y = Math.round(d.y); + for (var c = 4 * (d.y * b + d.x), e = this.colorLayerData.data[c], f = this.colorLayerData.data[c + 1], g = this.colorLayerData.data[c + 2], h = this.colorLayerData.data[c + 3], k, l, d = [[d.x, d.y]], m = Entry.hex2rgb(this.stroke.lineColor);d.length;) { + for (var c = d.pop(), n = c[0], q = c[1], c = 4 * (q * b + n);0 <= q && this.matchColor(c, e, f, g, h);) { + --q, c -= 4 * b; + } + c += 4 * b; + q += 1; + for (l = k = !1;q < a - 1 && this.matchColor(c, e, f, g, h);) { + q += 1, this.colorPixel(c, m.r, m.g, m.b), 0 < n && (this.matchColor(c - 4, e, f, g, h) ? k || (d.push([n - 1, q]), k = !0) : k && (k = !1)), n < b - 1 && (this.matchColor(c + 4, e, f, g, h) ? l || (d.push([n + 1, q]), l = !0) : l && (l = !1)), c += 4 * b; + } + if (1080 < d.length) { break; } } - this.sendQueue.readablePorts = void 0 != b ? this.sendQueue.readablePorts.slice(0, b).concat(this.sendQueue.readablePorts.slice(b + 1, this.sendQueue.readablePorts.length)) : []; + this.file.modified = !0; + this.reloadContext(); } }; -p.update = function() { - this.socket && (this.socket.disconnected || this.socket.emit("message", {data:JSON.stringify(this.sendQueue), mode:this.socket.mode, type:"utf8"})); -}; -p.updatePortData = function(a) { - this.portData = a; - this.hwMonitor && "hw" == Entry.propertyPanel.selected && this.hwMonitor.update(); +Entry.Painter.prototype.reloadContext = function() { + delete this.selectedObject; + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(this.colorLayerData, 0, 0); + var b = new Image; + b.src = this.canvas.toDataURL(); + var a = this; + b.onload = function(b) { + b = new createjs.Bitmap(b.target); + a.objectContainer.removeAllChildren(); + a.objectContainer.addChild(b); + a.stroke.locked = !1; + }; }; -p.closeConnection = function() { - this.socket && this.socket.close(); +Entry.Painter.prototype.move_pen = function() { + var b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); + this.oldPt.x = this.stage.mouseX; + this.oldPt.y = this.stage.mouseY; + this.oldMidPt.x = b.x; + this.oldMidPt.y = b.y; + this.file.modified = !0; + this.stage.update(); }; -p.downloadConnector = function() { - window.open("http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe", "_blank").focus(); +Entry.Painter.prototype.move_line = function() { + this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").moveTo(this.oldPt.x, this.oldPt.y).lineTo(this.stage.mouseX, this.stage.mouseY); + this.file.modified = !0; + this.stage.update(); }; -p.downloadGuide = function() { - window.open("http://download.play-entry.org/data/%EC%97%94%ED%8A%B8%EB%A6%AC-%ED%95%98%EB%93%9C%EC%9B%A8%EC%96%B4%EC%97%B0%EA%B2%B0%EB%A7%A4%EB%89%B4%EC%96%BC_16_08_17.hwp", "_blank").focus(); +Entry.Painter.prototype.move_rect = function() { + var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (a = b); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, + this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, b, a); + this.file.modified = !0; + this.stage.update(); }; -p.downloadSource = function() { - window.open("http://play-entry.com/down/board.ino", "_blank").focus(); +Entry.Painter.prototype.move_circle = function() { + var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (a = b); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, + this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, b, a)); + this.file.modified = !0; + this.stage.update(); }; -p.setZero = function() { - Entry.hw.hwModule && Entry.hw.hwModule.setZero(); +Entry.Painter.prototype.edit_copy = function() { + this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, + 0)) : alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); }; -p.checkDevice = function(a) { - void 0 !== a.company && (a = [Entry.Utils.convertIntToHex(a.company), ".", Entry.Utils.convertIntToHex(a.model)].join(""), a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], Entry.dispatchEvent("hwChanged"), Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5", "\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.", !1), this.hwModule.monitorTemplate && - (this.hwMonitor ? (this.hwMonitor._hwModule = this.hwModule, this.hwMonitor.initView()) : this.hwMonitor = new Entry.HWMonitor(this.hwModule), Entry.propertyPanel.addMode("hw", this.hwMonitor), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); +Entry.Painter.prototype.edit_cut = function() { + this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, + 0), this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height), this.reloadContext(), this.file.modified = !0) : alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); }; -p.banHW = function() { - var a = this.hwInfo, b; - for (b in a) { - Entry.playground.mainWorkspace.blockMenu.banClass(a[b].name, !0); - } +Entry.Painter.prototype.edit_paste = function() { + var b = new Image; + b.src = this.canvas_.toDataURL(); + var a = this; + b.onload = function(b) { + b = new createjs.Bitmap(b.target); + b.x = a.canvas.width / 2; + b.y = a.canvas.height / 2; + b.regX = a.copy.width / 2 | 0; + b.regY = a.copy.height / 2 | 0; + b.id = Entry.generateHash(); + a.objectContainer.addChild(b); + a.selectObject(b, !0); + }; + this.file.modified = !0; }; -p.executeHardware = function() { - function a(b) { - navigator.msLaunchUri(b, function() { - }, function() { - alert("\uc124\uce58\uc548\ub42c\uc5c9"); - }); - } - function b(b) { - var a = document.createElement("iframe"); - a.src = "about:blank"; - a.style = "display:none"; - document.getElementsByTagName("body")[0].appendChild(a); - var c = null, c = setTimeout(function() { - var d = !1; - try { - a.contentWindow.location.href = b, d = !0; - } catch (l) { - "NS_ERROR_UNKNOWN_PROTOCOL" == l.name && (d = !1); - } - d || alert("\uc124\uce58\uc548\ub42c\uc5c9"); - document.getElementsByTagName("body")[0].removeChild(a); - clearTimeout(c); - }, 500); - } - function c(b) { - var a = !1; - window.focus(); - window.onblur = function() { - a = !0; +Entry.Painter.prototype.edit_select = function() { + this.clearHandle(); + this.selectedObject && delete this.selectedObject; + this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.copy = {}; + this.copy.width = this.selectArea.x2; + this.copy.height = this.selectArea.y2; + this.canvas_.width = this.copy.width; + this.canvas_.height = this.copy.height; + this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height); + this.ctx_.putImageData(this.copyLayerData, 0, 0); + this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(this.colorLayerData, 0, 0); + var b = new Image; + b.src = this.canvas.toDataURL(); + var a = this; + b.onload = function(b) { + b = new createjs.Bitmap(b.target); + a.objectContainer.removeAllChildren(); + a.objectContainer.addChild(b); + b = new Image; + b.src = a.canvas_.toDataURL(); + b.onload = function(b) { + b = new createjs.Bitmap(b.target); + b.x = a.selectArea.x1 + a.copy.width / 2; + b.y = a.selectArea.y1 + a.copy.height / 2; + b.regX = a.copy.width / 2 | 0; + b.regY = a.copy.height / 2 | 0; + b.id = Entry.generateHash(); + b.name = b.id; + a.objectContainer.addChild(b); + a.selectObject(b, !0); }; - location.assign(encodeURI(b)); - setTimeout(function() { - (0 == a || 0 < navigator.userAgent.indexOf("Edge")) && alert("\uc124\uce58 \uc548\ub42c\uc5c9"); - window.onblur = null; - }, 1500); - } - var d = {_bNotInstalled:!1, init:function(b, a) { - this._w = window.open("", "comic_viewer_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); - var c = null, c = setTimeout(function() { - d.runViewer(b, a); - clearInterval(c); - }, 1E3); - }, runViewer:function(b, a) { - this._w.document.write(""); - var c = 0, d = null, d = setInterval(function() { - try { - this._w.location.href; - } catch (n) { - this._bNotInstalled = !0; - } - if (10 < c) { - clearInterval(d); - var b = 0, e = null, e = setInterval(function() { - b++; - this._w.closed || 2 < b ? clearInterval(e) : this._w.close(); - this._bNotInstalled = !1; - c = 0; - }.bind(this), 5E3); - a(!this._bNotInstalled); - } - c++; - }.bind(this), 100); - }, set:function() { - this._bNotInstalled = !0; - }}, e = "entryhw://-roomId:" + this.sessionRoomId; - 0 < navigator.userAgent.indexOf("MSIE") || 0 < navigator.userAgent.indexOf("Trident") ? void 0 != navigator.msLaunchUri ? a(e) : 9 > (0 < document.documentMode ? document.documentMode : navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]) ? alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4.") : d.init(e, function(b) { - 0 == b && alert("\uc124\uce58\uc548\ub42c\uc5c9"); - }) : 0 < navigator.userAgent.indexOf("Firefox") ? b(e) : 0 < navigator.userAgent.indexOf("Chrome") || 0 < navigator.userAgent.indexOf("Safari") ? c(e) : alert("\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube0c\ub77c\uc6b0\uc800\uc785\ub2c8\ub2e4."); + }; }; -Entry.PropertyPanel = function() { - this.modes = {}; - this.selected = null; +Entry.Painter.prototype.move_erase = function(b) { + b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); + this.oldPt.x = this.stage.mouseX; + this.oldPt.y = this.stage.mouseY; + this.oldMidPt.x = b.x; + this.oldMidPt.y = b.y; + this.file.modified = !0; + this.stage.update(); }; -(function(a) { - a.generateView = function(b, a) { - this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(b)}); - this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); - this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); - this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); - b = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); - this.initializeSplitter(b); +Entry.Painter.prototype.settingShapeBlur = function() { + this.objectWidthInput.blur(); + this.objectHeightInput.blur(); + this.objectRotateInput.blur(); +}; +Entry.Painter.prototype.stagemousedown = function(b) { + "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(b.stageX, b.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(b) : "text" === this.toolbox.selected ? (this.showInputField(b), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? + this.fill() : "cursor" !== this.toolbox.selected && (this.createBrush(), this.stroke.enabled = !0)); +}; +Entry.Painter.prototype.stagemousemove = function(b) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(b) : "line" === this.toolbox.selected ? this.move_line(b) : "rect" === this.toolbox.selected ? + this.move_rect(b) : "circle" === this.toolbox.selected ? this.move_circle(b) : "erase" === this.toolbox.selected && this.move_erase(b)), this.painterTopStageXY.innerHTML = "x:" + b.stageX.toFixed(1) + ", y:" + b.stageY.toFixed(1)); +}; +Entry.Painter.prototype.stagemouseup = function(b) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && + this.eraser.graphics.endStroke(), -1 < this.objectContainer.getChildIndex(this.brush) && this.brush.graphics.endStroke(), this.clearHandle(), this.platten(), this.stroke.enabled = !1, this.checkCommand())); +}; +Entry.Painter.prototype.file_save = function(b) { + this.clearHandle(); + this.transparent(); + this.trim(); + var a = this.canvas_.toDataURL(); + Entry.dispatchEvent("saveCanvasImage", {file:b ? this.file_ : this.file, image:a}); + this.file.modified = !1; +}; +Entry.Painter.prototype.transparent = function() { + var b = this.canvas.width, a = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, b, a); + var d = b * (a - 1) * 4, c = 4 * (b - 1), e = 4 * (b * a - 1); + this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(1, a) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(b, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(b, a); +}; +Entry.Painter.prototype.fillTransparent = function(b, a) { + this.stage.mouseX = b; + this.stage.mouseY = a; + this.stroke.transparent = !0; + this.fill(); +}; +Entry.Painter.prototype.trim = function() { + var b = this.canvas.width, a = this.ctx.getImageData(0, 0, b, this.canvas.height), d = a.data.length, c, e = null, f = null, g = null, h = null, k; + for (c = 0;c < d;c += 4) { + 0 !== a.data[c + 3] && (g = c / 4 % b, k = ~~(c / 4 / b), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); + } + b = h - e; + a = g - f; + d = null; + 0 === b || 0 === a ? (d = this.ctx.getImageData(0, 0, 1, 1), d.data[0] = 255, d.data[1] = 255, d.data[2] = 255, d.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (d = this.ctx.getImageData(f, e, a, b), this.canvas_.width = a, this.canvas_.height = b); + this.ctx_.putImageData(d, 0, 0); +}; +Entry.Painter.prototype.showInputField = function(b) { + this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:b.stageX, y:b.stageY, onsubmit:function() { + Entry.dispatchEvent("textUpdate"); + }}), this.inputField.show()); +}; +Entry.Painter.prototype.addPicture = function(b) { + this.initCommand(); + var a = new Image; + a.id = Entry.generateHash(); + a.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; + var d = this; + a.onload = function(a) { + d.addImage(a.target); + d.selectToolbox("cursor"); }; - a.addMode = function(b, a) { - var c = a.getView(), c = Entry.Dom(c, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[b] + "
", {classes:["propertyTabElement", "propertyTab" + b], parent:this._tabView}), f = this; - e.bind("click", function() { - f.select(b); - }); - this.modes[b] && (this.modes[b].tabDom.remove(), this.modes[b].contentDom.remove(), "hw" == b && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); - this.modes[b] = {obj:a, tabDom:e, contentDom:c}; - "hw" == b && $(".propertyTabhw").bind("dblclick", function() { - Entry.dispatchEvent("hwModeChange"); - }); - }; - a.removeMode = function(b) { - this.modes[b] && (this.modes[b].tabDom.remove(), this.modes[b].contentDom.remove(), "hw" == b && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); - (b = Object.keys(this.modes)) && 0 < b.length && this.select(b[0]); - }; - a.resize = function(b) { - this._view.css({width:b + "px", top:9 * b / 16 + 123 - 22 + "px"}); - 430 <= b ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); - Entry.dispatchEvent("windowResized"); - b = this.selected; - "hw" == b ? this.modes.hw.obj.listPorts ? this.modes[b].obj.resizeList() : this.modes[b].obj.resize() : this.modes[b].obj.resize(); - }; - a.select = function(b) { - for (var a in this.modes) { - var d = this.modes[a]; - d.tabDom.removeClass("selected"); - d.contentDom.addClass("entryRemove"); - d.obj.visible = !1; - } - a = this.modes[b]; - a.tabDom.addClass("selected"); - a.contentDom.removeClass("entryRemove"); - a.obj.resize && a.obj.resize(); - a.obj.visible = !0; - this.selected = b; - }; - a.initializeSplitter = function(b) { - var a = this; - b.bind("mousedown touchstart", function(b) { - a._cover.removeClass("entryRemove"); - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(b) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.clientX || b.x}); - })); - }); - $(document).bind("mouseup touchend", function(b) { - if (b = Entry.container.resizeEvent) { - Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(b), a._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; - } - Entry.container.enableSort(); - }); - }; -})(Entry.PropertyPanel.prototype); -Entry.init = function(a, b) { - Entry.assert("object" === typeof b, "Init option is not object"); - this.events_ = {}; - this.interfaceState = {menuWidth:264}; - Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); - this.options = b; - this.parseOptions(b); - this.mediaFilePath = (b.libDir ? b.libDir : "/lib") + "/entryjs/images/"; - this.defaultPath = b.defaultDir || ""; - this.blockInjectPath = b.blockInjectDir || ""; - "workspace" == this.type && this.isPhone() && (this.type = "phone"); - this.initialize_(); - this.view_ = a; - "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); - Entry.initFonts(b.fonts); - this.createDom(a, this.type); - this.loadInterfaceState(); - this.overridePrototype(); - this.maxCloneLimit = 302; - this.cloudSavable = !0; - this.startTime = (new Date).getTime(); - document.onkeydown = function(b) { - Entry.dispatchEvent("keyPressed", b); - }; - document.onkeyup = function(b) { - Entry.dispatchEvent("keyUpped", b); - }; - window.onresize = function(b) { - Entry.dispatchEvent("windowResized", b); - }; - window.onbeforeunload = this.beforeUnload; - Entry.addEventListener("saveWorkspace", function(b) { - Entry.addActivity("save"); - }); - Entry.addEventListener("showBlockHelper", function(b) { - 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); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); - createjs.Sound.stop(); -}; -Entry.loadAudio_ = function(a, b) { - if (window.Audio && a.length) { - for (;0 < a.length;) { - a = a[0]; - a.match(/\/([^.]+)./); - Entry.soundQueue.loadFile({id:b, src:a, type:createjs.LoadQueue.SOUND}); - break; - } - } -}; -Entry.initialize_ = function() { - this.stage = new Entry.Stage; - Entry.engine && Entry.engine.clearTimer(); - this.engine = new Entry.Engine; - this.propertyPanel = new Entry.PropertyPanel; - this.container = new Entry.Container; - this.helper = new Entry.Helper; - this.youtube = new Entry.Youtube; - this.variableContainer = new Entry.VariableContainer; - this.commander = new Entry.Commander(this.type); - this.scene = new Entry.Scene; - this.playground = new Entry.Playground; - this.toast = new Entry.Toast; - this.hw && this.hw.closeConnection(); - this.hw = new Entry.HW; - if (Entry.enableActivityLogging) { - this.reporter = new Entry.Reporter(!1); - } else { - if ("workspace" == this.type || "phone" == this.type) { - this.reporter = new Entry.Reporter(!0); - } - } -}; -Entry.createDom = function(a, b) { - if (b && "workspace" != b) { - "minimize" == b ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), a.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b)) : "phone" == b && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, - b), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), a.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, b), c = Entry.createElement("div"), - a.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, b)); - } else { - Entry.documentMousedown.attach(this, this.cancelObjectEdit); - var c = Entry.createElement("div"); - a.appendChild(c); - this.sceneView = c; - this.scene.generateView(this.sceneView, b); - c = Entry.createElement("div"); - this.sceneView.appendChild(c); - this.stateManagerView = c; - this.stateManager.generateView(this.stateManagerView, b); - var d = Entry.createElement("div"); - a.appendChild(d); - this.engineView = d; - this.engine.generateView(this.engineView, b); - c = Entry.createElement("canvas"); - c.addClass("entryCanvasWorkspace"); - c.id = "entryCanvas"; - c.width = 640; - c.height = 360; - d.insertBefore(c, this.engine.addButton); - c.addEventListener("mousewheel", function(b) { - var a = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); - b = 0 < b.wheelDelta ? !0 : !1; - for (var c = 0;c < a.length;c++) { - var d = a[c]; - d.scrollButton_.y = b ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; - d.updateView(); - } - }); - this.canvas_ = c; - this.stage.initStage(this.canvas_); - c = Entry.createElement("div"); - this.propertyPanel.generateView(a, b); - this.containerView = c; - this.container.generateView(this.containerView, b); - this.propertyPanel.addMode("object", this.container); - this.helper.generateView(this.containerView, b); - this.propertyPanel.addMode("helper", this.helper); - c = Entry.createElement("div"); - a.appendChild(c); - this.playgroundView = c; - this.playground.generateView(this.playgroundView, b); - this.propertyPanel.select("object"); - this.helper.bindWorkspace(this.playground.mainWorkspace); - } -}; -Entry.start = function(a) { - this.FPS || (this.FPS = 60); - Entry.assert("number" == typeof this.FPS, "FPS must be number"); - Entry.engine.start(this.FPS); -}; -Entry.parseOptions = function(a) { - this.type = a.type; - a.device && (this.device = a.device); - this.projectSaveable = a.projectsaveable; - void 0 === this.projectSaveable && (this.projectSaveable = !0); - this.objectAddable = a.objectaddable; - void 0 === this.objectAddable && (this.objectAddable = !0); - this.objectEditable = a.objectEditable; - void 0 === this.objectEditable && (this.objectEditable = !0); - this.objectEditable || (this.objectAddable = !1); - this.objectDeletable = a.objectdeletable; - void 0 === this.objectDeletable && (this.objectDeletable = !0); - this.soundEditable = a.soundeditable; - void 0 === this.soundEditable && (this.soundEditable = !0); - this.pictureEditable = a.pictureeditable; - void 0 === this.pictureEditable && (this.pictureEditable = !0); - this.sceneEditable = a.sceneEditable; - void 0 === this.sceneEditable && (this.sceneEditable = !0); - this.functionEnable = a.functionEnable; - void 0 === this.functionEnable && (this.functionEnable = !0); - this.messageEnable = a.messageEnable; - void 0 === this.messageEnable && (this.messageEnable = !0); - this.variableEnable = a.variableEnable; - void 0 === this.variableEnable && (this.variableEnable = !0); - this.listEnable = a.listEnable; - void 0 === this.listEnable && (this.listEnable = !0); - this.hasVariableManager = a.hasvariablemanager; - this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; - this.isForLecture = a.isForLecture; }; -Entry.initFonts = function(a) { - this.fonts = a; - a || (this.fonts = []); -}; -Entry.Activity = function(a, b) { - this.name = a; - this.timestamp = new Date; - a = []; - if (void 0 !== b) { - for (var c = 0, d = b.length;c < d;c++) { - var e = b[c]; - a.push({key:e[0], value:e[1]}); - } - } - this.data = a; +Entry.Painter.prototype.initCoordinator = function() { + var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); + b.addChild(a); + this.stage.addChild(b); + b.visible = !1; + this.coordinator = b; }; -Entry.ActivityReporter = function() { - this._activities = []; +Entry.Painter.prototype.toggleCoordinator = function() { + this.coordinator.visible = !this.coordinator.visible; + this.stage.update(); }; -(function(a) { - a.add = function(b) { - if (b && 0 !== b.length) { - if (!(b instanceof Entry.Activity)) { - var a = b.shift(); - b = new Entry.Activity(a, b); - } - this._activities.push(b); +Entry.Painter.prototype.initDashedLine = function() { + createjs.Graphics.prototype.dashedLineTo = function(b, a, d, c, e) { + this.moveTo(b, a); + var f = d - b, g = c - a; + e = Math.floor(Math.sqrt(f * f + g * g) / e); + for (var f = f / e, g = g / e, h = 0;h++ < e;) { + b += f, a += g, this[0 === h % 2 ? "moveTo" : "lineTo"](b, a); } + this[0 === h % 2 ? "moveTo" : "lineTo"](d, c); + return this; }; - a.clear = function() { - this._activities = []; - }; - a.get = function() { - return this._activities; + createjs.Graphics.prototype.drawDashedRect = function(b, a, d, c, e) { + this.moveTo(b, a); + d = b + d; + c = a + c; + this.dashedLineTo(b, a, d, a, e); + this.dashedLineTo(d, a, d, c, e); + this.dashedLineTo(d, c, b, c, e); + this.dashedLineTo(b, c, b, a, e); + return this; }; - a.report = function() { + createjs.Graphics.prototype.drawResizableDashedRect = function(b, a, d, c, e, f) { + this.moveTo(b, a); + d = b + d; + c = a + c; + this.dashedLineTo(b + f, a, d - f, a, e); + this.dashedLineTo(d, a + f, d, c - f, e); + this.dashedLineTo(d - f, c, b + f, c, e); + this.dashedLineTo(b, c - f, b, a + f, e); + return this; }; -})(Entry.ActivityReporter.prototype); -Entry.State = function(a, b, c, d) { - this.caller = b; - this.func = c; - 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); - this.message = a; - this.time = Entry.getUpTime(); - this.isPass = Entry.Command[a] ? Entry.Command[a].isPass : !1; -}; -Entry.State.prototype.generateMessage = function() { -}; -Entry.StateManager = function() { - this.undoStack_ = []; - this.redoStack_ = []; - this.isIgnore = this.isRestore = !1; - Entry.addEventListener("cancelLastCommand", function(a) { - Entry.stateManager.cancelLastCommand(); - }); - Entry.addEventListener("run", function(a) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("stop", function(a) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("saveWorkspace", function(a) { - Entry.stateManager.addStamp(); - }); - Entry.addEventListener("undo", function(a) { - Entry.stateManager.undo(); - }); - Entry.addEventListener("redo", function(a) { - Entry.stateManager.redo(); - }); -}; -Entry.StateManager.prototype.generateView = function(a, b) { -}; -Entry.StateManager.prototype.addCommand = function(a, b, c, d) { - if (!this.isIgnoring()) { - if (this.isRestoring()) { - var e = new Entry.State, f = Array.prototype.slice.call(arguments); - Entry.State.prototype.constructor.apply(e, f); - this.redoStack_.push(e); - Entry.reporter && Entry.reporter.report(e); - } else { - e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); - } - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } -}; -Entry.StateManager.prototype.cancelLastCommand = function() { - this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); -}; -Entry.StateManager.prototype.getLastCommand = function() { - return this.undoStack_[this.undoStack_.length - 1]; -}; -Entry.StateManager.prototype.undo = function() { - if (this.canUndo() && !this.isRestoring()) { - this.addActivity("undo"); - for (this.startRestore();this.undoStack_.length;) { - var a = this.undoStack_.pop(); - a.func.apply(a.caller, a.params); - if (!0 !== a.isPass) { - break; - } - } - this.updateView(); - this.endRestore(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } -}; -Entry.StateManager.prototype.redo = function() { - if (this.canRedo() && !this.isRestoring()) { - for (this.addActivity("redo");this.redoStack_.length;) { - var a = this.redoStack_.pop(); - a.func.apply(a.caller, a.params); - if (!0 !== a.isPass) { - break; - } - } - this.updateView(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } -}; -Entry.StateManager.prototype.updateView = function() { - this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); -}; -Entry.StateManager.prototype.startRestore = function() { - this.isRestore = !0; -}; -Entry.StateManager.prototype.endRestore = function() { - this.isRestore = !1; -}; -Entry.StateManager.prototype.isRestoring = function() { - return this.isRestore; -}; -Entry.StateManager.prototype.startIgnore = function() { - this.isIgnore = !0; -}; -Entry.StateManager.prototype.endIgnore = function() { - this.isIgnore = !1; -}; -Entry.StateManager.prototype.isIgnoring = function() { - return this.isIgnore; -}; -Entry.StateManager.prototype.canUndo = function() { - return 0 < this.undoStack_.length && Entry.engine.isState("stop"); -}; -Entry.StateManager.prototype.canRedo = function() { - return 0 < this.redoStack_.length && Entry.engine.isState("stop"); -}; -Entry.StateManager.prototype.addStamp = function() { - this.stamp = Entry.generateHash(); - this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); -}; -Entry.StateManager.prototype.isSaved = function() { - return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; -}; -Entry.StateManager.prototype.addActivity = function(a) { - Entry.reporter && Entry.reporter.report(new Entry.State(a)); -}; -Entry.BlockModel = function() { - Entry.Model(this); -}; -Entry.BlockModel.prototype.schema = {id:null, x:0, y:0, type:null, params:{}, statements:{}, prev:null, next:null, view:null}; -Entry.BlockRenderModel = function() { - Entry.Model(this); -}; -Entry.BlockRenderModel.prototype.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, width:0, height:0, magneting:!1}; -Entry.BoxModel = function() { - Entry.Model(this); -}; -Entry.BoxModel.prototype.schema = {id:0, type:Entry.STATIC.BOX_MODEL, x:0, y:0, width:0, height:0}; -Entry.DragInstance = function(a) { - Entry.Model(this); - this.set(a); }; -Entry.DragInstance.prototype.schema = {type:Entry.STATIC.DRAG_INSTANCE, startX:0, startY:0, offsetX:0, offsetY:0, absX:0, absY:0, prev:null, height:0, mode:0, isNew:!1}; -Entry.ThreadModel = function() { - Entry.Model(this); -}; -Entry.ThreadModel.prototype.schema = {id:0, type:Entry.STATIC.THREAD_MODEL, x:0, y:0, width:0, minWidth:0, height:0}; -Entry.EntryObject = function(a) { - var b = this; - if (a) { - this.id = a.id; - this.name = a.name || a.sprite.name; - this.text = a.text || this.name; - this.objectType = a.objectType; - this.objectType || (this.objectType = "sprite"); - this.script = new Entry.Code(a.script ? a.script : [], this); - this.pictures = a.sprite.pictures; - this.sounds = []; - this.sounds = a.sprite.sounds; - for (var c = 0;c < this.sounds.length;c++) { - this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); - } - this.lock = a.lock ? a.lock : !1; - this.isEditing = !1; - "sprite" == this.objectType && (this.selectedPicture = a.selectedPictureId ? this.getPicture(a.selectedPictureId) : this.pictures[0]); - this.scene = Entry.scene.getSceneById(a.scene) || Entry.scene.selectedScene; - this.setRotateMethod(a.rotateMethod); - this.entity = new Entry.EntityObject(this); - this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, a.entity ? a.entity : this.initEntity(a)); - this.clonedEntities = []; - Entry.stage.loadObject(this); - for (c in this.pictures) { - (function(a) { - a.objectId = this.id; - a.id || (a.id = Entry.generateHash()); - var c = new Image; - if (a.fileurl) { - c.src = a.fileurl; - } else { - if (a.fileurl) { - c.src = a.fileurl; - } else { - var d = a.filename; - c.src = Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/image/" + d + ".png"; - } - } - Entry.Loader.addQueue(); - c.onload = function(c) { - Entry.container.cachePicture(a.id + b.entity.id, this); - Entry.requestUpdate = !0; - Entry.Loader.removeQueue(); - }; - c.onerror = function(b) { - Entry.Loader.removeQueue(); - }; - })(this.pictures[c]); - } - } -}; -Entry.EntryObject.prototype.generateView = function() { - if ("workspace" == Entry.type) { - var a = Entry.createElement("li", this.id); - a.addClass("entryContainerListElementWorkspace"); - a.object = this; - Entry.Utils.disableContextmenu(a); - var b = this; - longPressTimer = null; - $(a).bind("mousedown touchstart", function(a) { - function c(b) { - b.stopPropagation(); - h && 5 < Math.sqrt(Math.pow(b.pageX - h.x, 2) + Math.pow(b.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); - } - function d(b) { - b.stopPropagation(); - e.unbind(".object"); - longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); - } - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - var e = $(document), f = a.type, g = !1; - if (Entry.Utils.isRightButton(a)) { - a.stopPropagation(), Entry.documentMousedown.notify(a), g = !0, b._rightClick(a); - } else { - var h = {x:a.clientX, y:a.clientY}; - "touchstart" !== f || g || (a.stopPropagation(), Entry.documentMousedown.notify(a), longPressTimer = setTimeout(function() { - longPressTimer && (longPressTimer = null, b._rightClick(a)); - }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); - } +Entry.Painter.prototype.generateView = function(b) { + var a = this; + this.view_ = b; + if (!Entry.type || "workspace" == Entry.type) { + this.view_.addClass("entryPainterWorkspace"); + var d = Entry.createElement("div", "entryPainterTop"); + d.addClass("entryPlaygroundPainterTop"); + this.view_.appendChild(d); + var c = Entry.createElement("div", "entryPainterToolbox"); + c.addClass("entryPlaygroundPainterToolbox"); + this.view_.appendChild(c); + var e = Entry.createElement("div", "entryPainterToolboxTop"); + e.addClass("entryPainterToolboxTop"); + c.appendChild(e); + var f = Entry.createElement("div", "entryPainterContainer"); + f.addClass("entryPlaygroundPainterContainer"); + this.view_.appendChild(f); + e = Entry.createElement("canvas", "entryPainterCanvas"); + e.width = 960; + e.height = 540; + e.addClass("entryPlaygroundPainterCanvas"); + f.appendChild(e); + e = Entry.createElement("canvas", "entryPainterCanvas_"); + e.addClass("entryRemove"); + e.width = 960; + e.height = 540; + f.appendChild(e); + var g = Entry.createElement("div", "entryPainterAttr"); + g.addClass("entryPlaygroundPainterAttr"); + this.view_.appendChild(g); + this.flipObject = Entry.createElement("div", "entryPictureFlip"); + this.flipObject.addClass("entryPlaygroundPainterFlip"); + g.appendChild(this.flipObject); + e = Entry.createElement("div", "entryPictureFlipX"); + e.title = "\uc88c\uc6b0\ub4a4\uc9d1\uae30"; + e.bindOnClick(function() { + a.selectedObject && (a.selectedObject.scaleX *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); }); - this.view_ = a; - var c = this, a = Entry.createElement("ul"); - a.addClass("objectInfoView"); - Entry.objectEditable || a.addClass("entryHide"); - var d = Entry.createElement("li"); - d.addClass("objectInfo_visible"); - this.entity.getVisible() || d.addClass("objectInfo_unvisible"); - d.bindOnClick(function(b) { - Entry.engine.isState("run") || (b = c.entity, b.setVisible(!b.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); + e.addClass("entryPlaygroundPainterFlipX"); + this.flipObject.appendChild(e); + e = Entry.createElement("div", "entryPictureFlipY"); + e.title = "\uc0c1\ud558\ub4a4\uc9d1\uae30"; + e.bindOnClick(function() { + a.selectedObject && (a.selectedObject.scaleY *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); }); - var e = Entry.createElement("li"); - e.addClass("objectInfo_unlock"); - this.getLock() && e.addClass("objectInfo_lock"); - e.bindOnClick(function(b) { - Entry.engine.isState("run") || (b = c, b.setLock(!b.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), b.updateInputViews(b.getLock())); + e.addClass("entryPlaygroundPainterFlipY"); + this.flipObject.appendChild(e); + Entry.addEventListener("windowResized", function(a) { + var d = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + a = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + var c = parseInt(document.getElementById("entryCanvas").style.width), d = d - (c + 240), c = a - 349; + b.style.width = d + "px"; + f.style.width = d - 54 + "px"; + f.style.height = c + "px"; + g.style.top = c + 30 + "px"; + g.style.height = a - c + "px"; }); - a.appendChild(d); - a.appendChild(e); - this.view_.appendChild(a); - a = Entry.createElement("div"); - a.addClass("entryObjectThumbnailWorkspace"); - this.view_.appendChild(a); - this.thumbnailView_ = a; - a = Entry.createElement("div"); - a.addClass("entryObjectWrapperWorkspace"); - this.view_.appendChild(a); - d = Entry.createElement("input"); - d.bindOnClick(function(b) { - b.preventDefault(); - Entry.container.selectObject(c.id); - this.readOnly || (this.focus(), this.select()); + var h = Entry.createElement("nav", "entryPainterTopMenu"); + h.addClass("entryPlaygroundPainterTopMenu"); + d.appendChild(h); + e = Entry.createElement("ul"); + h.appendChild(e); + var k = Entry.createElement("li"); + h.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuFileNew"); + h.bindOnClick(function() { + a.newPicture(); }); - d.addClass("entryObjectNameWorkspace"); - a.appendChild(d); - this.nameView_ = d; - this.nameView_.entryObject = this; - d.setAttribute("readonly", !0); - var f = this; - this.nameView_.onblur = function(b) { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }; - this.nameView_.onkeypress = function(b) { - 13 == b.keyCode && f.editObjectValues(!1); - }; - this.nameView_.value = this.name; - d = Entry.createElement("div"); - d.addClass("entryObjectEditWorkspace"); - d.object = this; - this.editView_ = d; - this.view_.appendChild(d); - $(d).mousedown(function(a) { - var c = b.isEditing; - a.stopPropagation(); - Entry.documentMousedown.notify(a); - Entry.engine.isState("run") || !1 !== c || (b.editObjectValues(!c), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); + h.addClass("entryPlaygroundPainterTopMenuFileNew"); + h.innerHTML = Lang.Workspace.new_picture; + k.appendChild(h); + h = Entry.createElement("li", "entryPainterTopMenuFile"); + h.addClass("entryPlaygroundPainterTopMenuFile"); + h.innerHTML = Lang.Workspace.painter_file; + e.appendChild(h); + k = Entry.createElement("ul"); + h.appendChild(k); + h = Entry.createElement("li"); + k.appendChild(h); + var l = Entry.createElement("a", "entryPainterTopMenuFileSave"); + l.bindOnClick(function() { + a.file_save(!1); }); - d.blur = function(a) { - b.editObjectComplete(); - }; - Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeleteWorkspace"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(b) { - Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })); - d = Entry.createElement("div"); - d.addClass("entryObjectInformationWorkspace"); - d.object = this; - this.isInformationToggle = !1; - a.appendChild(d); - this.informationView_ = d; - a = Entry.createElement("div"); - a.addClass("entryObjectRotationWrapperWorkspace"); - a.object = this; - this.view_.appendChild(a); - d = Entry.createElement("span"); - d.addClass("entryObjectCoordinateWorkspace"); - a.appendChild(d); - e = Entry.createElement("span"); - e.addClass("entryObjectCoordinateSpanWorkspace"); - e.innerHTML = "X:"; - var g = Entry.createElement("input"); - g.addClass("entryObjectCoordinateInputWorkspace"); - g.setAttribute("readonly", !0); - g.bindOnClick(function(b) { - b.stopPropagation(); - this.select(); + l.addClass("entryPainterTopMenuFileSave"); + l.innerHTML = Lang.Workspace.painter_file_save; + h.appendChild(l); + h = Entry.createElement("li"); + k.appendChild(h); + k = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); + k.bindOnClick(function() { + a.file.mode = "new"; + a.file_save(!1); }); - var h = Entry.createElement("span"); - h.addClass("entryObjectCoordinateSpanWorkspace"); - h.innerHTML = "Y:"; - var k = Entry.createElement("input"); - k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); - k.bindOnClick(function(b) { - b.stopPropagation(); - this.select(); + k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); + k.innerHTML = Lang.Workspace.painter_file_saveas; + h.appendChild(k); + k = Entry.createElement("li", "entryPainterTopMenuEdit"); + k.addClass("entryPlaygroundPainterTopMenuEdit"); + k.innerHTML = Lang.Workspace.painter_edit; + e.appendChild(k); + e = Entry.createElement("ul"); + k.appendChild(e); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); + h.bindOnClick(function() { + Entry.dispatchEvent("openPictureImport"); }); - k.setAttribute("readonly", !0); - var l = Entry.createElement("span"); - l.addClass("entryObjectCoordinateSizeWorkspace"); - l.innerHTML = Lang.Workspace.Size + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); - m.bindOnClick(function(b) { - b.stopPropagation(); - this.select(); + h.addClass("entryPainterTopMenuEditImport"); + h.innerHTML = Lang.Workspace.get_file; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditCopy"); + h.bindOnClick(function() { + a.edit_copy(); }); - m.setAttribute("readonly", !0); - d.appendChild(e); - d.appendChild(g); - d.appendChild(h); - d.appendChild(k); - d.appendChild(l); - d.appendChild(m); - d.xInput_ = g; - d.yInput_ = k; - d.sizeInput_ = m; - this.coordinateView_ = d; - c = this; - g.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }; - g.onblur = function(b) { - isNaN(g.value) || c.entity.setX(Number(g.value)); - c.updateCoordinateView(); - Entry.stage.updateObject(); - }; - k.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }; - k.onblur = function(b) { - isNaN(k.value) || c.entity.setY(Number(k.value)); - c.updateCoordinateView(); - Entry.stage.updateObject(); - }; - m.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }; - m.onblur = function(b) { - isNaN(m.value) || c.entity.setSize(Number(m.value)); - c.updateCoordinateView(); - Entry.stage.updateObject(); - }; - 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 + " : "; - var n = Entry.createElement("input"); - n.addClass("entryObjectRotateInputWorkspace"); - n.setAttribute("readonly", !0); - n.bindOnClick(function(b) { - b.stopPropagation(); - this.select(); + h.addClass("entryPlaygroundPainterTopMenuEditCopy"); + h.innerHTML = Lang.Workspace.copy_file; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditCut"); + h.bindOnClick(function() { + a.edit_cut(); }); - this.rotateSpan_ = e; - this.rotateInput_ = n; - h = Entry.createElement("span"); - h.addClass("entryObjectDirectionSpanWorkspace"); - h.innerHTML = Lang.Workspace.direction + " : "; - var q = Entry.createElement("input"); - q.addClass("entryObjectDirectionInputWorkspace"); - q.setAttribute("readonly", !0); - q.bindOnClick(function(b) { - b.stopPropagation(); - this.select(); + h.addClass("entryPlaygroundPainterTopMenuEditCut"); + h.innerHTML = Lang.Workspace.cut_picture; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditPaste"); + h.bindOnClick(function() { + a.edit_paste(); }); - this.directionInput_ = q; + h.addClass("entryPlaygroundPainterTopMenuEditPaste"); + h.innerHTML = Lang.Workspace.paste_picture; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + e = Entry.createElement("a", "entryPainterTopMenuEditEraseAll"); + e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); + e.innerHTML = Lang.Workspace.remove_all; + e.bindOnClick(function() { + a.clearCanvas(); + }); + k.appendChild(e); + this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); + e.addClass("entryPlaygroundPainterTopStageXY"); d.appendChild(e); - d.appendChild(n); - d.appendChild(h); - d.appendChild(q); - d.rotateInput_ = n; - d.directionInput_ = q; - c = this; - n.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }; - n.onblur = function(b) { - b = n.value; - -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); - isNaN(b) || c.entity.setRotation(Number(b)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - q.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }; - q.onblur = function(b) { - b = q.value; - -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); - isNaN(b) || c.entity.setDirection(Number(b)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - d = Entry.createElement("div"); - d.addClass("rotationMethodWrapper"); - a.appendChild(d); - this.rotationMethodWrapper_ = d; - a = Entry.createElement("span"); - a.addClass("entryObjectRotateMethodLabelWorkspace"); - d.appendChild(a); - a.innerHTML = Lang.Workspace.rotate_method + " : "; - a = Entry.createElement("div"); - a.addClass("entryObjectRotateModeWorkspace"); - a.addClass("entryObjectRotateModeAWorkspace"); - a.object = this; - this.rotateModeAView_ = a; - d.appendChild(a); - a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); + e = Entry.createElement("ul", "entryPainterTopToolbar"); + e.addClass("entryPlaygroundPainterTopToolbar"); + d.appendChild(e); + d = Entry.createElement("li", "entryPainterTopToolbarUndo"); + d.bindOnClick(function() { }); - a = Entry.createElement("div"); - a.addClass("entryObjectRotateModeWorkspace"); - a.addClass("entryObjectRotateModeBWorkspace"); - a.object = this; - this.rotateModeBView_ = a; - d.appendChild(a); - a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); + d.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(d); + d = Entry.createElement("li", "entryPainterTopToolbarRedo"); + d.bindOnClick(function() { }); - a = Entry.createElement("div"); - a.addClass("entryObjectRotateModeWorkspace"); - a.addClass("entryObjectRotateModeCWorkspace"); - a.object = this; - this.rotateModeCView_ = a; - d.appendChild(a); - a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); - }); - this.updateThumbnailView(); - this.updateCoordinateView(); - this.updateRotateMethodView(); - this.updateInputViews(); - this.updateCoordinateView(!0); - this.updateRotationView(!0); - return this.view_; - } - if ("phone" == Entry.type) { - return a = Entry.createElement("li", this.id), a.addClass("entryContainerListElementWorkspace"), a.object = this, a.bindOnClick(function(b) { - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - }), $ && (b = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(b) { - b.preventDefault(); - }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(a) { - a.preventDefault(); - Entry.container.addCloneObject(b); - }}, {text:Lang.Workspace.context_remove, href:"/", action:function(a) { - a.preventDefault(); - Entry.container.removeObject(b); - }}])), this.view_ = a, a = Entry.createElement("ul"), a.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), a.appendChild(d), a.appendChild(e), this.view_.appendChild(a), a = Entry.createElement("div"), a.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(a), this.thumbnailView_ = a, a = Entry.createElement("div"), a.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(a), - d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), a.appendChild(d), this.nameView_ = d, this.nameView_.entryObject = this, this.nameView_.onblur = function() { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }, this.nameView_.onkeypress = function(b) { - 13 == b.keyCode && c.editObjectValues(!1); - }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeletePhone"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(b) { - Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(b) { - if (b = Entry.container.getObject(this.id)) { - Entry.container.selectObject(b.id), Entry.playground.injectObject(b); - } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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 + " : ", n = Entry.createElement("input"), - n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, 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(n), d.appendChild(h), d.appendChild(q), d.rotateInput_ = n, d.directionInput_ = q, c = this, n.onkeypress = function(b) { - 13 == b.keyCode && (b = n.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), n.blur()); - }, n.onblur = function(b) { - c.entity.setRotation(c.entity.getRotation()); - Entry.stage.updateObject(); - }, q.onkeypress = function(b) { - 13 == b.keyCode && (b = q.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), q.blur()); - }, q.onblur = function(b) { - c.entity.setDirection(c.entity.getDirection()); - Entry.stage.updateObject(); - }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.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, m = Entry.createElement("input"), m.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(m), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = m, this.coordinateView_ = d, c = this, g.onkeypress = function(b) { - 13 == b.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); - }, g.onblur = function(b) { - c.entity.setX(c.entity.getX()); - Entry.stage.updateObject(); - }, k.onkeypress = function(b) { - 13 == b.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); - }, k.onblur = function(b) { - c.entity.setY(c.entity.getY()); - Entry.stage.updateObject(); - }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), a.appendChild(d), this.rotationMethodWrapper_ = d, a = Entry.createElement("span"), a.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(a), a.innerHTML = Lang.Workspace.rotate_method + " : ", a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeAWorkspace"), a.object = this, this.rotateModeAView_ = a, d.appendChild(a), a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.setRotateMethod("free"); - }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeBWorkspace"), a.object = this, this.rotateModeBView_ = a, d.appendChild(a), a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); - }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeCWorkspace"), a.object = this, this.rotateModeCView_ = a, d.appendChild(a), a.bindOnClick(function(b) { - Entry.engine.isState("run") || this.object.setRotateMethod("none"); - }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; - } -}; -Entry.EntryObject.prototype.setName = function(a) { - Entry.assert("string" == typeof a, "object name must be string"); - this.name = a; - this.nameView_.value = a; -}; -Entry.EntryObject.prototype.setText = function(a) { - Entry.assert("string" == typeof a, "object text must be string"); - this.text = a; -}; -Entry.EntryObject.prototype.setScript = function(a) { - this.script = a; -}; -Entry.EntryObject.prototype.getScriptText = function() { - return JSON.stringify(this.script.toJSON()); -}; -Entry.EntryObject.prototype.initEntity = function(a) { - var b = {}; - b.x = b.y = 0; - b.rotation = 0; - b.direction = 90; - if ("sprite" == this.objectType) { - var c = a.sprite.pictures[0].dimension; - b.regX = c.width / 2; - b.regY = c.height / 2; - b.scaleX = b.scaleY = "background" == a.sprite.category.main || "new" == a.sprite.category.main ? Math.max(270 / c.height, 480 / c.width) : "new" == a.sprite.category.main ? 1 : 200 / (c.width + c.height); - b.width = c.width; - b.height = c.height; - } else { - if ("textBox" == this.objectType) { - if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.text, a.options) { - if (a = a.options, c = "", a.bold && (c += "bold "), a.italic && (c += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = c + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) { - b.width = 256, b.height = .5625 * b.width, b.regX = b.width / 2, b.regY = b.height / 2; - } - } else { - b.underline = !1, b.strike = !1, b.font = "20px Nanum Gothic", b.colour = "#000000", b.bgColor = "#ffffff"; - } - } - } - return b; -}; -Entry.EntryObject.prototype.updateThumbnailView = function() { - if ("sprite" == this.objectType) { - if (this.entity.picture.fileurl) { - this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; - } else { - var a = this.entity.picture.filename; - this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/thumb/" + a + '.png")'; - } - } else { - "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); - } -}; -Entry.EntryObject.prototype.updateCoordinateView = function(a) { - if ((this.isSelected() || a) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { - a = this.coordinateView_.xInput_.value; - var b = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); - a != d && (this.coordinateView_.xInput_.value = d); - b != e && (this.coordinateView_.yInput_.value = e); - c != f && (this.coordinateView_.sizeInput_.value = f); - } -}; -Entry.EntryObject.prototype.updateRotationView = function(a) { - if (this.isSelected() && this.view_ || a) { - a = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), a += this.entity.getRotation().toFixed(1), this.rotateInput_.value = a + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), a = "" + this.entity.getDirection().toFixed(1), this.directionInput_.value = a + "\u02da"; - } -}; -Entry.EntryObject.prototype.select = function(a) { - console.log(this); -}; -Entry.EntryObject.prototype.addPicture = function(a, b) { - Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, a.id); - a.objectId = this.id; - b || 0 === b ? (this.pictures.splice(b, 0, a), Entry.playground.injectPicture(this)) : this.pictures.push(a); - return new Entry.State(this, this.removePicture, a.id); -}; -Entry.EntryObject.prototype.removePicture = function(a) { - if (2 > this.pictures.length) { - return !1; - } - a = this.getPicture(a); - var b = this.pictures.indexOf(a); - Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, a, b); - this.pictures.splice(b, 1); - a === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); - Entry.playground.injectPicture(this); - Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addPicture, a, b); -}; -Entry.EntryObject.prototype.getPicture = function(a) { - if (!a) { - return this.selectedPicture; - } - a = a.trim(); - for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { - if (b[d].id == a) { - return b[d]; - } - } - for (d = 0;d < c;d++) { - if (b[d].name == a) { - return b[d]; - } - } - a = Entry.parseNumber(a); - if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { - return b[a - 1]; - } - throw Error("No picture found"); -}; -Entry.EntryObject.prototype.setPicture = function(a) { - for (var b in this.pictures) { - if (a.id === this.pictures[b].id) { - this.pictures[b] = a; - return; - } - } - throw Error("No picture found"); -}; -Entry.EntryObject.prototype.getPrevPicture = function(a) { - for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { - if (b[d].id == a) { - return b[0 == d ? c - 1 : d - 1]; - } - } -}; -Entry.EntryObject.prototype.getNextPicture = function(a) { - for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { - if (b[d].id == a) { - return b[d == c - 1 ? 0 : d + 1]; - } - } -}; -Entry.EntryObject.prototype.selectPicture = function(a) { - var b = this.getPicture(a); - if (b) { - this.selectedPicture = b, this.entity.setImage(b), this.updateThumbnailView(); - } else { - throw Error("No picture with pictureId : " + a); - } -}; -Entry.EntryObject.prototype.addSound = function(a, b) { - a.id || (a.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, a.id); - Entry.initSound(a, b); - b || 0 === b ? (this.sounds.splice(b, 0, a), Entry.playground.injectSound(this)) : this.sounds.push(a); - return new Entry.State(this, this.removeSound, a.id); -}; -Entry.EntryObject.prototype.removeSound = function(a) { - var b; - b = this.getSound(a); - a = this.sounds.indexOf(b); - Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, b, a); - this.sounds.splice(a, 1); - Entry.playground.reloadPlayground(); - Entry.playground.injectSound(this); - return new Entry.State(this, this.addSound, b, a); -}; -Entry.EntryObject.prototype.getRotateMethod = function() { - this.rotateMethod || (this.rotateMethod = "free"); - return this.rotateMethod; -}; -Entry.EntryObject.prototype.setRotateMethod = function(a) { - a || (a = "free"); - this.rotateMethod = a; - this.updateRotateMethodView(); - Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); -}; -Entry.EntryObject.prototype.initRotateValue = function(a) { - this.rotateMethod != a && (a = this.entity, a.rotation = 0, a.direction = 90, a.flip = !1); -}; -Entry.EntryObject.prototype.updateRotateMethodView = function() { - var a = this.rotateMethod; - this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == a ? this.rotateModeAView_.addClass("selected") : "vertical" == a ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); -}; -Entry.EntryObject.prototype.toggleInformation = function(a) { - this.setRotateMethod(this.getRotateMethod()); - void 0 === a && (a = this.isInformationToggle = !this.isInformationToggle); - a ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); -}; -Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { - this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), - a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); -}; -Entry.EntryObject.prototype.initializeSplitter = function(a) { - a.onmousedown = function(b) { - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - }; - document.addEventListener("mousemove", function(b) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.x || b.clientX}); - }); - document.addEventListener("mouseup", function(b) { - Entry.container.splitterEnable = !1; - Entry.container.enableSort(); - }); -}; -Entry.EntryObject.prototype.isSelected = function() { - return this.isSelected_; -}; -Entry.EntryObject.prototype.toJSON = function() { - var a = {}; - a.id = this.id; - a.name = this.name; - "textBox" == this.objectType && (a.text = this.text); - a.script = this.getScriptText(); - "sprite" == this.objectType && (a.selectedPictureId = this.selectedPicture.id); - a.objectType = this.objectType; - a.rotateMethod = this.getRotateMethod(); - a.scene = this.scene.id; - a.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; - a.lock = this.lock; - a.entity = this.entity.toJSON(); - return a; -}; -Entry.EntryObject.prototype.destroy = function() { - Entry.stage.unloadEntity(this.entity); - this.view_ && Entry.removeElement(this.view_); -}; -Entry.EntryObject.prototype.getSound = function(a) { - a = a.trim(); - for (var b = this.sounds, c = b.length, d = 0;d < c;d++) { - if (b[d].id == a) { - return b[d]; - } - } - for (d = 0;d < c;d++) { - if (b[d].name == a) { - return b[d]; - } - } - a = Entry.parseNumber(a); - if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { - return b[a - 1]; - } - throw Error("No Sound"); -}; -Entry.EntryObject.prototype.addCloneVariables = function(a, b, c, d) { - b.variables = []; - b.lists = []; - c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", a.id)); - d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", a.id)); - for (a = 0;a < c.length;a++) { - b.variables.push(c[a].clone()); - } - for (a = 0;a < d.length;a++) { - b.lists.push(d[a].clone()); - } -}; -Entry.EntryObject.prototype.getLock = function() { - return this.lock; -}; -Entry.EntryObject.prototype.setLock = function(a) { - this.lock = a; - Entry.stage.updateObject(); - return a; -}; -Entry.EntryObject.prototype.updateInputViews = function(a) { - a = a || this.getLock(); - var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (a && 1 != b[0].getAttribute("readonly")) { - for (a = 0;a < b.length;a++) { - b[a].removeClass("selectedEditingObject"), b[a].setAttribute("readonly", !1), this.isEditing = !1; - } - } -}; -Entry.EntryObject.prototype.editObjectValues = function(a) { - var b; - b = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (a) { - var c = this.nameView_; - $(b).removeClass("selectedNotEditingObject"); - $(c).removeClass("selectedNotEditingObject"); - window.setTimeout(function() { - $(c).removeAttr("readonly"); - c.addClass("selectedEditingObject"); - }); - for (a = 0;a < b.length;a++) { - $(b[a]).removeAttr("readonly"), b[a].addClass("selectedEditingObject"); - } - this.isEditing = !0; - } else { - for (a = 0;a < b.length;a++) { - b[a].blur(!0); - } - this.nameView_.blur(!0); - this.blurAllInput(); - this.isEditing = !1; - } -}; -Entry.EntryObject.prototype.blurAllInput = function() { - var a = document.getElementsByClassName("selectedEditingObject"); - $(a).removeClass("selectedEditingObject"); - for (var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], b = 0;b < a.length;b++) { - a[b].addClass("selectedNotEditingObject"), a[b].setAttribute("readonly", !0); - } -}; -Entry.EntryObject.prototype.addStampEntity = function(a) { - a = new Entry.StampEntity(this, a); - Entry.stage.loadEntity(a); - this.clonedEntities.push(a); - Entry.stage.sortZorder(); -}; -Entry.EntryObject.prototype.getClonedEntities = function() { - var a = []; - this.clonedEntities.map(function(b) { - b.isStamp || a.push(b); - }); - return a; -}; -Entry.EntryObject.prototype.getStampEntities = function() { - var a = []; - this.clonedEntities.map(function(b) { - b.isStamp && a.push(b); - }); - return a; -}; -Entry.EntryObject.prototype.clearExecutor = function() { - this.script.clearExecutors(); -}; -Entry.EntryObject.prototype._rightClick = function(a) { - var b = this, c = [{text:Lang.Workspace.context_rename, callback:function(a) { - a.stopPropagation(); - b.setLock(!1); - b.editObjectValues(!0); - b.nameView_.select(); - }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { - Entry.container.addCloneObject(b); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.container.removeObject(b); - }}, {text:Lang.Workspace.copy_file, callback:function() { - Entry.container.setCopiedObject(b); - }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - a = Entry.Utils.convertMouseEvent(a); - Entry.ContextMenu.show(c, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); -}; -Entry.Painter = function() { - this.toolbox = {selected:"cursor"}; - this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; - this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; - this.font = {name:"KoPub Batang", size:20, style:"normal"}; - this.selectArea = {}; - this.firstStatement = !1; -}; -Entry.Painter.prototype.initialize = function(a) { - this.generateView(a); - this.canvas = document.getElementById("entryPainterCanvas"); - this.canvas_ = document.getElementById("entryPainterCanvas_"); - this.stage = new createjs.Stage(this.canvas); - this.stage.autoClear = !0; - this.stage.enableDOMEvents(!0); - this.stage.enableMouseOver(10); - this.stage.mouseMoveOutside = !0; - createjs.Touch.enable(this.stage); - this.objectContainer = new createjs.Container; - this.objectContainer.name = "container"; - this.stage.addChild(this.objectContainer); - this.ctx = this.stage.canvas.getContext("2d"); - this.ctx.imageSmoothingEnabled = !1; - this.ctx.webkitImageSmoothingEnabled = !1; - this.ctx.mozImageSmoothingEnabled = !1; - this.ctx.msImageSmoothingEnabled = !1; - this.ctx.oImageSmoothingEnabled = !1; - this.ctx_ = this.canvas_.getContext("2d"); - this.initDashedLine(); - this.initPicture(); - this.initCoordinator(); - this.initHandle(); - this.initDraw(); - var b = this; - Entry.addEventListener("textUpdate", function() { - var a = b.inputField.value(); - "" === a ? (b.inputField.hide(), delete b.inputField) : (b.inputField.hide(), b.drawText(a), b.selectToolbox("cursor")); - }); - this.selectToolbox("cursor"); -}; -Entry.Painter.prototype.initHandle = function() { - this._handle = new createjs.Container; - this._handle.rect = new createjs.Shape; - this._handle.addChild(this._handle.rect); - var a = new createjs.Container; - a.name = "move"; - a.width = 90; - a.height = 90; - a.x = 90; - a.y = 90; - a.rect = new createjs.Shape; - var b = this; - a.rect.on("mousedown", function(c) { - "cursor" === b.toolbox.selected && (b.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", a.isSelectCenter = !1); - }); - a.rect.on("pressmove", function(c) { - "cursor" !== b.toolbox.selected || a.isSelectCenter || (b.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, b.updateImageHandle()); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - a.rect.cursor = "move"; - a.addChild(a.rect); - a.notch = new createjs.Shape; - a.addChild(a.notch); - a.NEHandle = this.generateCornerHandle(); - a.addChild(a.NEHandle); - a.NWHandle = this.generateCornerHandle(); - a.addChild(a.NWHandle); - a.SWHandle = this.generateCornerHandle(); - a.addChild(a.SWHandle); - a.SEHandle = this.generateCornerHandle(); - a.addChild(a.SEHandle); - a.EHandle = this.generateXHandle(); - a.addChild(a.EHandle); - a.WHandle = this.generateXHandle(); - a.addChild(a.WHandle); - a.NHandle = this.generateYHandle(); - a.addChild(a.NHandle); - a.SHandle = this.generateYHandle(); - a.addChild(a.SHandle); - a.RHandle = new createjs.Shape; - a.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); - a.RHandle.on("mousedown", function(a) { - b.initCommand(); - }); - a.RHandle.on("pressmove", function(a) { - b.doCommand(); - var c = a.stageX - this.parent.x; - a = a.stageY - this.parent.y; - this.parent.rotation = 0 <= c ? Math.atan(a / c) / Math.PI * 180 + 90 : Math.atan(a / c) / Math.PI * 180 + 270; - b.updateImageHandle(); - }); - a.RHandle.cursor = "crosshair"; - a.addChild(a.RHandle); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - a.visible = !1; - this.handle = a; - this.stage.addChild(a); - this.updateImageHandleCursor(); -}; -Entry.Painter.prototype.generateCornerHandle = function() { - var a = this, b = new createjs.Shape; - b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - b.on("mousedown", function(b) { - a.initCommand(); - this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}; - }); - b.on("pressmove", function(b) { - a.doCommand(); - var c = Math.sqrt(Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x * (b.stageY - this.parent.y + this.parent.regY) / this.offset.y)); - 10 < this.parent.width * c && 10 < this.parent.height * c && (this.parent.width *= c, this.parent.height *= c, this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}); - a.updateImageHandle(); - }); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - return b; -}; -Entry.Painter.prototype.generateXHandle = function() { - var a = this, b = new createjs.Shape; - b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - b.on("mousedown", function(b) { - a.initCommand(); - this.offset = {x:b.stageX - this.parent.x + this.parent.regX}; - }); - b.on("pressmove", function(b) { - a.doCommand(); - var c = Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x); - 10 < this.parent.width * c && (this.parent.width *= c, this.offset = {x:b.stageX - this.parent.x + this.parent.regX}); - a.updateImageHandle(); - }); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - return b; -}; -Entry.Painter.prototype.generateYHandle = function() { - var a = this, b = new createjs.Shape; - b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - b.on("mousedown", function(b) { - a.initCommand(); - this.offset = {y:b.stageY - this.parent.y + this.parent.regY}; - }); - b.on("pressmove", function(b) { - a.doCommand(); - var c = Math.abs((b.stageY - this.parent.y + this.parent.regY) / this.offset.y); - 10 < this.parent.height * c && (this.parent.height *= c, this.offset = {y:b.stageY - this.parent.y + this.parent.regY}); - a.updateImageHandle(); - }); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - return b; -}; -Entry.Painter.prototype.updateImageHandle = function() { - if (this.handle.visible) { - var a = this.handle, b = a.direction, c = a.width, d = a.height, e = a.regX, f = a.regY; - a.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); - a.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); - a.NEHandle.x = +a.width / 2; - a.NEHandle.y = -a.height / 2; - a.NWHandle.x = -a.width / 2; - a.NWHandle.y = -a.height / 2; - a.SWHandle.x = -a.width / 2; - a.SWHandle.y = +a.height / 2; - a.SEHandle.x = +a.width / 2; - a.SEHandle.y = +a.height / 2; - a.EHandle.x = +a.width / 2; - a.EHandle.y = 0; - a.WHandle.x = -a.width / 2; - a.WHandle.y = 0; - a.NHandle.x = 0; - a.NHandle.y = -a.height / 2; - a.SHandle.x = 0; - a.SHandle.y = +a.height / 2; - a.RHandle.x = -2; - a.RHandle.y = -a.height / 2 - 20 - 2; - this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = a.width / c.width, c.scaleY = a.height / c.height, c.x = a.x, c.y = a.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = a.rotation, c.direction = b, this.selectArea.x1 = a.x - a.width / 2, this.selectArea.y1 = a.y - a.height / 2, this.selectArea.x2 = - a.width, this.selectArea.y2 = a.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); - this.updateImageHandleCursor(); - this.stage.update(); - } -}; -Entry.Painter.prototype.updateImageHandleCursor = function() { - var a = this.handle; - a.rect.cursor = "move"; - a.RHandle.cursor = "crosshair"; - for (var b = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((a.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { - b.push(b.shift()); - } - a.NHandle.cursor = b[1]; - a.NEHandle.cursor = b[2]; - a.EHandle.cursor = b[3]; - a.SEHandle.cursor = b[0]; - a.SHandle.cursor = b[1]; - a.SWHandle.cursor = b[2]; - a.WHandle.cursor = b[3]; - a.NWHandle.cursor = b[0]; -}; -Entry.Painter.prototype.clearCanvas = function(a) { - this.clearHandle(); - a || this.initCommand(); - this.objectContainer.removeAllChildren(); - this.stage.update(); - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - a = 0; - for (var b = this.colorLayerData.data.length;a < b;a++) { - this.colorLayerData.data[a] = 255, this.colorLayerData.data[a + 1] = 255, this.colorLayerData.data[a + 2] = 255, this.colorLayerData.data[a + 3] = 255; - } - this.reloadContext(); -}; -Entry.Painter.prototype.newPicture = function() { - var a = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; - a.id = Entry.generateHash(); - Entry.playground.addPicture(a, !0); -}; -Entry.Painter.prototype.initPicture = function() { - var a = this; - Entry.addEventListener("pictureSelected", function(b) { - a.selectToolbox("cursor"); - if (a.file.id !== b.id) { - a.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (a.file_ = JSON.parse(JSON.stringify(a.file)), a.file_save(!0)); - a.file.modified = !1; - a.clearCanvas(!0); - var c = new Image; - c.id = b.id ? b.id : Entry.generateHash(); - a.file.id = c.id; - a.file.name = b.name; - a.file.mode = "edit"; - c.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; - c.onload = function(b) { - a.addImage(b.target); - }; - } - }); - Entry.addEventListener("pictureImport", function(b) { - a.addPicture(b); - }); - Entry.addEventListener("pictureNameChanged", function(b) { - a.file.name = b.name; - }); - Entry.addEventListener("pictureClear", function(b) { - a.file.modified = !1; - a.file.id = ""; - a.file.name = ""; - a.clearCanvas(); - }); -}; -Entry.Painter.prototype.initDraw = function() { - var a = this; - this.stage.on("stagemousedown", function(b) { - a.stagemousedown(b); - }); - this.stage.on("stagemouseup", function(b) { - a.stagemouseup(b); - }); - this.stage.on("stagemousemove", function(b) { - a.stagemousemove(b); - }); -}; -Entry.Painter.prototype.selectObject = function(a, b) { - this.selectedObject = a; - this.handle.visible = a.visible; - b ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = a.scaleX * a.image.width, this.handle.height = a.scaleY * a.image.height, this.handle.x = a.x, this.handle.y = a.y, this.handle.regX = +(a.regX - a.image.width / 2) * a.scaleX, this.handle.regY = +(a.regY - a.image.height / 2) * a.scaleY); - this.handle.rotation = a.rotation; - this.handle.direction = 0; - this.updateImageHandle(); -}; -Entry.Painter.prototype.selectTextObject = function(a) { - this.selectedObject = a; - var b = a.getTransformedBounds(); - this.handle.visible = a.visible; - a.width || (this.selectedObject.width = b.width); - a.height || (this.selectedObject.height = b.height); - this.handle.width = a.scaleX * this.selectedObject.width; - this.handle.height = a.scaleY * this.selectedObject.height; - this.handle.x = a.x; - this.handle.y = a.y; - a.regX || (a.regX = a.width / 2); - a.regY || (a.regY = a.height / 2); - this.handle.regX = (a.regX - this.selectedObject.width / 2) * a.scaleX; - this.handle.regY = (a.regY - this.selectedObject.height / 2) * a.scaleY; - this.handle.rotation = a.rotation; - this.handle.direction = 0; - this.updateImageHandle(); -}; -Entry.Painter.prototype.updateHandle = function() { - -1 < this.stage.getChildIndex(this._handle) && this.stage.removeChild(this._handle); - -1 === this.stage.getChildIndex(this.handle) && this.stage.addChild(this.handle); - var a = new createjs.Shape; - a.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.handle.rect.hitArea = a; - this.handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#000000").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 4); - this.stage.update(); -}; -Entry.Painter.prototype.updateHandle_ = function() { - this.stage.getChildIndex(-1 < this._handle) && this.stage.addChild(this._handle); - this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); - this.stage.update(); -}; -Entry.Painter.prototype.matchTolerance = function(a, b, c, d, e) { - var f = this.colorLayerData.data[a], g = this.colorLayerData.data[a + 1]; - a = this.colorLayerData.data[a + 2]; - return f >= b - e / 100 * b && f <= b + e / 100 * b && g >= c - e / 100 * c && g <= c + e / 100 * c && a >= d - e / 100 * d && a <= d + e / 100 * d; -}; -Entry.Painter.prototype.matchColorOnly = function(a, b, c, d) { - return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] ? !0 : !1; -}; -Entry.Painter.prototype.matchColor = function(a, b, c, d, e) { - return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] && e === this.colorLayerData.data[a + 3] ? !0 : !1; -}; -Entry.Painter.prototype.colorPixel = function(a, b, c, d, e) { - e || (e = 255); - this.stroke.transparent && (e = d = c = b = 0); - this.colorLayerData.data[a] = b; - this.colorLayerData.data[a + 1] = c; - this.colorLayerData.data[a + 2] = d; - this.colorLayerData.data[a + 3] = e; -}; -Entry.Painter.prototype.pickStrokeColor = function(a) { - a = 4 * (Math.round(a.stageY) * this.canvas.width + Math.round(a.stageX)); - this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[a], this.colorLayerData.data[a + 1], this.colorLayerData.data[a + 2]); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = this.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; -}; -Entry.Painter.prototype.drawText = function(a) { - var b = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; - a = new createjs.Text(a, b + " " + d + 'px "' + c + '"', this.stroke.lineColor); - a.textBaseline = "top"; - a.x = this.oldPt.x; - a.y = this.oldPt.y; - this.objectContainer.addChild(a); - this.selectTextObject(a); - this.file.modified = !0; -}; -Entry.Painter.prototype.addImage = function(a) { - var b = new createjs.Bitmap(a); - this.objectContainer.addChild(b); - b.x = this.stage.canvas.width / 2; - b.y = this.stage.canvas.height / 2; - b.regX = b.image.width / 2 | 0; - b.regY = b.image.height / 2 | 0; - if (540 < b.image.height) { - var c = 540 / b.image.height; - b.scaleX = c; - b.scaleY = c; - } - b.name = a.id; - b.id = a.id; - this.selectObject(b); - this.stage.update(); -}; -Entry.Painter.prototype.createBrush = function() { - this.initCommand(); - this.brush = new createjs.Shape; - this.objectContainer.addChild(this.brush); - this.stage.update(); -}; -Entry.Painter.prototype.createEraser = function() { - this.initCommand(); - this.eraser = new createjs.Shape; - this.objectContainer.addChild(this.eraser); - this.stage.update(); -}; -Entry.Painter.prototype.clearHandle = function() { - this.handle.visible && (this.handle.visible = !1); - this.coordinator.visible && (this.coordinator.visible = !1); - this.stage.update(); -}; -Entry.Painter.prototype.initCommand = function() { - var a = !1; - this.handle.visible && (a = !0, this.handle.visible = !1); - var b = !1; - this.coordinator.visible && (b = !0, this.coordinator.visible = !1); - (a || b) && this.stage.update(); - this.isCommandValid = !1; - this.colorLayerModel = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - Entry.stateManager && this.firstStatement && Entry.stateManager.addCommand("edit sprite", this, this.restorePainter, this.colorLayerModel); - this.firstStatement = !0; - a && (this.handle.visible = !0); - b && (this.coordinator.visible = !0); - (a || b) && this.stage.update(); -}; -Entry.Painter.prototype.doCommand = function() { - this.isCommandValid = !0; -}; -Entry.Painter.prototype.checkCommand = function() { - this.isCommandValid || Entry.dispatchEvent("cancelLastCommand"); -}; -Entry.Painter.prototype.restorePainter = function(a) { - this.clearHandle(); - var b = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(a, 0, 0); - a = new Image; - a.src = this.canvas.toDataURL(); - var c = this; - a.onload = function(b) { - b = new createjs.Bitmap(b.target); - c.objectContainer.removeAllChildren(); - c.objectContainer.addChild(b); - }; - Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, b); -}; -Entry.Painter.prototype.platten = function() { - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.reloadContext(); -}; -Entry.Painter.prototype.fill = function() { - if (!this.stroke.locked) { - this.stroke.locked = !0; - this.initCommand(); - this.doCommand(); - this.clearHandle(); - var a = this.canvas.width, b = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, a, b); - var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); - c.x = Math.round(c.x); - c.y = Math.round(c.y); - for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], m = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), n = d[0], q = d[1], d = 4 * (q * a + n);0 <= q && this.matchColor(d, e, f, g, h);) { - --q, d -= 4 * a; - } - d += 4 * a; - q += 1; - for (l = k = !1;q < b - 1 && this.matchColor(d, e, f, g, h);) { - q += 1, this.colorPixel(d, m.r, m.g, m.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, q]), k = !0) : k && (k = !1)), n < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, q]), l = !0) : l && (l = !1)), d += 4 * a; - } - if (1080 < c.length) { - break; - } - } - this.file.modified = !0; - this.reloadContext(); - } -}; -Entry.Painter.prototype.reloadContext = function() { - delete this.selectedObject; - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(this.colorLayerData, 0, 0); - var a = new Image; - a.src = this.canvas.toDataURL(); - var b = this; - a.onload = function(a) { - a = new createjs.Bitmap(a.target); - b.objectContainer.removeAllChildren(); - b.objectContainer.addChild(a); - b.stroke.locked = !1; - }; -}; -Entry.Painter.prototype.move_pen = function() { - var a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); - this.oldPt.x = this.stage.mouseX; - this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = a.x; - this.oldMidPt.y = a.y; - this.file.modified = !0; - this.stage.update(); -}; -Entry.Painter.prototype.move_line = function() { - this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").moveTo(this.oldPt.x, this.oldPt.y).lineTo(this.stage.mouseX, this.stage.mouseY); - this.file.modified = !0; - this.stage.update(); -}; -Entry.Painter.prototype.move_rect = function() { - var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (b = a); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, - this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, a, b); - this.file.modified = !0; - this.stage.update(); -}; -Entry.Painter.prototype.move_circle = function() { - var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (b = a); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, - this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, a, b)); - this.file.modified = !0; - this.stage.update(); -}; -Entry.Painter.prototype.edit_copy = function() { - this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, - 0)) : alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); -}; -Entry.Painter.prototype.edit_cut = function() { - this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, - 0), this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height), this.reloadContext(), this.file.modified = !0) : alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); -}; -Entry.Painter.prototype.edit_paste = function() { - var a = new Image; - a.src = this.canvas_.toDataURL(); - var b = this; - a.onload = function(a) { - a = new createjs.Bitmap(a.target); - a.x = b.canvas.width / 2; - a.y = b.canvas.height / 2; - a.regX = b.copy.width / 2 | 0; - a.regY = b.copy.height / 2 | 0; - a.id = Entry.generateHash(); - b.objectContainer.addChild(a); - b.selectObject(a, !0); - }; - this.file.modified = !0; -}; -Entry.Painter.prototype.edit_select = function() { - this.clearHandle(); - this.selectedObject && delete this.selectedObject; - this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.copy = {}; - this.copy.width = this.selectArea.x2; - this.copy.height = this.selectArea.y2; - this.canvas_.width = this.copy.width; - this.canvas_.height = this.copy.height; - this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height); - this.ctx_.putImageData(this.copyLayerData, 0, 0); - this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(this.colorLayerData, 0, 0); - var a = new Image; - a.src = this.canvas.toDataURL(); - var b = this; - a.onload = function(a) { - a = new createjs.Bitmap(a.target); - b.objectContainer.removeAllChildren(); - b.objectContainer.addChild(a); - a = new Image; - a.src = b.canvas_.toDataURL(); - a.onload = function(a) { - a = new createjs.Bitmap(a.target); - a.x = b.selectArea.x1 + b.copy.width / 2; - a.y = b.selectArea.y1 + b.copy.height / 2; - a.regX = b.copy.width / 2 | 0; - a.regY = b.copy.height / 2 | 0; - a.id = Entry.generateHash(); - a.name = a.id; - b.objectContainer.addChild(a); - b.selectObject(a, !0); - }; - }; -}; -Entry.Painter.prototype.move_erase = function(a) { - a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); - this.oldPt.x = this.stage.mouseX; - this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = a.x; - this.oldMidPt.y = a.y; - this.file.modified = !0; - this.stage.update(); -}; -Entry.Painter.prototype.settingShapeBlur = function() { - this.objectWidthInput.blur(); - this.objectHeightInput.blur(); - this.objectRotateInput.blur(); -}; -Entry.Painter.prototype.stagemousedown = function(a) { - "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(a.stageX, a.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(a) : "text" === this.toolbox.selected ? (this.showInputField(a), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? - this.fill() : "cursor" !== this.toolbox.selected && (this.createBrush(), this.stroke.enabled = !0)); -}; -Entry.Painter.prototype.stagemousemove = function(a) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(a) : "line" === this.toolbox.selected ? this.move_line(a) : "rect" === this.toolbox.selected ? - this.move_rect(a) : "circle" === this.toolbox.selected ? this.move_circle(a) : "erase" === this.toolbox.selected && this.move_erase(a)), this.painterTopStageXY.innerHTML = "x:" + a.stageX.toFixed(1) + ", y:" + a.stageY.toFixed(1)); -}; -Entry.Painter.prototype.stagemouseup = function(a) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && - this.eraser.graphics.endStroke(), -1 < this.objectContainer.getChildIndex(this.brush) && this.brush.graphics.endStroke(), this.clearHandle(), this.platten(), this.stroke.enabled = !1, this.checkCommand())); -}; -Entry.Painter.prototype.file_save = function(a) { - this.clearHandle(); - this.transparent(); - this.trim(); - var b = this.canvas_.toDataURL(); - Entry.dispatchEvent("saveCanvasImage", {file:a ? this.file_ : this.file, image:b}); - this.file.modified = !1; -}; -Entry.Painter.prototype.transparent = function() { - var a = this.canvas.width, b = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, a, b); - var c = a * (b - 1) * 4, d = 4 * (a - 1), e = 4 * (a * b - 1); - this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, b) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(a, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(a, b); -}; -Entry.Painter.prototype.fillTransparent = function(a, b) { - this.stage.mouseX = a; - this.stage.mouseY = b; - this.stroke.transparent = !0; - this.fill(); -}; -Entry.Painter.prototype.trim = function() { - var a = this.canvas.width, b = this.ctx.getImageData(0, 0, a, this.canvas.height), c = b.data.length, d, e = null, f = null, g = null, h = null, k; - for (d = 0;d < c;d += 4) { - 0 !== b.data[d + 3] && (g = d / 4 % a, k = ~~(d / 4 / a), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); - } - a = h - e; - b = g - f; - 0 === a || 0 === b ? (e = this.ctx.getImageData(0, 0, 1, 1), e.data[0] = 255, e.data[1] = 255, e.data[2] = 255, e.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (e = this.ctx.getImageData(f, e, b, a), this.canvas_.width = b, this.canvas_.height = a); - this.ctx_.putImageData(e, 0, 0); -}; -Entry.Painter.prototype.showInputField = function(a) { - this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:a.stageX, y:a.stageY, onsubmit:function() { - Entry.dispatchEvent("textUpdate"); - }}), this.inputField.show()); -}; -Entry.Painter.prototype.addPicture = function(a) { - this.initCommand(); - var b = new Image; - b.id = Entry.generateHash(); - b.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; - var c = this; - b.onload = function(b) { - c.addImage(b.target); - c.selectToolbox("cursor"); - }; -}; -Entry.Painter.prototype.initCoordinator = function() { - var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); - a.addChild(b); - this.stage.addChild(a); - a.visible = !1; - this.coordinator = a; -}; -Entry.Painter.prototype.toggleCoordinator = function() { - this.coordinator.visible = !this.coordinator.visible; - this.stage.update(); -}; -Entry.Painter.prototype.initDashedLine = function() { - createjs.Graphics.prototype.dashedLineTo = function(a, b, c, d, e) { - this.moveTo(a, b); - var f = c - a, g = d - b; - e = Math.floor(Math.sqrt(f * f + g * g) / e); - for (var f = f / e, g = g / e, h = 0;h++ < e;) { - a += f, b += g, this[0 === h % 2 ? "moveTo" : "lineTo"](a, b); - } - this[0 === h % 2 ? "moveTo" : "lineTo"](c, d); - return this; - }; - createjs.Graphics.prototype.drawDashedRect = function(a, b, c, d, e) { - this.moveTo(a, b); - c = a + c; - d = b + d; - this.dashedLineTo(a, b, c, b, e); - this.dashedLineTo(c, b, c, d, e); - this.dashedLineTo(c, d, a, d, e); - this.dashedLineTo(a, d, a, b, e); - return this; - }; - createjs.Graphics.prototype.drawResizableDashedRect = function(a, b, c, d, e, f) { - this.moveTo(a, b); - c = a + c; - d = b + d; - this.dashedLineTo(a + f, b, c - f, b, e); - this.dashedLineTo(c, b + f, c, d - f, e); - this.dashedLineTo(c - f, d, a + f, d, e); - this.dashedLineTo(a, d - f, a, b + f, e); - return this; - }; -}; -Entry.Painter.prototype.generateView = function(a) { - var b = this; - this.view_ = a; - if (!Entry.type || "workspace" == Entry.type) { - this.view_.addClass("entryPainterWorkspace"); - var c = Entry.createElement("div", "entryPainterTop"); - c.addClass("entryPlaygroundPainterTop"); - this.view_.appendChild(c); - var d = Entry.createElement("div", "entryPainterToolbox"); - d.addClass("entryPlaygroundPainterToolbox"); - this.view_.appendChild(d); - var e = Entry.createElement("div", "entryPainterToolboxTop"); - e.addClass("entryPainterToolboxTop"); - d.appendChild(e); - var f = Entry.createElement("div", "entryPainterContainer"); - f.addClass("entryPlaygroundPainterContainer"); - this.view_.appendChild(f); - e = Entry.createElement("canvas", "entryPainterCanvas"); - e.width = 960; - e.height = 540; - e.addClass("entryPlaygroundPainterCanvas"); - f.appendChild(e); - e = Entry.createElement("canvas", "entryPainterCanvas_"); - e.addClass("entryRemove"); - e.width = 960; - e.height = 540; - f.appendChild(e); - var g = Entry.createElement("div", "entryPainterAttr"); - g.addClass("entryPlaygroundPainterAttr"); - this.view_.appendChild(g); - this.flipObject = Entry.createElement("div", "entryPictureFlip"); - this.flipObject.addClass("entryPlaygroundPainterFlip"); - g.appendChild(this.flipObject); - e = Entry.createElement("div", "entryPictureFlipX"); - e.title = "\uc88c\uc6b0\ub4a4\uc9d1\uae30"; - e.bindOnClick(function() { - b.selectedObject && (b.selectedObject.scaleX *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); - }); - e.addClass("entryPlaygroundPainterFlipX"); - this.flipObject.appendChild(e); - e = Entry.createElement("div", "entryPictureFlipY"); - e.title = "\uc0c1\ud558\ub4a4\uc9d1\uae30"; - e.bindOnClick(function() { - b.selectedObject && (b.selectedObject.scaleY *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); - }); - e.addClass("entryPlaygroundPainterFlipY"); - this.flipObject.appendChild(e); - Entry.addEventListener("windowResized", function(b) { - var c = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - b = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = b - 349; - a.style.width = c + "px"; - f.style.width = c - 54 + "px"; - f.style.height = d + "px"; - g.style.top = d + 30 + "px"; - g.style.height = b - d + "px"; - }); - var h = Entry.createElement("nav", "entryPainterTopMenu"); - h.addClass("entryPlaygroundPainterTopMenu"); - c.appendChild(h); - e = Entry.createElement("ul"); - h.appendChild(e); - var k = Entry.createElement("li"); - h.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuFileNew"); - h.bindOnClick(function() { - b.newPicture(); - }); - h.addClass("entryPlaygroundPainterTopMenuFileNew"); - h.innerHTML = Lang.Workspace.new_picture; - k.appendChild(h); - h = Entry.createElement("li", "entryPainterTopMenuFile"); - h.addClass("entryPlaygroundPainterTopMenuFile"); - h.innerHTML = Lang.Workspace.painter_file; - e.appendChild(h); - k = Entry.createElement("ul"); - h.appendChild(k); - h = Entry.createElement("li"); - k.appendChild(h); - var l = Entry.createElement("a", "entryPainterTopMenuFileSave"); - l.bindOnClick(function() { - b.file_save(!1); - }); - l.addClass("entryPainterTopMenuFileSave"); - l.innerHTML = Lang.Workspace.painter_file_save; - h.appendChild(l); - h = Entry.createElement("li"); - k.appendChild(h); - k = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); - k.bindOnClick(function() { - b.file.mode = "new"; - b.file_save(!1); - }); - k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); - k.innerHTML = Lang.Workspace.painter_file_saveas; - h.appendChild(k); - k = Entry.createElement("li", "entryPainterTopMenuEdit"); - k.addClass("entryPlaygroundPainterTopMenuEdit"); - k.innerHTML = Lang.Workspace.painter_edit; - e.appendChild(k); - e = Entry.createElement("ul"); - k.appendChild(e); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); - h.bindOnClick(function() { - Entry.dispatchEvent("openPictureImport"); - }); - h.addClass("entryPainterTopMenuEditImport"); - h.innerHTML = Lang.Workspace.get_file; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditCopy"); - h.bindOnClick(function() { - b.edit_copy(); - }); - h.addClass("entryPlaygroundPainterTopMenuEditCopy"); - h.innerHTML = Lang.Workspace.copy_file; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditCut"); - h.bindOnClick(function() { - b.edit_cut(); - }); - h.addClass("entryPlaygroundPainterTopMenuEditCut"); - h.innerHTML = Lang.Workspace.cut_picture; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditPaste"); - h.bindOnClick(function() { - b.edit_paste(); - }); - h.addClass("entryPlaygroundPainterTopMenuEditPaste"); - h.innerHTML = Lang.Workspace.paste_picture; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - e = Entry.createElement("a", "entryPainterTopMenuEditEraseAll"); - e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); - e.innerHTML = Lang.Workspace.remove_all; - e.bindOnClick(function() { - b.clearCanvas(); - }); - k.appendChild(e); - this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); - e.addClass("entryPlaygroundPainterTopStageXY"); - c.appendChild(e); - e = Entry.createElement("ul", "entryPainterTopToolbar"); - e.addClass("entryPlaygroundPainterTopToolbar"); - c.appendChild(e); - c = Entry.createElement("li", "entryPainterTopToolbarUndo"); - c.bindOnClick(function() { - }); - c.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(c); - c = Entry.createElement("li", "entryPainterTopToolbarRedo"); - c.bindOnClick(function() { - }); - c.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(c); - c = Entry.createElement("ul"); - c.addClass("entryPlaygroundPainterToolboxContainer"); - d.appendChild(c); - this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); - this.toolboxCursor.title = "\uc774\ub3d9"; - this.toolboxCursor.bindOnClick(function() { - b.selectToolbox("cursor"); + d.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(d); + d = Entry.createElement("ul"); + d.addClass("entryPlaygroundPainterToolboxContainer"); + c.appendChild(d); + this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); + this.toolboxCursor.title = "\uc774\ub3d9"; + this.toolboxCursor.bindOnClick(function() { + a.selectToolbox("cursor"); }); this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); - c.appendChild(this.toolboxCursor); + d.appendChild(this.toolboxCursor); this.toolboxSelect = Entry.createElement("li", "entryPainterToolboxSelect"); this.toolboxSelect.title = "\uc790\ub974\uae30"; this.toolboxSelect.bindOnClick(function() { - b.selectToolbox("select"); + a.selectToolbox("select"); }); this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); - c.appendChild(this.toolboxSelect); + d.appendChild(this.toolboxSelect); this.toolboxPen = Entry.createElement("li", "entryPainterToolboxPen"); this.toolboxPen.title = "\ud39c"; this.toolboxPen.bindOnClick(function() { - b.selectToolbox("pen"); + a.selectToolbox("pen"); }); this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); - c.appendChild(this.toolboxPen); + d.appendChild(this.toolboxPen); this.toolboxLine = Entry.createElement("li", "entryPainterToolboxLine"); this.toolboxLine.title = "\uc9c1\uc120"; this.toolboxLine.bindOnClick(function() { - b.selectToolbox("line"); + a.selectToolbox("line"); }); this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); - c.appendChild(this.toolboxLine); + d.appendChild(this.toolboxLine); this.toolboxRect = Entry.createElement("li", "entryPainterToolboxRect"); this.toolboxRect.title = "\uc0ac\uac01\ud615"; this.toolboxRect.bindOnClick(function() { - b.selectToolbox("rect"); + a.selectToolbox("rect"); }); this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); - c.appendChild(this.toolboxRect); + d.appendChild(this.toolboxRect); this.toolboxCircle = Entry.createElement("li", "entryPainterToolboxCircle"); this.toolboxCircle.title = "\uc6d0"; this.toolboxCircle.bindOnClick(function() { - b.selectToolbox("circle"); + a.selectToolbox("circle"); }); this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); - c.appendChild(this.toolboxCircle); + d.appendChild(this.toolboxCircle); this.toolboxText = Entry.createElement("li", "entryPainterToolboxText"); this.toolboxText.title = "\uae00\uc0c1\uc790"; this.toolboxText.bindOnClick(function() { - b.selectToolbox("text"); + a.selectToolbox("text"); }); this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); - c.appendChild(this.toolboxText); + d.appendChild(this.toolboxText); this.toolboxFill = Entry.createElement("li", "entryPainterToolboxFill"); this.toolboxFill.bindOnClick(function() { - b.selectToolbox("fill"); + a.selectToolbox("fill"); }); this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); - c.appendChild(this.toolboxFill); + d.appendChild(this.toolboxFill); this.toolboxErase = Entry.createElement("li", "entryPainterToolboxErase"); this.toolboxErase.title = "\uc9c0\uc6b0\uae30"; this.toolboxErase.bindOnClick(function() { - b.selectToolbox("erase"); + a.selectToolbox("erase"); }); this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); - c.appendChild(this.toolboxErase); - d = Entry.createElement("li", "entryPainterToolboxCoordinate"); - d.title = "\uc88c\ud45c"; - d.bindOnClick(function() { - b.toggleCoordinator(); + d.appendChild(this.toolboxErase); + c = Entry.createElement("li", "entryPainterToolboxCoordinate"); + c.title = "\uc88c\ud45c"; + c.bindOnClick(function() { + a.toggleCoordinator(); }); - d.addClass("entryPlaygroundPainterToolboxCoordinate"); - c.appendChild(d); + c.addClass("entryPlaygroundPainterToolboxCoordinate"); + d.appendChild(c); this.attrResizeArea = Entry.createElement("fieldset", "painterAttrResize"); this.attrResizeArea.addClass("entryPlaygroundPainterAttrResize"); g.appendChild(this.attrResizeArea); - d = Entry.createElement("legend"); - d.innerHTML = Lang.Workspace.picture_size; - this.attrResizeArea.appendChild(d); - d = Entry.createElement("div", "painterAttrWrapper"); - d.addClass("painterAttrWrapper"); - this.attrResizeArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrResizeX"); - d.appendChild(c); + c = Entry.createElement("legend"); + c.innerHTML = Lang.Workspace.picture_size; + this.attrResizeArea.appendChild(c); + c = Entry.createElement("div", "painterAttrWrapper"); + c.addClass("painterAttrWrapper"); + this.attrResizeArea.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrResizeX"); + c.appendChild(d); e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrResizeXTop"); e.innerHTML = "X"; - c.appendChild(e); + d.appendChild(e); this.objectWidthInput = Entry.createElement("input", "entryPainterAttrWidth"); this.objectWidthInput.onblur = function() { if (isNaN(this.value)) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - b.handle.width = this.value; - b.updateImageHandle(); + a.handle.width = this.value; + a.updateImageHandle(); }; this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); - c.appendChild(this.objectWidthInput); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterSizeText"); - c.innerHTML = "x"; - d.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundAttrReiszeY"); - d.appendChild(c); + d.appendChild(this.objectWidthInput); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterSizeText"); + d.innerHTML = "x"; + c.appendChild(d); d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrResizeYTop"); - d.innerHTML = "Y"; + d.addClass("entryPlaygroundAttrReiszeY"); c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrResizeYTop"); + c.innerHTML = "Y"; + d.appendChild(c); this.objectHeightInput = Entry.createElement("input", "entryPainterAttrHeight"); this.objectHeightInput.onblur = function() { if (isNaN(this.value)) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - b.handle.height = this.value; - b.updateImageHandle(); + a.handle.height = this.value; + a.updateImageHandle(); }; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput"); - c.appendChild(this.objectHeightInput); + d.appendChild(this.objectHeightInput); this.attrRotateArea = Entry.createElement("div", "painterAttrRotateArea"); this.attrRotateArea.addClass("painterAttrRotateArea"); g.appendChild(this.attrRotateArea); - d = Entry.createElement("div"); - d.addClass("painterAttrRotateName"); - d.innerHTML = Lang.Workspace.picture_rotation; - this.attrRotateArea.appendChild(d); - d = Entry.createElement("fieldset", "entryPainterAttrRotate"); - d.addClass("entryPlaygroundPainterAttrRotate"); - this.attrRotateArea.appendChild(d); c = Entry.createElement("div"); - c.addClass("painterAttrRotateTop"); - c.innerHTML = "\u03bf"; - d.appendChild(c); + c.addClass("painterAttrRotateName"); + c.innerHTML = Lang.Workspace.picture_rotation; + this.attrRotateArea.appendChild(c); + c = Entry.createElement("fieldset", "entryPainterAttrRotate"); + c.addClass("entryPlaygroundPainterAttrRotate"); + this.attrRotateArea.appendChild(c); + d = Entry.createElement("div"); + d.addClass("painterAttrRotateTop"); + d.innerHTML = "\u03bf"; + c.appendChild(d); this.objectRotateInput = Entry.createElement("input", "entryPainterAttrDegree"); this.objectRotateInput.onblur = function() { if (isNaN(this.value)) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } 360 <= this.value ? this.value %= 360 : 0 > this.value && (this.value = 360 + this.value % 360); - b.handle.rotation = this.value; - b.updateImageHandle(); + a.handle.rotation = this.value; + a.updateImageHandle(); }; this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); this.objectRotateInput.defaultValue = "0"; - d.appendChild(this.objectRotateInput); + c.appendChild(this.objectRotateInput); this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); g.appendChild(this.attrColorArea); @@ -12484,61 +10372,61 @@ Entry.Painter.prototype.generateView = function(a) { this.attrCircleArea = Entry.createElement("div"); this.attrCircleArea.addClass("painterAttrCircleArea"); g.appendChild(this.attrCircleArea); - d = Entry.createElement("div", "entryPainterAttrCircle"); - d.addClass("painterAttrCircle"); - this.attrCircleArea.appendChild(d); - this.attrCircleArea.painterAttrCircle = d; - d = Entry.createElement("input", "entryPainterAttrCircleInput"); - d.value = "#000000"; - d.addClass("painterAttrCircleInput"); - this.attrCircleArea.appendChild(d); + c = Entry.createElement("div", "entryPainterAttrCircle"); + c.addClass("painterAttrCircle"); + this.attrCircleArea.appendChild(c); + this.attrCircleArea.painterAttrCircle = c; + c = Entry.createElement("input", "entryPainterAttrCircleInput"); + c.value = "#000000"; + c.addClass("painterAttrCircleInput"); + this.attrCircleArea.appendChild(c); this.attrColorSpoid = Entry.createElement("div"); this.attrColorSpoid.bindOnClick(function() { - b.selectToolbox("spoid"); + a.selectToolbox("spoid"); }); this.attrColorSpoid.addClass("painterAttrColorSpoid"); g.appendChild(this.attrColorSpoid); - Entry.getColourCodes().forEach(function(a) { - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrColorElement"); - "transparent" === a ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = a; - c.bindOnClick(function(c) { - "transparent" === a ? (b.stroke.transparent = !0, b.stroke.lineColor = "#ffffff") : (b.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = a, b.stroke.fillColor = a), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = a, b.stroke.lineColor = a)); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = b.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = a; + Entry.getColourCodes().forEach(function(b) { + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrColorElement"); + "transparent" === b ? d.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : d.style.backgroundColor = b; + d.bindOnClick(function(d) { + "transparent" === b ? (a.stroke.transparent = !0, a.stroke.lineColor = "#ffffff") : (a.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = b, a.stroke.fillColor = b), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = b, a.stroke.lineColor = b)); + document.getElementById("entryPainterAttrCircle").style.backgroundColor = a.stroke.lineColor; + document.getElementById("entryPainterAttrCircleInput").value = b; }); - m.appendChild(c); + m.appendChild(d); }); this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); g.appendChild(this.attrThickArea); - d = Entry.createElement("legend"); - d.addClass("painterAttrThickName"); - d.innerHTML = Lang.Workspace.thickness; - this.attrThickArea.appendChild(d); + c = Entry.createElement("legend"); + c.addClass("painterAttrThickName"); + c.innerHTML = Lang.Workspace.thickness; + this.attrThickArea.appendChild(c); var n = Entry.createElement("fieldset", "entryPainterAttrThick"); n.addClass("entryPlaygroundPainterAttrThick"); this.attrThickArea.appendChild(n); - d = Entry.createElement("div"); - d.addClass("paintAttrThickTop"); - n.appendChild(d); + c = Entry.createElement("div"); + c.addClass("paintAttrThickTop"); + n.appendChild(c); e = Entry.createElement("select", "entryPainterAttrThick"); e.addClass("entryPlaygroundPainterAttrThickInput"); e.size = "1"; - e.onchange = function(a) { - b.stroke.thickness = a.target.value; + e.onchange = function(b) { + a.stroke.thickness = b.target.value; }; - for (d = 1;10 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); + for (c = 1;10 >= c;c++) { + d = Entry.createElement("option"), d.value = c, d.innerHTML = c, e.appendChild(d); } n.appendChild(e); - d = Entry.createElement("div", "entryPainterShapeLineColor"); - d.addClass("painterAttrShapeLineColor"); - c = Entry.createElement("div", "entryPainterShapeInnerBackground"); - c.addClass("painterAttrShapeInnerBackground"); - d.appendChild(c); - n.appendChild(d); - this.attrThickArea.painterAttrShapeLineColor = d; + c = Entry.createElement("div", "entryPainterShapeLineColor"); + c.addClass("painterAttrShapeLineColor"); + d = Entry.createElement("div", "entryPainterShapeInnerBackground"); + d.addClass("painterAttrShapeInnerBackground"); + c.appendChild(d); + n.appendChild(c); + this.attrThickArea.painterAttrShapeLineColor = c; n.bindOnClick(function() { q.style.zIndex = "1"; this.style.zIndex = "10"; @@ -12547,18 +10435,18 @@ Entry.Painter.prototype.generateView = function(a) { this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); g.appendChild(this.attrBackgroundArea); - d = Entry.createElement("fieldset", "entryPainterAttrbackground"); - d.addClass("entryPlaygroundPainterAttrBackground"); - this.attrBackgroundArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("paintAttrBackgroundTop"); - d.appendChild(c); + c = Entry.createElement("fieldset", "entryPainterAttrbackground"); + c.addClass("entryPlaygroundPainterAttrBackground"); + this.attrBackgroundArea.appendChild(c); + d = Entry.createElement("div"); + d.addClass("paintAttrBackgroundTop"); + c.appendChild(d); var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); q.addClass("painterAttrShapeBackgroundColor"); this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; - c.appendChild(q); + d.appendChild(q); var r = !1; - q.bindOnClick(function(b) { + q.bindOnClick(function(a) { n.style.zIndex = "1"; this.style.zIndex = "10"; r = !0; @@ -12569,53 +10457,53 @@ Entry.Painter.prototype.generateView = function(a) { e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrTop"); this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPaintAttrTop_"); - e.appendChild(d); - d = Entry.createElement("legend"); - d.addClass("panterAttrFontTitle"); - d.innerHTML = Lang.Workspace.textStyle; + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPaintAttrTop_"); + e.appendChild(c); + c = Entry.createElement("legend"); + c.addClass("panterAttrFontTitle"); + c.innerHTML = Lang.Workspace.textStyle; k = Entry.createElement("select", "entryPainterAttrFontName"); k.addClass("entryPlaygroundPainterAttrFontName"); k.size = "1"; - k.onchange = function(a) { - b.font.name = a.target.value; + k.onchange = function(b) { + a.font.name = b.target.value; }; - for (d = 0;d < Entry.fonts.length;d++) { - h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); + for (c = 0;c < Entry.fonts.length;c++) { + h = Entry.fonts[c], d = Entry.createElement("option"), d.value = h.family, d.innerHTML = h.name, k.appendChild(d); } e.appendChild(k); e = Entry.createElement("div"); e.addClass("painterAttrFontSizeArea"); this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("painterAttrFontSizeTop"); - e.appendChild(d); + c = Entry.createElement("div"); + c.addClass("painterAttrFontSizeTop"); + e.appendChild(c); k = Entry.createElement("select", "entryPainterAttrFontSize"); k.addClass("entryPlaygroundPainterAttrFontSize"); k.size = "1"; - k.onchange = function(a) { - b.font.size = a.target.value; + k.onchange = function(b) { + a.font.size = b.target.value; }; - for (d = 20;72 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); + for (c = 20;72 >= c;c++) { + d = Entry.createElement("option"), d.value = c, d.innerHTML = c, k.appendChild(d); } e.appendChild(k); e = Entry.createElement("div"); e.addClass("entryPlaygroundPainterAttrFontStyleArea"); this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrFontTop"); - e.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrFontTop"); + e.appendChild(c); k = Entry.createElement("select", "entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle"); k.size = "1"; - k.onchange = function(a) { - b.font.style = a.target.value; + k.onchange = function(b) { + a.font.style = b.target.value; }; h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; - for (d = 0;d < h.length;d++) { - l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); + for (c = 0;c < h.length;c++) { + l = h[c], d = Entry.createElement("option"), d.value = l.value, d.innerHTML = l.label, k.appendChild(d); } e.appendChild(k); this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); @@ -12627,32 +10515,32 @@ Entry.Painter.prototype.generateView = function(a) { var u = Entry.createElement("div"); u.addClass("entryPlaygroundPaitnerAttrLineArea"); this.attrLineArea.appendChild(u); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); - d.value = "line"; + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrLineStyleLine1"); + u.appendChild(c); + c.value = "line"; var v = Entry.createElement("div"); v.addClass("painterAttrLineStyleBackgroundLine"); - t.bindOnClick(function(b) { + t.bindOnClick(function(a) { u.removeClass("entryRemove"); }); - u.blur = function(b) { + u.blur = function(a) { this.addClass("entryRemove"); }; - u.onmouseleave = function(b) { + u.onmouseleave = function(a) { this.addClass("entryRemove"); }; - d.bindOnClick(function(b) { + c.bindOnClick(function(a) { this.attrLineArea.removeClass(t); this.attrLineArea.appendChild(v); - this.attrLineArea.onchange(b); + this.attrLineArea.onchange(a); u.blur(); }); - v.bindOnClick(function(b) { + v.bindOnClick(function(a) { u.removeClass("entryRemove"); }); - this.attrLineArea.onchange = function(a) { - b.stroke.style = a.target.value; + this.attrLineArea.onchange = function(b) { + a.stroke.style = b.target.value; }; u.blur(); } @@ -12698,13 +10586,13 @@ Entry.Painter.prototype.initDisplay = function() { this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); }; -Entry.Painter.prototype.selectToolbox = function(a) { - this.toolbox.selected = a; - "erase" != a && $(".entryPlaygroundPainterContainer").removeClass("dd"); +Entry.Painter.prototype.selectToolbox = function(b) { + this.toolbox.selected = b; + "erase" != b && $(".entryPlaygroundPainterContainer").removeClass("dd"); this.initDisplay(); - "cursor" !== a && this.clearHandle(); - "text" !== a && this.inputField && delete this.inputField; - switch(a) { + "cursor" !== b && this.clearHandle(); + "text" !== b && this.inputField && delete this.inputField; + switch(b) { case "cursor": this.restoreHandle(); this.toolboxCursor.addClass("entryToolboxCursorClicked"); @@ -12782,31 +10670,31 @@ Entry.Painter.prototype.selectToolbox = function(a) { this.toggleCoordinator(); } }; -Entry.Painter2 = function(a) { - this.view = a; +Entry.Painter2 = function(b) { + this.view = b; this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; - Entry.addEventListener("pictureImport", function(b) { - this.addPicture(b); + Entry.addEventListener("pictureImport", function(a) { + this.addPicture(a); }.bind(this)); this.clipboard = null; }; -(function(a) { - a.initialize = function() { +(function(b) { + b.initialize = function() { if (!this.lc) { - var b = new Image; - b.src = "/lib/literallycanvas/lib/img/transparent-pattern.png"; + var a = new Image; + a.src = "/lib/literallycanvas/lib/img/transparent-pattern.png"; this.lc = LC.init(this.view, {imageURLPrefix:"/lib/literallycanvas/lib/img", zoomMax:3, zoomMin:.5, toolbarPosition:"bottom", imageSize:{width:960, height:540}, backgroundShapes:[LC.createShape("Rectangle", {x:0, y:0, width:960, height:540, strokeWidth:0, strokeColor:"transparent"})]}); - b.onload = function() { + a.onload = function() { this.lc.repaintLayer("background"); }.bind(this); - b = function(b) { - b.shape && !b.opts && b.shape.isPass || b.opts && b.opts.isPass ? Entry.do("processPicture", b, this.lc) : Entry.do("editPicture", b, this.lc); + a = function(a) { + a.shape && !a.opts && a.shape.isPass || a.opts && a.opts.isPass ? Entry.do("processPicture", a, this.lc) : Entry.do("editPicture", a, this.lc); this.file.modified = !0; }.bind(this); - this.lc.on("clear", b); - this.lc.on("shapeEdit", b); - this.lc.on("shapeSave", b); - this.lc.on("toolChange", function(b) { + this.lc.on("clear", a); + this.lc.on("shapeEdit", a); + this.lc.on("shapeSave", a); + this.lc.on("toolChange", function(a) { this.updateEditMenu(); }.bind(this)); this.lc.on("lc-pointerdrag", this.stagemousemove.bind(this)); @@ -12817,116 +10705,115 @@ Entry.Painter2 = function(a) { Entry.keyUpped && Entry.keyUpped.attach(this, this._keyboardUpControl); } }; - a.show = function() { + b.show = function() { this.lc || this.initialize(); this.isShow = !0; }; - a.hide = function() { + b.hide = function() { this.isShow = !1; }; - a.changePicture = function(b) { - this.file && this.file.id === b.id || (this.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && this.file_save(!0), this.file.modified = !1, this.lc.clear(!1), this.file.id = b.id ? b.id : Entry.generateHash(), this.file.name = b.name, this.file.mode = "edit", this.addPicture(b, !0)); + b.changePicture = function(a) { + this.file && this.file.id === a.id || (this.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && this.file_save(!0), this.file.modified = !1, this.lc.clear(!1), this.file.id = a.id ? a.id : Entry.generateHash(), this.file.name = a.name, this.file.mode = "edit", this.addPicture(a, !0)); }; - a.addPicture = function(b, a) { + b.addPicture = function(a, b) { var c = new Image; - c.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; - b = b.dimension; - var e = LC.createShape("Image", {x:480, y:270, width:b.width, height:b.height, image:c}); - this.lc.saveShape(e, !a); + c.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; + var e = a.dimension, f = LC.createShape("Image", {x:480, y:270, width:e.width, height:e.height, image:c}); + this.lc.saveShape(f, !b); c.onload = function() { this.lc.setTool(this.lc.tools.SelectShape); - this.lc.tool.setShape(this.lc, e); + this.lc.tool.setShape(this.lc, f); }.bind(this); }; - a.copy = function() { + b.copy = function() { if ("SelectShape" === this.lc.tool.name && this.lc.tool.selectedShape) { - var b = this.lc.tool.selectedShape; - this.clipboard = {className:b.className, data:b.toJSON()}; + var a = this.lc.tool.selectedShape; + this.clipboard = {className:a.className, data:a.toJSON()}; this.updateEditMenu(); } }; - a.cut = function() { + b.cut = function() { "SelectShape" === this.lc.tool.name && this.lc.tool.selectedShape && (this.copy(), this.lc.removeShape(this.lc.tool.selectedShape), this.lc.tool.setShape(this.lc, null)); }; - a.paste = function() { + b.paste = function() { if (this.clipboard) { - var b = this.lc.addShape(this.clipboard); + var a = this.lc.addShape(this.clipboard); this.lc.setTool(this.lc.tools.SelectShape); - this.lc.tool.setShape(this.lc, b); + this.lc.tool.setShape(this.lc, a); } }; - a.updateEditMenu = function() { - var b = "SelectShape" === this.lc.tool.name ? "block" : "none"; - this._cutButton.style.display = b; - this._copyButton.style.display = b; + b.updateEditMenu = function() { + var a = "SelectShape" === this.lc.tool.name ? "block" : "none"; + this._cutButton.style.display = a; + this._copyButton.style.display = a; this._pasteButton.style.display = this.clipboard ? "block" : "none"; }; - a.file_save = function() { + b.file_save = function() { this.lc.trigger("dispose"); - var b = this.lc.getImage().toDataURL(); + var a = this.lc.getImage().toDataURL(); this.file_ = JSON.parse(JSON.stringify(this.file)); - Entry.dispatchEvent("saveCanvasImage", {file:this.file_, image:b}); + Entry.dispatchEvent("saveCanvasImage", {file:this.file_, image:a}); this.file.modified = !1; }; - a.newPicture = function() { - var b = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; - b.id = Entry.generateHash(); - Entry.playground.addPicture(b, !0); + b.newPicture = function() { + var a = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; + a.id = Entry.generateHash(); + Entry.playground.addPicture(a, !0); }; - a._keyboardPressControl = function(b) { - if (this.isShow && !Entry.Utils.isInInput(b)) { - var a = b.keyCode || b.which, d = b.ctrlKey; - 8 == a || 46 == a ? (this.cut(), b.preventDefault()) : d && (67 == a ? this.copy() : 88 == a && this.cut()); - d && 86 == a && this.paste(); - this.lc.trigger("keyDown", b); + b._keyboardPressControl = function(a) { + if (this.isShow && !Entry.Utils.isInInput(a)) { + var b = a.keyCode || a.which, c = a.ctrlKey; + 8 == b || 46 == b ? (this.cut(), a.preventDefault()) : c && (67 == b ? this.copy() : 88 == b && this.cut()); + c && 86 == b && this.paste(); + this.lc.trigger("keyDown", a); } }; - a._keyboardUpControl = function(b) { - this.lc.trigger("keyUp", b); + b._keyboardUpControl = function(a) { + this.lc.trigger("keyUp", a); }; - a.initTopBar = function() { - var b = this, a = Entry.createElement(document.getElementById("canvas-top-menu")); - a.addClass("entryPlaygroundPainterTop"); - a.addClass("entryPainterTop"); - var d = Entry.createElement("nav", "entryPainterTopMenu"); - d.addClass("entryPlaygroundPainterTopMenu"); - a.appendChild(d); + b.initTopBar = function() { + var a = this, b = Entry.createElement(document.getElementById("canvas-top-menu")); + b.addClass("entryPlaygroundPainterTop"); + b.addClass("entryPainterTop"); + var c = Entry.createElement("nav", "entryPainterTopMenu"); + c.addClass("entryPlaygroundPainterTopMenu"); + b.appendChild(c); var e = Entry.createElement("ul"); - d.appendChild(e); + c.appendChild(e); var f = Entry.createElement("li"); - d.appendChild(f); - d = Entry.createElement("a", "entryPainterTopMenuFileNew"); - d.bindOnClick(function() { - b.newPicture(); + c.appendChild(f); + c = Entry.createElement("a", "entryPainterTopMenuFileNew"); + c.bindOnClick(function() { + a.newPicture(); }); - d.addClass("entryPlaygroundPainterTopMenuFileNew"); - d.innerHTML = Lang.Workspace.new_picture; - f.appendChild(d); - d = Entry.createElement("li", "entryPainterTopMenuFile"); - d.addClass("entryPlaygroundPainterTopMenuFile"); - d.innerHTML = Lang.Workspace.painter_file; - e.appendChild(d); + c.addClass("entryPlaygroundPainterTopMenuFileNew"); + c.innerHTML = Lang.Workspace.new_picture; + f.appendChild(c); + c = Entry.createElement("li", "entryPainterTopMenuFile"); + c.addClass("entryPlaygroundPainterTopMenuFile"); + c.innerHTML = Lang.Workspace.painter_file; + e.appendChild(c); f = Entry.createElement("ul"); - d.appendChild(f); - d = Entry.createElement("li"); - f.appendChild(d); + c.appendChild(f); + c = Entry.createElement("li"); + f.appendChild(c); var g = Entry.createElement("a", "entryPainterTopMenuFileSave"); g.bindOnClick(function() { - b.file_save(!1); + a.file_save(!1); }); g.addClass("entryPainterTopMenuFileSave"); g.innerHTML = Lang.Workspace.painter_file_save; - d.appendChild(g); - d = Entry.createElement("li"); - f.appendChild(d); + c.appendChild(g); + c = Entry.createElement("li"); + f.appendChild(c); f = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); f.bindOnClick(function() { - b.file.mode = "new"; - b.file_save(!1); + a.file.mode = "new"; + a.file_save(!1); }); f.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); f.innerHTML = Lang.Workspace.painter_file_saveas; - d.appendChild(f); + c.appendChild(f); f = Entry.createElement("li", "entryPainterTopMenuEdit"); f.addClass("entryPlaygroundPainterTopMenuEdit"); f.innerHTML = Lang.Workspace.painter_edit; @@ -12935,42 +10822,42 @@ Entry.Painter2 = function(a) { f.appendChild(e); f = Entry.createElement("li"); e.appendChild(f); - d = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); - d.bindOnClick(function() { + c = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); + c.bindOnClick(function() { Entry.dispatchEvent("openPictureImport"); }); - d.addClass("entryPainterTopMenuEditImport"); - d.innerHTML = Lang.Workspace.get_file; - f.appendChild(d); + c.addClass("entryPainterTopMenuEditImport"); + c.innerHTML = Lang.Workspace.get_file; + f.appendChild(c); f = Entry.createElement("li"); e.appendChild(f); - d = Entry.createElement("a", "entryPainterTopMenuEditCopy"); - d.bindOnClick(function() { - b.copy(); + c = Entry.createElement("a", "entryPainterTopMenuEditCopy"); + c.bindOnClick(function() { + a.copy(); }); - d.addClass("entryPlaygroundPainterTopMenuEditCopy"); - d.innerHTML = Lang.Workspace.copy_file; - f.appendChild(d); + c.addClass("entryPlaygroundPainterTopMenuEditCopy"); + c.innerHTML = Lang.Workspace.copy_file; + f.appendChild(c); this._copyButton = f; f = Entry.createElement("li"); e.appendChild(f); - d = Entry.createElement("a", "entryPainterTopMenuEditCut"); - d.bindOnClick(function() { - b.cut(); + c = Entry.createElement("a", "entryPainterTopMenuEditCut"); + c.bindOnClick(function() { + a.cut(); }); - d.addClass("entryPlaygroundPainterTopMenuEditCut"); - d.innerHTML = Lang.Workspace.cut_picture; - f.appendChild(d); + c.addClass("entryPlaygroundPainterTopMenuEditCut"); + c.innerHTML = Lang.Workspace.cut_picture; + f.appendChild(c); this._cutButton = f; f = Entry.createElement("li"); e.appendChild(f); - d = Entry.createElement("a", "entryPainterTopMenuEditPaste"); - d.bindOnClick(function() { - b.paste(); + c = Entry.createElement("a", "entryPainterTopMenuEditPaste"); + c.bindOnClick(function() { + a.paste(); }); - d.addClass("entryPlaygroundPainterTopMenuEditPaste"); - d.innerHTML = Lang.Workspace.paste_picture; - f.appendChild(d); + c.addClass("entryPlaygroundPainterTopMenuEditPaste"); + c.innerHTML = Lang.Workspace.paste_picture; + f.appendChild(c); this._pasteButton = f; f = Entry.createElement("li"); e.appendChild(f); @@ -12978,6606 +10865,7530 @@ Entry.Painter2 = function(a) { e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); e.innerHTML = Lang.Workspace.remove_all; e.bindOnClick(function() { - b.lc.clear(); + a.lc.clear(); }); f.appendChild(e); this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); e.addClass("entryPlaygroundPainterTopStageXY"); - a.appendChild(e); + b.appendChild(e); Entry.addEventListener("pictureSelected", this.changePicture.bind(this)); }; - a.stagemousemove = function(b) { - this.painterTopStageXY.textContent = "x:" + b.x.toFixed(1) + ", y:" + b.y.toFixed(1); + b.stagemousemove = function(a) { + this.painterTopStageXY.textContent = "x:" + a.x.toFixed(1) + ", y:" + a.y.toFixed(1); }; })(Entry.Painter2.prototype); -Entry.BlockParser = function(a) { - this.syntax = a; +Entry.BlockParser = function(b) { + this.syntax = b; this._iterVariableCount = 0; this._iterVariableChunk = ["i", "j", "k"]; }; -(function(a) { - a.Code = function(b) { - if (b instanceof Entry.Thread) { - return this.Thread(b); +(function(b) { + b.Code = function(a) { + if (a instanceof Entry.Thread) { + return this.Thread(a); } - if (b instanceof Entry.Block) { - return this.Block(b); + if (a instanceof Entry.Block) { + return this.Block(a); } - var a = ""; - b = b.getThreads(); - for (var d = 0;d < b.length;d++) { - a += this.Thread(b[d]); + var b = ""; + a = a.getThreads(); + for (var c = 0;c < a.length;c++) { + b += this.Thread(a[c]); } - return a; + return b; }; - a.Thread = function(b) { - if (b instanceof Entry.Block) { - return this.Block(b); + b.Thread = function(a) { + if (a instanceof Entry.Block) { + return this.Block(a); } - var a = ""; - b = b.getBlocks(); - for (var d = 0;d < b.length;d++) { - a += this.Block(b[d]); + var b = ""; + a = a.getBlocks(); + for (var c = 0;c < a.length;c++) { + b += this.Block(a[c]); } - return a; + return b; }; - a.Block = function(b) { - var a = b._schema.syntax; - return a ? this[a[0]](b) : ""; + b.Block = function(a) { + var b = a._schema.syntax; + return b ? this[b[0]](a) : ""; }; - a.Program = function(b) { + b.Program = function(a) { return ""; }; - a.Scope = function(b) { - b = b._schema.syntax.concat(); - return b.splice(1, b.length - 1).join(".") + "();\n"; + b.Scope = function(a) { + a = a._schema.syntax.concat(); + return a.splice(1, a.length - 1).join(".") + "();\n"; }; - a.BasicFunction = function(b) { - b = this.Thread(b.statements[0]); - return "function promise() {\n" + this.indent(b) + "}\n"; + b.BasicFunction = function(a) { + a = this.Thread(a.statements[0]); + return "function promise() {\n" + this.indent(a) + "}\n"; }; - a.BasicIteration = function(b) { - var a = b.params[0], d = this.publishIterateVariable(); - b = this.Thread(b.statements[0]); + b.BasicIteration = function(a) { + var b = a.params[0], c = this.publishIterateVariable(); + a = this.Thread(a.statements[0]); this.unpublishIterateVariable(); - return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++){\n" + this.indent(b) + "}\n"; + return "for (var " + c + " = 0; " + c + " < " + b + "; " + c + "++){\n" + this.indent(a) + "}\n"; }; - a.BasicIf = function(b) { - var a = this.Thread(b.statements[0]); - return "if (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; + b.BasicIf = function(a) { + var b = this.Thread(a.statements[0]); + return "if (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; }; - a.BasicWhile = function(b) { - var a = this.Thread(b.statements[0]); - return "while (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; + b.BasicWhile = function(a) { + var b = this.Thread(a.statements[0]); + return "while (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; }; - a.indent = function(b) { - var a = " "; - b = b.split("\n"); - b.pop(); - return a += b.join("\n ") + "\n"; + b.indent = function(a) { + var b = " "; + a = a.split("\n"); + a.pop(); + return b += a.join("\n ") + "\n"; }; - a.publishIterateVariable = function() { - var b = "", a = this._iterVariableCount; + b.publishIterateVariable = function() { + var a = "", b = this._iterVariableCount; do { - b = this._iterVariableChunk[a % 3] + b, a = parseInt(a / 3) - 1, 0 === a && (b = this._iterVariableChunk[0] + b); - } while (0 < a); + a = this._iterVariableChunk[b % 3] + a, b = parseInt(b / 3) - 1, 0 === b && (a = this._iterVariableChunk[0] + a); + } while (0 < b); this._iterVariableCount++; - return b; + return a; }; - a.unpublishIterateVariable = function() { + b.unpublishIterateVariable = function() { this._iterVariableCount && this._iterVariableCount--; }; })(Entry.BlockParser.prototype); -Entry.JSParser = function(a) { - this.syntax = a; +Entry.JSParser = function(b) { + this.syntax = b; this.scopeChain = []; this.scope = null; }; -(function(a) { - a.Program = function(b) { - var a = [], d = []; - d.push({type:this.syntax.Program}); - var e = this.initScope(b), d = d.concat(this.BlockStatement(b)); +(function(b) { + b.Program = function(a) { + var b = [], c = []; + c.push({type:this.syntax.Program}); + var e = this.initScope(a), c = c.concat(this.BlockStatement(a)); this.unloadScope(); - a.push(d); - return a = a.concat(e); + b.push(c); + return b = b.concat(e); }; - a.Identifier = function(b, a) { - return a ? a[b.name] : this.scope[b.name]; + b.Identifier = function(a, b) { + return b ? b[a.name] : this.scope[a.name]; }; - a.ExpressionStatement = function(b) { - b = b.expression; - return this[b.type](b); + b.ExpressionStatement = function(a) { + a = a.expression; + return this[a.type](a); }; - a.ForStatement = function(b) { - var a = b.init, d = b.test, e = b.update, f = b.body; + b.ForStatement = function(a) { + var b = a.init, c = a.test, e = a.update, f = a.body; if (this.syntax.ForStatement) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } - var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; - "++" != e.operator && (e = a, a = d, d = e); + var f = this[f.type](f), b = b.declarations[0].init.value, g = c.operator, c = c.right.value, h = 0; + "++" != e.operator && (e = b, b = c, c = e); switch(g) { case "<": - h = d - a; + h = c - b; break; case "<=": - h = d + 1 - a; + h = c + 1 - b; break; case ">": - h = a - d; + h = b - c; break; case ">=": - h = a + 1 - d; + h = b + 1 - c; } - return this.BasicIteration(b, h, f); + return this.BasicIteration(a, h, f); }; - a.BlockStatement = function(b) { - var a = []; - b = b.body; - for (var d = 0;d < b.length;d++) { - var e = b[d], f = this[e.type](e); + b.BlockStatement = function(a) { + var b = []; + a = a.body; + for (var c = 0;c < a.length;c++) { + var e = a[c], f = this[e.type](e); if (f) { if (void 0 === f.type) { throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; } - f && a.push(f); + f && b.push(f); } } - return a; + return b; }; - a.EmptyStatement = function(b) { - throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.EmptyStatement = function(a) { + throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.DebuggerStatement = function(b) { - throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.DebuggerStatement = function(a) { + throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.WithStatement = function(b) { - throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.WithStatement = function(a) { + throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ReturnStaement = function(b) { - throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ReturnStaement = function(a) { + throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.LabeledStatement = function(b) { - throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.LabeledStatement = function(a) { + throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.BreakStatement = function(b) { - throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.BreakStatement = function(a) { + throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ContinueStatement = function(b) { - throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ContinueStatement = function(a) { + throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.IfStatement = function(b) { + b.IfStatement = function(a) { if (this.syntax.IfStatement) { - throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } - return this.BasicIf(b); + return this.BasicIf(a); }; - a.SwitchStatement = function(b) { - throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.SwitchStatement = function(a) { + throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.SwitchCase = function(b) { - throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.SwitchCase = function(a) { + throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ThrowStatement = function(b) { - throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ThrowStatement = function(a) { + throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.TryStatement = function(b) { - throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.TryStatement = function(a) { + throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.CatchClause = function(b) { - throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.CatchClause = function(a) { + throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.WhileStatement = function(b) { - var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); - if (d) { - throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.WhileStatement = function(a) { + var b = a.body, c = this.syntax.WhileStatement, b = this[b.type](b); + if (c) { + throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } - return this.BasicWhile(b, a); + return this.BasicWhile(a, b); }; - a.DoWhileStatement = function(b) { - throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.DoWhileStatement = function(a) { + throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ForInStatement = function(b) { - throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ForInStatement = function(a) { + throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.FunctionDeclaration = function(b) { + b.FunctionDeclaration = function(a) { if (this.syntax.FunctionDeclaration) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } return null; }; - a.VariableDeclaration = function(b) { - throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.VariableDeclaration = function(a) { + throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ThisExpression = function(b) { + b.ThisExpression = function(a) { return this.scope.this; }; - a.ArrayExpression = function(b) { - throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ArrayExpression = function(a) { + throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.ObjectExpression = function(b) { - throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ObjectExpression = function(a) { + throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.Property = function(b) { - throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.Property = function(a) { + throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.FunctionExpression = function(b) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.FunctionExpression = function(a) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.UnaryExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.UnaryExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; }; - a.UnaryOperator = function() { + b.UnaryOperator = function() { return "- + ! ~ typeof void delete".split(" "); }; - a.updateOperator = function() { + b.updateOperator = function() { return ["++", "--"]; }; - a.BinaryOperator = function() { + b.BinaryOperator = function() { return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); }; - a.AssignmentExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.AssignmentExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; }; - a.AssignmentOperator = function() { + b.AssignmentOperator = function() { return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); }; - a.LogicalExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.LogicalExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; }; - a.LogicalOperator = function() { + b.LogicalOperator = function() { return ["||", "&&"]; }; - a.MemberExpression = function(b) { - var a = b.object, d = b.property; - console.log(a.type); - a = this[a.type](a); - console.log(a); - d = this[d.type](d, a); - if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { - throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; + b.MemberExpression = function(a) { + var b = a.object, c = a.property; + console.log(b.type); + b = this[b.type](b); + console.log(b); + c = this[c.type](c, b); + if (Object(b) !== b || Object.getPrototypeOf(b) !== Object.prototype) { + throw {message:b + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:a}; } - a = d; - if (!a) { - throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; + b = c; + if (!b) { + throw {message:c + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:a}; } - return a; + return b; }; - a.ConditionalExpression = function(b) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ConditionalExpression = function(a) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.UpdateExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.UpdateExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; }; - a.CallExpression = function(b) { - b = b.callee; - return {type:this[b.type](b)}; + b.CallExpression = function(a) { + a = a.callee; + return {type:this[a.type](a)}; }; - a.NewExpression = function(b) { - throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.NewExpression = function(a) { + throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.SequenceExpression = function(b) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.SequenceExpression = function(a) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.initScope = function(b) { + b.initScope = function(a) { if (null === this.scope) { - var a = function() { + var b = function() { }; - a.prototype = this.syntax.Scope; + b.prototype = this.syntax.Scope; } else { - a = function() { - }, a.prototype = this.scope; + b = function() { + }, b.prototype = this.scope; } - this.scope = new a; + this.scope = new b; this.scopeChain.push(this.scope); - return this.scanDefinition(b); + return this.scanDefinition(a); }; - a.unloadScope = function() { + b.unloadScope = function() { this.scopeChain.pop(); this.scope = this.scopeChain.length ? this.scopeChain[this.scopeChain.length - 1] : null; }; - a.scanDefinition = function(b) { - b = b.body; - for (var a = [], d = 0;d < b.length;d++) { - var e = b[d]; - "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); + b.scanDefinition = function(a) { + a = a.body; + for (var b = [], c = 0;c < a.length;c++) { + var e = a[c]; + "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, b.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); } - return a; + return b; }; - a.BasicFunction = function(b, a) { + b.BasicFunction = function(a, b) { return null; }; - a.BasicIteration = function(b, a, d) { - var c = this.syntax.BasicIteration; - if (!c) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.BasicIteration = function(a, b, c) { + var e = this.syntax.BasicIteration; + if (!e) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } - return {params:[a], type:c, statements:[d]}; + return {params:[b], type:e, statements:[c]}; }; - a.BasicWhile = function(b, a) { - var c = b.test.raw; + b.BasicWhile = function(a, b) { + var c = a.test.raw; if (this.syntax.BasicWhile[c]) { - return {type:this.syntax.BasicWhile[c], statements:[a]}; + return {type:this.syntax.BasicWhile[c], statements:[b]}; } - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; }; - a.BasicIf = function(b) { - var a = b.consequent, a = this[a.type](a); + b.BasicIf = function(a) { + var b = a.consequent, b = this[b.type](b); try { - var d = "", e = "===" === b.test.operator ? "==" : b.test.operator; - if ("Identifier" === b.test.left.type && "Literal" === b.test.right.type) { - d = b.test.left.name + " " + e + " " + b.test.right.raw; + var c = "", e = "===" === a.test.operator ? "==" : a.test.operator; + if ("Identifier" === a.test.left.type && "Literal" === a.test.right.type) { + c = a.test.left.name + " " + e + " " + a.test.right.raw; } else { - if ("Literal" === b.test.left.type && "Identifier" === b.test.right.type) { - d = b.test.right.name + " " + e + " " + b.test.left.raw; + if ("Literal" === a.test.left.type && "Identifier" === a.test.right.type) { + c = a.test.right.name + " " + e + " " + a.test.left.raw; } else { throw Error(); } } - if (this.syntax.BasicIf[d]) { - return Array.isArray(a) || "object" !== typeof a || (a = [a]), {type:this.syntax.BasicIf[d], statements:[a]}; + if (this.syntax.BasicIf[c]) { + return Array.isArray(b) || "object" !== typeof b || (b = [b]), {type:this.syntax.BasicIf[c], statements:[b]}; } throw Error(); } catch (f) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; } }; })(Entry.JSParser.prototype); Entry.ParserOld = {}; -Entry.Parser = function(a, b, c) { - this._mode = a; +Entry.Parser = function(b, a, d) { + this._mode = b; this.syntax = {}; - this.codeMirror = c; - this._lang = b || "js"; + this.codeMirror = d; + this._lang = a || "js"; this.availableCode = []; - "maze" === a && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); - this.mappingSyntax(a); + "maze" === b && (this._stageId = +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": this._parser = new Entry.JSParser(this.syntax); - b = this.syntax; - var d = {}, e; - for (e in b.Scope) { - d[e + "();\n"] = b.Scope[e]; - } - "BasicIf" in b && (d.front = "BasicIf"); - CodeMirror.commands.javascriptComplete = function(b) { - CodeMirror.showHint(b, null, {globalScope:d}); + a = this.syntax; + var c = {}, e; + for (e in a.Scope) { + c[e + "();\n"] = a.Scope[e]; + } + "BasicIf" in a && (c.front = "BasicIf"); + CodeMirror.commands.javascriptComplete = function(a) { + CodeMirror.showHint(a, null, {globalScope:c}); }; - c.on("keyup", function(b, a) { - !b.state.completionActive && 65 <= a.keyCode && 95 >= a.keyCode && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:d}); + d.on("keyup", function(a, b) { + !a.state.completionActive && 65 <= b.keyCode && 95 >= b.keyCode && CodeMirror.showHint(a, null, {completeSingle:!1, globalScope:c}); }); break; case "block": this._parser = new Entry.BlockParser(this.syntax); } }; -(function(a) { - a.parse = function(b) { - var a = null; - switch(this._lang) { - case "js": - try { - var d = acorn.parse(b), a = this._parser.Program(d); - } catch (e) { - this.codeMirror && (e instanceof SyntaxError ? (b = {from:{line:e.loc.line - 1, ch:e.loc.column - 2}, to:{line:e.loc.line - 1, ch:e.loc.column + 1}}, e.message = "\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4.") : (b = this.getLineNumber(e.node.start, e.node.end), b.message = e.message, b.severity = "error", this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0})), Entry.toast.alert("Error", e.message)), a = []; - } - break; - case "block": - b = this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g), a = Array.isArray(b) ? b.reduce(function(b, a, c) { - 1 === c && (b += "\n"); - return (-1 < a.indexOf("function") ? a + b : b + a) + "\n"; - }) : ""; - } - return a; +(function(b) { + b.parse = function(a) { + var b = null; + switch(this._lang) { + case "js": + try { + var c = acorn.parse(a), b = this._parser.Program(c); + } catch (e) { + this.codeMirror && (e instanceof SyntaxError ? (a = {from:{line:e.loc.line - 1, ch:e.loc.column - 2}, to:{line:e.loc.line - 1, ch:e.loc.column + 1}}, e.message = "\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4.") : (a = this.getLineNumber(e.node.start, e.node.end), a.message = e.message, a.severity = "error", this.codeMirror.markText(a.from, a.to, {className:"CodeMirror-lint-mark-error", __annotation:a, clearOnEnter:!0})), Entry.toast.alert("Error", e.message)), b = []; + } + break; + case "block": + a = this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g), b = Array.isArray(a) ? a.reduce(function(a, b, d) { + var c = ""; + 1 === d && (a += "\n"); + c = -1 < b.indexOf("function") ? b + a : a + b; + return c + "\n"; + }) : ""; + } + return b; + }; + b.getLineNumber = function(a, b) { + var c = this.codeMirror.getValue(), e = {from:{}, to:{}}, f = c.substring(0, a).split(/\n/gi); + e.from.line = f.length - 1; + e.from.ch = f[f.length - 1].length; + c = c.substring(0, b).split(/\n/gi); + e.to.line = c.length - 1; + e.to.ch = c[c.length - 1].length; + return e; + }; + b.mappingSyntax = function(a) { + for (var b = Object.keys(Entry.block), c = 0;c < b.length;c++) { + var e = b[c], f = Entry.block[e]; + if (f.mode === a && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { + for (var g = this.syntax, h = 0;h < f.length;h++) { + var k = f[h]; + if (h === f.length - 2 && "function" === typeof f[h + 1]) { + g[k] = f[h + 1]; + break; + } + g[k] || (g[k] = {}); + h === f.length - 1 ? g[k] = e : g = g[k]; + } + } + } + }; + b.setAvailableCode = function(a, b) { + var c = []; + a.forEach(function(a, b) { + a.forEach(function(a, b) { + c.push(a.type); + }); + }); + b instanceof Entry.Code ? b.getBlockList().forEach(function(a) { + a.type !== NtryData.START && -1 === c.indexOf(a.type) && c.push(a.type); + }) : b.forEach(function(a, b) { + a.forEach(function(a, b) { + a.type !== NtryData.START && -1 === c.indexOf(a.type) && c.push(a.type); + }); + }); + this.availableCode = this.availableCode.concat(c); + }; +})(Entry.Parser.prototype); +Entry.Pdf = function(b) { + this.generateView(b); +}; +p = Entry.Pdf.prototype; +p.generateView = function(b) { + var a = Entry.createElement("div", "entryPdfWorkspace"); + a.addClass("entryRemove"); + this._view = a; + var d = "/pdfjs/web/viewer.html"; + b && "" != b && (d += "?file=" + b); + pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); + pdfViewIframe.setAttribute("id", "pdfViewIframe"); + pdfViewIframe.setAttribute("frameborder", 0); + pdfViewIframe.setAttribute("src", d); + a.appendChild(pdfViewIframe); +}; +p.getView = function() { + return this._view; +}; +p.resize = function() { + var b = document.getElementById("entryContainerWorkspaceId"), a = document.getElementById("pdfViewIframe"); + w = b.offsetWidth; + a.width = w + "px"; + a.height = 9 * w / 16 + "px"; +}; +Entry.Popup = function() { + Entry.assert(!window.popup, "Popup exist"); + this.body_ = Entry.createElement("div"); + this.body_.addClass("entryPopup"); + this.body_.bindOnClick(function(b) { + b.target == this && this.popup.remove(); + }); + this.body_.popup = this; + document.body.appendChild(this.body_); + this.window_ = Entry.createElement("div"); + this.window_.addClass("entryPopupWindow"); + "tablet" === Entry.device && this.window_.addClass("tablet"); + this.window_.bindOnClick(function() { + }); + Entry.addEventListener("windowResized", this.resize); + window.popup = this; + this.resize(); + this.body_.appendChild(this.window_); +}; +Entry.Popup.prototype.remove = function() { + for (;this.window_.hasChildNodes();) { + "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); + } + $("body").css("overflow", "auto"); + Entry.removeElement(this.body_); + window.popup = null; + Entry.removeEventListener("windowResized", this.resize); + Entry.engine.popup = null; + Entry.windowResized.notify(); +}; +Entry.Popup.prototype.resize = function(b) { + b = window.popup.window_; + var a = .9 * window.innerWidth, d = .9 * window.innerHeight - 35; + 9 * a <= 16 * d ? d = a / 16 * 9 : a = 16 * d / 9; + b.style.width = String(a) + "px"; + b.style.height = String(d + 35) + "px"; + Entry.stage && Entry.stage.updateBoundRect(); +}; +Entry.popupHelper = function(b) { + function a(a) { + if (!(e.nowContent && -1 < d.indexOf(e.nowContent.prop("type")))) { + var b = $(a.target); + c.forEach(function(a) { + b.hasClass(a) && e.hide(); + }); + a.target == e && e.hide(); + } + } + this.popupList = {}; + this.nextPopupList = []; + this.nowContent; + b && (window.popupHelper = null); + Entry.assert(!window.popupHelper, "Popup exist"); + var d = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; + this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); + var e = this; + this.body_.bindOnClick(a); + this.body_.bind("touchstart", a); + window.popupHelper = this; + this.body_.prop("popup", this); + Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); + b = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:b}); + this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:b}); + Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:b}); + $("body").append(this.body_); +}; +Entry.popupHelper.prototype.clearPopup = function() { + for (var b = this.popupWrapper_.children.length - 1;2 < b;b--) { + this.popupWrapper_.removeChild(this.popupWrapper_.children[b]); + } +}; +Entry.popupHelper.prototype.addPopup = function(b, a) { + var d = Entry.Dom("div"), c = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); + c.bindOnClick(function() { + a.closeEvent ? a.closeEvent(this) : this.hide(); + }.bind(this)); + var e = this; + c.bind("touchstart", function() { + a.closeEvent ? a.closeEvent(e) : e.hide(); + }); + var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); + f.append(c); + a.title && (c = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(c), c.text(a.title)); + d.addClass(b); + d.append(f); + d.popupWrapper_ = f; + d.prop("type", a.type); + "function" === typeof a.setPopupLayout && a.setPopupLayout(d); + this.popupList[b] = d; +}; +Entry.popupHelper.prototype.hasPopup = function(b) { + return !!this.popupList[b]; +}; +Entry.popupHelper.prototype.setPopup = function(b) { +}; +Entry.popupHelper.prototype.remove = function(b) { + 0 < this.window_.children().length && this.window_.children().remove(); + delete this.popupList[b]; + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); + 0 < this.nextPopupList.length && this.show(this.nextPopupList.shift()); +}; +Entry.popupHelper.prototype.resize = function(b) { +}; +Entry.popupHelper.prototype.show = function(b, a) { + function d(a) { + c.window_.append(c.popupList[a]); + c.nowContent = c.popupList[a]; + c.body_.removeClass("hiddenPopup"); + } + var c = this; + a ? 0 < this.window_.children().length ? this.nextPopupList.push(b) : (this.window_.children().detach(), d(b)) : (this.window_.children().detach(), d(b)); +}; +Entry.popupHelper.prototype.hide = function() { + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); + this.window_.children().detach(); + 0 < this.nextPopupList.length && this.show(this.nextPopupList.shift()); +}; +Entry.getStartProject = function(b) { + return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], + selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:b + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:b + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:b + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, + entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; +}; +Entry.PropertyPanel = function() { + this.modes = {}; + this.selected = null; +}; +(function(b) { + b.generateView = function(a, b) { + this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(a)}); + this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); + this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); + this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); + var c = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); + this.initializeSplitter(c); }; - a.getLineNumber = function(b, a) { - var c = this.codeMirror.getValue(), e = {from:{}, to:{}}; - b = c.substring(0, b).split(/\n/gi); - e.from.line = b.length - 1; - e.from.ch = b[b.length - 1].length; - a = c.substring(0, a).split(/\n/gi); - e.to.line = a.length - 1; - e.to.ch = a[a.length - 1].length; - return e; + b.addMode = function(a, b) { + var c = b.getView(), c = Entry.Dom(c, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[a] + "
", {classes:["propertyTabElement", "propertyTab" + a], parent:this._tabView}), f = this; + e.bind("click", function() { + f.select(a); + }); + this.modes[a] && (this.modes[a].tabDom.remove(), this.modes[a].contentDom.remove(), "hw" == a && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); + this.modes[a] = {obj:b, tabDom:e, contentDom:c}; + "hw" == a && $(".propertyTabhw").bind("dblclick", function() { + Entry.dispatchEvent("hwModeChange"); + }); }; - a.mappingSyntax = function(b) { - for (var a = Object.keys(Entry.block), d = 0;d < a.length;d++) { - var e = a[d], f = Entry.block[e]; - if (f.mode === b && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { - for (var g = this.syntax, h = 0;h < f.length;h++) { - var k = f[h]; - if (h === f.length - 2 && "function" === typeof f[h + 1]) { - g[k] = f[h + 1]; - break; - } - g[k] || (g[k] = {}); - h === f.length - 1 ? g[k] = e : g = g[k]; - } - } - } + b.removeMode = function(a) { + this.modes[a] && (this.modes[a].tabDom.remove(), this.modes[a].contentDom.remove(), "hw" == a && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); + (a = Object.keys(this.modes)) && 0 < a.length && this.select(a[0]); }; - a.setAvailableCode = function(b, a) { - var c = []; - b.forEach(function(b, a) { - b.forEach(function(b, a) { - c.push(b.type); - }); + b.resize = function(a) { + this._view.css({width:a + "px", top:9 * a / 16 + 123 - 22 + "px"}); + 430 <= a ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); + Entry.dispatchEvent("windowResized"); + a = this.selected; + "hw" == a ? this.modes.hw.obj.listPorts ? this.modes[a].obj.resizeList() : this.modes[a].obj.resize() : this.modes[a].obj.resize(); + }; + b.select = function(a) { + for (var b in this.modes) { + var c = this.modes[b]; + c.tabDom.removeClass("selected"); + c.contentDom.addClass("entryRemove"); + c.obj.visible = !1; + } + b = this.modes[a]; + b.tabDom.addClass("selected"); + b.contentDom.removeClass("entryRemove"); + b.obj.resize && b.obj.resize(); + b.obj.visible = !0; + this.selected = a; + }; + b.initializeSplitter = function(a) { + var b = this; + a.bind("mousedown touchstart", function(a) { + b._cover.removeClass("entryRemove"); + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; + Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(a) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.clientX || a.x}); + })); }); - a instanceof Entry.Code ? a.getBlockList().forEach(function(b) { - b.type !== NtryData.START && -1 === c.indexOf(b.type) && c.push(b.type); - }) : a.forEach(function(b, a) { - b.forEach(function(b, a) { - b.type !== NtryData.START && -1 === c.indexOf(b.type) && c.push(b.type); - }); + $(document).bind("mouseup touchend", function(a) { + if (a = Entry.container.resizeEvent) { + Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(a), b._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; + } + Entry.container.enableSort(); }); - this.availableCode = this.availableCode.concat(c); }; -})(Entry.Parser.prototype); -Entry.Pdf = function(a) { - this.generateView(a); -}; -p = Entry.Pdf.prototype; -p.generateView = function(a) { - var b = Entry.createElement("div", "entryPdfWorkspace"); - b.addClass("entryRemove"); - this._view = b; - var c = "/pdfjs/web/viewer.html"; - a && "" != a && (c += "?file=" + a); - pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); - pdfViewIframe.setAttribute("id", "pdfViewIframe"); - pdfViewIframe.setAttribute("frameborder", 0); - pdfViewIframe.setAttribute("src", c); - b.appendChild(pdfViewIframe); +})(Entry.PropertyPanel.prototype); +Entry.Reporter = function(b) { + this.projectId = this.userId = null; + this.isRealTime = b; + this.activities = []; }; -p.getView = function() { - return this._view; +Entry.Reporter.prototype.start = function(b, a, d) { + this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:a, projectId:b, time:d})); + this.userId = a; + this.projectId = b; }; -p.resize = function() { - var a = document.getElementById("entryContainerWorkspaceId"), b = document.getElementById("pdfViewIframe"); - w = a.offsetWidth; - b.width = w + "px"; - b.height = 9 * w / 16 + "px"; +Entry.Reporter.prototype.report = function(b) { + if (!this.isRealTime || this.io) { + var a = [], d; + for (d in b.params) { + var c = b.params[d]; + "object" !== typeof c ? a.push(c) : c.id && a.push(c.id); + } + b = {message:b.message, userId:this.userId, projectId:this.projectId, time:b.time, params:a}; + this.isRealTime ? this.io.emit("activity", b) : this.activities.push(b); + } }; -Entry.FieldTrashcan = function(a) { - a && this.setBoard(a); - this.dragBlockObserver = this.dragBlock = null; - this.isOver = !1; - Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); +Entry.Scene = function() { + var b = this; + this.scenes_ = []; + this.selectedScene = null; + this.maxCount = 20; + $(window).on("resize", function(a) { + b.resize(); + }); }; -(function(a) { - a._generateView = function() { - this.svgGroup = this.board.svg.elem("g"); - this.renderStart(); - this._addControl(); - }; - a.renderStart = function() { - var b = Entry.mediaFilePath + "delete_"; - this.trashcanTop = this.svgGroup.elem("image", {href:b + "cover.png", width:60, height:20}); - this.svgGroup.elem("image", {href:b + "body.png", y:20, width:60, height:60}); - }; - a._addControl = function() { - $(this.svgGroup).bind("mousedown", function(b) { - Entry.Utils.isRightButton(b) && (b.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); +Entry.Scene.viewBasicWidth = 70; +Entry.Scene.prototype.generateView = function(b, a) { + var d = this; + this.view_ = b; + this.view_.addClass("entryScene"); + if (!a || "workspace" == a) { + this.view_.addClass("entrySceneWorkspace"); + $(this.view_).on("mousedown", function(a) { + var b = $(this).offset(), c = $(window), h = a.pageX - b.left + c.scrollLeft(); + a = a.pageY - b.top + c.scrollTop(); + a = 40 - a; + b = -40 / 55; + c = $(d.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; + !(h < c || h > c + 55) && a > 40 + b * (h - c) && (h = d.getNextScene()) && (h = $(h.view), $(document).trigger("mouseup"), h.trigger("mousedown")); }); + var c = Entry.createElement("ul"); + c.addClass("entrySceneListWorkspace"); + Entry.sceneEditable && $ && $(c).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + $(b.item[0]).clone(!0); + }, stop:function(a, b) { + var d = b.item.data("start_pos"), c = b.item.index(); + Entry.scene.moveScene(d, c); + }, axis:"x", tolerance:"pointer"}); + this.view_.appendChild(c); + this.listView_ = c; + Entry.sceneEditable && (c = Entry.createElement("span"), c.addClass("entrySceneElementWorkspace"), c.addClass("entrySceneAddButtonWorkspace"), c.bindOnClick(function(a) { + Entry.engine.isState("run") || Entry.scene.addScene(); + }), this.view_.appendChild(c), this.addButton_ = c); + } +}; +Entry.Scene.prototype.generateElement = function(b) { + var a = this, d = Entry.createElement("li", b.id); + d.addClass("entrySceneElementWorkspace"); + d.addClass("entrySceneButtonWorkspace"); + d.addClass("minValue"); + $(d).on("mousedown", function(a) { + Entry.engine.isState("run") ? a.preventDefault() : Entry.scene.selectScene(b); + }); + var c = Entry.createElement("input"); + c.addClass("entrySceneFieldWorkspace"); + c.value = b.name; + Entry.sceneEditable || (c.disabled = "disabled"); + var e = Entry.createElement("span"); + e.addClass("entrySceneLeftWorkspace"); + d.appendChild(e); + var f = Entry.createElement("span"); + f.addClass("entrySceneInputCover"); + f.style.width = Entry.computeInputWidth(b.name); + d.appendChild(f); + b.inputWrapper = f; + c.onkeyup = function(d) { + d = d.keyCode; + Entry.isArrowOrBackspace(d) || (b.name = this.value, f.style.width = Entry.computeInputWidth(b.name), a.resize(), 13 == d && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); }; - a.updateDragBlock = function() { - var b = this.board.dragBlock, a = this.dragBlockObserver; - a && (a.destroy(), this.dragBlockObserver = null); - b ? this.dragBlockObserver = b.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); - this.dragBlock = b; + c.onblur = function(a) { + c.value = this.value; + b.name = this.value; + f.style.width = Entry.computeInputWidth(b.name); }; - a.checkBlock = function() { - var b = this.dragBlock; - if (b && b.block.isDeletable()) { - var a = this.board.offset(), d = this.getPosition(), e = d.x + a.left, a = d.y + a.top, f, g; - if (b = b.dragInstance) { - f = b.offsetX, g = b.offsetY; - } - this.tAnimation(f >= e && g >= a); + f.appendChild(c); + e = Entry.createElement("span"); + e.addClass("entrySceneRemoveButtonCoverWorkspace"); + d.appendChild(e); + if (Entry.sceneEditable) { + var g = Entry.createElement("button"); + g.addClass("entrySceneRemoveButtonWorkspace"); + g.scene = b; + g.bindOnClick(function(a) { + a.stopPropagation(); + Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); + }); + e.appendChild(g); + } + Entry.Utils.disableContextmenu(d); + $(d).on("contextmenu", function() { + var a = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { + Entry.scene.cloneScene(b); + }}]; + Entry.ContextMenu.show(a, "workspace-contextmenu"); + }); + return b.view = d; +}; +Entry.Scene.prototype.updateView = function() { + if (!Entry.type || "workspace" == Entry.type) { + for (var b = this.listView_, a = $(b).children().length;a < this.getScenes().length;a++) { + b.appendChild(this.getScenes()[a].view); } - }; - a.align = function() { - var b = this.getPosition(); - this.svgGroup.attr({transform:"translate(" + b.x + "," + b.y + ")"}); - }; - a.setPosition = function() { - if (this.board) { - var b = this.board.svgDom; - this._x = b.width() - 110; - this._y = b.height() - 110; - this.align(); + this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); + } + this.resize(); +}; +Entry.Scene.prototype.addScenes = function(b) { + if ((this.scenes_ = b) && 0 !== b.length) { + for (var a = 0, d = b.length;a < d;a++) { + this.generateElement(b[a]); } - }; - a.getPosition = function() { - return {x:this._x, y:this._y}; - }; - a.tAnimation = function(b) { - if (b !== this.isOver) { - b = void 0 === b ? !0 : b; - var a, d = this.trashcanTop; - a = b ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; - $(d).velocity(a, {duration:50}); - this.isOver = b; + } else { + this.scenes_ = [], this.scenes_.push(this.createScene()); + } + this.selectScene(this.getScenes()[0]); + this.updateView(); +}; +Entry.Scene.prototype.addScene = function(b, a) { + void 0 === b && (b = this.createScene()); + b.view || this.generateElement(b); + a || "number" == typeof a ? this.getScenes().splice(a, 0, b) : this.getScenes().push(b); + Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(b)); + Entry.playground.flushPlayground(); + this.selectScene(b); + this.updateView(); + return b; +}; +Entry.Scene.prototype.removeScene = function(b) { + if (1 >= this.getScenes().length) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); + } else { + var a = this.getScenes().indexOf(this.getSceneById(b.id)); + this.getScenes().splice(a, 1); + for (var a = Entry.container.getSceneObjects(b), d = 0;d < a.length;d++) { + Entry.container.removeObject(a[d]); } - }; - a.setBoard = function(b) { - this._dragBlockObserver && this._dragBlockObserver.destroy(); - this.board = b; - this.svgGroup || this._generateView(); - var a = b.svg, d = a.firstChild; - d ? a.insertBefore(this.svgGroup, d) : a.appendChild(this.svgGroup); - this._dragBlockObserver = b.observe(this, "updateDragBlock", ["dragBlock"]); - this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + b.suffix + ")"}); - this.setPosition(); - }; -})(Entry.FieldTrashcan.prototype); -Entry.Workspace = function(a) { - Entry.Model(this, !1); - this.observe(this, "_handleChangeBoard", ["selectedBoard"], !1); - this.trashcan = new Entry.FieldTrashcan; - var b = a.blockMenu; - b && (this.blockMenu = new Entry.BlockMenu(b.dom, b.align, b.categoryData, b.scroll), this.blockMenu.workspace = this, this.blockMenu.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1)); - if (b = a.board) { - b.workspace = this, this.board = new Entry.Board(b), this.board.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1), this.set({selectedBoard:this.board}); + Entry.stage.removeObjectContainer(b); + $(b.view).remove(); + this.selectScene(); } - if (b = a.vimBoard) { - this.vimBoard = new Entry.Vim(b.dom), this.vimBoard.workspace = this; +}; +Entry.Scene.prototype.selectScene = function(b) { + b = b || this.getScenes()[0]; + if (!this.selectedScene || this.selectedScene.id != b.id) { + Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); + var a = this.selectedScene; + a && (a = a.view, a.removeClass("selectedScene"), a = $(a), a.find("input").blur()); + this.selectedScene = b; + b.view.addClass("selectedScene"); + Entry.container.setCurrentObjects(); + Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(b); + (b = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(b.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); + Entry.container.listView_ || Entry.stage.sortZorder(); + Entry.container.updateListView(); + this.updateView(); + Entry.requestUpdate = !0; } - this.board && this.vimBoard && this.vimBoard.hide(); - Entry.GlobalSvg.createDom(); - this.mode = Entry.Workspace.MODE_BOARD; - Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); - this.changeEvent = new Entry.Event(this); - Entry.commander.setCurrentEditor("board", this.board); - this.textType = Entry.Vim.TEXT_TYPE_PY; }; -Entry.Workspace.MODE_BOARD = 0; -Entry.Workspace.MODE_VIMBOARD = 1; -Entry.Workspace.MODE_OVERLAYBOARD = 2; -(function(a) { - a.schema = {selectedBlockView:null, selectedBoard:null}; - a.getBoard = function() { - return this.board; - }; - a.getSelectedBoard = function() { - return this.selectedBoard; - }; - a.getBlockMenu = function() { - return this.blockMenu; - }; - a.getVimBoard = function() { - return this.vimBoard; - }; - a.getMode = function() { - return this.mode; - }; - a.setMode = function(b, a) { - "number" === typeof b ? this.mode = b : (this.mode = b.boardType, this.runType = b.runType, this.textType = b.textType); - switch(this.mode) { - case this.oldMode: - return; - case Entry.Workspace.MODE_VIMBOARD: - try { - this.board && this.board.hide(), this.overlayBoard && this.overlayBoard.hide(), this.set({selectedBoard:this.vimBoard}), this.vimBoard.show(), this.codeToText(this.board.code, b), this.blockMenu.renderText(function() { - this.blockMenu.reDraw(); - }.bind(this)), this.board.clear(), this.oldTextType = this.textType; - } catch (d) { - } - break; - case Entry.Workspace.MODE_BOARD: - try { - this.board.show(), this.set({selectedBoard:this.board}), this.textToCode(this.oldMode, this.oldTextType), this.vimBoard && this.vimBoard.hide(), this.overlayBoard && this.overlayBoard.hide(), this.blockMenu.renderBlock(function() { - this.blockMenu.reDraw(); - }.bind(this)), this.oldTextType = this.textType; - } catch (d) { - this.board && this.board.hide(), this.set({selectedBoard:this.vimBoard}), this.mode = Entry.Workspace.MODE_VIMBOARD, this.oldTextType == Entry.Vim.PARSER_TYPE_JS_TO_BLOCK ? (b.boardType = Entry.Workspace.MODE_VIMBOARD, b.textType = Entry.Vim.TEXT_TYPE_JS, b.runType = Entry.Vim.MAZE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK, Entry.dispatchEvent("changeMode", b), Ntry.dispatchEvent("textError", b)) : this.oldTextType == Entry.Vim.PARSER_TYPE_PY_TO_BLOCK && (b.boardType = - Entry.Workspace.MODE_VIMBOARD, b.textType = Entry.Vim.TEXT_TYPE_PY, b.runType = Entry.Vim.WORKSPACE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK, Entry.dispatchEvent("changeMode", b)); - } - Entry.commander.setCurrentEditor("board", this.board); - break; - case Entry.Workspace.MODE_OVERLAYBOARD: - this.overlayBoard || this.initOverlayBoard(), this.overlayBoard.show(), this.set({selectedBoard:this.overlayBoard}), Entry.commander.setCurrentEditor("board", this.overlayBoard); - } - this.oldMode = this.mode; - this.changeEvent.notify(a); - }; - a.changeBoardCode = function(b) { - this._syncTextCode(); - this.board.changeCode(b); - this.mode === Entry.Workspace.MODE_VIMBOARD && this.codeToText(this.board.code); - }; - a.changeOverlayBoardCode = function(b) { - this.overlayBoard && this.overlayBoard.changeCode(b); - }; - a.changeBlockMenuCode = function(b) { - this.blockMenu.changeCode(b); - }; - a.textToCode = function(b, a) { - if (b == Entry.Workspace.MODE_VIMBOARD) { - var c = this; - b = this.vimBoard.textToCode(a); - a = this.board; - var e = a.code; - e.load(b); - e.createView(a); - this.board.reDraw(); - setTimeout(function() { - c.board.alignThreads(); - }, 0); - } - }; - a.codeToText = function(b, a) { - return this.vimBoard.codeToText(b, a); - }; - a.getCodeToText = function(b) { - return this.vimBoard.getCodeToText(b); - }; - a._setSelectedBlockView = function() { - this.set({selectedBlockView:this.board.selectedBlockView || this.blockMenu.selectedBlockView || (this.overlayBoard ? this.overlayBoard.selectedBlockView : null)}); - }; - a.initOverlayBoard = function() { - this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); - this.overlayBoard.changeCode(new Entry.Code([])); - this.overlayBoard.workspace = this; - this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); - }; - a._keyboardControl = function(b) { - var a = b.keyCode || b.which, d = b.ctrlKey; - if (!Entry.Utils.isInInput(b)) { - var e = this.selectedBlockView; - e && !e.isInBlockMenu && e.block.isDeletable() && (8 == a || 46 == a ? (Entry.do("destroyBlock", e.block), b.preventDefault()) : d && (67 == a ? e.block.copyToClipboard() : 88 == a && (b = e.block, b.copyToClipboard(), b.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); - d && 86 == a && (a = this.selectedBoard) && a instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); - } - }; - a._handleChangeBoard = function() { - var b = this.selectedBoard; - b && b.constructor === Entry.Board && this.trashcan.setBoard(b); - }; - a._syncTextCode = function() { - if (this.mode === Entry.Workspace.MODE_VIMBOARD) { - var b = this.vimBoard.textToCode(this.textType), a = this.board, d = a.code; - d.load(b); - d.createView(a); - this.board.alignThreads(); +Entry.Scene.prototype.toJSON = function() { + for (var b = [], a = this.getScenes().length, d = 0;d < a;d++) { + var c = this.getScenes()[d], e = c.view, f = c.inputWrapper; + delete c.view; + delete c.inputWrapper; + b.push(JSON.parse(JSON.stringify(c))); + c.view = e; + c.inputWrapper = f; + } + return b; +}; +Entry.Scene.prototype.moveScene = function(b, a) { + this.getScenes().splice(a, 0, this.getScenes().splice(b, 1)[0]); + Entry.container.updateObjectsOrder(); + Entry.stage.sortZorder(); + $(".entrySceneElementWorkspace").removeAttr("style"); +}; +Entry.Scene.prototype.getSceneById = function(b) { + for (var a = this.getScenes(), d = 0;d < a.length;d++) { + if (a[d].id == b) { + return a[d]; } - }; - a.addVimBoard = function(b) { - this.vimBoard || (this.vimBoard = new Entry.Vim(b), this.vimBoard.workspace = this, this.vimBoard.hide()); - }; -})(Entry.Workspace.prototype); -Entry.BlockDriver = function() { + } + return !1; +}; +Entry.Scene.prototype.getScenes = function() { + return this.scenes_; +}; +Entry.Scene.prototype.takeStartSceneSnapshot = function() { + this.sceneBeforeRun = this.selectedScene; +}; +Entry.Scene.prototype.loadStartSceneSnapshot = function() { + this.selectScene(this.sceneBeforeRun); + this.sceneBeforeRun = null; }; -(function(a) { - a.convert = function() { - var b = new Date, a; - for (a in Entry.block) { - "function" === typeof Entry.block[a] && this._convertBlock(a); +Entry.Scene.prototype.createScene = function() { + var b = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; + this.generateElement(b); + return b; +}; +Entry.Scene.prototype.cloneScene = function(b) { + if (this.scenes_.length >= this.maxCount) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_add_error, !1); + } else { + var a = {name:b.name + Lang.Workspace.replica_of_object, id:Entry.generateHash()}; + this.generateElement(a); + this.addScene(a); + b = Entry.container.getSceneObjects(b); + for (var d = b.length - 1;0 <= d;d--) { + Entry.container.addCloneObject(b[d], a.id); } - console.log((new Date).getTime() - b.getTime()); - }; - a._convertBlock = function(b) { - function a(b) { - var c = {type:b.getAttribute("type"), index:{}}; - b = $(b).children(); - if (!b) { - return c; - } - for (var d = 0;d < b.length;d++) { - var e = b[d], f = e.tagName, g = $(e).children()[0], h = e.getAttribute("name"); - "value" === f ? "block" == g.nodeName && (c.params || (c.params = []), c.params.push(a(g)), c.index[h] = c.params.length - 1) : "field" === f && (c.params || (c.params = []), c.params.push(e.textContent), c.index[h] = c.params.length - 1); - } - return c; + } +}; +Entry.Scene.prototype.resize = function() { + var b = this.getScenes(), a = this.selectedScene, d = b[0]; + if (0 !== b.length && d) { + var c = $(d.view).offset().left, d = parseFloat($(a.view).css("margin-left")), e = $(this.view_).width() - c, f = 0, g; + for (g in b) { + var c = b[g], h = c.view; + h.addClass("minValue"); + $(c.inputWrapper).width(Entry.computeInputWidth(c.name)); + h = $(h); + f = f + h.width() + d; } - var d = Blockly.Blocks[b], e = EntryStatic.blockInfo[b], f, g; - if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { - var e = $.parseXML(e), h = a(e.childNodes[0]) + if (f > e) { + for (g in e -= $(a.view).width(), d = e / (b.length - 1) - (Entry.Scene.viewBasicWidth + d), b) { + c = b[g], a.id != c.id ? (c.view.removeClass("minValue"), $(c.inputWrapper).width(d)) : c.view.addClass("minValue"); + } } - d = (new Entry.BlockMockup(d, h, b)).toJSON(); - d.class = f; - d.isNotFor = g; - _.isEmpty(d.paramsKeyMap) && delete d.paramsKeyMap; - _.isEmpty(d.statementsKeyMap) && delete d.statementsKeyMap; - d.func = Entry.block[b]; - -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(b.toUpperCase()) && (d.isPrimitive = !0); - Entry.block[b] = d; - }; -})(Entry.BlockDriver.prototype); -Entry.BlockMockup = function(a, b, c) { - this.templates = []; - this.params = []; - this.statements = []; - this.color = ""; - this.output = this.isNext = this.isPrev = !1; - this.fieldCount = 0; - this.events = {}; - this.def = b || {}; - this.paramsKeyMap = {}; - this.statementsKeyMap = {}; - this.definition = {params:[], type:this.def.type}; - this.simulate(a); - this.def = this.definition; + } }; -(function(a) { - a.simulate = function(b) { - b.sensorList && (this.sensorList = b.sensorList); - b.portList && (this.portList = b.portList); - b.init.call(this); - b.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(b.whenAdd)); - b.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(b.whenRemove)); - }; - a.toJSON = function() { - function b(a) { - if (a && (a = a.params)) { - for (var c = 0;c < a.length;c++) { - var d = a[c]; - d && (delete d.index, b(d)); - } +Entry.Scene.prototype.getNextScene = function() { + var b = this.getScenes(); + return b[b.indexOf(this.selectedScene) + 1]; +}; +Entry.Script = function(b) { + this.entity = b; +}; +p = Entry.Script.prototype; +p.init = function(b, a, d) { + Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName); + this.type = b.getAttribute("type"); + this.id = +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)); + d instanceof Entry.Script && (this.parentScript = d); + b = b.childNodes; + for (a = 0;a < b.length;a++) { + if (d = b[a], "NEXT" == d.tagName.toUpperCase()) { + this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(b[a].childNodes[0], this); + } else { + if ("VALUE" == d.tagName.toUpperCase()) { + this.values || (this.values = {}); + var c = new Entry.Script(this.entity); + this.register && (c.register = this.register); + c.init(d.childNodes[0]); + this.values[d.getAttribute("name")] = c; + } else { + "FIELD" == d.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[d.getAttribute("name")] = d.textContent) : "STATEMENT" == d.tagName.toUpperCase() && (this.statements || (this.statements = {}), c = new Entry.Script(this.entity), this.register && (c.register = this.register), c.init(d.childNodes[0], null, this), c.key = d.getAttribute("name"), this.statements[d.getAttribute("name")] = c); } } - var a = ""; - this.output ? a = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? a = "basic_event" : 1 == this.statements.length ? a = "basic_loop" : 2 == this.statements.length ? a = "basic_double_loop" : this.isPrev && this.isNext ? a = "basic" : this.isPrev && !this.isNext && (a = "basic_without_next"); - b(this.def); - var d = /dummy_/mi, e; - for (e in this.paramsKeyMap) { - d.test(e) && delete this.paramsKeyMap[e]; + } +}; +p.clone = function(b, a) { + var d = new Entry.Script(b); + d.id = this.id; + d.type = this.type; + d.isRepeat = this.isRepeat; + if (this.parentScript && !this.previousScript && 2 != a) { + d.parentScript = this.parentScript.clone(b); + for (var c = d.parentScript.statements[this.key] = d;c.nextScript;) { + c = c.nextScript, c.parentScript = d.parentScript; } - for (e in this.statementsKeyMap) { - d.test(e) && delete this.statementsKeyMap[e]; + } + this.nextScript && 1 != a && (d.nextScript = this.nextScript.clone(b, 0), d.nextScript.previousScript = this); + this.previousScript && 0 !== a && (d.previousScript = this.previousScript.clone(b, 1), d.previousScript.previousScript = this); + if (this.fields) { + d.fields = {}; + for (var e in this.fields) { + d.fields[e] = this.fields[e]; } - return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(b) { - return "string" === typeof b; - }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; - }; - a.appendDummyInput = function() { - return this; - }; - a.appendValueInput = function(b) { - this.def && this.def.index && (void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null)); - this.params.push({type:"Block", accept:"string"}); - this._addToParamsKeyMap(b); - this.templates.push(this.getFieldCount()); - return this; + } + if (this.values) { + for (e in d.values = {}, this.values) { + d.values[e] = this.values[e].clone(b); + } + } + if (this.statements) { + for (e in d.statements = {}, this.statements) { + for (d.statements[e] = this.statements[e].clone(b, 2), c = d.statements[e], c.parentScript = d;c.nextScript;) { + c = c.nextScript, c.parentScript = d; + } + } + } + return d; +}; +p.getStatement = function(b) { + return this.statements[b]; +}; +p.compute = function() { +}; +p.getValue = function(b) { + return this.values[b].run(); +}; +p.getNumberValue = function(b) { + return +this.values[b].run(); +}; +p.getStringValue = function(b) { + return String(this.values[b].run()); +}; +p.getBooleanValue = function(b) { + return this.values[b].run() ? !0 : !1; +}; +p.getField = function(b) { + return this.fields[b]; +}; +p.getStringField = function(b) { + return String(this.fields[b]); +}; +p.getNumberField = function(b) { + return +this.fields[b]; +}; +p.callReturn = function() { + return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; +}; +p.run = function() { + return Entry.block[this.type](this.entity, this); +}; +Entry.StampEntity = function(b, a) { + this.parent = b; + this.type = b.objectType; + this.isStamp = this.isClone = !0; + this.width = a.getWidth(); + this.height = a.getHeight(); + "sprite" == this.type && (this.object = a.object.clone(!0), this.object.filters = null, a.effect && (this.effect = Entry.cloneSimpleObject(a.effect), this.applyFilter())); + this.object.entity = this; +}; +(function(b, a) { + b.applyFilter = a.applyFilter; + b.removeClone = a.removeClone; + b.getWidth = a.getWidth; + b.getHeight = a.getHeight; + b.getInitialEffectValue = a.getInitialEffectValue; +})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); +Entry.JsAstGenerator = function() { +}; +(function(b) { + b.generate = function(a) { + return arcon.parse(a); }; - a.appendStatementInput = function(b) { - this._addToStatementsKeyMap(b); - this.statements.push({accept:"basic"}); +})(Entry.JsAstGenerator.prototype); +Entry.PyAstGenerator = function() { +}; +(function(b) { + b.generate = function(a) { + var b = filbert.parse, c = {locations:!1, ranges:!1}, e; + try { + return e = b(a, c), console.log("astTree", e), e; + } catch (f) { + throw f.message = " \ud30c\uc774\uc36c \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694", f; + } }; - a.setCheck = function(b) { - var a = this.params; - "Boolean" === b && (a[a.length - 1].accept = "boolean"); +})(Entry.PyAstGenerator.prototype); +Entry.Map = function() { + this._map = {repo:{}}; +}; +(function(b) { + b.getKey = function(a) { + return a; }; - a.appendField = function(b, a) { - if (!b) { - return this; - } - "string" === typeof b && 0 < b.length ? a ? (b = {type:"Text", text:b, color:a}, this.params.push(b), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0)) : this.templates.push(b) : b.constructor == Blockly.FieldIcon ? ("start" === b.type ? this.params.push({type:"Indicator", img:b.src_, size:17, position:{x:0, y:-2}}) : - this.params.push({type:"Indicator", img:b.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : b.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:b.menuGenerator_, value:b.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(a), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : - this.definition.params.push(void 0)) : b.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:b.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), - this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), - void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : console.log("else", b); - return this; + b.put = function(a, b) { + var c = this.getKey(a); + this._map.repo[c] = b; }; - a.setColour = function(b) { - this.color = b; + b.contains = function(a) { + a = this.getKey(a); + return this._map.repo[a] ? !0 : !1; }; - a.setInputsInline = function() { + b.get = function(a) { + a = this.getKey(a); + return this._map.repo[a] ? this._map.repo[a] : null; }; - a.setOutput = function(b, a) { - b && (this.output = a); + b.remove = function(a) { + var b = this.getKey(a); + this.contains(a) && (this._map.repo[b] = void 0); }; - a.setPreviousStatement = function(b) { - this.isPrev = b; + b.clear = function() { + this._map.repo = {}; }; - a.setNextStatement = function(b) { - this.isNext = b; + b.toString = function() { + return this._map.repo; }; - a.setEditable = function(b) { +})(Entry.Map.prototype); +Entry.Queue = function() { + this.tail = this.head = null; +}; +function Node(b) { + this.data = b; + this.next = null; +} +(function(b) { + b.enqueue = function(a) { + a = new Node(a); + null === this.head ? this.head = a : this.tail.next = a; + this.tail = a; }; - a.getFieldCount = function() { - this.fieldCount++; - return "%" + this.fieldCount; + b.dequeue = function() { + var a; + null !== this.head && (a = this.head.data, this.head = this.head.next); + return a; }; - a._addToParamsKeyMap = function(b) { - b = b ? b : "dummy_" + Entry.Utils.generateId(); - var a = this.paramsKeyMap; - a[b] = Object.keys(a).length; + b.clear = function() { + for (;this.dequeue();) { + } }; - a._addToStatementsKeyMap = function(b) { - b = b ? b : "dummy_" + Entry.Utils.generateId(); - var a = this.statementsKeyMap; - a[b] = Object.keys(a).length; + b.toString = function() { + for (var a = this.head, b = [];a;) { + b.push(a.data), a = a.next; + } + return b.toString(); }; -})(Entry.BlockMockup.prototype); -Entry.Playground = function() { - this.enableArduino = this.isTextBGMode_ = !1; - this.viewMode_ = "default"; - var a = this; - Entry.addEventListener("textEdited", this.injectText); - Entry.addEventListener("hwChanged", this.updateHW); - Entry.addEventListener("changeMode", function(b) { - a.setMode(b); - }); -}; -Entry.Playground.prototype.setMode = function(a) { - this.mainWorkspace.setMode(a); -}; -Entry.Playground.prototype.generateView = function(a, b) { - this.view_ = a; - this.view_.addClass("entryPlayground"); - b && "workspace" != b ? "phone" == b && (this.view_.addClass("entryPlaygroundPhone"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(a, this.view_), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainPhone"), a.addClass("entryRemove"), a.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, a.bindOnClick(function() { - Entry.engine.toggleStop(); - }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPicturePhone"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspacePhone"), - a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(b) { - Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(b) { - Entry.playground.curtainView_.addClass("entryRemove"); - })) : (this.view_.addClass("entryPlaygroundWorkspace"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabWorkspace"), this.view_.appendChild(a), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainWorkspace"), a.addClass("entryRemove"), b = Lang.Workspace.cannot_edit_click_to_stop.split("."), a.innerHTML = b[0] + ".
" + b[1], a.addEventListener("click", function() { - Entry.engine.toggleStop(); - }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPictureWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryPlaygroundTextWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = - Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), a.addClass("entryPlaygroundDefaultWorkspace"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodeWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), - this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(b) { - Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(b) { - Entry.playground.curtainView_.addClass("entryRemove"); - })); -}; -Entry.Playground.prototype.generateDefaultView = function(a) { - return a; -}; -Entry.Playground.prototype.generateTabView = function(a) { - var b = this, c = Entry.createElement("ul"); - c.addClass("entryTabListWorkspace"); - this.tabList_ = c; - a.appendChild(c); - this.tabViewElements = {}; - a = Entry.createElement("li", "entryCodeTab"); - a.innerHTML = Lang.Workspace.tab_code; - a.addClass("entryTabListItemWorkspace"); - a.addClass("entryTabSelected"); - c.appendChild(a); - a.bindOnClick(function(a) { - b.changeViewMode("code"); - b.blockMenu.reDraw(); - }); - this.tabViewElements.code = a; - Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { - Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { - Entry.playground.changeViewMode("text"); - }), this.tabViewElements.text = a, a.addClass("entryRemove")); - Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { - Entry.playground.changeViewMode("sound"); - }), this.tabViewElements.sound = a); - Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - }), this.tabViewElements.variable = a); -}; -Entry.Playground.prototype.generateCodeView = function(a) { - var b = this.createVariableView(); - a.appendChild(b); - this.variableView_ = b; - a = Entry.Dom(a); - b = Entry.Dom("div", {parent:a, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); - a = Entry.Dom("div", {parent:a, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); - this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:a, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:b}}); - this.blockMenu = this.mainWorkspace.blockMenu; - this.board = this.mainWorkspace.board; - Entry.hw && this.updateHW(); -}; -Entry.Playground.prototype.generatePictureView = function(a) { - if ("workspace" == Entry.type) { - var b = Entry.createElement("div", "entryAddPicture"); - b.addClass("entryPlaygroundAddPicture"); - b.bindOnClick(function(b) { - Entry.dispatchEvent("openPictureManager"); +})(Entry.Queue.prototype); +Entry.PyHint = function() { + function b(a, b, d) { + a = fuzzy.filter(b, a, d); + return a = a.map(function(a) { + return a.original; }); - var c = Entry.createElement("div", "entryAddPictureInner"); - c.addClass("entryPlaygroundAddPictureInner"); - c.innerHTML = Lang.Workspace.picture_add; - b.appendChild(c); - a.appendChild(b); - b = Entry.createElement("ul", "entryPictureList"); - b.addClass("entryPlaygroundPictureList"); - $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.movePicture(b, a); - }, axis:"y"}); - a.appendChild(b); - this.pictureListView_ = b; - b = Entry.createElement("div", "entryPainter"); - b.addClass("entryPlaygroundPainter"); - a.appendChild(b); - this.painter = new Entry.Painter2(b); - } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(b) { - Entry.dispatchEvent("openPictureManager"); - }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.movePicture(b, a); - }, axis:"y"}), a.appendChild(b), this.pictureListView_ = b); - } -}; -Entry.Playground.prototype.generateTextView = function(a) { - var b = Entry.createElement("div"); - a.appendChild(b); - a = Entry.createElement("div"); - a.addClass("textProperties"); - b.appendChild(a); - var c = Entry.createElement("div"); - c.addClass("entryTextFontSelect"); - a.appendChild(c); - var d = Entry.createElement("select", "entryPainterAttrFontName"); - d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); - d.size = "1"; - d.onchange = function(b) { - Entry.playground.object.entity.setFontType(b.target.value); - }; - for (var e = 0;e < Entry.fonts.length;e++) { - var f = Entry.fonts[e], g = Entry.createElement("option"); - g.value = f.family; - g.innerHTML = f.name; - d.appendChild(g); } - this.fontName_ = d; - c.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryPlayground_text_buttons"); - a.appendChild(e); - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(b) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); - }); - e.appendChild(c); - this.alignLeftBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(b) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); - }); - e.appendChild(c); - this.alignCenterBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(b) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); - }); - e.appendChild(c); - this.alignRightBtn = c; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - }); - var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); - d.appendChild(h); - h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var b = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + b + ".png"; - Entry.playground.object.entity.setUnderLine(b); - }); - var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); - d.appendChild(k); - k.src = Entry.mediaFilePath + "text_button_underline_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; - }); - var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); - d.appendChild(l); - l.src = Entry.mediaFilePath + "text_button_italic_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var b = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(b); - m.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; - }); - var m = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - d.appendChild(m); - m.src = Entry.mediaFilePath + "text_button_strike_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { - Entry.playground.toggleColourChooser("foreground"); - }); - d = Entry.createElement("img"); - c.appendChild(d); - d.src = Entry.mediaFilePath + "text_button_color_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - e = Entry.createElement("a"); - c.appendChild(e); - e.bindOnClick(function() { - Entry.playground.toggleColourChooser("background"); + CodeMirror.registerHelper("hint", "python", function(c) { + var e = c.getCursor(), f = c.getTokenAt(e); + /^[\w$_]*$/.test(f.string) || (f = {start:e.ch, end:e.ch, string:"", state:f.state, className:":" == f.string ? "python-type" : null}); + var g = [], h = f.string, r; + if ("variable" == f.type) { + r = f.string, null != r && (g = g.concat(b(a, h)), g = g.concat(b(d._global, h, {extract:function(a) { + return a.displayText; + }}))); + } else { + if ("property" == f.type || "variable-2" == f.type || "." == f.state.lastToken) { + r = f.string; + c = c.getLineTokens(e.line); + for (var t = c.shift();"variable" !== t.type && "variable-2" !== t.type;) { + t = c.shift(); + } + c = t.string; + null != r && d[c] && (g = g.concat(b(d[c], h, {extract:function(a) { + return a.displayText; + }}))); + "." == f.state.lastToken && (g = g.concat(d[c])); + } + } + return {list:g.slice(0, 25), from:CodeMirror.Pos(e.line, f.start), to:CodeMirror.Pos(e.line, f.end)}; }); - c = Entry.createElement("img"); - e.appendChild(c); - c.src = Entry.mediaFilePath + "text_button_background_false.png"; - e = Entry.createElement("div"); - e.addClass("entryPlayground_fgColorDiv"); - c = Entry.createElement("div"); - c.addClass("entryPlayground_bgColorDiv"); - a.appendChild(e); - a.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextColoursWrapper"); - this.coloursWrapper = d; - b.appendChild(d); - a = Entry.getColourCodes(); - for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { - Entry.playground.setTextColour(b.target.getAttribute("colour")); - }), d.appendChild(c); + var a = "Entry;self;Hw;while True;True;False;break;for i in range;if;if else;len;random.randint".split(";"), d = {_global:[]}, c = Entry.block, e; + for (e in c) { + var f = c[e].syntax; + if (f && f.py) { + f = f.py.join(""); + f = f.split("."); + if (-1 < f[0].indexOf("def ")) { + f = f[0].split(" "); + } else { + if (1 === f.length) { + continue; + } + } + var g = f.shift(); + d[g] || (d[g] = [], d._global.push({displayText:g, text:g})); + var f = f[0].split(","), h = "(" + Array(f.length).join(" , ") + ")", f = f[0].split("(")[0]; + d[g].push({displayText:f, text:f + h}); + "def" == g ? d._global.push({displayText:g + " " + f, text:g + " " + f + h}) : d._global.push({displayText:g + "." + f, text:g + "." + f + h}); + } } - d.style.display = "none"; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextBackgroundsWrapper"); - this.backgroundsWrapper = d; - b.appendChild(d); - for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { - Entry.playground.setBackgroundColour(b.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - a = Entry.createElement("input"); - a.addClass("entryPlayground_textBox"); - a.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); +}; +Entry.KeyboardCode = function() { +}; +(function(b) { + b.keyCodeToChar = {8:"Backspace", 9:"Tab", 13:"Enter", 16:"Shift", 17:"Ctrl", 18:"Alt", 19:"Pause/Break", 20:"Caps Lock", 27:"Esc", 32:"Space", 33:"Page Up", 34:"Page Down", 35:"End", 36:"Home", 37:"Left", 38:"Up", 39:"Right", 40:"Down", 45:"Insert", 46:"Delete", 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 65:"A", 66:"B", 67:"C", 68:"D", 69:"E", 70:"F", 71:"G", 72:"H", 73:"I", 74:"J", 75:"K", 76:"L", 77:"M", 78:"N", 79:"O", 80:"P", 81:"Q", 82:"R", 83:"S", 84:"T", + 85:"U", 86:"V", 87:"W", 88:"X", 89:"Y", 90:"Z", 91:"Windows", 93:"Right Click", 96:"Numpad 0", 97:"Numpad 1", 98:"Numpad 2", 99:"Numpad 3", 100:"Numpad 4", 101:"Numpad 5", 102:"Numpad 6", 103:"Numpad 7", 104:"Numpad 8", 105:"Numpad 9", 106:"Numpad *", 107:"Numpad +", 109:"Numpad -", 110:"Numpad .", 111:"Numpad /", 112:"F1", 113:"F2", 114:"F3", 115:"F4", 116:"F5", 117:"F6", 118:"F7", 119:"F8", 120:"F9", 121:"F10", 122:"F11", 123:"F12", 144:"Num Lock", 145:"Scroll Lock", 182:"My Computer", 183:"My Calculator", + 186:";", 187:"=", 188:",", 189:"-", 190:".", 191:"/", 192:"`", 219:"[", 220:"\\", 221:"]", 222:"'"}; + b.keyCharToCode = {Backspace:8, Tab:9, Enter:13, Shift:16, Ctrl:17, Alt:18, "Pause/Break":19, "Caps Lock":20, Esc:27, Space:32, "Page Up":33, "Page Down":34, End:35, Home:36, Left:37, Up:38, Right:39, Down:40, Insert:45, Delete:46, 0:48, 1:49, 2:50, 3:51, 4:52, 5:53, 6:54, 7:55, 8:56, 9:57, A:65, B:66, C:67, D:68, E:69, F:70, G:71, H:72, I:73, J:74, K:75, L:76, M:77, N:78, O:79, P:80, Q:81, R:82, S:83, T:84, U:85, V:86, W:87, X:88, Y:89, Z:90, Windows:91, "Right Click":93, "Numpad 0":96, "Numpad 1":97, + "Numpad 2":98, "Numpad 3":99, "Numpad 4":100, "Numpad 5":101, "Numpad 6":102, "Numpad 7":103, "Numpad 8":104, "Numpad 9":105, "Numpad *":106, "Numpad +":107, "Numpad -":109, "Numpad .":110, "Numpad /":111, F1:112, F2:113, F3:114, F4:115, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, F12:123, "Num Lock":144, "Scroll Lock":145, "My Computer":182, "My Calculator":183, ";":186, "=":187, ",":188, "-":189, ".":190, "/":191, "`":192, "[":219, "\\":220, "]":221, "'":222}; +})(Entry.KeyboardCode.prototype); +Entry.Console = function() { + Entry.propertyPanel && (this.createView(), Entry.propertyPanel.addMode("console", this), Entry.console = this, this._isEditing = !1, this._inputData = null); +}; +(function(b) { + b.createView = function() { + this.view = new Entry.Dom("div", {id:"entryConsole"}); + this.codeMirror = CodeMirror(this.view[0], {lineNumbers:!1, lineWrapping:!0, value:"", mode:{}, theme:"default", styleActiveLine:!1, lint:!1}); + this._doc = this.codeMirror.getDoc(); + this.codeMirror.on("beforeChange", function(a, b) { + this._isEditing ? "+delete" === b.origin && 0 === b.to.ch && b.cancel() : b.cancel(); + }.bind(this)); + this.codeMirror.on("keyup", function(a, b) { + this._isEditing && 13 === b.keyCode && this.endInput(); + }.bind(this)); + this.codeMirror.on("cursorActivity", function(a, b) { + a.execCommand("goDocEnd"); + }); + Entry.addEventListener("stop", this.clear.bind(this)); + this.clear(); }; - a.onblur = function() { - Entry.dispatchEvent("textEdited"); + b.getView = function() { + return this.view; }; - this.textEditInput = a; - b.appendChild(a); - a = Entry.createElement("textarea"); - a.addClass("entryPlayground_textArea"); - a.style.display = "none"; - a.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); + b.clear = function() { + this.setEditing(!0); + this.codeMirror.setValue("Entry Console \n"); + this.codeMirror.execCommand("goDocEnd"); + this.setEditing(!1); }; - a.onblur = function() { - Entry.dispatchEvent("textEdited"); + b.print = function(a, b) { + this.setEditing(!0); + this.codeMirror.execCommand("goDocEnd"); + var c = this._doc.getCursor(); + this._doc.replaceRange(a + "\n", {line:c.line, ch:0}); + this._doc.addLineClass(c.line, "text", b); + "speak" === b && this.setEditing(!1); + this.codeMirror.execCommand("goDocEnd"); + "ask" === b && (this._doc.addLineClass(c.line + 1, "text", "answer"), this.codeMirror.focus()); }; - this.textEditArea = a; - b.appendChild(a); - a = Entry.createElement("div"); - a.addClass("entryPlaygroundFontSizeWrapper"); - b.appendChild(a); - this.fontSizeWrapper = a; - var n = Entry.createElement("div"); - n.addClass("entryPlaygroundFontSizeSlider"); - a.appendChild(n); - var q = Entry.createElement("div"); - q.addClass("entryPlaygroundFontSizeIndicator"); - n.appendChild(q); - this.fontSizeIndiciator = q; - var r = Entry.createElement("div"); - r.addClass("entryPlaygroundFontSizeKnob"); - n.appendChild(r); - this.fontSizeKnob = r; - e = Entry.createElement("div"); - e.addClass("entryPlaygroundFontSizeLabel"); - e.innerHTML = "\uae00\uc790 \ud06c\uae30"; - a.appendChild(e); - var t = !1, u = 0; - r.onmousedown = function(b) { - t = !0; - u = $(n).offset().left; + b.endInput = function() { + var a = this._doc.getCursor(), b = this.codeMirror.lineInfo(a.line); + "answer" === b.textClass ? (this._inputData = b.text, this._doc.replaceRange("\n", {line:a.line, ch:b.text.length})) : this._inputData = this._doc.getLine(a.line - 1); + Entry.container.setInputValue(this._inputData); + this.setEditing(!1); }; - r.addEventListener("touchstart", function(b) { - t = !0; - u = $(n).offset().left; - }); - document.addEventListener("mousemove", function(b) { - t && (b = b.pageX - u, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); - }); - document.addEventListener("touchmove", function(b) { - t && (b = b.touches[0].pageX - u, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); - }); - document.addEventListener("mouseup", function(b) { - t = !1; - }); - document.addEventListener("touchend", function(b) { - t = !1; - }); - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakWrapper"); - b.appendChild(a); - b = Entry.createElement("hr"); - b.addClass("entryPlaygroundLinebreakHorizontal"); - a.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundLinebreakButtons"); - a.appendChild(b); - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!1); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; - b.appendChild(e); - this.linebreakOffImage = e; - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!0); - v.innerHTML = Lang.Menus.linebreak_on_desc_1; - x.innerHTML = Lang.Menus.linebreak_on_desc_2; - y.innerHTML = Lang.Menus.linebreak_on_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; - b.appendChild(e); - this.linebreakOnImage = e; - b = Entry.createElement("div"); - b.addClass("entryPlaygroundLinebreakDescription"); - a.appendChild(b); - var v = Entry.createElement("p"); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - b.appendChild(v); - a = Entry.createElement("ul"); - b.appendChild(a); - var x = Entry.createElement("li"); - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - a.appendChild(x); - var y = Entry.createElement("li"); - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - a.appendChild(y); -}; -Entry.Playground.prototype.generateSoundView = function(a) { - if ("workspace" == Entry.type) { - var b = Entry.createElement("div", "entryAddSound"); - b.addClass("entryPlaygroundAddSound"); - b.bindOnClick(function(b) { - Entry.dispatchEvent("openSoundManager"); - }); - var c = Entry.createElement("div", "entryAddSoundInner"); - c.addClass("entryPlaygroundAddSoundInner"); - c.innerHTML = Lang.Workspace.sound_add; - b.appendChild(c); - a.appendChild(b); - b = Entry.createElement("ul", "entrySoundList"); - b.addClass("entryPlaygroundSoundList"); - $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.moveSound(b, a); - }, axis:"y"}); - a.appendChild(b); - this.soundListView_ = b; - } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(b) { - Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.moveSound(b, a); - }, axis:"y"}), a.appendChild(b), this.soundListView_ = b); - } + b.stopInput = function(a) { + this.setEditing(!1); + }; + b.setEditing = function(a) { + this._isEditing !== a && (this._isEditing = a); + }; +})(Entry.Console.prototype); +Entry.TextCodingUtil = function() { }; -Entry.Playground.prototype.injectObject = function(a) { - if (!a) { - this.changeViewMode("code"), this.object = null; - } else { - if (a !== this.object) { - this.object && this.object.toggleInformation(!1); - this.object = a; - this.setMenu(a.objectType); - this.injectCode(); - "sprite" == a.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == a.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); - var b = this.viewMode_; - "default" == b ? this.changeViewMode("code") : "picture" != b && "text" != b || "textBox" != a.objectType ? "text" != b && "picture" != b || "sprite" != a.objectType ? "sound" == b && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); - this.reloadPlayground(); +(function(b) { + b._funcParamQ; + b.initQueue = function() { + this._funcParamQ = new Entry.Queue; + this._funcNameQ = new Entry.Queue; + }; + b.clearQueue = function() { + this._funcParamQ.clear(); + this._funcNameQ.clear(); + }; + b.indent = function(a) { + var b = "\t"; + a = a.split("\n"); + a.pop(); + b += a.join("\n\t"); + return b = "\t" + b.trim(); + }; + b.isNumeric = function(a) { + return a.match(/^-?\d+$|^-\d+$/) || a.match(/^-?\d+\.\d+$/) ? !0 : !1; + }; + b.isBinaryOperator = function(a) { + return "==" == a || ">" == a || "<" == a || ">=" == a || "<=" == a || "+" == a || "-" == a || "*" == a || "/" == a ? !0 : !1; + }; + b.binaryOperatorConvert = function(a) { + switch(a) { + case "==": + a = "EQUAL"; + break; + case ">": + a = "GREATER"; + break; + case "<": + a = "LESS"; + break; + case ">=": + a = "GREATER_OR_EQUAL"; + break; + case "<=": + a = "LESS_OR_EQUAL"; + break; + case "+": + a = "PLUS"; + break; + case "-": + a = "MINUS"; + break; + case "*": + a = "MULTIFLY"; + break; + case "/": + a = "DIVIDE"; + break; + } + return a; + }; + b.logicalExpressionConvert = function(a) { + switch(a) { + case "&&": + a = null; + break; + case "||": + a = null; + break; + } + return a; + }; + b.dropdownDynamicValueConvertor = function(a, b) { + var c = b.options, e = null, f; + for (f in c) { + e = c[f]; + if ("null" == e[1]) { + return e = {}; + } + if ("mouse" == a || "wall" == a || "wall_up" == a || "wall_down" == a || "wall_right" == a || "wall_left" == a) { + return a; + } + if (a == e[1]) { + return console.log("dropdownDynamicValueConvertor value", a, e[1]), e = e[0]; + } + } + e = a; + if ("variables" == b.menuName) { + var g = Entry.variableContainer.variables_, h; + for (h in g) { + var k = g[h]; + if (k.id_ == a) { + e = k.name_; + break; + } + } + } else { + if ("lists" == b.menuName) { + for (h in g = Entry.variableContainer.lists, g) { + if (k = g[h], k.id_ == a) { + e = k.name_; + break; + } + } + } else { + if ("pictures" == b.menuName) { + for (g in h = Entry.container.getAllObjects(), h) { + for (k in c = h[g], c = c.pictures, c) { + if (f = c[k], f.id == a) { + return e = f.name; + } + } + } + } else { + if ("sounds" == b.menuName) { + for (g in h = Entry.container.getAllObjects(), h) { + for (k in c = h[g], c = c.sounds, c) { + if (f = c[k], f.id == a) { + return e = f.name; + } + } + } + } + } + } + } + return e; + }; + b.binaryOperatorValueConvertor = function(a) { + switch(a) { + case "EQUAL": + a = "=="; + break; + case "GREATER": + a = ">"; + break; + case "LESS": + a = "<"; + break; + case "GREATER_OR_EQUAL": + a = ">="; + break; + case "LESS_OR_EQUAL": + a = "<="; + break; + case "\uadf8\ub9ac\uace0": + a = "&&"; + break; + case "\ub610\ub294": + a = "||"; + break; + case "PLUS": + a = "+"; + break; + case "MINUS": + a = "-"; + break; + case "MULTI": + a = "*"; + break; + case "DIVIDE": + a = "/"; + break; + } + return a; + }; + b.variableFilter = function(a, b, c) { + var e = c; + a = a.data.type; + "change_variable" == a || "set_variable" == a || "get_variable" == a ? 1 == b && (e = eval(c)) : "length_of_list" == a || "is_included_in_list" == a ? 2 == b && (e = eval(c)) : "value_of_index_from_list" == a ? 2 == b ? e = eval(c) : 4 == b && this.isNumeric(c) && (e = c - 1) : "remove_value_from_list" == a ? 2 == b ? e = eval(c) : 1 == b && this.isNumeric(c) && (e = c - 1) : "insert_value_to_list" == a ? 2 == b ? e = eval(c) : 3 == b && this.isNumeric(c) && (e = c - 1) : "change_value_list_index" == + a ? 1 == b ? e = eval(c) : 2 == b && this.isNumeric(c) && (e = c - 1) : "add_value_to_list" == a && 2 == b && (e = eval(c)); + return e; + }; + b.isGlobalVariableExisted = function(a) { + var b = Entry.variableContainer.variables_, c; + for (c in b) { + var e = b[c]; + if (null === e.object_ && e.name_ == a) { + return !0; + } + } + return !1; + }; + b.updateGlobalVariable = function(a, b) { + var c = Entry.variableContainer.variables_, e; + for (e in c) { + var f = c[e]; + if (null === f.object_ && f.name_ == a) { + variable = {x:f.x_, y:f.y_, id:f.id_, visible:f.visible_, value:b, name:a, isCloud:f.isClud_}; + f.syncModel_(variable); + Entry.variableContainer.updateList(); + break; + } + } + }; + b.createGlobalVariable = function(a, b) { + this.isGlobalVariableExisted(a) || (Entry.variableContainer.addVariable({name:a, value:b, variableType:"variable"}), Entry.variableContainer.updateList()); + }; + b.isLocalVariableExisted = function(a, b) { + var c = Entry.variableContainer.variables_, e; + for (e in c) { + var f = c[e]; + if (f.object_ === b.id && f.name_ == a) { + return !0; + } + } + return !1; + }; + b.updateLocalVariable = function(a, b, c) { + var e = Entry.variableContainer.variables_, f; + for (f in e) { + var g = e[f]; + if (g.object_ === c.id && g.name_ == a) { + g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, value:b, name:a, isCloud:g.isClud_}); + Entry.variableContainer.updateList(); + break; + } } - } -}; -Entry.Playground.prototype.injectCode = function() { - var a = this.mainWorkspace; - a.changeBoardCode(this.object.script); - a.getBoard().adjustThreadsPosition(); -}; -Entry.Playground.prototype.injectPicture = function() { - var a = this.pictureListView_; - if (a) { - for (;a.hasChildNodes();) { - a.removeChild(a.lastChild); + }; + b.createLocalVariable = function(a, b, c) { + this.isLocalVariableExisted(a, c) || (Entry.variableContainer.addVariable({name:a, value:b, object:c.id, variableType:"variable"}), Entry.variableContainer.updateList()); + }; + b.isLocalVariable = function(a) { + var b = Entry.playground.object, c = Entry.variableContainer.variables_, e; + for (e in c) { + var f = c[e]; + if (f.object_ == b.id && f.id_ == a) { + return !0; + } } - if (this.object) { - for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { - var e = b[c].view; - e || console.log(e); - e.orderHolder.innerHTML = c + 1; - a.appendChild(e); + return !1; + }; + b.isGlobalListExisted = function(a) { + var b = Entry.variableContainer.lists_, c; + for (c in b) { + var e = b[c]; + if (null === e.object_ && e.name_ == a) { + return !0; } - this.selectPicture(this.object.selectedPicture); - } else { - Entry.dispatchEvent("pictureClear"); } - } -}; -Entry.Playground.prototype.addPicture = function(a, b) { - a = Entry.cloneSimpleObject(a); - delete a.id; - delete a.view; - a = JSON.parse(JSON.stringify(a)); - a.id = Entry.generateHash(); - a.name = Entry.getOrderedName(a.name, this.object.pictures); - this.generatePictureElement(a); - this.object.addPicture(a); - this.injectPicture(); - this.selectPicture(a); -}; -Entry.Playground.prototype.setPicture = function(a) { - var b = Entry.container.getPictureElement(a.id, a.objectId), c = $(b); - if (b) { - a.view = b; - b.picture = a; - b = c.find("#t_" + a.id)[0]; - if (a.fileurl) { - b.style.backgroundImage = 'url("' + a.fileurl + '")'; - } else { - var d = a.filename; - b.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; + return !1; + }; + b.updateGlobalList = function(a, b) { + var c = Entry.variableContainer.lists_, e; + for (e in c) { + var f = c[e]; + if (null === f.object_ && f.name_ == a) { + list = {x:f.x_, y:f.y_, id:f.id_, visible:f.visible_, name:a, isCloud:f.isClud_, width:f.width_, height:f.height_, array:b}; + f.syncModel_(list); + f.updateView(); + Entry.variableContainer.updateList(); + break; + } } - c.find("#s_" + a.id)[0].innerHTML = a.dimension.width + " X " + a.dimension.height; - } - Entry.container.setPicture(a); -}; -Entry.Playground.prototype.downloadPicture = function(a) { - a = Entry.playground.object.getPicture(a); - a.fileurl ? window.open(a.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(a.filename) + "/" + encodeURIComponent(a.name) + ".png"); -}; -Entry.Playground.prototype.clonePicture = function(a) { - a = Entry.playground.object.getPicture(a); - this.addPicture(a, !0); -}; -Entry.Playground.prototype.selectPicture = function(a) { - for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { - var e = b[c]; - e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); - } - var f; - a && a.id && (f = Entry.container.selectPicture(a.id, a.objectId)); - this.object.id === f && Entry.dispatchEvent("pictureSelected", a); -}; -Entry.Playground.prototype.movePicture = function(a, b) { - this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]); - this.injectPicture(); - Entry.stage.sortZorder(); -}; -Entry.Playground.prototype.injectText = function() { - if (Entry.playground.object) { - Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); - Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); - Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); - if (Entry.playground.object.entity.font) { - var a = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; - $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + a + ".png"); - a = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; - $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + a + ".png"); - } - a = Entry.playground.object.entity.getUnderLine() || !1; - $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + a + ".png"); - a = Entry.playground.object.entity.getStrike() || !1; - $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + a + ".png"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); - $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); - Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); - Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); - Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); - a = Entry.playground.object.entity.getFontSize(); - Entry.playground.fontSizeIndiciator.style.width = a + "%"; - Entry.playground.fontSizeKnob.style.left = .88 * a + "px"; - } -}; -Entry.Playground.prototype.injectSound = function() { - var a = this.soundListView_; - if (a) { - for (;a.hasChildNodes();) { - a.removeChild(a.lastChild); + }; + b.createGlobalList = function(a, b) { + this.isGlobalListExisted(a) || (Entry.variableContainer.addList({name:a, array:b, variableType:"list"}), Entry.variableContainer.updateList()); + }; + b.isLocalListExisted = function(a, b) { + var c = Entry.variableContainer.lists_, e; + for (e in c) { + var f = c[e]; + if (f.object_ === b.id && f.name_ == a) { + return !0; + } } - if (this.object) { - for (var b = this.object.sounds, c = 0, d = b.length;c < d;c++) { - var e = b[c].view; - e.orderHolder.innerHTML = c + 1; - a.appendChild(e); + return !1; + }; + b.updateLocalList = function(a, b, c) { + var e = Entry.variableContainer.lists_, f; + for (f in e) { + var g = e[f]; + if (g.object_ === c.id && g.name_ == a) { + g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, name:a, isCloud:g.isClud_, width:g.width_, height:g.height_, array:b}); + g.updateView(); + Entry.variableContainer.updateList(); + break; } } - } -}; -Entry.Playground.prototype.moveSound = function(a, b) { - this.object.sounds.splice(b, 0, this.object.sounds.splice(a, 1)[0]); - this.updateListViewOrder("sound"); - Entry.stage.sortZorder(); -}; -Entry.Playground.prototype.addSound = function(a, b) { - a = Entry.cloneSimpleObject(a); - delete a.view; - delete a.id; - a = JSON.parse(JSON.stringify(a)); - a.id = Entry.generateHash(); - a.name = Entry.getOrderedName(a.name, this.object.sounds); - this.generateSoundElement(a); - this.object.addSound(a); - this.injectSound(); -}; -Entry.Playground.prototype.changeViewMode = function(a) { - for (var b in this.tabViewElements) { - this.tabViewElements[b].removeClass("entryTabSelected"); - } - "default" != a && this.tabViewElements[a].addClass("entryTabSelected"); - if ("variable" != a) { - var c = this.view_.children; - for (b = 0;b < c.length;b++) { - var d = c[b]; - -1 < d.id.toUpperCase().indexOf(a.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); + }; + b.createLocalList = function(a, b, c) { + this.isLocalListExisted(a, c) || (Entry.variableContainer.addList({name:a, array:b, object:c.id, variableType:"list"}), Entry.variableContainer.updateList()); + }; + b.isLocalList = function(a) { + var b = Entry.playground.object, c = Entry.variableContainer.lists_, e; + for (e in c) { + var f = c[e]; + if (f.object_ == b.id && f.id_ == a) { + return !0; + } } - Entry.pictureEditable && ("picture" == a ? (this.painter.show(), this.pictureView_.object && this.pictureView_.object == this.object || (this.pictureView_.object = this.object, this.injectPicture())) : this.painter.hide()); - if ("sound" == a && (!this.soundView_.object || this.soundView_.object != this.object)) { - this.soundView_.object = this.object, this.injectSound(); + return !1; + }; + b.isLocalType = function(a, b) { + if ("get_variable" == a.data.type || "set_variable" == a.data.type || "change_variable" == a.data.type) { + if (this.isLocalVariable(b)) { + return !0; + } } else { - if ("text" == a && "textBox" == this.object.objectType || this.textView_.object != this.object) { - this.textView_.object = this.object, this.injectText(); + if (("value_of_index_from_list" == a.data.type || "add_value_to_list" == a.data.type || "remove_value_from_list" == a.data.type || "insert_value_to_list" == a.data.type || "change_value_list_index" == a.data.type || "length_of_list" == a.data.type || "is_included_in_list" == a.data.type) && this.isLocalList(b)) { + return !0; } } - "code" == a && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); - Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); - this.viewMode_ = a; - this.toggleOffVariableView(); - } -}; -Entry.Playground.prototype.createVariableView = function() { - var a = Entry.createElement("div"); - Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && a.addClass("entryVariablePanelPhone") : a.addClass("entryVariablePanelWorkspace"); - this.variableViewWrapper_ = a; - Entry.variableContainer.createDom(a); - return a; -}; -Entry.Playground.prototype.toggleOnVariableView = function() { - Entry.playground.changeViewMode("code"); - this.hideBlockMenu(); - Entry.variableContainer.updateList(); - this.variableView_.removeClass("entryRemove"); - this.resizeHandle_.removeClass("entryRemove"); -}; -Entry.Playground.prototype.toggleOffVariableView = function() { - this.showBlockMenu(); - this.variableView_.addClass("entryRemove"); -}; -Entry.Playground.prototype.editBlock = function() { - var a = Entry.playground; - Entry.stateManager && Entry.stateManager.addCommand("edit block", a, a.restoreBlock, a.object, a.object.getScriptText()); -}; -Entry.Playground.prototype.mouseupBlock = function() { - if (Entry.reporter) { - var a = Entry.playground, b = a.object; - Entry.reporter.report(new Entry.State("edit block mouseup", a, a.restoreBlock, b, b.getScriptText())); - } -}; -Entry.Playground.prototype.restoreBlock = function(a, b) { - Entry.container.selectObject(a.id); - Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); - Blockly.Xml.textToDom(b); -}; -Entry.Playground.prototype.setMenu = function(a) { - if (this.currentObjectType != a) { - var b = this.blockMenu; - b.unbanClass(this.currentObjectType); - b.banClass(a); - b.setMenu(); - b.selectMenu(0, !0); - this.currentObjectType = a; - } -}; -Entry.Playground.prototype.hideTabs = function() { - var a = ["picture", "text", "sound", "variable"], b; - for (b in a) { - this.hideTab([a[b]]); - } -}; -Entry.Playground.prototype.hideTab = function(a) { - this.tabViewElements[a] && (this.tabViewElements[a].addClass("hideTab"), this.tabViewElements[a].removeClass("showTab")); -}; -Entry.Playground.prototype.showTabs = function() { - var a = ["picture", "text", "sound", "variable"], b; - for (b in a) { - this.showTab(a[b]); - } -}; -Entry.Playground.prototype.showTab = function(a) { - this.tabViewElements[a] && (this.tabViewElements[a].addClass("showTab"), this.tabViewElements[a].removeClass("hideTab")); -}; -Entry.Playground.prototype.initializeResizeHandle = function(a) { - $(a).bind("mousedown touchstart", function(b) { - Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(b) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:b.clientX - Entry.interfaceState.canvasWidth}); - })); - }); - $(document).bind("mouseup touchend", function(b) { - if (b = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(b), delete Entry.playground.resizeEvent; + }; + b.isEventBlock = function(a) { + a = a.data.type; + return "when_run_button_click" == a || "when_some_key_pressed" == a || "mouse_clicked" == a || "mouse_click_cancled" == a || "when_object_click" == a || "when_object_click_canceled" == a || "when_message_cast" == a || "when_scene_start" == a || "when_clone_start" == a ? !0 : !1; + }; + b.makeDefinition = function(a) { + var b = /(%.)/mi; + a = Entry.block[a.data.type].syntax.py[0].split(b); + for (var c = "", e = 0;e < a.length;e++) { + var f = a[e], c = b.test(f) ? c + "event" : c + f } - }); -}; -Entry.Playground.prototype.reloadPlayground = function() { - var a = this.mainWorkspace; - a && (a.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); -}; -Entry.Playground.prototype.flushPlayground = function() { - this.object = null; - if (Entry.playground && Entry.playground.view_) { - this.injectPicture(); - this.injectSound(); - var a = Entry.playground.mainWorkspace.getBoard(); - a.clear(); - a.changeCode(null); - } -}; -Entry.Playground.prototype.refreshPlayground = function() { - Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); -}; -Entry.Playground.prototype.updateListViewOrder = function(a) { - a = "picture" == a ? this.pictureListView_.childNodes : this.soundListView_.childNodes; - for (var b = 0, c = a.length;b < c;b++) { - a[b].orderHolder.innerHTML = b + 1; - } -}; -Entry.Playground.prototype.generatePictureElement = function(a) { - function b() { - if ("" === this.value.trim()) { - Entry.deAttachEventListener(this, "blur", b), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", b); - } else { - for (var a = $(".entryPlaygroundPictureName"), c = 0;c < a.length;c++) { - if (a.eq(c).val() == f.value && a[c] != this) { - Entry.deAttachEventListener(this, "blur", b); - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - Entry.attachEventListener(this, "blur", b); - return; + return c; + }; + b.isNoPrintBlock = function(a) { + return !1; + }; + b.entryEventFuncFilter = function(a) { + var b = !1; + a = a.split("\n"); + for (var c in a) { + var e = a[c]; + "def entry_event_start():" == e || "def entry_event_mouse_down():" == e || "def entry_event_mouse_up():" == e || "def entry_event_object_down():" == e || "def entry_event_scene_start():" == e || "def entry_event_clone_create():" == e ? (tokens = e.split("def"), e = tokens[1].substring(0, tokens[1].length - 1).trim() + "\n", a[c] = e, b = !0) : (new RegExp(/^def entry_event_key(.+):$/)).test(e) || (new RegExp(/^def entry_event_signal(.+):$/)).test(e) ? (tokens = e.split("def"), e = tokens[1].substring(0, + tokens[1].length - 1).trim() + "\n", a[c] = e, b = !0) : b && (e = a[c], e = e.replace("\t", ""), a[c] = e); + } + return a.join("\n"); + }; + b.eventBlockSyntaxFilter = function(a) { + if ("entry_event_start" == a || "entry_event_key" == a || "entry_event_mouse_down" == a || "entry_event_mouse_up" == a || "entry_event_object_down" == a || "entry_event_signal" == a || "entry_event_scene_start" == a || "entry_event_clone_create" == a) { + a = "def " + a; + } + return a; + }; + b.isEntryEventFunc = function(a) { + return "def entry_event_start" == a || "def entry_event_key" == a || "def entry_event_mouse_down" == a || "def entry_event_mouse_up" == a || "def entry_event_object_down" == a || "def entry_event_signal" == a || "def entry_event_scene_start" == a || "def entry_event_clone_create" == a ? !0 : !1; + }; + b.searchFuncDefParam = function(a) { + "function_field_label" == a.data.type && this._funcNameQ.enqueue(a.data.params[0]); + return a && a.data && a.data.params && a.data.params[1] ? ("function_field_string" != a.data.type && "function_field_boolean" != a.data.type || this._funcParamQ.enqueue(a.data.params[0].data.type), this.searchFuncDefParam(a.data.params[1])) : a; + }; + b.gatherFuncDefParam = function(a) { + if (a && a.data) { + if (a.data.params[0]) { + if (a.data.params[0].data) { + var b = a.data.params[0].data.type; + "function_field_string" != a.data.type && "function_field_boolean" != a.data.type || this._funcParamQ.enqueue(b); + } else { + "function_field_label" == a.data.type && this._funcNameQ.enqueue(a.data.params[0]); } } - this.picture.name = this.value; - Entry.playground.reloadPlayground(); - Entry.dispatchEvent("pictureNameChanged", this.picture); + if (a.data.params[1]) { + var c = this.searchFuncDefParam(a.data.params[1]); + c.data.params[0].data && (b = c.data.params[0].data.type, "function_field_string" != c.data.type && "function_field_boolean" != c.data.type || this._funcParamQ.enqueue(b)); + c.data.params[1] && c.data.params[1].data.params[0].data && (b = c.data.params[1].data.params[0].data.type, "function_field_string" != c.data.params[1].data.type && "function_field_boolean" != c.data.params[1].data.type || this._funcParamQ.enqueue(b)); + } } - } - var c = Entry.createElement("li", a.id); - a.view = c; - c.addClass("entryPlaygroundPictureElement"); - c.picture = a; - c.bindOnClick(function(b) { - Entry.playground.selectPicture(this.picture); - }); - Entry.Utils.disableContextmenu(a.view); - $(a.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - f.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.clonePicture(a.id); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removePicture(a.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, a.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); - }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { - Entry.playground.downloadPicture(a.id); - }}], "workspace-contextmenu"); - }); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundPictureOrder"); - c.orderHolder = d; - c.appendChild(d); - d = Entry.createElement("div", "t_" + a.id); - d.addClass("entryPlaygroundPictureThumbnail"); - if (a.fileurl) { - d.style.backgroundImage = 'url("' + a.fileurl + '")'; - } else { - var e = a.filename; - d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; - } - c.appendChild(d); - var f = Entry.createElement("input"); - f.addClass("entryPlaygroundPictureName"); - f.addClass("entryEllipsis"); - f.picture = a; - f.value = a.name; - Entry.attachEventListener(f, "blur", b); - f.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + return c; }; - c.appendChild(f); - d = Entry.createElement("div", "s_" + a.id); - d.addClass("entryPlaygroundPictureSize"); - d.innerHTML = a.dimension.width + " X " + a.dimension.height; - c.appendChild(d); -}; -Entry.Playground.prototype.generateSoundElement = function(a) { - var b = Entry.createElement("sound", a.id); - a.view = b; - b.addClass("entryPlaygroundSoundElement"); - b.sound = a; - Entry.Utils.disableContextmenu(a.view); - $(a.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - g.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.addSound(a, !0); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removeSound(a.id) ? (Entry.removeElement(b), Entry.toast.success(Lang.Workspace.sound_remove_ok, a.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); - Entry.removeElement(b); - }}], "workspace-contextmenu"); - }); - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundOrder"); - b.orderHolder = c; - b.appendChild(c); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundSoundThumbnail"); - d.addClass("entryPlaygroundSoundPlay"); - var e = !1, f; - d.addEventListener("click", function() { - e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { - d.removeClass("entryPlaygroundSoundStop"); - d.addClass("entryPlaygroundSoundPlay"); - e = !1; - }), f.addEventListener("loop", function(b) { - }), f.addEventListener("failed", function(b) { - })); - }); - b.appendChild(d); - var g = Entry.createElement("input"); - g.addClass("entryPlaygroundSoundName"); - g.sound = a; - g.value = a.name; - var h = document.getElementsByClassName("entryPlaygroundSoundName"); - g.onblur = function() { - if ("" === this.value) { - alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); - } else { - for (var b = 0, a = 0;a < h.length;a++) { - if (h[a].value == g.value && (b += 1, 1 < b)) { - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - return; + b.getLastParam = function(a) { + a && a.data && a.data.params[1] && (a = this.getLastParam(a.data.params[1])); + return a; + }; + b.isFuncContentsMatch = function(a, b, c) { + for (var e = !0, f = 0;f < a.length && e;f++) { + var e = !1, g = a[f], h = b[f]; + if (g && !h) { + e = fasle; + break; + } + if (!g && h) { + e = !1; + break; + } + if (h.type == g.data.type) { + var e = !0, k = h.params, l = g.data.params, m = []; + l.map(function(a, b) { + a && m.push(a); + }); + l = m; + if (k.length == l.length) { + for (var e = !0, n = 0;n < k.length && e;n++) { + if (e = !1, k[n].name) { + for (var q in textFuncParams) { + if (k[n].name == textFuncParams[q]) { + for (var r in c) { + if (l[n].data.type == r && c[r] == q) { + e = !0; + break; + } + } + if (e) { + break; + } + } + } + } else { + "True" == k[n].type || "False" == k[n].type ? k[n].type == l[n].data.type && (e = !0) : k[n].type && k[n].params && k[n].params[0] == l[n].data.params[0] && (e = !0); + } + } + e && h.statements && 0 != h.statements.length && (e = this.isFuncContentsMatch(g.data.statements[0]._data, h.statements[0])); + } else { + e = !1; + break; } + } else { + e = !1; + break; } - this.sound.name = this.value; - Entry.playground.reloadPlayground(); } + return e; }; - g.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + b.isParamBlock = function(a) { + a = a.type; + return "ai_boolean_distance" == a || "ai_distance_value" == a || "ai_boolean_object" == a || "ai_boolean_and" == a ? !0 : !1; }; - b.appendChild(g); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundLength"); - c.innerHTML = a.duration + " \ucd08"; - b.appendChild(c); -}; -Entry.Playground.prototype.toggleColourChooser = function(a) { - "foreground" === a ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === a && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); -}; -Entry.Playground.prototype.setTextColour = function(a) { - Entry.playground.object.entity.setColour(a); - Entry.playground.toggleColourChooser("foreground"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", a); -}; -Entry.Playground.prototype.setBackgroundColour = function(a) { - Entry.playground.object.entity.setBGColour(a); - Entry.playground.toggleColourChooser("background"); - $(".entryPlayground_bgColorDiv").css("backgroundColor", a); -}; -Entry.Playground.prototype.isTextBGMode = function() { - return this.isTextBGMode_; -}; -Entry.Playground.prototype.checkVariables = function() { - Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); -}; -Entry.Playground.prototype.getViewMode = function() { - return this.viewMode_; -}; -Entry.Playground.prototype.updateHW = function() { - var a = Entry.playground.mainWorkspace.blockMenu; - if (a) { - var b = Entry.hw; - b && b.connected ? (a.unbanClass("arduinoConnected", !0), a.banClass("arduinoDisconnected", !0), b.banHW(), b.hwModule && a.unbanClass(b.hwModule.name)) : (a.banClass("arduinoConnected", !0), a.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); - a.reDraw(); - } -}; -Entry.Playground.prototype.toggleLineBreak = function(a) { - this.object && "textBox" == this.object.objectType && (a ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", - "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); -}; -Entry.Playground.prototype.setFontAlign = function(a) { - if ("textBox" == this.object.objectType) { - this.alignLeftBtn.removeClass("toggle"); - this.alignCenterBtn.removeClass("toggle"); - this.alignRightBtn.removeClass("toggle"); + b.hasBlockInfo = function(a, b) { + var c = !1, e; + for (e in b) { + var f = b[e]; + if (e == a.type) { + for (var g in f) { + var h = f[g]; + if (h.start == a.start && h.end == a.end) { + c = !0; + break; + } + } + } + } + return c; + }; + b.updateBlockInfo = function(a, b) { + var c = b[a.type]; + if (c && Array.isArray(c) && 0 != c.legnth) { + for (var e in c) { + var f = c[e]; + if (f.start == a.start && f.end == a.end) { + break; + } else { + f = {}, f.start = a.start, f.end = a.end, c.push(f); + } + } + } else { + b[a.type] = [], f = {}, f.start = a.start, f.end = a.end, b[a.type].push(f); + } + }; + b.jsAdjustSyntax = function(a, b) { + var c = ""; + if ("ai_boolean_distance" == a.data.type) { + var e = b.split(" "), c = e[0].split("_"); + c[1] = c[1].substring(1, c[1].length - 1); + c[1] = c[1].toLowerCase(); + var c = c.join("_"), f = e[1], f = this.bTojBinaryOperatorConvertor(f), e = e[2], c = c + " " + f + " " + e; + } else { + "ai_boolean_object" == a.data.type ? (e = b.split(" "), c = e[0].split("_"), c[1] = c[1].substring(1, c[1].length - 1), c[1] = c[1].toLowerCase(), c = c.join("_"), f = e[1], e = e[2], c = c + " " + f + " " + e) : "ai_distance_value" == a.data.type ? (e = b.split(" "), c = e[0].split("_"), c[1] = c[1].substring(1, c[1].length - 1), c[1] = c[1].toLowerCase(), c = c.join("_")) : c = b; + } + return c; + }; + b.bTojBinaryOperatorConvertor = function(a) { + var b; switch(a) { - case Entry.TEXT_ALIGN_LEFT: - this.alignLeftBtn.addClass("toggle"); + case "'BIGGER'": + b = ">"; break; - case Entry.TEXT_ALIGN_CENTER: - this.alignCenterBtn.addClass("toggle"); + case "'BIGGER_EQUAL'": + b = ">="; break; - case Entry.TEXT_ALIGN_RIGHT: - this.alignRightBtn.addClass("toggle"); - } - this.object.entity.setTextAlign(a); - } -}; -Entry.Playground.prototype.hideBlockMenu = function() { - this.mainWorkspace.getBlockMenu().hide(); -}; -Entry.Playground.prototype.showBlockMenu = function() { - this.mainWorkspace.getBlockMenu().show(); -}; -Entry.Popup = function() { - Entry.assert(!window.popup, "Popup exist"); - this.body_ = Entry.createElement("div"); - this.body_.addClass("entryPopup"); - this.body_.bindOnClick(function(a) { - a.target == this && this.popup.remove(); - }); - this.body_.popup = this; - document.body.appendChild(this.body_); - this.window_ = Entry.createElement("div"); - this.window_.addClass("entryPopupWindow"); - "tablet" === Entry.device && this.window_.addClass("tablet"); - this.window_.bindOnClick(function() { - }); - Entry.addEventListener("windowResized", this.resize); - window.popup = this; - this.resize(); - this.body_.appendChild(this.window_); -}; -Entry.Popup.prototype.remove = function() { - for (;this.window_.hasChildNodes();) { - "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); - } - $("body").css("overflow", "auto"); - Entry.removeElement(this.body_); - window.popup = null; - Entry.removeEventListener("windowResized", this.resize); - Entry.engine.popup = null; - Entry.windowResized.notify(); -}; -Entry.Popup.prototype.resize = function(a) { - a = window.popup.window_; - var b = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; - 9 * b <= 16 * c ? c = b / 16 * 9 + 35 : (b = 16 * c / 9, c += 35); - a.style.width = String(b) + "px"; - a.style.height = String(c) + "px"; - Entry.stage && Entry.stage.updateBoundRect(); -}; -Entry.popupHelper = function(a) { - this.popupList = {}; - this.nowContent; - a && (window.popupHelper = null); - Entry.assert(!window.popupHelper, "Popup exist"); - var b = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; - this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var d = this; - this.body_.bindOnClick(function(a) { - if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { - var e = $(a.target); - c.forEach(function(b) { - e.hasClass(b) && this.popup.hide(); - }.bind(this)); - a.target == this && this.popup.hide(); - } - }); - this.body_.bind("touchstart", function(a) { - if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { - var e = $(a.target); - c.forEach(function(b) { - e.hasClass(b) && this.popup.hide(); - }.bind(this)); - a.target == this && this.popup.hide(); + case "'EQUAL'": + b = "=="; + break; + case "'SMALLER'": + b = "<"; + break; + case "'SMALLER_EQUAL'": + b = "<="; } - }); - window.popupHelper = this; - this.body_.prop("popup", this); - Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); - a = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:a}); - this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:a}); - Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:a}); - $("body").append(this.body_); -}; -Entry.popupHelper.prototype.clearPopup = function() { - for (var a = this.popupWrapper_.children.length - 1;2 < a;a--) { - this.popupWrapper_.removeChild(this.popupWrapper_.children[a]); - } -}; -Entry.popupHelper.prototype.addPopup = function(a, b) { - var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); - d.bindOnClick(function() { - b.closeEvent ? b.closeEvent(this) : this.hide(); - }.bind(this)); - var e = this; - d.bind("touchstart", function() { - b.closeEvent ? b.closeEvent(e) : e.hide(); - }); - var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - f.append(d); - b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(b.title)); - c.addClass(a); - c.append(f); - c.popupWrapper_ = f; - c.prop("type", b.type); - "function" === typeof b.setPopupLayout && b.setPopupLayout(c); - this.popupList[a] = c; -}; -Entry.popupHelper.prototype.hasPopup = function(a) { - return !!this.popupList[a]; -}; -Entry.popupHelper.prototype.setPopup = function(a) { -}; -Entry.popupHelper.prototype.remove = function(a) { - 0 < this.window_.children().length && this.window_.children().remove(); - this.window_.remove(); - delete this.popupList[a]; - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.resize = function(a) { -}; -Entry.popupHelper.prototype.show = function(a) { - 0 < this.window_.children().length && this.window_.children().detach(); - this.window_.append(this.popupList[a]); - this.nowContent = this.popupList[a]; - this.body_.removeClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.hide = function() { - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.getStartProject = function(a) { - return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], - selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:a + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:a + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:a + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, - entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; -}; -Entry.Reporter = function(a) { - this.projectId = this.userId = null; - this.isRealTime = a; - this.activities = []; -}; -Entry.Reporter.prototype.start = function(a, b, c) { - this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:b, projectId:a, time:c})); - this.userId = b; - this.projectId = a; -}; -Entry.Reporter.prototype.report = function(a) { - if (!this.isRealTime || this.io) { - var b = [], c; - for (c in a.params) { - var d = a.params[c]; - "object" !== typeof d ? b.push(d) : d.id && b.push(d.id); + return b; + }; + b.jTobBinaryOperatorConvertor = function(a) { + var b; + switch(a) { + case ">": + b = "BIGGER"; + break; + case ">=": + b = "BIGGER_EQUAL"; + break; + case "==": + b = "EQUAL"; + break; + case "<": + b = "SMALLER"; + break; + case "<=": + b = "SMALLER_EQUAL"; } - a = {message:a.message, userId:this.userId, projectId:this.projectId, time:a.time, params:b}; - this.isRealTime ? this.io.emit("activity", a) : this.activities.push(a); - } -}; -Entry.Scene = function() { - var a = this; - this.scenes_ = []; - this.selectedScene = null; - this.maxCount = 20; - $(window).on("resize", function(b) { - a.resize(); - }); -}; -Entry.Scene.viewBasicWidth = 70; -Entry.Scene.prototype.generateView = function(a, b) { - var c = this; - this.view_ = a; - this.view_.addClass("entryScene"); - b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(b) { - var a = $(this).offset(), d = $(window), g = b.pageX - a.left + d.scrollLeft(); - b = b.pageY - a.top + d.scrollTop(); - b = 40 - b; - a = -40 / 55; - d = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(g < d || g > d + 55) && b > 40 + a * (g - d) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); - }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - $(a.item[0]).clone(!0); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.scene.moveScene(b, a); - }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(b) { - Entry.engine.isState("run") || Entry.scene.addScene(); - }), this.view_.appendChild(a), this.addButton_ = a)); -}; -Entry.Scene.prototype.generateElement = function(a) { - var b = this, c = Entry.createElement("li", a.id); - c.addClass("entrySceneElementWorkspace"); - c.addClass("entrySceneButtonWorkspace"); - c.addClass("minValue"); - $(c).on("mousedown", function(b) { - Entry.engine.isState("run") ? b.preventDefault() : Entry.scene.selectScene(a); - }); - var d = Entry.createElement("input"); - d.addClass("entrySceneFieldWorkspace"); - d.value = a.name; - Entry.sceneEditable || (d.disabled = "disabled"); - var e = Entry.createElement("span"); - e.addClass("entrySceneLeftWorkspace"); - c.appendChild(e); - var f = Entry.createElement("span"); - f.addClass("entrySceneInputCover"); - f.style.width = Entry.computeInputWidth(a.name); - c.appendChild(f); - a.inputWrapper = f; - d.onkeyup = function(c) { - c = c.keyCode; - Entry.isArrowOrBackspace(c) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); + return b; }; - d.onblur = function(b) { - d.value = this.value; - a.name = this.value; - f.style.width = Entry.computeInputWidth(a.name); + b.radarVariableConvertor = function(a) { + return a.split("_")[1].toUpperCase(); }; - f.appendChild(d); - e = Entry.createElement("span"); - e.addClass("entrySceneRemoveButtonCoverWorkspace"); - c.appendChild(e); - if (Entry.sceneEditable) { - var g = Entry.createElement("button"); - g.addClass("entrySceneRemoveButtonWorkspace"); - g.scene = a; - g.bindOnClick(function(b) { - b.stopPropagation(); - Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); - }); - e.appendChild(g); - } - Entry.Utils.disableContextmenu(c); - $(c).on("contextmenu", function() { - var b = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { - Entry.scene.cloneScene(a); - }}]; - Entry.ContextMenu.show(b, "workspace-contextmenu"); - }); - return a.view = c; -}; -Entry.Scene.prototype.updateView = function() { - if (!Entry.type || "workspace" == Entry.type) { - for (var a = this.listView_, b = $(a).children().length;b < this.getScenes().length;b++) { - a.appendChild(this.getScenes()[b].view); - } - this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); - } - this.resize(); -}; -Entry.Scene.prototype.addScenes = function(a) { - if ((this.scenes_ = a) && 0 !== a.length) { - for (var b = 0, c = a.length;b < c;b++) { - this.generateElement(a[b]); - } - } else { - this.scenes_ = [], this.scenes_.push(this.createScene()); - } - this.selectScene(this.getScenes()[0]); - this.updateView(); -}; -Entry.Scene.prototype.addScene = function(a, b) { - void 0 === a && (a = this.createScene()); - a.view || this.generateElement(a); - b || "number" == typeof b ? this.getScenes().splice(b, 0, a) : this.getScenes().push(a); - Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(a)); - Entry.playground.flushPlayground(); - this.selectScene(a); - this.updateView(); - return a; -}; -Entry.Scene.prototype.removeScene = function(a) { - if (1 >= this.getScenes().length) { - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); - } else { - var b = this.getScenes().indexOf(this.getSceneById(a.id)); - this.getScenes().splice(b, 1); - for (var b = Entry.container.getSceneObjects(a), c = 0;c < b.length;c++) { - Entry.container.removeObject(b[c]); - } - Entry.stage.removeObjectContainer(a); - $(a.view).remove(); - this.selectScene(); - } -}; -Entry.Scene.prototype.selectScene = function(a) { - a = a || this.getScenes()[0]; - if (!this.selectedScene || this.selectedScene.id != a.id) { - Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); - var b = this.selectedScene; - b && (b = b.view, b.removeClass("selectedScene"), b = $(b), b.find("input").blur()); - this.selectedScene = a; - a.view.addClass("selectedScene"); - Entry.container.setCurrentObjects(); - Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(a); - (a = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(a.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); - Entry.container.listView_ || Entry.stage.sortZorder(); - Entry.container.updateListView(); - this.updateView(); - Entry.requestUpdate = !0; - } -}; -Entry.Scene.prototype.toJSON = function() { - for (var a = [], b = this.getScenes().length, c = 0;c < b;c++) { - var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; - delete d.view; - delete d.inputWrapper; - a.push(JSON.parse(JSON.stringify(d))); - d.view = e; - d.inputWrapper = f; - } - return a; -}; -Entry.Scene.prototype.moveScene = function(a, b) { - this.getScenes().splice(b, 0, this.getScenes().splice(a, 1)[0]); - Entry.container.updateObjectsOrder(); - Entry.stage.sortZorder(); - $(".entrySceneElementWorkspace").removeAttr("style"); + b.tTobDropdownValueConvertor = function(a) { + return "stone" == a ? "OBSTACLE" : "wall" == a ? a.toUpperCase() : "item" == a ? a.toUpperCase() : a; + }; +})(Entry.TextCodingUtil.prototype); +Entry.BlockToJsParser = function(b) { + this.syntax = b; + this._iterVariableCount = 0; + this._iterVariableChunk = ["i", "j", "k"]; }; -Entry.Scene.prototype.getSceneById = function(a) { - for (var b = this.getScenes(), c = 0;c < b.length;c++) { - if (b[c].id == a) { - return b[c]; +(function(b) { + b.Code = function(a, b) { + this._parseMode = b; + if (a instanceof Entry.Block) { + return this.Block(a); } - } - return !1; -}; -Entry.Scene.prototype.getScenes = function() { - return this.scenes_; -}; -Entry.Scene.prototype.takeStartSceneSnapshot = function() { - this.sceneBeforeRun = this.selectedScene; -}; -Entry.Scene.prototype.loadStartSceneSnapshot = function() { - this.selectScene(this.sceneBeforeRun); - this.sceneBeforeRun = null; -}; -Entry.Scene.prototype.createScene = function() { - var a = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; - this.generateElement(a); - return a; -}; -Entry.Scene.prototype.cloneScene = function(a) { - if (this.scenes_.length >= this.maxCount) { - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_add_error, !1); - } else { - var b = {name:a.name + Lang.Workspace.replica_of_object, id:Entry.generateHash()}; - this.generateElement(b); - this.addScene(b); - a = Entry.container.getSceneObjects(a); - for (var c = a.length - 1;0 <= c;c--) { - Entry.container.addCloneObject(a[c], b.id); + for (var c = "", e = a._data, f = 0;f < e.length;f++) { + c += this.Thread(e[f]); } - } -}; -Entry.Scene.prototype.resize = function() { - var a = this.getScenes(), b = this.selectedScene, c = a[0]; - if (0 !== a.length && c) { - var d = $(c.view).offset().left, c = parseFloat($(b.view).css("margin-left")), e = $(this.view_).width() - d, f = 0, g; - for (g in a) { - var d = a[g], h = d.view; - h.addClass("minValue"); - $(d.inputWrapper).width(Entry.computeInputWidth(d.name)); - h = $(h); - f = f + h.width() + c; + return c.trim(); + }; + b.Thread = function(a) { + if (a instanceof Entry.Block) { + return this.Block(a); } - if (f > e) { - for (g in e -= $(b.view).width(), c = e / (a.length - 1) - (Entry.Scene.viewBasicWidth + c), a) { - d = a[g], b.id != d.id ? (d.view.removeClass("minValue"), $(d.inputWrapper).width(c)) : d.view.addClass("minValue"); - } + var b = ""; + a = a.getBlocks(); + for (var c = 0;c < a.length;c++) { + var e = a[c]; + c != a.length - 1 ? (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? b += e + "\n" : this._parseMode == Entry.Parser.PARSE_SYNTAX && (b = e + "\n")) : (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? b += e : this._parseMode == Entry.Parser.PARSE_SYNTAX && (b = e)); } - } -}; -Entry.Scene.prototype.getNextScene = function() { - var a = this.getScenes(); - return a[a.indexOf(this.selectedScene) + 1]; -}; -Entry.Script = function(a) { - this.entity = a; -}; -p = Entry.Script.prototype; -p.init = function(a, b, c) { - Entry.assert("BLOCK" == a.tagName.toUpperCase(), a.tagName); - this.type = a.getAttribute("type"); - this.id = Number(a.getAttribute("id")); - a.getElementsByTagName("mutation").length && a.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = a.childNodes[0].getAttribute("hashid")); - "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); - b instanceof Entry.Script && (this.previousScript = b, b.parentScript && (this.parentScript = b.parentScript)); - c instanceof Entry.Script && (this.parentScript = c); - a = a.childNodes; - for (b = 0;b < a.length;b++) { - if (c = a[b], "NEXT" == c.tagName.toUpperCase()) { - this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(a[b].childNodes[0], this); + return b + "\n"; + }; + b.Block = function(a) { + var b = a._schema.syntax.js ? a._schema.syntax.js : a._schema.syntax; + return b ? a = this[b[0]](a) : ""; + }; + b.Program = function(a) { + return ""; + }; + b.Scope = function(a) { + var b = !1, c = "", e = /(%.)/mi; + if (a._schema.syntax.js) { + var f = a._schema.syntax.js.concat(), b = !0 } else { - if ("VALUE" == c.tagName.toUpperCase()) { - this.values || (this.values = {}); - var d = new Entry.Script(this.entity); - this.register && (d.register = this.register); - d.init(c.childNodes[0]); - this.values[c.getAttribute("name")] = d; - } else { - "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); - } + f = a._schema.syntax.concat(); } - } + f.shift(); + for (var f = f[0].split(e), g = a._schema.params, h = a.data.params, k = 0;k < f.length;k++) { + var l = f[k]; + 0 !== l.length && "Scope" !== l && ("Judge" === l ? b = !0 : e.test(l) ? (l = l.split("%")[1], l = parseInt(l) - 1, g[l] && "Image" != g[l].type && ("Block" == g[l].type ? (l = this.Block(h[l]), c += l) : c += this[g[l].type](h[l], g[l]))) : c += l); + } + "#" == c.charAt(c.length - 1) && (b = !0, c = c.substring(0, c.length - 1), c = c.trim()); + b || (c += "();"); + return c = Entry.TextCodingUtil.prototype.jsAdjustSyntax(a, c); + }; + b.BasicFunction = function(a) { + a = this.Thread(a.statements[0]); + return "function promise() {\n" + this.indent(a).trim() + "}"; + }; + b.BasicIteration = function(a) { + var b = a.params[0], c = this.publishIterateVariable(); + a = this.Thread(a.statements[0]); + this.unpublishIterateVariable(); + return "for (var " + c + " = 0; " + c + " < " + b + "; " + c + "++) {\n" + this.indent(a) + "}"; + }; + b.BasicIf = function(a) { + if (2 == a.data.statements.length) { + var b = this.Thread(a.statements[0]), c = this.Thread(a.statements[1]), e = a._schema.syntax.concat(), e = (a = a.data.params[0]) && "True" == a.data.type ? e[1] : void 0 === a ? e[1] : this.Block(a), b = "if (" + e + ") {\n" + this.indent(b) + "}\nelse {\n" + this.indent(c) + "}\n" + } else { + b = this.Thread(a.statements[0]), e = a._schema.syntax.concat(), e = (a = a.data.params[0]) && "True" == a.data.type ? e[1] : void 0 === a ? e[1] : this.Block(a), b = "if (" + e + ") {\n" + this.indent(b) + "}\n"; + } + return b; + }; + b.BasicWhile = function(a) { + var b = this.Thread(a.statements[0]); + return "while (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; + }; + b.indent = function(a) { + var b = ""; + a = a.split("\n"); + for (var c in a) { + var e = a[c]; + 0 != e.length && (b += "\t" + e + "\n"); + } + return b; + }; + b.publishIterateVariable = function() { + var a = "", b = this._iterVariableCount; + do { + a = this._iterVariableChunk[b % 3] + a, b = parseInt(b / 3) - 1, 0 === b && (a = this._iterVariableChunk[0] + a); + } while (0 < b); + this._iterVariableCount++; + return a; + }; + b.unpublishIterateVariable = function() { + this._iterVariableCount && this._iterVariableCount--; + }; + b.Dropdown = function(a) { + "OBSTACLE" == a ? a = "stone" : "ITEM" == a ? a = a.toLowerCase() : "WALL" == a && (a = a.toLowerCase()); + return "'" + a + "'"; + }; + b.TextInput = function(a) { + return a; + }; + b.DropdownDynamic = function(a, b) { + return a = "null" == a ? "none" : Entry.TextCodingUtil.prototype.dropdownDynamicValueConvertor(a, b); + }; +})(Entry.BlockToJsParser.prototype); +Entry.BlockToPyParser = function(b) { + this.blockSyntax = b; + this._variableMap = new Entry.Map; + this._funcMap = new Entry.Map; + this._queue = new Entry.Queue; }; -p.clone = function(a, b) { - var c = new Entry.Script(a); - c.id = this.id; - c.type = this.type; - c.isRepeat = this.isRepeat; - if (this.parentScript && !this.previousScript && 2 != b) { - c.parentScript = this.parentScript.clone(a); - for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c.parentScript; +(function(b) { + b.Code = function(a, b) { + this._parseMode = b; + if (a instanceof Entry.Thread) { + return this.Thread(a); } - } - this.nextScript && 1 != b && (c.nextScript = this.nextScript.clone(a, 0), c.nextScript.previousScript = this); - this.previousScript && 0 !== b && (c.previousScript = this.previousScript.clone(a, 1), c.previousScript.previousScript = this); - if (this.fields) { - c.fields = {}; - for (var e in this.fields) { - c.fields[e] = this.fields[e]; + if (a instanceof Entry.Block) { + return this.Block(a); } - } - if (this.values) { - for (e in c.values = {}, this.values) { - c.values[e] = this.values[e].clone(a); + for (var c = "", e = a.getThreads(), f = 0;f < e.length;f++) { + c += this.Thread(e[f]) + "\n"; } - } - if (this.statements) { - for (e in c.statements = {}, this.statements) { - for (c.statements[e] = this.statements[e].clone(a, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c; + return c = c.trim(); + }; + b.Thread = function(a) { + if (a instanceof Entry.Block) { + return this.Block(a); + } + var b = ""; + a = a.getBlocks(); + for (var c = !1, e = "", f = "", g = 0;g < a.length;g++) { + var h = a[g]; + if (this._parseMode == Entry.Parser.PARSE_GENERAL) { + if (Entry.TextCodingUtil.prototype.isNoPrintBlock(h)) { + continue; + } + 0 == g ? (c = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? e = this.Block(h) + "\n" : f += this.Block(h) + "\n" : 0 != g && (f += this.Block(h) + "\n"); + } else { + this._parseMode == Entry.Parser.PARSE_SYNTAX && (b = (c = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? "" : this.Block(h) + "\n"); } + this._queue.clear(); + this._variableMap.clear(); } - } - return c; -}; -p.getStatement = function(a) { - return this.statements[a]; -}; -p.compute = function() { -}; -p.getValue = function(a) { - return this.values[a].run(); -}; -p.getNumberValue = function(a) { - return Number(this.values[a].run()); -}; -p.getStringValue = function(a) { - return String(this.values[a].run()); -}; -p.getBooleanValue = function(a) { - return this.values[a].run() ? !0 : !1; -}; -p.getField = function(a) { - return this.fields[a]; -}; -p.getStringField = function(a) { - return String(this.fields[a]); -}; -p.getNumberField = function(a) { - return Number(this.fields[a]); -}; -p.callReturn = function() { - return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; -}; -p.run = function() { - return Entry.block[this.type](this.entity, this); -}; -Entry.Stage = function() { - this.variables = {}; - this.background = new createjs.Shape; - this.background.graphics.beginFill("#ffffff").drawRect(-480, -240, 960, 480); - this.objectContainers = []; - this.selectedObjectContainer = null; - this.variableContainer = new createjs.Container; - this.dialogContainer = new createjs.Container; - this.selectedObject = null; - this.isObjectClick = !1; -}; -Entry.Stage.prototype.initStage = function(a) { - this.canvas = new createjs.Stage(a.id); - this.canvas.x = 320; - this.canvas.y = 180; - this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; - createjs.Touch.enable(this.canvas); - this.canvas.enableMouseOver(10); - this.canvas.mouseMoveOutside = !0; - this.canvas.addChild(this.background); - this.canvas.addChild(this.variableContainer); - this.canvas.addChild(this.dialogContainer); - this.inputField = null; - this.initCoordinator(); - this.initHandle(); - this.mouseCoordinate = {x:0, y:0}; - if (Entry.isPhone()) { - a.ontouchstart = function(b) { - Entry.dispatchEvent("canvasClick", b); - Entry.stage.isClick = !0; - }, a.ontouchend = function(b) { - Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", b); - }; - } else { - var b = function(b) { - Entry.dispatchEvent("canvasClick", b); - Entry.stage.isClick = !0; - }; - a.onmousedown = b; - a.ontouchstart = b; - b = function(b) { - Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", b); - }; - a.onmouseup = b; - a.ontouchend = b; - $(document).click(function(b) { - Entry.stage.focused = "entryCanvas" === b.target.id ? !0 : !1; - }); - } - Entry.addEventListener("canvasClick", function(b) { - Entry.stage.isObjectClick = !1; - }); - Entry.windowResized.attach(this, function() { - Entry.stage.updateBoundRect(); - }); - $(window).scroll(function() { - Entry.stage.updateBoundRect(); - }); - b = function(b) { - b.preventDefault(); - var a = Entry.stage.getBoundRect(), c; - -1 < Entry.getBrowserType().indexOf("IE") ? (c = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (c = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (c = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), - b = -270 * ((b.pageY - a.top - document.body.scrollTop) / a.height - .5)); - Entry.stage.mouseCoordinate = {x:c.toFixed(1), y:b.toFixed(1)}; - Entry.dispatchEvent("stageMouseMove"); - }; - a.onmousemove = b; - a.ontouchmove = b; - a.onmouseout = function(b) { - Entry.dispatchEvent("stageMouseOut"); + this._parseMode == Entry.Parser.PARSE_GENERAL && (b = c ? e + Entry.TextCodingUtil.prototype.indent(f) + "\n" : e + f + "\n"); + return b = b.trim() + "\n"; }; - Entry.addEventListener("updateObject", function(b) { - Entry.engine.isState("stop") && Entry.stage.updateObject(); - }); - Entry.addEventListener("canvasInputComplete", function(b) { - try { - var a = Entry.stage.inputField.value(); - Entry.stage.hideInputField(); - if (a) { - var c = Entry.container; - c.setInputValue(a); - c.inputValue.complete = !0; - } - } catch (f) { + b.Block = function(a) { + var b = "", c; + a._schema && a._schema.syntax && (c = a._schema.syntax.py[0]); + this.isFunc(a) ? (b += this.makeFuncDef(a), this.isRegisteredFunc(a) && (c = this.makeFuncSyntax(a))) : this.isFuncStmtParam(a) && (b += a.data.type); + if (!c || null == c) { + return b; } - }); - this.initWall(); - this.render(); -}; -Entry.Stage.prototype.render = function() { - Entry.stage.timer && clearTimeout(Entry.stage.timer); - var a = (new Date).getTime(); - Entry.stage.update(); - a = (new Date).getTime() - a; - Entry.stage.timer = setTimeout(Entry.stage.render, 16 - a % 16 + 16 * Math.floor(a / 16)); -}; -Entry.Stage.prototype.update = function() { - Entry.requestUpdate ? (Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(), this.inputField && !this.inputField._isHidden && this.inputField.render(), Entry.requestUpdateTwice ? Entry.requestUpdateTwice = !1 : Entry.requestUpdate = !1) : Entry.requestUpdate = !1; -}; -Entry.Stage.prototype.loadObject = function(a) { - var b = a.entity.object; - this.getObjectContainerByScene(a.scene).addChild(b); - this.canvas.update(); -}; -Entry.Stage.prototype.loadEntity = function(a) { - Entry.stage.getObjectContainerByScene(a.parent.scene).addChild(a.object); - this.sortZorder(); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.unloadEntity = function(a) { - Entry.stage.getObjectContainerByScene(a.parent.scene).removeChild(a.object); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.loadVariable = function(a) { - var b = a.view_; - this.variables[a.id] = b; - this.variableContainer.addChild(b); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.removeVariable = function(a) { - this.variableContainer.removeChild(a.view_); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.loadDialog = function(a) { - this.dialogContainer.addChild(a.object); -}; -Entry.Stage.prototype.unloadDialog = function(a) { - this.dialogContainer.removeChild(a.object); -}; -Entry.Stage.prototype.sortZorder = function() { - for (var a = Entry.container.getCurrentObjects(), b = this.selectedObjectContainer, c = 0, d = a.length - 1;0 <= d;d--) { - for (var e = a[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { - e[g].shape && b.setChildIndex(e[g].shape, c++), b.setChildIndex(e[g].object, c++); + var e = /(%.)/mi, f = /(\$.)/mi; + c = c.split(e); + var g = a._schema.params, h = a.data.params, k = a._schema.skeleton, l = a._schema.paramsKeyMap, m = ""; + if (this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l) { + var n = 0 } - f.shape && b.setChildIndex(f.shape, c++); - b.setChildIndex(f.object, c++); - } -}; -Entry.Stage.prototype.initCoordinator = function() { - var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); - b.scaleX = .5; - b.scaleY = .5; - b.x = -240; - b.y = -135; - a.addChild(b); - this.canvas.addChild(a); - a.visible = !1; - this.coordinator = a; -}; -Entry.Stage.prototype.toggleCoordinator = function() { - this.coordinator.visible = !this.coordinator.visible; - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.selectObject = function(a) { - this.selectedObject = a ? a : null; - this.updateObject(); -}; -Entry.Stage.prototype.initHandle = function() { - this.handle = new EaselHandle(this.canvas); - this.handle.setChangeListener(this, this.updateHandle); - this.handle.setEditStartListener(this, this.startEdit); - this.handle.setEditEndListener(this, this.endEdit); -}; -Entry.Stage.prototype.updateObject = function() { - Entry.requestUpdate = !0; - this.handle.setDraggable(!0); - if (!this.editEntity) { - var a = this.selectedObject; - if (a) { - "textBox" == a.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); - "free" == a.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); - this.handle.toggleDirection(!0); - a.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); - this.handle.setVisible(!0); - var b = a.entity; - this.handle.setWidth(b.getScaleX() * b.getWidth()); - this.handle.setHeight(b.getScaleY() * b.getHeight()); - var c, d; - if ("textBox" == b.type) { - if (b.getLineBreak()) { - c = b.regX * b.scaleX, d = -b.regY * b.scaleY; + for (var q = 0;q < c.length;q++) { + if (n = c[q], 0 !== n.length) { + if (e.test(n)) { + var n = n.split("%")[1], r = +n - 1; + if (g[r] && "Indicator" != g[r].type) { + if ("Block" == g[r].type) { + if (m = this.Block(h[r]).trim(), r = this._funcMap.get(m)) { + b += r; + } else { + var r = m.split("_"), t = r[0]; + 2 == r.length && ("stringParam" == t ? m = "string_param" : "booleanParam" == t && (m = "boolean_param")); + m = Entry.TextCodingUtil.prototype.variableFilter(a, n, m); + b += m; + this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (r = Object.keys(l), n = String(r[n++]), n = n.toLowerCase(), this._variableMap.put(n, m), this._queue.enqueue(n)); + } + } else { + m = this["Field" + g[r].type](h[r], g[r]), null == m && (m = g[r].text ? g[r].text : null), m = Entry.TextCodingUtil.prototype.binaryOperatorValueConvertor(m), m = String(m), Entry.TextCodingUtil.prototype.isNumeric(m) || Entry.TextCodingUtil.prototype.isBinaryOperator(m) || (m = String('"' + m + '"')), m = Entry.TextCodingUtil.prototype.variableFilter(a, n, m), Entry.TextCodingUtil.prototype.isLocalType(a, h[r]) && (m = "self".concat(".").concat(m)), b += m, this._parseMode == Entry.Parser.PARSE_VARIABLE && + k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (r = Object.keys(l), n = String(r[n++]), n = n.toLowerCase(), this._variableMap.put(n, m), this._queue.enqueue(n)); + } + } } else { - var e = b.getTextAlign(); - d = -b.regY * b.scaleY; - switch(e) { - case Entry.TEXT_ALIGN_LEFT: - c = -b.getWidth() / 2 * b.scaleX; - break; - case Entry.TEXT_ALIGN_CENTER: - c = b.regX * b.scaleX; - break; - case Entry.TEXT_ALIGN_RIGHT: - c = b.getWidth() / 2 * b.scaleX; + if (f.test(n)) { + for (n = n.split(f), m = 0;m < n.length;m++) { + r = n[m], 0 !== r.length && (f.test(r) ? (r = +r.split("$")[1] - 1, b += Entry.TextCodingUtil.prototype.indent(this.Thread(a.statements[r]))) : b += r); + } + } else { + m = 0, n.search("#"), -1 != n.search("#") && (m = n.indexOf("#"), n = n.substring(m + 1)), b += n; } } + } + } + this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (a = Object.keys(l).length) && (b = this.makeExpressionWithVariable(b, a)); + return b; + }; + b.FieldAngle = function(a) { + return a; + }; + b.FieldColor = function(a) { + return a; + }; + b.FieldDropdown = function(a) { + return a; + }; + b.FieldDropdownDynamic = function(a, b) { + console.log("FieldDropdownDynamic", a, b); + console.log("FieldDropdownDynamic Object", Entry.playground.object); + return a = "null" == a ? "None" : Entry.TextCodingUtil.prototype.dropdownDynamicValueConvertor(a, b); + }; + b.FieldImage = function(a) { + return a; + }; + b.FieldIndicator = function(a) { + return a; + }; + b.FieldKeyboard = function(a) { + return a; + }; + b.FieldOutput = function(a) { + return a; + }; + b.FieldText = function(a) { + return a; + }; + b.FieldTextInput = function(a) { + return a; + }; + b.FieldNumber = function(a) { + return a; + }; + b.FieldKeyboard = function(a) { + (a = Entry.KeyboardCode.prototype.keyCodeToChar[a]) && null != a || (a = "Q"); + return a; + }; + b.getBlockType = function(a) { + return this.blockSyntax[a]; + }; + b.makeExpressionWithVariable = function(a, b) { + var c, e = c = "", f = 0, g = a.indexOf("("); + c = a.substring(0, g).trim().concat("("); + if (this._queue.toString()) { + for (;(variable = this._queue.dequeue()) && !(g = this._variableMap.get(variable), g = variable.concat(" = ").concat(g).concat("\n"), e += g, c = c.concat(variable).concat(",").concat(" "), f++, 10 < f);) { + } + g = c.lastIndexOf(","); + c = c.substring(0, g); + c = c.trim().concat(")"); + c = e.concat(c); + } else { + c = a; + } + return c; + }; + b.isFunc = function(a) { + return "func" == a.data.type.split("_")[0] ? !0 : !1; + }; + b.isRegisteredFunc = function(a) { + a = a.data.type.split("_")[1]; + return Entry.variableContainer.functions_[a] ? !0 : !1; + }; + b.isFuncStmtParam = function(a) { + a = a.data.type.split("_")[0]; + return "stringParam" == a || "booleanParam" == a ? !0 : !1; + }; + b.makeFuncSyntax = function(a) { + var b = "", c = a._schema.template.trim(); + a = a._schema.params; + var b = /(%.)/mi, c = c.trim().split(b), e = "", f = "", g; + for (g in c) { + var h = c[g].trim(); + if (b.test(h)) { + var k = +h.split("%")[1] - 1; + "Indicator" != a[k].type && (f += h.concat(", ")); } else { - c = (b.regX - b.width / 2) * b.scaleX, d = (b.height / 2 - b.regY) * b.scaleY; - } - e = b.getRotation() / 180 * Math.PI; - this.handle.setX(b.getX() - c * Math.cos(e) - d * Math.sin(e)); - this.handle.setY(-b.getY() - c * Math.sin(e) + d * Math.cos(e)); - this.handle.setRegX((b.regX - b.width / 2) * b.scaleX); - this.handle.setRegY((b.regY - b.height / 2) * b.scaleY); - this.handle.setRotation(b.getRotation()); - this.handle.setDirection(b.getDirection()); - this.objectUpdated = !0; - this.handle.setVisible(a.entity.getVisible()); - a.entity.getVisible() && this.handle.render(); + h = h.split(" "), e += h.join("__"); + } + } + k = f.lastIndexOf(","); + f = f.substring(0, k); + return b = e.trim().concat("(").concat(f.trim()).concat(")"); + }; + b.makeFuncDef = function(a) { + var b = "def ", c = this.getFuncInfo(a); + this.isRegisteredFunc(a) || (c.name = "f"); + if (c.name) { + b += c.name; } else { - this.handle.setVisible(!1); + return b; } - } -}; -Entry.Stage.prototype.updateHandle = function() { - this.editEntity = !0; - var a = this.handle, b = this.selectedObject.entity; - if (b.lineBreak) { - b.setHeight(a.height / b.getScaleY()), b.setWidth(a.width / b.getScaleX()); - } else { - if (0 !== b.width) { - var c = Math.abs(a.width / b.width); - b.flip && (c *= -1); - b.setScaleX(c); + b = b.concat("("); + if (c.params && 0 != c.params.length) { + for (var e in c.params) { + b += c.params[e], b = b.concat(", "); + } + a = b.lastIndexOf(","); + b = b.substring(0, a); + b = b.trim(); } - 0 !== b.height && b.setScaleY(a.height / b.height); - } - c = a.rotation / 180 * Math.PI; - if ("textBox" == b.type) { - var d; - if (b.getLineBreak()) { - b.setX(a.x), b.setY(-a.y); + b = b.concat("):").concat("\n"); + if (c.statements && c.statements.length) { + a = ""; + for (var f in c.statements) { + a += this.Block(c.statements[f]).concat("\n"); + } + a = a.concat("\n"); + b += Entry.TextCodingUtil.prototype.indent(a).concat("\n"); + } + this._funcMap.clear(); + return b; + }; + b.getFuncInfo = function(a) { + var b = {}; + if (a = a.data.type.split("_")[1]) { + var c = Entry.variableContainer.functions_[a]; + if (!c) { + return b.name = "\ud568\uc218", b; + } } else { - switch(b.getTextAlign()) { - case Entry.TEXT_ALIGN_LEFT: - b.setX(a.x - a.width / 2 * Math.cos(c)); - b.setY(-a.y + a.width / 2 * Math.sin(c)); - break; - case Entry.TEXT_ALIGN_CENTER: - b.setX(a.x); - b.setY(-a.y); - break; - case Entry.TEXT_ALIGN_RIGHT: - b.setX(a.x + a.width / 2 * Math.cos(c)), b.setY(-a.y - a.width / 2 * Math.sin(c)); + return b; + } + a = c.block.template; + var e = a.search(/(%.)/); + a = a.substring(0, e).trim().split(" ").join("__"); + Entry.TextCodingUtil.prototype.initQueue(); + Entry.TextCodingUtil.prototype.gatherFuncDefParam(c.content._data[0]._data[0].data.params[0]); + for (var f = [], g = {};m = Entry.TextCodingUtil.prototype._funcParamQ.dequeue();) { + f.push(m); + } + for (var h in f) { + g[f[h]] = h; + } + Entry.TextCodingUtil.prototype.clearQueue(); + if (g) { + var f = {}, k; + for (k in g) { + e = g[k]; + h = k.search("_"); + h = k.substring(0, h); + if ("stringParam" == h) { + var l = "value" + String(e + 1) + } else { + "booleanParam" == h && (l = "boolean" + String(e + 1)); + } + var m = l; + f[e] = m; + this._funcMap.put(k, m); } } - } else { - d = b.width / 2 + a.regX / b.scaleX, b.setX(a.x + a.regX * Math.cos(c) - a.regY * Math.sin(c)), b.setRegX(d), d = b.height / 2 + a.regY / b.scaleY, b.setY(-a.y - a.regX * Math.sin(c) - a.regY * Math.cos(c)), b.setRegY(d); - } - b.setDirection(a.direction); - b.setRotation(a.rotation); - this.selectedObject.entity.doCommand(); - this.editEntity = !1; -}; -Entry.Stage.prototype.startEdit = function() { - this.selectedObject.entity.initCommand(); -}; -Entry.Stage.prototype.endEdit = function() { - this.selectedObject.entity.checkCommand(); -}; -Entry.Stage.prototype.initWall = function() { - var a = new createjs.Container, b = new Image; - b.src = Entry.mediaFilePath + "media/bound.png"; - a.up = new createjs.Bitmap; - a.up.scaleX = 16; - a.up.y = -165; - a.up.x = -240; - a.up.image = b; - a.addChild(a.up); - a.down = new createjs.Bitmap; - a.down.scaleX = 16; - a.down.y = 135; - a.down.x = -240; - a.down.image = b; - a.addChild(a.down); - a.right = new createjs.Bitmap; - a.right.scaleY = 9; - a.right.y = -135; - a.right.x = 240; - a.right.image = b; - a.addChild(a.right); - a.left = new createjs.Bitmap; - a.left.scaleY = 9; - a.left.y = -135; - a.left.x = -270; - a.left.image = b; - a.addChild(a.left); - this.canvas.addChild(a); - this.wall = a; -}; -Entry.Stage.prototype.showInputField = function(a) { - a = 1 / 1.5; - this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * a, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * a, height:26 * a, padding:8 * a, borderWidth:1 * a, borderColor:"#000", borderRadius:3 * a, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * a, y:450 * a, topPosition:!0, onsubmit:function() { - Entry.dispatchEvent("canvasInputComplete"); - }})); - a = new createjs.Container; - var b = new Image; - b.src = Entry.mediaFilePath + "confirm_button.png"; - var c = new createjs.Bitmap; - c.scaleX = .23; - c.scaleY = .23; - c.x = 160; - c.y = 89; - c.cursor = "pointer"; - c.image = b; - a.addChild(c); - a.on("mousedown", function(b) { - Entry.dispatchEvent("canvasInputComplete"); - }); - this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(a), this.inputSubmitButton = a); - this.inputField.show(); - Entry.requestUpdateTwice = !0; -}; -Entry.Stage.prototype.hideInputField = function() { - this.inputField && this.inputField.value() && this.inputField.value(""); - this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); - this.inputField && this.inputField.hide(); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.initObjectContainers = function() { - var a = Entry.scene.scenes_; - if (a && 0 !== a.length) { - for (var b = 0;b < a.length;b++) { - this.objectContainers[b] = this.createObjectContainer(a[b]); + k = c.content._data[0]._data; + l = []; + for (c = 1;c < k.length;c++) { + l.push(k[c]); } - this.selectedObjectContainer = this.objectContainers[0]; - } else { - a = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(a), this.selectedObjectContainer = a; - } - this.canvas.addChild(this.selectedObjectContainer); - this.selectObjectContainer(Entry.scene.selectedScene); + a && (b.name = a); + 0 != Object.keys(f).length && (b.params = f); + 0 != l.length && (b.statements = l); + return b; + }; +})(Entry.BlockToPyParser.prototype); +Entry.JsToBlockParser = function(b) { + this.syntax = b; + this.scopeChain = []; + this.scope = null; + this._blockCount = 0; + this._blockInfo = {}; }; -Entry.Stage.prototype.selectObjectContainer = function(a) { - if (this.canvas) { - for (var b = this.objectContainers, c = 0;c < b.length;c++) { - this.canvas.removeChild(b[c]); +(function(b) { + b.Program = function(a) { + var b = [], c = []; + c.push({type:this.syntax.Program}); + for (var e in a) { + var f = a[e]; + if ("Program" != f.type) { + return; + } + this.initScope(f); + var f = this.BlockStatement(f), g; + for (g in f) { + c.push(f[g]); + } + this.unloadScope(); + 0 != c.length && b.push(c); } - this.selectedObjectContainer = this.getObjectContainerByScene(a); - this.canvas.addChildAt(this.selectedObjectContainer, 2); - } -}; -Entry.Stage.prototype.reAttachToCanvas = function() { - for (var a = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], b = 0;b < a.length;b++) { - this.canvas.removeChild(a[b]), this.canvas.addChild(a[b]); - } - console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); -}; -Entry.Stage.prototype.createObjectContainer = function(a) { - var b = new createjs.Container; - b.scene = a; - return b; -}; -Entry.Stage.prototype.removeObjectContainer = function(a) { - var b = this.objectContainers; - a = this.getObjectContainerByScene(a); - this.canvas.removeChild(a); - b.splice(this.objectContainers.indexOf(a), 1); -}; -Entry.Stage.prototype.getObjectContainerByScene = function(a) { - for (var b = this.objectContainers, c = 0;c < b.length;c++) { - if (b[c].scene.id == a.id) { - return b[c]; + return b; + }; + b.Identifier = function(a) { + return a.name; + }; + b.Literal = function(a, b) { + return !0 === a.value ? {type:"True"} : !1 === a.value ? {type:"False"} : "ai_distance_value" == b ? a.value : "ai_boolean_object" == b ? a.value : {type:"text", params:[a.value]}; + }; + b.ExpressionStatement = function(a) { + a = a.expression; + return this[a.type](a); + }; + b.ForStatement = function(a) { + var b = a.init, c = a.test, e = a.update, f = a.body; + if (this.syntax.ForStatement) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } - } -}; -Entry.Stage.prototype.moveSprite = function(a) { - if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { - var b = 5; - a.shiftKey && (b = 1); - var c = this.selectedObject.entity; - switch(a.keyCode) { - case 38: - c.setY(c.getY() + b); + var f = this[f.type](f), b = b.declarations[0].init.value, g = c.operator, c = c.right.value, h = 0; + "++" != e.operator && (e = b, b = c, c = e); + switch(g) { + case "<": + h = c - b; break; - case 40: - c.setY(c.getY() - b); + case "<=": + h = c + 1 - b; break; - case 37: - c.setX(c.getX() - b); + case ">": + h = b - c; break; - case 39: - c.setX(c.getX() + b); + case ">=": + h = b + 1 - c; + } + return this.BasicIteration(a, h, f); + }; + b.BlockStatement = function(a) { + var b = []; + a = a.body; + for (var c = 0;c < a.length;c++) { + var e = a[c], f = this[e.type](e); + Entry.TextCodingUtil.prototype.hasBlockInfo(e, this._blockInfo) || this._blockCount++; + Entry.TextCodingUtil.prototype.updateBlockInfo(e, this._blockInfo); + if (f) { + if (void 0 === f.type) { + throw {title:"\ube14\ub85d\ubcc0\ud658 \uc624\ub958", message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube14\ub85d\uc785\ub2c8\ub2e4.", node:e, blockCount:this._blockCount}; + } + Entry.TextCodingUtil.prototype.isParamBlock(f) || f && b.push(f); + } + } + return b; + }; + b.EmptyStatement = function(a) { + throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.DebuggerStatement = function(a) { + throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.WithStatement = function(a) { + throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ReturnStaement = function(a) { + throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.LabeledStatement = function(a) { + throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.BreakStatement = function(a) { + throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ContinueStatement = function(a) { + throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.IfStatement = function(a) { + if (this.syntax.BasicIf) { + return this.BasicIf(a); + } + throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.SwitchStatement = function(a) { + throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.SwitchCase = function(a) { + throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ThrowStatement = function(a) { + throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.TryStatement = function(a) { + throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.CatchClause = function(a) { + throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.WhileStatement = function(a) { + var b = a.body, c = this.syntax.WhileStatement, b = this[b.type](b); + if (c) { + throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + } + return this.BasicWhile(a, b); + }; + b.DoWhileStatement = function(a) { + throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ForInStatement = function(a) { + throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.FunctionDeclaration = function(a) { + if (this.syntax.FunctionDeclaration) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + } + return null; + }; + b.VariableDeclaration = function(a) { + throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ThisExpression = function(a) { + return this.scope.this; + }; + b.ArrayExpression = function(a) { + throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.ObjectExpression = function(a) { + throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.Property = function(a) { + throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.FunctionExpression = function(a) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + }; + b.UnaryExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; + }; + b.UnaryOperator = function() { + return "- + ! ~ typeof void delete".split(" "); + }; + b.updateOperator = function() { + return ["++", "--"]; + }; + b.BinaryOperator = function() { + return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); + }; + b.AssignmentExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; + }; + b.AssignmentOperator = function() { + return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); + }; + b.BinaryExpression = function(a) { + var b = {}, c = {}, b = String(a.operator), e = a.left.name; + switch(b) { + case "==": + var f = "object_up" == e || "object_right" == e || "object_down" == e ? "ai_boolean_object" : "radar_up" == e || "radar_right" == e || "radar_down" == e ? "ai_boolean_distance" : null; + break; + case "<": + f = "ai_boolean_distance"; + break; + case "<=": + f = "ai_boolean_distance"; + break; + case ">": + f = "ai_boolean_distance"; + break; + case ">=": + f = "ai_boolean_distance"; + } + if (f) { + e = []; + b = a.left; + if ("Literal" == b.type || "Identifier" == b.type) { + arguments = []; + arguments.push(b); + var b = Entry.block[f].params, g; + for (g in b) { + var h = b[g].type; + "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); + } + for (var k in arguments) { + b = arguments[k], h = this[b.type](b), (h = Entry.TextCodingUtil.prototype.radarVariableConvertor(h)) && null != h && e.push(h); + } + } else { + h = this[b.type](b), (h = Entry.TextCodingUtil.prototype.radarVariableConvertor(h)) && e.push(h); + } + if (b = String(a.operator)) { + (h = b = Entry.TextCodingUtil.prototype.jTobBinaryOperatorConvertor(b)) && e.push(h), c.operator = b; + } + b = a.right; + if ("Literal" == b.type || "Identifier" == b.type) { + arguments = []; + arguments.push(b); + b = Entry.block[f].params; + for (g in b) { + h = b[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); + } + for (k in arguments) { + if (b = arguments[k], h = this[b.type](b), "string" == typeof h && (g = h.split("_"), "radar" == g[0] && (b = {type:"ai_distance_value", params:[]}, b.params.push(g[1].toUpperCase()), h = b)), h && null != h && ("ai_boolean_object" == f && (h = h.params[0], e.splice(1, 1)), h = Entry.TextCodingUtil.prototype.tTobDropdownValueConvertor(h), e.push(h), console.log("rigth param", e), e[2] && "text" != e[2].type && "ai_distance_value" != e[2].type)) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; + } + } + } else { + h = this[b.type](b), "ai_boolean_object" == f && (h = h.params[0], e.splice(1, 1)), h && e.push(h); + } + c.type = f; + c.params = e; + } else { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; + } + return c; + }; + b.LogicalExpression = function(a) { + var b = {}, c = String(a.operator); + switch(c) { + case "&&": + var e = "ai_boolean_and"; + break; + default: + e = "ai_boolean_and"; + } + var f = [], c = a.left; + if ("Literal" == c.type || "Identifier" == c.type) { + arguments = []; + arguments.push(c); + var c = Entry.block[e].params, g; + for (g in c) { + var h = c[g].type; + "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); + } + for (var k in arguments) { + c = arguments[k], (c = this[c.type](c)) && null != c && f.push(c); + } + } else { + (c = this[c.type](c)) && f.push(c); + } + if (c = String(a.operator)) { + c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), f.push(c); + } + c = a.right; + if ("Literal" == c.type || "Identifier" == c.type) { + arguments = []; + arguments.push(c); + c = Entry.block[e].params; + for (g in c) { + h = c[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); + } + for (k in arguments) { + c = arguments[k], (c = this[c.type](c)) && null != c && f.push(c); + } + if ("True" != f[0].type && "ai_boolean_distance" != f[0].type && "ai_boolean_object" != f[0].type && "ai_boolean_and" != f[0].type && "ai_distance_value" != f[0].type) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; + } + if ("True" != f[2].type && "ai_boolean_distance" != f[2].type && "ai_boolean_object" != f[2].type && "ai_boolean_and" != f[2].type && "ai_distance_value" != f[2].type) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; + } + } else { + (c = this[c.type](c)) && f.push(c); } - this.updateObject(); - } -}; -Entry.Stage.prototype.getBoundRect = function(a) { - return this._boundRect ? this._boundRect : this.updateBoundRect(); -}; -Entry.Stage.prototype.updateBoundRect = function(a) { - return this._boundRect = this.canvas.canvas.getBoundingClientRect(); -}; -Entry.StampEntity = function(a, b) { - this.parent = a; - this.type = a.objectType; - this.isStamp = this.isClone = !0; - this.width = b.getWidth(); - this.height = b.getHeight(); - "sprite" == this.type && (this.object = b.object.clone(!0), this.object.filters = null, b.effect && (this.effect = Entry.cloneSimpleObject(b.effect), this.applyFilter())); - this.object.entity = this; -}; -(function(a, b) { - a.applyFilter = b.applyFilter; - a.removeClone = b.removeClone; - a.getWidth = b.getWidth; - a.getHeight = b.getHeight; - a.getInitialEffectValue = b.getInitialEffectValue; -})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); -Entry.JsAstGenerator = function() { -}; -(function(a) { - a.generate = function(b) { - return arcon.parse(b); + b.type = e; + b.params = f; + return b; }; -})(Entry.JsAstGenerator.prototype); -Entry.PyAstGenerator = function() { -}; -(function(a) { - a.generate = function(b) { - var a = filbert.parse, d = {locations:!1, ranges:!1}, e; - try { - return e = a(b, d), console.log("astTree", e), e; - } catch (f) { - throw f.message = " \ud30c\uc774\uc36c \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694", f; - } + b.LogicalOperator = function() { + return ["||", "&&"]; }; -})(Entry.PyAstGenerator.prototype); -Entry.Map = function() { - this._map = {repo:{}}; -}; -(function(a) { - a.getKey = function(b) { + b.MemberExpression = function(a) { + var b = a.object, c = a.property, b = this[b.type](b), c = this[c.type](c, b); + if (Object(b) !== b || Object.getPrototypeOf(b) !== Object.prototype) { + throw {message:b + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:a}; + } + b = c; + if (!b) { + throw {message:c + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:a}; + } return b; }; - a.put = function(b, a) { - b = this.getKey(b); - this._map.repo[b] = a; + b.ConditionalExpression = function(a) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.contains = function(b) { - b = this.getKey(b); - return this._map.repo[b] ? !0 : !1; + b.UpdateExpression = function(a) { + throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; }; - a.get = function(b) { - b = this.getKey(b); - return this._map.repo[b] ? this._map.repo[b] : null; + b.CallExpression = function(a) { + var b = a.callee; + a = a.arguments; + for (var c = [], b = this[b.type](b), b = this.syntax.Scope[b], e = Entry.block[b], f = 0;f < a.length;f++) { + var g = a[f], g = this[g.type](g, b); + "Dropdown" != e.params[f].type && "Block" === e.params[f].type && (g = "string" == typeof g ? {type:"text", params:[g]} : "number" == typeof g ? {type:"number", params:[g]} : g); + c.push(g); + } + return {type:b, params:c}; }; - a.remove = function(b) { - var a = this.getKey(b); - this.contains(b) && (this._map.repo[a] = void 0); + b.NewExpression = function(a) { + throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.clear = function() { - this._map.repo = {}; + b.SequenceExpression = function(a) { + throw {message:"SequenceExpression \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; }; - a.toString = function() { - return this._map.repo; + b.initScope = function(a) { + if (null === this.scope) { + var b = function() { + }; + b.prototype = this.syntax.Scope; + } else { + b = function() { + }, b.prototype = this.scope; + } + this.scope = new b; + this.scopeChain.push(this.scope); + return this.scanDefinition(a); }; -})(Entry.Map.prototype); -Entry.Queue = function() { - this.tail = this.head = null; -}; -function Node(a) { - this.data = a; - this.next = null; -} -(function(a) { - a.enqueue = function(b) { - b = new Node(b); - null === this.head ? this.head = b : this.tail.next = b; - this.tail = b; + b.unloadScope = function() { + this.scopeChain.pop(); + this.scope = this.scopeChain.length ? this.scopeChain[this.scopeChain.length - 1] : null; }; - a.dequeue = function() { - var b; - null !== this.head && (b = this.head.data, this.head = this.head.next); + b.scanDefinition = function(a) { + a = a.body; + for (var b = [], c = 0;c < a.length;c++) { + var e = a[c]; + "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, b.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); + } return b; }; - a.clear = function() { - for (;this.dequeue();) { + b.BasicFunction = function(a, b) { + return null; + }; + b.BasicIteration = function(a, b, c) { + if (10 < b) { + throw {message:"\ubc18\ubcf5 \uc22b\uc790\uac12\uc774 10\uc744 \ub118\uc73c\uba74 \uc548\ub429\ub2c8\ub2e4.", node:a.test}; + } + var e = this.syntax.BasicIteration; + if (!e) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; } + return {params:[b], type:e, statements:[c]}; }; - a.toString = function() { - for (var b = this.head, a = [];b;) { - a.push(b.data), b = b.next; + b.BasicWhile = function(a, b) { + var c = a.test.raw; + if (this.syntax.BasicWhile[c]) { + return {type:this.syntax.BasicWhile[c], statements:[b]}; } - return a.toString(); + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; }; -})(Entry.Queue.prototype); -Entry.PyHint = function() { - function a(b, a, c) { - b = fuzzy.filter(a, b, c); - return b = b.map(function(b) { - return b.original; - }); - } - CodeMirror.registerHelper("hint", "python", function(d) { - var e = d.getCursor(), f = d.getTokenAt(e); - /^[\w$_]*$/.test(f.string) || (f = {start:e.ch, end:e.ch, string:"", state:f.state, className:":" == f.string ? "python-type" : null}); - var g = [], h = f.string, k; - if ("variable" == f.type) { - k = f.string, null != k && (g = g.concat(a(b, h)), g = g.concat(a(c._global, h, {extract:function(b) { - return b.displayText; - }}))); - } else { - if ("property" == f.type || "variable-2" == f.type || "." == f.state.lastToken) { - k = f.string; - d = d.getLineTokens(e.line); - for (var t = d.shift();"variable" !== t.type && "variable-2" !== t.type;) { - t = d.shift(); - } - d = t.string; - null != k && c[d] && (g = g.concat(a(c[d], h, {extract:function(b) { - return b.displayText; - }}))); - "." == f.state.lastToken && (g = g.concat(c[d])); - } + b.BasicIf = function(a) { + var b = {params:[], statements:[]}, c, e = [], f = [], g = [], h = a.consequent; + if (h) { + var k = this[h.type](h) } - return {list:g.slice(0, 25), from:CodeMirror.Pos(e.line, f.start), to:CodeMirror.Pos(e.line, f.end)}; - }); - var b = "Entry;self;Hw;while True;True;False;break;for i in range;if;if else;len;random.randint".split(";"), c = {_global:[]}, d = Entry.block, e; - for (e in d) { - var f = d[e].syntax; - if (f && f.py) { - f = f.py.join(""); - f = f.split("."); - if (-1 < f[0].indexOf("def ")) { - f = f[0].split(" "); + if (h = a.alternate) { + var l = this[h.type](h) + } + try { + var m = a.test.operator ? "===" === a.test.operator ? "==" : a.test.operator : null, n = a.test.left && a.test.right ? a.test.left.name + a.test.right.value : null; + if ("frontwall" == n && "==" == m) { + c = this.syntax.BasicIf["front == 'wall'"]; } else { - if (1 === f.length) { - continue; + if ("fronthump" == n && "==" == m) { + c = this.syntax.BasicIf["front == 'hump'"]; + } else { + if ("frontstone" == n && "==" == m) { + c = this.syntax.BasicIf["front == 'stone'"]; + } else { + if ("frontbee" == n && "==" == m) { + c = this.syntax.BasicIf["front == 'bee'"]; + } else { + if (a.test.value || a.test.left && a.test.right) { + c = "ai_if_else"; + var q = this[a.test.type](a.test, this.syntax.Scope); + g.push(q); + } else { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; + } + } + } } } - var g = f.shift(); - c[g] || (c[g] = [], c._global.push({displayText:g, text:g})); - var f = f[0].split(","), h = "(" + Array(f.length).join(" , ") + ")", f = f[0].split("(")[0]; - c[g].push({displayText:f, text:f + h}); - "def" == g ? c._global.push({displayText:g + " " + f, text:g + " " + f + h}) : c._global.push({displayText:g + "." + f, text:g + "." + f + h}); + c ? (k && 0 != k.length && b.statements.push(k), l && 0 != l.length && b.statements.push(l), c && (b.type = c), g && 0 != g.length && (b.params = g)) : (k && 0 != k.length && (e = k), l && 0 != l.length && (f = l), c && (b.type = c), g && 0 != g.length && (b.params = g), b.statements = [e, f]); + return b; + } catch (r) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; } - } -}; -Entry.TextCodingUtil = function() { -}; -(function(a) { - a._funcParamQ; - a.initQueue = function() { - this._funcParamQ = new Entry.Queue; - this._funcNameQ = new Entry.Queue; - }; - a.clearQueue = function() { - this._funcParamQ.clear(); - this._funcNameQ.clear(); - }; - a.indent = function(b) { - var a = "\t"; - b = b.split("\n"); - b.pop(); - a += b.join("\n\t"); - return a = "\t" + a.trim(); - }; - a.isNumeric = function(b) { - return b.match(/^-?\d+$|^-\d+$/) || b.match(/^-?\d+\.\d+$/) ? !0 : !1; }; - a.isBinaryOperator = function(b) { - return "==" == b || ">" == b || "<" == b || ">=" == b || "<=" == b || "+" == b || "-" == b || "*" == b || "/" == b ? !0 : !1; - }; - a.binaryOperatorConvert = function(b) { - switch(b) { - case "==": - b = "EQUAL"; - break; - case ">": - b = "GREATER"; - break; - case "<": - b = "LESS"; - break; - case ">=": - b = "GREATER_OR_EQUAL"; - break; - case "<=": - b = "LESS_OR_EQUAL"; - break; - case "+": - b = "PLUS"; - break; - case "-": - b = "MINUS"; - break; - case "*": - b = "MULTIFLY"; - break; - case "/": - b = "DIVIDE"; +})(Entry.JsToBlockParser.prototype); +Entry.PyToBlockParser = function(b) { + this.blockSyntax = b; + this._blockStatmentIndex = 0; + this._blockStatments = []; + this._variableMap = new Entry.Map; + this._funcMap = new Entry.Map; + this._paramQ = new Entry.Queue; +}; +(function(b) { + b.Program = function(a) { + var b = [], c; + for (c in a) { + if ("Program" != a[c].type) { + return; + } + var e = [], f = a[c].body; + console.log("nodes", f); + for (c in f) { + var g = f[c]; + console.log("Program node", g); + g = this[g.type](g); + console.log("result block", g); + g && g.type && e.push(g); + } + console.log("thread", e); + 0 != e.length && b.push(e); } return b; }; - a.logicalExpressionConvert = function(b) { - switch(b) { - case "&&": - b = null; - break; - case "||": - b = null; + b.ExpressionStatement = function(a) { + console.log("ExpressionStatement component", a); + var b = {}; + a = a.expression; + a.type && (a = this[a.type](a), console.log("ExpressionStatement expressionData", a), a.type && a.params ? (b.type = a.type, b.params = a.params) : a.type ? b.type = a.type : b = a, result = b); + console.log("ExpressionStatement result", result); + return result; + }; + b.CallExpression = function(a) { + console.log("CallExpression component", a); + var b = {}, c = [], e, f = a.callee, g = this[f.type](f); + console.log("CallExpression calleeData", g); + arguments = a.arguments; + if ("Identifier" == f.type) { + console.log("CallExpression Identifier calleeData", g), b.callee = g, t = Entry.TextCodingUtil.prototype.eventBlockSyntaxFilter(g.name), e = this.getBlockType(t); + } else { + var h = g.object; + e = g.property; + if (h.statements && "call" == e.name && 0 == e.userCode) { + e = h.statements, console.log("CallExpression statement", e), b.statements = e; + } else { + var k = h.name ? String(h.name).concat(".").concat(String(e.name)) : h.object.name ? String(h.object.name).concat(".").concat(String(h.property.name)).concat(".").concat(String(e.name)) : null + } + console.log("CallExpression calleeName", k); + e = this.getBlockType(k); + console.log("CallExpression type before", e); + if (k) { + var l = k.split(".") + } + console.log("CallExpression calleeTokens", l); + if ("__pythonRuntime.functions.range" == k) { + var m = "%1number#"; + e = this.getBlockType(m); + } else { + if ("__pythonRuntime.ops.add" == k) { + m = "(%1 %2calc_basic# %3)", e = this.getBlockType(m), f = {raw:"PLUS", type:"Literal", value:"PLUS"}, console.log("arguments geniuse", arguments), 2 == arguments.length && arguments.splice(1, 0, f), b.operator = "PLUS"; + } else { + if ("__pythonRuntime.ops.multiply" == k) { + m = "(%1 %2calc_basic# %3)", e = this.getBlockType(m), f = {raw:"MULTI", type:"Literal", value:"MULTI"}, 2 == arguments.length && arguments.splice(1, 0, f), b.operator = "MULTI"; + } else { + if ("__pythonRuntime.ops.in" == k) { + m = "%4 in %2", e = this.getBlockType(m); + } else { + if ("__pythonRuntime.functions.len" == k) { + m = "len", e = this.getBlockType(m); + } else { + if ("Identifier" == f.object.type && "append" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "append" == l[2]) { + m = "%2.append", e = this.getBlockType(m); + } else { + if ("Identifier" == f.object.type && "insert" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "insert" == l[2]) { + m = "%2.insert", e = this.getBlockType(m); + } else { + if ("Identifier" == f.object.type && "pop" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "pop" == l[2]) { + m = "%2.pop", e = this.getBlockType(m); + } + } + } + } + } + } + } + } + b.callee = k; + } + console.log("CallExpression type after", e); + if (e) { + var n = Entry.block[e], f = n.params, n = n.def.params; + console.log("CallExpression component.arguments", arguments); + console.log("CallExpression paramsMeta", f); + console.log("CallExpression paramsDefMeta", n); + for (var q in f) { + h = f[q].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, q < arguments.length && arguments.splice(q, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, q < arguments.length && arguments.splice(q, 0, h)); + } + console.log("CallExpression arguments", arguments); + for (var r in arguments) { + if (q = arguments[r]) { + console.log("CallExpression argument", q, "typeof", typeof q), q = this[q.type](q, f[r], n[r], !0), console.log("CallExpression param", q), "__pythonRuntime.functions.range" == k && q.type ? (e = q.type, c = q.params) : c.push(q); + } + } + console.log("CallExpression syntax", m); + console.log("CallExpression argument params", c); + if ("%2.append" == m || "%2.pop" == m) { + if ("self" == l[0]) { + var h = Entry.playground.object, t = l[1]; + if (!Entry.TextCodingUtil.prototype.isLocalListExisted(t, h)) { + return b; + } + } else { + if (t = l[0], !Entry.TextCodingUtil.prototype.isGlobalListExisted(t)) { + return b; + } + } + console.log("CallExpression append calleeData", g); + r = this.ParamDropdownDynamic(t, f[1], n[1]); + console.log("CallExpression listName", r); + c.push(r); + console.log("CallExpression params[0]", c[0]); + "%2.pop" == m && ("number" == c[0].type ? c[0].params[0] += 1 : "text" == c[0].type && (c[0].params[0] = String(+c[0].params[0] + 1))); + } else { + if ("%2.insert" == m) { + if ("self" == l[0]) { + if (h = Entry.playground.object, t = l[1], !Entry.TextCodingUtil.prototype.isLocalListExisted(t, h)) { + return b; + } + } else { + if (t = l[0], !Entry.TextCodingUtil.prototype.isGlobalListExisted(t)) { + return b; + } + } + console.log("CallExpression insert params", c); + c.pop(); + console.log("CallExpression append calleeData", g); + r = this.ParamDropdownDynamic(t, f[1], n[1]); + console.log("CallExpression listName", r); + c.splice(0, 0, r); + console.log("CallExpression check arguments", arguments); + console.log("CallExpression arguments[1] 2", arguments[1]); + q = this[arguments[1].type](arguments[1], f[2], n[2], !0); + console.log("CallExpression check param", q); + c.splice(0, 0, q); + console.log("CallExpression insert params", c); + "number" == c[2].type ? c[2].params[0] += 1 : "text" == c[2].type && (c[2].params[0] = String(+c[2].params[0] + 1)); + } else { + "len" == m ? (r = this.ParamDropdownDynamic(c[1].name, f[1], n[1]), delete c[1], c[1] = r) : "%4 in %2" == m && (q = a.arguments[1], q = this[q.type](q, f[3], n[3], !0), r = a.arguments[3].name, r = this.ParamDropdownDynamic(r, f[1], n[1]), c = [], c.push(""), c.push(r), c.push(""), c.push(q), c.push("")); + } + } + e && (b.type = e); + c && (b.params = c); + } else { + c = []; + for (r in arguments) { + q = arguments[r], console.log("CallExpression argument", q, "typeof", typeof q), f = this[q.type](q), console.log("CallExpression argumentData", f), "__pythonRuntime.utils.createParamsObj" == f.callee ? c = f.arguments : c.push(f); + } + console.log("CallExpression args", c); + b.arguments = c; + } + console.log("CallExpression Function Check result", b); + if (b.arguments && b.arguments[0] && "__pythonRuntime.utils.createParamsObj" == b.arguments[0].callee) { + return b; } + b.callee && (c = b.callee.name + (b.arguments ? b.arguments.length : 0), console.log("funcKey", c), e = this._funcMap.get(c)) && (b = {}, b.type = e); + console.log("CallExpression result", b); return b; }; - a.dropdownDynamicValueConvertor = function(b, a) { - var c = a.options, e; - for (e in c) { - var f = c[e]; - if ("null" == f[1]) { - return c = {}; - } - if ("mouse" == b || "wall" == b || "wall_up" == b || "wall_down" == b || "wall_right" == b || "wall_left" == b) { + b.Identifier = function(a, b, c) { + console.log("Identifier component", a, "paramMeta", b, "paramDefMeta", c); + b = {}; + b.name = a.name; + if (!0 === a.userCode || !1 === a.userCode) { + b.userCode = a.userCode; + } + if (c = this.getBlockType("%1")) { + a = a.name; + var e = Entry.block[c], f = e.params, e = e.def.params; + if (!Entry.TextCodingUtil.prototype.isGlobalVariableExisted(a)) { return b; } - if (b == f[1]) { - return console.log("dropdownDynamicValueConvertor value", b, f[1]), c = f[0]; + var g = [], h, k; + for (k in f) { + console.log("Identifiler paramsMeta, paramsDefMeta", f[k], e[k]), "Text" != f[k].type && (h = this["Param" + f[k].type](a, f[k], e[k])); } + console.log("Identifiler param", h); + h && g.push(h); + b.type = c; + 0 != g.length && (b.params = g); } - c = b; - if ("variables" == a.menuName) { - var g = Entry.variableContainer.variables_, h; - for (h in g) { - var k = g[h]; - if (k.id_ == b) { - c = k.name_; - break; + console.log("Identifiler result", b); + return b; + }; + b.VariableDeclaration = function(a) { + console.log("VariableDeclaration component", a); + var b = {declarations:[]}, c, e; + a = a.declarations; + for (var f in a) { + var g = a[f], g = this[g.type](g); + console.log("VariableDeclaration declarationData", g); + g && b.declarations.push(g); + g && g.type && (c = g.type); + g && g.params && (e = g.params); + } + c && (b.type = c); + e && (b.params = e); + console.log("VariableDeclaration result", b); + return b; + }; + b.VariableDeclarator = function(a) { + console.log("VariableDeclarator component", a); + var b = {}, c, e = [], e = a.id, f = a.init; + if ("__params0" != e.name && "__formalsIndex0" != e.name && "__args0" != e.name) { + if (f.callee && "__getParam0" == f.callee.name) { + return b.name = e.name, b; + } + var g; + console.log("VariableDeclarator init", f); + if (f.callee && f.callee.object && f.callee.property) { + if (f.callee.object.object && f.callee.object.object.name) { + var h = f.callee.object.object.name + } + if (f.callee.object.property && f.callee.object.property.name) { + var k = f.callee.object.property.name + } + if (f.callee.property.name) { + var l = f.callee.property.name } + h && k && l && (g = h.concat(".").concat(k).concat(".").concat(l)); } - } else { - if ("lists" == a.menuName) { - for (h in g = Entry.variableContainer.lists, g) { - if (k = g[h], k.id_ == b) { - c = k.name_; - break; - } + if ("__pythonRuntime.objects.list" == g) { + h = this[e.type](e); + console.log("VariableDeclarator idData", h); + b.id = h; + g = this[f.type](f); + console.log("VariableDeclarator initData", g); + b.init = g; + h = e.name; + f = []; + arguments = g.arguments; + for (c in arguments) { + var m = {}; + m.data = String(arguments[c].params[0]); + f.push(m); } + Entry.TextCodingUtil.prototype.isGlobalListExisted(h) ? Entry.TextCodingUtil.prototype.updateGlobalList(h, f) : Entry.TextCodingUtil.prototype.createGlobalList(h, f); } else { - if ("pictures" == a.menuName) { - for (g in h = Entry.container.getAllObjects(), h) { - for (k in a = h[g], a = a.pictures, a) { - if (e = a[k], e.id == b) { - return c = e.name; - } - } - } + h = e.name; + g = "Literal" == f.type ? f.value : "Identifier" == f.type ? f.name : NaN; + console.log("variable name", h, "value", g); + g && NaN != g && (h.includes("__filbert") || (Entry.TextCodingUtil.prototype.isGlobalVariableExisted(h) ? Entry.TextCodingUtil.prototype.updateGlobalVariable(h, g) : Entry.TextCodingUtil.prototype.createGlobalVariable(h, g))); + h = this[e.type](e); + console.log("VariableDeclarator idData", h); + b.id = h; + g = this[f.type](f); + console.log("VariableDeclarator initData", g); + b.init = g; + console.log("VariableDeclarator init.type", f.type); + if ("Literal" == f.type) { + c = e = this.getBlockType("%1 = %2"); } else { - if ("sounds" == a.menuName) { - for (g in h = Entry.container.getAllObjects(), h) { - for (k in a = h[g], a = a.sounds, a) { - if (e = a[k], e.id == b) { - return c = e.name; - } - } + if (g.params && g.params[0] && g.params[0].name && h.name == g.params[0].name) { + if (console.log("VariableDeclarator idData.name", h.name, "initData.params[0].name", g.params[0].name), c = e = this.getBlockType("%1 += %2"), "PLUS" != g.operator) { + return b; } + } else { + c = e = this.getBlockType("%1 = %2"); } } + k = Entry.block[e]; + e = k.params; + k = k.def.params; + h.name && (m = this.ParamDropdownDynamic(h.name, e[0], k[0])); + e = []; + "Literal" == f.type ? (h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g)) : (console.log("VariableDeclarator idData", h, "initData", g), g.params && g.params[0] && h.name == g.params[0].name ? (console.log("in initData.params[0]"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g.params[2])) : (console.log("in initData"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g))); + b.type = c; + b.params = e; } + console.log("VariableDeclarator result", b); + return b; } - return c; }; - a.binaryOperatorValueConvertor = function(b) { - switch(b) { - case "EQUAL": - b = "=="; - break; - case "GREATER": - b = ">"; - break; - case "LESS": - b = "<"; - break; - case "GREATER_OR_EQUAL": - b = ">="; - break; - case "LESS_OR_EQUAL": - b = "<="; - break; - case "\uadf8\ub9ac\uace0": - b = "&&"; - break; - case "\ub610\ub294": - b = "||"; - break; - case "PLUS": - b = "+"; - break; - case "MINUS": - b = "-"; - break; - case "MULTI": - b = "*"; - break; - case "DIVIDE": - b = "/"; + b.Literal = function(a, b, c, e) { + console.log("Literal component", a, "paramMeta", b, "paramDefMeta", c, "aflag", e); + e = a.value; + console.log("Literal value", e); + b || (b = {type:"Block"}, c || (c = "number" == typeof e ? {type:"number"} : {type:"text"})); + if ("Indicator" == b.type) { + var f; + return null; } - return b; - }; - a.variableFilter = function(b, a, d) { - var c = d; - b = b.data.type; - "change_variable" == b || "set_variable" == b || "get_variable" == b ? 1 == a && (c = eval(d)) : "length_of_list" == b || "is_included_in_list" == b ? 2 == a && (c = eval(d)) : "value_of_index_from_list" == b ? 2 == a ? c = eval(d) : 4 == a && this.isNumeric(d) && (c = d - 1) : "remove_value_from_list" == b ? 2 == a ? c = eval(d) : 1 == a && this.isNumeric(d) && (c = d - 1) : "insert_value_to_list" == b ? 2 == a ? c = eval(d) : 3 == a && this.isNumeric(d) && (c = d - 1) : "change_value_list_index" == - b ? 1 == a ? c = eval(d) : 2 == a && this.isNumeric(d) && (c = d - 1) : "add_value_to_list" == b && 2 == a && (c = eval(d)); - return c; - }; - a.isGlobalVariableExisted = function(b) { - var a = Entry.variableContainer.variables_, d; - for (d in a) { - var e = a[d]; - if (null === e.object_ && e.name_ == b) { - return !0; - } + if ("Text" == b.type) { + return ""; } - return !1; + console.log("Literal paramMeta", b, "paramDefMeta", c); + null != a.value ? (b = this["Param" + b.type](e, b, c), console.log("Literal param", f)) : (b = [], f = this[a.left.type](a.left), b.push(f), b.push(a.operator), a = this[a.right.type](a.right), b.push(a)); + a = b; + console.log("Literal result", a); + return a; }; - a.updateGlobalVariable = function(b, a) { - var c = Entry.variableContainer.variables_, e; - for (e in c) { - var f = c[e]; - if (null === f.object_ && f.name_ == b) { - variable = {x:f.x_, y:f.y_, id:f.id_, visible:f.visible_, value:a, name:b, isCloud:f.isClud_}; - f.syncModel_(variable); - Entry.variableContainer.updateList(); - break; + b.ParamBlock = function(a, b, c) { + console.log("ParamBlock value", a, "paramMeta", b, "paramDefMeta", c); + b = {}; + var e = a, f = []; + if (!0 === a) { + return b.type = "True", b; + } + if (!1 === a) { + return b.type = "False", b; + } + var g = Entry.block[c.type], h = g.params, g = g.def.params; + if (h && 0 != h.length) { + for (var k in h) { + console.log("aaa", h[k], "bbb", g[k]), e = this["Param" + h[k].type](a, h[k], g[k]); } + } else { + e = a; } + console.log("ParamBlock param", e); + f.push(e); + b.type = c.type; + b.params = f; + a = b; + console.log("ParamBlock result", a); + return a; }; - a.createGlobalVariable = function(b, a) { - this.isGlobalVariableExisted(b) || (Entry.variableContainer.addVariable({name:b, value:a, variableType:"variable"}), Entry.variableContainer.updateList()); + b.ParamAngle = function(a, b, c) { + console.log("ParamAngle value, paramMeta, paramDefMeta", a, b, c); + return a; }; - a.isLocalVariableExisted = function(b, a) { - var c = Entry.variableContainer.variables_, e; - for (e in c) { - var f = c[e]; - if (f.object_ === a.id && f.name_ == b) { - return !0; + b.ParamTextInput = function(a, b, c) { + console.log("ParamTextInput value, paramMeta, paramDefMeta", a, b, c); + return a; + }; + b.ParamColor = function(a, b, c) { + console.log("ParamColor value, paramMeta, paramDefMeta", a, b, c); + console.log("ParamColor result", a); + return a; + }; + b.ParamDropdown = function(a, b, c) { + console.log("ParamDropdown value, paramMeta, paramDefMeta", a, b, c); + var e; + b = b.options; + console.log("options", b); + for (var f in b) { + if (c = b[f], a == c[1]) { + e = c[1]; + break; } } - return !1; + e && (e = String(e)); + console.log("ParamDropdown result", e); + return e; }; - a.updateLocalVariable = function(b, a, d) { - var c = Entry.variableContainer.variables_, f; - for (f in c) { - var g = c[f]; - if (g.object_ === d.id && g.name_ == b) { - g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, value:a, name:b, isCloud:g.isClud_}); - Entry.variableContainer.updateList(); + b.ParamDropdownDynamic = function(a, b, c) { + console.log("ParamDropdownDynamic value, paramMeta, paramDefMeta", a, b, c); + var e; + if ("mouse" == a || "wall" == a || "wall_up" == a || "wall_down" == a || "wall_right" == a || "wall_left" == a) { + return a; + } + b = b.options; + console.log("ParamDropdownDynamic options", b); + for (var f in b) { + if (a == b[f][0]) { + console.log("options[i][0]", b[f][0]); + e = b[f][1]; break; } } + e && (e = String(e)); + console.log("ParamDropdownDynamic result", e); + return e; + }; + b.ParamKeyboard = function(a, b, c) { + console.log("ParamKeyboard value, paramMeta, paramDefMeta", a, b, c); + a = Entry.KeyboardCode.prototype.keyCharToCode[a]; + console.log("ParamKeyboard result", a); + return a; }; - a.createLocalVariable = function(b, a, d) { - this.isLocalVariableExisted(b, d) || (Entry.variableContainer.addVariable({name:b, value:a, object:d.id, variableType:"variable"}), Entry.variableContainer.updateList()); + b.Indicator = function(a, b, c) { }; - a.isLocalVariable = function(b) { - var a = Entry.playground.object, d = Entry.variableContainer.variables_, e; - for (e in d) { - var f = d[e]; - if (f.object_ == a.id && f.id_ == b) { - return !0; + b.MemberExpression = function(a) { + console.log("MemberExpression component", a); + var b = {}, c, e = a.object, f = a.property; + c = this[e.type](e); + b.object = c; + var g = this[f.type](f); + b.property = g; + console.log("MemberExpression objectData", c); + console.log("MemberExpression propertyData", g); + if ("call" == g.name && 0 == g.userCode) { + return b; + } + if ("__pythonRuntime.ops.subscriptIndex" == g.callee) { + e = Entry.playground.object; + if (c.object && "self" == c.object.name) { + if (f = c.property.name, !Entry.TextCodingUtil.prototype.isLocalListExisted(f, e)) { + return b; + } + } else { + if (f = c.name, !Entry.TextCodingUtil.prototype.isGlobalListExisted(f)) { + return b; + } + } + c = e = this.getBlockType("%2[%4]"); + var arguments = g.arguments, e = Entry.block[e], h = e.params, k = e.def.params, f = this.ParamDropdownDynamic(f, h[1], k[1]); + console.log("MemberExpression listName", f); + g = []; + g.push(""); + g.push(f); + g.push(""); + "number" == arguments[0].type ? arguments[0].params[0] += 1 : "text" == arguments[0].type && (arguments[0].params[0] = String(+arguments[0].params[0] + 1)); + g.push(arguments[0]); + g.push(""); + b.type = c; + b.params = g; + } else { + if (g = [], "self" == e.name) { + c = e = this.getBlockType("%1"); + e = Entry.block[e]; + h = e.params; + k = e.def.params; + f = f.name; + e = Entry.playground.object; + if (!Entry.TextCodingUtil.prototype.isLocalVariableExisted(f, e)) { + return b; + } + f = this.ParamDropdownDynamic(f, h[0], k[0]); + g.push(f); + b.type = c; + 0 != g.length && (b.params = g); + } else { + return b; } } - return !1; + console.log("MemberExpression result", b); + return b; }; - a.isGlobalListExisted = function(b) { - var a = Entry.variableContainer.lists_, d; - for (d in a) { - var e = a[d]; - if (null === e.object_ && e.name_ == b) { - return !0; + b.WhileStatement = function(a) { + console.log("WhileStatement component", a); + var b; + b = {statements:[]}; + var c = a.test; + console.log("WhileStatement test", c); + if (!0 === c.value) { + var e = this.getBlockType("while True:\n$1") + } + console.log("WhileStatement type", e); + var f = Entry.block[e].params; + console.log("WhileStatement paramsMeta", f); + var g = []; + if ("Literal" == c.type || "Identifier" == c.type) { + arguments = []; + arguments.push(c); + f = Entry.block[e].params; + c = Entry.block[e].def.params; + console.log("WhileStatement paramsMeta", f); + console.log("WhileStatement paramsDefMeta", c); + for (var h in f) { + var k = f[h].type; + "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); + } + for (var l in arguments) { + h = arguments[l], console.log("WhileStatement argument", h), h = this[h.type](h, f[l], c[l], !0), console.log("WhileStatement Literal param", h), h && null != h && g.push(h); } + } else { + h = this[c.type](c), console.log("WhileStatement Not Literal param", h), h && null != h && g.push(h); } - return !1; + f = a.body; + f = this[f.type](f); + console.log("WhileStatement bodyData", f); + "True" == g[0].type && (b.type = e, b.statements.push(f.statements)); + console.log("WhileStatement result", b); + return b; }; - a.updateGlobalList = function(b, a) { - var c = Entry.variableContainer.lists_, e; - for (e in c) { - var f = c[e]; - if (null === f.object_ && f.name_ == b) { - list = {x:f.x_, y:f.y_, id:f.id_, visible:f.visible_, name:b, isCloud:f.isClud_, width:f.width_, height:f.height_, array:a}; - f.syncModel_(list); - f.updateView(); - Entry.variableContainer.updateList(); - break; + b.BlockStatement = function(a) { + console.log("BlockStatement component", a); + var b = {statements:[], data:[]}, c = [], e = [], f = []; + a = a.body; + console.log("BlockStatement bodies", a); + for (var g in a) { + var h = a[g], h = this[h.type](h); + console.log("BlockStatement bodyData", h); + h && null == h || (f.push(h), console.log("BlockStatement data", f)); + } + console.log("BlockStatement final data", f); + b.data = f; + console.log("jhlee data check", f); + for (var k in f) { + if (f[1] && "repeat_basic" == f[1].type) { + if (0 == k) { + if (f[k].declarations) { + a = f[0].declarations; + for (k in a) { + h = a[k], (h = h.init) && c.push(h); + } + b.params = c; + } + } else { + if (1 == k) { + b.type = f[k].type; + e = []; + a = f[k].statements[0]; + console.log("BlockStatement allStatements", a); + if (a && 0 != a.length) { + for (g in a) { + h = a[g], console.log("BlockStatement(for) statement", h), h.type && e.push(h); + } + } + console.log("BlockStatement(for) statements", e); + b.statements.push(e); + } + } + } else { + if (f) { + if (0 == k) { + if (f[k] && f[k].declarations) { + a = f[k].declarations; + for (k in a) { + h = a[k], (h = h.init) && c.push(h); + } + b.params = c; + } else { + (h = f[k]) && h.type && e.push(h); + } + } else { + e = []; + if ((a = f) && 0 != a.length) { + for (g in a) { + h = a[g], console.log("BlockStatement statement", h), h && h.type && e.push(h); + } + } + console.log("BlockStatement statements", e); + } + b.statements = e; + } } } + console.log("BlockStatement statement result", b); + return b; }; - a.createGlobalList = function(b, a) { - this.isGlobalListExisted(b) || (Entry.variableContainer.addList({name:b, array:a, variableType:"list"}), Entry.variableContainer.updateList()); - }; - a.isLocalListExisted = function(b, a) { - var c = Entry.variableContainer.lists_, e; - for (e in c) { - var f = c[e]; - if (f.object_ === a.id && f.name_ == b) { - return !0; + b.IfStatement = function(a) { + console.log("IfStatement component", a); + var b; + b = {statements:[]}; + var c, e = [], f = a.consequent, g = a.alternate; + c = null != g ? "if_else" : "_if"; + b.type = c; + console.log("IfStatement type", c); + var h = a.test; + console.log("IfStatement test", h); + if ("Literal" == h.type || "Identifier" == h.type) { + arguments = []; + arguments.push(h); + h = Entry.block[c].params; + c = Entry.block[c].def.params; + console.log("IfStatement paramsMeta", h); + console.log("IfStatement paramsDefMeta", c); + for (var k in h) { + var l = h[k].type; + "Indicator" == l ? (l = {raw:null, type:"Literal", value:null}, k < arguments.length && arguments.splice(k, 0, l)) : "Text" == l && (l = {raw:"", type:"Literal", value:""}, k < arguments.length && arguments.splice(k, 0, l)); + } + for (var m in arguments) { + k = arguments[m], console.log("IfStatement argument", k), k = this[k.type](k, h[m], c[m], !0), console.log("IfStatement Literal param", k), k && null != k && e.push(k); } + } else { + k = this[h.type](h), console.log("IfStatement Not Literal param", k), k && null != k && e.push(k); } - return !1; - }; - a.updateLocalList = function(b, a, d) { - var c = Entry.variableContainer.lists_, f; - for (f in c) { - var g = c[f]; - if (g.object_ === d.id && g.name_ == b) { - g.syncModel_({x:g.x_, y:g.y_, id:g.id_, visible:g.visible_, name:b, isCloud:g.isClud_, width:g.width_, height:g.height_, array:a}); - g.updateView(); - Entry.variableContainer.updateList(); - break; + e && 0 != e.length && (b.params = e); + console.log("IfStatement params result", e); + if (null != f) { + e = []; + console.log("IfStatement consequent", f); + f = this[f.type](f); + console.log("IfStatement consequent data", f); + f = f.data; + console.log("IfStatement consequentsData", f); + for (m in f) { + h = f[m], console.log("IfStatement consData", h), h && (h.init && h.type ? (b.type = h.type, (h = h.statements) && (e = h)) : !h.init && h.type && e.push(h)); } + 0 != e.length && (b.statements[0] = e); } - }; - a.createLocalList = function(b, a, d) { - this.isLocalListExisted(b, d) || (Entry.variableContainer.addList({name:b, array:a, object:d.id, variableType:"list"}), Entry.variableContainer.updateList()); - }; - a.isLocalList = function(b) { - var a = Entry.playground.object, d = Entry.variableContainer.lists_, e; - for (e in d) { - var f = d[e]; - if (f.object_ == a.id && f.id_ == b) { - return !0; + if (null != g) { + f = []; + console.log("IfStatement alternate", g); + g = this[g.type](g); + console.log("IfStatement alternate data", g); + g = g.data; + for (m in g) { + (e = g[m]) && e.type && f.push(e); } + 0 != f.length && (b.statements[1] = f); } - return !1; + console.log("IfStatement result", b); + return b; }; - a.isLocalType = function(b, a) { - if ("get_variable" == b.data.type || "set_variable" == b.data.type || "change_variable" == b.data.type) { - if (this.isLocalVariable(a)) { - return !0; - } - } else { - if (("value_of_index_from_list" == b.data.type || "add_value_to_list" == b.data.type || "remove_value_from_list" == b.data.type || "insert_value_to_list" == b.data.type || "change_value_list_index" == b.data.type || "length_of_list" == b.data.type || "is_included_in_list" == b.data.type) && this.isLocalList(a)) { - return !0; + b.ForStatement = function(a) { + console.log("ForStatement component", a); + var b = {statements:[]}, c = this.getBlockType("for i in range"); + b.type = c; + if (c = a.init) { + var e = this[c.type](c) + } + b.init = e; + console.log("ForStatement init", c); + e = a.body.body; + console.log("ForStatement bodies", e); + if (e) { + for (var f in e) { + 0 != f && (c = e[f], console.log("ForStatement bodyData", c, "index", f), c = this[c.type](c), console.log("ForStatement bodyData result", c, "index", f), b.statements.push(c)); } } - }; - a.isEventBlock = function(b) { - b = b.data.type; - return "when_run_button_click" == b || "when_some_key_pressed" == b || "mouse_clicked" == b || "mouse_click_cancled" == b || "when_object_click" == b || "when_object_click_canceled" == b || "when_message_cast" == b || "when_scene_start" == b || "when_clone_start" == b ? !0 : !1; - }; - a.makeDefinition = function(b) { - var a = /(%.)/mi; - b = Entry.block[b.data.type].syntax.py[0].split(a); - for (var d = "", e = 0;e < b.length;e++) { - var f = b[e], d = a.test(f) ? d + "event" : d + f + console.log("ForStatement bodyData result", b); + if (f = a.test) { + var g = this[f.type](f) } - return d; - }; - a.isNoPrintBlock = function(b) { - return !1; - }; - a.entryEventFuncFilter = function(b) { - var a = !1; - b = b.split("\n"); - for (var d in b) { - var e = b[d]; - "def entry_event_start():" == e || "def entry_event_mouse_down():" == e || "def entry_event_mouse_up():" == e || "def entry_event_object_down():" == e || "def entry_event_scene_start():" == e || "def entry_event_clone_create():" == e ? (tokens = e.split("def"), e = tokens[1].substring(0, tokens[1].length - 1).trim() + "\n", b[d] = e, a = !0) : (new RegExp(/^def entry_event_key(.+):$/)).test(e) || (new RegExp(/^def entry_event_signal(.+):$/)).test(e) ? (tokens = e.split("def"), e = tokens[1].substring(0, - tokens[1].length - 1).trim() + "\n", b[d] = e, a = !0) : a && (e = b[d], e = e.replace("\t", ""), b[d] = e); + b.test = g; + console.log("ForStatement testData", g); + if (a = a.update) { + var h = this[a.type](a) } - return b.join("\n"); - }; - a.eventBlockSyntaxFilter = function(b) { - return "entry_event_start" == b || "entry_event_key" == b || "entry_event_mouse_down" == b || "entry_event_mouse_up" == b || "entry_event_object_down" == b || "entry_event_signal" == b || "entry_event_scene_start" == b || "entry_event_clone_create" == b ? "def " + b : b; - }; - a.isEntryEventFunc = function(b) { - return "def entry_event_start" == b || "def entry_event_key" == b || "def entry_event_mouse_down" == b || "def entry_event_mouse_up" == b || "def entry_event_object_down" == b || "def entry_event_signal" == b || "def entry_event_scene_start" == b || "def entry_event_clone_create" == b ? !0 : !1; + b.update = h; + console.log("ForStatement updateData", h); + console.log("ForStatement result", b); + return b; }; - a.searchFuncDefParam = function(b) { - "function_field_label" == b.data.type && this._funcNameQ.enqueue(b.data.params[0]); - return b && b.data && b.data.params && b.data.params[1] ? ("function_field_string" != b.data.type && "function_field_boolean" != b.data.type || this._funcParamQ.enqueue(b.data.params[0].data.type), this.searchFuncDefParam(b.data.params[1])) : b; + b.ForInStatement = function(a) { + console.log("ForInStatement component", a); + a = null; + console.log("ForInStatement result", a); + return a; }; - a.gatherFuncDefParam = function(b) { - if (b && b.data) { - if (b.data.params[0]) { - if (b.data.params[0].data) { - var a = b.data.params[0].data.type; - "function_field_string" != b.data.type && "function_field_boolean" != b.data.type || this._funcParamQ.enqueue(a); - } else { - "function_field_label" == b.data.type && this._funcNameQ.enqueue(b.data.params[0]); - } - } - if (b.data.params[1]) { - var d = this.searchFuncDefParam(b.data.params[1]); - d.data.params[0].data && (a = d.data.params[0].data.type, "function_field_string" != d.data.type && "function_field_boolean" != d.data.type || this._funcParamQ.enqueue(a)); - d.data.params[1] && d.data.params[1].data.params[0].data && (a = d.data.params[1].data.params[0].data.type, "function_field_string" != d.data.params[1].data.type && "function_field_boolean" != d.data.params[1].data.type || this._funcParamQ.enqueue(a)); - } - } - return d; + b.BreakStatement = function(a) { + console.log("BreakStatement component", a); + a = {}; + var b = this.getBlockType("break"); + console.log("BreakStatement type", b); + a.type = b; + console.log("BreakStatement result", a); + return a; }; - a.getLastParam = function(b) { - b && b.data && b.data.params[1] && (b = this.getLastParam(b.data.params[1])); - return b; + b.UnaryExpression = function(a) { + console.log("UnaryExpression component", a); + var b; + a.prefix && (b = a.operator, a = a.argument, console.log("UnaryExpression operator", b), a.value = +b.concat(a.value), b = this[a.type](a), console.log("UnaryExpression data", b)); + a = b; + console.log("UnaryExpression result", a); + return a; }; - a.isFuncContentsMatch = function(b, a, d) { - for (var c = !0, f = 0;f < b.length && c;f++) { - var c = !1, g = b[f], h = a[f]; - if (g && !h) { - c = fasle; + b.LogicalExpression = function(a) { + console.log("LogicalExpression component", a); + var b; + b = {}; + var c = String(a.operator); + switch(c) { + case "&&": + var e = "(%1 and %3)"; break; - } - if (!g && h) { - c = !1; + case "||": + e = "(%1 or %3)"; break; + default: + e = "(%1 and %3)"; + } + var e = this.getBlockType(e), f = [], c = a.left; + if ("Literal" == c.type || "Identifier" == c.type) { + arguments = []; + arguments.push(c); + var c = Entry.block[e].params, g = Entry.block[e].def.params; + console.log("LogicalExpression paramsMeta", c); + console.log("LogicalExpression paramsDefMeta", g); + for (var h in c) { + var k = c[h].type; + "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); } - if (h.type == g.data.type) { - var c = !0, k = h.params, l = g.data.params, m = []; - l.map(function(b, a) { - b && m.push(b); - }); - l = m; - if (k.length == l.length) { - for (var c = !0, n = 0;n < k.length && c;n++) { - if (c = !1, k[n].name) { - for (var q in textFuncParams) { - if (k[n].name == textFuncParams[q]) { - for (var r in d) { - if (l[n].data.type == r && d[r] == q) { - c = !0; - break; - } - } - if (c) { - break; - } - } - } - } else { - "True" == k[n].type || "False" == k[n].type ? k[n].type == l[n].data.type && (c = !0) : k[n].type && k[n].params && k[n].params[0] == l[n].data.params[0] && (c = !0); - } - } - c && h.statements && 0 != h.statements.length && (c = this.isFuncContentsMatch(g.data.statements[0]._data, h.statements[0])); - } else { - c = !1; - break; - } - } else { - c = !1; - break; + for (var l in arguments) { + var m = arguments[l]; + console.log("LogicalExpression argument", m); + m = this[m.type](m, c[l], g[l], !0); + console.log("LogicalExpression param", m); + m && null != m && f.push(m); } + } else { + (m = this[c.type](c)) && f.push(m); } - return c; - }; - a.isParamBlock = function(b) { - b = b.type; - return "ai_boolean_distance" == b || "ai_distance_value" == b || "ai_boolean_object" == b || "ai_boolean_and" == b ? !0 : !1; - }; - a.hasBlockInfo = function(b, a) { - var c = !1, e; - for (e in a) { - var f = a[e]; - if (e == b.type) { - for (var g in f) { - var h = f[g]; - if (h.start == b.start && h.end == b.end) { - c = !0; - break; - } - } + console.log("LogicalExpression left param", m); + c = String(a.operator); + console.log("LogicalExpression operator", c); + c && (m = c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), f.push(m)); + c = a.right; + if ("Literal" == c.type || "Identifier" == c.type) { + arguments = []; + arguments.push(c); + c = Entry.block[e].params; + g = Entry.block[e].def.params; + console.log("LogicalExpression paramsMeta", c); + console.log("LogicalExpression paramsDefMeta", g); + for (h in c) { + k = c[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); } - } - return c; - }; - a.updateBlockInfo = function(b, a) { - var c = a[b.type]; - if (c && Array.isArray(c) && 0 != c.legnth) { - for (var e in c) { - if (a = c[e], a.start == b.start && a.end == b.end) { - break; - } else { - var f = {}; - f.start = b.start; - f.end = b.end; - c.push(f); - } + for (l in arguments) { + m = arguments[l], console.log("LogicalExpression argument", m), m = this[m.type](m, c[l], g[l], !0), console.log("LogicalExpression param", m), m && null != m && f.push(m); } } else { - a[b.type] = [], f = {}, f.start = b.start, f.end = b.end, a[b.type].push(f); - } - }; - a.jsAdjustSyntax = function(b, a) { - if ("ai_boolean_distance" == b.data.type) { - var c = a.split(" "); - b = c[0].split("_"); - b[1] = b[1].substring(1, b[1].length - 1); - b[1] = b[1].toLowerCase(); - b = b.join("_"); - a = c[1]; - a = this.bTojBinaryOperatorConvertor(a); - c = c[2]; - b = b + " " + a + " " + c; - } else { - "ai_boolean_object" == b.data.type ? (c = a.split(" "), b = c[0].split("_"), b[1] = b[1].substring(1, b[1].length - 1), b[1] = b[1].toLowerCase(), b = b.join("_"), a = c[1], c = c[2], b = b + " " + a + " " + c) : "ai_distance_value" == b.data.type ? (c = a.split(" "), b = c[0].split("_"), b[1] = b[1].substring(1, b[1].length - 1), b[1] = b[1].toLowerCase(), b = b.join("_")) : b = a; + (m = this[c.type](c)) && f.push(m); } + console.log("LogicalExpression right param", m); + b.type = e; + b.params = f; + console.log("LogicalExpression result", b); return b; }; - a.bTojBinaryOperatorConvertor = function(b) { - var a; - switch(b) { - case "'BIGGER'": - a = ">"; + b.BinaryExpression = function(a) { + console.log("BinaryExpression component", a); + var b = {}, c = {}, e = String(a.operator); + switch(e) { + case "==": + var f = "(%1 %2boolean_compare# %3)"; break; - case "'BIGGER_EQUAL'": - a = ">="; + case "!=": + f = "(%2 != True)"; break; - case "'EQUAL'": - a = "=="; + case "<": + f = "(%1 %2boolean_compare# %3)"; break; - case "'SMALLER'": - a = "<"; + case "<=": + f = "(%1 %2boolean_compare# %3)"; break; - case "'SMALLER_EQUAL'": - a = "<="; - } - return a; - }; - a.jTobBinaryOperatorConvertor = function(b) { - var a; - switch(b) { case ">": - a = "BIGGER"; + f = "(%1 %2boolean_compare# %3)"; break; case ">=": - a = "BIGGER_EQUAL"; + f = "(%1 %2boolean_compare# %3)"; break; - case "==": - a = "EQUAL"; + case "+": + f = "(%1 %2calc_basic# %3)"; break; - case "<": - a = "SMALLER"; + case "-": + f = "(%1 %2calc_basic# %3)"; break; - case "<=": - a = "SMALLER_EQUAL"; - } - return a; - }; - a.radarVariableConvertor = function(b) { - return b.split("_")[1].toUpperCase(); - }; - a.tTobDropdownValueConvertor = function(b) { - return "stone" == b ? "OBSTACLE" : "wall" == b ? b.toUpperCase() : "item" == b ? b.toUpperCase() : b; - }; -})(Entry.TextCodingUtil.prototype); -Entry.BlockToJsParser = function(a) { - this.syntax = a; - this._iterVariableCount = 0; - this._iterVariableChunk = ["i", "j", "k"]; -}; -(function(a) { - a.Code = function(b, a) { - this._parseMode = a; - if (b instanceof Entry.Block) { - return this.Block(b); - } - a = ""; - b = b._data; - for (var c = 0;c < b.length;c++) { - a += this.Thread(b[c]); - } - return a.trim(); - }; - a.Thread = function(b) { - if (b instanceof Entry.Block) { - return this.Block(b); - } - var a = ""; - b = b.getBlocks(); - for (var d = 0;d < b.length;d++) { - var e = b[d]; - d != b.length - 1 ? (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e + "\n" : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e + "\n")) : (e = this.Block(e), this._parseMode == Entry.Parser.PARSE_GENERAL ? a += e : this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = e)); - } - return a + "\n"; - }; - a.Block = function(b) { - var a = b._schema.syntax.js ? b._schema.syntax.js : b._schema.syntax; - return a ? b = this[a[0]](b) : ""; - }; - a.Program = function(b) { - return ""; - }; - a.Scope = function(b) { - var a = !1, d = "", e = /(%.)/mi; - if (b._schema.syntax.js) { - var f = b._schema.syntax.js.concat(), a = !0 - } else { - f = b._schema.syntax.concat(); - } - f.shift(); - for (var f = f[0].split(e), g = b._schema.params, h = b.data.params, k = 0;k < f.length;k++) { - var l = f[k]; - 0 !== l.length && "Scope" !== l && ("Judge" === l ? a = !0 : e.test(l) ? (l = l.split("%")[1], l = parseInt(l) - 1, g[l] && "Image" != g[l].type && ("Block" == g[l].type ? (l = this.Block(h[l]), d += l) : d += this[g[l].type](h[l], g[l]))) : d += l); - } - "#" == d.charAt(d.length - 1) && (a = !0, d = d.substring(0, d.length - 1), d = d.trim()); - a || (d += "();"); - return d = Entry.TextCodingUtil.prototype.jsAdjustSyntax(b, d); - }; - a.BasicFunction = function(b) { - b = this.Thread(b.statements[0]); - return "function promise() {\n" + this.indent(b).trim() + "}"; - }; - a.BasicIteration = function(b) { - var a = b.params[0], d = this.publishIterateVariable(); - b = this.Thread(b.statements[0]); - this.unpublishIterateVariable(); - return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++) {\n" + this.indent(b) + "}"; - }; - a.BasicIf = function(b) { - if (2 == b.data.statements.length) { - var a = this.Thread(b.statements[0]), d = this.Thread(b.statements[1]), e = b._schema.syntax.concat(), e = (b = b.data.params[0]) && "True" == b.data.type ? e[1] : void 0 === b ? e[1] : this.Block(b), a = "if (" + e + ") {\n" + this.indent(a) + "}\nelse {\n" + this.indent(d) + "}\n" - } else { - a = this.Thread(b.statements[0]), e = b._schema.syntax.concat(), e = (b = b.data.params[0]) && "True" == b.data.type ? e[1] : void 0 === b ? e[1] : this.Block(b), a = "if (" + e + ") {\n" + this.indent(a) + "}\n"; - } - return a; - }; - a.BasicWhile = function(b) { - var a = this.Thread(b.statements[0]); - return "while (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; - }; - a.indent = function(b) { - var a = ""; - b = b.split("\n"); - for (var d in b) { - var e = b[d]; - 0 != e.length && (a += "\t" + e + "\n"); - } - return a; - }; - a.publishIterateVariable = function() { - var b = "", a = this._iterVariableCount; - do { - b = this._iterVariableChunk[a % 3] + b, a = parseInt(a / 3) - 1, 0 === a && (b = this._iterVariableChunk[0] + b); - } while (0 < a); - this._iterVariableCount++; - return b; - }; - a.unpublishIterateVariable = function() { - this._iterVariableCount && this._iterVariableCount--; - }; - a.Dropdown = function(b) { - "OBSTACLE" == b ? b = "stone" : "ITEM" == b ? b = b.toLowerCase() : "WALL" == b && (b = b.toLowerCase()); - return "'" + b + "'"; - }; - a.TextInput = function(b) { - return b; - }; - a.DropdownDynamic = function(b, a) { - return b = "null" == b ? "none" : Entry.TextCodingUtil.prototype.dropdownDynamicValueConvertor(b, a); - }; -})(Entry.BlockToJsParser.prototype); -Entry.KeyboardCode = function() { -}; -(function(a) { - a.keyCodeToChar = {8:"Backspace", 9:"Tab", 13:"Enter", 16:"Shift", 17:"Ctrl", 18:"Alt", 19:"Pause/Break", 20:"Caps Lock", 27:"Esc", 32:"Space", 33:"Page Up", 34:"Page Down", 35:"End", 36:"Home", 37:"Left", 38:"Up", 39:"Right", 40:"Down", 45:"Insert", 46:"Delete", 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 65:"A", 66:"B", 67:"C", 68:"D", 69:"E", 70:"F", 71:"G", 72:"H", 73:"I", 74:"J", 75:"K", 76:"L", 77:"M", 78:"N", 79:"O", 80:"P", 81:"Q", 82:"R", 83:"S", 84:"T", - 85:"U", 86:"V", 87:"W", 88:"X", 89:"Y", 90:"Z", 91:"Windows", 93:"Right Click", 96:"Numpad 0", 97:"Numpad 1", 98:"Numpad 2", 99:"Numpad 3", 100:"Numpad 4", 101:"Numpad 5", 102:"Numpad 6", 103:"Numpad 7", 104:"Numpad 8", 105:"Numpad 9", 106:"Numpad *", 107:"Numpad +", 109:"Numpad -", 110:"Numpad .", 111:"Numpad /", 112:"F1", 113:"F2", 114:"F3", 115:"F4", 116:"F5", 117:"F6", 118:"F7", 119:"F8", 120:"F9", 121:"F10", 122:"F11", 123:"F12", 144:"Num Lock", 145:"Scroll Lock", 182:"My Computer", 183:"My Calculator", - 186:";", 187:"=", 188:",", 189:"-", 190:".", 191:"/", 192:"`", 219:"[", 220:"\\", 221:"]", 222:"'"}; - a.keyCharToCode = {Backspace:8, Tab:9, Enter:13, Shift:16, Ctrl:17, Alt:18, "Pause/Break":19, "Caps Lock":20, Esc:27, Space:32, "Page Up":33, "Page Down":34, End:35, Home:36, Left:37, Up:38, Right:39, Down:40, Insert:45, Delete:46, 0:48, 1:49, 2:50, 3:51, 4:52, 5:53, 6:54, 7:55, 8:56, 9:57, A:65, B:66, C:67, D:68, E:69, F:70, G:71, H:72, I:73, J:74, K:75, L:76, M:77, N:78, O:79, P:80, Q:81, R:82, S:83, T:84, U:85, V:86, W:87, X:88, Y:89, Z:90, Windows:91, "Right Click":93, "Numpad 0":96, "Numpad 1":97, - "Numpad 2":98, "Numpad 3":99, "Numpad 4":100, "Numpad 5":101, "Numpad 6":102, "Numpad 7":103, "Numpad 8":104, "Numpad 9":105, "Numpad *":106, "Numpad +":107, "Numpad -":109, "Numpad .":110, "Numpad /":111, F1:112, F2:113, F3:114, F4:115, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, F12:123, "Num Lock":144, "Scroll Lock":145, "My Computer":182, "My Calculator":183, ";":186, "=":187, ",":188, "-":189, ".":190, "/":191, "`":192, "[":219, "\\":220, "]":221, "'":222}; -})(Entry.KeyboardCode.prototype); -Entry.BlockToPyParser = function(a) { - this.blockSyntax = a; - this._variableMap = new Entry.Map; - this._funcMap = new Entry.Map; - this._queue = new Entry.Queue; -}; -(function(a) { - a.Code = function(b, a) { - this._parseMode = a; - if (b instanceof Entry.Thread) { - return this.Thread(b); - } - if (b instanceof Entry.Block) { - return this.Block(b); - } - a = ""; - b = b.getThreads(); - for (var c = 0;c < b.length;c++) { - a += this.Thread(b[c]) + "\n"; - } - return a = a.trim(); - }; - a.Thread = function(b) { - if (b instanceof Entry.Block) { - return this.Block(b); + case "*": + f = "(%1 %2calc_basic# %3)"; + break; + case "/": + f = "(%1 %2calc_basic# %3)"; } - var a = ""; - b = b.getBlocks(); - for (var d = !1, e = "", f = "", g = 0;g < b.length;g++) { - var h = b[g]; - if (this._parseMode == Entry.Parser.PARSE_GENERAL) { - if (Entry.TextCodingUtil.prototype.isNoPrintBlock(h)) { - continue; + console.log("BinaryExpression operator", e); + console.log("BinaryExpression syntax", f); + if (f = this.getBlockType(f)) { + console.log("BinaryExpression type", f); + b = []; + e = a.left; + console.log("BinaryExpression left", e); + if ("Literal" == e.type || "Identifier" == e.type) { + arguments = []; + arguments.push(e); + var e = Entry.block[f].params, g = Entry.block[f].def.params; + console.log("BinaryExpression paramsMeta", e); + console.log("BinaryExpression paramsDefMeta", g); + for (var h in e) { + var k = e[h].type; + "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); + } + for (var l in arguments) { + var m = arguments[l]; + console.log("BinaryExpression argument", m); + m = this[m.type](m, e[l], g[l], !0); + console.log("BinaryExpression param", m); + m && null != m && b.push(m); } - 0 == g ? (d = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? e = this.Block(h) + "\n" : f += this.Block(h) + "\n" : 0 != g && (f += this.Block(h) + "\n"); } else { - this._parseMode == Entry.Parser.PARSE_SYNTAX && (a = (d = Entry.TextCodingUtil.prototype.isEventBlock(h)) ? "" : this.Block(h) + "\n"); + (m = this[e.type](e)) && b.push(m); } - this._queue.clear(); - this._variableMap.clear(); + console.log("BinaryExpression left params", b); + if ("boolean_not" == f) { + return b.splice(0, 0, ""), b.splice(2, 0, ""), console.log("BinaryExpression boolean_not params", b), c.type = f, c.params = b, c; + } + if (e = String(a.operator)) { + console.log("BinaryExpression operator", e), (m = e = Entry.TextCodingUtil.prototype.binaryOperatorConvert(e)) && b.push(m), c.operator = e; + } + e = a.right; + if ("Literal" == e.type || "Identifier" == e.type) { + arguments = []; + arguments.push(e); + e = Entry.block[f].params; + g = Entry.block[f].def.params; + console.log("BinaryExpression paramsMeta", e); + console.log("BinaryExpression paramsDefMeta", g); + for (h in e) { + k = e[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); + } + for (l in arguments) { + m = arguments[l], console.log("BinaryExpression argument", m), m = this[m.type](m, e[l], g[l], !0), console.log("BinaryExpression param", m), m && null != m && b.push(m); + } + } else { + (m = this[e.type](e)) && b.push(m); + } + console.log("BinaryExpression right param", m); + c.type = f; + c.params = b; + } else { + return b; } - this._parseMode == Entry.Parser.PARSE_GENERAL && (a = d ? e + Entry.TextCodingUtil.prototype.indent(f) + "\n" : e + f + "\n"); - return a = a.trim() + "\n"; + console.log("BinaryExpression params", b); + b = c; + console.log("BinaryExpression result", b); + return b; }; - a.Block = function(b) { - var a = "", d; - b._schema && b._schema.syntax && (d = b._schema.syntax.py[0]); - this.isFunc(b) ? (a += this.makeFuncDef(b), this.isRegisteredFunc(b) && (d = this.makeFuncSyntax(b))) : this.isFuncStmtParam(b) && (a += b.data.type); - if (!d || null == d) { - return a; + b.UpdateExpression = function(a) { + console.log("UpdateExpression", a); + var b = {}, c = a.argument; + if (c) { + var e = this[c.type](c) } - var e = /(%.)/mi, f = /(\$.)/mi; - d = d.split(e); - var g = b._schema.params, h = b.data.params, k = b._schema.skeleton, l = b._schema.paramsKeyMap, m; - if (this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l) { - var n + b.argument = e; + b.operator = a.operator; + b.prefix = a.prefix; + console.log("UpdateExpression result", b); + return b; + }; + b.AssignmentExpression = function(a) { + console.log("AssignmentExpression component", a); + var b = {}, c, e = [], f, g = a.left; + g.type && (f = this[g.type](g), console.log("AssignmentExpression leftData", f)); + console.log("AssignmentExpression leftData", f); + b.left = f; + operator = String(a.operator); + console.log("AssignmentExpression operator", operator); + g = a.right; + if (g.type) { + var h = this[g.type](g); + console.log("AssignmentExpression rightData", h); } - for (var q = 0;q < d.length;q++) { - if (n = d[q], 0 !== n.length) { - if (e.test(n)) { - n = n.split("%")[1]; - var r = Number(n) - 1; - if (g[r] && "Indicator" != g[r].type) { - if ("Block" == g[r].type) { - if (m = this.Block(h[r]).trim(), r = this._funcMap.get(m)) { - a += r; - } else { - var r = m.split("_"), t = r[0]; - 2 == r.length && ("stringParam" == t ? m = "string_param" : "booleanParam" == t && (m = "boolean_param")); - m = Entry.TextCodingUtil.prototype.variableFilter(b, n, m); - a += m; - this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (r = Object.keys(l), n = String(r[n++]), n = n.toLowerCase(), this._variableMap.put(n, m), this._queue.enqueue(n)); - } - } else { - m = this["Field" + g[r].type](h[r], g[r]), null == m && (m = g[r].text ? g[r].text : null), m = Entry.TextCodingUtil.prototype.binaryOperatorValueConvertor(m), m = String(m), Entry.TextCodingUtil.prototype.isNumeric(m) || Entry.TextCodingUtil.prototype.isBinaryOperator(m) || (m = String('"' + m + '"')), m = Entry.TextCodingUtil.prototype.variableFilter(b, n, m), Entry.TextCodingUtil.prototype.isLocalType(b, h[r]) && (m = "self".concat(".").concat(m)), a += m, this._parseMode == Entry.Parser.PARSE_VARIABLE && - k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (r = Object.keys(l), n = String(r[n++]), n = n.toLowerCase(), this._variableMap.put(n, m), this._queue.enqueue(n)); - } + b.right = h; + switch(operator) { + case "=": + if (h.callee && h.callee.object) { + var k = h.callee.object.object.name.concat(".").concat(h.callee.object.property.name).concat(".").concat(h.callee.property.name) + } + if ("__pythonRuntime.objects.list" == k && "self" == f.object.name) { + var l = f.property.name; + c = []; + var arguments = h.arguments, m; + for (m in arguments) { + var n = {}; + n.data = String(arguments[m].params[0]); + c.push(n); } + n = Entry.playground.object; + Entry.TextCodingUtil.prototype.isLocalListExisted(l, n) ? Entry.TextCodingUtil.prototype.updateLocalList(l, c, n) : Entry.TextCodingUtil.prototype.createLocalList(l, c, n); + } + if (f.property && "__pythonRuntime.ops.subscriptIndex" == f.property.callee) { + var l = "%1[%2] = %3", q = this.getBlockType(l) } else { - if (f.test(n)) { - for (n = n.split(f), m = 0;m < n.length;m++) { - r = n[m], 0 !== r.length && (f.test(r) ? (r = Number(r.split("$")[1]) - 1, a += Entry.TextCodingUtil.prototype.indent(this.Thread(b.statements[r]))) : a += r); + g.arguments && g.arguments[0] ? (c = a.left.name ? a.left.name : a.left.object.name.concat(a.left.property.name), l = a.right.arguments[0].name ? a.right.arguments[0].name : a.right.arguments[0].object.name.concat(a.right.arguments[0].property.name), console.log("AssignmentExpression leftEx", c, "rightEx", l), l = a.right.arguments && c == l ? "%1 += %2" : "%1 = %2") : l = "%1 = %2", q = this.getBlockType(l); + } + c = q; + } + if (operator) { + var r = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator) + } + b.operator = r; + console.log("AssignmentExpression syntax", l); + f.object ? n = f.object : f.name && (n = f.name); + if (f.proprty) { + var t = f.property + } else { + f.name && (t = f.name); + } + console.log("AssignmentExpression object property value", n, t); + if ("%1[%2] = %3" == l) { + n = Entry.block[q]; + k = n.params; + r = n.def.params; + t = f.params[1]; + console.log("AssignmentExpression listName", t); + if (!t) { + return b; + } + e.push(t); + f = f.property.arguments[0]; + console.log("AssignmentExpression param 1", f); + console.log("AssignmentExpression param 2", f); + e.push(f); + e.push(h); + } else { + if ("%1 = %2" == l) { + console.log("AssignmentExpression calleeName check", k), n && "self" == n.name && "__pythonRuntime.objects.list" != k ? (n = Entry.block[q], k = n.params, r = n.def.params, l = t.name, (f = "number" == h.type || "text" == h.type ? h.params[0] : NaN) && NaN != f && (n = Entry.playground.object, console.log("final value", f), console.log("final object", n), Entry.TextCodingUtil.prototype.isLocalVariableExisted(l, n) ? Entry.TextCodingUtil.prototype.updateLocalVariable(l, f, n) : Entry.TextCodingUtil.prototype.createLocalVariable(l, + f, n)), l = this.ParamDropdownDynamic(l, k[0], r[0]), e.push(l)) : (n = Entry.block[q], k = n.params, r = n.def.params, console.log("property 123", t), l = t, (f = "number" == h.type || "text" == h.type ? h.params[0] : NaN) && NaN != f && (n = Entry.playground.object, console.log("final object", n), console.log("final value", f), Entry.TextCodingUtil.prototype.isGlobalVariableExisted(l, n) ? Entry.TextCodingUtil.prototype.updateGlobalVariable(l, f, n) : Entry.TextCodingUtil.prototype.createGlobalVariable(l, + f, n)), l = this.ParamDropdownDynamic(l, k[0], r[0]), e.push(l), h.callee && delete h.callee), e.push(h); + } else { + if ("%1 += %2" == l) { + if (n && "self" == n.name) { + if (n = Entry.block[q], k = n.params, r = n.def.params, l = t.name, n = Entry.playground.object, console.log("final object", n), !Entry.TextCodingUtil.prototype.isLocalVariableExisted(l, n)) { + return b; } } else { - n.search("#"), -1 != n.search("#") && (m = n.indexOf("#"), n = n.substring(m + 1)), a += n; + if (n = Entry.block[q], k = n.params, r = n.def.params, l = t, !Entry.TextCodingUtil.prototype.isGlobalVariableExisted(l)) { + return b; + } } + l = this.ParamDropdownDynamic(l, k[0], r[0]); + e.push(l); + e.push(h.params[2]); } } } - this._parseMode == Entry.Parser.PARSE_VARIABLE && k == Entry.Parser.BLOCK_SKELETON_BASIC && l && (b = Object.keys(l).length) && (a = this.makeExpressionWithVariable(a, b)); - return a; - }; - a.FieldAngle = function(b) { - return b; - }; - a.FieldColor = function(b) { - return b; - }; - a.FieldDropdown = function(b) { - return b; - }; - a.FieldDropdownDynamic = function(b, a) { - console.log("FieldDropdownDynamic", b, a); - console.log("FieldDropdownDynamic Object", Entry.playground.object); - return b = "null" == b ? "None" : Entry.TextCodingUtil.prototype.dropdownDynamicValueConvertor(b, a); - }; - a.FieldImage = function(b) { - return b; - }; - a.FieldIndicator = function(b) { - return b; - }; - a.FieldKeyboard = function(b) { - return b; - }; - a.FieldOutput = function(b) { - return b; - }; - a.FieldText = function(b) { - return b; - }; - a.FieldTextInput = function(b) { - return b; - }; - a.FieldNumber = function(b) { - return b; - }; - a.FieldKeyboard = function(b) { - (b = Entry.KeyboardCode.prototype.keyCodeToChar[b]) && null != b || (b = "Q"); + b.type = c; + b.params = e; + console.log("AssignmentExpression result", b); return b; }; - a.getBlockType = function(b) { - return this.blockSyntax[b]; - }; - a.makeExpressionWithVariable = function(b, a) { - var c = "", e = 0, f = b.indexOf("("); - a = b.substring(0, f).trim().concat("("); - if (this._queue.toString()) { - for (;(variable = this._queue.dequeue()) && !(b = this._variableMap.get(variable), b = variable.concat(" = ").concat(b).concat("\n"), c += b, a = a.concat(variable).concat(",").concat(" "), e++, 10 < e);) { - } - f = a.lastIndexOf(","); - a = a.substring(0, f); - a = a.trim().concat(")"); - a = c.concat(a); - } else { - a = b; + b.FunctionDeclaration = function(a) { + console.log("FunctionDeclaration component", a); + var b = {}, c = a.body; + a = a.id; + if ("__getParam0" == a.name) { + return b; } - return a; - }; - a.isFunc = function(b) { - return "func" == b.data.type.split("_")[0] ? !0 : !1; - }; - a.isRegisteredFunc = function(b) { - b = b.data.type.split("_"); - return Entry.variableContainer.functions_[b[1]] ? !0 : !1; - }; - a.isFuncStmtParam = function(b) { - b = b.data.type.split("_")[0]; - return "stringParam" == b || "booleanParam" == b ? !0 : !1; - }; - a.makeFuncSyntax = function(b) { - var a = b._schema.template.trim(); - b = b._schema.params; - var d = /(%.)/mi, a = a.trim().split(d), e = "", f = "", g; - for (g in a) { - var h = a[g].trim(); - if (d.test(h)) { - var k = h.split("%")[1], k = Number(k) - 1; - "Indicator" != b[k].type && (f += h.concat(", ")); + var e = this[c.type](c); + console.log("FunctionDeclaration bodyData", e); + if ("Identifier" == a.type) { + var f = this[a.type](a) + } + console.log("FunctionDeclaration idData", f); + c = []; + a = []; + var f = f.name, e = e.data, g; + for (g in e) { + if (e[g].declarations) { + var h = e[g].declarations; + 0 < h.length && c.push(h[0].name); } else { - h = h.split(" "), e += h.join("__"); + e[g].argument && (h = e[g].argument.statements) && 0 < h.length && (a = h); } } - k = f.lastIndexOf(","); - f = f.substring(0, k); - return e.trim().concat("(").concat(f.trim()).concat(")"); - }; - a.makeFuncDef = function(b) { - var a = "def ", d = this.getFuncInfo(b); - this.isRegisteredFunc(b) || (d.name = "f"); - if (d.name) { - a += d.name; - } else { - return a; - } - a = a.concat("("); - if (d.params && 0 != d.params.length) { - for (var e in d.params) { - a += d.params[e], a = a.concat(", "); + console.log("FunctionDeclaration textFuncName", f); + console.log("FunctionDeclaration textFuncParams", c); + console.log("FunctionDeclaration textFuncStatements", a); + var k, l, m, e = Entry.variableContainer.functions_, n; + for (n in e) { + var q = e[n]; + Entry.TextCodingUtil.prototype.initQueue(); + Entry.TextCodingUtil.prototype.gatherFuncDefParam(q.content._data[0]._data[0].data.params[0]); + console.log("Entry.TextCodingUtil._funcParamQ", Entry.TextCodingUtil.prototype._funcParamQ); + for (var r = [], h = {};g = Entry.TextCodingUtil.prototype._funcParamQ.dequeue();) { + r.push(g), console.log("param", g); } - b = a.lastIndexOf(","); - a = a.substring(0, b); - a = a.trim(); - } - a = a.concat("):").concat("\n"); - if (d.statements && d.statements.length) { - b = ""; - for (var f in d.statements) { - b += this.Block(d.statements[f]).concat("\n"); + console.log("funcParams", r); + for (var t in r) { + h[r[t]] = t; } - b = b.concat("\n"); - a += Entry.TextCodingUtil.prototype.indent(b).concat("\n"); - } - this._funcMap.clear(); - return a; - }; - a.getFuncInfo = function(b) { - var a = {}; - if (b = b.data.type.split("_")[1]) { - var d = Entry.variableContainer.functions_[b]; - if (!d) { - return a.name = "\ud568\uc218", a; + console.log("paramMap", h); + console.log("funcNameQueue", Entry.TextCodingUtil.prototype._funcNameQ); + for (g = [];nameToken = Entry.TextCodingUtil.prototype._funcNameQ.dequeue();) { + g.push(nameToken), console.log("funcNames", nameToken); } - } else { - return a; - } - b = d.block.template; - var e = b.search(/(%.)/); - b = b.substring(0, e).trim().split(" ").join("__"); - Entry.TextCodingUtil.prototype.initQueue(); - Entry.TextCodingUtil.prototype.gatherFuncDefParam(d.content._data[0]._data[0].data.params[0]); - for (var f = [], g = {};m = Entry.TextCodingUtil.prototype._funcParamQ.dequeue();) { - f.push(m); - } - for (var h in f) { - g[f[h]] = h; - } - Entry.TextCodingUtil.prototype.clearQueue(); - if (g) { - var f = {}, k; - for (k in g) { - e = g[k]; - h = k.search("_"); - h = k.substring(0, h); - if ("stringParam" == h) { - var l = "value" + String(e + 1) + Entry.TextCodingUtil.prototype.clearQueue(); + blockFuncName = g.join("__").trim(); + console.log("first blockFuncName", blockFuncName); + console.log("first textFuncName", f); + if (f == blockFuncName) { + if (console.log("textFuncName", f), console.log("blockFuncName", blockFuncName), console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), c.length == Object.keys(h).length ? (k = !0, console.log("textFuncParams.length", c.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), l = q.content._data[0]._data, g = l.slice(), g.shift(), console.log("blockFuncContents", l), l = Entry.TextCodingUtil.prototype.isFuncContentsMatch(g, + a, h)) : l = k = !1, k && l) { + m = "func"; + m = m.concat("_").concat(n); + break; } else { - "booleanParam" == h && (l = "boolean" + String(e + 1)); + if (k && !l) { + m = n; + break; + } } - var m = l; - f[e] = m; - this._funcMap.put(k, m); } } - k = d.content._data[0]._data; - l = []; - for (d = 1;d < k.length;d++) { - l.push(k[d]); - } - b && (a.name = b); - 0 != Object.keys(f).length && (a.params = f); - 0 != l.length && (a.statements = l); - return a; - }; -})(Entry.BlockToPyParser.prototype); -Entry.JsToBlockParser = function(a) { - this.syntax = a; - this.scopeChain = []; - this.scope = null; - this._blockCount = 0; - this._blockInfo = {}; -}; -(function(a) { - a.Program = function(b) { - var a = [], d = []; - d.push({type:this.syntax.Program}); - for (var e in b) { - var f = b[e]; - if ("Program" != f.type) { - return; - } - this.initScope(f); - var f = this.BlockStatement(f), g; - for (g in f) { - d.push(f[g]); - } - this.unloadScope(); - 0 != d.length && a.push(d); - } - return a; - }; - a.Identifier = function(b) { - return b.name; - }; - a.Literal = function(b, a) { - return !0 === b.value ? {type:"True"} : !1 === b.value ? {type:"False"} : "ai_distance_value" == a ? b.value : "ai_boolean_object" == a ? b.value : {type:"text", params:[b.value]}; - }; - a.ExpressionStatement = function(b) { - b = b.expression; - return this[b.type](b); - }; - a.ForStatement = function(b) { - var a = b.init, d = b.test, e = b.update, f = b.body; - if (this.syntax.ForStatement) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - } - var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; - "++" != e.operator && (e = a, a = d, d = e); - switch(g) { - case "<": - h = d - a; - break; - case "<=": - h = d + 1 - a; - break; - case ">": - h = a - d; - break; - case ">=": - h = a + 1 - d; - } - return this.BasicIteration(b, h, f); - }; - a.BlockStatement = function(b) { - var a = []; - b = b.body; - for (var d = 0;d < b.length;d++) { - var e = b[d], f = this[e.type](e); - Entry.TextCodingUtil.prototype.hasBlockInfo(e, this._blockInfo) || this._blockCount++; - Entry.TextCodingUtil.prototype.updateBlockInfo(e, this._blockInfo); - if (f) { - if (void 0 === f.type) { - throw {title:"\ube14\ub85d\ubcc0\ud658 \uc624\ub958", message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ube14\ub85d\uc785\ub2c8\ub2e4.", node:e, blockCount:this._blockCount}; + console.log("FunctionDeclaration foundFlag", k); + console.log("FunctionDeclaration matchFlag", l); + if (k && l) { + console.log("targetFuncId", m); + var u = c.length, u = f + u; + this._funcMap.put(u, m); + console.log("FunctionDeclaration this._funcMap", this._funcMap); + b = m; + } else { + if (k && !l) { + b = Entry.variableContainer.functions_[m]; + n = b.content._data[0]; + n._data.splice(1, n._data.length - 1); + if (0 < a.length) { + for (u in a) { + t = a[u], t = new Entry.Block(t, n), n._data.push(t); + } + } + Entry.variableContainer.saveFunction(b); + Entry.variableContainer.updateList(); + b = m; + console.log("textFuncName", f); + u = c.length; + u = f + u; + n = m; + m = "func".concat("_").concat(n); + this._funcMap.put(u, m); + console.log("FunctionDeclaration result", b); + } else { + console.log("FunctionDeclaration textFuncName", f); + console.log("FunctionDeclaration textFuncParams", c); + console.log("FunctionDeclaration textFuncStatements", a); + k = new Entry.Func; + k.generateBlock(!0); + console.log("FunctionDeclaration newFunc", k); + m = []; + for (g = 1;g <= c.length + 1;g++) { + m.push("%" + g); + } + k.block.template = f + " " + m.join(" "); + console.log("newFunc template", k.block.template); + n = k.content._data[0]; + t = n._data[0].data.params[0]; + m = t.data.params; + k.description = ""; + g = f.split("__"); + if (0 < g.length) { + for (e = 1;e < g.length;e++) { + h = g[e], q = new Entry.Block({type:"function_field_label"}, n), q.data.params = [], q.data.params.push(h), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = q, k.description += h.concat(" "); + } + k.description += " "; + } else { + m[0] = f, k.description = f + " "; } - Entry.TextCodingUtil.prototype.isParamBlock(f) || f && a.push(f); + if (0 < c.length) { + for (e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = e, k.paramMap[h] = 0, console.log("FunctionDeclaration paramBlock", k), t = 1;t < c.length;t++) { + e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.searchFuncDefParam(m[1]), console.log("FunctionDeclaration paramBlock", l), 0 == l.data.params.length ? l.data.params[0] = g : 1 == l.data.params.length && (l.data.params[1] = e), k.paramMap[h] = +t, console.log("FunctionDeclaration paramBlock", + k); + } + } + if (0 < a.length) { + for (u in a) { + t = a[u], t = new Entry.Block(t, n), n._data.push(t); + } + } + Entry.Func.generateWsBlock(k); + Entry.variableContainer.saveFunction(k); + Entry.variableContainer.updateList(); + u = c.length; + u = f + u; + n = k.id; + m = "func".concat("_").concat(n); + this._funcMap.put(u, m); + console.log("FunctionDeclaration newFunc", k); } } - return a; - }; - a.EmptyStatement = function(b) { - throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.DebuggerStatement = function(b) { - throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + console.log("FunctionDeclaration result", b); }; - a.WithStatement = function(b) { - throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ReturnStaement = function(b) { - throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.LabeledStatement = function(b) { - throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.BreakStatement = function(b) { - throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ContinueStatement = function(b) { - throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.FunctionExpression = function(a) { + console.log("FunctionExpression component", a); + var b = {}; + a = a.body; + a = this[a.type](a); + console.log("FunctionExpression bodyData", a); + b.statements = a.statements; + console.log("FunctionExpression result", b); + return b; }; - a.IfStatement = function(b) { - if (this.syntax.BasicIf) { - return this.BasicIf(b); + b.ReturnStatement = function(a) { + console.log("ReturnStatement component", a); + var b = {}; + if (a = a.argument) { + var c = this[a.type](a) } - throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.SwitchStatement = function(b) { - throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.SwitchCase = function(b) { - throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ThrowStatement = function(b) { - throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.TryStatement = function(b) { - throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.CatchClause = function(b) { - throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + c && (b.argument = c); + console.log("ReturnStaement result", b); + return b; }; - a.WhileStatement = function(b) { - var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); - if (d) { - throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.ThisExpression = function(a) { + console.log("ThisExpression component", a); + var b = {}; + if (a = a.userCode) { + b.userCode = a; } - return this.BasicWhile(b, a); - }; - a.DoWhileStatement = function(b) { - throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ForInStatement = function(b) { - throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + console.log("ThisExpression result", b); + return b; }; - a.FunctionDeclaration = function(b) { - if (this.syntax.FunctionDeclaration) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.NewExpression = function(a) { + console.log("NewExpression component", a); + var b = {}, c = a.callee, c = this[c.type](c), arguments = a.arguments, e = [], f; + for (f in arguments) { + var g = arguments[f]; + console.log("NewExpression argument", g); + g = this[g.type](g); + e.push(g); } - return null; - }; - a.VariableDeclaration = function(b) { - throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ThisExpression = function(b) { - return this.scope.this; - }; - a.ArrayExpression = function(b) { - throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.ObjectExpression = function(b) { - throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.Property = function(b) { - throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.FunctionExpression = function(b) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - }; - a.UnaryExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.callee = c; + b.arguments = e; + console.log("NewExpression result", b); + return b; }; - a.UnaryOperator = function() { - return "- + ! ~ typeof void delete".split(" "); + b.getBlockType = function(a) { + return this.blockSyntax[a]; }; - a.updateOperator = function() { - return ["++", "--"]; + b.RegExp = function(a) { + console.log("RegExp", a); + console.log("RegExp result", a); + return a; }; - a.BinaryOperator = function() { - return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); + b.Function = function(a) { + console.log("Function component", a); + console.log("Function result", a); + return a; }; - a.AssignmentExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.EmptyStatement = function(a) { + console.log("EmptyStatement component", a); + console.log("EmptyStatement result", a); + return a; }; - a.AssignmentOperator = function() { - return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); + b.DebuggerStatement = function(a) { + console.log("DebuggerStatement component", a); + console.log("DebuggerStatement result", a); + return a; }; - a.BinaryExpression = function(b) { - var a, d = {}; - a = String(b.operator); - var e = b.left.name; - switch(a) { - case "==": - var f = "object_up" == e || "object_right" == e || "object_down" == e ? "ai_boolean_object" : "radar_up" == e || "radar_right" == e || "radar_down" == e ? "ai_boolean_distance" : null; - break; - case "<": - f = "ai_boolean_distance"; - break; - case "<=": - f = "ai_boolean_distance"; - break; - case ">": - f = "ai_boolean_distance"; - break; - case ">=": - f = "ai_boolean_distance"; - } - if (f) { - e = []; - a = b.left; - if ("Literal" == a.type || "Identifier" == a.type) { - arguments = []; - arguments.push(a); - a = Entry.block[f].params; - for (var g in a) { - var h = a[g].type; - "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); - } - for (var k in arguments) { - a = arguments[k], h = this[a.type](a), (h = Entry.TextCodingUtil.prototype.radarVariableConvertor(h)) && null != h && e.push(h); - } - } else { - h = this[a.type](a), (h = Entry.TextCodingUtil.prototype.radarVariableConvertor(h)) && e.push(h); - } - if (a = String(b.operator)) { - (h = a = Entry.TextCodingUtil.prototype.jTobBinaryOperatorConvertor(a)) && e.push(h), d.operator = a; - } - a = b.right; - if ("Literal" == a.type || "Identifier" == a.type) { - arguments = []; - arguments.push(a); - a = Entry.block[f].params; - for (g in a) { - h = a[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); - } - for (k in arguments) { - if (a = arguments[k], h = this[a.type](a), "string" == typeof h && (g = h.split("_"), "radar" == g[0] && (a = {type:"ai_distance_value", params:[]}, a.params.push(g[1].toUpperCase()), h = a)), h && null != h && ("ai_boolean_object" == f && (h = h.params[0], e.splice(1, 1)), h = Entry.TextCodingUtil.prototype.tTobDropdownValueConvertor(h), e.push(h), console.log("rigth param", e), e[2] && "text" != e[2].type && "ai_distance_value" != e[2].type)) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; - } - } - } else { - h = this[a.type](a), "ai_boolean_object" == f && (h = h.params[0], e.splice(1, 1)), h && e.push(h); - } - d.type = f; - d.params = e; - } else { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; - } - return d; + b.WithStatement = function(a) { + console.log("WithStatement component", a); + console.log("WithStatement result", a); + return a; }; - a.LogicalExpression = function(b) { - var a = {}, d = String(b.operator); - switch(d) { - case "&&": - var e = "ai_boolean_and"; - break; - default: - e = "ai_boolean_and"; - } - var f = [], d = b.left; - if ("Literal" == d.type || "Identifier" == d.type) { - arguments = []; - arguments.push(d); - var d = Entry.block[e].params, g; - for (g in d) { - var h = d[g].type; - "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); - } - for (var k in arguments) { - d = arguments[k], (d = this[d.type](d)) && null != d && f.push(d); - } - } else { - (d = this[d.type](d)) && f.push(d); - } - if (d = String(b.operator)) { - d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), f.push(d); - } - d = b.right; - if ("Literal" == d.type || "Identifier" == d.type) { - arguments = []; - arguments.push(d); - d = Entry.block[e].params; - for (g in d) { - h = d[g].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, g < arguments.length && arguments.splice(g, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, g < arguments.length && arguments.splice(g, 0, h)); - } - for (k in arguments) { - d = arguments[k], (d = this[d.type](d)) && null != d && f.push(d); - } - if ("True" != f[0].type && "ai_boolean_distance" != f[0].type && "ai_boolean_object" != f[0].type && "ai_boolean_and" != f[0].type && "ai_distance_value" != f[0].type) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; - } - if ("True" != f[2].type && "ai_boolean_distance" != f[2].type && "ai_boolean_object" != f[2].type && "ai_boolean_and" != f[2].type && "ai_distance_value" != f[2].type) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; - } - } else { - (d = this[d.type](d)) && f.push(d); - } - a.type = e; - a.params = f; + b.LabeledStatement = function(a) { + console.log("LabeledStatement component", a); + console.log("LabeledStatement result", a); return a; }; - a.LogicalOperator = function() { - return ["||", "&&"]; + b.ContinueStatement = function(a) { + console.log("ContinueStatement component", a); + console.log("ContinueStatement result", a); + return a; }; - a.MemberExpression = function(b) { - var a = b.object, d = b.property, a = this[a.type](a), d = this[d.type](d, a); - if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { - throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; - } - a = d; - if (!a) { - throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; - } + b.SwitchStatement = function(a) { + console.log("SwitchStatement component", a); + console.log("SwitchStatement result", a); return a; }; - a.ConditionalExpression = function(b) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.SwitchCase = function(a) { + console.log("SwitchCase component", a); + console.log("SwitchCase result", a); + return a; }; - a.UpdateExpression = function(b) { - throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + b.ThrowStatement = function(a) { + console.log("ThrowStatement component", a); + console.log("ThrowStatement result", a); + return a; }; - a.CallExpression = function(b) { - var a = b.callee; - b = b.arguments; - for (var d = [], a = this[a.type](a), a = this.syntax.Scope[a], e = Entry.block[a], f = 0;f < b.length;f++) { - var g = b[f], g = this[g.type](g, a); - "Dropdown" != e.params[f].type && "Block" === e.params[f].type && (g = "string" == typeof g ? {type:"text", params:[g]} : "number" == typeof g ? {type:"number", params:[g]} : g); - d.push(g); - } - return {type:a, params:d}; + b.TryStatement = function(a) { + console.log("TryStatement component", a); + console.log("TryStatement result", a); + return a; }; - a.NewExpression = function(b) { - throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.CatchClause = function(a) { + console.log("CatchClause component", a); + console.log("CatchClause result", a); + return a; }; - a.SequenceExpression = function(b) { - throw {message:"SequenceExpression \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + b.DoWhileStatement = function(a) { + console.log("DoWhileStatement component", a); + console.log("DoWhileStatement result", a); + return a; }; - a.initScope = function(b) { - if (null === this.scope) { - var a = function() { - }; - a.prototype = this.syntax.Scope; - } else { - a = function() { - }, a.prototype = this.scope; - } - this.scope = new a; - this.scopeChain.push(this.scope); - return this.scanDefinition(b); + b.ArrayExpression = function(a) { + console.log("ArrayExpression component", a); + console.log("ArrayExpression result", a); + return a; }; - a.unloadScope = function() { - this.scopeChain.pop(); - this.scope = this.scopeChain.length ? this.scopeChain[this.scopeChain.length - 1] : null; + b.ObjectExpression = function(a) { + console.log("ObjectExpression component", a); + console.log("ObjectExpression result", a); + return a; }; - a.scanDefinition = function(b) { - b = b.body; - for (var a = [], d = 0;d < b.length;d++) { - var e = b[d]; - "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); - } + b.Property = function(a) { + console.log("Property component", a); + console.log("Property result", a); return a; }; - a.BasicFunction = function(b, a) { - return null; + b.ConditionalExpression = function(a) { + console.log("ConditionalExpression component", a); + console.log("ConditionalExpression result", a); + return a; }; - a.BasicIteration = function(b, a, d) { - if (10 < a) { - throw {message:"\ubc18\ubcf5 \uc22b\uc790\uac12\uc774 10\uc744 \ub118\uc73c\uba74 \uc548\ub429\ub2c8\ub2e4.", node:b.test}; - } - var c = this.syntax.BasicIteration; - if (!c) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; - } - return {params:[a], type:c, statements:[d]}; + b.SequenceExpression = function(a) { + console.log("SequenceExpression component", a); + console.log("SequenceExpression result", a); + return a; }; - a.BasicWhile = function(b, a) { - var c = b.test.raw; - if (this.syntax.BasicWhile[c]) { - return {type:this.syntax.BasicWhile[c], statements:[a]}; +})(Entry.PyToBlockParser.prototype); +Entry.Parser = function(b, a, d, c) { + this._mode = b; + this.syntax = {}; + this.codeMirror = d; + this._lang = c || "js"; + this._type = a; + this.availableCode = []; + Entry.Parser.PARSE_GENERAL = 0; + Entry.Parser.PARSE_SYNTAX = 1; + Entry.Parser.PARSE_VARIABLE = 2; + Entry.Parser.BLOCK_SKELETON_BASIC = "basic"; + Entry.Parser.BLOCK_SKELETON_BASIC_LOOP = "basic_loop"; + Entry.Parser.BLOCK_SKELETON_BASIC_DOUBLE_LOOP = "basic_double_loop"; + this._console = new Entry.Console; + switch(this._lang) { + case "js": + this._parser = new Entry.JsToBlockParser(this.syntax); + break; + case "py": + this._parser = new Entry.PyToBlockParser(this.syntax); + c = this.syntax; + var e = {}, f; + for (f in c.Scope) { + e[f + "();\n"] = c.Scope[f]; + } + "BasicIf" in c && (e.front = "BasicIf"); + CodeMirror.commands.javascriptComplete = function(a) { + CodeMirror.showHint(a, null, {globalScope:e}); + }; + d.on("keyup", function(a, b) { + (65 <= b.keyCode && 95 >= b.keyCode || 167 == b.keyCode || 190 == b.keyCode) && CodeMirror.showHint(a, null, {completeSingle:!1, globalScope:e}); + }); + break; + case "blockJs": + this._parser = new Entry.BlockToJsParser(this.syntax); + c = this.syntax; + break; + case "blockPy": + this._parser = new Entry.BlockToPyParser(this.syntax), c = this.syntax; + } +}; +(function(b) { + b.setParser = function(a, b, c) { + this._mode = a; + this._type = b; + this._cm = c; + this.syntax = this.mappingSyntax(a); + switch(b) { + case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK: + this._parser = new Entry.JsToBlockParser(this.syntax); + this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK; + break; + case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK: + this._parser = new Entry.PyToBlockParser(this.syntax); + this._parserType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK; + break; + case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS: + this._parser = new Entry.BlockToJsParser(this.syntax); + a = this.syntax; + var e = {}, f; + for (f in a.Scope) { + e[f + "();\n"] = a.Scope[f]; + } + c.on("keydown", function(a, b) { + var d = b.keyCode; + (65 <= d && 95 >= d || 167 == d || !b.shiftKey && 190 == d) && CodeMirror.showHint(a, null, {completeSingle:!1, globalScope:e}); + }); + this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK; + break; + case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY: + this._parser = new Entry.BlockToPyParser(this.syntax), c.setOption("mode", {name:"python", globalVars:!0}), c.markText({line:0, ch:0}, {line:5}, {readOnly:!0}), this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; } - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; }; - a.BasicIf = function(b) { - var a = {params:[], statements:[]}, d, e = [], f = [], g = [], h = b.consequent; - if (h) { - var k = this[h.type](h) - } - if (h = b.alternate) { - var l = this[h.type](h) - } - try { - var m = b.test.operator ? "===" === b.test.operator ? "==" : b.test.operator : null, n = b.test.left && b.test.right ? b.test.left.name + b.test.right.value : null; - if ("frontwall" == n && "==" == m) { - d = this.syntax.BasicIf["front == 'wall'"]; - } else { - if ("fronthump" == n && "==" == m) { - d = this.syntax.BasicIf["front == 'hump'"]; - } else { - if ("frontstone" == n && "==" == m) { - d = this.syntax.BasicIf["front == 'stone'"]; - } else { - if ("frontbee" == n && "==" == m) { - d = this.syntax.BasicIf["front == 'bee'"]; + b.parse = function(a, b) { + var c = null; + switch(this._type) { + case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK: + try { + var e = []; + e.push(a); + var f = [], g; + for (g in e) { + var h = e[g], h = h.trim(), k = acorn.parse(h); + f.push(k); + } + c = this._parser.Program(f); + } catch (q) { + if (this.codeMirror) { + q instanceof SyntaxError ? (c = {from:{line:q.loc.line - 1, ch:0}, to:{line:q.loc.line - 1, ch:q.loc.column}}, q.message = "\ubb38\ubc95(Syntax) \uc624\ub958\uc785\ub2c8\ub2e4.", q.type = 1) : (c = this.getLineNumber(q.node.start, q.node.end), c.message = q.message, c.severity = "converting error", q.type = 2); + this.codeMirror.markText(c.from, c.to, {className:"CodeMirror-lint-mark-error", __annotation:c, clearOnEnter:!0}); + c = q.title ? q.title : "\ubb38\ubc95 \uc624\ub958"; + if (2 == q.type && q.message) { + var l = q.message } else { - if (b.test.value || b.test.left && b.test.right) { - d = "ai_if_else"; - var q = this[b.test.type](b.test, this.syntax.Scope); - g.push(q); - } else { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; - } + 2 != q.type || q.message ? 1 == q.type && (l = "\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694.") : l = "\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694."; } + Entry.toast.alert(c, l); + l = {}; + l.boardType = Entry.Workspace.MODE_BOARD; + l.textType = Entry.Vim.TEXT_TYPE_JS; + l.runType = Entry.Vim.MAZE_MODE; + Ntry.dispatchEvent("textError", l); + throw q; + } + c = []; + } + break; + case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK: + try { + var m = new Entry.PyAstGenerator, e = a.split("\n\n"), n; + for (n in e) { + h = e[n], -1 != h.search("import") ? e[n] = "" : (h = Entry.TextCodingUtil.prototype.entryEventFuncFilter(h), e[n] = h); + } + f = []; + for (g in e) { + h = e[g], k = m.generate(h), "Program" == k.type && 0 != k.body.length && f.push(k); + } + c = this._parser.Program(f); + this._parser._variableMap.clear(); + } catch (q) { + if (this.codeMirror) { + throw q instanceof SyntaxError ? (c = {from:{line:q.loc.line - 1, ch:q.loc.column - 2}, to:{line:q.loc.line - 1, ch:q.loc.column + 1}}, q.message = "\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4.") : (c = this.getLineNumber(q.node.start, q.node.end), c.message = q.message, c.severity = "error"), l = parseInt(c.to.line) + 1, c.from.line = l - 1, c.to.line = l, this.codeMirror.markText(c.from, c.to, {className:"CodeMirror-lint-mark-error", __annotation:c, clearOnEnter:!0}), c = q.title ? + q.title : "\ubb38\ubc95 \uc624\ub958", l = q.message && l ? q.message + " (line: " + l + ")" : "\ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694", Entry.toast.alert(c, l), q; } + c = []; } - } - d ? (k && 0 != k.length && a.statements.push(k), l && 0 != l.length && a.statements.push(l), d && (a.type = d), g && 0 != g.length && (a.params = g)) : (k && 0 != k.length && (e = k), l && 0 != l.length && (f = l), d && (a.type = d), g && 0 != g.length && (a.params = g), a.statements = [e, f]); - return a; - } catch (r) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; - } - }; -})(Entry.JsToBlockParser.prototype); -Entry.PyToBlockParser = function(a) { - this.blockSyntax = a; - this._blockStatmentIndex = 0; - this._blockStatments = []; - this._variableMap = new Entry.Map; - this._funcMap = new Entry.Map; - this._paramQ = new Entry.Queue; -}; -(function(a) { - a.Program = function(b) { - var a = [], d; - for (d in b) { - if ("Program" != b[d].type) { - return; - } - var e = [], f = b[d].body; - console.log("nodes", f); - for (d in f) { - var g = f[d]; - console.log("Program node", g); - g = this[g.type](g); - console.log("result block", g); - g && g.type && e.push(g); - } - console.log("thread", e); - 0 != e.length && a.push(e); + break; + case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS: + c = l = this._parser.Code(a, b); + break; + case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY: + l = this._parser.Code(a, b), this._pyHinter || (this._pyHinter = new Entry.PyHint), c = l; } - return a; + return c; }; - a.ExpressionStatement = function(b) { - console.log("ExpressionStatement component", b); - var a = {}; - b = b.expression; - b.type && (b = this[b.type](b), console.log("ExpressionStatement expressionData", b), b.type && b.params ? (a.type = b.type, a.params = b.params, result = a) : b.type ? (a.type = b.type, result = a) : result = b); - console.log("ExpressionStatement result", result); - return result; + b.getLineNumber = function(a, b) { + var c = this.codeMirror.getValue(), e = {from:{}, to:{}}, f = c.substring(0, a).split(/\n/gi); + e.from.line = f.length - 1; + e.from.ch = f[f.length - 1].length; + c = c.substring(0, b).split(/\n/gi); + e.to.line = c.length - 1; + e.to.ch = c[c.length - 1].length; + return e; }; - a.CallExpression = function(b) { - console.log("CallExpression component", b); - var a = {}, d = [], e, f = b.callee, g = this[f.type](f); - console.log("CallExpression calleeData", g); - arguments = b.arguments; - if ("Identifier" == f.type) { - console.log("CallExpression Identifier calleeData", g), a.callee = g, t = Entry.TextCodingUtil.prototype.eventBlockSyntaxFilter(g.name), e = this.getBlockType(t); - } else { - var h = g.object; - e = g.property; - if (h.statements && "call" == e.name && 0 == e.userCode) { - e = h.statements, console.log("CallExpression statement", e), a.statements = e; - } else { - var k = h.name ? String(h.name).concat(".").concat(String(e.name)) : h.object.name ? String(h.object.name).concat(".").concat(String(h.property.name)).concat(".").concat(String(e.name)) : null - } - console.log("CallExpression calleeName", k); - e = this.getBlockType(k); - console.log("CallExpression type before", e); - if (k) { - var l = k.split(".") - } - console.log("CallExpression calleeTokens", l); - if ("__pythonRuntime.functions.range" == k) { - var m = "%1number#"; - e = this.getBlockType(m); - } else { - if ("__pythonRuntime.ops.add" == k) { - m = "(%1 %2calc_basic# %3)", e = this.getBlockType(m), f = {raw:"PLUS", type:"Literal", value:"PLUS"}, console.log("arguments geniuse", arguments), 2 == arguments.length && arguments.splice(1, 0, f), a.operator = "PLUS"; - } else { - if ("__pythonRuntime.ops.multiply" == k) { - m = "(%1 %2calc_basic# %3)", e = this.getBlockType(m), f = {raw:"MULTI", type:"Literal", value:"MULTI"}, 2 == arguments.length && arguments.splice(1, 0, f), a.operator = "MULTI"; - } else { - if ("__pythonRuntime.ops.in" == k) { - m = "%4 in %2", e = this.getBlockType(m); - } else { - if ("__pythonRuntime.functions.len" == k) { - m = "len", e = this.getBlockType(m); - } else { - if ("Identifier" == f.object.type && "append" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "append" == l[2]) { - m = "%2.append", e = this.getBlockType(m); - } else { - if ("Identifier" == f.object.type && "insert" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "insert" == l[2]) { - m = "%2.insert", e = this.getBlockType(m); - } else { - if ("Identifier" == f.object.type && "pop" == l[1] || "MemberExpression" == f.object.type && "self" == l[0] && "pop" == l[2]) { - m = "%2.pop", e = this.getBlockType(m); - } - } - } + b.mappingSyntax = function(a) { + for (var b = Object.keys(Entry.block), c = {}, e = 0;e < b.length;e++) { + var f = b[e], g = Entry.block[f]; + if (a === Entry.Vim.MAZE_MODE) { + if (-1 < this.availableCode.indexOf(f) && (g = g.syntax)) { + for (var h = c, k = 0;k < g.length;k++) { + var l = g[k]; + if (!(-1 < l.indexOf("%"))) { + var m = l.indexOf("("); + -1 < m && (l = l.substring(0, m)); + if (k === g.length - 2 && "function" === typeof g[k + 1]) { + h[l] = g[k + 1]; + break; } + h[l] || (h[l] = {}); + k === g.length - 1 ? h[l] = f : h = h[l]; } } } - } - a.callee = k; - } - console.log("CallExpression type after", e); - if (e) { - var n = Entry.block[e], f = n.params, n = n.def.params; - console.log("CallExpression component.arguments", arguments); - console.log("CallExpression paramsMeta", f); - console.log("CallExpression paramsDefMeta", n); - for (var q in f) { - h = f[q].type, "Indicator" == h ? (h = {raw:null, type:"Literal", value:null}, q < arguments.length && arguments.splice(q, 0, h)) : "Text" == h && (h = {raw:"", type:"Literal", value:""}, q < arguments.length && arguments.splice(q, 0, h)); - } - console.log("CallExpression arguments", arguments); - for (var r in arguments) { - if (q = arguments[r]) { - console.log("CallExpression argument", q, "typeof", typeof q), q = this[q.type](q, f[r], n[r], !0), console.log("CallExpression param", q), "__pythonRuntime.functions.range" == k && q.type ? (e = q.type, d = q.params) : d.push(q); - } - } - console.log("CallExpression syntax", m); - console.log("CallExpression argument params", d); - if ("%2.append" == m || "%2.pop" == m) { - if ("self" == l[0]) { - var h = Entry.playground.object, t = l[1]; - if (!Entry.TextCodingUtil.prototype.isLocalListExisted(t, h)) { - return a; - } - } else { - if (t = l[0], !Entry.TextCodingUtil.prototype.isGlobalListExisted(t)) { - return a; - } - } - console.log("CallExpression append calleeData", g); - r = this.ParamDropdownDynamic(t, f[1], n[1]); - console.log("CallExpression listName", r); - d.push(r); - console.log("CallExpression params[0]", d[0]); - "%2.pop" == m && ("number" == d[0].type ? d[0].params[0] += 1 : "text" == d[0].type && (d[0].params[0] = String(Number(d[0].params[0]) + 1))); } else { - if ("%2.insert" == m) { - if ("self" == l[0]) { - if (h = Entry.playground.object, t = l[1], !Entry.TextCodingUtil.prototype.isLocalListExisted(t, h)) { - return a; - } - } else { - if (t = l[0], !Entry.TextCodingUtil.prototype.isGlobalListExisted(t)) { - return a; - } + if (a === Entry.Vim.WORKSPACE_MODE) { + for (l in f = Entry.block, f) { + g = f[l], h = null, g.syntax && g.syntax.py && (h = g.syntax.py), h && (h = String(h), g = h.split("("), 0 != g[0].length && (h = g[0]), c[h] = l); } - console.log("CallExpression insert params", d); - d.pop(); - console.log("CallExpression append calleeData", g); - r = this.ParamDropdownDynamic(t, f[1], n[1]); - console.log("CallExpression listName", r); - d.splice(0, 0, r); - console.log("CallExpression check arguments", arguments); - console.log("CallExpression arguments[1] 2", arguments[1]); - q = this[arguments[1].type](arguments[1], f[2], n[2], !0); - console.log("CallExpression check param", q); - d.splice(0, 0, q); - console.log("CallExpression insert params", d); - "number" == d[2].type ? d[2].params[0] += 1 : "text" == d[2].type && (d[2].params[0] = String(Number(d[2].params[0]) + 1)); - } else { - "len" == m ? (r = this.ParamDropdownDynamic(d[1].name, f[1], n[1]), delete d[1], d[1] = r) : "%4 in %2" == m && (q = b.arguments[1], q = this[q.type](q, f[3], n[3], !0), r = b.arguments[3].name, r = this.ParamDropdownDynamic(r, f[1], n[1]), d = [], d.push(""), d.push(r), d.push(""), d.push(q), d.push("")); } } - e && (a.type = e); - d && (a.params = d); - } else { - d = []; - for (r in arguments) { - q = arguments[r], console.log("CallExpression argument", q, "typeof", typeof q), f = this[q.type](q), console.log("CallExpression argumentData", f), "__pythonRuntime.utils.createParamsObj" == f.callee ? d = f.arguments : d.push(f); - } - console.log("CallExpression args", d); - a.arguments = d; - } - console.log("CallExpression Function Check result", a); - if (a.arguments && a.arguments[0] && "__pythonRuntime.utils.createParamsObj" == a.arguments[0].callee) { - return a; } - a.callee && (d = a.callee.name + (a.arguments ? a.arguments.length : 0), console.log("funcKey", d), e = this._funcMap.get(d)) && (a = {}, a.type = e); - console.log("CallExpression result", a); - return a; + return c; }; - a.Identifier = function(b, a, d) { - console.log("Identifier component", b, "paramMeta", a, "paramDefMeta", d); - a = {}; - a.name = b.name; - if (!0 === b.userCode || !1 === b.userCode) { - a.userCode = b.userCode; - } - if (d = this.getBlockType("%1")) { - b = b.name; - var c = Entry.block[d], f = c.params, c = c.def.params; - if (!Entry.TextCodingUtil.prototype.isGlobalVariableExisted(b)) { - return a; - } - var g = [], h, k; - for (k in f) { - console.log("Identifiler paramsMeta, paramsDefMeta", f[k], c[k]), "Text" != f[k].type && (h = this["Param" + f[k].type](b, f[k], c[k])); - } - console.log("Identifiler param", h); - h && g.push(h); - a.type = d; - 0 != g.length && (a.params = g); - } - console.log("Identifiler result", a); - return a; + b.setAvailableCode = function(a, b) { + var c = [], e; + a instanceof Entry.Code ? e = a.getBlockList() : a.forEach(function(a, b) { + e.concat(a); + }); + e.forEach(function(a) { + c.push(a.type); + }); + e = []; + b instanceof Entry.Code ? e = b.getBlockList() : b.forEach(function(a, b) { + e.concat(a); + }); + e.forEach(function(a) { + -1 === c.indexOf(a.type) && c.push(a.type); + }); + this.availableCode = this.availableCode.concat(c); }; - a.VariableDeclaration = function(b) { - console.log("VariableDeclaration component", b); - var a = {declarations:[]}, d, e; - b = b.declarations; - for (var f in b) { - var g = b[f], g = this[g.type](g); - console.log("VariableDeclaration declarationData", g); - g && a.declarations.push(g); - g && g.type && (d = g.type); - g && g.params && (e = g.params); + b.findErrorInfo = function(a) { + var b = 0, c = 0, e = this.codeMirror.getValue().split("\n"), f; + for (f in e) { + var g = e[f].trim(); + b++; + if (!(0 == g.length || 1 == g.length || -1 < g.indexOf("else")) && (c++, c == a.blockCount)) { + break; + } } - d && (a.type = d); - e && (a.params = e); - console.log("VariableDeclaration result", a); - return a; + return {lineNumber:b - b, location:a.node}; }; - a.VariableDeclarator = function(b) { - console.log("VariableDeclarator component", b); - var a = {}, d, e; - e = b.id; - var f = b.init; - if ("__params0" != e.name && "__formalsIndex0" != e.name && "__args0" != e.name) { - if (f.callee && "__getParam0" == f.callee.name) { - return a.name = e.name, a; - } - var g; - console.log("VariableDeclarator init", f); - if (f.callee && f.callee.object && f.callee.property) { - if (f.callee.object.object && f.callee.object.object.name) { - var h = f.callee.object.object.name - } - if (f.callee.object.property && f.callee.object.property.name) { - var k = f.callee.object.property.name - } - if (f.callee.property.name) { - var l = f.callee.property.name - } - h && k && l && (g = h.concat(".").concat(k).concat(".").concat(l)); +})(Entry.Parser.prototype); +Entry.PyBlockAssembler = function(b) { + this.blockSyntax = b; + this._blockStatmentIndex = 0; + this._blockStatments = []; +}; +(function(b) { + b.Program = function(a) { + var b = [], c; + for (c in a) { + if ("Program" != a[c].type) { + return; } - if ("__pythonRuntime.objects.list" == g) { - h = this[e.type](e); - console.log("VariableDeclarator idData", h); - a.id = h; - g = this[f.type](f); - console.log("VariableDeclarator initData", g); - a.init = g; - h = e.name; - f = []; - arguments = g.arguments; - for (d in arguments) { - var m = {}; - m.data = String(arguments[d].params[0]); - f.push(m); - } - Entry.TextCodingUtil.prototype.isGlobalListExisted(h) ? Entry.TextCodingUtil.prototype.updateGlobalList(h, f) : Entry.TextCodingUtil.prototype.createGlobalList(h, f); - } else { - h = e.name; - g = "Literal" == f.type ? f.value : "Identifier" == f.type ? f.name : NaN; - console.log("variable name", h, "value", g); - g && NaN != g && (h.includes("__filbert") || (Entry.TextCodingUtil.prototype.isGlobalVariableExisted(h) ? Entry.TextCodingUtil.prototype.updateGlobalVariable(h, g) : Entry.TextCodingUtil.prototype.createGlobalVariable(h, g))); - h = this[e.type](e); - console.log("VariableDeclarator idData", h); - a.id = h; - g = this[f.type](f); - console.log("VariableDeclarator initData", g); - a.init = g; - console.log("VariableDeclarator init.type", f.type); - if ("Literal" == f.type) { - d = e = this.getBlockType("%1 = %2"); - } else { - if (g.params && g.params[0] && g.params[0].name && h.name == g.params[0].name) { - if (console.log("VariableDeclarator idData.name", h.name, "initData.params[0].name", g.params[0].name), d = e = this.getBlockType("%1 += %2"), "PLUS" != g.operator) { - return a; - } - } else { - d = e = this.getBlockType("%1 = %2"); - } - } - k = Entry.block[e]; - e = k.params; - k = k.def.params; - h.name && (m = this.ParamDropdownDynamic(h.name, e[0], k[0])); - e = []; - "Literal" == f.type ? (h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g)) : (console.log("VariableDeclarator idData", h, "initData", g), g.params && g.params[0] && h.name == g.params[0].name ? (console.log("in initData.params[0]"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g.params[2])) : (console.log("in initData"), h.params && h.params[0] ? e.push(h.params[0]) : e.push(m), e.push(g))); - a.type = d; - a.params = e; + var e = [], f = a[c].body; + console.log("nodes", f); + for (c in f) { + var g = f[c], g = this[g.type](g); + console.log("checkitout", g); + g = this._assembler[g.type](g); + e.push(g); } - console.log("VariableDeclarator result", a); - return a; - } - }; - a.Literal = function(b, a, d, e) { - console.log("Literal component", b, "paramMeta", a, "paramDefMeta", d, "aflag", e); - e = b.value; - console.log("Literal value", e); - a || (a = {type:"Block"}, d || (d = "number" == typeof e ? {type:"number"} : {type:"text"})); - if ("Indicator" == a.type) { - return null; - } - if ("Text" == a.type) { - return ""; + console.log("thread", e); + b.push(e); } - console.log("Literal paramMeta", a, "paramDefMeta", d); - null != b.value ? (a = this["Param" + a.type](e, a, d), console.log("Literal param", void 0)) : (a = [], d = this[b.left.type](b.left), a.push(d), a.push(b.operator), b = this[b.right.type](b.right), a.push(b)); - b = a; - console.log("Literal result", b); return b; }; - a.ParamBlock = function(b, a, d) { - console.log("ParamBlock value", b, "paramMeta", a, "paramDefMeta", d); - a = {}; - var c = b, f = []; - if (!0 === b) { - return a.type = "True", a; - } - if (!1 === b) { - return a.type = "False", a; - } - var g = Entry.block[d.type], h = g.params, g = g.def.params; - if (h && 0 != h.length) { - for (var k in h) { - console.log("aaa", h[k], "bbb", g[k]), c = this["Param" + h[k].type](b, h[k], g[k]); + b.ExpressionStatement = function(a) { + console.log("ExpressionStatement component", a); + var b = {}; + a = a.expression; + "Literal" == a.type ? (a = this[a.type]({type:"Block", accept:"booleanMagnet"}, a), b.type = a.type, result = b, console.log("ExpressionStatement type literal", result)) : (a = this[a.type](a), b.type = a.type, b.params = a.params, result = b, console.log("ExpressionStatement type not literal", result)); + console.log("ExpressionStatement result", result); + return result; + }; + b.AssignmentExpression = function(a) { + console.log("AssignmentExpression component", a); + var b = [], c; + c = a.left; + c.type ? ("Literal" == c.type ? (c = this[c.type](paramsMeta[0], c), console.log("AssignmentExpression left Literal param", c)) : c = this[c.type](c), c && b.push(c), console.log("AssignmentExpression left param", c)) : (c = a.left, this[c.type](c)); + operator = String(a.operator); + console.log("AssignmentExpression operator", operator); + operator && (c = operator = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator), b.push(c)); + c = a.right; + c.type ? ("Literal" == c.type ? (c = this[c.type](paramsMeta[2], c), console.log("AssignmentExpression right Literal param", c)) : c = this[c.type](c), c && b.push(c), console.log("AssignmentExpression right param", c)) : (c = a.right, this[c.type](c)); + console.log("AssignmentExpression params", b); + console.log("AssignmentExpression result", result); + return result; + }; + b.CallExpression = function(a) { + console.log("CallExpression component", a); + var b; + b = {}; + var c = a.callee, c = this[c.type](c); + console.log("CallExpression calleeData", c, "calleeData typeof", typeof c); + var e = "object" != typeof c.object ? String(c.object).concat(".").concat(String(c.property)) : String(c.object.object).concat(".").concat(String(c.object.property)).concat(".").concat(String(c.property)); + console.log("CallExpression syntax", e); + c = this.getBlockType(e); + console.log("CallExpression type1", c); + c || "__pythonRuntime.functions.range" == e && (c = "repeat_basic"); + console.log("CallExpression type2", c); + e = Entry.block[c].params; + console.log("CallExpression paramsMeta", e); + var arguments = a.arguments, f = [], g; + for (g in arguments) { + var h = arguments[g]; + console.log("CallExpression argument", h); + if ("Literal" == h.type) { + var k = e[g]; + "Indicator" == k.type ? (h = null, f.push(h), g--) : (console.log("CallExpression argument index", h.type, g), h = this[h.type](k, h, c, g), f.push(h)); + g == arguments.length - 1 && (console.log("CallExpression in1"), g < e.length && (console.log("CallExpression in2"), f.push(null))); + console.log("CallExpression i", g); } - } else { - c = b; } - console.log("ParamBlock param", c); - f.push(c); - a.type = d.type; - a.params = f; - console.log("ParamBlock result", a); - return a; - }; - a.ParamAngle = function(b, a, d) { - console.log("ParamAngle value, paramMeta, paramDefMeta", b, a, d); + console.log("CallExpression params", f); + b.type = c; + b.params = f; + console.log("CallExpression result", b); return b; }; - a.ParamTextInput = function(b, a, d) { - console.log("ParamTextInput value, paramMeta, paramDefMeta", b, a, d); - return b; + b.Literal = function(a, b, c, e) { + console.log("Literal paramMeta component particularIndex blockType", a, b, c, e); + b = b.value; + a = c ? this["Param" + a.type](a, b, c, e) : this["Param" + a.type](a, b); + console.log("Literal result", a); + return a; }; - a.ParamColor = function(b, a, d) { - console.log("ParamColor value, paramMeta, paramDefMeta", b, a, d); + b.ParamColor = function(a, b) { + console.log("ParamColor paramMeta value", a, b); console.log("ParamColor result", b); return b; }; - a.ParamDropdown = function(b, a, d) { - console.log("ParamDropdown value, paramMeta, paramDefMeta", b, a, d); + b.ParamDropdown = function(a, b) { + console.log("ParamDropdown paramMeta value", a, b); + console.log("ParamDropdownDynamic result", b); + return b; + }; + b.ParamDropdownDynamic = function(a, b) { + console.log("ParamDropdownDynamic paramMeta value", a, b); var c; - a = a.options; - console.log("options", a); - for (var f in a) { - if (d = a[f], b == d[1]) { - c = d[1]; + if ("mouse" == b) { + return "mouse"; + } + var e = a.options, f; + for (f in e) { + if (console.log("options", e), b == e[f][0]) { + console.log("options[i][0]", e[f][0]); + c = e[f][1]; break; } } - c && (c = String(c)); - console.log("ParamDropdown result", c); + console.log("ParamDropdownDynamic result", c); return c; }; - a.ParamDropdownDynamic = function(b, a, d) { - console.log("ParamDropdownDynamic value, paramMeta, paramDefMeta", b, a, d); + b.ParamKeyboard = function(a, b) { + console.log("ParamKeyboard paramMeta value", a, b); var c; - if ("mouse" == b || "wall" == b || "wall_up" == b || "wall_down" == b || "wall_right" == b || "wall_left" == b) { - return b; - } - a = a.options; - console.log("ParamDropdownDynamic options", a); - for (var f in a) { - if (b == a[f][0]) { - console.log("options[i][0]", a[f][0]); - c = a[f][1]; - break; + c = Entry.KeyboardCodeMap.prototype.keyCharToCode[b]; + console.log("ParamKeyboard result", c); + return c; + }; + b.ParamBlock = function(a, b, c, e) { + console.log("ParamBlock paramMeta value blockType", a, b, c, e); + var f = {}, g = []; + c = Entry.TextCodingUtil.prototype.particularParam(c); + if (null != c) { + var h = c[e]; + if (h) { + h = c[e]; + console.log("ParamBlock particularType", h); + e = h; + f.type = e; + c = Entry.block[e].params; + console.log("ParamBlock particular block paramsMeta", a); + var k, l; + for (l in c) { + a = c[l]; + a = a.options; + for (var m in a) { + h = a[m], b == h[0] && (k = h[1]); + } + } + g.push(k); + f.params = g; + } else { + switch(e = typeof b, e) { + case "number": + f.type = "number"; + g.push(b); + f.params = g; + break; + case "boolean": + 1 == b ? f.type = "True" : 0 == b && (f.type = "False"); + break; + default: + f.type = "text", g.push(b), f.params = g; + } + } + } else { + switch(e = typeof b, e) { + case "number": + f.type = "number"; + g.push(b); + f.params = g; + break; + case "boolean": + 1 == b ? f.type = "True" : 0 == b && (f.type = "False"); + break; + default: + f.type = "text", g.push(b), f.params = g; } } - c && (c = String(c)); - console.log("ParamDropdownDynamic result", c); - return c; + console.log("ParamBlock valueType", e); + console.log("ParamBlock result", f); + return f; }; - a.ParamKeyboard = function(b, a, d) { - console.log("ParamKeyboard value, paramMeta, paramDefMeta", b, a, d); - b = Entry.KeyboardCode.prototype.keyCharToCode[b]; - console.log("ParamKeyboard result", b); + b.Indicator = function(a, b, c) { + }; + b.MemberExpression = function(a) { + console.log("MemberExpression component", a); + var b = {}, c = a.object; + a = a.property; + c = this[c.type](c); + a = this[a.type](a); + console.log("MemberExpression objectData", c); + console.log("MemberExpression structure", a); + b.object = c; + b.property = a; + console.log("MemberExpression result", b); return b; }; - a.Indicator = function(b, a, d) { + b.Identifier = function(a) { + console.log("Identifiler component", a); + a = a.name; + console.log("Identifiler result", a); + return a; }; - a.MemberExpression = function(b) { - console.log("MemberExpression component", b); - var a = {}, d, e = b.object, f = b.property; - d = this[e.type](e); - a.object = d; - var g = this[f.type](f); - a.property = g; - console.log("MemberExpression objectData", d); - console.log("MemberExpression propertyData", g); - if ("call" == g.name && 0 == g.userCode) { - return a; - } - if ("__pythonRuntime.ops.subscriptIndex" == g.callee) { - e = Entry.playground.object; - if (d.object && "self" == d.object.name) { - if (f = d.property.name, !Entry.TextCodingUtil.prototype.isLocalListExisted(f, e)) { - return a; + b.WhileStatement = function(a) { + console.log("WhileStatement component", a); + var b = {}, c = a.test, e; + 1 == c.value && (e = this.getBlockType("while True:\n$1")); + console.log("WhileStatement type", e); + var f = Entry.block[e].params; + console.log("WhileStatement paramsMeta", f); + var g = []; + c && (c.type = "Literal", f = f[0], c = "Indicator" == f.type ? null : this[c.type](f, c), g.push(c)); + c = []; + a = a.body.body; + for (var h in a) { + f = a[h], f = this[f.type](f), c.push(f); + } + b.type = e; + b.params = g; + b.statements = []; + b.statements.push(c); + console.log("WhileStatement result", b); + return b; + }; + b.BlockStatement = function(a) { + console.log("BlockStatement component", a); + this._blockStatmentIndex = 0; + this._blockStatments = []; + var b = {}; + a = a.body; + for (var c in a) { + var e = a[c]; + console.log("BlockStatement body", e, "i", c); + e = this[e.type](e); + console.log("BlockStatement bodyData", e, "i", c); + if (e.declarations) { + console.log("BlockStatement statements type params bodyData", c, e); + var e = e.declarations, f; + for (f in e) { + var g = e[f]; + g.init.type && (b.type = g.init.type); + g.init.params && (console.log("BlockStatement params", g.init.params), b.params = g.init.params); + console.log("BlockStatement structure", b, "j", f); } } else { - if (f = d.name, !Entry.TextCodingUtil.prototype.isGlobalListExisted(f)) { - return a; + 0 == this._blockStatmentIndex && this._blockStatments.push(e); + } + } + b.statements = [this._blockStatments]; + console.log("BlockStatement result", b); + this._blockStatmentIndex++; + return b; + }; + b.IfStatement = function(a) { + console.log("IfStatement component", a); + var b = {}, c = [], e = [], f = [], g = [], h = a.test, k = a.alternate, l = a.consequent; + a = this.getBlockType(null == k ? "if %1:\n$1" : "if %1:\n$1\nelse:\n$2"); + if (null != h) { + var m = Entry.block[a].params; + console.log("IfStatement paramsMeta", m); + c = []; + h.type = "Literal"; + m = m[0]; + h = "Indicator" == m.type ? null : this[h.type](m, h); + c.push(h); + } + if (null != l) { + for (var n in l.body) { + if (h = l.body[n]) { + h = this[h.type](h), console.log("IfStatement consequent bodyData", h), e.push(h); } } - d = e = this.getBlockType("%2[%4]"); - var arguments = g.arguments, e = Entry.block[e], h = e.params, k = e.def.params, f = this.ParamDropdownDynamic(f, h[1], k[1]); - console.log("MemberExpression listName", f); - g = []; - g.push(""); - g.push(f); - g.push(""); - "number" == arguments[0].type ? arguments[0].params[0] += 1 : "text" == arguments[0].type && (arguments[0].params[0] = String(Number(arguments[0].params[0]) + 1)); - g.push(arguments[0]); - g.push(""); - a.type = d; - a.params = g; - } else { - if (g = [], "self" == e.name) { - d = e = this.getBlockType("%1"); - e = Entry.block[e]; - h = e.params; - k = e.def.params; - f = f.name; - e = Entry.playground.object; - if (!Entry.TextCodingUtil.prototype.isLocalVariableExisted(f, e)) { - return a; + } + if (null != k) { + for (n in k.body) { + if (h = k.body[n]) { + h = this[h.type](h), console.log("IfStatement alternate bodyData", h), f.push(h); } - f = this.ParamDropdownDynamic(f, h[0], k[0]); - g.push(f); - a.type = d; - 0 != g.length && (a.params = g); - } else { - return a; } } - console.log("MemberExpression result", a); + 0 != e.length && g.push(e); + 0 != f.length && g.push(f); + b.type = a; + 0 != c.length && (b.params = c); + 0 != g.length && (b.statements = g); + console.log("IfStatement result", b); + return b; + }; + b.VariableDeclaration = function(a) { + console.log("VariableDeclaration component", a); + var b = {}, c = []; + a = a.declarations; + for (var e in a) { + var f = a[e], f = this[f.type](f); + console.log("VariableDeclaration declarationData", f); + c.push(f); + } + b.declarations = c; + console.log("VariableDeclaration result", b); + return b; + }; + b.VariableDeclarator = function(a) { + console.log("VariableDeclarator component", a); + var b = {}, c = a.id, e = this[c.type](c); + console.log("VariableDeclarator idData", e); + a = a.init; + a = this[a.type](a); + console.log("VariableDeclarator initData", a); + b.id = c; + b.init = a; + console.log("VariableDeclarator result", b); + return b; + }; + b.BreakStatement = function(a) { + console.log("BreakStatement component", a); + a = {}; + var b = this.getBlockType("break"); + a.type = b; + console.log("BreakStatement result", a); return a; }; - a.WhileStatement = function(b) { - console.log("WhileStatement component", b); - var a; - a = {statements:[]}; - var d = b.test; - console.log("WhileStatement test", d); - if (!0 === d.value) { - var e = this.getBlockType("while True:\n$1") + b.UnaryExpression = function(a) { + console.log("UnaryExpression component", a); + var b = []; + a.prefix && (a = a.operator.concat(a.argument.value), b.push(a)); + result.params = b; + console.log("UnaryExpression result", result); + return result; + }; + b.LogicalExpression = function(a) { + console.log("LogicalExpression component", a); + var b = {}, c = String(a.operator); + switch(c) { + case "&&": + var e = "%1 and %3"; + break; + case "||": + e = "%1 or %3"; + break; + default: + e = "%1 and %3"; } - console.log("WhileStatement type", e); + var e = this.getBlockType(e), f = Entry.block[e].params; + console.log("LogicalExpression paramsMeta", f); + var g = [], c = a.left; + c.type ? ("Literal" == c.type ? (c = this[c.type](f[0], c), console.log("LogicalExpression left Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("LogicalExpression left param", c)) : (c = a.left, this[c.type](c)); + c = String(a.operator); + console.log("LogicalExpression operator", c); + c && (c = Entry.TextCodingUtil.prototype.logicalExpressionConvert(c), g.push(c)); + c = a.right; + c.type ? ("Literal" == c.type ? (c = this[c.type](f[2], c), console.log("LogicalExpression right Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("LogicalExpression right param", c)) : (c = a.right, this[c.type](c)); + b.type = e; + b.params = g; + console.log("LogicalExpression result", b); + return b; + }; + b.BinaryExpression = function(a) { + console.log("BinaryExpression component", a); + var b = {params:[]}, c = String(a.operator); + console.log("BinaryExpression operator", c); + if (c) { + var e = "(%1 %2 %3)" + } + console.log("BinaryExpression syntax", e); + e = this.getBlockType(e); + console.log("BinaryExpression type", e); var f = Entry.block[e].params; - console.log("WhileStatement paramsMeta", f); - var g = []; - if ("Literal" == d.type || "Identifier" == d.type) { - arguments = []; - arguments.push(d); - f = Entry.block[e].params; - d = Entry.block[e].def.params; - console.log("WhileStatement paramsMeta", f); - console.log("WhileStatement paramsDefMeta", d); - for (var h in f) { - var k = f[h].type; - "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); + console.log("BinaryExpression paramsMeta", f); + var g = [], c = a.left; + c.type ? ("Literal" == c.type ? (c = this[c.type](f[0], c), console.log("BinaryExpression left Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("BinaryExpression left param", c)) : (c = a.left, this[c.type](c)); + if (c = String(a.operator)) { + console.log("BinaryExpression operator", c), (c = Entry.TextCodingUtil.prototype.binaryOperatorConvert(c)) && g.push(c); + } + c = a.right; + c.type ? ("Literal" == c.type ? (c = this[c.type](f[2], c), console.log("BinaryExpression right Literal param", c)) : c = this[c.type](c), c && g.push(c), console.log("BinaryExpression right param", c)) : (c = a.right, this[c.type](c)); + console.log("BinaryExpression params", g); + b.type = e; + b.params = g; + console.log("BinaryExpression result", b); + return b; + }; + b.getBlockType = function(a) { + return this.blockSyntax[a]; + }; + b.FunctionDeclaration = function(a) { + console.log("FunctionDeclaration component", a); + console.log("FunctionDeclaration result", void 0); + return a; + }; + b.RegExp = function(a) { + console.log("RegExp", a); + console.log("RegExp result", void 0); + return a; + }; + b.Function = function(a) { + console.log("Function", a); + console.log("Function result", void 0); + return a; + }; + b.EmptyStatement = function(a) { + console.log("EmptyStatement", a); + console.log("EmptyStatement result", void 0); + return a; + }; + b.DebuggerStatement = function(a) { + console.log("DebuggerStatement", a); + console.log("DebuggerStatement result", void 0); + return a; + }; + b.WithStatement = function(a) { + console.log("WithStatement", a); + console.log("WithStatement result", void 0); + return a; + }; + b.ReturnStaement = function(a) { + console.log("ReturnStaement", a); + console.log("ReturnStaement result", void 0); + return a; + }; + b.LabeledStatement = function(a) { + console.log("LabeledStatement", a); + console.log("LabeledStatement result", void 0); + return a; + }; + b.BreakStatement = function(a) { + console.log("BreakStatement", a); + console.log("BreakStatement result", void 0); + return a; + }; + b.ContinueStatement = function(a) { + console.log("ContinueStatement", a); + console.log("ContinueStatement result", void 0); + return a; + }; + b.SwitchStatement = function(a) { + console.log("SwitchStatement", a); + console.log("SwitchStatement result", void 0); + return a; + }; + b.SwitchCase = function(a) { + console.log("SwitchCase", a); + console.log("SwitchCase result", void 0); + return a; + }; + b.ThrowStatement = function(a) { + console.log("ThrowStatement", a); + console.log("ThrowStatement result", void 0); + return a; + }; + b.TryStatement = function(a) { + console.log("TryStatement", a); + console.log("TryStatement result", void 0); + return a; + }; + b.CatchClause = function(a) { + console.log("CatchClause", a); + console.log("CatchClause result", void 0); + return a; + }; + b.DoWhileStatement = function(a) { + console.log("DoWhileStatement", a); + console.log("DoWhileStatement result", void 0); + return a; + }; + b.ForInStatement = function(a) { + console.log("ForInStatement", a); + console.log("ForInStatement result", void 0); + return a; + }; + b.FunctionDeclaration = function(a) { + console.log("FunctionDeclaration", a); + console.log("FunctionDeclaration result", void 0); + return a; + }; + b.ThisExpression = function(a) { + console.log("ThisExpression", a); + console.log("ThisExpression result", void 0); + return a; + }; + b.ArrayExpression = function(a) { + console.log("ArrayExpression", a); + console.log("ArrayExpression result", void 0); + return a; + }; + b.ObjectExpression = function(a) { + console.log("ObjectExpression", a); + console.log("ObjectExpression result", void 0); + return a; + }; + b.Property = function(a) { + console.log("Property", a); + console.log("Property result", void 0); + return a; + }; + b.FunctionExpression = function(a) { + console.log("FunctionExpression", a); + console.log("FunctionExpression result", void 0); + return a; + }; + b.UpdateExpression = function(a) { + console.log("UpdateExpression", a); + console.log("UpdateExpression result", void 0); + return a; + }; + b.ConditionalExpression = function(a) { + console.log("ConditionalExpression", a); + console.log("ConditionalExpression result", void 0); + return a; + }; + b.NewExpression = function(a) { + console.log("NewExpression", a); + console.log("NewExpression result", void 0); + return a; + }; + b.SequenceExpression = function(a) { + console.log("SequenceExpression", a); + console.log("SequenceExpression result", void 0); + return a; + }; +})(Entry.PyBlockAssembler.prototype); +Entry.PyToBlockParserTemp = function(b) { + this._assembler = new Entry.PyBlockAssembler(b); +}; +(function(b) { + b.Program = function(a) { + var b = [], c; + for (c in a) { + if ("Program" != a[c].type) { + return; } - for (var l in arguments) { - h = arguments[l], console.log("WhileStatement argument", h), h = this[h.type](h, f[l], d[l], !0), console.log("WhileStatement Literal param", h), h && null != h && g.push(h); + var e = [], f = a[c].body; + console.log("nodes", f); + for (c in f) { + var g = f[c], g = this[g.type](g); + console.log("checkitout", g); + g = this._assembler[g.type](g); + e.push(g); } - } else { - h = this[d.type](d), console.log("WhileStatement Not Literal param", h), h && null != h && g.push(h); + console.log("thread", e); + b.push(e); } - f = b.body; - f = this[f.type](f); - console.log("WhileStatement bodyData", f); - "True" == g[0].type && (a.type = e, a.statements.push(f.statements)); - console.log("WhileStatement result", a); - return a; + return b; }; - a.BlockStatement = function(b) { - console.log("BlockStatement component", b); - var a = {statements:[], data:[]}, d = [], e = [], f = []; - b = b.body; - console.log("BlockStatement bodies", b); - for (var g in b) { - var h = b[g], h = this[h.type](h); - console.log("BlockStatement bodyData", h); - h && null == h || (f.push(h), console.log("BlockStatement data", f)); + b.Identifier = function(a) { + console.log("Identifier", a); + return {type:a.type, name:a.name}; + }; + b.FunctionDeclaration = function(a) { + console.log("FunctionDeclaration", a); + var b = this[a.id.type](a.id); + return {type:a.type, id:b}; + }; + b.Literal = function(a) { + console.log("Literal", a); + console.log("typeof node at Literal", typeof a.value); + var b; + "string" === typeof a.value ? b = a.value : "boolean" === typeof a.value ? b = a.value : "number" === typeof a.value ? b = a.value : "RegExp" === typeof a.value ? (b = this[typeof a.value](a), b = b.regex.pattern) : b = null; + console.log("value", b); + return {type:a.type, value:b}; + }; + b.RegExp = function(a) { + console.log("RegExp", a); + return {regex:a.regex}; + }; + b.Function = function(a) { + console.log("Function", a); + var b = this[a.id](a), c = [], e; + for (e in a.params) { + c.push(a.params[e]); } - console.log("BlockStatement final data", f); - a.data = f; - console.log("jhlee data check", f); - for (var k in f) { - if (f[1] && "repeat_basic" == f[1].type) { - if (0 == k) { - if (f[k].declarations) { - b = f[0].declarations; - for (k in b) { - h = b[k], (h = h.init) && d.push(h); - } - a.params = d; - } - } else { - if (1 == k) { - a.type = f[k].type; - e = []; - b = f[k].statements[0]; - console.log("BlockStatement allStatements", b); - if (b && 0 != b.length) { - for (g in b) { - h = b[g], console.log("BlockStatement(for) statement", h), h.type && e.push(h); - } - } - console.log("BlockStatement(for) statements", e); - a.statements.push(e); - } - } - } else { - if (f) { - if (0 == k) { - if (f[k] && f[k].declarations) { - b = f[k].declarations; - for (k in b) { - h = b[k], (h = h.init) && d.push(h); - } - a.params = d; - } else { - (h = f[k]) && h.type && e.push(h); - } - } else { - e = []; - if ((b = f) && 0 != b.length) { - for (g in b) { - h = b[g], console.log("BlockStatement statement", h), h && h.type && e.push(h); - } - } - console.log("BlockStatement statements", e); - } - a.statements = e; - } - } + a = this[a.body](a); + return {id:b, params:c, body:a}; + }; + b.ExpressionStatement = function(a) { + var b = this[a.expression.type](a.expression); + return {type:a.type, expression:b}; + }; + b.BlockStatement = function(a) { + console.log("BlockStatement", a); + var b = [], c; + for (c in a.body) { + var e = a.body[c]; + console.log("BlockStatement statement", e); + e = this[e.type](e); + console.log("BlockStatement body", e); + b.push(e); } - console.log("BlockStatement statement result", a); - return a; + console.log("bodies", b); + return {type:a.type, body:b}; }; - a.IfStatement = function(b) { - console.log("IfStatement component", b); - var a; - a = {statements:[]}; - var d, e = [], f = b.consequent, g = b.alternate; - d = null != g ? "if_else" : "_if"; - a.type = d; - console.log("IfStatement type", d); - var h = b.test; - console.log("IfStatement test", h); - if ("Literal" == h.type || "Identifier" == h.type) { - arguments = []; - arguments.push(h); - h = Entry.block[d].params; - d = Entry.block[d].def.params; - console.log("IfStatement paramsMeta", h); - console.log("IfStatement paramsDefMeta", d); - for (var k in h) { - var l = h[k].type; - "Indicator" == l ? (l = {raw:null, type:"Literal", value:null}, k < arguments.length && arguments.splice(k, 0, l)) : "Text" == l && (l = {raw:"", type:"Literal", value:""}, k < arguments.length && arguments.splice(k, 0, l)); - } - for (var m in arguments) { - k = arguments[m], console.log("IfStatement argument", k), k = this[k.type](k, h[m], d[m], !0), console.log("IfStatement Literal param", k), k && null != k && e.push(k); - } + b.EmptyStatement = function(a) { + console.log("EmptyStatement", a); + return {type:a.type}; + }; + b.DebuggerStatement = function(a) { + console.log("DebuggerStatement", a); + return {type:a.type}; + }; + b.WithStatement = function(a) { + console.log("WithStatement", a); + var b = this[a.object.type](a.object), c = this[a.body.type](a.body); + return {type:a.type, object:b, body:c}; + }; + b.ReturnStaement = function(a) { + console.log("ReturnStaement", a); + var b; + b = null === a.argument ? null : this[a.argument.type](a.argument); + return {type:a.type, argument:b}; + }; + b.LabeledStatement = function(a) { + console.log("LabeledStatement", a); + var b = this[a.label.type](a.label), c = this[a.body.type](a.body); + return {type:a.type, label:b, body:c}; + }; + b.BreakStatement = function(a) { + console.log("BreakStatement", a); + var b; + console.log("node.label", a.label); + a.label && null !== a.label ? (console.log("node.label2", a.label), b = this[a.label.type](a.label)) : (console.log("node.lable1", a.label), b = null); + console.log("label", b); + return {type:a.type, label:b}; + }; + b.ContinueStatement = function(a) { + console.log("ContinueStatement", a); + var b; + b = null === a.label ? null : this[a.label.type](a.label); + return {type:a.type, label:b}; + }; + b.IfStatement = function(a) { + console.log("IfStatement", a); + var b = this[a.test.type](a.test), c = {body:[]}; + if (null === a.alternate) { + c = null; } else { - k = this[h.type](h), console.log("IfStatement Not Literal param", k), k && null != k && e.push(k); - } - e && 0 != e.length && (a.params = e); - console.log("IfStatement params result", e); - if (null != f) { - e = []; - console.log("IfStatement consequent", f); - f = this[f.type](f); - console.log("IfStatement consequent data", f); - f = f.data; - console.log("IfStatement consequentsData", f); - for (m in f) { - h = f[m], console.log("IfStatement consData", h), h && (h.init && h.type ? (a.type = h.type, (h = h.statements) && (e = h)) : !h.init && h.type && e.push(h)); + for (var e in a.alternate.body) { + var f = a.alternate.body[e], g = this[f.type](f); + c.body.push(g); } - 0 != e.length && (a.statements[0] = e); } - if (null != g) { - f = []; - console.log("IfStatement alternate", g); - g = this[g.type](g); - console.log("IfStatement alternate data", g); - g = g.data; - for (m in g) { - (e = g[m]) && e.type && f.push(e); - } - 0 != f.length && (a.statements[1] = f); + g = {body:[]}; + for (e in a.consequent.body) { + f = a.consequent.body[e], f = this[f.type](f), g.body.push(f); } - console.log("IfStatement result", a); - return a; + console.log("alternate", c); + console.log("consequent", g); + return {type:a.type, test:b, consequent:g, alternate:c}; }; - a.ForStatement = function(b) { - console.log("ForStatement component", b); - var a = {statements:[]}, d = this.getBlockType("for i in range"); - a.type = d; - if (d = b.init) { - var e = this[d.type](d) + b.SwitchStatement = function(a) { + console.log("SwitchStatement", a); + var b = this[a.discriminant.type](a.discriminant), c = [], e; + for (e in a.cases) { + var f = a.cases[e], f = this[f.type](f); + c.push(f); } - a.init = e; - console.log("ForStatement init", d); - e = b.body.body; - console.log("ForStatement bodies", e); - if (e) { - for (var f in e) { - 0 != f && (d = e[f], console.log("ForStatement bodyData", d, "index", f), d = this[d.type](d), console.log("ForStatement bodyData result", d, "index", f), a.statements.push(d)); - } + return {type:a.type, discriminant:b, cases:c}; + }; + b.SwitchCase = function(a) { + console.log("SwitchCase", a); + var b; + b = null === a.test ? null : this[a.test.type](a.test); + for (var c in a.consequent) { + a = this[statment.type](statment), (void 0).push(a); } - console.log("ForStatement bodyData result", a); - if (f = b.test) { - var g = this[f.type](f) + return {test:b, consequent:void 0}; + }; + b.ThrowStatement = function(a) { + console.log("ThrowStatement", a); + var b = this[a.argument.type](a.argument); + return {type:a.type, argument:b}; + }; + b.TryStatement = function(a) { + console.log("TryStatement", a); + var b = this[a.block.type](a.block), c; + c = null === a.handler ? null : this[a.handler.type](a.handler); + var e; + e = null === a.finalizer ? null : this[a.finalizer.type](a.finalizer); + return {type:a.type, block:b, handler:c, finalizer:e}; + }; + b.CatchClause = function(a) { + console.log("CatchClause", a); + var b = a.param; + a = this[a.body.type](a.body); + return {param:b, body:a}; + }; + b.WhileStatement = function(a) { + console.log("WhileStatement", a); + var b = this[a.test.type](a.test), c = this[a.body.type](a.body); + console.log("WhileStatement test", b); + console.log("WhileStatement body", c); + return {type:a.type, test:b, body:c}; + }; + b.DoWhileStatement = function(a) { + console.log("DoWhileStatement", a); + var b; + b = this[a.init.type](a.init); + var c; + c = null === a.test ? null : this[a.test.type](a.test); + var e; + e = null === a.update ? null : this[a.update.type](a.update); + var f = this[a.body.type](a.body); + return {type:a.type, init:b, test:c, update:e, body:f}; + }; + b.ForStatement = function(a) { + console.log("ForStatement", a); + var b; + if (null === a.init) { + b = null; + } else { + this[a.init.type](a.init); } - a.test = g; - console.log("ForStatement testData", g); - if (b = b.update) { - var h = this[b.type](b) + var c; + c = null === a.test ? null : this[a.test.type](a.test); + var e; + e = null === a.update ? null : this[a.update.type](a.update); + var f = this[a.body.type](a.body); + console.log("ForStatement body", f); + return {type:a.type, init:b, test:c, update:e, body:f}; + }; + b.ForInStatement = function(a) { + console.log("ForInStatement", a); + var b; + b = this[a.left.type](a.left); + var c = this[a.right.type](a.right), e = this[a.body.type](a.body); + return {type:a.type, left:b, right:c, body:e}; + }; + b.FunctionDeclaration = function(a) { + console.log("FunctionDeclaration", a); + return {id:this[a.id.type](a.id)}; + }; + b.VariableDeclaration = function(a) { + console.log("VariableDeclaration", a); + var b = [], c; + for (c in a.declarations) { + var e = a.declarations[c], e = this[e.type](e); + console.log("declaration", e); + b.push(e); } - a.update = h; - console.log("ForStatement updateData", h); - console.log("ForStatement result", a); - return a; + console.log("VariableDeclaration declarations", b); + return {type:a.type, declarations:b, kind:"var"}; }; - a.ForInStatement = function(b) { - console.log("ForInStatement component", b); - console.log("ForInStatement result", null); - return null; + b.VariableDeclarator = function(a) { + console.log("VariableDeclarator", a); + var b = this[a.id.type](a.id), c; + c = null === a.init ? null : this[a.init.type](a.init); + console.log("id", b); + console.log("init", c); + return {type:a.type, id:b, init:c}; }; - a.BreakStatement = function(b) { - console.log("BreakStatement component", b); - b = {}; - var a = this.getBlockType("break"); - console.log("BreakStatement type", a); - b.type = a; - console.log("BreakStatement result", b); - return b; + b.ThisExpression = function(a) { + console.log("ThisExpression", a); + return {type:a.type}; }; - a.UnaryExpression = function(b) { - console.log("UnaryExpression component", b); - var a; - b.prefix && (a = b.operator, b = b.argument, console.log("UnaryExpression operator", a), b.value = Number(a.concat(b.value)), a = this[b.type](b), console.log("UnaryExpression data", a)); - b = a; - console.log("UnaryExpression result", b); - return b; + b.ArrayExpression = function(a) { + console.log("ArrayExpression", a); + var b; + if (null === a.elements) { + b = null; + } else { + for (var c in a.elements) { + var e = a.elements[c], e = this[e.type](e); + b.push(e); + } + } + return {type:a.type, elements:b}; }; - a.LogicalExpression = function(b) { - console.log("LogicalExpression component", b); - var a; - a = {}; - var d = String(b.operator); - switch(d) { - case "&&": - var e = "(%1 and %3)"; + b.ObjectExpression = function(a) { + console.log("ObjectExpression", a); + for (var b in a.properties) { + var c = a.properties[b], c = this[c.type](c); + (void 0).push(c); + } + return {type:a.type, properties:void 0}; + }; + b.Property = function(a) { + console.log("Property", a); + var b = this[a.key.type](a.key), c = this[a.value.type](a.value); + return {type:a.type, key:b, value:c, kind:a.kind}; + }; + b.FunctionExpression = function(a) { + console.log("FunctionExpression", a); + return {type:a.type}; + }; + b.UnaryExpression = function(a) { + console.log("UnaryExpression", a); + var b; + switch(a.operator) { + case "-": + b = a.operator; break; - case "||": - e = "(%1 or %3)"; + case "+": + b = a.operator; + break; + case "!": + b = a.operator; + break; + case "~": + b = a.operator; + break; + case "typeof": + b = a.operator; + break; + case "void": + b = a.operator; + break; + case "delete": + b = a.operator; break; default: - e = "(%1 and %3)"; - } - var e = this.getBlockType(e), f = [], d = b.left; - if ("Literal" == d.type || "Identifier" == d.type) { - arguments = []; - arguments.push(d); - var d = Entry.block[e].params, g = Entry.block[e].def.params; - console.log("LogicalExpression paramsMeta", d); - console.log("LogicalExpression paramsDefMeta", g); - for (var h in d) { - var k = d[h].type; - "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); - } - for (var l in arguments) { - var m = arguments[l]; - console.log("LogicalExpression argument", m); - m = this[m.type](m, d[l], g[l], !0); - console.log("LogicalExpression param", m); - m && null != m && f.push(m); - } - } else { - (m = this[d.type](d)) && f.push(m); + b = null; } - console.log("LogicalExpression left param", m); - d = String(b.operator); - console.log("LogicalExpression operator", d); - d && (m = d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), f.push(m)); - d = b.right; - if ("Literal" == d.type || "Identifier" == d.type) { - arguments = []; - arguments.push(d); - d = Entry.block[e].params; - g = Entry.block[e].def.params; - console.log("LogicalExpression paramsMeta", d); - console.log("LogicalExpression paramsDefMeta", g); - for (h in d) { - k = d[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); - } - for (l in arguments) { - m = arguments[l], console.log("LogicalExpression argument", m), m = this[m.type](m, d[l], g[l], !0), console.log("LogicalExpression param", m), m && null != m && f.push(m); - } - } else { - (m = this[d.type](d)) && f.push(m); + var c = a.prefix, e = this[a.argument.type](a.argument); + return {type:a.type, operator:b, prefix:c, argument:e}; + }; + b.UpdateExpression = function(a) { + console.log("UpdateExpression", a); + var b; + switch(a.operator) { + case "++": + b = a.operator; + break; + case "--": + b = a.operator; + break; + default: + b = null; } - console.log("LogicalExpression right param", m); - a.type = e; - a.params = f; - console.log("LogicalExpression result", a); - return a; + var c = this[a.argument.type](a.argument); + return {type:a.type, operator:b, prefix:a.prefix, argument:c}; }; - a.BinaryExpression = function(b) { - console.log("BinaryExpression component", b); - var a = {}, d = {}, e = String(b.operator); - switch(e) { + b.BinaryExpression = function(a) { + console.log("BinaryExpression", a); + var b; + switch(a.operator) { case "==": - var f = "(%1 %2boolean_compare# %3)"; + b = a.operator; break; case "!=": - f = "(%2 != True)"; + b = a.operator; + break; + case "===": + b = a.operator; + break; + case "!==": + b = a.operator; break; case "<": - f = "(%1 %2boolean_compare# %3)"; + b = a.operator; break; case "<=": - f = "(%1 %2boolean_compare# %3)"; + b = a.operator; + break; + case ">": + b = a.operator; + break; + case ">=": + b = a.operator; + break; + case "<<": + b = a.operator; + break; + case ">>": + b = a.operator; + break; + case ">>>": + b = a.operator; + break; + case "+": + b = a.operator; + break; + case "-": + b = a.operator; + break; + case "*": + b = a.operator; + break; + case "/": + b = a.operator; + break; + case "%": + b = a.operator; + break; + case "|": + b = a.operator; + break; + case "^": + b = a.operator; + break; + case "|": + b = a.operator; + break; + case "&": + b = a.operator; + break; + case "in": + b = a.operator; + break; + case "instanceof": + b = a.operator; + break; + default: + b = null; + } + var c = this[a.left.type](a.left), e = this[a.right.type](a.right); + return {type:a.type, operator:b, left:c, right:e}; + }; + b.AssignmentExpression = function(a) { + console.log("AssignmentExpression", a); + var b; + switch(a.operator) { + case "=": + b = a.operator; + break; + case "+=": + b = a.operator; + break; + case "-=": + b = a.operator; + break; + case "*=": + b = a.operator; + break; + case "/=": + b = a.operator; + break; + case "%=": + b = a.operator; + break; + case "<<=": + b = a.operator; break; - case ">": - f = "(%1 %2boolean_compare# %3)"; + case ">>=": + b = a.operator; break; - case ">=": - f = "(%1 %2boolean_compare# %3)"; + case "|=": + b = a.operator; break; - case "+": - f = "(%1 %2calc_basic# %3)"; + case "^=": + b = a.operator; break; - case "-": - f = "(%1 %2calc_basic# %3)"; + case "&=": + b = a.operator; break; - case "*": - f = "(%1 %2calc_basic# %3)"; + default: + b = null; + } + var c; + c = a.left; + var e = this[a.right.type](a.right); + return {type:a.type, operator:b, left:c, right:e}; + }; + b.LogicalExpression = function(a) { + console.log("LogicalExpression", a); + var b; + switch(a.operator) { + case "||": + b = a.operator; break; - case "/": - f = "(%1 %2calc_basic# %3)"; + case "&&": + b = a.operator; + break; + default: + b = null; } - console.log("BinaryExpression operator", e); - console.log("BinaryExpression syntax", f); - if (f = this.getBlockType(f)) { - console.log("BinaryExpression type", f); - a = []; - e = b.left; - console.log("BinaryExpression left", e); - if ("Literal" == e.type || "Identifier" == e.type) { - arguments = []; - arguments.push(e); - var e = Entry.block[f].params, g = Entry.block[f].def.params; - console.log("BinaryExpression paramsMeta", e); - console.log("BinaryExpression paramsDefMeta", g); - for (var h in e) { - var k = e[h].type; - "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); - } - for (var l in arguments) { - var m = arguments[l]; - console.log("BinaryExpression argument", m); - m = this[m.type](m, e[l], g[l], !0); - console.log("BinaryExpression param", m); - m && null != m && a.push(m); - } - } else { - (m = this[e.type](e)) && a.push(m); - } - console.log("BinaryExpression left params", a); - if ("boolean_not" == f) { - return a.splice(0, 0, ""), a.splice(2, 0, ""), console.log("BinaryExpression boolean_not params", a), d.type = f, d.params = a, d; - } - if (e = String(b.operator)) { - console.log("BinaryExpression operator", e), (m = e = Entry.TextCodingUtil.prototype.binaryOperatorConvert(e)) && a.push(m), d.operator = e; - } - e = b.right; - if ("Literal" == e.type || "Identifier" == e.type) { - arguments = []; - arguments.push(e); - e = Entry.block[f].params; - g = Entry.block[f].def.params; - console.log("BinaryExpression paramsMeta", e); - console.log("BinaryExpression paramsDefMeta", g); - for (h in e) { - k = e[h].type, "Indicator" == k ? (k = {raw:null, type:"Literal", value:null}, h < arguments.length && arguments.splice(h, 0, k)) : "Text" == k && (k = {raw:"", type:"Literal", value:""}, h < arguments.length && arguments.splice(h, 0, k)); - } - for (l in arguments) { - m = arguments[l], console.log("BinaryExpression argument", m), m = this[m.type](m, e[l], g[l], !0), console.log("BinaryExpression param", m), m && null != m && a.push(m); - } - } else { - (m = this[e.type](e)) && a.push(m); - } - console.log("BinaryExpression right param", m); - d.type = f; - d.params = a; - } else { - return a; + var c = this[a.left.type](a.left), e = this[a.right.type](a.right); + return {type:a.type, operator:b, left:c, right:e}; + }; + b.MemberExpression = function(a) { + console.log("MemberExpression", a); + var b = this[a.object.type](a.object), c = this[a.property.type](a.property), e = a.computed; + console.log("object", b); + console.log("property", c); + return {type:a.type, object:b, property:c, computed:e}; + }; + b.ConditionalExpression = function(a) { + console.log("ConditionalExpression", a); + var b = this[a.callee.type](a.callee), c; + for (c in a.arguments) { + var e = a.arguments[c], e = this[e.type](e); + (void 0).push(e); } - console.log("BinaryExpression params", a); - a = d; - console.log("BinaryExpression result", a); - return a; + return {type:a.type, callee:b, arguments:void 0}; }; - a.UpdateExpression = function(b) { - console.log("UpdateExpression", b); - var a = {}, d = b.argument; - if (d) { - var e = this[d.type](d) + b.CallExpression = function(a) { + console.log("CallExpression", a); + var b = this[a.callee.type](a.callee), c = [], e; + for (e in a.arguments) { + var f = a.arguments[e], f = this[f.type](f); + c.push(f); } - a.argument = e; - a.operator = b.operator; - a.prefix = b.prefix; - console.log("UpdateExpression result", a); - return a; + console.log("callee", b); + console.log("arguments", c); + return {type:a.type, callee:b, arguments:c}; }; - a.AssignmentExpression = function(b) { - console.log("AssignmentExpression component", b); - var a = {}, d, e = [], f, g = b.left; - if (g.type) { - var h = this[g.type](g); - console.log("AssignmentExpression leftData", h); - } - console.log("AssignmentExpression leftData", h); - a.left = h; - operator = String(b.operator); - console.log("AssignmentExpression operator", operator); - g = b.right; - if (g.type) { - var k = this[g.type](g); - console.log("AssignmentExpression rightData", k); - } - a.right = k; - switch(operator) { - case "=": - if (k.callee && k.callee.object) { - var l = k.callee.object.object.name.concat(".").concat(k.callee.object.property.name).concat(".").concat(k.callee.property.name) - } - if ("__pythonRuntime.objects.list" == l && "self" == h.object.name) { - var m = h.property.name; - d = []; - var arguments = k.arguments, n; - for (n in arguments) { - var q = {}; - q.data = String(arguments[n].params[0]); - d.push(q); - } - q = Entry.playground.object; - Entry.TextCodingUtil.prototype.isLocalListExisted(m, q) ? Entry.TextCodingUtil.prototype.updateLocalList(m, d, q) : Entry.TextCodingUtil.prototype.createLocalList(m, d, q); - } - if (h.property && "__pythonRuntime.ops.subscriptIndex" == h.property.callee) { - var m = "%1[%2] = %3", r = this.getBlockType(m) - } else { - g.arguments && g.arguments[0] ? (d = b.left.name ? b.left.name : b.left.object.name.concat(b.left.property.name), m = b.right.arguments[0].name ? b.right.arguments[0].name : b.right.arguments[0].object.name.concat(b.right.arguments[0].property.name), console.log("AssignmentExpression leftEx", d, "rightEx", m), m = b.right.arguments && d == m ? "%1 += %2" : "%1 = %2") : m = "%1 = %2", r = this.getBlockType(m); - } - d = r; - } - if (operator) { - var t = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator) - } - a.operator = t; - console.log("AssignmentExpression syntax", m); - h.object ? q = h.object : h.name && (q = h.name); - h.proprty ? f = h.property : h.name && (f = h.name); - console.log("AssignmentExpression object property value", q, f); - if ("%1[%2] = %3" == m) { - f = h.params[1]; - console.log("AssignmentExpression listName", f); - if (!f) { - return a; - } - e.push(f); - f = h.property.arguments[0]; - console.log("AssignmentExpression param 1", f); - console.log("AssignmentExpression param 2", f); - e.push(f); - e.push(k); - } else { - if ("%1 = %2" == m) { - console.log("AssignmentExpression calleeName check", l), q && "self" == q.name && "__pythonRuntime.objects.list" != l ? (q = Entry.block[r], h = q.params, l = q.def.params, m = f.name, (f = "number" == k.type || "text" == k.type ? k.params[0] : NaN) && NaN != f && (q = Entry.playground.object, console.log("final value", f), console.log("final object", q), Entry.TextCodingUtil.prototype.isLocalVariableExisted(m, q) ? Entry.TextCodingUtil.prototype.updateLocalVariable(m, f, q) : Entry.TextCodingUtil.prototype.createLocalVariable(m, - f, q)), m = this.ParamDropdownDynamic(m, h[0], l[0]), e.push(m)) : (q = Entry.block[r], h = q.params, l = q.def.params, console.log("property 123", f), m = f, (f = "number" == k.type || "text" == k.type ? k.params[0] : NaN) && NaN != f && (q = Entry.playground.object, console.log("final object", q), console.log("final value", f), Entry.TextCodingUtil.prototype.isGlobalVariableExisted(m, q) ? Entry.TextCodingUtil.prototype.updateGlobalVariable(m, f, q) : Entry.TextCodingUtil.prototype.createGlobalVariable(m, - f, q)), m = this.ParamDropdownDynamic(m, h[0], l[0]), e.push(m), k.callee && delete k.callee), e.push(k); - } else { - if ("%1 += %2" == m) { - if (q && "self" == q.name) { - if (q = Entry.block[r], h = q.params, l = q.def.params, m = f.name, q = Entry.playground.object, console.log("final object", q), !Entry.TextCodingUtil.prototype.isLocalVariableExisted(m, q)) { - return a; - } - } else { - if (q = Entry.block[r], h = q.params, l = q.def.params, m = f, !Entry.TextCodingUtil.prototype.isGlobalVariableExisted(m)) { - return a; - } - } - m = this.ParamDropdownDynamic(m, h[0], l[0]); - e.push(m); - e.push(k.params[2]); - } - } - } - a.type = d; - a.params = e; - console.log("AssignmentExpression result", a); - return a; + b.NewExpression = function(a) { + console.log("NewExpression", a); + return {type:a.type}; }; - a.FunctionDeclaration = function(b) { - console.log("FunctionDeclaration component", b); - var a = {}, d = b.body; - b = b.id; - if ("__getParam0" == b.name) { - return a; - } - var e = this[d.type](d); - console.log("FunctionDeclaration bodyData", e); - if ("Identifier" == b.type) { - var f = this[b.type](b) - } - console.log("FunctionDeclaration idData", f); - d = []; - b = []; - var f = f.name, e = e.data, g; - for (g in e) { - if (e[g].declarations) { - var h = e[g].declarations; - 0 < h.length && d.push(h[0].name); - } else { - e[g].argument && (h = e[g].argument.statements) && 0 < h.length && (b = h); - } - } - console.log("FunctionDeclaration textFuncName", f); - console.log("FunctionDeclaration textFuncParams", d); - console.log("FunctionDeclaration textFuncStatements", b); - var k, l, m, e = Entry.variableContainer.functions_, n; - for (n in e) { - var q = e[n]; - Entry.TextCodingUtil.prototype.initQueue(); - Entry.TextCodingUtil.prototype.gatherFuncDefParam(q.content._data[0]._data[0].data.params[0]); - console.log("Entry.TextCodingUtil._funcParamQ", Entry.TextCodingUtil.prototype._funcParamQ); - for (var r = [], h = {};g = Entry.TextCodingUtil.prototype._funcParamQ.dequeue();) { - r.push(g), console.log("param", g); - } - console.log("funcParams", r); - for (var t in r) { - h[r[t]] = t; - } - console.log("paramMap", h); - console.log("funcNameQueue", Entry.TextCodingUtil.prototype._funcNameQ); - for (g = [];nameToken = Entry.TextCodingUtil.prototype._funcNameQ.dequeue();) { - g.push(nameToken), console.log("funcNames", nameToken); - } - Entry.TextCodingUtil.prototype.clearQueue(); - blockFuncName = g.join("__").trim(); - console.log("first blockFuncName", blockFuncName); - console.log("first textFuncName", f); - if (f == blockFuncName) { - if (console.log("textFuncName", f), console.log("blockFuncName", blockFuncName), console.log("textFuncParams.length", d.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), d.length == Object.keys(h).length ? (k = !0, console.log("textFuncParams.length", d.length), console.log("Object.keys(paramMap).length", Object.keys(h).length), l = q.content._data[0]._data, g = l.slice(), g.shift(), console.log("blockFuncContents", l), l = Entry.TextCodingUtil.prototype.isFuncContentsMatch(g, - b, h)) : l = k = !1, k && l) { - m = "func".concat("_").concat(n); - break; - } else { - if (k && !l) { - m = n; - break; - } - } - } + b.SequenceExpression = function(a) { + console.log("SequenceExpression", a); + for (var b in a.expressions) { + var c = a.expressions[b], c = this[c.type](c); + (void 0).push(c); } - console.log("FunctionDeclaration foundFlag", k); - console.log("FunctionDeclaration matchFlag", l); - if (k && l) { - console.log("targetFuncId", m); - var u = d.length; - this._funcMap.put(f + u, m); - console.log("FunctionDeclaration this._funcMap", this._funcMap); - a = m; - } else { - if (k && !l) { - a = Entry.variableContainer.functions_[m]; - n = a.content._data[0]; - n._data.splice(1, n._data.length - 1); - if (0 < b.length) { - for (u in b) { - t = b[u], t = new Entry.Block(t, n), n._data.push(t); - } - } - Entry.variableContainer.saveFunction(a); - Entry.variableContainer.updateList(); - a = m; - console.log("textFuncName", f); - u = d.length; - u = f + u; - n = m; - m = "func".concat("_").concat(n); - this._funcMap.put(u, m); - console.log("FunctionDeclaration result", a); - } else { - console.log("FunctionDeclaration textFuncName", f); - console.log("FunctionDeclaration textFuncParams", d); - console.log("FunctionDeclaration textFuncStatements", b); - k = new Entry.Func; - k.generateBlock(!0); - console.log("FunctionDeclaration newFunc", k); - m = []; - for (g = 1;g <= d.length + 1;g++) { - m.push("%" + g); - } - k.block.template = f + " " + m.join(" "); - console.log("newFunc template", k.block.template); - n = k.content._data[0]; - t = n._data[0].data.params[0]; - m = t.data.params; - k.description = ""; - g = f.split("__"); - if (0 < g.length) { - for (e = 1;e < g.length;e++) { - h = g[e], q = new Entry.Block({type:"function_field_label"}, n), q.data.params = [], q.data.params.push(h), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = q, k.description += h.concat(" "); - } - k.description += " "; - } else { - m[0] = f, k.description = f + " "; - } - if (0 < d.length) { - for (e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.getLastParam(t), l.data.params[1] = e, k.paramMap[h] = Number(0), console.log("FunctionDeclaration paramBlock", k), t = 1;t < d.length;t++) { - e = new Entry.Block({type:"function_field_string"}, n), e.data.params = [], h = Entry.Func.requestParamBlock("string"), console.log("FunctionDeclaration stringParam", h), g = new Entry.Block({type:h}, n), e.data.params.push(g), l = Entry.TextCodingUtil.prototype.searchFuncDefParam(m[1]), console.log("FunctionDeclaration paramBlock", l), 0 == l.data.params.length ? l.data.params[0] = g : 1 == l.data.params.length && (l.data.params[1] = e), k.paramMap[h] = Number(t), console.log("FunctionDeclaration paramBlock", - k); - } - } - if (0 < b.length) { - for (u in b) { - t = b[u], t = new Entry.Block(t, n), n._data.push(t); - } - } - Entry.Func.generateWsBlock(k); - Entry.variableContainer.saveFunction(k); - Entry.variableContainer.updateList(); - u = d.length; - u = f + u; - n = k.id; - m = "func".concat("_").concat(n); - this._funcMap.put(u, m); - console.log("FunctionDeclaration newFunc", k); + return {type:a.type, expressions:void 0}; + }; +})(Entry.PyToBlockParserTemp.prototype); +Entry.Toast = function() { + this.toasts_ = []; + var b = document.getElementById("entryToastContainer"); + b && document.body.removeChild(b); + this.body_ = Entry.createElement("div", "entryToastContainer"); + this.body_.addClass("entryToastContainer"); + document.body.appendChild(this.body_); +}; +Entry.Toast.prototype.warning = function(b, a, d) { + var c = Entry.createElement("div", "entryToast"); + c.addClass("entryToast"); + c.addClass("entryToastWarning"); + c.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = b; + c.appendChild(e); + b = Entry.createElement("p", "entryToast"); + b.addClass("entryToastMessage"); + b.innerHTML = a; + c.appendChild(b); + this.toasts_.push(c); + this.body_.appendChild(c); + d || window.setTimeout(function() { + c.style.opacity = 1; + var a = setInterval(function() { + .05 > c.style.opacity && (clearInterval(a), c.style.display = "none", Entry.removeElement(c)); + c.style.opacity *= .9; + }, 20); + }, 1E3); +}; +Entry.Toast.prototype.success = function(b, a, d) { + var c = Entry.createElement("div", "entryToast"); + c.addClass("entryToast"); + c.addClass("entryToastSuccess"); + c.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = b; + c.appendChild(e); + b = Entry.createElement("p", "entryToast"); + b.addClass("entryToastMessage"); + b.innerHTML = a; + c.appendChild(b); + this.toasts_.push(c); + this.body_.appendChild(c); + d || window.setTimeout(function() { + c.style.opacity = 1; + var a = setInterval(function() { + .05 > c.style.opacity && (clearInterval(a), c.style.display = "none", Entry.removeElement(c)); + c.style.opacity *= .9; + }, 20); + }, 1E3); +}; +Entry.Toast.prototype.alert = function(b, a, d) { + var c = Entry.createElement("div", "entryToast"); + c.addClass("entryToast"); + c.addClass("entryToastAlert"); + c.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = b; + c.appendChild(e); + b = Entry.createElement("p", "entryToast"); + b.addClass("entryToastMessage"); + b.innerHTML = a; + c.appendChild(b); + this.toasts_.push(c); + this.body_.appendChild(c); + d || window.setTimeout(function() { + c.style.opacity = 1; + var a = setInterval(function() { + .05 > c.style.opacity && (clearInterval(a), c.style.display = "none", Entry.toast.body_.removeChild(c)); + c.style.opacity *= .9; + }, 20); + }, 5E3); +}; +Entry.TvCast = function(b) { + this.generateView(b); +}; +p = Entry.TvCast.prototype; +p.init = function(b) { + this.tvCastHash = b; +}; +p.generateView = function(b) { + var a = Entry.createElement("div"); + a.addClass("entryContainerMovieWorkspace"); + a.addClass("entryRemove"); + this.movieContainer = a; + a = Entry.createElement("iframe"); + a.setAttribute("id", "tvCastIframe"); + a.setAttribute("allowfullscreen", ""); + a.setAttribute("frameborder", 0); + a.setAttribute("src", b); + this.movieFrame = a; + this.movieContainer.appendChild(this.movieFrame); +}; +p.getView = function() { + return this.movieContainer; +}; +p.resize = function() { + document.getElementById("entryContainerWorkspaceId"); + var b = document.getElementById("tvCastIframe"); + w = this.movieContainer.offsetWidth; + b.width = w + "px"; + b.height = 9 * w / 16 + "px"; +}; +Entry.BlockDriver = function() { +}; +(function(b) { + b.convert = function() { + var a = new Date, b; + for (b in Entry.block) { + "function" === typeof Entry.block[b] && this._convertBlock(b); + } + console.log((new Date).getTime() - a.getTime()); + }; + b._convertBlock = function(a) { + function b(a) { + var c = {type:a.getAttribute("type"), index:{}}; + a = $(a).children(); + if (!a) { + return c; + } + for (var e = 0;e < a.length;e++) { + var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (c.params || (c.params = []), c.params.push(b(h)), c.index[t] = c.params.length - 1) : "field" === g && (c.params || (c.params = []), c.params.push(f.textContent), c.index[t] = c.params.length - 1); } + return c; + } + var c = Blockly.Blocks[a], e = EntryStatic.blockInfo[a], f, g; + if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { + var e = $.parseXML(e), h = b(e.childNodes[0]) } - console.log("FunctionDeclaration result", a); + c = (new Entry.BlockMockup(c, h, a)).toJSON(); + c.class = f; + c.isNotFor = g; + _.isEmpty(c.paramsKeyMap) && delete c.paramsKeyMap; + _.isEmpty(c.statementsKeyMap) && delete c.statementsKeyMap; + c.func = Entry.block[a]; + -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(a.toUpperCase()) && (c.isPrimitive = !0); + Entry.block[a] = c; }; - a.FunctionExpression = function(b) { - console.log("FunctionExpression component", b); - var a = {}; - b = b.body; - b = this[b.type](b); - console.log("FunctionExpression bodyData", b); - a.statements = b.statements; - console.log("FunctionExpression result", a); - return a; +})(Entry.BlockDriver.prototype); +Entry.BlockMockup = function(b, a, d) { + this.templates = []; + this.params = []; + this.statements = []; + this.color = ""; + this.output = this.isNext = this.isPrev = !1; + this.fieldCount = 0; + this.events = {}; + this.def = a || {}; + this.paramsKeyMap = {}; + this.statementsKeyMap = {}; + this.definition = {params:[], type:this.def.type}; + this.simulate(b); + this.def = this.definition; +}; +(function(b) { + b.simulate = function(a) { + a.sensorList && (this.sensorList = a.sensorList); + a.portList && (this.portList = a.portList); + a.init.call(this); + a.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(a.whenAdd)); + a.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(a.whenRemove)); }; - a.ReturnStatement = function(b) { - console.log("ReturnStatement component", b); - var a = {}; - if (b = b.argument) { - var d = this[b.type](b) + b.toJSON = function() { + function a(b) { + if (b && (b = b.params)) { + for (var d = 0;d < b.length;d++) { + var c = b[d]; + c && (delete c.index, a(c)); + } + } } - d && (a.argument = d); - console.log("ReturnStaement result", a); - return a; - }; - a.ThisExpression = function(b) { - console.log("ThisExpression component", b); - var a = {}; - if (b = b.userCode) { - a.userCode = b; + var b = ""; + this.output ? b = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? b = "basic_event" : 1 == this.statements.length ? b = "basic_loop" : 2 == this.statements.length ? b = "basic_double_loop" : this.isPrev && this.isNext ? b = "basic" : this.isPrev && !this.isNext && (b = "basic_without_next"); + a(this.def); + var c = /dummy_/mi, e; + for (e in this.paramsKeyMap) { + c.test(e) && delete this.paramsKeyMap[e]; } - console.log("ThisExpression result", a); - return a; - }; - a.NewExpression = function(b) { - console.log("NewExpression component", b); - var a = {}, d = b.callee, d = this[d.type](d), arguments = b.arguments, e = [], f; - for (f in arguments) { - var g = arguments[f]; - console.log("NewExpression argument", g); - g = this[g.type](g); - e.push(g); + for (e in this.statementsKeyMap) { + c.test(e) && delete this.statementsKeyMap[e]; } - a.callee = d; - a.arguments = e; - console.log("NewExpression result", a); - return a; - }; - a.getBlockType = function(b) { - return this.blockSyntax[b]; + return {color:this.color, skeleton:b, statements:this.statements, template:this.templates.filter(function(a) { + return "string" === typeof a; + }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; }; - a.RegExp = function(b) { - console.log("RegExp", b); - console.log("RegExp result", b); - return b; + b.appendDummyInput = function() { + return this; }; - a.Function = function(b) { - console.log("Function component", b); - console.log("Function result", b); - return b; + b.appendValueInput = function(a) { + this.def && this.def.index && (void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null)); + this.params.push({type:"Block", accept:"string"}); + this._addToParamsKeyMap(a); + this.templates.push(this.getFieldCount()); + return this; }; - a.EmptyStatement = function(b) { - console.log("EmptyStatement component", b); - console.log("EmptyStatement result", b); - return b; + b.appendStatementInput = function(a) { + this._addToStatementsKeyMap(a); + this.statements.push({accept:"basic"}); }; - a.DebuggerStatement = function(b) { - console.log("DebuggerStatement component", b); - console.log("DebuggerStatement result", b); - return b; + b.setCheck = function(a) { + var b = this.params; + "Boolean" === a && (b[b.length - 1].accept = "boolean"); }; - a.WithStatement = function(b) { - console.log("WithStatement component", b); - console.log("WithStatement result", b); - return b; + b.appendField = function(a, b) { + if (!a) { + return this; + } + "string" === typeof a && 0 < a.length ? b ? (a = {type:"Text", text:a, color:b}, this.params.push(a), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0)) : this.templates.push(a) : a.constructor == Blockly.FieldIcon ? ("start" === a.type ? this.params.push({type:"Indicator", img:a.src_, size:17, position:{x:0, y:-2}}) : + this.params.push({type:"Indicator", img:a.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : a.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:a.menuGenerator_, value:a.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(b), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : + this.definition.params.push(void 0)) : a.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:a.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), + this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), + void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : console.log("else", a); + return this; }; - a.LabeledStatement = function(b) { - console.log("LabeledStatement component", b); - console.log("LabeledStatement result", b); - return b; + b.setColour = function(a) { + this.color = a; }; - a.ContinueStatement = function(b) { - console.log("ContinueStatement component", b); - console.log("ContinueStatement result", b); - return b; + b.setInputsInline = function() { }; - a.SwitchStatement = function(b) { - console.log("SwitchStatement component", b); - console.log("SwitchStatement result", b); - return b; + b.setOutput = function(a, b) { + a && (this.output = b); }; - a.SwitchCase = function(b) { - console.log("SwitchCase component", b); - console.log("SwitchCase result", b); - return b; + b.setPreviousStatement = function(a) { + this.isPrev = a; }; - a.ThrowStatement = function(b) { - console.log("ThrowStatement component", b); - console.log("ThrowStatement result", b); - return b; + b.setNextStatement = function(a) { + this.isNext = a; }; - a.TryStatement = function(b) { - console.log("TryStatement component", b); - console.log("TryStatement result", b); - return b; + b.setEditable = function(a) { }; - a.CatchClause = function(b) { - console.log("CatchClause component", b); - console.log("CatchClause result", b); - return b; + b.getFieldCount = function() { + this.fieldCount++; + return "%" + this.fieldCount; }; - a.DoWhileStatement = function(b) { - console.log("DoWhileStatement component", b); - console.log("DoWhileStatement result", b); - return b; + b._addToParamsKeyMap = function(a) { + a = a ? a : "dummy_" + Entry.Utils.generateId(); + var b = this.paramsKeyMap; + b[a] = Object.keys(b).length; }; - a.ArrayExpression = function(b) { - console.log("ArrayExpression component", b); - console.log("ArrayExpression result", b); - return b; + b._addToStatementsKeyMap = function(a) { + a = a ? a : "dummy_" + Entry.Utils.generateId(); + var b = this.statementsKeyMap; + b[a] = Object.keys(b).length; }; - a.ObjectExpression = function(b) { - console.log("ObjectExpression component", b); - console.log("ObjectExpression result", b); - return b; +})(Entry.BlockMockup.prototype); +Entry.ContextMenu = {}; +(function(b) { + b.visible = !1; + b._hideEvent = null; + b.createDom = function() { + this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); + this.dom.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + Entry.Utils.disableContextmenu(this.dom); }; - a.Property = function(b) { - console.log("Property component", b); - console.log("Property result", b); - return b; + b.show = function(a, b, c) { + this._hideEvent = Entry.documentMousedown.attach(this, function() { + this.hide(); + }); + this.dom || this.createDom(); + if (0 !== a.length) { + var e = this; + void 0 !== b && (this._className = b, this.dom.addClass(b)); + var f = this.dom; + f.empty(); + for (var g = 0, h = a.length;g < h;g++) { + var k = a[g], l = k.text, m = !1 !== k.enable, n = Entry.Dom("li", {parent:f}); + if (k.divider) { + b = "divider"; + } else { + b = m ? "menuAble" : "menuDisable"; + var q = Entry.Dom("span", {parent:n}); + q.text(l); + m && k.callback && function(a, b) { + a.mousedown(function(a) { + a.preventDefault(); + e.hide(); + b(a); + }); + }(q, k.callback); + } + n.addClass(b); + } + f.removeClass("entryRemove"); + this.visible = !0; + this.position(c || Entry.mouseCoordinate); + } }; - a.ConditionalExpression = function(b) { - console.log("ConditionalExpression component", b); - console.log("ConditionalExpression result", b); - return b; + b.position = function(a) { + var b = this.dom; + b.css({left:0, top:0}); + var c = b.width(), e = b.height(), f = $(window), g = f.width(), f = f.height(); + a.x + c > g && (a.x -= c + 3); + a.y + e > f && (a.y -= e); + b.css({left:a.x, top:a.y}); }; - a.SequenceExpression = function(b) { - console.log("SequenceExpression component", b); - console.log("SequenceExpression result", b); - return b; + b.hide = function() { + this.visible = !1; + this.dom.empty(); + this.dom.addClass("entryRemove"); + this._className && (this.dom.removeClass(this._className), delete this._className); + this._hideEvent && (Entry.documentMousedown.detach(this._hideEvent), this._hideEvent = null); }; -})(Entry.PyToBlockParser.prototype); -Entry.Console = function() { - Entry.propertyPanel && (this.createView(), Entry.propertyPanel.addMode("console", this), Entry.console = this, this._isEditing = !1, this._inputData = null); +})(Entry.ContextMenu); +Entry.Loader = {queueCount:0, totalCount:0, loaded:!1}; +Entry.Loader.addQueue = function(b) { + this.queueCount || Entry.dispatchEvent("loadStart"); + this.queueCount++; + this.totalCount++; }; -(function(a) { - a.createView = function() { - this.view = new Entry.Dom("div", {id:"entryConsole"}); - this.codeMirror = CodeMirror(this.view[0], {lineNumbers:!1, lineWrapping:!0, value:"", mode:{}, theme:"default", styleActiveLine:!1, lint:!1}); - this._doc = this.codeMirror.getDoc(); - this.codeMirror.on("beforeChange", function(b, a) { - this._isEditing ? "+delete" === a.origin && 0 === a.to.ch && a.cancel() : a.cancel(); - }.bind(this)); - this.codeMirror.on("keyup", function(b, a) { - this._isEditing && 13 === a.keyCode && this.endInput(); - }.bind(this)); - this.codeMirror.on("cursorActivity", function(b, a) { - b.execCommand("goDocEnd"); - }); - Entry.addEventListener("stop", this.clear.bind(this)); - this.clear(); +Entry.Loader.removeQueue = function(b) { + this.queueCount--; + this.queueCount || (this.totalCount = 0, this.handleLoad()); +}; +Entry.Loader.getLoadedPercent = function() { + return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; +}; +Entry.Loader.isLoaded = function() { + return !this.queueCount && !this.totalCount; +}; +Entry.Loader.handleLoad = function() { + this.loaded || (this.loaded = !0, Entry.dispatchEvent("loadComplete")); +}; +Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3, COMMAND_TYPES:{addThread:101, destroyThread:102, destroyBlock:103, recoverBlock:104, insertBlock:105, separateBlock:106, moveBlock:107, cloneBlock:108, uncloneBlock:109, scrollBoard:110, setFieldValue:111, selectObject:201, "do":301, +undo:302, redo:303, editPicture:401, uneditPicture:402, processPicture:403, unprocessPicture:404}}; +Entry.Command = {}; +(function(b) { + b.do = {type:Entry.STATIC.COMMAND_TYPES["do"], log:function(a) { + return [b["do"].type]; + }}; + b.undo = {type:Entry.STATIC.COMMAND_TYPES.undo, log:function(a) { + return [b.undo.type]; + }}; + b.redo = {type:Entry.STATIC.COMMAND_TYPES.redo, log:function(a) { + return [b.redo.type]; + }}; +})(Entry.Command); +Entry.Commander = function(b) { + if ("workspace" == b || "phone" == b) { + Entry.stateManager = new Entry.StateManager; + } + Entry.do = this.do.bind(this); + Entry.undo = this.undo.bind(this); + this.editor = {}; + this.reporters = []; + this._tempStorage = null; + Entry.Command.editor = this.editor; +}; +(function(b) { + b.do = function(a) { + var b = this, c = Array.prototype.slice.call(arguments); + c.shift(); + var e = Entry.Command[a]; + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, e.undo].concat(e.state.apply(this, c))); + e = Entry.Command[a].do.apply(this, c); + setTimeout(function() { + b.report("do"); + b.report(a, c); + }, 0); + return {value:e, isPass:this.isPass.bind(this)}; }; - a.getView = function() { - return this.view; + b.undo = function() { + var a = Array.prototype.slice.call(arguments), b = a.shift(), c = Entry.Command[b]; + this.report("undo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, c.undo].concat(c.state.apply(this, a))); + return {value:Entry.Command[b].do.apply(this, a), isPass:this.isPass.bind(this)}; }; - a.clear = function() { - this.setEditing(!0); - this.codeMirror.setValue("Entry Console \n"); - this.codeMirror.execCommand("goDocEnd"); - this.setEditing(!1); + b.redo = function() { + var a = Array.prototype.slice.call(arguments), b = a.shift(), c = Entry.Command[b]; + that.report("redo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.undo, b].concat(c.state.apply(null, a))); + c.undo.apply(this, a); }; - a.print = function(b, a) { - this.setEditing(!0); - this.codeMirror.execCommand("goDocEnd"); - var c = this._doc.getCursor(); - this._doc.replaceRange(b + "\n", {line:c.line, ch:0}); - this._doc.addLineClass(c.line, "text", a); - "speak" === a && this.setEditing(!1); - this.codeMirror.execCommand("goDocEnd"); - "ask" === a && (this._doc.addLineClass(c.line + 1, "text", "answer"), this.codeMirror.focus()); + b.setCurrentEditor = function(a, b) { + this.editor[a] = b; }; - a.endInput = function() { - var b = this._doc.getCursor(), a = this.codeMirror.lineInfo(b.line); - "answer" === a.textClass ? (this._inputData = a.text, this._doc.replaceRange("\n", {line:b.line, ch:a.text.length})) : this._inputData = this._doc.getLine(b.line - 1); - Entry.container.setInputValue(this._inputData); - this.setEditing(!1); + b.isPass = function(a) { + a = void 0 === a ? !0 : a; + if (Entry.stateManager) { + var b = Entry.stateManager.getLastCommand(); + b && (b.isPass = a); + } }; - a.stopInput = function(b) { - this.setEditing(!1); + b.addReporter = function(a) { + this.reporters.push(a); }; - a.setEditing = function(b) { - this._isEditing !== b && (this._isEditing = b); + b.removeReporter = function(a) { + a = this.reporters.indexOf(a); + -1 < a && this.reporters.splice(a, 1); }; -})(Entry.Console.prototype); -Entry.Parser = function(a, b, c, d) { - this._mode = a; - this.syntax = {}; - this.codeMirror = c; - this._lang = d || "js"; - this._type = b; - this.availableCode = []; - Entry.Parser.PARSE_GENERAL = 0; - Entry.Parser.PARSE_SYNTAX = 1; - Entry.Parser.PARSE_VARIABLE = 2; - Entry.Parser.BLOCK_SKELETON_BASIC = "basic"; - Entry.Parser.BLOCK_SKELETON_BASIC_LOOP = "basic_loop"; - Entry.Parser.BLOCK_SKELETON_BASIC_DOUBLE_LOOP = "basic_double_loop"; - this._console = new Entry.Console; - switch(this._lang) { - case "js": - this._parser = new Entry.JsToBlockParser(this.syntax); - break; - case "py": - this._parser = new Entry.PyToBlockParser(this.syntax); - d = this.syntax; - var e = {}, f; - for (f in d.Scope) { - e[f + "();\n"] = d.Scope[f]; - } - "BasicIf" in d && (e.front = "BasicIf"); - CodeMirror.commands.javascriptComplete = function(b) { - CodeMirror.showHint(b, null, {globalScope:e}); - }; - c.on("keyup", function(b, a) { - (65 <= a.keyCode && 95 >= a.keyCode || 167 == a.keyCode || 190 == a.keyCode) && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:e}); + b.report = function(a, b) { + var c = this.reporters; + if (0 !== c.length) { + var e; + e = a && Entry.Command[a] && Entry.Command[a].log ? Entry.Command[a].log.apply(this, b) : b; + c.forEach(function(a) { + a.add(e); }); - break; - case "blockJs": - this._parser = new Entry.BlockToJsParser(this.syntax); - d = this.syntax; - break; - case "blockPy": - this._parser = new Entry.BlockToPyParser(this.syntax), d = this.syntax; - } -}; -(function(a) { - a.setParser = function(b, a, d) { - this._mode = b; - this._type = a; - this._cm = d; - this.syntax = this.mappingSyntax(b); - switch(a) { - case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK: - this._parser = new Entry.JsToBlockParser(this.syntax); - this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK; - break; - case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK: - this._parser = new Entry.PyToBlockParser(this.syntax); - this._parserType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK; - break; - case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS: - this._parser = new Entry.BlockToJsParser(this.syntax); - b = this.syntax; - var c = {}, f; - for (f in b.Scope) { - c[f + "();\n"] = b.Scope[f]; - } - d.on("keydown", function(b, a) { - var d = a.keyCode; - (65 <= d && 95 >= d || 167 == d || !a.shiftKey && 190 == d) && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:c}); - }); - this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK; - break; - case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY: - this._parser = new Entry.BlockToPyParser(this.syntax), d.setOption("mode", {name:"python", globalVars:!0}), d.markText({line:0, ch:0}, {line:5}, {readOnly:!0}), this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; } }; - a.parse = function(b, a) { - var c = null; - switch(this._type) { - case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK: - try { - var e = []; - e.push(b); - var f = [], g; - for (g in e) { - var h = e[g], h = h.trim(), k = acorn.parse(h); - f.push(k); - } - c = this._parser.Program(f); - } catch (q) { - if (this.codeMirror) { - q instanceof SyntaxError ? (b = {from:{line:q.loc.line - 1, ch:0}, to:{line:q.loc.line - 1, ch:q.loc.column}}, q.message = "\ubb38\ubc95(Syntax) \uc624\ub958\uc785\ub2c8\ub2e4.", q.type = 1) : (b = this.getLineNumber(q.node.start, q.node.end), b.message = q.message, b.severity = "converting error", q.type = 2); - this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0}); - b = q.title ? q.title : "\ubb38\ubc95 \uc624\ub958"; - if (2 == q.type && q.message) { - var l = q.message - } else { - 2 != q.type || q.message ? 1 == q.type && (l = "\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694.") : l = "\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694."; - } - Entry.toast.alert(b, l); - l = {}; - l.boardType = Entry.Workspace.MODE_BOARD; - l.textType = Entry.Vim.TEXT_TYPE_JS; - l.runType = Entry.Vim.MAZE_MODE; - Ntry.dispatchEvent("textError", l); - throw q; - } - c = []; - } - break; - case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK: - try { - var m = new Entry.PyAstGenerator, e = b.split("\n\n"), n; - for (n in e) { - h = e[n], -1 != h.search("import") ? e[n] = "" : (h = Entry.TextCodingUtil.prototype.entryEventFuncFilter(h), e[n] = h); - } - f = []; - for (g in e) { - h = e[g], k = m.generate(h), "Program" == k.type && 0 != k.body.length && f.push(k); - } - c = this._parser.Program(f); - this._parser._variableMap.clear(); - } catch (q) { - if (this.codeMirror) { - throw q instanceof SyntaxError ? (b = {from:{line:q.loc.line - 1, ch:q.loc.column - 2}, to:{line:q.loc.line - 1, ch:q.loc.column + 1}}, q.message = "\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4.") : (b = this.getLineNumber(q.node.start, q.node.end), b.message = q.message, b.severity = "error"), l = parseInt(b.to.line) + 1, b.from.line = l - 1, b.to.line = l, this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0}), b = q.title ? - q.title : "\ubb38\ubc95 \uc624\ub958", l = q.message && l ? q.message + " (line: " + l + ")" : "\ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694", Entry.toast.alert(b, l), q; - } - c = []; - } - break; - case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS: - c = l = this._parser.Code(b, a); - break; - case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY: - l = this._parser.Code(b, a), this._pyHinter || (this._pyHinter = new Entry.PyHint), c = l; - } +})(Entry.Commander.prototype); +(function(b) { + b.addThread = {type:Entry.STATIC.COMMAND_TYPES.addThread, do:function(a) { + return this.editor.board.code.createThread(a); + }, state:function(a) { + a.length && (a[0].id = Entry.Utils.generateId()); + return [a]; + }, log:function(a) { + a = this.editor.board.code.getThreads().pop(); + return [b.addThread.type, ["thread", a.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyThread"}; + b.destroyThread = {type:Entry.STATIC.COMMAND_TYPES.destroyThread, do:function(a) { + this.editor.board.findById(a[0].id).destroy(!0, !0); + }, state:function(a) { + return [this.editor.board.findById(a[0].id).thread.toJSON()]; + }, log:function(a) { + a = a[0].id; + this.editor.board.findById(a); + return [b.destroyThread.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; + }, undo:"addThread"}; + b.destroyBlock = {type:Entry.STATIC.COMMAND_TYPES.destroyBlock, do:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + a.doDestroy(!0); + }, state:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + return [a.toJSON(), a.pointer()]; + }, log:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + return [b.destroyBlock.type, ["blockId", a.id], ["code", this.editor.board.code.stringify()]]; + }, undo:"recoverBlock"}; + b.recoverBlock = {type:Entry.STATIC.COMMAND_TYPES.recoverBlock, do:function(a, b) { + var c = this.editor.board.code.createThread([a]).getFirstBlock(); + "string" === typeof c && (c = this.editor.board.findById(c)); + this.editor.board.insert(c, b); + }, state:function(a) { + "string" !== typeof a && (a = a.id); + return [a]; + }, log:function(a, d) { + a = this.editor.board.findById(a.id); + return [b.recoverBlock.type, ["block", a.stringify()], ["pointer", d], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyBlock"}; + b.insertBlock = {type:Entry.STATIC.COMMAND_TYPES.insertBlock, do:function(a, b, c) { + "string" === typeof a && (a = this.editor.board.findById(a)); + this.editor.board.insert(a, b, c); + }, state:function(a, b) { + "string" === typeof a && (a = this.editor.board.findById(a)); + var c = [a.id], e = a.targetPointer(); + c.push(e); + "string" !== typeof a && "basic" === a.getBlockType() && c.push(a.thread.getCount(a)); return c; + }, log:function(a, d, c) { + "string" === typeof a && (a = this.editor.board.findById(a)); + return [b.insertBlock.type, ["blockId", a.id], ["targetPointer", a.targetPointer()], ["count", c], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + b.separateBlock = {type:Entry.STATIC.COMMAND_TYPES.separateBlock, do:function(a) { + a.view && a.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); + a.doSeparate(); + }, state:function(a) { + var b = [a.id], c = a.targetPointer(); + b.push(c); + "basic" === a.getBlockType() && b.push(a.thread.getCount(a)); + return b; + }, log:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + return [b.separateBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + b.moveBlock = {type:Entry.STATIC.COMMAND_TYPES.moveBlock, do:function(a, b, c) { + void 0 !== b ? (a = this.editor.board.findById(a), a.moveTo(b, c)) : a._updatePos(); + }, state:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + return [a.id, a.x, a.y]; + }, log:function(a, d, c) { + return [b.moveBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"moveBlock"}; + b.cloneBlock = {type:Entry.STATIC.COMMAND_TYPES.cloneBlock, do:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + this.editor.board.code.createThread(a.copy()); + }, state:function(a) { + "string" !== typeof a && (a = a.id); + return [a]; + }, log:function(a) { + "string" === typeof a && (a = this.editor.board.findById(a)); + var d = this.editor.board.code.getThreads().pop(); + return [b.cloneBlock.type, ["blockId", a.id], ["thread", d.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"uncloneBlock"}; + b.uncloneBlock = {type:Entry.STATIC.COMMAND_TYPES.uncloneBlock, do:function(a) { + a = this.editor.board.code.getThreads().pop().getFirstBlock(); + this._tempStorage = a.id; + a.destroy(!0, !0); + }, state:function(a) { + return [a]; + }, log:function(a) { + a = this._tempStorage; + this._tempStorage = null; + return [b.uncloneBlock.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; + }, undo:"cloneBlock"}; + b.scrollBoard = {type:Entry.STATIC.COMMAND_TYPES.scrollBoard, do:function(a, b, c) { + c || this.editor.board.scroller._scroll(a, b); + delete this.editor.board.scroller._diffs; + }, state:function(a, b) { + return [-a, -b]; + }, log:function(a, d) { + return [b.scrollBoard.type, ["dx", a], ["dy", d]]; + }, undo:"scrollBoard"}; + b.setFieldValue = {type:Entry.STATIC.COMMAND_TYPES.setFieldValue, do:function(a, b, c, e, f) { + b.setValue(f, !0); + }, state:function(a, b, c, e, f) { + return [a, b, c, f, e]; + }, log:function(a, d, c, e, f) { + return [b.setFieldValue.type, ["pointer", c], ["newValue", f], ["code", this.editor.board.code.stringify()]]; + }, undo:"setFieldValue"}; +})(Entry.Command); +(function(b) { + b.selectObject = {type:Entry.STATIC.COMMAND_TYPES.selectObject, do:function(a) { + return Entry.container.selectObject(a); + }, state:function(a) { + if ((a = Entry.playground) && a.object) { + return [a.object.id]; + } + }, log:function(a) { + return [a]; + }, undo:"selectObject"}; +})(Entry.Command); +(function(b) { + b.editPicture = {type:Entry.STATIC.COMMAND_TYPES.editPicture, do:function(a, b) { + Entry.playground.painter.lc.canRedo() && Entry.playground.painter.lc.redo(); + }, state:function(a) { + }, log:function(a) { + return [a]; + }, undo:"uneditPicture"}; + b.uneditPicture = {type:Entry.STATIC.COMMAND_TYPES.uneditPicture, do:function(a, b) { + Entry.playground.painter.lc.undo(); + }, state:function(a) { + }, log:function(a) { + return [a]; + }, undo:"editPicture"}; + b.processPicture = {type:Entry.STATIC.COMMAND_TYPES.processPicture, do:function(a, b) { + Entry.playground.painter.lc.canRedo() && Entry.playground.painter.lc.redo(); + }, state:function(a) { + }, log:function(a) { + return [a]; + }, undo:"unprocessPicture", isPass:!0}; + b.unprocessPicture = {type:Entry.STATIC.COMMAND_TYPES.unprocessPicture, do:function(a, b) { + Entry.playground.painter.lc.undo(); + }, state:function(a) { + }, log:function(a) { + return [a]; + }, undo:"processPicture", isPass:!0}; +})(Entry.Command); +Entry.init = function(b, a) { + Entry.assert("object" === typeof a, "Init option is not object"); + this.events_ = {}; + this.interfaceState = {menuWidth:264}; + Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); + this.options = a; + this.parseOptions(a); + this.mediaFilePath = (a.libDir ? a.libDir : "/lib") + "/entryjs/images/"; + this.defaultPath = a.defaultDir || ""; + this.blockInjectPath = a.blockInjectDir || ""; + "workspace" == this.type && this.isPhone() && (this.type = "phone"); + this.initialize_(); + this.view_ = b; + "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); + Entry.initFonts(a.fonts); + this.createDom(b, this.type); + this.loadInterfaceState(); + this.overridePrototype(); + this.maxCloneLimit = 302; + this.cloudSavable = !0; + this.startTime = (new Date).getTime(); + document.onkeydown = function(a) { + Entry.dispatchEvent("keyPressed", a); }; - a.getLineNumber = function(b, a) { - var c = this.codeMirror.getValue(), e = {from:{}, to:{}}; - b = c.substring(0, b).split(/\n/gi); - e.from.line = b.length - 1; - e.from.ch = b[b.length - 1].length; - a = c.substring(0, a).split(/\n/gi); - e.to.line = a.length - 1; - e.to.ch = a[a.length - 1].length; - return e; + document.onkeyup = function(a) { + Entry.dispatchEvent("keyUpped", a); }; - a.mappingSyntax = function(b) { - for (var a = Object.keys(Entry.block), d = {}, e = 0;e < a.length;e++) { - var f = a[e], g = Entry.block[f]; - if (b === Entry.Vim.MAZE_MODE) { - if (-1 < this.availableCode.indexOf(f) && (g = g.syntax)) { - for (var h = d, k = 0;k < g.length;k++) { - var l = g[k]; - if (!(-1 < l.indexOf("%"))) { - var m = l.indexOf("("); - -1 < m && (l = l.substring(0, m)); - if (k === g.length - 2 && "function" === typeof g[k + 1]) { - h[l] = g[k + 1]; - break; - } - h[l] || (h[l] = {}); - k === g.length - 1 ? h[l] = f : h = h[l]; - } - } - } - } else { - if (b === Entry.Vim.WORKSPACE_MODE) { - for (l in f = Entry.block, f) { - g = f[l], h = null, g.syntax && g.syntax.py && (h = g.syntax.py), h && (h = String(h), g = h.split("("), 0 != g[0].length && (h = g[0]), d[h] = l); - } - } - } - } - return d; + window.onresize = function(a) { + Entry.dispatchEvent("windowResized", a); }; - a.setAvailableCode = function(b, a) { - var c = [], e; - b instanceof Entry.Code ? e = b.getBlockList() : b.forEach(function(b, a) { - e.concat(b); - }); - e.forEach(function(b) { - c.push(b.type); - }); - e = []; - a instanceof Entry.Code ? e = a.getBlockList() : a.forEach(function(b, a) { - e.concat(b); - }); - e.forEach(function(b) { - -1 === c.indexOf(b.type) && c.push(b.type); + window.onbeforeunload = this.beforeUnload; + 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); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); + createjs.Sound.stop(); +}; +Entry.loadAudio_ = function(b, a) { + if (window.Audio && b.length) { + for (;0 < b.length;) { + var d = b[0]; + d.match(/\/([^.]+)./); + Entry.soundQueue.loadFile({id:a, src:d, type:createjs.LoadQueue.SOUND}); + break; + } + } +}; +Entry.initialize_ = function() { + this.stage = new Entry.Stage; + Entry.engine && Entry.engine.clearTimer(); + this.engine = new Entry.Engine; + this.propertyPanel = new Entry.PropertyPanel; + this.container = new Entry.Container; + this.helper = new Entry.Helper; + this.youtube = new Entry.Youtube; + this.variableContainer = new Entry.VariableContainer; + this.commander = new Entry.Commander(this.type); + this.scene = new Entry.Scene; + this.playground = new Entry.Playground; + this.toast = new Entry.Toast; + this.hw && this.hw.closeConnection(); + this.hw = new Entry.HW; + if (Entry.enableActivityLogging) { + this.reporter = new Entry.Reporter(!1); + } else { + if ("workspace" == this.type || "phone" == this.type) { + this.reporter = new Entry.Reporter(!0); + } + } +}; +Entry.createDom = function(b, a) { + if (a && "workspace" != a) { + "minimize" == a ? (d = Entry.createElement("canvas"), d.className = "entryCanvasWorkspace", d.id = "entryCanvas", d.width = 640, d.height = 360, c = Entry.createElement("div", "entryCanvasWrapper"), c.appendChild(d), b.appendChild(c), this.canvas_ = d, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), b.appendChild(c), this.engineView = c, this.engine.generateView(this.engineView, a)) : "phone" == a && (this.stateManagerView = d = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, + a), c = Entry.createElement("div"), b.appendChild(c), this.engineView = c, this.engine.generateView(this.engineView, a), d = Entry.createElement("canvas"), d.addClass("entryCanvasPhone"), d.id = "entryCanvas", d.width = 640, d.height = 360, c.insertBefore(d, this.engine.footerView_), this.canvas_ = d, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), b.appendChild(d), this.containerView = d, this.container.generateView(this.containerView, a), d = Entry.createElement("div"), + b.appendChild(d), this.playgroundView = d, this.playground.generateView(this.playgroundView, a)); + } else { + Entry.documentMousedown.attach(this, this.cancelObjectEdit); + var d = Entry.createElement("div"); + b.appendChild(d); + this.sceneView = d; + this.scene.generateView(this.sceneView, a); + d = Entry.createElement("div"); + this.sceneView.appendChild(d); + this.stateManagerView = d; + this.stateManager.generateView(this.stateManagerView, a); + var c = Entry.createElement("div"); + b.appendChild(c); + this.engineView = c; + this.engine.generateView(this.engineView, a); + d = Entry.createElement("canvas"); + d.addClass("entryCanvasWorkspace"); + d.id = "entryCanvas"; + d.width = 640; + d.height = 360; + c.insertBefore(d, this.engine.addButton); + d.addEventListener("mousewheel", function(a) { + var b = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); + a = 0 < a.wheelDelta ? !0 : !1; + for (var c = 0;c < b.length;c++) { + var d = b[c]; + d.scrollButton_.y = a ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; + d.updateView(); + } }); - this.availableCode = this.availableCode.concat(c); + this.canvas_ = d; + this.stage.initStage(this.canvas_); + d = Entry.createElement("div"); + this.propertyPanel.generateView(b, a); + this.containerView = d; + this.container.generateView(this.containerView, a); + this.propertyPanel.addMode("object", this.container); + this.helper.generateView(this.containerView, a); + this.propertyPanel.addMode("helper", this.helper); + d = Entry.createElement("div"); + b.appendChild(d); + this.playgroundView = d; + this.playground.generateView(this.playgroundView, a); + this.propertyPanel.select("object"); + this.helper.bindWorkspace(this.playground.mainWorkspace); + } +}; +Entry.start = function(b) { + this.FPS || (this.FPS = 60); + Entry.assert("number" == typeof this.FPS, "FPS must be number"); + Entry.engine.start(this.FPS); +}; +Entry.parseOptions = function(b) { + this.type = b.type; + b.device && (this.device = b.device); + this.projectSaveable = b.projectsaveable; + void 0 === this.projectSaveable && (this.projectSaveable = !0); + this.objectAddable = b.objectaddable; + void 0 === this.objectAddable && (this.objectAddable = !0); + this.objectEditable = b.objectEditable; + void 0 === this.objectEditable && (this.objectEditable = !0); + this.objectEditable || (this.objectAddable = !1); + this.objectDeletable = b.objectdeletable; + void 0 === this.objectDeletable && (this.objectDeletable = !0); + this.soundEditable = b.soundeditable; + void 0 === this.soundEditable && (this.soundEditable = !0); + this.pictureEditable = b.pictureeditable; + void 0 === this.pictureEditable && (this.pictureEditable = !0); + this.sceneEditable = b.sceneEditable; + void 0 === this.sceneEditable && (this.sceneEditable = !0); + this.functionEnable = b.functionEnable; + void 0 === this.functionEnable && (this.functionEnable = !0); + this.messageEnable = b.messageEnable; + void 0 === this.messageEnable && (this.messageEnable = !0); + this.variableEnable = b.variableEnable; + void 0 === this.variableEnable && (this.variableEnable = !0); + this.listEnable = b.listEnable; + void 0 === this.listEnable && (this.listEnable = !0); + this.hasVariableManager = b.hasvariablemanager; + this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; + this.isForLecture = b.isForLecture; +}; +Entry.initFonts = function(b) { + this.fonts = b; + b || (this.fonts = []); +}; +Entry.Utils = {}; +Entry.overridePrototype = function() { + Number.prototype.mod = function(b) { + return (this % b + b) % b; }; - a.findErrorInfo = function(b) { - var a = 0, d = 0, e = this.codeMirror.getValue().split("\n"), f; - for (f in e) { - var g = e[f].trim(); - a++; - if (!(0 == g.length || 1 == g.length || -1 < g.indexOf("else")) && (d++, d == b.blockCount)) { +}; +Entry.Utils.generateId = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +}; +Entry.Utils.intersectArray = function(b, a) { + for (var d = [], c = 0;c < b.length;c++) { + for (var e = 0;e < a.length;e++) { + if (b[c] == a[e]) { + d.push(b[c]); break; } } - return {lineNumber:a - a, location:b.node}; - }; -})(Entry.Parser.prototype); -Entry.PyBlockAssembler = function(a) { - this.blockSyntax = a; - this._blockStatmentIndex = 0; - this._blockStatments = []; + } + return d; }; -(function(a) { - a.Program = function(b) { - var a = [], d; - for (d in b) { - if ("Program" != b[d].type) { - return; - } - var e = [], f = b[d].body; - console.log("nodes", f); - for (d in f) { - var g = f[d], g = this[g.type](g); - console.log("checkitout", g); - g = this._assembler[g.type](g); - e.push(g); - } - console.log("thread", e); - a.push(e); - } +Entry.Utils.isPointInMatrix = function(b, a, d) { + d = void 0 === d ? 0 : d; + var c = b.offsetX ? b.x + b.offsetX : b.x, e = b.offsetY ? b.y + b.offsety : b.y; + return c - d <= a.x && c + b.width + d >= a.x && e - d <= a.y && e + b.height + d >= a.y; +}; +Entry.Utils.colorDarken = function(b, a) { + function d(a) { + 2 != a.length && (a = "0" + a); return a; - }; - a.ExpressionStatement = function(b) { - console.log("ExpressionStatement component", b); - var a = {}; - b = b.expression; - "Literal" == b.type ? (b = this[b.type]({type:"Block", accept:"booleanMagnet"}, b), a.type = b.type, result = a, console.log("ExpressionStatement type literal", result)) : (b = this[b.type](b), a.type = b.type, a.params = b.params, result = a, console.log("ExpressionStatement type not literal", result)); - console.log("ExpressionStatement result", result); - return result; - }; - a.AssignmentExpression = function(b) { - console.log("AssignmentExpression component", b); - var a = [], d; - d = b.left; - d.type ? ("Literal" == d.type ? (d = this[d.type](paramsMeta[0], d), console.log("AssignmentExpression left Literal param", d)) : d = this[d.type](d), d && a.push(d), console.log("AssignmentExpression left param", d)) : (d = b.left, this[d.type](d)); - operator = String(b.operator); - console.log("AssignmentExpression operator", operator); - operator && (d = operator = Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator), a.push(d)); - d = b.right; - d.type ? ("Literal" == d.type ? (d = this[d.type](paramsMeta[2], d), console.log("AssignmentExpression right Literal param", d)) : d = this[d.type](d), d && a.push(d), console.log("AssignmentExpression right param", d)) : (d = b.right, this[d.type](d)); - console.log("AssignmentExpression params", a); - console.log("AssignmentExpression result", result); - return result; - }; - a.CallExpression = function(b) { - console.log("CallExpression component", b); - var a; - a = {}; - var d = b.callee, d = this[d.type](d); - console.log("CallExpression calleeData", d, "calleeData typeof", typeof d); - var e = "object" != typeof d.object ? String(d.object).concat(".").concat(String(d.property)) : String(d.object.object).concat(".").concat(String(d.object.property)).concat(".").concat(String(d.property)); - console.log("CallExpression syntax", e); - d = this.getBlockType(e); - console.log("CallExpression type1", d); - d || "__pythonRuntime.functions.range" == e && (d = "repeat_basic"); - console.log("CallExpression type2", d); - e = Entry.block[d].params; - console.log("CallExpression paramsMeta", e); - var arguments = b.arguments, f = [], g; - for (g in arguments) { - var h = arguments[g]; - console.log("CallExpression argument", h); - if ("Literal" == h.type) { - var k = e[g]; - "Indicator" == k.type ? (h = null, f.push(h), g--) : (console.log("CallExpression argument index", h.type, g), h = this[h.type](k, h, d, g), f.push(h)); - g == arguments.length - 1 && (console.log("CallExpression in1"), g < e.length && (console.log("CallExpression in2"), f.push(null))); - console.log("CallExpression i", g); - } + } + var c, e, f; + 7 === b.length ? (c = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(3, 2), 16), f = parseInt(b.substr(5, 2), 16)) : (c = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(2, 2), 16), f = parseInt(b.substr(3, 2), 16)); + a = void 0 === a ? .7 : a; + c = d(Math.floor(c * a).toString(16)); + e = d(Math.floor(e * a).toString(16)); + f = d(Math.floor(f * a).toString(16)); + return "#" + c + e + f; +}; +Entry.Utils.colorLighten = function(b, a) { + a = 0 === a ? 0 : a || 20; + var d = Entry.Utils.hexToHsl(b); + d.l += a / 100; + d.l = Math.min(1, Math.max(0, d.l)); + return Entry.Utils.hslToHex(d); +}; +Entry.Utils.bound01 = function(b, a) { + var d = b; + "string" == typeof d && -1 != d.indexOf(".") && 1 === parseFloat(d) && (b = "100%"); + d = "string" === typeof b && -1 != b.indexOf("%"); + b = Math.min(a, Math.max(0, parseFloat(b))); + d && (b = parseInt(b * a, 10) / 100); + return 1E-6 > Math.abs(b - a) ? 1 : b % a / parseFloat(a); +}; +Entry.Utils.hexToHsl = function(b) { + var a, d; + 7 === b.length ? (a = parseInt(b.substr(1, 2), 16), d = parseInt(b.substr(3, 2), 16), b = parseInt(b.substr(5, 2), 16)) : (a = parseInt(b.substr(1, 2), 16), d = parseInt(b.substr(2, 2), 16), b = parseInt(b.substr(3, 2), 16)); + a = Entry.Utils.bound01(a, 255); + d = Entry.Utils.bound01(d, 255); + b = Entry.Utils.bound01(b, 255); + var c = Math.max(a, d, b), e = Math.min(a, d, b), f, g = (c + e) / 2; + if (c == e) { + f = e = 0; + } else { + var h = c - e, e = .5 < g ? h / (2 - c - e) : h / (c + e); + switch(c) { + case a: + f = (d - b) / h + (d < b ? 6 : 0); + break; + case d: + f = (b - a) / h + 2; + break; + case b: + f = (a - d) / h + 4; } - console.log("CallExpression params", f); - a.type = d; - a.params = f; - console.log("CallExpression result", a); - return a; + f /= 6; + } + return {h:360 * f, s:e, l:g}; +}; +Entry.Utils.hslToHex = function(b) { + function a(a, b, c) { + 0 > c && (c += 1); + 1 < c && --c; + return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a; + } + function d(a) { + return 1 == a.length ? "0" + a : "" + a; + } + var c, e; + e = Entry.Utils.bound01(b.h, 360); + c = Entry.Utils.bound01(b.s, 1); + b = Entry.Utils.bound01(b.l, 1); + if (0 === c) { + c = b = e = b; + } else { + var f = .5 > b ? b * (1 + c) : b + c - b * c, g = 2 * b - f; + c = a(g, f, e + 1 / 3); + b = a(g, f, e); + e = a(g, f, e - 1 / 3); + } + b *= 255; + e *= 255; + return "#" + [d(Math.round(255 * c).toString(16)), d(Math.round(b).toString(16)), d(Math.round(e).toString(16))].join(""); +}; +Entry.Utils.bindGlobalEvent = function(b) { + var a = $(document); + void 0 === b && (b = "resize mousedown mousemove keydown keyup dispose".split(" ")); + -1 < b.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(a) { + Entry.windowResized.notify(a); + })); + -1 < b.indexOf("mousedown") && (Entry.documentMousedown && (a.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), a.on("mousedown", function(a) { + Entry.documentMousedown.notify(a); + })); + -1 < b.indexOf("mousemove") && (Entry.documentMousemove && (a.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), a.on("touchmove mousemove", function(a) { + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + Entry.documentMousemove.notify(a); + Entry.mouseCoordinate.x = a.clientX; + Entry.mouseCoordinate.y = a.clientY; + })); + -1 < b.indexOf("keydown") && (Entry.keyPressed && (a.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), a.on("keydown", function(a) { + var b = a.keyCode; + 0 > Entry.pressedKeys.indexOf(b) && Entry.pressedKeys.push(b); + Entry.keyPressed.notify(a); + })); + -1 < b.indexOf("keyup") && (Entry.keyUpped && (a.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), a.on("keyup", function(a) { + var b = Entry.pressedKeys.indexOf(a.keyCode); + -1 < b && Entry.pressedKeys.splice(b, 1); + Entry.keyUpped.notify(a); + })); + -1 < b.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(a) { + Entry.disposeEvent.notify(a); + })); +}; +Entry.Utils.makeActivityReporter = function() { + Entry.activityReporter = new Entry.ActivityReporter; + Entry.commander && Entry.commander.addReporter(Entry.activityReporter); + return Entry.activityReporter; +}; +Entry.Utils.initEntryEvent_ = function() { + Entry.events_ || (Entry.events_ = []); +}; +Entry.sampleColours = []; +Entry.assert = function(b, a) { + if (!b) { + throw Error(a || "Assert failed"); + } +}; +Entry.parseTexttoXML = function(b) { + var a; + window.ActiveXObject ? (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(b)) : a = (new DOMParser).parseFromString(b, "text/xml"); + return a; +}; +Entry.createElement = function(b, a) { + var d; + d = b instanceof HTMLElement ? b : document.createElement(b); + a && (d.id = a); + d.hasClass = function(a) { + return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)")); }; - a.Literal = function(b, a, d, e) { - console.log("Literal paramMeta component particularIndex blockType", b, a, d, e); - a = a.value; - b = d ? this["Param" + b.type](b, a, d, e) : this["Param" + b.type](b, a); - console.log("Literal result", b); - return b; + d.addClass = function(a) { + for (var b = 0;b < arguments.length;b++) { + a = arguments[b], this.hasClass(a) || (this.className += " " + a); + } }; - a.ParamColor = function(b, a) { - console.log("ParamColor paramMeta value", b, a); - console.log("ParamColor result", a); - return a; + d.removeClass = function(a) { + for (var b = 0;b < arguments.length;b++) { + a = arguments[b], this.hasClass(a) && (this.className = this.className.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); + } }; - a.ParamDropdown = function(b, a) { - console.log("ParamDropdown paramMeta value", b, a); - console.log("ParamDropdownDynamic result", a); - return a; + d.bindOnClick = function(a) { + $(this).on("click tab", function(b) { + b.stopImmediatePropagation(); + a.call(this, b); + }); }; - a.ParamDropdownDynamic = function(b, a) { - console.log("ParamDropdownDynamic paramMeta value", b, a); - var c; - if ("mouse" == a) { - return "mouse"; + return d; +}; +Entry.makeAutolink = function(b) { + return b ? b.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; +}; +Entry.generateHash = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +}; +Entry.addEventListener = function(b, a) { + this.events_ || (this.events_ = {}); + this.events_[b] || (this.events_[b] = []); + a instanceof Function && this.events_[b].push(a); + return !0; +}; +Entry.dispatchEvent = function(b, a) { + this.events_ || (this.events_ = {}); + if (this.events_[b]) { + for (var d = 0, c = this.events_[b].length;d < c;d++) { + this.events_[b][d].call(window, a); } - b = b.options; - for (var e in b) { - if (console.log("options", b), a == b[e][0]) { - console.log("options[i][0]", b[e][0]); - c = b[e][1]; + } +}; +Entry.removeEventListener = function(b, a) { + if (this.events_[b]) { + for (var d = 0, c = this.events_[b].length;d < c;d++) { + if (this.events_[b][d] === a) { + this.events_[b].splice(d, 1); break; } } - console.log("ParamDropdownDynamic result", c); - return c; - }; - a.ParamKeyboard = function(b, a) { - console.log("ParamKeyboard paramMeta value", b, a); - b = Entry.KeyboardCodeMap.prototype.keyCharToCode[a]; - console.log("ParamKeyboard result", b); - return b; - }; - a.ParamBlock = function(b, a, d, e) { - console.log("ParamBlock paramMeta value blockType", b, a, d, e); - var c = {}, g = []; - d = Entry.TextCodingUtil.prototype.particularParam(d); - if (null != d) { - var h = d[e]; - if (h) { - h = d[e]; - console.log("ParamBlock particularType", h); - e = h; - c.type = e; - d = Entry.block[e].params; - console.log("ParamBlock particular block paramsMeta", b); - var k, l; - for (l in d) { - b = d[l]; - b = b.options; - for (var m in b) { - h = b[m], a == h[0] && (k = h[1]); - } - } - g.push(k); - c.params = g; - } else { - switch(e = typeof a, e) { - case "number": - c.type = "number"; - g.push(a); - c.params = g; - break; - case "boolean": - 1 == a ? c.type = "True" : 0 == a && (c.type = "False"); - break; - default: - c.type = "text", g.push(a), c.params = g; - } + } +}; +Entry.removeAllEventListener = function(b) { + this.events_ && this.events_[b] && delete this.events_[b]; +}; +Entry.addTwoNumber = function(b, a) { + if (isNaN(b) || isNaN(a)) { + return b + a; + } + b += ""; + a += ""; + var d = b.indexOf("."), c = a.indexOf("."), e = 0, f = 0; + 0 < d && (e = b.length - d - 1); + 0 < c && (f = a.length - c - 1); + return 0 < e || 0 < f ? e >= f ? (parseFloat(b) + parseFloat(a)).toFixed(e) : (parseFloat(b) + parseFloat(a)).toFixed(f) : parseInt(b) + parseInt(a); +}; +Entry.hex2rgb = function(b) { + return (b = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b)) ? {r:parseInt(b[1], 16), g:parseInt(b[2], 16), b:parseInt(b[3], 16)} : null; +}; +Entry.rgb2hex = function(b, a, d) { + return "#" + (16777216 + (b << 16) + (a << 8) + d).toString(16).slice(1); +}; +Entry.generateRgb = function() { + return {r:Math.floor(256 * Math.random()), g:Math.floor(256 * Math.random()), b:Math.floor(256 * Math.random())}; +}; +Entry.adjustValueWithMaxMin = function(b, a, d) { + return b > d ? d : b < a ? a : b; +}; +Entry.isExist = function(b, a, d) { + for (var c = 0;c < d.length;c++) { + if (d[c][a] == b) { + return d[c]; + } + } + return !1; +}; +Entry.getColourCodes = function() { + return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); +}; +Entry.removeElement = function(b) { + b && b.parentNode && b.parentNode.removeChild(b); +}; +Entry.getElementsByClassName = function(b) { + for (var a = [], d = document.getElementsByTagName("*"), c = 0;c < d.length;c++) { + -1 < (" " + d[c].className + " ").indexOf(" " + b + " ") && a.push(d[c]); + } + return a; +}; +Entry.parseNumber = function(b) { + return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; +}; +Entry.countStringLength = function(b) { + var a, d = 0; + for (a = 0;a < b.length;a++) { + 255 < b.charCodeAt(a) ? d += 2 : d++; + } + return d; +}; +Entry.cutStringByLength = function(b, a) { + var d, c = 0; + for (d = 0;c < a && d < b.length;d++) { + 255 < b.charCodeAt(d) ? c += 2 : c++; + } + return b.substr(0, d); +}; +Entry.isChild = function(b, a) { + if (!a) { + for (;a.parentNode;) { + if ((a = a.parentNode) == b) { + return !0; } + } + } + return !1; +}; +Entry.launchFullScreen = function(b) { + b.requestFullscreen ? b.requestFullscreen() : b.mozRequestFulScreen ? b.mozRequestFulScreen() : b.webkitRequestFullscreen ? b.webkitRequestFullscreen() : b.msRequestFullScreen && b.msRequestFullScreen(); +}; +Entry.exitFullScreen = function() { + document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); +}; +Entry.isPhone = function() { + return !1; +}; +Entry.getKeyCodeMap = function() { + return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", + 13:Lang.Blocks.START_press_some_key_enter}; +}; +Entry.checkCollisionRect = function(b, a) { + return !(b.y + b.height < a.y || b.y > a.y + a.height || b.x + b.width < a.x || b.x > a.x + a.width); +}; +Entry.bindAnimationCallback = function(b, a) { + b.addEventListener("webkitAnimationEnd", a, !1); + b.addEventListener("animationend", a, !1); + b.addEventListener("oanimationend", a, !1); +}; +Entry.cloneSimpleObject = function(b) { + var a = {}, d; + for (d in b) { + a[d] = b[d]; + } + return a; +}; +Entry.nodeListToArray = function(b) { + for (var a = Array(b.length), d = -1, c = b.length;++d !== c;a[d] = b[d]) { + } + return a; +}; +Entry.computeInputWidth = function(b) { + var a = document.createElement("span"); + a.className = "tmp-element"; + a.innerHTML = b.replace(/&/g, "&").replace(//g, ">"); + document.body.appendChild(a); + b = a.offsetWidth; + document.body.removeChild(a); + return +(b + 10) + "px"; +}; +Entry.isArrowOrBackspace = function(b) { + return -1 < [37, 38, 39, 40, 8].indexOf(b); +}; +Entry.hexStringToBin = function(b) { + for (var a = [], d = 0;d < b.length - 1;d += 2) { + a.push(parseInt(b.substr(d, 2), 16)); + } + return String.fromCharCode.apply(String, a); +}; +Entry.findObjsByKey = function(b, a, d) { + for (var c = [], e = 0;e < b.length;e++) { + b[e][a] == d && c.push(b[e]); + } + return c; +}; +Entry.factorials = []; +Entry.factorial = function(b) { + return 0 === b || 1 == b ? 1 : 0 < Entry.factorials[b] ? Entry.factorials[b] : Entry.factorials[b] = Entry.factorial(b - 1) * b; +}; +Entry.getListRealIndex = function(b, a) { + if (isNaN(b)) { + switch(b) { + case "FIRST": + b = 1; + break; + case "LAST": + b = a.array_.length; + break; + case "RANDOM": + b = Math.floor(Math.random() * a.array_.length) + 1; + } + } + return b; +}; +Entry.toRadian = function(b) { + return b * Math.PI / 180; +}; +Entry.toDegrees = function(b) { + return 180 * b / Math.PI; +}; +Entry.getPicturesJSON = function(b) { + for (var a = [], d = 0, c = b.length;d < c;d++) { + var e = b[d], f = {}; + f._id = e._id; + f.id = e.id; + f.dimension = e.dimension; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + f.scale = e.scale; + a.push(f); + } + return a; +}; +Entry.getSoundsJSON = function(b) { + for (var a = [], d = 0, c = b.length;d < c;d++) { + var e = b[d], f = {}; + f._id = e._id; + f.duration = e.duration; + f.ext = e.ext; + f.id = e.id; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + a.push(f); + } + return a; +}; +Entry.cutDecimal = function(b) { + return Math.round(100 * b) / 100; +}; +Entry.getBrowserType = function() { + if (Entry.userAgent) { + return Entry.userAgent; + } + var b = navigator.userAgent, a, d = b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if (/trident/i.test(d[1])) { + return a = /\brv[ :]+(\d+)/g.exec(b) || [], "IE " + (a[1] || ""); + } + if ("Chrome" === d[1] && (a = b.match(/\b(OPR|Edge)\/(\d+)/), null != a)) { + return a.slice(1).join(" ").replace("OPR", "Opera"); + } + d = d[2] ? [d[1], d[2]] : [navigator.appName, navigator.appVersion, "-?"]; + null != (a = b.match(/version\/(\d+)/i)) && d.splice(1, 1, a[1]); + b = d.join(" "); + return Entry.userAgent = b; +}; +Entry.setBasicBrush = function(b) { + var a = new createjs.Graphics; + a.thickness = 1; + a.rgb = Entry.hex2rgb("#ff0000"); + a.opacity = 100; + a.setStrokeStyle(1); + a.beginStroke("rgba(255,0,0,1)"); + var d = new createjs.Shape(a); + Entry.stage.selectedObjectContainer.addChild(d); + b.brush && (b.brush = null); + b.brush = a; + b.shape && (b.shape = null); + b.shape = d; +}; +Entry.setCloneBrush = function(b, a) { + var d = new createjs.Graphics; + d.thickness = a.thickness; + d.rgb = a.rgb; + d.opacity = a.opacity; + d.setStrokeStyle(d.thickness); + d.beginStroke("rgba(" + d.rgb.r + "," + d.rgb.g + "," + d.rgb.b + "," + d.opacity / 100 + ")"); + var c = new createjs.Shape(d); + Entry.stage.selectedObjectContainer.addChild(c); + b.brush && (b.brush = null); + b.brush = d; + b.shape && (b.shape = null); + b.shape = c; +}; +Entry.isFloat = function(b) { + return /\d+\.{1}\d+$/.test(b); +}; +Entry.getStringIndex = function(b) { + if (!b) { + return ""; + } + for (var a = {string:b, index:1}, d = 0, c = [], e = b.length - 1;0 < e;--e) { + var f = b.charAt(e); + if (isNaN(f)) { + break; } else { - switch(e = typeof a, e) { - case "number": - c.type = "number"; - g.push(a); - c.params = g; - break; - case "boolean": - 1 == a ? c.type = "True" : 0 == a && (c.type = "False"); - break; - default: - c.type = "text", g.push(a), c.params = g; - } + c.unshift(f), d = e; } - console.log("ParamBlock valueType", e); - console.log("ParamBlock result", c); - return c; - }; - a.Indicator = function(b, a, d) { - }; - a.MemberExpression = function(b) { - console.log("MemberExpression component", b); - var a = {}, d = b.object; - b = b.property; - d = this[d.type](d); - b = this[b.type](b); - console.log("MemberExpression objectData", d); - console.log("MemberExpression structure", b); - a.object = d; - a.property = b; - console.log("MemberExpression result", a); - return a; - }; - a.Identifier = function(b) { - console.log("Identifiler component", b); - b = b.name; - console.log("Identifiler result", b); + } + 0 < d && (a.string = b.substring(0, d), a.index = parseInt(c.join("")) + 1); + return a; +}; +Entry.getOrderedName = function(b, a, d) { + if (!b) { + return "untitled"; + } + if (!a || 0 === a.length) { return b; - }; - a.WhileStatement = function(b) { - console.log("WhileStatement component", b); - var a = {}, d = b.test, e; - 1 == d.value && (e = this.getBlockType("while True:\n$1")); - console.log("WhileStatement type", e); - var f = Entry.block[e].params; - console.log("WhileStatement paramsMeta", f); - var g = []; - d && (d.type = "Literal", f = f[0], d = "Indicator" == f.type ? null : this[d.type](f, d), g.push(d)); - d = []; - b = b.body.body; - for (var h in b) { - f = b[h], f = this[f.type](f), d.push(f); - } - a.type = e; - a.params = g; - a.statements = []; - a.statements.push(d); - console.log("WhileStatement result", a); - return a; - }; - a.BlockStatement = function(b) { - console.log("BlockStatement component", b); - this._blockStatmentIndex = 0; - this._blockStatments = []; - var a = {}; - b = b.body; - for (var d in b) { - var e = b[d]; - console.log("BlockStatement body", e, "i", d); - e = this[e.type](e); - console.log("BlockStatement bodyData", e, "i", d); - if (e.declarations) { - console.log("BlockStatement statements type params bodyData", d, e); - var e = e.declarations, f; - for (f in e) { - var g = e[f]; - g.init.type && (a.type = g.init.type); - g.init.params && (console.log("BlockStatement params", g.init.params), a.params = g.init.params); - console.log("BlockStatement structure", a, "j", f); - } - } else { - 0 == this._blockStatmentIndex && this._blockStatments.push(e); - } + } + d || (d = "name"); + for (var c = 0, e = Entry.getStringIndex(b), f = 0, g = a.length;f < g;f++) { + var h = Entry.getStringIndex(a[f][d]); + e.string === h.string && h.index > c && (c = h.index); + } + return 0 < c ? e.string + c : b; +}; +Entry.changeXmlHashId = function(b) { + if (/function_field/.test(b.getAttribute("type"))) { + for (var a = b.getElementsByTagName("mutation"), d = 0, c = a.length;d < c;d++) { + a[d].setAttribute("hashid", Entry.generateHash()); } - a.statements = [this._blockStatments]; - console.log("BlockStatement result", a); - this._blockStatmentIndex++; - return a; - }; - a.IfStatement = function(b) { - console.log("IfStatement component", b); - var a = {}, d = [], e = [], f = [], g = [], h = b.test, k = b.alternate, l = b.consequent; - b = this.getBlockType(null == k ? "if %1:\n$1" : "if %1:\n$1\nelse:\n$2"); - if (null != h) { - var m = Entry.block[b].params; - console.log("IfStatement paramsMeta", m); - d = []; - h.type = "Literal"; - m = m[0]; - h = "Indicator" == m.type ? null : this[h.type](m, h); - d.push(h); + } + return b; +}; +Entry.getMaxFloatPoint = function(b) { + for (var a = 0, d = 0, c = b.length;d < c;d++) { + var e = String(b[d]), f = e.indexOf("."); + -1 !== f && (e = e.length - (f + 1), e > a && (a = e)); + } + return Math.min(a, 20); +}; +Entry.convertToRoundedDecimals = function(b, a) { + return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); +}; +Entry.attachEventListener = function(b, a, d) { + setTimeout(function() { + b.addEventListener(a, d); + }, 0); +}; +Entry.deAttachEventListener = function(b, a, d) { + b.removeEventListener(a, d); +}; +Entry.isEmpty = function(b) { + if (!b) { + return !0; + } + for (var a in b) { + if (b.hasOwnProperty(a)) { + return !1; } - if (null != l) { - for (var n in l.body) { - if (h = l.body[n]) { - h = this[h.type](h), console.log("IfStatement consequent bodyData", h), e.push(h); - } + } + return !0; +}; +Entry.Utils.disableContextmenu = function(b) { + if (b) { + $(b).on("contextmenu", function(a) { + a.stopPropagation(); + a.preventDefault(); + return !1; + }); + } +}; +Entry.Utils.isRightButton = function(b) { + return 2 == b.button || b.ctrlKey; +}; +Entry.Utils.isTouchEvent = function(b) { + return "mousedown" !== b.type.toLowerCase(); +}; +Entry.Utils.inherit = function(b, a) { + function d() { + } + d.prototype = b.prototype; + a.prototype = new d; + return a; +}; +Entry.bindAnimationCallbackOnce = function(b, a) { + b.one("webkitAnimationEnd animationendo animationend", a); +}; +Entry.Utils.isInInput = function(b) { + return "textarea" == b.target.type || "text" == b.target.type; +}; +Entry.Utils.isFunction = function(b) { + return "function" === typeof b; +}; +Entry.Utils.addFilters = function(b, a) { + var d = b.elem("defs"), c = d.elem("filter", {id:"entryTrashcanFilter_" + a}); + c.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); + c.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); + c = c.elem("feMerge"); + c.elem("feMergeNode", {"in":"offsetBlur"}); + c.elem("feMergeNode", {"in":"SourceGraphic"}, c); + c = d.elem("filter", {id:"entryBlockShadowFilter_" + a, height:"200%"}); + c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); + c.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"}); + c.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); + d = d.elem("filter", {id:"entryBlockHighlightFilter_" + a}); + d.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); + d.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 d = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), c = d.elem("g"), e = c.elem("rect", {x:0, y:0, width:125, height:33}), f = Entry.mediaFilePath + "block_pattern_(order).png", g = 1;5 > g;g++) { + c.elem("image", {class:"pattern" + g, href:f.replace("(order)", g), x:0, y:0, width:125, height:33}); + } + return {pattern:d, rect:e}; +}; +Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; +Entry.Utils.createMouseEvent = function(b, a) { + var d = document.createEvent("MouseEvent"); + d.initMouseEvent(b, !0, !0, window, 0, 0, 0, a.clientX, a.clientY, !1, !1, !1, !1, 0, null); + return d; +}; +Entry.Utils.xmlToJsonData = function(b) { + b = $.parseXML(b); + var a = []; + b = b.childNodes[0].childNodes; + for (var d in b) { + var c = b[d]; + if (c.tagName) { + var e = {category:c.getAttribute("id"), blocks:[]}, c = c.childNodes; + for (d in c) { + var f = c[d]; + f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); } + a.push(e); } - if (null != k) { - for (n in k.body) { - if (h = k.body[n]) { - h = this[h.type](h), console.log("IfStatement alternate bodyData", h), f.push(h); + } + return a; +}; +Entry.Utils.stopProjectWithToast = function(b, a, d) { + var c = b.block; + a = a || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; + Entry.toast && !d && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); + Entry.engine && Entry.engine.toggleStop(); + "workspace" === Entry.type && (b.block && "funcBlock" in b.block ? c = b.block.funcBlock : b.funcExecutor && (c = b.funcExecutor.scope.block, b = b.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[b])), c && (Entry.container.selectObject(c.getCode().object.id, !0), c.view.getBoard().activateBlock(c))); + throw Error(a); +}; +Entry.Utils.AsyncError = function(b) { + this.name = "AsyncError"; + this.message = b || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; +}; +Entry.Utils.AsyncError.prototype = Error(); +Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; +Entry.Utils.isChrome = function() { + return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); +}; +Entry.Utils.waitForWebfonts = function(b, a) { + for (var d = 0, c = 0, e = b.length;c < e;++c) { + (function(c) { + function e() { + h && h.offsetWidth != k && (++d, h.parentNode.removeChild(h), h = null); + if (d >= b.length && (l && clearInterval(l), d == b.length)) { + return a(), !0; } } + var h = document.createElement("span"); + h.innerHTML = "giItT1WQy@!-/#"; + h.style.position = "absolute"; + h.style.left = "-10000px"; + h.style.top = "-10000px"; + h.style.fontSize = "300px"; + h.style.fontFamily = "sans-serif"; + h.style.fontVariant = "normal"; + h.style.fontStyle = "normal"; + h.style.fontWeight = "normal"; + h.style.letterSpacing = "0"; + document.body.appendChild(h); + var k = h.offsetWidth; + h.style.fontFamily = c; + var l; + e() || (l = setInterval(e, 50)); + })(b[c]); + } +}; +window.requestAnimFrame = function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(b) { + window.setTimeout(b, 1E3 / 60); + }; +}(); +Entry.isMobile = function() { + if (Entry.device) { + return "tablet" === Entry.device; + } + var b = window.platform; + if (b && b.type && ("tablet" === b.type || "mobile" === b.type)) { + return Entry.device = "tablet", !0; + } + Entry.device = "desktop"; + return !1; +}; +Entry.Utils.convertMouseEvent = function(b) { + return b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; +}; +Entry.Utils.convertIntToHex = function(b) { + return b.toString(16).toUpperCase(); +}; +Entry.Utils.hasSpecialCharacter = function(b) { + return /!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(b); +}; +Entry.Model = function(b, a) { + var d = Entry.Model; + d.generateSchema(b); + d.generateSetter(b); + d.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 c in b) { + (function(c) { + a.data[c] = b[c]; + Object.defineProperty(a, c, {get:function() { + return a.data[c]; + }}); + })(c); + } + a._toJSON = this._toJSON; } - 0 != e.length && g.push(e); - 0 != f.length && g.push(f); - a.type = b; - 0 != d.length && (a.params = d); - 0 != g.length && (a.statements = g); - console.log("IfStatement result", a); - return a; }; - a.VariableDeclaration = function(b) { - console.log("VariableDeclaration component", b); - var a = {}, d = []; - b = b.declarations; - for (var e in b) { - var f = b[e], f = this[f.type](f); - console.log("VariableDeclaration declarationData", f); - d.push(f); + b.generateSetter = function(a) { + a.set = this.set; + }; + b.set = function(a, b) { + var c = {}, e; + for (e in this.data) { + void 0 !== a[e] && (a[e] === this.data[e] ? delete a[e] : (c[e] = this.data[e], this.data[e] = a[e] instanceof Array ? a[e].concat() : a[e])); } - a.declarations = d; - console.log("VariableDeclaration result", a); - return a; + b || this.notify(Object.keys(a), c); }; - a.VariableDeclarator = function(b) { - console.log("VariableDeclarator component", b); - var a = {}, d = b.id, e = this[d.type](d); - console.log("VariableDeclarator idData", e); - b = b.init; - b = this[b.type](b); - console.log("VariableDeclarator initData", b); - a.id = d; - a.init = b; - console.log("VariableDeclarator result", a); - return a; + b.generateObserve = function(a) { + a.observers = []; + a.observe = this.observe; + a.unobserve = this.unobserve; + a.notify = this.notify; }; - a.BreakStatement = function(b) { - console.log("BreakStatement component", b); - b = {}; - var a = this.getBlockType("break"); - b.type = a; - console.log("BreakStatement result", b); - return b; + b.observe = function(a, b, c, e) { + c = new Entry.Observer(this.observers, a, b, c); + if (!1 !== e) { + a[b]([]); + } + return c; }; - a.UnaryExpression = function(b) { - console.log("UnaryExpression component", b); - var a = []; - b.prefix && (b = b.operator.concat(b.argument.value), a.push(b)); - result.params = a; - console.log("UnaryExpression result", result); - return result; + b.unobserve = function(a) { + a.destroy(); }; - a.LogicalExpression = function(b) { - console.log("LogicalExpression component", b); - var a = {}, d = String(b.operator); - switch(d) { - case "&&": - var e = "%1 and %3"; - break; - case "||": - e = "%1 or %3"; - break; - default: - e = "%1 and %3"; - } - var e = this.getBlockType(e), f = Entry.block[e].params; - console.log("LogicalExpression paramsMeta", f); - var g = [], d = b.left; - d.type ? ("Literal" == d.type ? (d = this[d.type](f[0], d), console.log("LogicalExpression left Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("LogicalExpression left param", d)) : (d = b.left, this[d.type](d)); - d = String(b.operator); - console.log("LogicalExpression operator", d); - d && (d = Entry.TextCodingUtil.prototype.logicalExpressionConvert(d), g.push(d)); - d = b.right; - d.type ? ("Literal" == d.type ? (d = this[d.type](f[2], d), console.log("LogicalExpression right Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("LogicalExpression right param", d)) : (d = b.right, this[d.type](d)); - a.type = e; - a.params = g; - console.log("LogicalExpression result", a); - return a; + b.notify = function(a, b) { + "string" === typeof a && (a = [a]); + var c = this; + c.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:c, oldValue:b[a]}; + })); + } + }); }; - a.BinaryExpression = function(b) { - console.log("BinaryExpression component", b); - var a = {params:[]}, d = String(b.operator); - console.log("BinaryExpression operator", d); - if (d) { - var e = "(%1 %2 %3)" + b._toJSON = function() { + var a = {}, b; + for (b in this.data) { + a[b] = this.data[b]; } - console.log("BinaryExpression syntax", e); - e = this.getBlockType(e); - console.log("BinaryExpression type", e); - var f = Entry.block[e].params; - console.log("BinaryExpression paramsMeta", f); - var g = [], d = b.left; - d.type ? ("Literal" == d.type ? (d = this[d.type](f[0], d), console.log("BinaryExpression left Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("BinaryExpression left param", d)) : (d = b.left, this[d.type](d)); - if (d = String(b.operator)) { - console.log("BinaryExpression operator", d), (d = Entry.TextCodingUtil.prototype.binaryOperatorConvert(d)) && g.push(d); - } - d = b.right; - d.type ? ("Literal" == d.type ? (d = this[d.type](f[2], d), console.log("BinaryExpression right Literal param", d)) : d = this[d.type](d), d && g.push(d), console.log("BinaryExpression right param", d)) : (d = b.right, this[d.type](d)); - console.log("BinaryExpression params", g); - a.type = e; - a.params = g; - console.log("BinaryExpression result", a); return a; }; - a.getBlockType = function(b) { - return this.blockSyntax[b]; - }; - a.FunctionDeclaration = function(b) { - console.log("FunctionDeclaration component", b); - console.log("FunctionDeclaration result", void 0); - return b; - }; - a.RegExp = function(b) { - console.log("RegExp", b); - console.log("RegExp result", void 0); - return b; - }; - a.Function = function(b) { - console.log("Function", b); - console.log("Function result", void 0); - return b; - }; - a.EmptyStatement = function(b) { - console.log("EmptyStatement", b); - console.log("EmptyStatement result", void 0); - return b; - }; - a.DebuggerStatement = function(b) { - console.log("DebuggerStatement", b); - console.log("DebuggerStatement result", void 0); - return b; - }; - a.WithStatement = function(b) { - console.log("WithStatement", b); - console.log("WithStatement result", void 0); - return b; - }; - a.ReturnStaement = function(b) { - console.log("ReturnStaement", b); - console.log("ReturnStaement result", void 0); - return b; - }; - a.LabeledStatement = function(b) { - console.log("LabeledStatement", b); - console.log("LabeledStatement result", void 0); - return b; - }; - a.BreakStatement = function(b) { - console.log("BreakStatement", b); - console.log("BreakStatement result", void 0); - return b; - }; - a.ContinueStatement = function(b) { - console.log("ContinueStatement", b); - console.log("ContinueStatement result", void 0); - return b; - }; - a.SwitchStatement = function(b) { - console.log("SwitchStatement", b); - console.log("SwitchStatement result", void 0); - return b; - }; - a.SwitchCase = function(b) { - console.log("SwitchCase", b); - console.log("SwitchCase result", void 0); - return b; - }; - a.ThrowStatement = function(b) { - console.log("ThrowStatement", b); - console.log("ThrowStatement result", void 0); - return b; - }; - a.TryStatement = function(b) { - console.log("TryStatement", b); - console.log("TryStatement result", void 0); - return b; - }; - a.CatchClause = function(b) { - console.log("CatchClause", b); - console.log("CatchClause result", void 0); - return b; - }; - a.DoWhileStatement = function(b) { - console.log("DoWhileStatement", b); - console.log("DoWhileStatement result", void 0); - return b; - }; - a.ForInStatement = function(b) { - console.log("ForInStatement", b); - console.log("ForInStatement result", void 0); - return b; - }; - a.FunctionDeclaration = function(b) { - console.log("FunctionDeclaration", b); - console.log("FunctionDeclaration result", void 0); - return b; - }; - a.ThisExpression = function(b) { - console.log("ThisExpression", b); - console.log("ThisExpression result", void 0); - return b; - }; - a.ArrayExpression = function(b) { - console.log("ArrayExpression", b); - console.log("ArrayExpression result", void 0); - return b; - }; - a.ObjectExpression = function(b) { - console.log("ObjectExpression", b); - console.log("ObjectExpression result", void 0); - return b; - }; - a.Property = function(b) { - console.log("Property", b); - console.log("Property result", void 0); - return b; - }; - a.FunctionExpression = function(b) { - console.log("FunctionExpression", b); - console.log("FunctionExpression result", void 0); - return b; - }; - a.UpdateExpression = function(b) { - console.log("UpdateExpression", b); - console.log("UpdateExpression result", void 0); - return b; - }; - a.ConditionalExpression = function(b) { - console.log("ConditionalExpression", b); - console.log("ConditionalExpression result", void 0); - return b; - }; - a.NewExpression = function(b) { - console.log("NewExpression", b); - console.log("NewExpression result", void 0); - return b; - }; - a.SequenceExpression = function(b) { - console.log("SequenceExpression", b); - console.log("SequenceExpression result", void 0); - return b; - }; -})(Entry.PyBlockAssembler.prototype); -Entry.PyToBlockParserTemp = function(a) { - this._assembler = new Entry.PyBlockAssembler(a); +})(Entry.Model); +Entry.Func = function(b) { + this.id = b ? b.id : Entry.generateHash(); + this.content = b ? new Entry.Code(b.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); + this.blockMenuBlock = this.block = null; + this.hashMap = {}; + this.paramMap = {}; + Entry.generateFunctionSchema(this.id); + if (b) { + b = this.content._blockMap; + for (var a in b) { + Entry.Func.registerParamBlock(b[a].type); + } + Entry.Func.generateWsBlock(this); + } + Entry.Func.registerFunction(this); + Entry.Func.updateMenu(); }; -(function(a) { - a.Program = function(b) { - var a = [], d; - for (d in b) { - if ("Program" != b[d].type) { - return; +Entry.Func.threads = {}; +Entry.Func.registerFunction = function(b) { + if (Entry.playground) { + var a = Entry.playground.mainWorkspace; + a && (this._targetFuncBlock = a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + b.id}]), b.blockMenuBlock = this._targetFuncBlock); + } +}; +Entry.Func.executeFunction = function(b) { + var a = this.threads[b]; + if (a = Entry.Engine.computeThread(a.entity, a)) { + return this.threads[b] = a, !0; + } + delete this.threads[b]; + return !1; +}; +Entry.Func.clearThreads = function() { + this.threads = {}; +}; +Entry.Func.prototype.init = function(b) { + this.id = b.id; + this.content = Blockly.Xml.textToDom(b.content); + this.block = Blockly.Xml.textToDom("" + b.block + "").childNodes[0]; +}; +Entry.Func.prototype.destroy = function() { + this.blockMenuBlock.destroy(); +}; +Entry.Func.edit = function(b) { + this.cancelEdit(); + this.targetFunc = b; + this.initEditView(b.content); + this.bindFuncChangeEvent(); + this.updateMenu(); +}; +Entry.Func.initEditView = function(b) { + this.menuCode || this.setupMenuCode(); + var a = Entry.playground.mainWorkspace; + a.setMode(Entry.Workspace.MODE_OVERLAYBOARD); + a.changeOverlayBoardCode(b); + b.recreateView(); + a.changeOverlayBoardCode(b); + b.view.board.alignThreads(); + this._workspaceStateEvent = a.changeEvent.attach(this, this.endEdit); +}; +Entry.Func.endEdit = function(b) { + this.unbindFuncChangeEvent(); + this._workspaceStateEvent.destroy(); + delete this._workspaceStateEvent; + switch(b) { + case "save": + this.save(); + case "cancelEdit": + this.cancelEdit(); + } +}; +Entry.Func.save = function() { + this.targetFunc.generateBlock(!0); + Entry.variableContainer.saveFunction(this.targetFunc); +}; +Entry.Func.syncFuncName = function(b) { + var a = 0, d = [], d = b.split(" "), c = ""; + b = []; + b = Blockly.mainWorkspace.getAllBlocks(); + for (var e = 0;e < b.length;e++) { + var f = b[e]; + if ("function_general" === f.type) { + for (var g = [], g = f.inputList, h = 0;h < g.length;h++) { + f = g[h], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_ && (c += f.fieldRow[0].text_, c += " "); } - var e = [], f = b[d].body; - console.log("nodes", f); - for (d in f) { - var g = f[d], g = this[g.type](g); - console.log("checkitout", g); - g = this._assembler[g.type](g); - e.push(g); + c = c.trim(); + if (c === this.srcFName && this.srcFName.split(" ").length == d.length) { + for (c = 0;c < g.length;c++) { + if (f = g[c], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_) { + if (void 0 === d[a]) { + g.splice(c, 1); + break; + } else { + f.fieldRow[0].text_ = d[a]; + } + a++; + } + } } - console.log("thread", e); - a.push(e); + c = ""; + a = 0; } - return a; - }; - a.Identifier = function(b) { - console.log("Identifier", b); - return {type:b.type, name:b.name}; - }; - a.FunctionDeclaration = function(b) { - console.log("FunctionDeclaration", b); - var a = this[b.id.type](b.id); - return {type:b.type, id:a}; - }; - a.Literal = function(b) { - console.log("Literal", b); - console.log("typeof node at Literal", typeof b.value); - var a; - "string" === typeof b.value ? a = b.value : "boolean" === typeof b.value ? a = b.value : "number" === typeof b.value ? a = b.value : "RegExp" === typeof b.value ? (a = this[typeof b.value](b), a = a.regex.pattern) : a = null; - console.log("value", a); - return {type:b.type, value:a}; - }; - a.RegExp = function(b) { - console.log("RegExp", b); - return {regex:b.regex}; + } + a = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); + Blockly.mainWorkspace.clear(); + Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, a); +}; +Entry.Func.cancelEdit = function() { + this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); +}; +Entry.Func.getMenuXml = function() { + var b = []; + this.targetFunc || (b = b.concat(this.createBtn)); + if (this.targetFunc) { + var a = this.FIELD_BLOCK, a = a.replace("#1", Entry.generateHash()), a = a.replace("#2", Entry.generateHash()), a = Blockly.Xml.textToDom(a).childNodes, b = b.concat(Entry.nodeListToArray(a)) + } + for (var d in Entry.variableContainer.functions_) { + a = Entry.variableContainer.functions_[d], a === this.targetFunc ? (a = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), a.id).block, b.push(a)) : b.push(a.block); + } + return b; +}; +Entry.Func.syncFunc = function() { + var b = Entry.Func; + if (b.targetFunc) { + var a = b.workspace.topBlocks_[0].toString(), d = b.workspace.topBlocks_.length; + (b.fieldText != a || b.workspaceLength != d) && 1 > Blockly.Block.dragMode_ && (b.updateMenu(), b.fieldText = a, b.workspaceLength = d); + } +}; +Entry.Func.setupMenuCode = function() { + var b = Entry.playground.mainWorkspace; + b && (b = b.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = b.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = b.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = b.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = b); +}; +Entry.Func.refreshMenuCode = function() { + if (Entry.playground.mainWorkspace) { + this.menuCode || this.setupMenuCode(); + var b = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; + 2 < b && this._fieldString.params[0].changeType(this.requestParamBlock("string")); + b = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; + 2 < b && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); + } +}; +Entry.Func.requestParamBlock = function(b) { + var a = Entry.generateHash(), d; + switch(b) { + case "string": + d = Entry.block.function_param_string; + break; + case "boolean": + d = Entry.block.function_param_boolean; + break; + default: + return null; + } + a = b + "Param_" + a; + b = Entry.Func.createParamBlock(a, d, b); + Entry.block[a] = b; + return a; +}; +Entry.Func.registerParamBlock = function(b) { + -1 < b.indexOf("stringParam") ? Entry.Func.createParamBlock(b, Entry.block.function_param_string, b) : -1 < b.indexOf("booleanParam") && Entry.Func.createParamBlock(b, Entry.block.function_param_boolean, b); +}; +Entry.Func.createParamBlock = function(b, a, d) { + var c = function() { }; - a.Function = function(b) { - console.log("Function", b); - var a = this[b.id](b), d = [], e; - for (e in b.params) { - d.push(b.params[e]); + d = "string" === d ? "function_param_string" : "function_param_boolean"; + c.prototype = a; + c = new c; + c.changeEvent = new Entry.Event; + c.template = Lang.template[d]; + return Entry.block[b] = c; +}; +Entry.Func.updateMenu = function() { + if (Entry.playground && Entry.playground.mainWorkspace) { + var b = Entry.playground.mainWorkspace.getBlockMenu(); + this.targetFunc ? (this.menuCode || this.setupMenuCode(), b.banClass("functionInit"), b.unbanClass("functionEdit")) : (b.unbanClass("functionInit"), b.banClass("functionEdit")); + b.reDraw(); + } +}; +Entry.Func.prototype.edit = function() { + Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); +}; +Entry.Func.generateBlock = function(b) { + b = Entry.block["func_" + b.id]; + var a = {template:b.template, params:b.params}, d = /(%\d)/mi, c = b.template.split(d), e = "", f = 0, g = 0, h; + for (h in c) { + var k = c[h]; + d.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; + } + return {block:a, description:e}; +}; +Entry.Func.prototype.generateBlock = function(b) { + b = Entry.Func.generateBlock(this); + this.block = b.block; + this.description = b.description; +}; +Entry.Func.generateWsBlock = function(b) { + this.unbindFuncChangeEvent(); + b = b ? b : this.targetFunc; + for (var a = b.content.getEventMap("funcDef")[0].params[0], d = 0, c = 0, e = [], f = "", g = b.hashMap, h = b.paramMap;a;) { + var k = a.params[0]; + switch(a.type) { + case "function_field_label": + f = f + " " + k; + break; + case "function_field_boolean": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (d ? d : "")}); + g[k.type] = !1; + h[k.type] = d + c; + d++; + e.push({type:"Block", accept:"boolean"}); + f += " %" + (d + c); + break; + case "function_field_string": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (c ? c : "")}), g[k.type] = !1, h[k.type] = d + c, c++, f += " %" + (d + c), e.push({type:"Block", accept:"string"}); } - b = this[b.body](b); - return {id:a, params:d, body:b}; - }; - a.ExpressionStatement = function(b) { - var a = this[b.expression.type](b.expression); - return {type:b.type, expression:a}; + a = a.getOutputBlock(); + } + d++; + f += " %" + (d + c); + e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); + Entry.Mutator.mutate("func_" + b.id, {params:e, template:f}); + for (var l in g) { + g[l] ? (a = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:a})) : g[l] = !0; + } + this.bindFuncChangeEvent(b); +}; +Entry.Func.bindFuncChangeEvent = function(b) { + b = b ? b : this.targetFunc; + !this._funcChangeEvent && b.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = b.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); +}; +Entry.Func.unbindFuncChangeEvent = function() { + this._funcChangeEvent && this._funcChangeEvent.destroy(); + delete this._funcChangeEvent; +}; +Entry.HWMontior = {}; +Entry.HWMonitor = function(b) { + this.svgDom = Entry.Dom($('')); + this._hwModule = b; + var a = this; + Entry.addEventListener("windowResized", function() { + var b = a._hwModule.monitorTemplate.mode; + "both" == b && (a.resize(), a.resizeList()); + "list" == b ? a.resizeList() : a.resize(); + }); + Entry.addEventListener("hwModeChange", function() { + a.changeMode(); + }); + this.changeOffset = 0; + this.scale = .5; + this._listPortViews = {}; +}; +(function(b) { + b.initView = function() { + this.svgDom = Entry.Dom($('')); }; - a.BlockStatement = function(b) { - console.log("BlockStatement", b); - var a = [], d; - for (d in b.body) { - var e = b.body[d]; - console.log("BlockStatement statement", e); - e = this[e.type](e); - console.log("BlockStatement body", e); - a.push(e); + b.generateView = function() { + this.snap = Entry.SVG("hwMonitor"); + this._svgGroup = this.snap.elem("g"); + this._portMap = {n:[], e:[], s:[], w:[]}; + var a = this._hwModule.monitorTemplate, b = {href:Entry.mediaFilePath + a.imgPath, x:-a.width / 2, y:-a.height / 2, width:a.width, height:a.height}; + this._portViews = {}; + this.hwView = this._svgGroup.elem("image"); + this.hwView = this.hwView.attr(b); + this._template = a; + a = a.ports; + this.pathGroup = null; + this.pathGroup = this._svgGroup.elem("g"); + var b = [], c; + for (c in a) { + var e = this.generatePortView(a[c], "_svgGroup"); + this._portViews[c] = e; + b.push(e); } - console.log("bodies", a); - return {type:b.type, body:a}; - }; - a.EmptyStatement = function(b) { - console.log("EmptyStatement", b); - return {type:b.type}; - }; - a.DebuggerStatement = function(b) { - console.log("DebuggerStatement", b); - return {type:b.type}; - }; - a.WithStatement = function(b) { - console.log("WithStatement", b); - var a = this[b.object.type](b.object), d = this[b.body.type](b.body); - return {type:b.type, object:a, body:d}; + b.sort(function(a, b) { + return a.box.x - b.box.x; + }); + var f = this._portMap; + b.map(function(a) { + (1 > (Math.atan2(-a.box.y, a.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(a); + }); + this.resize(); }; - a.ReturnStaement = function(b) { - console.log("ReturnStaement", b); - var a; - a = null === b.argument ? null : this[b.argument.type](b.argument); - return {type:b.type, argument:a}; + b.toggleMode = function(a) { + var b = this._hwModule.monitorTemplate; + "list" == a ? (b.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && + (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); }; - a.LabeledStatement = function(b) { - console.log("LabeledStatement", b); - var a = this[b.label.type](b.label), d = this[b.body.type](b.body); - return {type:b.type, label:a, body:d}; + b.setHwmonitor = function(a) { + this._hwmodule = a; }; - a.BreakStatement = function(b) { - console.log("BreakStatement", b); - var a; - console.log("node.label", b.label); - b.label && null !== b.label ? (console.log("node.label2", b.label), a = this[b.label.type](b.label)) : (console.log("node.lable1", b.label), a = null); - console.log("label", a); - return {type:b.type, label:a}; + b.changeMode = function(a) { + "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); }; - a.ContinueStatement = function(b) { - console.log("ContinueStatement", b); - var a; - a = null === b.label ? null : this[b.label.type](b.label); - return {type:b.type, label:a}; - }; - a.IfStatement = function(b) { - console.log("IfStatement", b); - var a = this[b.test.type](b.test), d = {body:[]}; - if (null === b.alternate) { - d = null; - } else { - for (var e in b.alternate.body) { - var f = b.alternate.body[e], g = this[f.type](f); - d.body.push(g); - } - } - g = {body:[]}; - for (e in b.consequent.body) { - f = b.consequent.body[e], f = this[f.type](f), g.body.push(f); + b.addPortEle = function(a, b) { + if ("object" != typeof b) { + return a; } - console.log("alternate", d); - console.log("consequent", g); - return {type:b.type, test:a, consequent:g, alternate:d}; - }; - a.SwitchStatement = function(b) { - console.log("SwitchStatement", b); - var a = this[b.discriminant.type](b.discriminant), d = [], e; - for (e in b.cases) { - var f = b.cases[e], f = this[f.type](f); - d.push(f); + for (var c in b) { + a[c] = b[c]; } - return {type:b.type, discriminant:a, cases:d}; + return a; }; - a.SwitchCase = function(b) { - console.log("SwitchCase", b); - var a; - a = null === b.test ? null : this[b.test.type](b.test); - for (var d in b.consequent) { - b = this[statment.type](statment), (void 0).push(b); + b.removePortEle = function(a, b) { + if ("object" != typeof b) { + return a; } - return {test:a, consequent:void 0}; - }; - a.ThrowStatement = function(b) { - console.log("ThrowStatement", b); - var a = this[b.argument.type](b.argument); - return {type:b.type, argument:a}; - }; - a.TryStatement = function(b) { - console.log("TryStatement", b); - var a = this[b.block.type](b.block), d; - d = null === b.handler ? null : this[b.handler.type](b.handler); - var e; - e = null === b.finalizer ? null : this[b.finalizer.type](b.finalizer); - return {type:b.type, block:a, handler:d, finalizer:e}; - }; - a.CatchClause = function(b) { - console.log("CatchClause", b); - var a = b.param; - b = this[b.body.type](b.body); - return {param:a, body:b}; - }; - a.WhileStatement = function(b) { - console.log("WhileStatement", b); - var a = this[b.test.type](b.test), d = this[b.body.type](b.body); - console.log("WhileStatement test", a); - console.log("WhileStatement body", d); - return {type:b.type, test:a, body:d}; - }; - a.DoWhileStatement = function(b) { - console.log("DoWhileStatement", b); - var a; - a = this[b.init.type](b.init); - var d; - d = null === b.test ? null : this[b.test.type](b.test); - var e; - e = null === b.update ? null : this[b.update.type](b.update); - var f = this[b.body.type](b.body); - return {type:b.type, init:a, test:d, update:e, body:f}; - }; - a.ForStatement = function(b) { - console.log("ForStatement", b); - var a; - if (null === b.init) { - a = null; - } else { - this[b.init.type](b.init); + for (var c in b) { + delete a[c]; } - var d; - d = null === b.test ? null : this[b.test.type](b.test); - var e; - e = null === b.update ? null : this[b.update.type](b.update); - var f = this[b.body.type](b.body); - console.log("ForStatement body", f); - return {type:b.type, init:a, test:d, update:e, body:f}; - }; - a.ForInStatement = function(b) { - console.log("ForInStatement", b); - var a; - a = this[b.left.type](b.left); - var d = this[b.right.type](b.right), e = this[b.body.type](b.body); - return {type:b.type, left:a, right:d, body:e}; - }; - a.FunctionDeclaration = function(b) { - console.log("FunctionDeclaration", b); - return {id:this[b.id.type](b.id)}; + return a; }; - a.VariableDeclaration = function(b) { - console.log("VariableDeclaration", b); - var a = [], d; - for (d in b.declarations) { - var e = b.declarations[d], e = this[e.type](e); - console.log("declaration", e); - a.push(e); + b.generateListView = function() { + this._portMapList = {n:[]}; + this._svglistGroup = null; + this.listsnap = Entry.SVG("hwMonitor"); + this._svglistGroup = this.listsnap.elem("g"); + var a = this._hwModule.monitorTemplate; + this._template = a; + a = a.listPorts; + this.pathGroup = this._svglistGroup.elem("g"); + var b = [], c; + for (c in a) { + var e = this.generatePortView(a[c], "_svglistGroup"); + this._listPortViews[c] = e; + b.push(e); } - console.log("VariableDeclaration declarations", a); - return {type:b.type, declarations:a, kind:"var"}; - }; - a.VariableDeclarator = function(b) { - console.log("VariableDeclarator", b); - var a = this[b.id.type](b.id), d; - d = null === b.init ? null : this[b.init.type](b.init); - console.log("id", a); - console.log("init", d); - return {type:b.type, id:a, init:d}; + var f = this._portMapList; + b.map(function(a) { + f.n.push(a); + }); + this.resizeList(); }; - a.ThisExpression = function(b) { - console.log("ThisExpression", b); - return {type:b.type}; + b.generatePortView = function(a, b) { + var c = this[b].elem("g"); + c.addClass("hwComponent"); + var e = null, e = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === a.type ? "#00979d" : "#A751E3", "stroke-width":3}), f = c.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), g = c.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); + g.textContent = a.name; + g = g.getComputedTextLength(); + c.elem("rect").attr({x:g + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === a.type ? "#00979d" : "#A751E3"}); + var h = c.elem("text").attr({x:g + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); + h.textContent = 0; + g += 40; + f.attr({width:g}); + return {group:c, value:h, type:a.type, path:e, box:{x:a.pos.x - this._template.width / 2, y:a.pos.y - this._template.height / 2, width:g}, width:g}; + }; + b.getView = function() { + return this.svgDom; }; - a.ArrayExpression = function(b) { - console.log("ArrayExpression", b); - var a; - if (null === b.elements) { - a = null; + b.update = function() { + var a = Entry.hw.portData, b = Entry.hw.sendQueue, c = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; + if ("list" == c) { + f = this._listPortViews; } else { - for (var d in b.elements) { - var e = b.elements[d], e = this[e.type](e); - a.push(e); + if ("both" == c) { + if (f = this._listPortViews, this._portViews) { + for (var g in this._portViews) { + f[g] = this._portViews[g]; + } + } + } else { + f = this._portViews; } } - return {type:b.type, elements:a}; - }; - a.ObjectExpression = function(b) { - console.log("ObjectExpression", b); - for (var a in b.properties) { - var d = b.properties[a], d = this[d.type](d); - (void 0).push(d); + if (b) { + for (g in b) { + 0 != b[g] && f[g] && (f[g].type = "output"); + } } - return {type:b.type, properties:void 0}; - }; - a.Property = function(b) { - console.log("Property", b); - var a = this[b.key.type](b.key), d = this[b.value.type](b.value); - return {type:b.type, key:a, value:d, kind:b.kind}; - }; - a.FunctionExpression = function(b) { - console.log("FunctionExpression", b); - return {type:b.type}; - }; - a.UnaryExpression = function(b) { - console.log("UnaryExpression", b); - var a; - switch(b.operator) { - case "-": - a = b.operator; - break; - case "+": - a = b.operator; - break; - case "!": - a = b.operator; - break; - case "~": - a = b.operator; - break; - case "typeof": - a = b.operator; - break; - case "void": - a = b.operator; - break; - case "delete": - a = b.operator; - break; - default: - a = null; + for (var h in f) { + if (c = f[h], "input" == c.type) { + var k = a[h]; + 0 < e.length && $.each(e, function(a, b) { + if ($.isPlainObject(k)) { + k = k[b] || 0; + } else { + return !1; + } + }); + c.value.textContent = k ? k : 0; + c.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); + } else { + k = b[h], 0 < e.length && $.each(e, function(a, b) { + if ($.isPlainObject(k)) { + k = k[b] || 0; + } else { + return !1; + } + }), c.value.textContent = k ? k : 0, c.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); + } } - var d = b.prefix, e = this[b.argument.type](b.argument); - return {type:b.type, operator:a, prefix:d, argument:e}; }; - a.UpdateExpression = function(b) { - console.log("UpdateExpression", b); - var a; - switch(b.operator) { - case "++": - a = b.operator; - break; - case "--": - a = b.operator; - break; - default: - a = null; + b.resize = function() { + this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); + if (this.svgDom) { + var a = this.svgDom.get(0).getBoundingClientRect() } - var d = this[b.argument.type](b.argument); - return {type:b.type, operator:a, prefix:b.prefix, argument:d}; + this._svgGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 1.8 + ")"}); + this._rect = a; + 0 >= this._template.height || 0 >= a.height || (this.scale = a.height / this._template.height * this._template.height / 1E3, this.align()); }; - a.BinaryExpression = function(b) { - console.log("BinaryExpression", b); - var a; - switch(b.operator) { - case "==": - a = b.operator; - break; - case "!=": - a = b.operator; - break; - case "===": - a = b.operator; - break; - case "!==": - a = b.operator; - break; - case "<": - a = b.operator; - break; - case "<=": - a = b.operator; - break; - case ">": - a = b.operator; - break; - case ">=": - a = b.operator; - break; - case "<<": - a = b.operator; - break; - case ">>": - a = b.operator; - break; - case ">>>": - a = b.operator; - break; - case "+": - a = b.operator; - break; - case "-": - a = b.operator; - break; - case "*": - a = b.operator; - break; - case "/": - a = b.operator; - break; - case "%": - a = b.operator; - break; - case "|": - a = b.operator; - break; - case "^": - a = b.operator; - break; - case "|": - a = b.operator; - break; - case "&": - a = b.operator; - break; - case "in": - a = b.operator; - break; - case "instanceof": - a = b.operator; - break; - default: - a = null; - } - var d = this[b.left.type](b.left), e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:d, right:e}; + b.resizeList = function() { + var a = this.svgDom.get(0).getBoundingClientRect(); + this._svglistGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 2 + ")"}); + this._rect = a; + this.alignList(); }; - a.AssignmentExpression = function(b) { - console.log("AssignmentExpression", b); - var a; - switch(b.operator) { - case "=": - a = b.operator; - break; - case "+=": - a = b.operator; - break; - case "-=": - a = b.operator; - break; - case "*=": - a = b.operator; - break; - case "/=": - a = b.operator; - break; - case "%=": - a = b.operator; - break; - case "<<=": - a = b.operator; - break; - case ">>=": - a = b.operator; - break; - case "|=": - a = b.operator; - break; - case "^=": - a = b.operator; - break; - case "&=": - a = b.operator; - break; - default: - a = null; + b.align = function() { + var a = [], a = this._portMap.s.concat(); + this._alignNS(a, this.scale / 3 * this._template.height + 5, 27); + a = this._portMap.n.concat(); + this._alignNS(a, -this._template.height * this.scale / 3 - 32, -27); + a = this._portMap.e.concat(); + this._alignEW(a, -this._template.width * this.scale / 3 - 5, -27); + a = this._portMap.w.concat(); + this._alignEW(a, this._template.width * this.scale / 3 - 32, -27); + }; + b.alignList = function() { + for (var a = {}, a = this._hwModule.monitorTemplate.listPorts, b = a.length, c = 0;c < a.length;c++) { + a[c].group.attr({transform:"translate(" + this._template.width * (c / b - .5) + "," + (-this._template.width / 2 - 30) + ")"}); + } + a = this._portMapList.n.concat(); + this._alignNSList(a, -this._template.width * this.scale / 2 - 32, -27); + }; + b._alignEW = function(a, b, c) { + var e = a.length, f = this._rect.height - 50; + tP = -f / 2; + bP = f / 2; + height = this._rect.height; + listVLine = wholeHeight = 0; + mode = this._hwModule.monitorTemplate; + for (f = 0;f < e;f++) { + wholeHeight += a[f].height + 5; } - var d; - d = b.left; - var e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:d, right:e}; + wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); + for (;1 < e;) { + var g = a.shift(), f = a.pop(), h = tP, k = bP, l = c; + wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === a.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); + wholeWidth -= g.width + f.width + 10; + b += l; + } + a.length && a[0].group.attr({transform:"translate(" + b + ",60)"}); + g && rPort && (this._movePort(g, b, tP, h), this._movePort(rPort, b, bP, k)); }; - a.LogicalExpression = function(b) { - console.log("LogicalExpression", b); - var a; - switch(b.operator) { - case "||": - a = b.operator; - break; - case "&&": - a = b.operator; - break; - default: - a = null; + b._alignNS = function(a, b, c) { + for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < a.length;k++) { + h += a[k].width + 5; } - var d = this[b.left.type](b.left), e = this[b.right.type](b.right); - return {type:b.type, operator:a, left:d, right:e}; - }; - a.MemberExpression = function(b) { - console.log("MemberExpression", b); - var a = this[b.object.type](b.object), d = this[b.property.type](b.property), e = b.computed; - console.log("object", a); - console.log("property", d); - return {type:b.type, object:a, property:d, computed:e}; - }; - a.ConditionalExpression = function(b) { - console.log("ConditionalExpression", b); - var a = this[b.callee.type](b.callee), d; - for (d in b.arguments) { - var e = b.arguments[d], e = this[e.type](e); - (void 0).push(e); + h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); + for (;1 < a.length;) { + var k = a.shift(), l = a.pop(), m = e, n = f, q = c; + h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, e, b, m); + this._movePort(l, f, b, n); + h -= k.width + l.width + 10; + b += q; } - return {type:b.type, callee:a, arguments:void 0}; + a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); }; - a.CallExpression = function(b) { - console.log("CallExpression", b); - var a = this[b.callee.type](b.callee), d = [], e; - for (e in b.arguments) { - var f = b.arguments[e], f = this[f.type](f); - d.push(f); + b._alignNSList = function(a, b) { + var c = this._rect.width; + initX = -this._rect.width / 2 + 10; + initY = -this._rect.height / 2 + 10; + for (var e = listLine = wholeWidth = 0;e < a.length;e++) { + wholeWidth += a[e].width; + } + for (var f = 0, g = 0, h = initX, k = 0, l = 0, m = 0, e = 0;e < a.length;e++) { + l = a[e], e != a.length - 1 && (m = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > c - (l.width + m.width / 2.2) && (f += 1, initX = h, g = 0); } - console.log("callee", a); - console.log("arguments", d); - return {type:b.type, callee:a, arguments:d}; }; - a.NewExpression = function(b) { - console.log("NewExpression", b); - return {type:b.type}; + b._movePort = function(a, b, c, e) { + var f = b, g = a.box.x * this.scale, h = a.box.y * this.scale; + b > e ? (f = b - a.width, b = b > g && g > e ? "M" + g + "," + c + "L" + g + "," + h : "M" + (b + e) / 2 + "," + c + "l0," + (h > c ? 28 : -3) + "H" + g + "L" + g + "," + h) : b = b < g && g < e ? "m" + g + "," + c + "L" + g + "," + h : "m" + (e + b) / 2 + "," + c + "l0," + (h > c ? 28 : -3) + "H" + g + "L" + g + "," + h; + a.group.attr({transform:"translate(" + f + "," + c + ")"}); + a.path.attr({d:b}); }; - a.SequenceExpression = function(b) { - console.log("SequenceExpression", b); - for (var a in b.expressions) { - var d = b.expressions[a], d = this[d.type](d); - (void 0).push(d); +})(Entry.HWMonitor.prototype); +Entry.HW = function() { + this.sessionRoomId = localStorage.getItem("entryhwRoomId"); + this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), localStorage.setItem("entryhwRoomId", this.sessionRoomId)); + this.connectTrial = 0; + this.isFirstConnect = !0; + this.downloadPath = "http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe"; + this.hwPopupCreate(); + this.initSocket(); + this.connected = !1; + this.portData = {}; + this.sendQueue = {}; + this.outputQueue = {}; + this.settingQueue = {}; + this.socketType = this.hwModule = this.selectedDevice = null; + Entry.addEventListener("stop", this.setZero); + this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino, "10.1":Entry.Roborobo_Roduino, "10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3, "B.1":Entry.Codestar}; +}; +Entry.HW.TRIAL_LIMIT = 2; +p = Entry.HW.prototype; +p.createRandomRoomId = function() { + return "xxxxxxxxyx".replace(/[xy]/g, function(b) { + var a = 16 * Math.random() | 0; + return ("x" == b ? a : a & 3 | 8).toString(16); + }); +}; +p.connectWebSocket = function(b, a) { + var d = this, c = io(b, a); + c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); + c.io.reconnectionDelayMax(1E3); + c.io.timeout(1E3); + c.on("connect", function() { + console.log("connect"); + d.socketType = "WebSocket"; + d.initHardware(c); + }); + c.on("matched", function(a) { + c.emit("matchTarget", {target:a}); + }); + c.on("mode", function(a) { + 0 === c.mode && 1 === a && d.disconnectHardware(); + c.mode = a; + }); + c.on("message", function(a) { + if (a.data && "string" === typeof a.data) { + switch(a.data) { + case "disconnectHardware": + d.disconnectHardware(); + break; + default: + a = JSON.parse(a.data), d.checkDevice(a), d.updatePortData(a); + } + } + }); + c.on("disconnect", function() { + console.log("disconnect"); + d.isOpenHardware ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); + }); + return c; +}; +p.initSocket = function() { + try { + this.connected = !1; + this.tlsSocketIo && this.tlsSocketIo.removeAllListeners(); + this.socketIo && this.socketIo.removeAllListeners(); + this.isOpenHardware || this.checkOldClient(); + if (-1 < location.protocol.indexOf("https")) { + this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } else { + if (Entry.isOffline) { + this.tlsSocketIo = this.connectWebSocket("http://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } else { + try { + this.socketIo = this.connectWebSocket("http://127.0.0.1:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } catch (b) { + } + try { + this.tlsSocketIo = this.connectWebSocket("https://hardware.play-entry.org:23518", {query:{client:!0, roomId:this.sessionRoomId}}); + } catch (b) { + } + } + } + Entry.dispatchEvent("hwChanged"); + } catch (b) { + } +}; +p.checkOldClient = function() { + try { + var b = this, a = new WebSocket("wss://hardware.play-entry.org:23518"); + a.onopen = function() { + b.popupHelper.show("newVersion", !0); + a.close(); + }; + } catch (d) { + } +}; +p.retryConnect = function() { + this.isOpenHardware = !1; + Entry.HW.TRIAL_LIMIT = 5; + this.initSocket(); +}; +p.openHardwareProgram = function() { + this.isOpenHardware = !0; + Entry.HW.TRIAL_LIMIT = 5; + this.socket ? this.executeHardware() : (this.executeHardware(), this.initSocket()); +}; +p.initHardware = function(b) { + this.socket = b; + this.connectTrial = 0; + this.connected = !0; + Entry.dispatchEvent("hwChanged"); + Entry.playground && Entry.playground.object && Entry.playground.setMenu(Entry.playground.object.objectType); +}; +p.disconnectHardware = function() { + Entry.propertyPanel.removeMode("hw"); + this.hwModule = this.selectedDevice = void 0; + Entry.dispatchEvent("hwChanged"); +}; +p.disconnectedSocket = function() { + this.tlsSocketIo.close(); + this.socketIo && this.socketIo.close(); + Entry.propertyPanel.removeMode("hw"); + this.socket = void 0; + this.connectTrial = 0; + this.connected = !1; + this.hwModule = this.selectedDevice = void 0; + Entry.dispatchEvent("hwChanged"); + Entry.toast.alert("\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8 \uc5f0\uacb0 \uc885\ub8cc", "\ud558\ub4dc\uc6e8\uc5b4 \ud504\ub85c\uadf8\ub7a8\uacfc\uc758 \uc5f0\uacb0\uc774 \uc885\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", !1); +}; +p.setDigitalPortValue = function(b, a) { + this.sendQueue[b] = a; + this.removePortReadable(b); +}; +p.getAnalogPortValue = function(b) { + return this.connected ? this.portData["a" + b] : 0; +}; +p.getDigitalPortValue = function(b) { + if (!this.connected) { + return 0; + } + this.setPortReadable(b); + return void 0 !== this.portData[b] ? this.portData[b] : 0; +}; +p.setPortReadable = function(b) { + this.sendQueue.readablePorts || (this.sendQueue.readablePorts = []); + var a = !1, d; + for (d in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[d] == b) { + a = !0; + break; + } + } + a || this.sendQueue.readablePorts.push(b); +}; +p.removePortReadable = function(b) { + if (this.sendQueue.readablePorts || Array.isArray(this.sendQueue.readablePorts)) { + var a, d; + for (d in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[d] == b) { + a = +d; + break; + } } - return {type:b.type, expressions:void 0}; + this.sendQueue.readablePorts = void 0 != a ? this.sendQueue.readablePorts.slice(0, a).concat(this.sendQueue.readablePorts.slice(a + 1, this.sendQueue.readablePorts.length)) : []; + } +}; +p.update = function() { + this.socket && (this.socket.disconnected || this.socket.emit("message", {data:JSON.stringify(this.sendQueue), mode:this.socket.mode, type:"utf8"})); +}; +p.updatePortData = function(b) { + this.portData = b; + this.hwMonitor && "hw" == Entry.propertyPanel.selected && this.hwMonitor.update(); +}; +p.closeConnection = function() { + this.socket && this.socket.close(); +}; +p.downloadConnector = function() { + window.open(this.downloadPath, "_blank").focus(); +}; +p.downloadGuide = function() { + window.open("http://download.play-entry.org/data/%EC%97%94%ED%8A%B8%EB%A6%AC-%ED%95%98%EB%93%9C%EC%9B%A8%EC%96%B4%EC%97%B0%EA%B2%B0%EB%A7%A4%EB%89%B4%EC%96%BC_16_08_17.hwp", "_blank").focus(); +}; +p.downloadSource = function() { + window.open("http://play-entry.com/down/board.ino", "_blank").focus(); +}; +p.setZero = function() { + Entry.hw.hwModule && Entry.hw.hwModule.setZero(); +}; +p.checkDevice = function(b) { + void 0 !== b.company && (b = [Entry.Utils.convertIntToHex(b.company), ".", Entry.Utils.convertIntToHex(b.model)].join(""), b != this.selectedDevice && (this.selectedDevice = b, this.hwModule = this.hwInfo[b], Entry.dispatchEvent("hwChanged"), Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5", "\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.", !1), this.hwModule.monitorTemplate && + (this.hwMonitor ? (this.hwMonitor._hwModule = this.hwModule, this.hwMonitor.initView()) : this.hwMonitor = new Entry.HWMonitor(this.hwModule), Entry.propertyPanel.addMode("hw", this.hwMonitor), b = this.hwModule.monitorTemplate, "both" == b.mode ? (b.mode = "list", this.hwMonitor.generateListView(), b.mode = "general", this.hwMonitor.generateView(), b.mode = "both") : "list" == b.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); +}; +p.banHW = function() { + var b = this.hwInfo, a; + for (a in b) { + Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name, !0); + } +}; +p.executeHardware = function() { + function b(a) { + navigator.msLaunchUri(a, function() { + }, function() { + c.popupHelper.show("hwDownload", !0); + }); + } + function a(a) { + var b = document.createElement("iframe"); + b.src = "about:blank"; + b.style = "display:none"; + document.getElementsByTagName("body")[0].appendChild(b); + var d = null, d = setTimeout(function() { + var e = !1; + try { + b.contentWindow.location.href = a, e = !0; + } catch (f) { + "NS_ERROR_UNKNOWN_PROTOCOL" == f.name && (e = !1); + } + e || c.popupHelper.show("hwDownload", !0); + document.getElementsByTagName("body")[0].removeChild(b); + clearTimeout(d); + }, 500); + } + function d(a) { + var b = !1; + window.focus(); + window.onblur = function() { + b = !0; + }; + location.assign(encodeURI(a)); + setTimeout(function() { + (0 == b || 0 < navigator.userAgent.indexOf("Edge")) && c.popupHelper.show("hwDownload", !0); + window.onblur = null; + }, 1500); + } + var c = this, e = {_bNotInstalled:!1, init:function(a, b) { + this._w = window.open("", "entry_hw_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); + var c = null, c = setTimeout(function() { + e.runViewer(a, b); + clearInterval(c); + }, 1E3); + }, runViewer:function(a, b) { + this._w.document.write(""); + var c = 0, d = null, d = setInterval(function() { + try { + this._w.location.href; + } catch (a) { + this._bNotInstalled = !0; + } + if (10 < c) { + clearInterval(d); + var e = 0, f = null, f = setInterval(function() { + e++; + this._w.closed || 2 < e ? clearInterval(f) : this._w.close(); + this._bNotInstalled = !1; + c = 0; + }.bind(this), 5E3); + b(!this._bNotInstalled); + } + c++; + }.bind(this), 100); + }, set:function() { + this._bNotInstalled = !0; + }}, f = "entryhw://-roomId:" + this.sessionRoomId; + 0 < navigator.userAgent.indexOf("MSIE") || 0 < navigator.userAgent.indexOf("Trident") ? void 0 != navigator.msLaunchUri ? b(f) : 9 > (0 < document.documentMode ? document.documentMode : navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]) ? alert(Lang.msgs.not_support_browser) : e.init(f, function(a) { + 0 == a && c.popupHelper.show("hwDownload", !0); + }) : 0 < navigator.userAgent.indexOf("Firefox") ? a(f) : 0 < navigator.userAgent.indexOf("Chrome") || 0 < navigator.userAgent.indexOf("Safari") ? d(f) : alert(Lang.msgs.not_support_browser); +}; +p.hwPopupCreate = function() { + var b = this; + this.popupHelper || (this.popupHelper = window.popupHelper ? window.popupHelper : new Entry.popupHelper(!0)); + this.popupHelper.addPopup("newVersion", {type:"confirm", title:Lang.Msgs.new_version_title, setPopupLayout:function(a) { + var d = Entry.Dom("div", {class:"contentArea"}), c = Entry.Dom("div", {class:"textArea", parent:d}), e = Entry.Dom("div", {class:"text1", parent:c}), f = Entry.Dom("div", {class:"text2", parent:c}), g = Entry.Dom("div", {class:"text3", parent:c}), c = Entry.Dom("div", {class:"text4", parent:c}), h = Entry.Dom("div", {classes:["popupCancelBtn", "popupDefaultBtn"], parent:d}), k = Entry.Dom("div", {classes:["popupOkBtn", "popupDefaultBtn"], parent:d}); + e.text(Lang.Msgs.new_version_text1); + f.html(Lang.Msgs.new_version_text2); + g.text(Lang.Msgs.new_version_text3); + c.text(Lang.Msgs.new_version_text4); + h.text(Lang.Buttons.cancel); + k.html(Lang.Msgs.new_version_download); + d.bindOnClick(".popupDefaultBtn", function(a) { + $(this).hasClass("popupOkBtn") ? b.downloadConnector() : b.popupHelper.hide("newVersion"); + }); + a.append(d); + }}); + this.popupHelper.addPopup("hwDownload", {type:"confirm", title:Lang.Msgs.not_install_title, setPopupLayout:function(a) { + var d = Entry.Dom("div", {class:"contentArea"}), c = Entry.Dom("div", {class:"textArea", parent:d}), e = Entry.Dom("div", {class:"text1", parent:c}), f = Entry.Dom("div", {class:"text2", parent:c}), g = Entry.Dom("div", {class:"text3", parent:c}), c = Entry.Dom("div", {class:"text4", parent:c}), h = Entry.Dom("div", {classes:["popupCancelBtn", "popupDefaultBtn"], parent:d}), k = Entry.Dom("div", {classes:["popupOkBtn", "popupDefaultBtn"], parent:d}); + e.text(Lang.Msgs.hw_download_text1); + f.html(Lang.Msgs.hw_download_text2); + g.text(Lang.Msgs.hw_download_text3); + c.text(Lang.Msgs.hw_download_text4); + h.text(Lang.Buttons.cancel); + k.html(Lang.Msgs.hw_download_btn); + d.bindOnClick(".popupDefaultBtn", function(a) { + $(this).hasClass("popupOkBtn") ? b.downloadConnector() : b.popupHelper.hide("hwDownload"); + }); + a.append(d); + }}); +}; +Entry.BlockModel = function() { + Entry.Model(this); +}; +Entry.BlockModel.prototype.schema = {id:null, x:0, y:0, type:null, params:{}, statements:{}, prev:null, next:null, view:null}; +Entry.BlockRenderModel = function() { + Entry.Model(this); +}; +Entry.BlockRenderModel.prototype.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, width:0, height:0, magneting:!1}; +Entry.BoxModel = function() { + Entry.Model(this); +}; +Entry.BoxModel.prototype.schema = {id:0, type:Entry.STATIC.BOX_MODEL, x:0, y:0, width:0, height:0}; +Entry.DragInstance = function(b) { + Entry.Model(this); + this.set(b); +}; +Entry.DragInstance.prototype.schema = {type:Entry.STATIC.DRAG_INSTANCE, startX:0, startY:0, offsetX:0, offsetY:0, absX:0, absY:0, prev:null, height:0, mode:0, isNew:!1}; +Entry.ThreadModel = function() { + Entry.Model(this); +}; +Entry.ThreadModel.prototype.schema = {id:0, type:Entry.STATIC.THREAD_MODEL, x:0, y:0, width:0, minWidth:0, height:0}; +Entry.Stage = function() { + this.variables = {}; + this.background = new createjs.Shape; + this.background.graphics.beginFill("#ffffff").drawRect(-480, -240, 960, 480); + this.objectContainers = []; + this.selectedObjectContainer = null; + this.variableContainer = new createjs.Container; + this.dialogContainer = new createjs.Container; + this.selectedObject = null; + this.isObjectClick = !1; +}; +Entry.Stage.prototype.initStage = function(b) { + this.canvas = new createjs.Stage(b.id); + this.canvas.x = 320; + this.canvas.y = 180; + this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; + createjs.Touch.enable(this.canvas); + this.canvas.enableMouseOver(10); + this.canvas.mouseMoveOutside = !0; + this.canvas.addChild(this.background); + this.canvas.addChild(this.variableContainer); + this.canvas.addChild(this.dialogContainer); + this.inputField = null; + this.initCoordinator(); + this.initHandle(); + this.mouseCoordinate = {x:0, y:0}; + if (Entry.isPhone()) { + b.ontouchstart = function(a) { + Entry.dispatchEvent("canvasClick", a); + Entry.stage.isClick = !0; + }, b.ontouchend = function(a) { + Entry.stage.isClick = !1; + Entry.dispatchEvent("canvasClickCanceled", a); + }; + } else { + var a = function(a) { + Entry.dispatchEvent("canvasClick", a); + Entry.stage.isClick = !0; + }; + b.onmousedown = a; + b.ontouchstart = a; + a = function(a) { + Entry.stage.isClick = !1; + Entry.dispatchEvent("canvasClickCanceled", a); + }; + b.onmouseup = a; + b.ontouchend = a; + $(document).click(function(a) { + Entry.stage.focused = "entryCanvas" === a.target.id ? !0 : !1; + }); + } + Entry.addEventListener("canvasClick", function(a) { + Entry.stage.isObjectClick = !1; + }); + Entry.windowResized.attach(this, function() { + Entry.stage.updateBoundRect(); + }); + $(window).scroll(function() { + Entry.stage.updateBoundRect(); + }); + a = function(a) { + a.preventDefault(); + var b = Entry.stage.getBoundRect(), e; + -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((a.pageX - b.left - document.documentElement.scrollLeft) / b.width - .5), a = -270 * ((a.pageY - b.top - document.documentElement.scrollTop) / b.height - .5)) : a.changedTouches ? (e = 480 * ((a.changedTouches[0].pageX - b.left - document.body.scrollLeft) / b.width - .5), a = -270 * ((a.changedTouches[0].pageY - b.top - document.body.scrollTop) / b.height - .5)) : (e = 480 * ((a.pageX - b.left - document.body.scrollLeft) / b.width - .5), + a = -270 * ((a.pageY - b.top - document.body.scrollTop) / b.height - .5)); + Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:a.toFixed(1)}; + Entry.dispatchEvent("stageMouseMove"); }; -})(Entry.PyToBlockParserTemp.prototype); -Entry.Toast = function() { - this.toasts_ = []; - var a = document.getElementById("entryToastContainer"); - a && document.body.removeChild(a); - this.body_ = Entry.createElement("div", "entryToastContainer"); - this.body_.addClass("entryToastContainer"); - document.body.appendChild(this.body_); + b.onmousemove = a; + b.ontouchmove = a; + b.onmouseout = function(a) { + Entry.dispatchEvent("stageMouseOut"); + }; + Entry.addEventListener("updateObject", function(a) { + Entry.engine.isState("stop") && Entry.stage.updateObject(); + }); + Entry.addEventListener("canvasInputComplete", function(a) { + try { + var b = Entry.stage.inputField.value(); + Entry.stage.hideInputField(); + if (b) { + var e = Entry.container; + e.setInputValue(b); + e.inputValue.complete = !0; + } + } catch (f) { + } + }); + this.initWall(); + this.render(); +}; +Entry.Stage.prototype.render = function() { + Entry.stage.timer && clearTimeout(Entry.stage.timer); + var b = (new Date).getTime(); + Entry.stage.update(); + b = (new Date).getTime() - b; + Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); }; -Entry.Toast.prototype.warning = function(a, b, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastWarning"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = a; - d.appendChild(e); - a = Entry.createElement("p", "entryToast"); - a.addClass("entryToastMessage"); - a.innerHTML = b; - d.appendChild(a); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); +Entry.Stage.prototype.update = function() { + Entry.requestUpdate ? (Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(), this.inputField && !this.inputField._isHidden && this.inputField.render(), Entry.requestUpdateTwice ? Entry.requestUpdateTwice = !1 : Entry.requestUpdate = !1) : Entry.requestUpdate = !1; }; -Entry.Toast.prototype.success = function(a, b, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastSuccess"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = a; - d.appendChild(e); - a = Entry.createElement("p", "entryToast"); - a.addClass("entryToastMessage"); - a.innerHTML = b; - d.appendChild(a); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); +Entry.Stage.prototype.loadObject = function(b) { + var a = b.entity.object; + this.getObjectContainerByScene(b.scene).addChild(a); + this.canvas.update(); }; -Entry.Toast.prototype.alert = function(a, b, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastAlert"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = a; - d.appendChild(e); - a = Entry.createElement("p", "entryToast"); - a.addClass("entryToastMessage"); - a.innerHTML = b; - d.appendChild(a); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.toast.body_.removeChild(d)); - d.style.opacity *= .9; - }, 20); - }, 5E3); +Entry.Stage.prototype.loadEntity = function(b) { + Entry.stage.getObjectContainerByScene(b.parent.scene).addChild(b.object); + this.sortZorder(); + Entry.requestUpdate = !0; }; -Entry.TvCast = function(a) { - this.generateView(a); +Entry.Stage.prototype.unloadEntity = function(b) { + Entry.stage.getObjectContainerByScene(b.parent.scene).removeChild(b.object); + Entry.requestUpdate = !0; }; -p = Entry.TvCast.prototype; -p.init = function(a) { - this.tvCastHash = a; +Entry.Stage.prototype.loadVariable = function(b) { + var a = b.view_; + this.variables[b.id] = a; + this.variableContainer.addChild(a); + Entry.requestUpdate = !0; }; -p.generateView = function(a) { - var b = Entry.createElement("div"); - b.addClass("entryContainerMovieWorkspace"); - b.addClass("entryRemove"); - this.movieContainer = b; - b = Entry.createElement("iframe"); - b.setAttribute("id", "tvCastIframe"); - b.setAttribute("allowfullscreen", ""); - b.setAttribute("frameborder", 0); - b.setAttribute("src", a); - this.movieFrame = b; - this.movieContainer.appendChild(this.movieFrame); +Entry.Stage.prototype.removeVariable = function(b) { + this.variableContainer.removeChild(b.view_); + Entry.requestUpdate = !0; }; -p.getView = function() { - return this.movieContainer; +Entry.Stage.prototype.loadDialog = function(b) { + this.dialogContainer.addChild(b.object); }; -p.resize = function() { - document.getElementById("entryContainerWorkspaceId"); - var a = document.getElementById("tvCastIframe"); - w = this.movieContainer.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; +Entry.Stage.prototype.unloadDialog = function(b) { + this.dialogContainer.removeChild(b.object); }; -Entry.ContextMenu = {}; -(function(a) { - a.visible = !1; - a._hideEvent = null; - a.createDom = function() { - this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - this.dom.bind("mousedown touchstart", function(b) { - b.stopPropagation(); - }); - Entry.Utils.disableContextmenu(this.dom); - }; - a.show = function(b, a, d) { - this._hideEvent = Entry.documentMousedown.attach(this, function() { - this.hide(); - }); - this.dom || this.createDom(); - if (0 !== b.length) { - var c = this; - void 0 !== a && (this._className = a, this.dom.addClass(a)); - var f = this.dom; - f.empty(); - for (var g = 0, h = b.length;g < h;g++) { - var k = b[g], l = k.text, m = !1 !== k.enable, n = Entry.Dom("li", {parent:f}); - if (k.divider) { - a = "divider"; +Entry.Stage.prototype.sortZorder = function() { + for (var b = Entry.container.getCurrentObjects(), a = this.selectedObjectContainer, d = 0, c = b.length - 1;0 <= c;c--) { + for (var e = b[c], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { + e[g].shape && a.setChildIndex(e[g].shape, d++), a.setChildIndex(e[g].object, d++); + } + f.shape && a.setChildIndex(f.shape, d++); + a.setChildIndex(f.object, d++); + } +}; +Entry.Stage.prototype.initCoordinator = function() { + var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); + a.scaleX = .5; + a.scaleY = .5; + a.x = -240; + a.y = -135; + b.addChild(a); + this.canvas.addChild(b); + b.visible = !1; + this.coordinator = b; +}; +Entry.Stage.prototype.toggleCoordinator = function() { + this.coordinator.visible = !this.coordinator.visible; + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.selectObject = function(b) { + this.selectedObject = b ? b : null; + this.updateObject(); +}; +Entry.Stage.prototype.initHandle = function() { + this.handle = new EaselHandle(this.canvas); + this.handle.setChangeListener(this, this.updateHandle); + this.handle.setEditStartListener(this, this.startEdit); + this.handle.setEditEndListener(this, this.endEdit); +}; +Entry.Stage.prototype.updateObject = function() { + Entry.requestUpdate = !0; + this.handle.setDraggable(!0); + if (!this.editEntity) { + var b = this.selectedObject; + if (b) { + "textBox" == b.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); + "free" == b.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); + this.handle.toggleDirection(!0); + b.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); + this.handle.setVisible(!0); + var a = b.entity; + this.handle.setWidth(a.getScaleX() * a.getWidth()); + this.handle.setHeight(a.getScaleY() * a.getHeight()); + var d, c; + if ("textBox" == a.type) { + if (a.getLineBreak()) { + d = a.regX * a.scaleX, c = -a.regY * a.scaleY; } else { - a = m ? "menuAble" : "menuDisable"; - var q = Entry.Dom("span", {parent:n}); - q.text(l); - m && k.callback && function(b, a) { - b.mousedown(function(b) { - b.preventDefault(); - c.hide(); - a(b); - }); - }(q, k.callback); + var e = a.getTextAlign(); + c = -a.regY * a.scaleY; + switch(e) { + case Entry.TEXT_ALIGN_LEFT: + d = -a.getWidth() / 2 * a.scaleX; + break; + case Entry.TEXT_ALIGN_CENTER: + d = a.regX * a.scaleX; + break; + case Entry.TEXT_ALIGN_RIGHT: + d = a.getWidth() / 2 * a.scaleX; + } } - n.addClass(a); + } else { + d = (a.regX - a.width / 2) * a.scaleX, c = (a.height / 2 - a.regY) * a.scaleY; + } + e = a.getRotation() / 180 * Math.PI; + this.handle.setX(a.getX() - d * Math.cos(e) - c * Math.sin(e)); + this.handle.setY(-a.getY() - d * Math.sin(e) + c * Math.cos(e)); + this.handle.setRegX((a.regX - a.width / 2) * a.scaleX); + this.handle.setRegY((a.regY - a.height / 2) * a.scaleY); + this.handle.setRotation(a.getRotation()); + this.handle.setDirection(a.getDirection()); + this.objectUpdated = !0; + this.handle.setVisible(b.entity.getVisible()); + b.entity.getVisible() && this.handle.render(); + } else { + this.handle.setVisible(!1); + } + } +}; +Entry.Stage.prototype.updateHandle = function() { + this.editEntity = !0; + var b = this.handle, a = this.selectedObject.entity; + if (a.lineBreak) { + a.setHeight(b.height / a.getScaleY()), a.setWidth(b.width / a.getScaleX()); + } else { + if (0 !== a.width) { + var d = Math.abs(b.width / a.width); + a.flip && (d *= -1); + a.setScaleX(d); + } + 0 !== a.height && a.setScaleY(b.height / a.height); + } + d = b.rotation / 180 * Math.PI; + if ("textBox" == a.type) { + var c = b.regX / a.scaleX, c = b.regY / a.scaleY; + if (a.getLineBreak()) { + a.setX(b.x), a.setY(-b.y); + } else { + switch(a.getTextAlign()) { + case Entry.TEXT_ALIGN_LEFT: + a.setX(b.x - b.width / 2 * Math.cos(d)); + a.setY(-b.y + b.width / 2 * Math.sin(d)); + break; + case Entry.TEXT_ALIGN_CENTER: + a.setX(b.x); + a.setY(-b.y); + break; + case Entry.TEXT_ALIGN_RIGHT: + a.setX(b.x + b.width / 2 * Math.cos(d)), a.setY(-b.y - b.width / 2 * Math.sin(d)); } - f.removeClass("entryRemove"); - this.visible = !0; - this.position(d || Entry.mouseCoordinate); } - }; - a.position = function(b) { - var a = this.dom; - a.css({left:0, top:0}); - var d = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); - b.x + d > g && (b.x -= d + 3); - b.y + e > f && (b.y -= e); - a.css({left:b.x, top:b.y}); - }; - a.hide = function() { - this.visible = !1; - this.dom.empty(); - this.dom.addClass("entryRemove"); - this._className && (this.dom.removeClass(this._className), delete this._className); - this._hideEvent && (Entry.documentMousedown.detach(this._hideEvent), this._hideEvent = null); - }; -})(Entry.ContextMenu); -Entry.Loader = {queueCount:0, totalCount:0, loaded:!1}; -Entry.Loader.addQueue = function(a) { - this.queueCount || Entry.dispatchEvent("loadStart"); - this.queueCount++; - this.totalCount++; + } else { + c = a.width / 2 + b.regX / a.scaleX, a.setX(b.x + b.regX * Math.cos(d) - b.regY * Math.sin(d)), a.setRegX(c), c = a.height / 2 + b.regY / a.scaleY, a.setY(-b.y - b.regX * Math.sin(d) - b.regY * Math.cos(d)), a.setRegY(c); + } + a.setDirection(b.direction); + a.setRotation(b.rotation); + this.selectedObject.entity.doCommand(); + this.editEntity = !1; }; -Entry.Loader.removeQueue = function(a) { - this.queueCount--; - this.queueCount || (this.totalCount = 0, this.handleLoad()); +Entry.Stage.prototype.startEdit = function() { + this.selectedObject.entity.initCommand(); }; -Entry.Loader.getLoadedPercent = function() { - return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; +Entry.Stage.prototype.endEdit = function() { + this.selectedObject.entity.checkCommand(); }; -Entry.Loader.isLoaded = function() { - return !this.queueCount && !this.totalCount; +Entry.Stage.prototype.initWall = function() { + var b = new createjs.Container, a = new Image; + a.src = Entry.mediaFilePath + "media/bound.png"; + b.up = new createjs.Bitmap; + b.up.scaleX = 16; + b.up.y = -165; + b.up.x = -240; + b.up.image = a; + b.addChild(b.up); + b.down = new createjs.Bitmap; + b.down.scaleX = 16; + b.down.y = 135; + b.down.x = -240; + b.down.image = a; + b.addChild(b.down); + b.right = new createjs.Bitmap; + b.right.scaleY = 9; + b.right.y = -135; + b.right.x = 240; + b.right.image = a; + b.addChild(b.right); + b.left = new createjs.Bitmap; + b.left.scaleY = 9; + b.left.y = -135; + b.left.x = -270; + b.left.image = a; + b.addChild(b.left); + this.canvas.addChild(b); + this.wall = b; +}; +Entry.Stage.prototype.showInputField = function(b) { + b = 1 / 1.5; + this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * b, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * b, height:26 * b, padding:8 * b, borderWidth:1 * b, borderColor:"#000", borderRadius:3 * b, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * b, y:450 * b, topPosition:!0, onsubmit:function() { + Entry.dispatchEvent("canvasInputComplete"); + }})); + b = new createjs.Container; + var a = new Image; + a.src = Entry.mediaFilePath + "confirm_button.png"; + var d = new createjs.Bitmap; + d.scaleX = .23; + d.scaleY = .23; + d.x = 160; + d.y = 89; + d.cursor = "pointer"; + d.image = a; + b.addChild(d); + b.on("mousedown", function(a) { + Entry.dispatchEvent("canvasInputComplete"); + }); + this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(b), this.inputSubmitButton = b); + this.inputField.show(); + Entry.requestUpdateTwice = !0; }; -Entry.Loader.handleLoad = function() { - this.loaded || (this.loaded = !0, Entry.dispatchEvent("loadComplete")); +Entry.Stage.prototype.hideInputField = function() { + this.inputField && this.inputField.value() && this.inputField.value(""); + this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); + this.inputField && this.inputField.hide(); + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.initObjectContainers = function() { + var b = Entry.scene.scenes_; + if (b && 0 !== b.length) { + for (var a = 0;a < b.length;a++) { + this.objectContainers[a] = this.createObjectContainer(b[a]); + } + this.selectedObjectContainer = this.objectContainers[0]; + } else { + b = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(b), this.selectedObjectContainer = b; + } + this.canvas.addChild(this.selectedObjectContainer); + this.selectObjectContainer(Entry.scene.selectedScene); +}; +Entry.Stage.prototype.selectObjectContainer = function(b) { + if (this.canvas) { + for (var a = this.objectContainers, d = 0;d < a.length;d++) { + this.canvas.removeChild(a[d]); + } + this.selectedObjectContainer = this.getObjectContainerByScene(b); + this.canvas.addChildAt(this.selectedObjectContainer, 2); + } +}; +Entry.Stage.prototype.reAttachToCanvas = function() { + for (var b = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], a = 0;a < b.length;a++) { + this.canvas.removeChild(b[a]), this.canvas.addChild(b[a]); + } + console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); +}; +Entry.Stage.prototype.createObjectContainer = function(b) { + var a = new createjs.Container; + a.scene = b; + return a; +}; +Entry.Stage.prototype.removeObjectContainer = function(b) { + var a = this.objectContainers; + b = this.getObjectContainerByScene(b); + this.canvas.removeChild(b); + a.splice(this.objectContainers.indexOf(b), 1); +}; +Entry.Stage.prototype.getObjectContainerByScene = function(b) { + for (var a = this.objectContainers, d = 0;d < a.length;d++) { + if (a[d].scene.id == b.id) { + return a[d]; + } + } +}; +Entry.Stage.prototype.moveSprite = function(b) { + if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { + var a = 5; + b.shiftKey && (a = 1); + var d = this.selectedObject.entity; + switch(b.keyCode) { + case 38: + d.setY(d.getY() + a); + break; + case 40: + d.setY(d.getY() - a); + break; + case 37: + d.setX(d.getX() - a); + break; + case 39: + d.setX(d.getX() + a); + } + this.updateObject(); + } +}; +Entry.Stage.prototype.getBoundRect = function(b) { + return this._boundRect ? this._boundRect : this.updateBoundRect(); +}; +Entry.Stage.prototype.updateBoundRect = function(b) { + return this._boundRect = this.canvas.canvas.getBoundingClientRect(); }; -Entry.Variable = function(a) { - Entry.assert("string" == typeof a.name, "Variable name must be given"); - this.name_ = a.name; - this.id_ = a.id ? a.id : Entry.generateHash(); - this.type = a.variableType ? a.variableType : "variable"; - this.object_ = a.object || null; - this.isCloud_ = a.isCloud || !1; +Entry.Variable = function(b) { + Entry.assert("string" == typeof b.name, "Variable name must be given"); + this.name_ = b.name; + this.id_ = b.id ? b.id : Entry.generateHash(); + this.type = b.variableType ? b.variableType : "variable"; + this.object_ = b.object || null; + this.isCloud_ = b.isCloud || !1; this._valueWidth = this._nameWidth = null; - var b = Entry.parseNumber(a.value); - this.value_ = "number" == typeof b ? b : a.value ? a.value : 0; - "slide" == this.type ? (this.setMinValue(a.minValue), this.setMaxValue(a.maxValue)) : "list" == this.type && (this.array_ = a.array ? a.array : []); - a.isClone || (this.visible_ = a.visible || "boolean" == typeof a.visible ? a.visible : !0, this.x_ = a.x ? a.x : null, this.y_ = a.y ? a.y : null, "list" == this.type && (this.width_ = a.width ? a.width : 100, this.height_ = a.height ? a.height : 120, this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); -}; -Entry.Variable.prototype.generateView = function(a) { - var b = this.type; - if ("variable" == b || "timer" == b || "answer" == b) { + var a = Entry.parseNumber(b.value); + this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; + "slide" == this.type ? (this.setMinValue(b.minValue), this.setMaxValue(b.maxValue)) : "list" == this.type && (this.array_ = b.array ? b.array : []); + 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.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); +}; +Entry.Variable.prototype.generateView = function(b) { + var a = this.type; + if ("variable" == a || "timer" == a || "answer" == a) { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(b) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressmove", function(b) { - "workspace" == Entry.type && (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + "alphabetic", a = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressmove", function(a) { + "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }); } else { - if ("slide" == b) { - var c = this; + if ("slide" == a) { + var d = this; this.view_ = new createjs.Container; this.rect_ = new createjs.Shape; this.view_.addChild(this.rect_); @@ -19591,74 +18402,74 @@ Entry.Variable.prototype.generateView = function(a) { this.view_.addChild(this.textView_); this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); this.valueView_.textBaseline = "alphabetic"; - this.view_.on("mousedown", function(b) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}); + this.view_.on("mousedown", function(a) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}); }); - this.view_.on("pressmove", function(b) { - "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + this.view_.on("pressmove", function(a) { + "workspace" != Entry.type || d.isAdjusting || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }); this.view_.visible = this.visible_; this.view_.addChild(this.valueView_); - b = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; - b = Math.max(b, 90); - this.maxWidth = b - 20; + a = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; + a = Math.max(a, 90); + this.maxWidth = a - 20; this.slideBar_ = new createjs.Shape; this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5); this.view_.addChild(this.slideBar_); - b = this.getSlidePosition(this.maxWidth); + a = this.getSlidePosition(this.maxWidth); this.valueSetter_ = new createjs.Shape; - this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); + this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); this.valueSetter_.cursor = "pointer"; - this.valueSetter_.on("mousedown", function(b) { - Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); + this.valueSetter_.on("mousedown", function(a) { + Entry.engine.isState("run") && (d.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); }); - this.valueSetter_.on("pressmove", function(b) { + this.valueSetter_.on("pressmove", function(a) { if (Entry.engine.isState("run")) { - var a = this.offsetX; - this.offsetX = -(this.x - .75 * b.stageX + 240); - a !== this.offsetX && (b = c.getX(), c.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + c.maxWidth + 10 > this.offsetX ? this.offsetX - b : c.maxWidth + 10)); + var b = this.offsetX; + this.offsetX = -(this.x - .75 * a.stageX + 240); + b !== this.offsetX && (a = d.getX(), d.setSlideCommandX(a + 10 > this.offsetX ? 0 : a + d.maxWidth + 10 > this.offsetX ? this.offsetX - a : d.maxWidth + 10)); } }); - this.valueSetter_.on("pressup", function(b) { - c.isAdjusting = !1; + this.valueSetter_.on("pressup", function(a) { + d.isAdjusting = !1; }); this.view_.addChild(this.valueSetter_); - b = Entry.variableContainer.variables_.length; - this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))); + a = Entry.variableContainer.variables_.length; + this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))); } else { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, - 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(b) { + 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(a) { this.cursor = "nwse-resize"; - }), this.resizeHandle_.on("mousedown", function(b) { + }), this.resizeHandle_.on("mousedown", function(a) { this.list.isResizing = !0; - this.offset = {x:.75 * b.stageX - this.list.getWidth(), y:.75 * b.stageY - this.list.getHeight()}; + this.offset = {x:.75 * a.stageX - this.list.getWidth(), y:.75 * a.stageY - this.list.getHeight()}; this.parent.cursor = "nwse-resize"; - }), this.resizeHandle_.on("pressmove", function(b) { - this.list.setWidth(.75 * b.stageX - this.offset.x); - this.list.setHeight(.75 * b.stageY - this.offset.y); + }), this.resizeHandle_.on("pressmove", function(a) { + this.list.setWidth(.75 * a.stageX - this.offset.x); + this.list.setHeight(.75 * a.stageY - this.offset.y); this.list.updateView(); - }), this.view_.on("mouseover", function(b) { + }), this.view_.on("mouseover", function(a) { this.cursor = "move"; - }), this.view_.on("mousedown", function(b) { - "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressup", function(b) { + }), this.view_.on("mousedown", function(a) { + "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressup", function(a) { this.cursor = "initial"; this.variable.isResizing = !1; - }), this.view_.on("pressmove", function(b) { - "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); - }), this.elementView = new createjs.Container, b = new createjs.Text("asdf", this.FONT, "#000"), b.textBaseline = "middle", b.y = 5, this.elementView.addChild(b), this.elementView.indexView = b, b = new createjs.Shape, this.elementView.addChild(b), this.elementView.valueWrapper = b, b = new createjs.Text("fdsa", this.FONT, "#eee"), b.x = 24, b.y = 6, b.textBaseline = "middle", this.elementView.addChild(b), this.elementView.valueView = b, this.elementView.x = this.BORDER, this.scrollButton_ = - new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(b) { + }), this.view_.on("pressmove", function(a) { + "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); + }), this.elementView = new createjs.Container, a = new createjs.Text("asdf", this.FONT, "#000"), a.textBaseline = "middle", a.y = 5, this.elementView.addChild(a), this.elementView.indexView = a, a = new createjs.Shape, this.elementView.addChild(a), this.elementView.valueWrapper = a, a = new createjs.Text("fdsa", this.FONT, "#eee"), a.x = 24, a.y = 6, a.textBaseline = "middle", this.elementView.addChild(a), this.elementView.valueView = a, this.elementView.x = this.BORDER, this.scrollButton_ = + new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(a) { this.list.isResizing = !0; this.cursor = "pointer"; - this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? b.rawY / 2 : this.offsetY; - }), this.scrollButton_.on("pressmove", function(b) { - void 0 === this.moveAmount ? (this.y = b.target.y, this.moveAmount = !0) : this.y = b.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; + this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? a.rawY / 2 : this.offsetY; + }), this.scrollButton_.on("pressmove", function(a) { + void 0 === this.moveAmount ? (this.y = a.target.y, this.moveAmount = !0) : this.y = a.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; 23 > this.y && (this.y = 23); this.y > this.list.getHeight() - 40 && (this.y = this.list.getHeight() - 40); this.list.updateView(); - }), this.scrollButton_.on("pressup", function(b) { + }), this.scrollButton_.on("pressup", function(a) { this.moveAmount = void 0; - }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (b = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(b / 6) + 120), this.setY(24 * a + 20 - 135 - 145 * Math.floor(b / 6))); + }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (a = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(a / 6) + 120), this.setY(24 * b + 20 - 135 - 145 * Math.floor(a / 6))); } } this.setVisible(this.isVisible()); @@ -19671,9 +18482,9 @@ Entry.Variable.prototype.updateView = function() { if ("variable" == this.type) { this.view_.x = this.getX(); this.view_.y = this.getY(); - var a = this.textView_.text, b; - b = this.object_ ? (b = Entry.container.getObject(this.object_)) ? b.name + ":" + this.getName() : this.getName() : this.getName(); - a !== b && (this.textView_.text = b, this._nameWidth = null); + var b = this.textView_.text, a; + a = this.object_ ? (a = Entry.container.getObject(this.object_)) ? a.name + ":" + this.getName() : this.getName() : this.getName(); + b !== a && (this.textView_.text = a, this._nameWidth = null); null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()); this.valueView_.x = this._nameWidth + 14; this.valueView_.y = 1; @@ -19683,33 +18494,33 @@ Entry.Variable.prototype.updateView = function() { this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7); } else { if ("slide" == this.type) { - this.view_.x = this.getX(), this.view_.y = this.getY(), a = this.textView_.text, b = this.object_ ? (b = Entry.container.getObject(this.object_)) ? b.name + ":" + this.getName() : this.getName() : this.getName(), a !== b && (this.textView_.text = b, this._nameWidth = null), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", - "") : this.valueView_.text = this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, a, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, - 90), this.maxWidth = a - 20, this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), a = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); + this.view_.x = this.getX(), this.view_.y = this.getY(), b = this.textView_.text, a = this.object_ ? (a = Entry.container.getObject(this.object_)) ? a.name + ":" + this.getName() : this.getName() : this.getName(), b !== a && (this.textView_.text = a, this._nameWidth = null), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", + "") : this.valueView_.text = this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, b, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, + 90), this.maxWidth = b - 20, this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), b = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); } else { if ("list" == this.type) { this.view_.x = this.getX(); this.view_.y = this.getY(); this.resizeHandle_.x = this.width_ - 2; this.resizeHandle_.y = this.height_ - 2; - a = this.getName(); - this.object_ && (b = Entry.container.getObject(this.object_)) && (a = b.name + ":" + a); - a = 7 < a.length ? a.substr(0, 6) + ".." : a; - this.titleView_.text = a; + b = this.getName(); + this.object_ && (a = Entry.container.getObject(this.object_)) && (b = a.name + ":" + b); + b = 7 < b.length ? b.substr(0, 6) + ".." : b; + this.titleView_.text = b; this.titleView_.x = this.width_ / 2; for (this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rect(0, 0, this.width_, this.height_);this.view_.children[4];) { this.view_.removeChild(this.view_.children[4]); } - a = Math.floor((this.getHeight() - 20) / 20); - a < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - a))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, + b = Math.floor((this.getHeight() - 20) / 20); + b < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - b))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !1, this.scrollPosition = 0); - for (b = this.scrollPosition;b < this.scrollPosition + a && b < this.array_.length;b++) { - this.elementView.indexView.text = b + 1; - var c = String(this.array_[b].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[b].data).length > c.length ? c + ".." : c; - this.elementView.valueView.text = c; - c = this.elementView.clone(!0); - c.y = 20 * (b - this.scrollPosition) + 23; - this.view_.addChild(c); + for (a = this.scrollPosition;a < this.scrollPosition + b && a < this.array_.length;a++) { + this.elementView.indexView.text = a + 1; + var d = String(this.array_[a].data), c = Math.floor((this.getWidth() - 50) / 7), d = Entry.cutStringByLength(d, c), d = String(this.array_[a].data).length > d.length ? d + ".." : d; + this.elementView.valueView.text = d; + d = this.elementView.clone(!0); + d.y = 20 * (a - this.scrollPosition) + 23; + this.view_.addChild(d); } } else { "answer" == this.type ? (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), this.valueView_.y = 1, this.isNumber() ? parseInt(this.getValue(), 10) == this.getValue() ? this.valueView_.text = this.getValue() : this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), null === this._valueWidth && (this._valueWidth = @@ -19726,9 +18537,9 @@ Entry.Variable.prototype.updateView = function() { Entry.Variable.prototype.getName = function() { return this.name_; }; -Entry.Variable.prototype.setName = function(a) { - Entry.assert("string" == typeof a, "Variable name must be string"); - this.name_ = a; +Entry.Variable.prototype.setName = function(b) { + Entry.assert("string" == typeof b, "Variable name must be string"); + this.name_ = b; this._nameWidth = null; this.updateView(); Entry.requestUpdateTwice = !0; @@ -19737,13 +18548,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? Number(this.value_) : this.value_; + return this.isNumber() ? +this.value_ : this.value_; }; Entry.Variable.prototype.isNumber = function() { return isNaN(this.value_) ? !1 : !0; }; -Entry.Variable.prototype.setValue = function(a) { - "slide" != this.type ? this.value_ = a : (a = Number(a), this.value_ = a < this.minValue_ ? this.minValue_ : a > this.maxValue_ ? this.maxValue_ : a); +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.isCloud_ && Entry.variableContainer.updateCloudVariables(); this._valueWidth = null; this.updateView(); @@ -19752,37 +18563,37 @@ Entry.Variable.prototype.setValue = function(a) { Entry.Variable.prototype.isVisible = function() { return this.visible_; }; -Entry.Variable.prototype.setVisible = function(a) { - Entry.assert("boolean" == typeof a, "Variable visible state must be boolean"); - this.visible !== a && (this.visible_ = this.view_.visible = a, this.updateView()); +Entry.Variable.prototype.setVisible = function(b) { + Entry.assert("boolean" == typeof b, "Variable visible state must be boolean"); + this.visible !== b && (this.visible_ = this.view_.visible = b, this.updateView()); }; -Entry.Variable.prototype.setX = function(a) { - this.x_ = a; +Entry.Variable.prototype.setX = function(b) { + this.x_ = b; this.updateView(); }; Entry.Variable.prototype.getX = function() { return this.x_; }; -Entry.Variable.prototype.setY = function(a) { - this.y_ = a; +Entry.Variable.prototype.setY = function(b) { + this.y_ = b; this.updateView(); }; Entry.Variable.prototype.getY = function() { return this.y_; }; -Entry.Variable.prototype.setWidth = function(a) { - this.width_ = 100 > a ? 100 : a; +Entry.Variable.prototype.setWidth = function(b) { + this.width_ = 100 > b ? 100 : b; this.updateView(); }; Entry.Variable.prototype.getWidth = function() { return this.width_; }; -Entry.Variable.prototype.isInList = function(a, b) { +Entry.Variable.prototype.isInList = function(b, a) { this.getX(); this.getY(); }; -Entry.Variable.prototype.setHeight = function(a) { - this.height_ = 100 > a ? 100 : a; +Entry.Variable.prototype.setHeight = function(b) { + this.height_ = 100 > b ? 100 : b; this.updateView(); }; Entry.Variable.prototype.getHeight = function() { @@ -19794,79 +18605,79 @@ Entry.Variable.prototype.takeSnapshot = function() { Entry.Variable.prototype.loadSnapshot = function() { this.snapshot_ && !this.isCloud_ && this.syncModel_(this.snapshot_); }; -Entry.Variable.prototype.syncModel_ = function(a) { - this.setX(a.x); - this.setY(a.y); - this.id_ = a.id; - this.setVisible(a.visible); - this.setValue(a.value); - this.setName(a.name); - this.isCloud_ = a.isCloud; - "list" == this.type && (this.setWidth(a.width), this.setHeight(a.height), this.array_ = a.array); +Entry.Variable.prototype.syncModel_ = function(b) { + this.setX(b.x); + this.setY(b.y); + this.id_ = b.id; + this.setVisible(b.visible); + this.setValue(b.value); + this.setName(b.name); + this.isCloud_ = b.isCloud; + "list" == this.type && (this.setWidth(b.width), this.setHeight(b.height), this.array_ = b.array); }; Entry.Variable.prototype.toJSON = function() { - var a = {}; - a.name = this.name_; - a.id = this.id_; - a.visible = this.visible_; - a.value = this.value_; - a.variableType = this.type; - "list" == this.type ? (a.width = this.getWidth(), a.height = this.getHeight(), a.array = JSON.parse(JSON.stringify(this.array_))) : "slide" == this.type && (a.minValue = this.minValue_, a.maxValue = this.maxValue_); - a.isCloud = this.isCloud_; - a.object = this.object_; - a.x = this.x_; - a.y = this.y_; - return a; + var b = {}; + b.name = this.name_; + b.id = this.id_; + b.visible = this.visible_; + b.value = this.value_; + b.variableType = this.type; + "list" == this.type ? (b.width = this.getWidth(), b.height = this.getHeight(), b.array = JSON.parse(JSON.stringify(this.array_))) : "slide" == this.type && (b.minValue = this.minValue_, b.maxValue = this.maxValue_); + b.isCloud = this.isCloud_; + b.object = this.object_; + b.x = this.x_; + b.y = this.y_; + return b; }; Entry.Variable.prototype.remove = function() { Entry.stage.removeVariable(this); }; Entry.Variable.prototype.clone = function() { - var a = this.toJSON(); - a.isClone = !0; - return a = new Entry.Variable(a); + var b = this.toJSON(); + b.isClone = !0; + return b = new Entry.Variable(b); }; Entry.Variable.prototype.getType = function() { return this.type; }; -Entry.Variable.prototype.setType = function(a) { - this.type = a; +Entry.Variable.prototype.setType = function(b) { + this.type = b; }; -Entry.Variable.prototype.getSlidePosition = function(a) { - var b = this.minValue_; - return Math.abs(this.value_ - b) / Math.abs(this.maxValue_ - b) * a + 10; +Entry.Variable.prototype.getSlidePosition = function(b) { + var a = this.minValue_; + return Math.abs(this.value_ - a) / Math.abs(this.maxValue_ - a) * b + 10; }; -Entry.Variable.prototype.setSlideCommandX = function(a) { - var b = this.valueSetter_.graphics.command; - a = Math.max("undefined" == typeof a ? 10 : a, 10); - a = Math.min(this.maxWidth + 10, a); - b.x = a; +Entry.Variable.prototype.setSlideCommandX = function(b) { + var a = this.valueSetter_.graphics.command; + b = Math.max("undefined" == typeof b ? 10 : b, 10); + b = Math.min(this.maxWidth + 10, b); + a.x = b; this.updateSlideValueByView(); }; Entry.Variable.prototype.updateSlideValueByView = function() { - var a = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; - 0 > a && (a = 0); - 1 < a && (a = 1); - var b = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), a = (b + Number(Math.abs(c - b) * a)).toFixed(2), a = parseFloat(a); - a < b ? a = this.minValue_ : a > c && (a = this.maxValue_); - this.isFloatPoint() || (a = Math.round(a)); - this.setValue(a); + 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_), d = parseFloat(this.maxValue_), b = (a + Math.abs(d - a) * b).toFixed(2), b = parseFloat(b); + b < a ? b = this.minValue_ : b > d && (b = this.maxValue_); + this.isFloatPoint() || (b = Math.round(b)); + this.setValue(b); }; Entry.Variable.prototype.getMinValue = function() { return this.minValue_; }; -Entry.Variable.prototype.setMinValue = function(a) { - this.minValue_ = a = a || 0; - this.value_ < a && this.setValue(a); +Entry.Variable.prototype.setMinValue = function(b) { + this.minValue_ = b = b || 0; + this.value_ < b && this.setValue(b); this.updateView(); this.isMinFloat = Entry.isFloat(this.minValue_); }; Entry.Variable.prototype.getMaxValue = function() { return this.maxValue_; }; -Entry.Variable.prototype.setMaxValue = function(a) { - this.maxValue_ = a = a || 100; - this.value_ > a && (this.value_ = a); +Entry.Variable.prototype.setMaxValue = function(b) { + this.maxValue_ = b = b || 100; + this.value_ > b && (this.value_ = b); this.updateView(); this.isMaxFloat = Entry.isFloat(this.maxValue_); }; @@ -19887,179 +18698,179 @@ Entry.VariableContainer = function() { this._messageRefs = []; this._functionRefs = []; }; -Entry.VariableContainer.prototype.createDom = function(a) { - var b = this; - this.view_ = a; - var c = Entry.createElement("table"); - c.addClass("entryVariableSelectorWorkspace"); - this.view_.appendChild(c); - var d = Entry.createElement("tr"); - c.appendChild(d); +Entry.VariableContainer.prototype.createDom = function(b) { + var a = this; + this.view_ = b; + var d = Entry.createElement("table"); + d.addClass("entryVariableSelectorWorkspace"); + this.view_.appendChild(d); + var c = Entry.createElement("tr"); + d.appendChild(c); var e = this.createSelectButton("all"); e.setAttribute("rowspan", "2"); e.addClass("selected", "allButton"); - d.appendChild(e); - d.appendChild(this.createSelectButton("variable", Entry.variableEnable)); - d.appendChild(this.createSelectButton("message", Entry.messageEnable)); - d = Entry.createElement("tr"); - d.appendChild(this.createSelectButton("list", Entry.listEnable)); - d.appendChild(this.createSelectButton("func", Entry.functionEnable)); - c.appendChild(d); - c = Entry.createElement("ul"); - c.addClass("entryVariableListWorkspace"); - this.view_.appendChild(c); - this.listView_ = c; - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.variable_add; + c.appendChild(e); + c.appendChild(this.createSelectButton("variable", Entry.variableEnable)); + c.appendChild(this.createSelectButton("message", Entry.messageEnable)); + c = Entry.createElement("tr"); + c.appendChild(this.createSelectButton("list", Entry.listEnable)); + c.appendChild(this.createSelectButton("func", Entry.functionEnable)); + d.appendChild(c); + d = Entry.createElement("ul"); + d.addClass("entryVariableListWorkspace"); + this.view_.appendChild(d); + this.listView_ = d; + d = Entry.createElement("li"); + d.addClass("entryVariableAddWorkspace"); + d.addClass("entryVariableListElementWorkspace"); + d.innerHTML = "+ " + Lang.Workspace.variable_add; var f = this; - this.variableAddButton_ = c; - c.bindOnClick(function(a) { - a = f.variableAddPanel; - var c = a.view.name.value.trim(); - a.isOpen ? c && 0 !== c.length ? b.addVariable() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + this.variableAddButton_ = d; + d.bindOnClick(function(b) { + b = f.variableAddPanel; + var c = b.view.name.value.trim(); + b.isOpen ? c && 0 !== c.length ? a.addVariable() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); }); this.generateVariableAddView(); this.generateListAddView(); this.generateVariableSplitterView(); this.generateVariableSettingView(); this.generateListSettingView(); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.message_create; - this.messageAddButton_ = c; - c.bindOnClick(function(a) { - b.addMessage({name:Lang.Workspace.message + " " + (b.messages_.length + 1)}); + d = Entry.createElement("li"); + d.addClass("entryVariableAddWorkspace"); + d.addClass("entryVariableListElementWorkspace"); + d.innerHTML = "+ " + Lang.Workspace.message_create; + this.messageAddButton_ = d; + d.bindOnClick(function(b) { + a.addMessage({name:Lang.Workspace.message + " " + (a.messages_.length + 1)}); }); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.list_create; - this.listAddButton_ = c; - c.bindOnClick(function(a) { - a = f.listAddPanel; - var c = a.view.name.value.trim(); - a.isOpen ? c && 0 !== c.length ? b.addList() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + d = Entry.createElement("li"); + d.addClass("entryVariableAddWorkspace"); + d.addClass("entryVariableListElementWorkspace"); + d.innerHTML = "+ " + Lang.Workspace.list_create; + this.listAddButton_ = d; + d.bindOnClick(function(b) { + b = f.listAddPanel; + var c = b.view.name.value.trim(); + b.isOpen ? c && 0 !== c.length ? a.addList() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); }); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.function_add; - this.functionAddButton_ = c; - c.bindOnClick(function(a) { - a = b._getBlockMenu(); + d = Entry.createElement("li"); + d.addClass("entryVariableAddWorkspace"); + d.addClass("entryVariableListElementWorkspace"); + d.innerHTML = "+ " + Lang.Workspace.function_add; + this.functionAddButton_ = d; + d.bindOnClick(function(b) { + b = a._getBlockMenu(); Entry.playground.changeViewMode("code"); - "func" != a.lastSelector && a.selectMenu("func"); - b.createFunction(); + "func" != b.lastSelector && b.selectMenu("func"); + a.createFunction(); }); - return a; + return b; }; -Entry.VariableContainer.prototype.createSelectButton = function(a, b) { - var c = this; - void 0 === b && (b = !0); - var d = Entry.createElement("td"); - d.addClass("entryVariableSelectButtonWorkspace", a); - d.innerHTML = Lang.Workspace[a]; - b ? d.bindOnClick(function(b) { - c.selectFilter(a); +Entry.VariableContainer.prototype.createSelectButton = function(b, a) { + var d = this; + void 0 === a && (a = !0); + var c = Entry.createElement("td"); + c.addClass("entryVariableSelectButtonWorkspace", b); + c.innerHTML = Lang.Workspace[b]; + a ? c.bindOnClick(function(a) { + d.selectFilter(b); this.addClass("selected"); - }) : d.addClass("disable"); - return d; + }) : c.addClass("disable"); + return c; }; -Entry.VariableContainer.prototype.selectFilter = function(a) { - for (var b = this.view_.getElementsByTagName("td"), c = 0;c < b.length;c++) { - b[c].removeClass("selected"), b[c].hasClass(a) && b[c].addClass("selected"); +Entry.VariableContainer.prototype.selectFilter = function(b) { + for (var a = this.view_.getElementsByTagName("td"), d = 0;d < a.length;d++) { + a[d].removeClass("selected"), a[d].hasClass(b) && a[d].addClass("selected"); } - this.viewMode_ = a; + this.viewMode_ = b; this.select(); this.updateList(); }; -Entry.VariableContainer.prototype.updateVariableAddView = function(a) { - a = "variable" == (a ? a : "variable") ? this.variableAddPanel : this.listAddPanel; - var b = a.info, c = a.view; - a.view.addClass("entryRemove"); - c.cloudCheck.removeClass("entryVariableAddChecked"); - c.localCheck.removeClass("entryVariableAddChecked"); - c.globalCheck.removeClass("entryVariableAddChecked"); - c.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); - b.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); - a.isOpen && (c.removeClass("entryRemove"), c.name.focus()); - b.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); -}; -Entry.VariableContainer.prototype.select = function(a) { - a = this.selected == a ? null : a; +Entry.VariableContainer.prototype.updateVariableAddView = function(b) { + b = "variable" == (b ? b : "variable") ? this.variableAddPanel : this.listAddPanel; + var a = b.info, d = b.view; + b.view.addClass("entryRemove"); + d.cloudCheck.removeClass("entryVariableAddChecked"); + d.localCheck.removeClass("entryVariableAddChecked"); + d.globalCheck.removeClass("entryVariableAddChecked"); + d.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); + a.isCloud && d.cloudCheck.addClass("entryVariableAddChecked"); + b.isOpen && (d.removeClass("entryRemove"), d.name.focus()); + a.object ? (d.localCheck.addClass("entryVariableAddChecked"), d.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : d.globalCheck.addClass("entryVariableAddChecked"); +}; +Entry.VariableContainer.prototype.select = function(b) { + b = this.selected == b ? null : b; this.selected && (this.selected.listElement.removeClass("selected"), this.selected.callerListElement && (this.listView_.removeChild(this.selected.callerListElement), delete this.selected.callerListElement), this.selected = null); - a && (a.listElement.addClass("selected"), this.selected = a, a instanceof Entry.Variable ? (this.renderVariableReference(a), a.object_ && Entry.container.selectObject(a.object_, !0)) : a instanceof Entry.Func ? this.renderFunctionReference(a) : this.renderMessageReference(a)); + b && (b.listElement.addClass("selected"), this.selected = b, b instanceof Entry.Variable ? (this.renderVariableReference(b), b.object_ && Entry.container.selectObject(b.object_, !0)) : b instanceof Entry.Func ? this.renderFunctionReference(b) : this.renderMessageReference(b)); }; -Entry.VariableContainer.prototype.renderMessageReference = function(a) { - for (var b = this, c = this._messageRefs, d = a.id, e = [], f = 0;f < c.length;f++) { - -1 < c[f].block.params.indexOf(d) && e.push(c[f]); +Entry.VariableContainer.prototype.renderMessageReference = function(b) { + for (var a = this, d = this._messageRefs, c = b.id, e = [], f = 0;f < d.length;f++) { + -1 < d[f].block.params.indexOf(c) && e.push(d[f]); } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); + d = Entry.createElement("ul"); + d.addClass("entryVariableListCallerListWorkspace"); for (f in e) { - var d = e[f], g = Entry.createElement("li"); + var c = e[f], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(d.object.thumbnailView_.cloneNode()); + g.appendChild(c.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = d.object.name + " : " + Lang.Blocks["START_" + d.block.type]; + h.innerHTML = c.object.name + " : " + Lang.Blocks["START_" + c.block.type]; g.appendChild(h); - g.caller = d; - g.message = a; - g.bindOnClick(function(a) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(this.message)); + g.caller = c; + g.message = b; + g.bindOnClick(function(b) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(this.message)); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); - c.appendChild(g); + d.appendChild(g); } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - a.callerListElement = c; - this.listView_.insertBefore(c, a.listElement); - this.listView_.insertBefore(a.listElement, c); + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); + b.callerListElement = d; + this.listView_.insertBefore(d, b.listElement); + this.listView_.insertBefore(b.listElement, d); }; -Entry.VariableContainer.prototype.renderVariableReference = function(a) { - for (var b = this, c = this._variableRefs, d = a.id_, e = [], f = 0;f < c.length;f++) { - -1 < c[f].block.params.indexOf(d) && e.push(c[f]); +Entry.VariableContainer.prototype.renderVariableReference = function(b) { + for (var a = this, d = this._variableRefs, c = b.id_, e = [], f = 0;f < d.length;f++) { + -1 < d[f].block.params.indexOf(c) && e.push(d[f]); } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); + d = Entry.createElement("ul"); + d.addClass("entryVariableListCallerListWorkspace"); for (f in e) { - var d = e[f], g = Entry.createElement("li"); + var c = e[f], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(d.object.thumbnailView_.cloneNode()); + g.appendChild(c.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = d.object.name + " : " + Lang.Blocks["VARIABLE_" + d.block.type]; + h.innerHTML = c.object.name + " : " + Lang.Blocks["VARIABLE_" + c.block.type]; g.appendChild(h); - g.caller = d; - g.variable = a; - g.bindOnClick(function(a) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null)); - a = this.caller; - a = a.funcBlock || a.block; - a.view.getBoard().activateBlock(a); + g.caller = c; + g.variable = b; + g.bindOnClick(function(b) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null)); + b = this.caller; + b = b.funcBlock || b.block; + b.view.getBoard().activateBlock(b); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); - c.appendChild(g); + d.appendChild(g); } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - a.callerListElement = c; - this.listView_.insertBefore(c, a.listElement); - this.listView_.insertBefore(a.listElement, c); + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); + b.callerListElement = d; + this.listView_.insertBefore(d, b.listElement); + this.listView_.insertBefore(b.listElement, d); }; -Entry.VariableContainer.prototype.renderFunctionReference = function(a) { - for (var b = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { - d.push(c[e]); +Entry.VariableContainer.prototype.renderFunctionReference = function(b) { + for (var a = this, d = this._functionRefs, c = [], e = 0;e < d.length;e++) { + c.push(d[e]); } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); - for (e in d) { - var f = d[e], g = Entry.createElement("li"); + d = Entry.createElement("ul"); + d.addClass("entryVariableListCallerListWorkspace"); + for (e in c) { + var f = c[e], g = Entry.createElement("li"); g.addClass("entryVariableListCallerWorkspace"); g.appendChild(f.object.thumbnailView_.cloneNode()); var h = Entry.createElement("div"); @@ -20068,18 +18879,18 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(a) { g.appendChild(h); g.caller = f; g.bindOnClick(function(c) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(a)); + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(b)); c = this.caller.block; Entry.playground.toggleOnVariableView(); c.view.getBoard().activateBlock(c); Entry.playground.changeViewMode("variable"); }); - c.appendChild(g); + d.appendChild(g); } - 0 === d.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - a.callerListElement = c; - this.listView_.insertBefore(c, a.listElement); - this.listView_.insertBefore(a.listElement, c); + 0 === c.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, d.appendChild(g)); + b.callerListElement = d; + this.listView_.insertBefore(d, b.listElement); + this.listView_.insertBefore(b.listElement, d); }; Entry.VariableContainer.prototype.updateList = function() { if (this.listView_) { @@ -20087,42 +18898,42 @@ Entry.VariableContainer.prototype.updateList = function() { for (this.listSettingView.addClass("entryRemove");this.listView_.firstChild;) { this.listView_.removeChild(this.listView_.firstChild); } - var a = this.viewMode_, b = []; - if ("all" == a || "message" == a) { - "message" == a && this.listView_.appendChild(this.messageAddButton_); - for (var c in this.messages_) { - var d = this.messages_[c]; - b.push(d); - var e = d.listElement; + var b = this.viewMode_, a = []; + if ("all" == b || "message" == b) { + "message" == b && this.listView_.appendChild(this.messageAddButton_); + for (var d in this.messages_) { + var c = this.messages_[d]; + a.push(c); + var e = c.listElement; this.listView_.appendChild(e); - d.callerListElement && this.listView_.appendChild(d.callerListElement); + c.callerListElement && this.listView_.appendChild(c.callerListElement); } } - if ("all" == a || "variable" == a) { - if ("variable" == a) { + if ("all" == b || "variable" == b) { + if ("variable" == b) { e = this.variableAddPanel.info; e.object && !Entry.playground.object && (e.object = null); this.listView_.appendChild(this.variableAddButton_); this.listView_.appendChild(this.variableAddPanel.view); this.variableSplitters.top.innerHTML = Lang.Workspace.Variable_used_at_all_objects; this.listView_.appendChild(this.variableSplitters.top); - for (c in this.variables_) { - d = this.variables_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + for (d in this.variables_) { + c = this.variables_[d], c.object_ || (a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.Variable_used_at_special_object; this.listView_.appendChild(this.variableSplitters.bottom); - for (c in this.variables_) { - d = this.variables_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + for (d in this.variables_) { + c = this.variables_[d], c.object_ && (a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); } this.updateVariableAddView("variable"); } else { - for (c in this.variables_) { - d = this.variables_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + for (d in this.variables_) { + c = this.variables_[d], a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement); } } } - if ("all" == a || "list" == a) { - if ("list" == a) { + if ("all" == b || "list" == b) { + if ("list" == b) { e = this.listAddPanel.info; e.object && !Entry.playground.object && (e.object = null); this.listView_.appendChild(this.listAddButton_); @@ -20130,219 +18941,219 @@ Entry.VariableContainer.prototype.updateList = function() { this.variableSplitters.top.innerHTML = Lang.Workspace.List_used_all_objects; this.listView_.appendChild(this.variableSplitters.top); this.updateVariableAddView("list"); - for (c in this.lists_) { - d = this.lists_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + for (d in this.lists_) { + c = this.lists_[d], c.object_ || (a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.list_used_specific_objects; this.listView_.appendChild(this.variableSplitters.bottom); - for (c in this.lists_) { - d = this.lists_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + for (d in this.lists_) { + c = this.lists_[d], c.object_ && (a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement)); } this.updateVariableAddView("variable"); } else { - for (c in this.lists_) { - d = this.lists_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + for (d in this.lists_) { + c = this.lists_[d], a.push(c), e = c.listElement, this.listView_.appendChild(e), c.callerListElement && this.listView_.appendChild(c.callerListElement); } } } - if ("all" == a || "func" == a) { - for (c in "func" == a && this.listView_.appendChild(this.functionAddButton_), this.functions_) { - a = this.functions_[c], b.push(a), e = a.listElement, this.listView_.appendChild(e), a.callerListElement && this.listView_.appendChild(a.callerListElement); + if ("all" == b || "func" == b) { + for (d in "func" == b && this.listView_.appendChild(this.functionAddButton_), this.functions_) { + b = this.functions_[d], a.push(b), e = b.listElement, this.listView_.appendChild(e), b.callerListElement && this.listView_.appendChild(b.callerListElement); } } this.listView_.appendChild(this.variableSettingView); this.listView_.appendChild(this.listSettingView); } }; -Entry.VariableContainer.prototype.setMessages = function(a) { - for (var b in a) { - var c = a[b]; - c.id || (c.id = Entry.generateHash()); - this.createMessageView(c); - this.messages_.push(c); +Entry.VariableContainer.prototype.setMessages = function(b) { + for (var a in b) { + var d = b[a]; + d.id || (d.id = Entry.generateHash()); + this.createMessageView(d); + this.messages_.push(d); } Entry.playground.reloadPlayground(); this.updateList(); }; -Entry.VariableContainer.prototype.setVariables = function(a) { - for (var b in a) { - var c = new Entry.Variable(a[b]), d = c.getType(); - "variable" == d || "slide" == d ? (c.generateView(this.variables_.length), this.createVariableView(c), this.variables_.push(c)) : "list" == d ? (c.generateView(this.lists_.length), this.createListView(c), this.lists_.push(c)) : "timer" == d ? this.generateTimer(c) : "answer" == d && this.generateAnswer(c); +Entry.VariableContainer.prototype.setVariables = function(b) { + for (var a in b) { + var d = new Entry.Variable(b[a]), c = d.getType(); + "variable" == c || "slide" == c ? (d.generateView(this.variables_.length), this.createVariableView(d), this.variables_.push(d)) : "list" == c ? (d.generateView(this.lists_.length), this.createListView(d), this.lists_.push(d)) : "timer" == c ? this.generateTimer(d) : "answer" == c && this.generateAnswer(d); } Entry.isEmpty(Entry.engine.projectTimer) && Entry.variableContainer.generateTimer(); Entry.isEmpty(Entry.container.inputValue) && Entry.variableContainer.generateAnswer(); Entry.playground.reloadPlayground(); this.updateList(); }; -Entry.VariableContainer.prototype.setFunctions = function(a) { - for (var b in a) { - var c = new Entry.Func(a[b]); - c.generateBlock(); - this.createFunctionView(c); - this.functions_[c.id] = c; +Entry.VariableContainer.prototype.setFunctions = function(b) { + for (var a in b) { + var d = new Entry.Func(b[a]); + d.generateBlock(); + this.createFunctionView(d); + this.functions_[d.id] = d; } this.updateList(); }; -Entry.VariableContainer.prototype.getFunction = function(a) { - return this.functions_[a]; +Entry.VariableContainer.prototype.getFunction = function(b) { + return this.functions_[b]; }; -Entry.VariableContainer.prototype.getVariable = function(a, b) { - var c = Entry.findObjsByKey(this.variables_, "id_", a)[0]; - b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.variables, "id_", a)[0]); - return c; +Entry.VariableContainer.prototype.getVariable = function(b, a) { + var d = Entry.findObjsByKey(this.variables_, "id_", b)[0]; + a && a.isClone && d.object_ && (d = Entry.findObjsByKey(a.variables, "id_", b)[0]); + return d; }; -Entry.VariableContainer.prototype.getList = function(a, b) { - var c = Entry.findObjsByKey(this.lists_, "id_", a)[0]; - b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.lists, "id_", a)[0]); - return c; +Entry.VariableContainer.prototype.getList = function(b, a) { + var d = Entry.findObjsByKey(this.lists_, "id_", b)[0]; + a && a.isClone && d.object_ && (d = Entry.findObjsByKey(a.lists, "id_", b)[0]); + return d; }; Entry.VariableContainer.prototype.createFunction = function() { if (!Entry.Func.isEdit) { - var a = new Entry.Func; - Entry.Func.edit(a); + var b = new Entry.Func; + Entry.Func.edit(b); } }; -Entry.VariableContainer.prototype.addFunction = function(a) { +Entry.VariableContainer.prototype.addFunction = function(b) { }; -Entry.VariableContainer.prototype.removeFunction = function(a) { - var b = a.id; - a = this.functions_; - a[b].destroy(); - delete a[b]; - b = "func_" + b; - Entry.container.removeFuncBlocks(b); - for (var c in a) { - a[c].content.removeBlocksByType(b); +Entry.VariableContainer.prototype.removeFunction = function(b) { + var a = b.id; + b = this.functions_; + b[a].destroy(); + delete b[a]; + a = "func_" + a; + Entry.container.removeFuncBlocks(a); + for (var d in b) { + b[d].content.removeBlocksByType(a); } this.updateList(); }; -Entry.VariableContainer.prototype.checkListPosition = function(a, b) { - var c = a.x_ + a.width_, d = -a.y_, e = -a.y_ + -a.height_; - return b.x > a.x_ && b.x < c && b.y < d && b.y > e ? !0 : !1; +Entry.VariableContainer.prototype.checkListPosition = function(b, a) { + var d = b.x_ + b.width_, c = -b.y_, e = -b.y_ + -b.height_; + return a.x > b.x_ && a.x < d && a.y < c && a.y > e ? !0 : !1; }; -Entry.VariableContainer.prototype.getListById = function(a) { - var b = this.lists_, c = []; - if (0 < b.length) { - for (var d = 0;d < b.length;d++) { - this.checkListPosition(b[d], a) && c.push(b[d]); +Entry.VariableContainer.prototype.getListById = function(b) { + var a = this.lists_, d = []; + if (0 < a.length) { + for (var c = 0;c < a.length;c++) { + this.checkListPosition(a[c], b) && d.push(a[c]); } - return c; + return d; } return !1; }; -Entry.VariableContainer.prototype.editFunction = function(a, b) { +Entry.VariableContainer.prototype.editFunction = function(b, a) { }; -Entry.VariableContainer.prototype.saveFunction = function(a) { - this.functions_[a.id] || (this.functions_[a.id] = a, this.createFunctionView(a)); - a.listElement.nameField.innerHTML = a.description; +Entry.VariableContainer.prototype.saveFunction = function(b) { + this.functions_[b.id] || (this.functions_[b.id] = b, this.createFunctionView(b)); + b.listElement.nameField.innerHTML = b.description; this.updateList(); }; -Entry.VariableContainer.prototype.createFunctionView = function(a) { - var b = this; +Entry.VariableContainer.prototype.createFunctionView = function(b) { + var a = this; if (this.view_) { - var c = Entry.createElement("li"); - c.addClass("entryVariableListElementWorkspace"); - c.addClass("entryFunctionElementWorkspace"); - c.bindOnClick(function(c) { + var d = Entry.createElement("li"); + d.addClass("entryVariableListElementWorkspace"); + d.addClass("entryFunctionElementWorkspace"); + d.bindOnClick(function(c) { c.stopPropagation(); - b.select(a); + a.select(b); }); - var d = Entry.createElement("button"); - d.addClass("entryVariableListElementDeleteWorkspace"); - d.bindOnClick(function(c) { + var c = Entry.createElement("button"); + c.addClass("entryVariableListElementDeleteWorkspace"); + c.bindOnClick(function(c) { c.stopPropagation(); - confirm(Lang.Workspace.will_you_delete_function) && (b.removeFunction(a), b.selected = null); + confirm(Lang.Workspace.will_you_delete_function) && (a.removeFunction(b), a.selected = null); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); var f = this._getBlockMenu(); - e.bindOnClick(function(b) { - b.stopPropagation(); - Entry.Func.edit(a); + e.bindOnClick(function(a) { + a.stopPropagation(); + Entry.Func.edit(b); Entry.playground && (Entry.playground.changeViewMode("code"), "func" != f.lastSelector && f.selectMenu("func")); }); var g = Entry.createElement("div"); g.addClass("entryVariableFunctionElementNameWorkspace"); - g.innerHTML = a.description; - c.nameField = g; - c.appendChild(g); - c.appendChild(e); - c.appendChild(d); - a.listElement = c; + g.innerHTML = b.description; + d.nameField = g; + d.appendChild(g); + d.appendChild(e); + d.appendChild(c); + b.listElement = d; } }; -Entry.VariableContainer.prototype.checkAllVariableName = function(a, b) { - b = this[b]; - for (var c = 0;c < b.length;c++) { - if (b[c].name_ == a) { +Entry.VariableContainer.prototype.checkAllVariableName = function(b, a) { + a = this[a]; + for (var d = 0;d < a.length;d++) { + if (a[d].name_ == b) { return !0; } } return !1; }; -Entry.VariableContainer.prototype.addVariable = function(a) { - if (!a) { - var b = this.variableAddPanel; - a = b.view.name.value.trim(); - a && 0 !== a.length || (a = Lang.Workspace.variable); - a.length > this._maxNameLength && (a = this._truncName(a, "variable")); - a = this.checkAllVariableName(a, "variables_") ? Entry.getOrderedName(a, this.variables_, "name_") : a; - var c = b.info; - a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"variable"}; - b.view.addClass("entryRemove"); +Entry.VariableContainer.prototype.addVariable = function(b) { + if (!b) { + var a = this.variableAddPanel; + b = a.view.name.value.trim(); + b && 0 !== b.length || (b = Lang.Workspace.variable); + b.length > this._maxNameLength && (b = this._truncName(b, "variable")); + b = this.checkAllVariableName(b, "variables_") ? Entry.getOrderedName(b, this.variables_, "name_") : b; + var d = a.info; + b = {name:b, isCloud:d.isCloud, object:d.object, variableType:"variable"}; + a.view.addClass("entryRemove"); this.resetVariableAddPanel("variable"); } - a = new Entry.Variable(a); - Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, a); - a.generateView(this.variables_.length); - this.createVariableView(a); - this.variables_.unshift(a); + b = new Entry.Variable(b); + Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, b); + b.generateView(this.variables_.length); + this.createVariableView(b); + this.variables_.unshift(b); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.removeVariable, a); -}; -Entry.VariableContainer.prototype.removeVariable = function(a) { - var b = this.variables_.indexOf(a), c = a.toJSON(); - this.selected == a && this.select(null); - a.remove(); - this.variables_.splice(b, 1); - Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, c); + return new Entry.State(this, this.removeVariable, b); +}; +Entry.VariableContainer.prototype.removeVariable = function(b) { + var a = this.variables_.indexOf(b), d = b.toJSON(); + this.selected == b && this.select(null); + b.remove(); + this.variables_.splice(a, 1); + Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, d); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.addVariable, c); + return new Entry.State(this, this.addVariable, d); }; -Entry.VariableContainer.prototype.changeVariableName = function(a, b) { - a.name_ != b && (Entry.isExist(b, "name_", this.variables_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (a.setName(b), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); +Entry.VariableContainer.prototype.changeVariableName = function(b, a) { + b.name_ != a && (Entry.isExist(a, "name_", this.variables_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (b.setName(a), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); }; -Entry.VariableContainer.prototype.changeListName = function(a, b) { - a.name_ != b && (Entry.isExist(b, "name_", this.lists_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (a.name_ = b, a.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); +Entry.VariableContainer.prototype.changeListName = function(b, a) { + b.name_ != a && (Entry.isExist(a, "name_", this.lists_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (b.name_ = a, b.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); }; -Entry.VariableContainer.prototype.removeList = function(a) { - var b = this.lists_.indexOf(a), c = a.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, c); - this.selected == a && this.select(null); - a.remove(); - this.lists_.splice(b, 1); +Entry.VariableContainer.prototype.removeList = function(b) { + var a = this.lists_.indexOf(b), d = b.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, d); + this.selected == b && this.select(null); + b.remove(); + this.lists_.splice(a, 1); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.addList, c); + return new Entry.State(this, this.addList, d); }; -Entry.VariableContainer.prototype.createVariableView = function(a) { - var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); - d.addClass("entryVariableListElementWrapperWorkspace"); - c.appendChild(d); - c.addClass("entryVariableListElementWorkspace"); - a.object_ ? c.addClass("entryVariableLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); - c.bindOnClick(function(c) { - b.select(a); +Entry.VariableContainer.prototype.createVariableView = function(b) { + var a = this, d = Entry.createElement("li"), c = Entry.createElement("div"); + c.addClass("entryVariableListElementWrapperWorkspace"); + d.appendChild(c); + d.addClass("entryVariableListElementWorkspace"); + b.object_ ? d.addClass("entryVariableLocalElementWorkspace") : b.isCloud_ ? d.addClass("entryVariableCloudElementWorkspace") : d.addClass("entryVariableGlobalElementWorkspace"); + d.bindOnClick(function(c) { + a.select(b); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); e.bindOnClick(function(c) { c.stopPropagation(); - b.removeVariable(a); - b.selectedVariable = null; - b.variableSettingView.addClass("entryRemove"); + a.removeVariable(b); + a.selectedVariable = null; + a.variableSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); @@ -20351,81 +19162,81 @@ Entry.VariableContainer.prototype.createVariableView = function(a) { h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); - b.updateSelectedVariable(a); + a.updateSelectedVariable(b); h.focus(); }); - c.editButton = f; + d.editButton = f; var g = Entry.createElement("button"); g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove"); - g.bindOnClick(function(a) { - a.stopPropagation(); + g.bindOnClick(function(b) { + b.stopPropagation(); h.blur(); h.setAttribute("disabled", "disabled"); f.removeClass("entryRemove"); this.addClass("entryRemove"); - b.updateSelectedVariable(null, "variable"); + a.updateSelectedVariable(null, "variable"); }); - c.editSaveButton = g; + d.editSaveButton = g; var h = Entry.createElement("input"); h.addClass("entryVariableListElementNameWorkspace"); h.setAttribute("disabled", "disabled"); - h.value = a.name_; - h.bindOnClick(function(b) { - b.stopPropagation(); + h.value = b.name_; + h.bindOnClick(function(a) { + a.stopPropagation(); }); h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); + (c = this.value.trim()) && 0 !== c.length ? a.changeVariableName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = b.getName()); }; - h.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + h.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; - c.nameField = h; - d.appendChild(h); - d.appendChild(f); - d.appendChild(g); - d.appendChild(e); - a.listElement = c; + d.nameField = h; + c.appendChild(h); + c.appendChild(f); + c.appendChild(g); + c.appendChild(e); + b.listElement = d; }; -Entry.VariableContainer.prototype.addMessage = function(a) { - a.id || (a.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, a); - this.createMessageView(a); - this.messages_.unshift(a); +Entry.VariableContainer.prototype.addMessage = function(b) { + b.id || (b.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, b); + this.createMessageView(b); + this.messages_.unshift(b); Entry.playground.reloadPlayground(); this.updateList(); - a.listElement.nameField.focus(); - return new Entry.State(this, this.removeMessage, a); -}; -Entry.VariableContainer.prototype.removeMessage = function(a) { - this.selected == a && this.select(null); - Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, a); - var b = this.messages_.indexOf(a); - this.messages_.splice(b, 1); + b.listElement.nameField.focus(); + return new Entry.State(this, this.removeMessage, b); +}; +Entry.VariableContainer.prototype.removeMessage = function(b) { + this.selected == b && this.select(null); + Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, b); + var a = this.messages_.indexOf(b); + this.messages_.splice(a, 1); this.updateList(); Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addMessage, a); + return new Entry.State(this, this.addMessage, b); }; -Entry.VariableContainer.prototype.changeMessageName = function(a, b) { - a.name != b && (Entry.isExist(b, "name", this.messages_) ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (a.name = b, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); +Entry.VariableContainer.prototype.changeMessageName = function(b, a) { + b.name != a && (Entry.isExist(a, "name", this.messages_) ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (b.name = a, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); }; -Entry.VariableContainer.prototype.createMessageView = function(a) { - var b = this, c = Entry.createElement("li"); - c.addClass("entryVariableListElementWorkspace"); - c.addClass("entryMessageElementWorkspace"); - c.bindOnClick(function(c) { - b.select(a); - }); - var d = Entry.createElement("button"); - d.addClass("entryVariableListElementDeleteWorkspace"); +Entry.VariableContainer.prototype.createMessageView = function(b) { + var a = this, d = Entry.createElement("li"); + d.addClass("entryVariableListElementWorkspace"); + d.addClass("entryMessageElementWorkspace"); d.bindOnClick(function(c) { + a.select(b); + }); + var c = Entry.createElement("button"); + c.addClass("entryVariableListElementDeleteWorkspace"); + c.bindOnClick(function(c) { c.stopPropagation(); - b.removeMessage(a); + a.removeMessage(b); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); - e.bindOnClick(function(b) { - b.stopPropagation(); + e.bindOnClick(function(a) { + a.stopPropagation(); g.removeAttribute("disabled"); g.focus(); f.removeClass("entryRemove"); @@ -20434,68 +19245,68 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); f.addClass("entryRemove"); - f.bindOnClick(function(b) { - b.stopPropagation(); + f.bindOnClick(function(a) { + a.stopPropagation(); g.blur(); e.removeClass("entryRemove"); this.addClass("entryRemove"); }); var g = Entry.createElement("input"); g.addClass("entryVariableListElementNameWorkspace"); - g.value = a.name; - g.bindOnClick(function(b) { - b.stopPropagation(); + g.value = b.name; + g.bindOnClick(function(a) { + a.stopPropagation(); }); g.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); + (c = this.value.trim()) && 0 !== c.length ? (a.changeMessageName(b, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = b.name); }; - g.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + g.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; - c.nameField = g; - c.appendChild(g); - c.appendChild(e); - c.appendChild(f); - c.appendChild(d); - a.listElement = c; + d.nameField = g; + d.appendChild(g); + d.appendChild(e); + d.appendChild(f); + d.appendChild(c); + b.listElement = d; }; -Entry.VariableContainer.prototype.addList = function(a) { - if (!a) { - var b = this.listAddPanel; - a = b.view.name.value.trim(); - a && 0 !== a.length || (a = Lang.Workspace.list); - var c = b.info; - a.length > this._maxNameLength && (a = this._truncName(a, "list")); - a = this.checkAllVariableName(a, "lists_") ? Entry.getOrderedName(a, this.lists_, "name_") : a; - a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"list"}; - b.view.addClass("entryRemove"); +Entry.VariableContainer.prototype.addList = function(b) { + if (!b) { + var a = this.listAddPanel; + b = a.view.name.value.trim(); + b && 0 !== b.length || (b = Lang.Workspace.list); + var d = a.info; + b.length > this._maxNameLength && (b = this._truncName(b, "list")); + b = this.checkAllVariableName(b, "lists_") ? Entry.getOrderedName(b, this.lists_, "name_") : b; + b = {name:b, isCloud:d.isCloud, object:d.object, variableType:"list"}; + a.view.addClass("entryRemove"); this.resetVariableAddPanel("list"); } - a = new Entry.Variable(a); - Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, a); - a.generateView(this.lists_.length); - this.createListView(a); - this.lists_.unshift(a); + b = new Entry.Variable(b); + Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, b); + b.generateView(this.lists_.length); + this.createListView(b); + this.lists_.unshift(b); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.removelist, a); + return new Entry.State(this, this.removelist, b); }; -Entry.VariableContainer.prototype.createListView = function(a) { - var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); - d.addClass("entryVariableListElementWrapperWorkspace"); - c.appendChild(d); - c.addClass("entryVariableListElementWorkspace"); - a.object_ ? c.addClass("entryListLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); - c.bindOnClick(function(c) { - b.select(a); +Entry.VariableContainer.prototype.createListView = function(b) { + var a = this, d = Entry.createElement("li"), c = Entry.createElement("div"); + c.addClass("entryVariableListElementWrapperWorkspace"); + d.appendChild(c); + d.addClass("entryVariableListElementWorkspace"); + b.object_ ? d.addClass("entryListLocalElementWorkspace") : b.isCloud_ ? d.addClass("entryListCloudElementWorkspace") : d.addClass("entryListGlobalElementWorkspace"); + d.bindOnClick(function(c) { + a.select(b); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); e.bindOnClick(function(c) { c.stopPropagation(); - b.removeList(a); - b.selectedList = null; - b.listSettingView.addClass("entryRemove"); + a.removeList(b); + a.selectedList = null; + a.listSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); @@ -20504,10 +19315,10 @@ Entry.VariableContainer.prototype.createListView = function(a) { h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); - b.updateSelectedVariable(a); + a.updateSelectedVariable(b); h.focus(); }); - c.editButton = f; + d.editButton = f; var g = Entry.createElement("button"); g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove"); @@ -20517,619 +19328,627 @@ Entry.VariableContainer.prototype.createListView = function(a) { h.setAttribute("disabled", "disabled"); f.removeClass("entryRemove"); this.addClass("entryRemove"); - b.select(a); - b.updateSelectedVariable(null, "list"); + a.select(b); + a.updateSelectedVariable(null, "list"); }); - c.editSaveButton = g; + d.editSaveButton = g; var h = Entry.createElement("input"); h.setAttribute("disabled", "disabled"); h.addClass("entryVariableListElementNameWorkspace"); - h.value = a.name_; - h.bindOnClick(function(b) { - b.stopPropagation(); + h.value = b.name_; + h.bindOnClick(function(a) { + a.stopPropagation(); }); h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); + (c = this.value.trim()) && 0 !== c.length ? a.changeListName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = b.getName()); }; - h.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + h.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; - c.nameField = h; - d.appendChild(h); - d.appendChild(f); - d.appendChild(g); - d.appendChild(e); - a.listElement = c; + d.nameField = h; + c.appendChild(h); + c.appendChild(f); + c.appendChild(g); + c.appendChild(e); + b.listElement = d; }; -Entry.VariableContainer.prototype.mapVariable = function(a, b) { - for (var c = this.variables_.length, d = 0;d < c;d++) { - a(this.variables_[d], b); +Entry.VariableContainer.prototype.mapVariable = function(b, a) { + for (var d = this.variables_.length, c = 0;c < d;c++) { + b(this.variables_[c], a); } }; -Entry.VariableContainer.prototype.mapList = function(a, b) { - for (var c = this.lists_.length, d = 0;d < c;d++) { - a(this.lists_[d], b); +Entry.VariableContainer.prototype.mapList = function(b, a) { + for (var d = this.lists_.length, c = 0;c < d;c++) { + b(this.lists_[c], a); } }; Entry.VariableContainer.prototype.getVariableJSON = function() { - for (var a = [], b = 0;b < this.variables_.length;b++) { - a.push(this.variables_[b].toJSON()); + for (var b = [], a = 0;a < this.variables_.length;a++) { + b.push(this.variables_[a].toJSON()); } - for (b = 0;b < this.lists_.length;b++) { - a.push(this.lists_[b].toJSON()); + for (a = 0;a < this.lists_.length;a++) { + b.push(this.lists_[a].toJSON()); } - Entry.engine.projectTimer && a.push(Entry.engine.projectTimer.toJSON()); - b = Entry.container.inputValue; - Entry.isEmpty(b) || a.push(b.toJSON()); - return a; + Entry.engine.projectTimer && b.push(Entry.engine.projectTimer.toJSON()); + a = Entry.container.inputValue; + Entry.isEmpty(a) || b.push(a.toJSON()); + return b; }; Entry.VariableContainer.prototype.getMessageJSON = function() { - for (var a = [], b = 0;b < this.messages_.length;b++) { - a.push({id:this.messages_[b].id, name:this.messages_[b].name}); + for (var b = [], a = 0;a < this.messages_.length;a++) { + b.push({id:this.messages_[a].id, name:this.messages_[a].name}); } - return a; + return b; }; Entry.VariableContainer.prototype.getFunctionJSON = function() { - var a = [], b; - for (b in this.functions_) { - var c = this.functions_[b], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; - a.push(c); + var b = [], a; + for (a in this.functions_) { + var d = this.functions_[a], d = {id:d.id, content:JSON.stringify(d.content.toJSON())}; + b.push(d); } - return a; + return b; }; -Entry.VariableContainer.prototype.resetVariableAddPanel = function(a) { - a = a || "variable"; - var b = "variable" == a ? this.variableAddPanel : this.listAddPanel, c = b.info; - c.isCloud = !1; - c.object = null; - b.view.name.value = ""; - b.isOpen = !1; - this.updateVariableAddView(a); +Entry.VariableContainer.prototype.resetVariableAddPanel = function(b) { + b = b || "variable"; + var a = "variable" == b ? this.variableAddPanel : this.listAddPanel, d = a.info; + d.isCloud = !1; + d.object = null; + a.view.name.value = ""; + a.isOpen = !1; + this.updateVariableAddView(b); }; Entry.VariableContainer.prototype.generateVariableAddView = function() { - var a = this, b = Entry.createElement("li"); - this.variableAddPanel.view = b; + var b = this, a = Entry.createElement("li"); + this.variableAddPanel.view = a; this.variableAddPanel.isOpen = !1; - b.addClass("entryVariableAddSpaceWorkspace"); - b.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - b.appendChild(c); - var d = Entry.createElement("input"); - d.addClass("entryVariableAddSpaceInputWorkspace"); - d.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); - d.variableContainer = this; - d.onkeypress = function(b) { - 13 == b.keyCode && (Entry.variableContainer.addVariable(), a.updateSelectedVariable(a.variables_[0]), b = a.variables_[0].listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); - }; - this.variableAddPanel.view.name = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(b) { - a.variableAddPanel.info.object = null; - a.updateVariableAddView("variable"); + a.addClass("entryVariableAddSpaceWorkspace"); + a.addClass("entryRemove"); + var d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + a.appendChild(d); + var c = Entry.createElement("input"); + c.addClass("entryVariableAddSpaceInputWorkspace"); + c.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); + c.variableContainer = this; + c.onkeypress = function(a) { + 13 == a.keyCode && (Entry.variableContainer.addVariable(), b.updateSelectedVariable(b.variables_[0]), a = b.variables_[0].listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); + }; + this.variableAddPanel.view.name = c; + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + d.bindOnClick(function(a) { + b.variableAddPanel.info.object = null; + b.updateVariableAddView("variable"); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_all_objects; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.globalCheck = d; - this.variableAddPanel.info.object || d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(b) { - Entry.playground.object && (b = a.variableAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("variable")); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.Variable_use_all_objects; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.globalCheck = c; + this.variableAddPanel.info.object || c.addClass("entryVariableAddChecked"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + d.bindOnClick(function(a) { + Entry.playground.object && (a = b.variableAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("variable")); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_this_object; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.localCheck = d; - this.variableAddPanel.info.object && d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - b.cloudWrapper = c; - c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(b) { - b = a.variableAddPanel.info; - b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("variable")); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.Variable_use_this_object; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.localCheck = c; + this.variableAddPanel.info.object && c.addClass("entryVariableAddChecked"); + d.appendChild(c); + d = Entry.createElement("div"); + a.cloudWrapper = d; + d.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + d.bindOnClick(function(a) { + a = b.variableAddPanel.info; + a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("variable")); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - d.innerHTML = Lang.Workspace.Variable_create_cloud; - c.appendChild(d); - d = Entry.createElement("span"); - this.variableAddPanel.view.cloudCheck = d; - d.addClass("entryVariableAddSpaceCheckWorkspace"); - d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.variableAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - b.appendChild(c); - b = Entry.createElement("span"); - b.addClass("entryVariableAddSpaceCancelWorkspace"); - b.addClass("entryVariableAddSpaceButtonWorkspace"); - b.innerHTML = Lang.Buttons.cancel; - b.bindOnClick(function(b) { - a.variableAddPanel.view.addClass("entryRemove"); - a.resetVariableAddPanel("variable"); + a.appendChild(d); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + c.innerHTML = Lang.Workspace.Variable_create_cloud; + d.appendChild(c); + c = Entry.createElement("span"); + this.variableAddPanel.view.cloudCheck = c; + c.addClass("entryVariableAddSpaceCheckWorkspace"); + c.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.variableAddPanel.info.isCloud && c.addClass("entryVariableAddChecked"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + a.appendChild(d); + a = Entry.createElement("span"); + a.addClass("entryVariableAddSpaceCancelWorkspace"); + a.addClass("entryVariableAddSpaceButtonWorkspace"); + a.innerHTML = Lang.Buttons.cancel; + a.bindOnClick(function(a) { + b.variableAddPanel.view.addClass("entryRemove"); + b.resetVariableAddPanel("variable"); }); - c.appendChild(b); - b = Entry.createElement("span"); - b.addClass("entryVariableAddSpaceConfirmWorkspace"); - b.addClass("entryVariableAddSpaceButtonWorkspace"); - b.innerHTML = Lang.Buttons.save; - b.variableContainer = this; - b.bindOnClick(function(b) { + d.appendChild(a); + a = Entry.createElement("span"); + a.addClass("entryVariableAddSpaceConfirmWorkspace"); + a.addClass("entryVariableAddSpaceButtonWorkspace"); + a.innerHTML = Lang.Buttons.save; + a.variableContainer = this; + a.bindOnClick(function(a) { Entry.variableContainer.addVariable(); - a.updateSelectedVariable(a.variables_[0]); - b = a.variables_[0].listElement; - b.editButton.addClass("entryRemove"); - b.editSaveButton.removeClass("entryRemove"); - b.nameField.removeAttribute("disabled"); + b.updateSelectedVariable(b.variables_[0]); + a = b.variables_[0].listElement; + a.editButton.addClass("entryRemove"); + a.editSaveButton.removeClass("entryRemove"); + a.nameField.removeAttribute("disabled"); }); - c.appendChild(b); + d.appendChild(a); }; Entry.VariableContainer.prototype.generateListAddView = function() { - var a = this, b = Entry.createElement("li"); - this.listAddPanel.view = b; + var b = this, a = Entry.createElement("li"); + this.listAddPanel.view = a; this.listAddPanel.isOpen = !1; - b.addClass("entryVariableAddSpaceWorkspace"); - b.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - c.addClass("entryListAddSpaceNameWrapperWorkspace"); - b.appendChild(c); - var d = Entry.createElement("input"); - d.addClass("entryVariableAddSpaceInputWorkspace"); - d.setAttribute("placeholder", Lang.Workspace.list_name); - this.listAddPanel.view.name = d; - d.variableContainer = this; - d.onkeypress = function(b) { - 13 == b.keyCode && (a.addList(), b = a.lists_[0], a.updateSelectedVariable(b), b = b.listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); + a.addClass("entryVariableAddSpaceWorkspace"); + a.addClass("entryRemove"); + var d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + d.addClass("entryListAddSpaceNameWrapperWorkspace"); + a.appendChild(d); + var c = Entry.createElement("input"); + c.addClass("entryVariableAddSpaceInputWorkspace"); + c.setAttribute("placeholder", Lang.Workspace.list_name); + this.listAddPanel.view.name = c; + c.variableContainer = this; + c.onkeypress = function(a) { + 13 == a.keyCode && (b.addList(), a = b.lists_[0], b.updateSelectedVariable(a), a = a.listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); }; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(b) { - a.listAddPanel.info.object = null; - a.updateVariableAddView("list"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + d.bindOnClick(function(a) { + b.listAddPanel.info.object = null; + b.updateVariableAddView("list"); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.use_all_objects; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.globalCheck = d; - this.listAddPanel.info.object || d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(b) { - Entry.playground.object && (b = a.listAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("list")); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.use_all_objects; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.globalCheck = c; + this.listAddPanel.info.object || c.addClass("entryVariableAddChecked"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + d.bindOnClick(function(a) { + Entry.playground.object && (a = b.listAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("list")); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_this_object; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.localCheck = d; + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.Variable_use_this_object; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.localCheck = c; this.variableAddPanel.info.object && addVariableLocalCheck.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - b.cloudWrapper = c; - c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(b) { - b = a.listAddPanel.info; - b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("list")); + d.appendChild(c); + d = Entry.createElement("div"); + a.cloudWrapper = d; + d.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + d.bindOnClick(function(a) { + a = b.listAddPanel.info; + a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("list")); }); - b.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - d.innerHTML = Lang.Workspace.List_create_cloud; - c.appendChild(d); - d = Entry.createElement("span"); - this.listAddPanel.view.cloudCheck = d; - d.addClass("entryVariableAddSpaceCheckWorkspace"); - d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.listAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - b.appendChild(c); - b = Entry.createElement("span"); - b.addClass("entryVariableAddSpaceCancelWorkspace"); - b.addClass("entryVariableAddSpaceButtonWorkspace"); - b.innerHTML = Lang.Buttons.cancel; - b.bindOnClick(function(b) { - a.listAddPanel.view.addClass("entryRemove"); - a.resetVariableAddPanel("list"); + a.appendChild(d); + c = Entry.createElement("span"); + c.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + c.innerHTML = Lang.Workspace.List_create_cloud; + d.appendChild(c); + c = Entry.createElement("span"); + this.listAddPanel.view.cloudCheck = c; + c.addClass("entryVariableAddSpaceCheckWorkspace"); + c.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.listAddPanel.info.isCloud && c.addClass("entryVariableAddChecked"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + a.appendChild(d); + a = Entry.createElement("span"); + a.addClass("entryVariableAddSpaceCancelWorkspace"); + a.addClass("entryVariableAddSpaceButtonWorkspace"); + a.innerHTML = Lang.Buttons.cancel; + a.bindOnClick(function(a) { + b.listAddPanel.view.addClass("entryRemove"); + b.resetVariableAddPanel("list"); }); - c.appendChild(b); - b = Entry.createElement("span"); - b.addClass("entryVariableAddSpaceConfirmWorkspace"); - b.addClass("entryVariableAddSpaceButtonWorkspace"); - b.innerHTML = Lang.Buttons.save; - b.variableContainer = this; - b.bindOnClick(function(b) { - a.addList(); - b = a.lists_[0]; - a.updateSelectedVariable(b); - b = b.listElement; - b.editButton.addClass("entryRemove"); - b.editSaveButton.removeClass("entryRemove"); - b.nameField.removeAttribute("disabled"); + d.appendChild(a); + a = Entry.createElement("span"); + a.addClass("entryVariableAddSpaceConfirmWorkspace"); + a.addClass("entryVariableAddSpaceButtonWorkspace"); + a.innerHTML = Lang.Buttons.save; + a.variableContainer = this; + a.bindOnClick(function(a) { + b.addList(); + a = b.lists_[0]; + b.updateSelectedVariable(a); + a = a.listElement; + a.editButton.addClass("entryRemove"); + a.editSaveButton.removeClass("entryRemove"); + a.nameField.removeAttribute("disabled"); }); - c.appendChild(b); + d.appendChild(a); }; Entry.VariableContainer.prototype.generateVariableSplitterView = function() { - var a = Entry.createElement("li"); - a.addClass("entryVariableSplitterWorkspace"); var b = Entry.createElement("li"); b.addClass("entryVariableSplitterWorkspace"); - this.variableSplitters = {top:a, bottom:b}; + var a = Entry.createElement("li"); + a.addClass("entryVariableSplitterWorkspace"); + this.variableSplitters = {top:b, bottom:a}; }; -Entry.VariableContainer.prototype.openVariableAddPanel = function(a) { - a = a ? a : "variable"; +Entry.VariableContainer.prototype.openVariableAddPanel = function(b) { + b = b ? b : "variable"; Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); - "variable" == a ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; - this.selectFilter(a); - this.updateVariableAddView(a); + "variable" == b ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; + this.selectFilter(b); + this.updateVariableAddView(b); }; -Entry.VariableContainer.prototype.getMenuXml = function(a) { - for (var b = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = a[f];f++) { +Entry.VariableContainer.prototype.getMenuXml = function(b) { + for (var a = [], d = 0 !== this.variables_.length, c = 0 !== this.lists_.length, e, f = 0, g;g = b[f];f++) { var h = g.tagName; - h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || b.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && b.push(g); + h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !d && "variable" == e || !c && "list" == e || a.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !d && "variable" == e || (c || "list" != e) && a.push(g); } - return b; + return a; }; -Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { - var b = [], c = this; - this.mapVariable(function(a, c) { - a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); - }, a); - b.map(function(b) { - c.addVariable(b); +Entry.VariableContainer.prototype.addCloneLocalVariables = function(b) { + var a = [], d = this; + this.mapVariable(function(b, d) { + if (b.object_ && b.object_ == d.objectId) { + var f = b.toJSON(); + f.originId = f.id; + f.id = Entry.generateHash(); + f.object = d.newObjectId; + delete f.x; + delete f.y; + a.push(f); + d.json.script = d.json.script.replace(new RegExp(f.originId, "g"), f.id); + } + }, b); + a.map(function(a) { + d.addVariable(a); }); }; -Entry.VariableContainer.prototype.generateTimer = function(a) { - a || (a = {}, a.id = Entry.generateHash(), a.name = Lang.Workspace.Variable_Timer, a.value = 0, a.variableType = "timer", a.visible = !1, a.x = 150, a.y = -70, a = new Entry.Variable(a)); - a.generateView(); - a.tick = null; - Entry.engine.projectTimer = a; +Entry.VariableContainer.prototype.generateTimer = function(b) { + b || (b = {}, b.id = Entry.generateHash(), b.name = Lang.Workspace.Variable_Timer, b.value = 0, b.variableType = "timer", b.visible = !1, b.x = 150, b.y = -70, b = new Entry.Variable(b)); + b.generateView(); + b.tick = null; + Entry.engine.projectTimer = b; Entry.addEventListener("stop", function() { Entry.engine.stopProjectTimer(); }); }; -Entry.VariableContainer.prototype.generateAnswer = function(a) { - a || (a = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); - a.generateView(); - Entry.container.inputValue = a; +Entry.VariableContainer.prototype.generateAnswer = function(b) { + b || (b = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); + b.generateView(); + Entry.container.inputValue = b; }; Entry.VariableContainer.prototype.generateVariableSettingView = function() { - var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(b) { - b.stopPropagation(); + var b = this, a = Entry.createElement("div"); + a.bindOnClick(function(a) { + a.stopPropagation(); }); - this.variableSettingView = b; - b.addClass("entryVariableSettingWorkspace"); - this.listView_.appendChild(b); - b.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryVariableSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(b) { - b = a.selectedVariable; - var c = a.variableSettingView.visibleCheck; - b.setVisible(!b.isVisible()); - b.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); + this.variableSettingView = a; + a.addClass("entryVariableSettingWorkspace"); + this.listView_.appendChild(a); + a.addClass("entryRemove"); + var d = Entry.createElement("div"); + d.addClass("entryVariableSettingVisibleWrapperWorkspace"); + d.bindOnClick(function(a) { + a = b.selectedVariable; + var c = b.variableSettingView.visibleCheck; + a.setVisible(!a.isVisible()); + a.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); }); - b.appendChild(c); - var d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.show_variable; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableSettingCheckWorkspace"); - b.visibleCheck = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingInitValueWrapperWorkspace"); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.default_value; - c.appendChild(d); - d = Entry.createElement("input"); - d.addClass("entryVariableSettingInitValueInputWorkspace"); - b.initValueInput = d; - d.value = 0; - d.onkeyup = function(b) { - a.selectedVariable.setValue(this.value); + a.appendChild(d); + var c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.show_variable; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableSettingCheckWorkspace"); + a.visibleCheck = c; + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableSettingInitValueWrapperWorkspace"); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.default_value; + d.appendChild(c); + c = Entry.createElement("input"); + c.addClass("entryVariableSettingInitValueInputWorkspace"); + a.initValueInput = c; + c.value = 0; + c.onkeyup = function(a) { + b.selectedVariable.setValue(this.value); }; - d.onblur = function(b) { - a.selectedVariable.setValue(this.value); + c.onblur = function(a) { + b.selectedVariable.setValue(this.value); }; - b.initValueInput = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSplitterWorkspace"); - b.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSlideWrapperWorkspace"); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.slide; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableSettingCheckWorkspace"); - b.slideCheck = d; - c.appendChild(d); - c.bindOnClick(function(b) { + a.initValueInput = c; + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryVariableSettingSplitterWorkspace"); + a.appendChild(d); + d = Entry.createElement("div"); + d.addClass("entryVariableSettingSlideWrapperWorkspace"); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.slide; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryVariableSettingCheckWorkspace"); + a.slideCheck = c; + d.appendChild(c); + d.bindOnClick(function(a) { var c; - b = a.selectedVariable; - var d = a.variables_, f = b.getType(); - "variable" == f ? (c = b.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = b.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - a.createVariableView(c); - a.removeVariable(b); - a.updateSelectedVariable(c); + a = b.selectedVariable; + var d = b.variables_, f = a.getType(); + "variable" == f ? (c = a.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = a.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + b.createVariableView(c); + b.removeVariable(a); + b.updateSelectedVariable(c); c.generateView(); }); - c = Entry.createElement("div"); - b.minMaxWrapper = c; - c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); - b.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.min_value; - c.appendChild(d); + d = Entry.createElement("div"); + a.minMaxWrapper = d; + d.addClass("entryVariableSettingMinMaxWrapperWorkspace"); + a.appendChild(d); + c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.min_value; + d.appendChild(c); var e = Entry.createElement("input"); e.addClass("entryVariableSettingMinValueInputWorkspace"); - d = a.selectedVariable; - e.value = d && "slide" == d.type ? d.minValue_ : 0; - e.onkeypress = function(b) { - 13 === b.keyCode && this.blur(); + c = b.selectedVariable; + e.value = c && "slide" == c.type ? c.minValue_ : 0; + e.onkeypress = function(a) { + 13 === a.keyCode && this.blur(); }; - e.onblur = function(b) { - isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(this.value), a.updateVariableSettingView(b)); + e.onblur = function(a) { + isNaN(this.value) || (a = b.selectedVariable, a.setMinValue(this.value), b.updateVariableSettingView(a)); }; - b.minValueInput = e; - c.appendChild(e); + a.minValueInput = e; + d.appendChild(e); var f = Entry.createElement("span"); f.addClass("entryVariableSettingMaxValueSpanWorkspace"); f.innerHTML = Lang.Workspace.max_value; - c.appendChild(f); + d.appendChild(f); var g = Entry.createElement("input"); g.addClass("entryVariableSettingMaxValueInputWorkspace"); - g.value = d && "slide" == d.type ? d.maxValue_ : 100; - g.onkeypress = function(b) { - 13 === b.keyCode && this.blur(); + g.value = c && "slide" == c.type ? c.maxValue_ : 100; + g.onkeypress = function(a) { + 13 === a.keyCode && this.blur(); }; - g.onblur = function(b) { - isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(this.value), a.updateVariableSettingView(b)); + g.onblur = function(a) { + isNaN(this.value) || (a = b.selectedVariable, a.setMaxValue(this.value), b.updateVariableSettingView(a)); }; - b.maxValueInput = g; - c.appendChild(g); + a.maxValueInput = g; + d.appendChild(g); }; -Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { - var b = this.variableSettingView, c = b.visibleCheck, d = b.initValueInput, e = b.slideCheck, f = b.minValueInput, g = b.maxValueInput, h = b.minMaxWrapper; - c.removeClass("entryVariableSettingChecked"); - a.isVisible() && c.addClass("entryVariableSettingChecked"); +Entry.VariableContainer.prototype.updateVariableSettingView = function(b) { + var a = this.variableSettingView, d = a.visibleCheck, c = a.initValueInput, e = a.slideCheck, f = a.minValueInput, g = a.maxValueInput, h = a.minMaxWrapper; + d.removeClass("entryVariableSettingChecked"); + b.isVisible() && d.addClass("entryVariableSettingChecked"); e.removeClass("entryVariableSettingChecked"); - "slide" == a.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = a.getMinValue(), g.value = a.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - d.value = a.getValue(); - a.listElement.appendChild(b); - b.removeClass("entryRemove"); + "slide" == b.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = b.getMinValue(), g.value = b.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + c.value = b.getValue(); + b.listElement.appendChild(a); + a.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.generateListSettingView = function() { - var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(b) { - b.stopPropagation(); + var b = this, a = Entry.createElement("div"); + a.bindOnClick(function(a) { + a.stopPropagation(); }); - this.listSettingView = b; - b.addClass("entryListSettingWorkspace"); - this.listView_.appendChild(b); - b.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryListSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(b) { - b = a.selectedList; - var c = a.listSettingView.visibleCheck; - b.setVisible(!b.isVisible()); - b.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); + this.listSettingView = a; + a.addClass("entryListSettingWorkspace"); + this.listView_.appendChild(a); + a.addClass("entryRemove"); + var d = Entry.createElement("div"); + d.addClass("entryListSettingVisibleWrapperWorkspace"); + d.bindOnClick(function(a) { + a = b.selectedList; + var c = b.listSettingView.visibleCheck; + a.setVisible(!a.isVisible()); + a.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); }); - b.appendChild(c); - var d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.show_list_workspace; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryListSettingCheckWorkspace"); - b.visibleCheck = d; - c.appendChild(d); - d = Entry.createElement("div"); - d.addClass("entryListSettingLengthWrapperWorkspace"); + a.appendChild(d); + var c = Entry.createElement("span"); + c.innerHTML = Lang.Workspace.show_list_workspace; + d.appendChild(c); c = Entry.createElement("span"); - c.addClass("entryListSettingLengthSpanWorkspace"); - c.innerHTML = Lang.Workspace.number_of_list; + c.addClass("entryListSettingCheckWorkspace"); + a.visibleCheck = c; d.appendChild(c); - b.appendChild(d); c = Entry.createElement("div"); - c.addClass("entryListSettingLengthControllerWorkspace"); - d.appendChild(c); + c.addClass("entryListSettingLengthWrapperWorkspace"); d = Entry.createElement("span"); - d.addClass("entryListSettingMinusWorkspace"); - d.bindOnClick(function(b) { - a.selectedList.array_.pop(); - a.updateListSettingView(a.selectedList); - }); + d.addClass("entryListSettingLengthSpanWorkspace"); + d.innerHTML = Lang.Workspace.number_of_list; + c.appendChild(d); + a.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryListSettingLengthControllerWorkspace"); c.appendChild(d); - d = Entry.createElement("input"); - d.addClass("entryListSettingLengthInputWorkspace"); - d.onblur = function() { - a.setListLength(this.value); + c = Entry.createElement("span"); + c.addClass("entryListSettingMinusWorkspace"); + c.bindOnClick(function(a) { + b.selectedList.array_.pop(); + b.updateListSettingView(b.selectedList); + }); + d.appendChild(c); + c = Entry.createElement("input"); + c.addClass("entryListSettingLengthInputWorkspace"); + c.onblur = function() { + b.setListLength(this.value); }; - d.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + c.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; - b.lengthInput = d; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryListSettingPlusWorkspace"); - d.bindOnClick(function(b) { - a.selectedList.array_.push({data:0}); - a.updateListSettingView(a.selectedList); + a.lengthInput = c; + d.appendChild(c); + c = Entry.createElement("span"); + c.addClass("entryListSettingPlusWorkspace"); + c.bindOnClick(function(a) { + b.selectedList.array_.push({data:0}); + b.updateListSettingView(b.selectedList); }); - c.appendChild(d); - c = Entry.createElement("div"); - b.seperator = c; - b.appendChild(c); - c.addClass("entryListSettingSeperatorWorkspace"); - c = Entry.createElement("div"); - c.addClass("entryListSettingListValuesWorkspace"); - b.listValues = c; - b.appendChild(c); + d.appendChild(c); + d = Entry.createElement("div"); + a.seperator = d; + a.appendChild(d); + d.addClass("entryListSettingSeperatorWorkspace"); + d = Entry.createElement("div"); + d.addClass("entryListSettingListValuesWorkspace"); + a.listValues = d; + a.appendChild(d); }; -Entry.VariableContainer.prototype.updateListSettingView = function(a) { - var b = this; - a = a || this.selectedList; - var c = this.listSettingView, d = c.listValues, e = c.visibleCheck, f = c.lengthInput, g = c.seperator; +Entry.VariableContainer.prototype.updateListSettingView = function(b) { + var a = this; + b = b || this.selectedList; + var d = this.listSettingView, c = d.listValues, e = d.visibleCheck, f = d.lengthInput, g = d.seperator; e.removeClass("entryListSettingCheckedWorkspace"); - a.isVisible() && e.addClass("entryListSettingCheckedWorkspace"); - f.value = a.array_.length; - for (a.listElement.appendChild(c);d.firstChild;) { - d.removeChild(d.firstChild); + b.isVisible() && e.addClass("entryListSettingCheckedWorkspace"); + f.value = b.array_.length; + for (b.listElement.appendChild(d);c.firstChild;) { + c.removeChild(c.firstChild); } - var h = a.array_; + var h = b.array_; 0 === h.length ? g.addClass("entryRemove") : g.removeClass("entryRemove"); for (e = 0;e < h.length;e++) { - (function(c) { + (function(d) { var e = Entry.createElement("div"); e.addClass("entryListSettingValueWrapperWorkspace"); var f = Entry.createElement("span"); f.addClass("entryListSettingValueNumberSpanWorkspace"); - f.innerHTML = c + 1; + f.innerHTML = d + 1; e.appendChild(f); f = Entry.createElement("input"); - f.value = h[c].data; + f.value = h[d].data; f.onblur = function() { - h[c].data = this.value; - a.updateView(); + h[d].data = this.value; + b.updateView(); }; - f.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + f.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; f.addClass("entryListSettingEachInputWorkspace"); e.appendChild(f); f = Entry.createElement("span"); f.bindOnClick(function() { - h.splice(c, 1); - b.updateListSettingView(); + h.splice(d, 1); + a.updateListSettingView(); }); f.addClass("entryListSettingValueRemoveWorkspace"); e.appendChild(f); - d.appendChild(e); + c.appendChild(e); })(e); } - a.updateView(); - c.removeClass("entryRemove"); + b.updateView(); + d.removeClass("entryRemove"); }; -Entry.VariableContainer.prototype.setListLength = function(a) { - a = Number(a); - var b = this.selectedList.array_; - if (!isNaN(a)) { - var c = b.length; - if (c < a) { - for (a -= c, c = 0;c < a;c++) { - b.push({data:0}); +Entry.VariableContainer.prototype.setListLength = function(b) { + b = +b; + var a = this.selectedList.array_; + if (!isNaN(b)) { + var d = a.length; + if (d < b) { + for (b -= d, d = 0;d < b;d++) { + a.push({data:0}); } } else { - c > a && (b.length = a); + d > b && (a.length = b); } } this.updateListSettingView(); }; Entry.VariableContainer.prototype.updateViews = function() { - var a = this.lists_; - this.variables_.map(function(b) { - b.updateView(); + var b = this.lists_; + this.variables_.map(function(a) { + a.updateView(); }); - a.map(function(b) { - b.updateView(); + b.map(function(a) { + a.updateView(); }); }; -Entry.VariableContainer.prototype.updateSelectedVariable = function(a, b) { - a ? "variable" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "slide" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "list" == a.type && (this.selectedList = a, this.updateListSettingView(a)) : (this.selectedVariable = null, "variable" == (b || "variable") ? this.variableSettingView.addClass("entryRemove") : this.listSettingView.addClass("entryRemove")); +Entry.VariableContainer.prototype.updateSelectedVariable = function(b, a) { + b ? "variable" == b.type ? (this.selectedVariable = b, this.updateVariableSettingView(b)) : "slide" == b.type ? (this.selectedVariable = b, this.updateVariableSettingView(b)) : "list" == b.type && (this.selectedList = b, this.updateListSettingView(b)) : (this.selectedVariable = null, "variable" == (a || "variable") ? this.variableSettingView.addClass("entryRemove") : this.listSettingView.addClass("entryRemove")); }; -Entry.VariableContainer.prototype.removeLocalVariables = function(a) { - var b = [], c = this; - this.mapVariable(function(a, c) { - a.object_ && a.object_ == c && b.push(a); - }, a); - b.map(function(b) { - c.removeVariable(b); +Entry.VariableContainer.prototype.removeLocalVariables = function(b) { + var a = [], d = this; + this.mapVariable(function(b, d) { + b.object_ && b.object_ == d && a.push(b); + }, b); + a.map(function(a) { + d.removeVariable(a); }); }; Entry.VariableContainer.prototype.updateCloudVariables = function() { - var a = Entry.projectId; - if (Entry.cloudSavable && a) { - var b = Entry.variableContainer, a = b.variables_.filter(function(b) { - return b.isCloud_; - }), a = a.map(function(b) { - return b.toJSON(); - }), b = b.lists_.filter(function(b) { - return b.isCloud_; - }), b = b.map(function(b) { - return b.toJSON(); + var b = Entry.projectId; + if (Entry.cloudSavable && b) { + var a = Entry.variableContainer, b = a.variables_.filter(function(a) { + return a.isCloud_; + }), b = b.map(function(a) { + return a.toJSON(); + }), a = a.lists_.filter(function(a) { + return a.isCloud_; + }), a = a.map(function(a) { + return a.toJSON(); }); - $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:a, lists:b}}).done(function() { + $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:b, lists:a}}).done(function() { }); } }; -Entry.VariableContainer.prototype.addRef = function(a, b) { +Entry.VariableContainer.prototype.addRef = function(b, a) { if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - var c = {object:b.getCode().object, block:b}; - b.funcBlock && (c.funcBlock = b.funcBlock, delete b.funcBlock); - this[a].push(c); - if ("_functionRefs" == a) { - a = b.type.substr(5); - for (var d = Entry.variableContainer.functions_[a].content.getBlockList(), e = 0;e < d.length;e++) { - b = d[e]; - var f = b.events; - -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (f && f.viewAdd && f.viewAdd.forEach(function(a) { - b.getCode().object = c.object; - a && (b.funcBlock = c.block, a(b)); - }), f && f.dataAdd && f.dataAdd.forEach(function(a) { - b.getCode().object = c.object; - a && (b.funcBlock = c.block, a(b)); + var d = {object:a.getCode().object, block:a}; + a.funcBlock && (d.funcBlock = a.funcBlock, delete a.funcBlock); + this[b].push(d); + if ("_functionRefs" == b) { + for (var c = a.type.substr(5), e = Entry.variableContainer.functions_[c].content.getBlockList(), f = 0;f < e.length;f++) { + a = e[f]; + var g = a.events; + -1 < a.type.indexOf("func_") && a.type.substr(5) == c || (g && g.viewAdd && g.viewAdd.forEach(function(b) { + a.getCode().object = d.object; + b && (a.funcBlock = d.block, b(a)); + }), g && g.dataAdd && g.dataAdd.forEach(function(b) { + a.getCode().object = d.object; + b && (a.funcBlock = d.block, b(a)); })); } } - return c; + return d; } }; -Entry.VariableContainer.prototype.removeRef = function(a, b) { +Entry.VariableContainer.prototype.removeRef = function(b, a) { if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - for (var c = this[a], d = 0;d < c.length;d++) { - if (c[d].block == b) { - c.splice(d, 1); + for (var d = this[b], c = 0;c < d.length;c++) { + if (d[c].block == a) { + d.splice(c, 1); break; } } - if ("_functionRefs" == a && (a = b.type.substr(5), d = Entry.variableContainer.functions_[a])) { - for (c = d.content.getBlockList(), d = 0;d < c.length;d++) { - b = c[d]; - var e = b.events; - -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (e && e.viewDestroy && e.viewDestroy.forEach(function(a) { - a && a(b); - }), e && e.dataDestroy && e.dataDestroy.forEach(function(a) { - a && a(b); + if ("_functionRefs" == b && (d = a.type.substr(5), c = Entry.variableContainer.functions_[d])) { + for (var e = c.content.getBlockList(), c = 0;c < e.length;c++) { + a = e[c]; + var f = a.events; + -1 < a.type.indexOf("func_") && a.type.substr(5) == d || (f && f.viewDestroy && f.viewDestroy.forEach(function(b) { + b && b(a); + }), f && f.dataDestroy && f.dataDestroy.forEach(function(b) { + b && b(a); })); } } @@ -21138,10 +19957,10 @@ Entry.VariableContainer.prototype.removeRef = function(a, b) { Entry.VariableContainer.prototype._getBlockMenu = function() { return Entry.playground.mainWorkspace.getBlockMenu(); }; -Entry.VariableContainer.prototype._truncName = function(a, b) { - a = a.substring(0, this._maxNameLength); - Entry.toast.warning(Lang.Workspace[b + "_name_auto_edited_title"], Lang.Workspace[b + "_name_auto_edited_content"]); - return a; +Entry.VariableContainer.prototype._truncName = function(b, a) { + b = b.substring(0, this._maxNameLength); + Entry.toast.warning(Lang.Workspace[a + "_name_auto_edited_title"], Lang.Workspace[a + "_name_auto_edited_content"]); + return b; }; Entry.VariableContainer.prototype._maxNameLength = 10; Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basic block"], func:function() { @@ -21149,9 +19968,9 @@ Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basi Entry.block.mutant = {skeleton:"basic", event:"start", color:"#3BBD70", template:"test mutant block", params:[], func:function() { }, changeEvent:new Entry.Event}; Entry.block.jr_start = {skeleton:"pebble_event", event:"start", color:"#3BBD70", template:"%1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_play_image.png", highlightColor:"#3BBD70", position:{x:0, y:0}, size:22}], func:function() { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; - for (b in a) { - this._unit = a[b]; + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; + for (a in b) { + this._unit = b[a]; } Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); }}; @@ -21161,14 +19980,13 @@ Entry.block.jr_repeat = {skeleton:"pebble_loop", color:"#127CDB", template:"%1 \ } if (0 < this.repeatCount) { this.repeatCount--; - var a = this.block.statements[0]; - if (0 === a.getBlocks().length) { - return; + var b = this.block.statements[0]; + if (0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; } - this.executor.stepInto(a); - return Entry.STATIC.CONTINUE; + } else { + delete this.repeatCount; } - delete this.repeatCount; }}; Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf43 \ubaa8\uc73c\uae30 %1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_item_image.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { if (this.isContinue) { @@ -21179,10 +19997,10 @@ Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf4 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this; + var b = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { Ntry.dispatchEvent("getItem"); - a.isAction = !1; + b.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -21196,10 +20014,10 @@ Entry.block.cparty_jr_item = {skeleton:"pebble_basic", color:"#8ABC1D", template delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this; + var b = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { Ntry.dispatchEvent("getItem"); - a.isAction = !1; + b.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -21213,32 +20031,32 @@ Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, c = function() { + var b = Ntry.STATIC, a = this, d = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; + a.isAction = !1; }); }, 3); - }, d; + }, c; switch(Ntry.unitComp.direction) { case Ntry.STATIC.EAST: - d = a.TURN_LEFT; + c = b.TURN_LEFT; break; case Ntry.STATIC.SOUTH: - d = a.HALF_ROTATION; + c = b.HALF_ROTATION; break; case Ntry.STATIC.WEST: - d = a.TURN_RIGHT; + c = b.TURN_RIGHT; break; default: - c(); + d(); } - d && Ntry.dispatchEvent("unitAction", d, c); + c && Ntry.dispatchEvent("unitAction", c, d); return Entry.STATIC.CONTINUE; } }}; Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_right}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_right_image.png", position:{x:83, y:0}, size:22}], func:function() { - var a = Ntry.STATIC; + var b = Ntry.STATIC; if (this.isContinue) { if (this.isAction) { return Entry.STATIC.CONTINUE; @@ -21247,27 +20065,27 @@ Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this, c = function() { + var a = this, d = function() { window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", a.WALK, function() { - b.isAction = !1; + Ntry.dispatchEvent("unitAction", b.WALK, function() { + a.isAction = !1; }); }, 3); - }, d; + }, c; switch(Ntry.unitComp.direction) { - case a.SOUTH: - d = a.TURN_LEFT; + case b.SOUTH: + c = b.TURN_LEFT; break; - case a.WEST: - d = a.HALF_ROTATION; + case b.WEST: + c = b.HALF_ROTATION; break; - case a.NORTH: - d = a.TURN_RIGHT; + case b.NORTH: + c = b.TURN_RIGHT; break; default: - c(); + d(); } - d && Ntry.dispatchEvent("unitAction", d, c); + c && Ntry.dispatchEvent("unitAction", c, d); return Entry.STATIC.CONTINUE; } }}; @@ -21280,27 +20098,27 @@ Entry.block.jr_south = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, c = function() { + var b = Ntry.STATIC, a = this, d = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; + a.isAction = !1; }); }, 3); - }, d; + }, c; switch(Ntry.unitComp.direction) { - case a.EAST: - d = a.TURN_RIGHT; + case b.EAST: + c = b.TURN_RIGHT; break; - case a.NORTH: - d = a.HALF_ROTATION; + case b.NORTH: + c = b.HALF_ROTATION; break; - case a.WEST: - d = a.TURN_LEFT; + case b.WEST: + c = b.TURN_LEFT; break; default: - c(); + d(); } - d && Ntry.dispatchEvent("unitAction", d, c); + c && Ntry.dispatchEvent("unitAction", c, d); return Entry.STATIC.CONTINUE; } }}; @@ -21313,34 +20131,34 @@ Entry.block.jr_west = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = Ntry.STATIC, b = this, c = function() { + var b = Ntry.STATIC, a = this, d = function() { window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", a.WALK, function() { - b.isAction = !1; + Ntry.dispatchEvent("unitAction", b.WALK, function() { + a.isAction = !1; }); }, 3); - }, d; + }, c; switch(Ntry.unitComp.direction) { - case a.SOUTH: - d = a.TURN_RIGHT; + case b.SOUTH: + c = b.TURN_RIGHT; break; - case a.EAST: - d = a.HALF_ROTATION; + case b.EAST: + c = b.HALF_ROTATION; break; - case a.NORTH: - d = a.TURN_LEFT; + case b.NORTH: + c = b.TURN_LEFT; break; default: - c(); + d(); } - d && Ntry.dispatchEvent("unitAction", d, c); + c && Ntry.dispatchEvent("unitAction", c, d); return Entry.STATIC.CONTINUE; } }}; Entry.block.jr_start_basic = {skeleton:"basic_event", event:"start", color:"#3BBD70", template:"%1 %2", params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}, Lang.Menus.maze_when_run], func:function() { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; - for (b in a) { - this._unit = a[b]; + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; + for (a in b) { + this._unit = b[a]; } Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); }}; @@ -21353,9 +20171,9 @@ Entry.block.jr_go_straight = {skeleton:"basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this; + var b = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; + b.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -21369,9 +20187,9 @@ Entry.block.jr_turn_left = {skeleton:"basic", color:"#A751E3", template:"%1 %2", delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this; + var b = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - a.isAction = !1; + b.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -21385,9 +20203,9 @@ Entry.block.jr_turn_right = {skeleton:"basic", color:"#A751E3", template:"%1 %2" delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this; + var b = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - a.isAction = !1; + b.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -21397,2306 +20215,3005 @@ Entry.block.jr_go_slow = {skeleton:"basic", color:"#f46c6c", template:"%1 %2", p if (this.isAction) { return Entry.STATIC.CONTINUE; } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var a = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.GO_SLOW, function() { - a.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", syntax:["BasicWhile", "true"], params:[Lang.Menus.repeat_until_reach_2, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_goal_image.png", size:18}, Lang.Menus.repeat_until_reach_1, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var a = this.block.statements[0]; - if (0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; - } -}}; -Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; - for (c in a) { - b = a[c]; + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.GO_SLOW, function() { + b.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", syntax:["BasicWhile", "true"], params:[Lang.Menus.repeat_until_reach_2, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_goal_image.png", size:18}, Lang.Menus.repeat_until_reach_1, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var b = this.block.statements[0]; + if (0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); + this.isContinue = !0; + b = this.block.statements[0]; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); + this.isContinue = !0; + b = this.block.statements[0]; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_step_start = {skeleton:"basic_event", mode:"maze", event:"start", color:"#3BBD70", template:"%1 \uc2dc\uc791\ud558\uae30\ub97c \ud074\ub9ad\ud588\uc744 \ub54c", syntax:["Program"], params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}], func:function() { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; + for (a in b) { + this._unit = b[a]; + } + Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); +}}; +Entry.block.maze_step_jump = {skeleton:"basic", mode:"maze", color:"#FF6E4B", template:"\ub6f0\uc5b4\ub118\uae30%1", params:[{type:"Image", img:"/img/assets/week/blocks/jump.png", size:24}], syntax:["Scope", "jump"], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.JUMP, function() { + b.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ubc88 \ubc18\ubcf5\ud558\uae30%2", syntax:["BasicIteration"], params:[{type:"Dropdown", key:"REPEAT", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (void 0 === this.repeatCount) { + return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; + } + if (0 < this.repeatCount) { + this.repeatCount--; + var b = this.block.statements[0]; + if (0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } else { + delete this.repeatCount; + } +}}; +Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { +}}; +Entry.block.maze_repeat_until_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var b = this.block.statements[0]; + if (0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ubaa8\ub4e0 %1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var b = this.block.statements[0]; + if (0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + d = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}); + b = this.block.statements[0]; + if (0 === d.length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + this.isContinue = !0; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); + this.isContinue = !0; + b = this.block.statements[0]; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242", template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1", syntax:["Scope", "promise"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], func:function() { + if (!this.funcExecutor) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), a; + for (a in b) { + this.funcExecutor = new Entry.Executor(b[a].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); + } + } + this.funcExecutor.execute(); + if (null !== this.funcExecutor.scope.block) { + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(b) { + if (!this.executed && (b = this.block.statements[0], 0 !== b.getBlocks().length)) { + return this.executor.stepInto(b), this.executed = !0, Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); + this.isContinue = !0; + b = this.block.statements[0]; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, d; + for (d in b) { + a = b[d]; + } + b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); + a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); + a = {x:a.x, y:a.y}; + Ntry.addVectorByDirection(a, b.direction, 1); + a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + this.isContinue = !0; + b = this.block.statements[0]; + if (0 !== a.length && 0 !== b.getBlocks().length) { + return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_step_move_step = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc55e\uc73c\ub85c \ud55c \uce78 \uc774\ub3d9%1", syntax:["Scope", "move"], params:[{type:"Image", img:"/img/assets/week/blocks/moveStep.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { + b.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_rotate_left = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc67c\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "left"], params:[{type:"Image", img:"/img/assets/week/blocks/turnL.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { + b.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_rotate_right = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc624\ub978\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "right"], params:[{type:"Image", img:"/img/assets/week/blocks/turnR.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { + b.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", template:"%1 this is test block %2", params:[{type:"Block", accept:"basic_boolean_field", value:[{type:"test", params:[30, 50]}]}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { +}}; +Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { +}}; +Entry.BlockMenu = function(b, a, d, c) { + Entry.Model(this, !1); + this._align = a || "CENTER"; + this.setAlign(this._align); + this._scroll = void 0 !== c ? c : !1; + this._bannedClass = []; + this._categories = []; + this.suffix = "blockMenu"; + b = "string" === typeof b ? $("#" + b) : $(b); + if ("DIV" !== b.prop("tagName")) { + return console.error("Dom is not div element"); + } + this.view = b; + this.visible = !0; + this._svgId = "blockMenu" + (new Date).getTime(); + this._clearCategory(); + this._categoryData = d; + this._generateView(d); + this._splitters = []; + this.setWidth(); + this.svg = Entry.SVG(this._svgId); + Entry.Utils.addFilters(this.svg, this.suffix); + a = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = a.rect; + this.pattern = a.pattern; + this.svgGroup = this.svg.elem("g"); + this.svgThreadGroup = this.svgGroup.elem("g"); + this.svgThreadGroup.board = this; + this.svgBlockGroup = this.svgGroup.elem("g"); + this.svgBlockGroup.board = this; + this.changeEvent = new Entry.Event(this); + d && this._generateCategoryCodes(d); + this.observe(this, "_handleDragBlock", ["dragBlock"]); + this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(b)); + Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); + this._categoryCodes && Entry.keyPressed && Entry.keyPressed.attach(this, this._captureKeyEvent); + Entry.windowResized && (b = _.debounce(this.updateOffset, 200), Entry.windowResized.attach(this, b)); +}; +(function(b) { + b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; + b._generateView = function(a) { + var b = this.view, c = this; + a && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:b}), this._generateCategoryView(a)); + this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:b}); + this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); + this.svgDom.mouseenter(function(a) { + c._scroller && c._scroller.setOpacity(1); + a = c.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = c.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); + }); + this.svgDom.mouseleave(function(a) { + Entry.playground && !Entry.playground.resizing && (c._scroller && c._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + }); + $(window).scroll(function() { + c.updateOffset(); + }); + }; + b.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { + return console.error("You must inject code instance"); + } + this.codeListener && this.code.changeEvent.detach(this.codeListener); + var b = this; + this.set({code:a}); + this.codeListener = this.code.changeEvent.attach(this, function() { + b.changeEvent.notify(); + }); + a.createView(this); + this.workspace.getMode(); + this.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD ? a.mode && "code" !== a.mode || this.renderText() : "text" === a.mode && this.renderBlock(); + this.align(); + }; + b.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); + this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); + }; + b.align = function(a) { + var b = this.code; + if (b) { + this._clearSplitters(); + b.view && !a && b.view.reDraw(); + a = b.getThreads(); + for (var b = 10, c = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { + var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(b), b += 15), e = h, h = c - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), b -= k.offsetY, k._moveTo(h, b, !1), b += k.height + 15); + } + this.updateSplitters(); + this.changeEvent.notify(); + } + }; + b.cloneToGlobal = function(a) { + if (!this._boardBlockView && null !== this.dragBlock) { + var b = this.workspace, c = b.getMode(), e = this.dragBlock, f = this._svgWidth, g = b.selectedBoard; + if (!g || c != Entry.Workspace.MODE_BOARD && c != Entry.Workspace.MODE_OVERLAYBOARD) { + Entry.GlobalSvg.setView(e, b.getMode()) && Entry.GlobalSvg.addControl(a); + } else { + if (g.code && (b = e.block, c = b.getThread(), b && c)) { + b = c.toJSON(!0); + this._boardBlockView = Entry.do("addThread", b).value.getFirstBlock().view; + var g = this.offset().top - g.offset().top, h, k; + if (b = this.dragBlock.mouseDownCoordinate) { + h = a.pageX - b.x, k = a.pageY - b.y; + } + this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); + this._boardBlockView.onMouseDown.call(this._boardBlockView, a); + this._boardBlockView.dragInstance.set({isNew:!0}); + } + } + } + }; + b.terminateDrag = function() { + if (this._boardBlockView) { + var a = this._boardBlockView; + if (a) { + this.workspace.getBoard(); + this._boardBlockView = null; + var b = Entry.GlobalSvg.left, c = Entry.GlobalSvg.width / 2, a = a.getBoard().offset().left; + return b < a - c; + } + } + }; + b.getCode = function(a) { + return this._code; + }; + b.setSelectedBlock = function(a) { + var b = this.selectedBlockView; + b && b.removeSelected(); + a instanceof Entry.BlockView ? a.addSelected() : a = null; + this.set({selectedBlockView:a}); + }; + b.hide = function() { + this.view.addClass("entryRemove"); + }; + b.show = function() { + this.view.removeClass("entryRemove"); + }; + b.renderText = function(a) { + var b = this.code.getThreads(); + this.code.mode = "text"; + for (var c = 0;c < b.length;c++) { + b[c].view.renderText(); + } + a && a(); + }; + b.renderBlock = function(a) { + var b = this.code.getThreads(); + this.code.mode = "code"; + for (var c = 0;c < b.length;c++) { + b[c].view.renderBlock(); } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); - this.isContinue = !0; - a = this.block.statements[0]; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + a && a(); + }; + b._createSplitter = function(a) { + a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); + this._splitters.push(a); + }; + b.updateSplitters = function(a) { + a = void 0 === a ? 0 : a; + var b = this._svgWidth - 20, c; + this._splitters.forEach(function(e) { + c = parseFloat(e.getAttribute("y1")) + a; + e.attr({x2:b, y1:c, y2:c}); + }); + }; + b._clearSplitters = function() { + for (var a = this._splitters, b = a.length - 1;0 <= b;b--) { + a[b].remove(), a.pop(); } - } -}}; -Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + }; + b.setWidth = function() { + this._svgWidth = this.blockMenuContainer.width(); + this.updateSplitters(); + }; + b.setMenu = function() { + var a = this._categoryCodes, b = this._categoryElems, c; for (c in a) { - b = a[c]; + for (var e = a[c], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { + var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; + this.checkBanClass(Entry.block[h]) && f--; + } + 0 === f ? b[c].addClass("entryRemove") : b[c].removeClass("entryRemove"); } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); - this.isContinue = !0; - a = this.block.statements[0]; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + }; + b.getCategoryCodes = function(a) { + a = this._convertSelector(a); + var b = this._categoryCodes[a]; + b || (this._generateCategoryElement(a), b = []); + b instanceof Entry.Code || (b = this._categoryCodes[a] = new Entry.Code(b)); + return b; + }; + b._convertSelector = function(a) { + if (isNaN(a)) { + return a; } - } -}}; -Entry.block.maze_step_start = {skeleton:"basic_event", mode:"maze", event:"start", color:"#3BBD70", template:"%1 \uc2dc\uc791\ud558\uae30\ub97c \ud074\ub9ad\ud588\uc744 \ub54c", syntax:["Program"], params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}], func:function() { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; - for (b in a) { - this._unit = a[b]; - } - Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); -}}; -Entry.block.maze_step_jump = {skeleton:"basic", mode:"maze", color:"#FF6E4B", template:"\ub6f0\uc5b4\ub118\uae30%1", params:[{type:"Image", img:"/img/assets/week/blocks/jump.png", size:24}], syntax:["Scope", "jump"], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + a = +a; + for (var b = this._categories, c = this._categoryElems, e = 0;e < b.length;e++) { + var f = b[e]; + if (!c[f].hasClass("entryRemove") && 0 === a--) { + return f; + } } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var a = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.JUMP, function() { - a.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ubc88 \ubc18\ubcf5\ud558\uae30%2", syntax:["BasicIteration"], params:[{type:"Dropdown", key:"REPEAT", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (void 0 === this.repeatCount) { - return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; - } - if (0 < this.repeatCount) { - this.repeatCount--; - var a = this.block.statements[0]; - if (0 === a.getBlocks().length) { - return; + }; + b.selectMenu = function(a, b) { + var c = this._convertSelector(a); + if (c) { + switch(c) { + case "variable": + Entry.playground.checkVariables(); + break; + case "arduino": + this._generateHwCode(); + } + var e = this._categoryElems[c], f = this._selectedCategoryView, g = !1, h = this.workspace.board, k = h.view; + f && f.removeClass("entrySelectedCategory"); + e != f || b ? f || (this.visible || (g = !0, k.addClass("foldOut"), Entry.playground.showTabs()), k.removeClass("folding"), this.visible = !0) : (k.addClass("folding"), this._selectedCategoryView = null, e.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), g = !0, this.visible = !1); + g && Entry.bindAnimationCallbackOnce(k, function() { + h.scroller.resizeScrollBar.call(h.scroller); + k.removeClass("foldOut"); + Entry.windowResized.notify(); + }); + this.visible && (f = this._categoryCodes[c], this._selectedCategoryView = e, e.addClass("entrySelectedCategory"), f.constructor !== Entry.Code && (f = this._categoryCodes[c] = new Entry.Code(f)), this.changeCode(f)); + this.lastSelector = c; + } else { + this.align(); } - this.executor.stepInto(a); - return Entry.STATIC.CONTINUE; - } - delete this.repeatCount; -}}; -Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { -}}; -Entry.block.maze_repeat_until_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var a = this.block.statements[0]; - if (0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ubaa8\ub4e0 %1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var a = this.block.statements[0]; - if (0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; - for (c in a) { - b = a[c]; - } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}); - a = this.block.statements[0]; - if (0 === c.length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; - } - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); - this.isContinue = !0; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + }; + b._generateCategoryCodes = function(a) { + this._categoryCodes = {}; + for (var b = 0;b < a.length;b++) { + var c = a[b], e = []; + c.blocks.forEach(function(a) { + var b = Entry.block[a]; + if (b && b.def) { + if (b.defs) { + for (a = 0;a < b.defs.length;a++) { + e.push([b.defs[a]]); + } + } else { + e.push([b.def]); + } + } else { + e.push([{type:a}]); + } + }); + c = c.category; + this._categories.push(c); + this._categoryCodes[c] = e; } - } -}}; -Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; - for (c in a) { - b = a[c]; + }; + b.banClass = function(a, b) { + 0 > this._bannedClass.indexOf(a) && this._bannedClass.push(a); + this.align(b); + }; + b.unbanClass = function(a, b) { + var c = this._bannedClass.indexOf(a); + -1 < c && this._bannedClass.splice(c, 1); + this.align(b); + }; + b.checkBanClass = function(a) { + if (a) { + a = a.isNotFor; + for (var b in this._bannedClass) { + if (a && -1 < a.indexOf(this._bannedClass[b])) { + return !0; + } + } + return !1; } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); - this.isContinue = !0; - a = this.block.statements[0]; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + }; + b._addControl = function(a) { + var b = this; + a.on("wheel", function() { + b._mouseWheel.apply(b, arguments); + }); + b._scroller && $(this.svg).bind("mousedown touchstart", function(a) { + b.onMouseDown.apply(b, arguments); + }); + }; + b.onMouseDown = function(a) { + function b(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = Entry.Utils.convertMouseEvent(a); + var c = e.dragInstance; + e._scroller.scroll(-a.pageY + c.offsetY); + c.set({offsetY:a.pageY}); + } + function c(a) { + $(document).unbind(".blockMenu"); + delete e.dragInstance; } - } -}}; -Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242", template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1", syntax:["Scope", "promise"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], func:function() { - if (!this.funcExecutor) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), b; + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + var e = this; + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + a = Entry.Utils.convertMouseEvent(a); + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var f = $(document); + f.bind("mousemove.blockMenu", b); + f.bind("mouseup.blockMenu", c); + f.bind("touchmove.blockMenu", b); + f.bind("touchend.blockMenu", c); + this.dragInstance = new Entry.DragInstance({startY:a.pageY, offsetY:a.pageY}); + } + }; + b._mouseWheel = function(a) { + a = a.originalEvent; + a.preventDefault(); + var b = Entry.disposeEvent; + b && b.notify(a); + this._scroller.scroll(-a.wheelDeltaY || a.deltaY / 3); + }; + b.dominate = function(a) { + this.svgBlockGroup.appendChild(a.view.svgGroup); + }; + b.reDraw = function() { + this.selectMenu(this.lastSelector, !0); + }; + b._handleDragBlock = function() { + this._boardBlockView = null; + this._scroller && this._scroller.setOpacity(0); + }; + b._captureKeyEvent = function(a) { + var b = a.keyCode, c = Entry.type; + a.ctrlKey && "workspace" == c && 48 < b && 58 > b && (a.preventDefault(), this.selectMenu(b - 49)); + }; + b.setPatternRectFill = function(a) { + this.patternRect.attr({fill:a}); + this.pattern.attr({style:""}); + }; + b.disablePattern = function() { + this.pattern.attr({style:"display: none"}); + }; + b._clearCategory = function() { + this._selectedCategoryView = null; + this._categories = []; + var a = this._categoryElems, b; for (b in a) { - this.funcExecutor = new Entry.Executor(a[b].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); + a[b].remove(); } - } - this.funcExecutor.execute(); - if (null !== this.funcExecutor.scope.block) { - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(a) { - if (!this.executed && (a = this.block.statements[0], 0 !== a.getBlocks().length)) { - return this.executor.stepInto(a), this.executed = !0, Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; - for (c in a) { - b = a[c]; + this._categoryElems = {}; + a = this._categoryCodes; + for (b in a) { + var c = a[b]; + c.constructor == Entry.Code && c.clear(); } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); - this.isContinue = !0; - a = this.block.statements[0]; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + this._categoryCodes = null; + }; + b.setCategoryData = function(a) { + this._clearCategory(); + this._categoryData = a; + this._generateCategoryView(a); + this._generateCategoryCodes(a); + }; + b._generateCategoryView = function(a) { + if (a) { + for (var b = 0;b < a.length;b++) { + this._generateCategoryElement(a[b].category); + } } - } -}}; -Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; - for (c in a) { - b = a[c]; + }; + b._generateCategoryElement = function(a) { + var b = this; + (function(a, e) { + a.text(Lang.Blocks[e.toUpperCase()]); + b._categoryElems[e] = a; + a.bindOnClick(function(a) { + b.selectMenu(e); + }); + })(Entry.Dom("li", {id:"entryCategory" + a, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), a); + }; + b.updateOffset = function() { + this._offset = this.svgDom.offset(); + }; + b.offset = function() { + (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); + return this._offset; + }; + b._generateHwCode = function() { + var a = this._categoryCodes.arduino; + a instanceof Entry.Code && a.clear(); + for (var b = this._categoryData, c, a = b.length - 1;0 <= a;a--) { + if ("arduino" === b[a].category) { + c = b[a].blocks; + break; + } } - a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); - b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); - b = {x:b.x, y:b.y}; - Ntry.addVectorByDirection(b, a.direction, 1); - b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); - this.isContinue = !0; - a = this.block.statements[0]; - if (0 !== b.length && 0 !== a.getBlocks().length) { - return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + b = []; + for (a = 0;a < c.length;a++) { + var e = c[a], f = Entry.block[e]; + if (!this.checkBanClass(f)) { + if (f && f.def) { + if (f.defs) { + for (a = 0;a < f.defs.length;a++) { + b.push([f.defs[a]]); + } + } else { + b.push([f.def]); + } + } else { + b.push([{type:e}]); + } + } } - } -}}; -Entry.block.maze_step_move_step = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc55e\uc73c\ub85c \ud55c \uce78 \uc774\ub3d9%1", syntax:["Scope", "move"], params:[{type:"Image", img:"/img/assets/week/blocks/moveStep.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + this._categoryCodes.arduino = b; + }; + b.setAlign = function(a) { + this._align = a || "CENTER"; + }; +})(Entry.BlockMenu.prototype); +Entry.BlockMenuScroller = function(b) { + var a = this; + this.board = b; + this.board.changeEvent.attach(this, this._reset); + this.svgGroup = null; + this.vRatio = this.vY = this.vWidth = this.hX = 0; + this._visible = !0; + this._opacity = -1; + this.mouseHandler = function() { + a.onMouseDown.apply(a, arguments); + }; + this.createScrollBar(); + this.setOpacity(0); + this._addControl(); + Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); +}; +Entry.BlockMenuScroller.RADIUS = 7; +(function(b) { + b.createScrollBar = function() { + this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); + this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); + this.resizeScrollBar(); + }; + b.resizeScrollBar = function() { + this._updateRatio(); + if (this._visible && 0 !== this.vRatio) { + var a = this.board.blockMenuContainer; + this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var a = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_rotate_left = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc67c\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "left"], params:[{type:"Image", img:"/img/assets/week/blocks/turnL.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + }; + b.updateScrollBar = function(a) { + this.vY += a; + this.vScrollbar.attr({y:this.vY}); + }; + b.scroll = function(a) { + this.isVisible() && (a = this._adjustValue(a) - this.vY, 0 !== a && (this.board.code.moveBy(0, -a * this.vRatio), this.updateScrollBar(a))); + }; + b._adjustValue = function(a) { + var b = this.board.svgDom.height(), b = b - b / this.vRatio; + a = this.vY + a; + a = Math.max(0, a); + return a = Math.min(b, a); + }; + b.setVisible = function(a) { + a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); + }; + b.setOpacity = function(a) { + this._opacity != a && (this.vScrollbar.attr({opacity:a}), this._opacity = a); + }; + b.isVisible = function() { + return this._visible; + }; + b._updateRatio = function() { + var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), c = a.blockMenuContainer.height(), a = a.offset(); + this.vRatio = b = (b.height + (b.top - a.top) + 10) / c; + 1 >= b ? this.setVisible(!1) : this.setVisible(!0); + }; + b._reset = function() { + this.vY = 0; + this.vScrollbar.attr({y:this.vY}); + this.resizeScrollBar(); + }; + b.onMouseDown = function(a) { + function b(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var c = e.dragInstance; + e.scroll(a.pageY - c.offsetY); + c.set({offsetY:a.pageY}); + } + function c(a) { + $(document).unbind(".scroll"); + delete e.dragInstance; } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var a = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - a.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_rotate_right = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc624\ub978\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "right"], params:[{type:"Image", img:"/img/assets/week/blocks/turnR.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + var e = this; + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var f; + f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var g = $(document); + g.bind("mousemove.scroll", b); + g.bind("mouseup.scroll", c); + g.bind("touchmove.scroll", b); + g.bind("touchend.scroll", c); + e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); } - delete this.isAction; - delete this.isContinue; + a.stopPropagation(); + }; + b._addControl = function() { + $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); + }; +})(Entry.BlockMenuScroller.prototype); +Entry.BlockView = function(b, a, d) { + var c = this; + Entry.Model(this, !1); + this.block = b; + this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200); + this._board = a; + this._observers = []; + this.set(b); + this.svgGroup = a.svgBlockGroup.elem("g"); + this._schema = Entry.block[b.type]; + if (void 0 === this._schema) { + this.block.destroy(!1, !1); } else { - this.isAction = this.isContinue = !0; - var a = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - a.isAction = !1; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + var e = this._skeleton = Entry.skeleton[this._schema.skeleton]; + this._contents = []; + this._statements = []; + this.magnet = {}; + this._paramMap = {}; + e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); + this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; + this.mouseHandler = function() { + var a = c.block.events; + a && a.mousedown && a.mousedown.forEach(function(a) { + a(c); + }); + c.onMouseDown.apply(c, arguments); + }; + this._startRender(b, d); + this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); + this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); + this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); + this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); + this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); + this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); + this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); + this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); + this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); + this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); + this.dragMode = Entry.DRAG_MODE_NONE; + Entry.Utils.disableContextmenu(this.svgGroup.node); + a = b.events.viewAdd; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(b); }); - return Entry.STATIC.CONTINUE; } -}}; -Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", template:"%1 this is test block %2", params:[{type:"Block", accept:"basic_boolean_field", value:[{type:"test", params:[30, 50]}]}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { -}}; -Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { -}}; -Entry.Thread = function(a, b, c) { - this._data = new Entry.Collection; - this._code = b; - this.changeEvent = new Entry.Event(this); - this.changeEvent.attach(this, this.handleChange); - this._event = null; - this.parent = c ? c : b; - this.load(a); }; -(function(a) { - a.load = function(b, a) { - void 0 === b && (b = []); - if (!(b instanceof Array)) { - return console.error("thread must be array"); +Entry.BlockView.PARAM_SPACE = 5; +Entry.BlockView.DRAG_RADIUS = 5; +Entry.BlockView.pngMap = {}; +(function(b) { + b.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; + b._startRender = function(a, b) { + var c = this, e = this._skeleton; + this.svgGroup.attr({class:"block"}); + var f = e.classes; + f && 0 !== f.length && f.forEach(function(a) { + c.svgGroup.addClass(a); + }); + f = e.path(this); + this.pathGroup = this.svgGroup.elem("g"); + this._updateMagnet(); + this._path = this.pathGroup.elem("path"); + this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { + c._mouseEnable && c._changeFill(!0); + }), $(this._path).mouseleave(function(a) { + c._mouseEnable && c._changeFill(!1); + })); + var g = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (g = Entry.Utils.colorLighten(g)); + this._fillColor = g; + f = {d:f, fill:g, class:"blockPath"}; + if (this.magnet.next || this._skeleton.nextShadow) { + g = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + g + ")"}); + } else { + if (this.magnet.string || this.magnet.boolean) { + f.stroke = e.outerLine; + } } - for (var c = 0;c < b.length;c++) { - var e = b[c]; - e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); + e.outerLine && (f["stroke-width"] = "0.6"); + this._path.attr(f); + this._moveTo(this.x, this.y, !1); + this._startContentRender(b); + !0 !== this._board.disableMouseEvent && this._addControl(); + this.bindPrev(); + }; + b._startContentRender = function(a) { + a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; + this.contentSvgGroup && this.contentSvgGroup.remove(); + var b = this._schema; + b.statements && b.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); + this._contents = []; + this.contentSvgGroup = this.svgGroup.elem("g"); + b.statements && b.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); + switch(a) { + case Entry.Workspace.MODE_BOARD: + ; + case Entry.Workspace.MODE_OVERLAYBOARD: + for (var c = /(%\d)/mi, e = (b.template ? b.template : Lang.template[this.block.type]).split(c), f = b.params, g = 0;g < e.length;g++) { + var h = e[g].trim(); + if (0 !== h.length) { + if (c.test(h)) { + var k = +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 { + this._contents.push(new Entry.FieldText({text:h}, this)); + } + } + } + if ((a = b.statements) && a.length) { + for (g = 0;g < a.length;g++) { + this._statements.push(new Entry.FieldStatement(a[g], this, g)); + } + } + break; + case Entry.Workspace.MODE_VIMBOARD: + if ("basic_button" === this._schema.skeleton) { + this._startContentRender(Entry.Workspace.MODE_BOARD); + return; + } + b = this.getBoard().workspace.getCodeToText(this.block); + a = !1; + /(if)+(.|\n)+(else)+/.test(b) && (g = b.split("\n"), b = g.shift() + " " + g.shift(), a = !0, g = g.join(" ")); + b = {text:b, color:"white"}; + this.block._schema.vimModeFontColor && (b.color = this.block._schema.vimModeFontColor); + this._contents.push(new Entry.FieldText(b, this)); + a && (this._contents.push(new Entry.FieldLineBreak(null, this)), b.text = g, this._contents.push(new Entry.FieldText(b, this))); } - (b = this._code.view) && this.createView(b.board, a); + this.alignContent(!1); }; - a.registerEvent = function(b, a) { - this._event = a; - this._code.registerEvent(b, a); + b._updateSchema = function() { + this._startContentRender(); }; - a.unregisterEvent = function(b, a) { - this._code.unregisterEvent(b, a); + b.changeType = function(a) { + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + this._schema = Entry.block[a]; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + this._updateSchema(); }; - a.createView = function(b, a) { - this.view || (this.view = new Entry.ThreadView(this, b)); - this._data.getAll().forEach(function(c) { - c.createView(b, a); - }); + b.alignContent = function(a) { + !0 !== a && (a = !1); + for (var b = 0, c = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { + var l = this._contents[k]; + l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, c = l.box.y, b = 8) : (l.align(b, c, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (b += Entry.BlockView.PARAM_SPACE)); + l = l.box; + 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); + b += l.width; + g = Math.max(g, b); + this.set({contentWidth:g, contentHeight:e}); + } + this.set({contentHeight:e + h}); + this._statements.length != f && this._alignStatement(a, f); + a = this.getContentPos(); + this.contentSvgGroup.attr("transform", "translate(" + a.x + "," + a.y + ")"); + this.contentPos = a; + this._render(); + this._updateMagnet(); }; - a.destroyView = function() { - this.view = null; - this._data.map(function(b) { - b.destroyView(); - }); + b._alignStatement = function(a, b) { + var c = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[b]; + e && (c = c[b]) && e.align(c.x, c.y, a); + }; + b._render = function() { + this._renderPath(); + this.set(this._skeleton.box(this)); }; - a.separate = function(b, a) { - this._data.has(b.id) && (b = this._data.splice(this._data.indexOf(b), a), this._code.createThread(b), this.changeEvent.notify()); + b._renderPath = function() { + var a = this._skeleton.path(this); + this._path.attr({d:a}); + this.set({animating:!1}); }; - a.cut = function(b) { - b = this._data.indexOf(b); - b = this._data.splice(b); - this.changeEvent.notify(); - return b; + b._setPosition = function(a) { + this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); }; - a.insertByBlock = function(b, a) { - b = b ? this._data.indexOf(b) : -1; - for (var c = 0;c < a.length;c++) { - a[c].setThread(this); + b._toLocalCoordinate = function(a) { + this._moveTo(0, 0, !1); + a.appendChild(this.svgGroup); + }; + b._toGlobalCoordinate = function(a) { + a = this.getAbsoluteCoordinate(a); + this._moveTo(a.x, a.y, !1); + this.getBoard().svgBlockGroup.appendChild(this.svgGroup); + }; + b._moveTo = function(a, b, c) { + this.set({x:a, y:b}); + this._lazyUpdatePos(); + this.visible && this.display && this._setPosition(c); + }; + b._moveBy = function(a, b, c) { + return this._moveTo(this.x + a, this.y + b, c); + }; + b._addControl = function() { + var a = this; + this._mouseEnable = !0; + $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", a.mouseHandler); + var b = a.block.events; + b && b.dblclick && $(this.svgGroup).dblclick(function() { + b.dblclick.forEach(function(b) { + b && b(a); + }); + }); + }; + b.removeControl = function() { + this._mouseEnable = !1; + $(this.svgGroup).unbind(".blockViewMousedown"); + }; + b.onMouseDown = function(a) { + function d(a) { + a.stopPropagation(); + var c = g.workspace.getMode(), d; + c === Entry.Workspace.MODE_VIMBOARD && b.vimBoardEvent(a, "dragOver"); + d = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); + if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { + e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(a) : (a = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), a = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, + offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), a && g.generateCodeMagnetMap(), f._updateCloseBlock())); + } + } + function c(a) { + e && (clearTimeout(e), e = null); + $(document).unbind(".block"); + f.terminateDrag(a); + g && g.set({dragBlock:null}); + f._changeFill(!1); + Entry.GlobalSvg.remove(); + delete this.mouseDownCoordinate; + delete f.dragInstance; + } + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + var e = null, f = this; + this._changeFill(!1); + var g = this.getBoard(); + Entry.documentMousedown && Entry.documentMousedown.notify(a); + if (!this.readOnly && !g.viewOnly) { + g.setSelectedBlock(this); + this.dominate(); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + var h = a.type, k; + k = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; + var l = $(document); + l.bind("mousemove.block touchmove.block", d); + l.bind("mouseup.block touchend.block", c); + this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); + g.set({dragBlock:this}); + this.addDragging(); + this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; + "touchstart" === h && (e = setTimeout(function() { + e && (e = null, c(), f._rightClick(a)); + }, 1E3)); + } else { + Entry.Utils.isRightButton(a) && this._rightClick(a); + } + g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && a && (vimBoard = $(".entryVimBoard>.CodeMirror")[0], document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event))); } - this._data.splice.apply(this._data, [b + 1, 0].concat(a)); - this.changeEvent.notify(); }; - a.insertToTop = function(b) { - b.setThread(this); - this._data.unshift.apply(this._data, [b]); - this.changeEvent.notify(); + b.vimBoardEvent = function(a, b, c) { + a && (a = Entry.Utils.createMouseEvent(b, a), c && (a.block = c), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); }; - a.clone = function(b, a) { - b = b || this._code; - b = new Entry.Thread([], b); - for (var c = this._data, e = [], f = 0, g = c.length;f < g;f++) { - e.push(c[f].clone(b)); + b.terminateDrag = function(a) { + var b = this.getBoard(), c = this.dragMode, e = this.block, f = b.workspace.getMode(); + this.removeDragging(); + this.set({visible:!0}); + this.dragMode = Entry.DRAG_MODE_NONE; + if (f === Entry.Workspace.MODE_VIMBOARD) { + b instanceof Entry.BlockMenu ? (b.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : b.clear(); + } else { + if (c === Entry.DRAG_MODE_DRAG) { + var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg; + a = !1; + var h = this.block.getPrevBlock(this.block); + a = !1; + switch(Entry.GlobalSvg.terminateDrag(this)) { + case g.DONE: + g = b.magnetedBlockView; + g instanceof Entry.BlockView && (g = g.block); + h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = c, b.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", + e); + break; + case g.RETURN: + e = this.block; + c = this.originPos; + h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(c.x, c.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); + break; + case g.REMOVE: + createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); + } + b.setMagnetedBlock(null); + a && Entry.ConnectionRipple.setView(e.view).dispose(); + } } - b.load(e, a); - return b; + this.destroyShadow(); + delete this.originPos; + this.dominate(); }; - a.toJSON = function(b, a) { - var c = []; - for (a = void 0 === a ? 0 : a;a < this._data.length;a++) { - this._data[a] instanceof Entry.Block && c.push(this._data[a].toJSON(b)); + b._updateCloseBlock = function() { + var a = this.getBoard(), b; + if (this._skeleton.magnets) { + for (var c in this.magnet) { + if (b = "next" === c ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), c) : this.getBoard().getNearestMagnet(this.x, this.y, c)) { + return a.setMagnetedBlock(b.view, c); + } + } + a.setMagnetedBlock(null); } - return c; }; - a.destroy = function(b) { - this._code.destroyThread(this, !1); - this.view && this.view.destroy(b); - for (var a = this._data, d = a.length - 1;0 <= d;d--) { - a[d].destroy(b); + b.dominate = function() { + this.block.getThread().view.dominate(); + }; + b.getSvgRoot = function() { + for (var a = this.getBoard().svgBlockGroup, b = this.svgGroup;b.parentNode !== a;) { + b = b.parentNode; } + return b; }; - a.getBlock = function(b) { - return this._data[b]; + b.getBoard = function() { + return this._board; }; - a.getBlocks = function() { - return this._data.map(function(b) { - return b; + b._setBoard = function() { + this._board = this._board.code.board; + }; + b.destroy = function(a) { + $(this.svgGroup).unbind(".blockViewMousedown"); + this._destroyObservers(); + var b = this.svgGroup; + a ? $(b).fadeOut(100, function() { + b.remove(); + }) : b.remove(); + this._contents.forEach(function(a) { + a.constructor !== Entry.Block && a.destroy(); + }); + var c = this.block; + a = c.events.viewDestroy; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(c); }); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + }; + b.getShadow = function() { + this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); + return this._shadow; }; - a.countBlock = function() { - for (var b = 0, a = 0;a < this._data.length;a++) { - var d = this._data[a]; - if (d.type && (b++, d = d.statements)) { - for (var e = 0;e < d.length;e++) { - b += d[e].countBlock(); + b.destroyShadow = function() { + this._shadow && (this._shadow.remove(), delete this._shadow); + }; + b._updateMagnet = function() { + if (this._skeleton.magnets) { + var a = this._skeleton.magnets(this); + a.next && this._nextGroup.attr("transform", "translate(" + a.next.x + "," + a.next.y + ")"); + this.magnet = a; + this.block.getThread().changeEvent.notify(); + } + }; + b._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + var a = this.svgGroup; + if (this.magnet.next) { + if (a = this.magneting) { + var b = this._board.dragBlock.getShadow(), c = this.getAbsoluteCoordinate(), e; + if ("previous" === a) { + e = this.magnet.next, e = "translate(" + (c.x + e.x) + "," + (c.y + e.y) + ")"; + } else { + if ("next" === a) { + e = this.magnet.previous; + var f = this._board.dragBlock.getBelowHeight(); + e = "translate(" + (c.x + e.x) + "," + (c.y + e.y - f) + ")"; + } + } + $(b).attr({transform:e, display:"block"}); + this._clonedShadow = b; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + "previous" === a && (a = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:a})); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:a}), delete this.originalHeight); } + (a = this.block.thread.changeEvent) && a.notify(); + } else { + this.magneting ? (a.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), a.addClass("outputHighlight")) : (a.removeClass("outputHighlight"), a.removeAttr("filter")); } } - return b; }; - a.handleChange = function() { - 0 === this._data.length && this.destroy(); + b.addDragging = function() { + this.svgGroup.addClass("dragging"); + }; + b.removeDragging = function() { + this.svgGroup.removeClass("dragging"); + }; + b.addSelected = function() { + this.svgGroup.addClass("selected"); + }; + b.removeSelected = function() { + this.svgGroup.removeClass("selected"); + }; + b.getSkeleton = function() { + return this._skeleton; }; - a.getCode = function() { - return this._code; + b.getContentPos = function() { + return this._skeleton.contentPos(this); }; - a.setCode = function(b) { - this._code = b; + b.renderText = function() { + this._startContentRender(Entry.Workspace.MODE_VIMBOARD); }; - a.spliceBlock = function(b) { - this._data.remove(b); - this.changeEvent.notify(); + b.renderBlock = function() { + this._startContentRender(Entry.Workspace.MODE_BOARD); }; - a.getFirstBlock = function() { - return this._data[0]; + b._updateOpacity = function() { + this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); + this.visible && this._setPosition(); }; - a.getPrevBlock = function(b) { - b = this._data.indexOf(b); - return this._data.at(b - 1); + b._updateShadow = function() { + this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); }; - a.getNextBlock = function(b) { - b = this._data.indexOf(b); - return this._data.at(b + 1); + b._setMovable = function() { + this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; }; - a.getLastBlock = function() { - return this._data.at(this._data.length - 1); + b._setReadOnly = function() { + this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; }; - a.getRootBlock = function() { - return this._data.at(0); + b._setCopyable = function() { + this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; }; - a.hasBlockType = function(b) { - function a(c) { - if (b == c.type) { - return !0; - } - for (var d = c.params, e = 0;e < d.length;e++) { - var h = d[e]; - if (h && h.constructor == Entry.Block && a(h)) { - return !0; - } - } - if (c = c.statements) { - for (d = 0;d < c.length;d++) { - if (c[d].hasBlockType(b)) { - return !0; - } - } + b.bumpAway = function(a, b) { + var c = this; + a = a || 15; + b ? window.setTimeout(function() { + c._moveBy(a, a, !1); + }, b) : c._moveBy(a, a, !1); + }; + b.bindPrev = function(a) { + if (a) { + if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { + var b = this.block.getLastBlock(); + b.view.magnet.next ? a.view._toLocalCoordinate(b.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); } - return !1; - } - for (var d = 0;d < this._data.length;d++) { - if (a(this._data[d])) { - return !0; + } else { + if (a = this.block.getPrevBlock()) { + this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); } } - return !1; }; - a.getCount = function(b) { - var a = this._data.length; - b && (a -= this._data.indexOf(b)); + b.getAbsoluteCoordinate = function(a) { + a = void 0 !== a ? a : this.dragMode; + if (a === Entry.DRAG_MODE_DRAG) { + return {x:this.x, y:this.y}; + } + a = this.block.getThread().view.requestAbsoluteCoordinate(this); + a.x += this.x; + a.y += this.y; return a; }; - a.indexOf = function(b) { - return this._data.indexOf(b); + b.getBelowHeight = function() { + return this.block.getThread().view.requestPartHeight(this); + }; + b._updateDisplay = function() { + this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); + this.display && this._setPosition(); }; - a.pointer = function(b, a) { - a = this.indexOf(a); - b.unshift(a); - this.parent instanceof Entry.Block && b.unshift(this.parent.indexOfStatements(this)); - return this._code === this.parent ? (b.unshift(this._code.indexOf(this)), a = this._data[0], b.unshift(a.y), b.unshift(a.x), b) : this.parent.pointer(b); + b._updateColor = function() { + var a = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); + this._fillColor = a; + this._path.attr({fill:a}); + this._updateContents(); }; - a.getBlockList = function(b, a) { - for (var c = [], e = 0;e < this._data.length;e++) { - c = c.concat(this._data[e].getBlockList(b, a)); + b._updateContents = function() { + for (var a = 0;a < this._contents.length;a++) { + this._contents[a].renderStart(); } - return c; + this.alignContent(!1); }; - a.stringify = function() { - return JSON.stringify(this.toJSON()); + b._destroyObservers = function() { + for (var a = this._observers;a.length;) { + a.pop().destroy(); + } }; -})(Entry.Thread.prototype); -Entry.skeleton = function() { -}; -Entry.skeleton.basic = {path:function(a) { - var b = a.contentWidth; - a = a.contentHeight; - a = Math.max(30, a + 2); - b = Math.max(0, b + 9 - a / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); -}, box:function(a) { - return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(a) { - return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; -}, contentPos:function(a) { - return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_create = {path:function(a) { - var b = a.contentWidth; - a = a.contentHeight; - a = Math.max(30, a + 2); - b = Math.max(0, b + 9 - a / 2); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); -}, box:function(a) { - return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(a) { - return {next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; -}, contentPos:function(a) { - return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_event = {path:function(a) { - a = a.contentWidth; - a = Math.max(0, a); - return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, a - 30); -}, box:function(a) { - return {offsetX:-19, offsetY:-7, width:a.contentWidth + 30, height:30, marginBottom:0}; -}, magnets:function(a) { - return {next:{x:0, y:(a ? Math.max(a.height + a.offsetY + 7, 30) : 30) + 1}}; -}, contentPos:function(a) { - return {x:1, y:15}; -}}; -Entry.skeleton.basic_loop = {path:function(a) { - var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); - a = a._statements[0] ? a._statements[0].height : 20; - a = Math.max(a, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, a + 1); -}, magnets:function(a) { - var b = Math.max(a.contentHeight + 2, 30), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 20); - return {previous:{x:0, y:0}, next:{x:0, y:c + b + 18 + a.offsetY}}; -}, box:function(a) { - var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 30); - a = a._statements[0] ? a._statements[0].height : 20; - a = Math.max(a, 20); - return {offsetX:-8, offsetY:0, width:b + 30, height:c + a + 17, marginBottom:0}; -}, statementPos:function(a) { - return [{x:16, y:Math.max(30, a.contentHeight + 2) + 1}]; -}, contentPos:function(a) { - return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_define = {path:function(a) { - var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); - a = a._statements[0] ? a._statements[0].height : 30; - a = Math.max(a, 20); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%h/gi, c / 2).replace(/%bw/gi, b - 8).replace(/%sh/gi, a + 1); -}, magnets:function() { - return {}; -}, box:function(a) { - return {offsetX:0, offsetY:0, width:a.contentWidth, height:Math.max(a.contentHeight, 25) + 46, marginBottom:0}; -}, statementPos:function(a) { - return [{x:16, y:Math.max(30, a.contentHeight + 2)}]; -}, contentPos:function() { - return {x:14, y:15}; -}}; -Entry.skeleton.pebble_event = {path:function(a) { - return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; -}, box:function(a) { - return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; -}, magnets:function(a) { - return {next:{x:0, y:(a ? Math.max(a.height, 49.3) : 49.3) + a.offsetY}}; -}, contentPos:function() { - return {x:0, y:25}; -}}; -Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(a) { - a = Math.max(a._statements[0] ? a._statements[0].height : 50, 50); - return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, a + 4).replace(/%cih/gi, a - 50); -}, magnets:function(a) { - var b = Math.max(a.contentHeight + 2, 41), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 51); - return {previous:{x:0, y:0}, next:{x:0, y:c + b + 13 + a.offsetY}}; -}, box:function(a) { - var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 41); - a = a._statements[0] ? a._statements[0].height : 20; - a = Math.max(a, 51); - return {offsetX:-(b / 2 + 13), offsetY:0, width:b + 30, height:c + a + 13, marginBottom:0}; -}, statementPos:function(a) { - return [{x:0, y:Math.max(39, a.contentHeight + 2) + 1.5}]; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(a) { - return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; -}, magnets:function(a) { - return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 51) : 51) + a.offsetY}}; -}, box:function() { - return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.basic_string_field = {path:function(a) { - var b = a.contentWidth; - a = a.contentHeight; - a = Math.max(18, a + 2); - b = Math.max(0, b - a + 12); - return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); -}, color:"#000", outerLine:"#768dce", box:function(a) { - return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 12, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {string:{}}; -}, contentPos:function(a) { - return {x:6, y:Math.max(a.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_boolean_field = {path:function(a) { - var b = a.contentWidth; - a = a.contentHeight; - a = Math.max(18, a + 2); - b = Math.max(0, b - a + 19); - return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); -}, color:"#000", outerLine:"#768dce", box:function(a) { - return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 19, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {boolean:{}}; -}, contentPos:function(a) { - return {x:10, y:Math.max(a.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_param = {path:function(a) { - var b = a.contentWidth; - (a = a._contents[a._contents.length - 1]) && (b -= a.box.width + Entry.BlockView.PARAM_SPACE - 2); - b = Math.max(0, b); - return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, b); -}, outerLine:"#768dce", box:function(a) { - return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 11, height:24, marginBottom:0}; -}, magnets:function() { - return {param:{}}; -}, contentPos:function(a) { - return {x:11, y:12}; -}}; -Entry.skeleton.basic_button = {path:function() { - return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; -}, box:function() { - return {offsetX:-80, offsetY:0, width:140, height:30}; -}, contentPos:function() { - return {x:0, y:15}; -}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; -Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(a) { - var b = a.contentWidth; - a = a.contentHeight; - a = Math.max(30, a + 2); - b = Math.max(0, b + 9 - a / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); -}, magnets:function(a) { - return {previous:{x:0, y:0}}; -}}; -Entry.skeleton.basic_double_loop = {path:function(a) { - var b = a.contentWidth, c = a.contentHeight % 1E6, d = Math.floor(a.contentHeight / 1E6), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; - a = e[0] ? e[0].height : 20; - e = e[1] ? e[1].height : 20; - a = Math.max(a, 20); - e = Math.max(e, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); -}, magnets:function(a) { - var b = Math.max(a.contentHeight % 1E6 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); - return {previous:{x:0, y:0}, next:{x:0, y:d + e + b + c + 19 + a.offsetY}}; -}, box:function(a) { - var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = Math.max(a.contentHeight % 1E6 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E6 : 20; - a = a._statements[1] ? a._statements[1].height : 20; - e = Math.max(e, 20); - a = Math.max(a, 20); - return {offsetX:-8, offsetY:0, width:b + 30, height:c + d + e + a + 17, marginBottom:0}; -}, statementPos:function(a) { - var b = Math.max(30, a.contentHeight % 1E6 + 2) + 1; - return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30) + 1}]; -}, contentPos:function(a) { - return {x:14, y:Math.max(a.contentHeight % 1E6, 28) / 2 + 1}; -}}; -Entry.Block = function(a, b) { - var c = this; - Entry.Model(this, !1); - this._schema = null; - this.setThread(b); - this.load(a); - a = this.getCode(); - a.registerBlock(this); - (b = this.events.dataAdd) && a.object && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(c); - }); -}; -Entry.Block.MAGNET_RANGE = 10; -Entry.Block.MAGNET_OFFSET = .4; -Entry.Block.DELETABLE_TRUE = 1; -Entry.Block.DELETABLE_FALSE = 2; -Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; -(function(a) { - a.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; - a.load = function(b) { - b.id || (b.id = Entry.Utils.generateId()); - this.set(b); - this.loadSchema(); + b._changeFill = function(a) { + var b = this.getBoard(); + if (b.patternRect && !b.dragBlock) { + var c = this._fillColor, e = this._path, b = this.getBoard(); + a ? (b.setPatternRectFill(c), c = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : b.disablePattern(); + e.attr({fill:c}); + } }; - a.changeSchema = function(b) { - this.set({params:[]}); - this.loadSchema(); + b.addActivated = function() { + this.svgGroup.addClass("activated"); }; - a.getSchema = function() { - this._schema || this.loadSchema(); - return this._schema; + b.removeActivated = function() { + this.svgGroup.removeClass("activated"); }; - a.loadSchema = function() { - if (this._schema = Entry.block[this.type]) { - !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); - var b = this._schema.events; + b.reDraw = function() { + if (this.visible) { + var a = this.block; + requestAnimFrame(this._updateContents.bind(this)); + var b = a.params; if (b) { - for (var a in b) { - this.events[a] || (this.events[a] = []); - for (var d = b[a], e = 0;e < d.length;e++) { - var f = d[e]; - f && 0 > this.events[a].indexOf(f) && this.events[a].push(f); - } + for (var c = 0;c < b.length;c++) { + var e = b[c]; + e instanceof Entry.Block && e.view.reDraw(); } } - this._schema.event && this.thread.registerEvent(this, this._schema.event); - b = this.params; - a = this._schema.params; - for (e = 0;a && e < a.length;e++) { - d = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !d || "Output" !== a[e].type && "Block" !== a[e].type || (d = new Entry.Block(d, this.thread)), f ? b.splice(e, 1, d) : b.push(d); - } - if (b = this._schema.statements) { - for (e = 0;e < b.length;e++) { - this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); + if (a = a.statements) { + for (c = 0;c < a.length;c++) { + a[c].view.reDraw(); } } } }; - a.changeType = function(b) { - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this.set({type:b}); - this.loadSchema(); - this.view && this.view.changeType(b); - }; - a.setThread = function(b) { - this.set({thread:b}); - }; - a.getThread = function() { - return this.thread; - }; - a.insertAfter = function(b) { - this.thread.insertByBlock(this, b); - }; - a._updatePos = function() { - this.view && this.set({x:this.view.x, y:this.view.y}); - }; - a.moveTo = function(b, a) { - this.view && this.view._moveTo(b, a); - this._updatePos(); - this.getCode().changeEvent.notify(); - }; - a.createView = function(b, a) { - this.view || (this.set({view:new Entry.BlockView(this, b, a)}), this._updatePos()); - }; - a.destroyView = function() { - this.set({view:null}); - }; - a.clone = function(b) { - return new Entry.Block(this.toJSON(!0), b); - }; - a.toJSON = function(b) { - var a = this._toJSON(); - delete a.view; - delete a.thread; - delete a.events; - b && delete a.id; - a.params = a.params.map(function(a) { - a instanceof Entry.Block && (a = a.toJSON(b)); - return a; - }); - a.statements = a.statements.map(function(a) { - return a.toJSON(b); - }); - a.x = this.x; - a.y = this.y; - a.movable = this.movable; - a.deletable = this.deletable; - a.readOnly = this.readOnly; - return a; + b.getParam = function(a) { + return this._paramMap[a]; }; - a.destroy = function(b, a) { - var c = this, e = this.params; - if (e) { - for (var f = 0;f < e.length;f++) { - var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(b)); - } + b.getDataUrl = function(a, b) { + function c() { + g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * m).replace("%H", h.height * m).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+ e || c.splice(e, 1); + } }; - a.doAdd = function() { - this.getCode().changeEvent.notify(); + b.raiseEvent = function(a, b, c) { + a = this._eventMap[a]; + var e = []; + if (void 0 !== a) { + for (var f = 0;f < a.length;f++) { + var g = a[f]; + if (void 0 === c || -1 < g.params.indexOf(c)) { + g = new Entry.Executor(a[f], b), this.executors.push(g), e.push(g); + } + } + return e; + } }; - a.doMove = function() { - this._updatePos(); - this.getCode().changeEvent.notify(); + b.getEventMap = function(a) { + return this._eventMap[a]; }; - a.doSeparate = function() { - this.separate(); + b.map = function(a) { + this._data.map(a); }; - a.doInsert = function(b) { - "basic" === this.getBlockType() ? this.insert(b) : this.replace(b); + b.tick = function() { + for (var a = this.executors, b = 0;b < a.length;b++) { + var c = a[b]; + c.isEnd() ? (a.splice(b--, 1), 0 === a.length && this.executeEndEvent.notify()) : c.execute(); + } }; - a.doDestroy = function(b) { - this.destroy(b); - this.getCode().changeEvent.notify(); - return this; + b.removeExecutor = function(a) { + a = this.executors.indexOf(a); + -1 < a && this.executors.splice(a, 1); }; - a.doDestroyBelow = function(b) { - console.log("destroyBelow", this.id, this.x, this.y); - this.destroy(b, !0); - this.getCode().changeEvent.notify(); - return this; + b.clearExecutors = function() { + this.executors.forEach(function(a) { + a.end(); + }); + this.executors = []; }; - a.copy = function() { - var b = this.getThread(), a = []; - if (b instanceof Entry.Thread) { - for (var d = b.getBlocks().indexOf(this), b = b.toJSON(!0, d), d = 0;d < b.length;d++) { - a.push(b[d]); - } - } else { - a.push(this.toJSON(!0)); + b.clearExecutorsByEntity = function(a) { + for (var b = this.executors, c = 0;c < b.length;c++) { + var e = b[c]; + e.entity === a && e.end(); } - b = this.view.getAbsoluteCoordinate(); - d = a[0]; - d.x = b.x + 15; - d.y = b.y + 15; - d.id = Entry.Utils.generateId(); - return a; }; - a.copyToClipboard = function() { - Entry.clipboard = this.copy(); - }; - a.separate = function(b) { - this.thread.separate(this, b); - this._updatePos(); - this.getCode().changeEvent.notify(); + b.addExecutor = function(a) { + this.executors.push(a); }; - a.insert = function(b) { - var a = this.thread.cut(this); - b instanceof Entry.Thread ? b.insertByBlock(null, a) : b.insertAfter(a); - this._updatePos(); - this.getCode().changeEvent.notify(); + b.createThread = function(a, b) { + if (!(a instanceof Array)) { + return console.error("blocks must be array"); + } + var c = new Entry.Thread(a, this); + void 0 === b ? this._data.push(c) : this._data.insert(c, b); + return c; }; - a.replace = function(b) { - this.thread.cut(this); - b.getThread().replace(this); - this.getCode().changeEvent.notify(); + b.cloneThread = function(a, b) { + var c = a.clone(this, b); + this._data.push(c); + return c; }; - a.getPrevBlock = function() { - return this.thread.getPrevBlock(this); + b.destroyThread = function(a, b) { + var c = this._data, e = c.indexOf(a); + 0 > e || c.splice(e, 1); }; - a.getNextBlock = function() { - return this.thread.getNextBlock(this) || null; + b.doDestroyThread = function(a, b) { + var c = this._data, e = c.indexOf(a); + 0 > e || c.splice(e, 1); }; - a.getLastBlock = function() { - return this.thread.getLastBlock(); + b.getThreads = function() { + return this._data.map(function(a) { + return a; + }); }; - a.getOutputBlock = function() { - for (var b = this._schema.params, a = 0;b && a < b.length;a++) { - if ("Output" === b[a].type) { - return this.params[a]; - } + b.toJSON = function() { + for (var a = this.getThreads(), b = [], c = 0, e = a.length;c < e;c++) { + b.push(a[c].toJSON()); } - return null; + return b; }; - a.getTerminateOutputBlock = function() { - for (var b = this;;) { - var a = b.getOutputBlock(); - if (!a) { - return b; - } - b = a; + b.countBlock = function() { + for (var a = this.getThreads(), b = 0, c = 0;c < a.length;c++) { + b += a[c].countBlock(); } + return b; }; - a.getBlockType = function() { - if (!this.view) { - return null; + b.moveBy = function(a, b) { + for (var c = this.getThreads(), e = 0, f = c.length;e < f;e++) { + var g = c[e].getFirstBlock(); + g && g.view._moveBy(a, b, !1); } - var b = Entry.skeleton[this._schema.skeleton].magnets(this.view); - return b.next || b.previous ? "basic" : b.boolean || b.string ? "field" : b.output ? "output" : null; + c = this.board; + c instanceof Entry.BlockMenu && c.updateSplitters(b); }; - a.indexOfStatements = function(b) { - return this.statements.indexOf(b); + b.stringify = function() { + return JSON.stringify(this.toJSON()); }; - a.pointer = function(b) { - b || (b = []); - return this.thread.pointer(b, this); + b.dominate = function(a) { + a.view.setZIndex(this._maxZIndex++); }; - a.targetPointer = function() { - var b = this.thread.pointer([], this); - 4 === b.length && 0 === b[3] && b.pop(); - return b; + b.indexOf = function(a) { + return this._data.indexOf(a); }; - a.getBlockList = function(b, a) { - var c = []; - if (!this._schema) { - return []; - } - if (b && this._schema.isPrimitive) { - return c; + b._handleChange = function() { + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + }; + b.hasBlockType = function(a) { + for (var b = this.getThreads(), c = 0;c < b.length;c++) { + if (b[c].hasBlockType(a)) { + return !0; + } } - (a || this.type) === this.type && c.push(this); - for (var e = this.params, f = 0;f < e.length;f++) { - var g = e[f]; - g && g.constructor == Entry.Block && (c = c.concat(g.getBlockList(b, a))); + return !1; + }; + b.findById = function(a) { + return this._blockMap[a]; + }; + b.registerBlock = function(a) { + this._blockMap[a.id] = a; + }; + b.unregisterBlock = function(a) { + delete this._blockMap[a.id]; + }; + b.getByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + for (var b = this._data[a.shift()].getBlock(a.shift());a.length;) { + b instanceof Entry.Block || (b = b.getValueBlock()); + var c = a.shift(), e = a.shift(); + -1 < c ? b = b.statements[c].getBlock(e) : -1 === c && (b = b.view.getParam(e)); } - if (e = this.statements) { - for (f = 0;f < e.length;f++) { - c = c.concat(e[f].getBlockList(b, a)); + return b; + }; + b.getTargetByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + var b = this._data[a.shift()], c; + if (1 === a.length) { + c = b.getBlock(a.shift() - 1); + } else { + for (c = b.getBlock(a.shift());a.length;) { + c instanceof Entry.Block || (c = c.getValueBlock()); + var e = a.shift(), b = a.shift(); + -1 < e ? (c = c.statements[e], c = a.length ? c.getBlock(b) : 0 === b ? c.view.getParent() : c.getBlock(b - 1)) : -1 === e && (c = c.view.getParam(b)); } } return c; }; - a.stringify = function() { - return JSON.stringify(this.toJSON()); + b.getBlockList = function(a, b) { + for (var c = this.getThreads(), e = [], f = 0;f < c.length;f++) { + e = e.concat(c[f].getBlockList(a, b)); + } + return e; }; -})(Entry.Block.prototype); -Entry.BlockMenu = function(a, b, c, d) { - Entry.Model(this, !1); - this._align = b || "CENTER"; - this.setAlign(this._align); - this._scroll = void 0 !== d ? d : !1; - this._bannedClass = []; - this._categories = []; - this.suffix = "blockMenu"; - a = "string" === typeof a ? $("#" + a) : $(a); - if ("DIV" !== a.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.view = a; - this.visible = !0; - this._svgId = "blockMenu" + (new Date).getTime(); - this._clearCategory(); - this._categoryData = c; - this._generateView(c); - this._splitters = []; - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - b = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = b.rect; - this.pattern = b.pattern; - this.svgGroup = this.svg.elem("g"); - this.svgThreadGroup = this.svgGroup.elem("g"); - this.svgThreadGroup.board = this; - this.svgBlockGroup = this.svgGroup.elem("g"); - this.svgBlockGroup.board = this; - this.changeEvent = new Entry.Event(this); - c && this._generateCategoryCodes(c); - this.observe(this, "_handleDragBlock", ["dragBlock"]); - this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(a)); - Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); - this._categoryCodes && Entry.keyPressed && Entry.keyPressed.attach(this, this._captureKeyEvent); - Entry.windowResized && (a = _.debounce(this.updateOffset, 200), Entry.windowResized.attach(this, a)); -}; -(function(a) { - a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - a._generateView = function(b) { - var a = this.view, d = this; - b && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:a}), this._generateCategoryView(b)); - this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:a}); - this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); - this.svgDom.mouseenter(function(b) { - d._scroller && d._scroller.setOpacity(1); - b = d.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = d.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); + b.removeBlocksByType = function(a) { + this.getBlockList(!1, a).forEach(function(a) { + a.doDestroy(); }); - this.svgDom.mouseleave(function(b) { - Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); - }); - $(window).scroll(function() { - d.updateOffset(); + }; +})(Entry.Code.prototype); +Entry.CodeView = function(b, a) { + Entry.Model(this, !1); + this.code = b; + this.set({board:a}); + this.svgThreadGroup = a.svgGroup.elem("g"); + this.svgThreadGroup.attr({class:"svgThreadGroup"}); + this.svgThreadGroup.board = a; + this.svgBlockGroup = a.svgGroup.elem("g"); + this.svgBlockGroup.attr({class:"svgBlockGroup"}); + this.svgBlockGroup.board = a; + a.bindCodeView(this); + this.code._data.getAll().forEach(function(b) { + b.createView(a); + }); + b.observe(this, "_setBoard", ["board"]); +}; +(function(b) { + b.schema = {board:null, scrollX:0, scrollY:0}; + b._setBoard = function() { + this.set({board:this.code.board}); + }; + b.reDraw = function() { + this.code.map(function(a) { + a.view.reDraw(); }); }; - a.changeCode = function(b) { - if (!(b instanceof Entry.Code)) { - return console.error("You must inject code instance"); - } - this.codeListener && this.code.changeEvent.detach(this.codeListener); - var a = this; - this.set({code:b}); - this.codeListener = this.code.changeEvent.attach(this, function() { - a.changeEvent.notify(); + b.destroy = function() { + this.code.map(function(a) { + a.destroyView(); }); - b.createView(this); - this.workspace.getMode(); - this.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD ? b.mode && "code" !== b.mode || this.renderText() : "text" === b.mode && this.renderBlock(); - this.align(); }; - a.bindCodeView = function(b) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = b.svgBlockGroup; - this.svgThreadGroup = b.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); - this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); +})(Entry.CodeView.prototype); +Entry.ConnectionRipple = {}; +(function(b) { + b.createDom = function(a) { + this.svgDom || (this._ripple = a.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); + }; + b.setView = function(a) { + this._ripple || this.createDom(a); + var b = this._ripple, c = a.getBoard().svgGroup; + b.remove(); + a = a.getAbsoluteCoordinate(); + b.attr({cx:a.x, cy:a.y}); + c.appendChild(b); + b._startTime = new Date; + return this; }; - a.align = function(b) { - var a = this.code; - if (a) { - this._clearSplitters(); - a.view && !b && a.view.reDraw(); - b = a.getThreads(); - for (var a = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { - var h = b[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); - } - this.updateSplitters(); - this.changeEvent.notify(); - } + b.dispose = function() { + var a = this, b = this._ripple, c = (new Date - b._startTime) / 150; + 1 < c ? b.remove() : (b.attr({r:25 * c, opacity:1 - c}), window.setTimeout(function() { + a.dispose(); + }, 10)); }; - a.cloneToGlobal = function(b) { - if (!this._boardBlockView && null !== this.dragBlock) { - var a = this.workspace, d = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; - if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { - Entry.GlobalSvg.setView(e, a.getMode()) && Entry.GlobalSvg.addControl(b); - } else { - if (g.code && (a = e.block, d = a.getThread(), a && d)) { - a = d.toJSON(!0); - this._boardBlockView = Entry.do("addThread", a).value.getFirstBlock().view; - var g = this.offset().top - g.offset().top, h, k; - if (a = this.dragBlock.mouseDownCoordinate) { - h = b.pageX - a.x, k = b.pageY - a.y; +})(Entry.ConnectionRipple); +Entry.Executor = function(b, a) { + this.scope = new Entry.Scope(b, this); + this.entity = a; + this._callStack = []; + this.register = {}; +}; +(function(b) { + b.execute = function() { + if (!this.isEnd()) { + for (;;) { + var a = null; + try { + var b = this.scope.block.getSchema(); + b && (a = b.func.call(this.scope, this.entity, this.scope)); + } catch (e) { + if ("AsyncError" === e.name) { + a = Entry.STATIC.BREAK; + } else { + var c = !1; + "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (c = !0); + Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); + } + } + if (this.isEnd()) { + break; + } + if (void 0 === a || null === a || a === Entry.STATIC.PASS) { + if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { + if (this._callStack.length) { + if (a = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== a.isLooped) { + break; + } + } else { + break; + } + } + } else { + if (a !== Entry.STATIC.CONTINUE && (a === Entry.STATIC.BREAK || this.scope === a)) { + break; } - this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); - this._boardBlockView.onMouseDown.call(this._boardBlockView, b); - this._boardBlockView.dragInstance.set({isNew:!0}); } } } }; - a.terminateDrag = function() { - if (this._boardBlockView) { - var b = this._boardBlockView; - if (b) { - this.workspace.getBoard(); - this._boardBlockView = null; - var a = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; - return a < b - d; - } + b.stepInto = function(a) { + a instanceof Entry.Thread || console.error("Must step in to thread"); + a = a.getFirstBlock(); + if (!a) { + return Entry.STATIC.BREAK; } + this._callStack.push(this.scope); + this.scope = new Entry.Scope(a, this); + return Entry.STATIC.CONTINUE; }; - a.getCode = function(b) { - return this._code; - }; - a.setSelectedBlock = function(b) { - var a = this.selectedBlockView; - a && a.removeSelected(); - b instanceof Entry.BlockView ? b.addSelected() : b = null; - this.set({selectedBlockView:b}); + b.break = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + return Entry.STATIC.PASS; }; - a.hide = function() { - this.view.addClass("entryRemove"); + b.breakLoop = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { + this.scope = this._callStack.pop(); + } + return Entry.STATIC.PASS; }; - a.show = function() { - this.view.removeClass("entryRemove"); + b.end = function() { + this.scope.block = null; }; - a.renderText = function(b) { - var a = this.code.getThreads(); - this.code.mode = "text"; - for (var d = 0;d < a.length;d++) { - a[d].view.renderText(); - } - b && b(); + b.isEnd = function() { + return null === this.scope.block; }; - a.renderBlock = function(b) { - var a = this.code.getThreads(); - this.code.mode = "code"; - for (var d = 0;d < a.length;d++) { - a[d].view.renderBlock(); - } - b && b(); +})(Entry.Executor.prototype); +Entry.Scope = function(b, a) { + this.type = (this.block = b) ? b.type : null; + this.executor = a; + this.entity = a.entity; +}; +(function(b) { + b.callReturn = function() { }; - a._createSplitter = function(b) { - b = this.svgBlockGroup.elem("line", {x1:20, y1:b, x2:this._svgWidth - 20, y2:b, stroke:"#b5b5b5"}); - this._splitters.push(b); + b.getParam = function(a) { + a = this.block.params[a]; + var b = new Entry.Scope(a, this.executor); + return Entry.block[a.type].func.call(b, this.entity, b); }; - a.updateSplitters = function(b) { - b = void 0 === b ? 0 : b; - var a = this._svgWidth - 20, d; - this._splitters.forEach(function(c) { - d = parseFloat(c.getAttribute("y1")) + b; - c.attr({x2:a, y1:d, y2:d}); + b.getParams = function() { + var a = this; + return this.block.params.map(function(b) { + if (b instanceof Entry.Block) { + var c = new Entry.Scope(b, a.executor); + return Entry.block[b.type].func.call(c, a.entity, c); + } + return b; }); }; - a._clearSplitters = function() { - for (var b = this._splitters, a = b.length - 1;0 <= a;a--) { - b[a].remove(), b.pop(); - } + b.getValue = function(a, b) { + var c = this.block.params[this._getParamIndex(a, b)], e = new Entry.Scope(c, this.executor); + return Entry.block[c.type].func.call(e, this.entity, e); }; - a.setWidth = function() { - this._svgWidth = this.blockMenuContainer.width(); - this.updateSplitters(); + b.getStringValue = function(a, b) { + return String(this.getValue(a, b)); }; - a.setMenu = function() { - var b = this._categoryCodes, a = this._categoryElems, d; - for (d in b) { - for (var e = b[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { - var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; - this.checkBanClass(Entry.block[h]) && f--; - } - 0 === f ? a[d].addClass("entryRemove") : a[d].removeClass("entryRemove"); - } + b.getNumberValue = function(a, b) { + return +this.getValue(a); }; - a.getCategoryCodes = function(b) { - b = this._convertSelector(b); - var a = this._categoryCodes[b]; - a || (this._generateCategoryElement(b), a = []); - a instanceof Entry.Code || (a = this._categoryCodes[b] = new Entry.Code(a)); - return a; + b.getBooleanValue = function(a, b) { + return +this.getValue(a, b) ? !0 : !1; }; - a._convertSelector = function(b) { - if (isNaN(b)) { - return b; - } - b = Number(b); - for (var a = this._categories, d = this._categoryElems, e = 0;e < a.length;e++) { - var f = a[e]; - if (!d[f].hasClass("entryRemove") && 0 === b--) { - return f; - } - } + b.getField = function(a, b) { + return this.block.params[this._getParamIndex(a)]; }; - a.selectMenu = function(b, a) { - if (b = this._convertSelector(b)) { - switch(b) { - case "variable": - Entry.playground.checkVariables(); - break; - case "arduino": - this._generateHwCode(); - } - var c = this._categoryElems[b], e = this._selectedCategoryView, f = !1, g = this.workspace.board, h = g.view; - e && e.removeClass("entrySelectedCategory"); - c != e || a ? e || (this.visible || (f = !0, h.addClass("foldOut"), Entry.playground.showTabs()), h.removeClass("folding"), this.visible = !0) : (h.addClass("folding"), this._selectedCategoryView = null, c.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), f = !0, this.visible = !1); - f && Entry.bindAnimationCallbackOnce(h, function() { - g.scroller.resizeScrollBar.call(g.scroller); - h.removeClass("foldOut"); - Entry.windowResized.notify(); - }); - this.visible && (a = this._categoryCodes[b], this._selectedCategoryView = c, c.addClass("entrySelectedCategory"), a.constructor !== Entry.Code && (a = this._categoryCodes[b] = new Entry.Code(a)), this.changeCode(a)); - this.lastSelector = b; - } else { - this.align(); - } + b.getStringField = function(a, b) { + return String(this.getField(a)); }; - a._generateCategoryCodes = function(b) { - this._categoryCodes = {}; - for (var a = 0;a < b.length;a++) { - var d = b[a], e = []; - d.blocks.forEach(function(b) { - var a = Entry.block[b]; - if (a && a.def) { - if (a.defs) { - for (b = 0;b < a.defs.length;b++) { - e.push([a.defs[b]]); - } - } else { - e.push([a.def]); - } - } else { - e.push([{type:b}]); - } - }); - d = d.category; - this._categories.push(d); - this._categoryCodes[d] = e; - } + b.getNumberField = function(a) { + return +this.getField(a); }; - a.banClass = function(b, a) { - 0 > this._bannedClass.indexOf(b) && this._bannedClass.push(b); - this.align(a); + b.getStatement = function(a, b) { + return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); }; - a.unbanClass = function(b, a) { - b = this._bannedClass.indexOf(b); - -1 < b && this._bannedClass.splice(b, 1); - this.align(a); + b._getParamIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.paramsKeyMap[a]; }; - a.checkBanClass = function(b) { - if (b) { - b = b.isNotFor; - for (var a in this._bannedClass) { - if (b && -1 < b.indexOf(this._bannedClass[a])) { - return !0; - } - } - return !1; - } + b._getStatementIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.statementsKeyMap[a]; }; - a._addControl = function(b) { - var a = this; - b.on("wheel", function() { - a._mouseWheel.apply(a, arguments); - }); - a._scroller && $(this.svg).bind("mousedown touchstart", function(b) { - a.onMouseDown.apply(a, arguments); - }); + b.die = function() { + this.block = null; + return Entry.STATIC.BREAK; }; - a.onMouseDown = function(b) { - function a(b) { - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - b = Entry.Utils.convertMouseEvent(b); - var a = e.dragInstance; - e._scroller.scroll(-b.pageY + a.offsetY); - a.set({offsetY:b.pageY}); - } - function d(b) { - $(document).unbind(".blockMenu"); - delete e.dragInstance; - } - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - var e = this; - if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - b = Entry.Utils.convertMouseEvent(b); - Entry.documentMousedown && Entry.documentMousedown.notify(b); - var f = $(document); - f.bind("mousemove.blockMenu", a); - f.bind("mouseup.blockMenu", d); - f.bind("touchmove.blockMenu", a); - f.bind("touchend.blockMenu", d); - this.dragInstance = new Entry.DragInstance({startY:b.pageY, offsetY:b.pageY}); - } +})(Entry.Scope.prototype); +Entry.Field = function() { +}; +(function(b) { + b.TEXT_LIMIT_LENGTH = 20; + b.destroy = function() { + $(this.svgGroup).unbind("mouseup touchend"); + this.destroyOption(); }; - a._mouseWheel = function(b) { - b = b.originalEvent; - b.preventDefault(); - var a = Entry.disposeEvent; - a && a.notify(b); - this._scroller.scroll(-b.wheelDeltaY || b.deltaY / 3); + b.command = function() { + this._startValue && (this._startValue === this.getValue() || this._blockView.isInBlockMenu || Entry.do("setFieldValue", this._block, this, this.pointer(), this._startValue, this.getValue())); + delete this._startValue; }; - a.dominate = function(b) { - this.svgBlockGroup.appendChild(b.view.svgGroup); + b.destroyOption = function() { + this.documentDownEvent && (Entry.documentMousedown.detach(this.documentDownEvent), delete this.documentDownEvent); + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this.command(); }; - a.reDraw = function() { - this.selectMenu(this.lastSelector, !0); + b._attachDisposeEvent = function(a) { + var b = this; + b.disposeEvent = Entry.disposeEvent.attach(b, a || function() { + b.destroyOption(); + }); }; - a._handleDragBlock = function() { - this._boardBlockView = null; - this._scroller && this._scroller.setOpacity(0); + b.align = function(a, b, c) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (b = this._position.y)); + var f = "translate(" + a + "," + b + ")"; + void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:b}); }; - a._captureKeyEvent = function(b) { - var a = b.keyCode, d = Entry.type; - b.ctrlKey && "workspace" == d && 48 < a && 58 > a && (b.preventDefault(), this.selectMenu(a - 49)); + b.getAbsolutePosFromBoard = function() { + var a = this._block.view, b = a.getContentPos(), a = a.getAbsoluteCoordinate(); + return {x:a.x + this.box.x + b.x, y:a.y + this.box.y + b.y}; }; - a.setPatternRectFill = function(b) { - this.patternRect.attr({fill:b}); - this.pattern.attr({style:""}); + b.getAbsolutePosFromDocument = function() { + var a = this._block.view, b = a.getContentPos(), c = a.getAbsoluteCoordinate(), a = a.getBoard().svgDom.offset(); + return {x:c.x + this.box.x + b.x + a.left, y:c.y + this.box.y + b.y + a.top}; }; - a.disablePattern = function() { - this.pattern.attr({style:"display: none"}); + b.getRelativePos = function() { + var a = this._block.view.getContentPos(), b = this.box; + return {x:b.x + a.x, y:b.y + a.y}; }; - a._clearCategory = function() { - this._selectedCategoryView = null; - this._categories = []; - var b = this._categoryElems, a; - for (a in b) { - b[a].remove(); - } - this._categoryElems = {}; - b = this._categoryCodes; - for (a in b) { - var d = b[a]; - d.constructor == Entry.Code && d.clear(); - } - this._categoryCodes = null; + b.truncate = function() { + var a = String(this.getValue()), b = this.TEXT_LIMIT_LENGTH, c = a.substring(0, b); + a.length > b && (c += "..."); + return c; + }; + b.appendSvgOptionGroup = function() { + return this._block.view.getBoard().svgGroup.elem("g"); + }; + b.getValue = function() { + return this._block.params[this._index]; }; - a.setCategoryData = function(b) { - this._clearCategory(); - this._categoryData = b; - this._generateCategoryView(b); - this._generateCategoryCodes(b); + b.setValue = function(a, b) { + this.value != a && (this.value = a, this._block.params[this._index] = a, b && this._blockView.reDraw()); }; - a._generateCategoryView = function(b) { - if (b) { - for (var a = 0;a < b.length;a++) { - this._generateCategoryElement(b[a].category); - } + b._isEditable = function() { + if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { + return !1; + } + var a = this._block.view, b = a.getBoard(); + if (!0 === b.disableMouseEvent) { + return !1; } + var c = b.workspace.selectedBlockView; + if (!c || b != c.getBoard()) { + return !1; + } + b = a.getSvgRoot(); + return b == c.svgGroup || $(b).has($(a.svgGroup)); }; - a._generateCategoryElement = function(b) { - var a = this; - (function(b, c) { - b.text(Lang.Blocks[c.toUpperCase()]); - a._categoryElems[c] = b; - b.bindOnClick(function(b) { - a.selectMenu(c); - }); - })(Entry.Dom("li", {id:"entryCategory" + b, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), b); + b._selectBlockView = function() { + var a = this._block.view; + a.getBoard().setSelectedBlock(a); }; - a.updateOffset = function() { - this._offset = this.svgDom.offset(); + b._bindRenderOptions = function() { + var a = this; + $(this.svgGroup).bind("mouseup touchend", function(b) { + a._isEditable() && (a.destroyOption(), a._startValue = a.getValue(), a.renderOptions()); + }); }; - a.offset = function() { - (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); - return this._offset; + b.pointer = function(a) { + a = a || []; + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); }; - a._generateHwCode = function() { - var b = this._categoryCodes.arduino; - b instanceof Entry.Code && b.clear(); - for (var a = this._categoryData, d, b = a.length - 1;0 <= b;b--) { - if ("arduino" === a[b].category) { - d = a[b].blocks; - break; - } - } - a = []; - for (b = 0;b < d.length;b++) { - var e = d[b], f = Entry.block[e]; - if (!this.checkBanClass(f)) { - if (f && f.def) { - if (f.defs) { - for (b = 0;b < f.defs.length;b++) { - a.push([f.defs[b]]); - } - } else { - a.push([f.def]); - } - } else { - a.push([{type:e}]); - } - } - } - this._categoryCodes.arduino = a; + b.getFontSize = function(a) { + return a = a || this._blockView.getSkeleton().fontSize || 12; }; - a.setAlign = function(b) { - this._align = b || "CENTER"; + b.getContentHeight = function() { + return Entry.isMobile() ? 22 : 16; }; -})(Entry.BlockMenu.prototype); -Entry.BlockMenuScroller = function(a) { - var b = this; - this.board = a; - this.board.changeEvent.attach(this, this._reset); +})(Entry.Field.prototype); +Entry.FieldAngle = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; this.svgGroup = null; - this.vRatio = this.vY = this.vWidth = this.hX = 0; - this._visible = !0; - this._opacity = -1; - this.mouseHandler = function() { - b.onMouseDown.apply(b, arguments); - }; - this.createScrollBar(); - this.setOpacity(0); - this._addControl(); - Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); + this.position = b.position; + this._contents = b; + this._index = d; + b = this.getValue(); + this.setValue(this.modValue(void 0 !== b ? b : 90)); + this._CONTENT_HEIGHT = this.getContentHeight(); + this.renderStart(); }; -Entry.BlockMenuScroller.RADIUS = 7; -(function(a) { - a.createScrollBar = function() { - this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); - this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); - this.resizeScrollBar(); +Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); + this.textElement.textContent = this.getText(); + var a = this.getTextWidth(), b = this._CONTENT_HEIGHT, c = this.position && this.position.y ? this.position.y : 0; + this._header = this.svgGroup.elem("rect", {x:0, y:c - b / 2, rx:3, ry:3, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:b}); }; - a.resizeScrollBar = function() { - this._updateRatio(); - if (this._visible && 0 !== this.vRatio) { - var b = this.board.blockMenuContainer; - this.vScrollbar.attr({width:9, height:b.height() / this.vRatio, x:b.width() - 9}); + b.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); + }); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.value); + this.optionGroup.on("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + this.optionGroup.on("keyup", function(b) { + var d = b.keyCode || b.which; + a.applyValue(b); + -1 < [13, 27].indexOf(d) && a.destroyOption(); + }); + var b = this.getAbsolutePosFromDocument(); + b.y -= this.box.height / 2; + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); + this.svgOptionGroup = this.appendSvgOptionGroup(); + this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); + $(this.svgOptionGroup).on("mousedown touchstart", function(b) { + b.stopPropagation(); + a._updateByCoord(b); + }); + this._dividerGroup = this.svgOptionGroup.elem("g"); + for (b = 0;360 > b;b += 15) { + this._dividerGroup.elem("line", {x1:49, y1:0, x2:49 - (0 === b % 45 ? 10 : 5), y2:0, transform:"rotate(" + b + ", 0, 0)", class:"entry-angle-divider"}); } + b = this.getAbsolutePosFromBoard(); + b.x += this.box.width / 2; + b.y = b.y + this.box.height / 2 + 49 + 1; + this.svgOptionGroup.attr({class:"entry-field-angle", transform:"translate(" + b.x + "," + b.y + ")"}); + $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); + $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); + this.updateGraph(); + this.optionGroup.focus(); + this.optionGroup.select(); }; - a.updateScrollBar = function(b) { - this.vY += b; - this.vScrollbar.attr({y:this.vY}); - }; - a.scroll = function(b) { - this.isVisible() && (b = this._adjustValue(b) - this.vY, 0 !== b && (this.board.code.moveBy(0, -b * this.vRatio), this.updateScrollBar(b))); - }; - a._adjustValue = function(b) { - var a = this.board.svgDom.height(), a = a - a / this.vRatio; - b = this.vY + b; - b = Math.max(0, b); - return b = Math.min(a, b); + b._updateByCoord = function(a) { + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + a = [a.clientX, a.clientY]; + var b = this.getAbsolutePosFromDocument(); + this.optionGroup.val(this.modValue(function(a, b) { + var d = b[0] - a[0], g = b[1] - a[1] - 49 - 1, h = Math.atan(-g / d), h = Entry.toDegrees(h), h = 90 - h; + 0 > d ? h += 180 : 0 < g && (h += 360); + return 15 * Math.round(h / 15); + }([b.x + this.box.width / 2, b.y + this.box.height / 2 + 1], a))); + this.applyValue(); }; - a.setVisible = function(b) { - b != this.isVisible() && (this._visible = b, this.svgGroup.attr({display:!0 === b ? "block" : "none"})); + b.updateGraph = function() { + this._fillPath && this._fillPath.remove(); + var a = Entry.toRadian(this.getValue()), b = 49 * Math.sin(a), c = -49 * Math.cos(a), a = a > Math.PI ? 1 : 0; + this._fillPath = this.svgOptionGroup.elem("path", {d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X", b).replace("%Y", c).replace("%LARGE", a), class:"entry-angle-fill-area"}); + this.svgOptionGroup.appendChild(this._dividerGroup); + this._indicator && this._indicator.remove(); + this._indicator = this.svgOptionGroup.elem("line", {x1:0, y1:0, x2:b, y2:c}); + this._indicator.attr({class:"entry-angle-indicator"}); }; - a.setOpacity = function(b) { - this._opacity != b && (this.vScrollbar.attr({opacity:b}), this._opacity = b); + b.applyValue = function() { + var a = this.optionGroup.val(); + isNaN(a) || "" === a || (a = this.modValue(a), this.setValue(a), this.updateGraph(), this.textElement.textContent = this.getValue(), this.optionGroup && this.optionGroup.val(a), this.resize()); }; - a.isVisible = function() { - return this._visible; + b.resize = function() { + var a = this.getTextWidth(); + this._header.attr({width:a}); + this.optionGroup && this.optionGroup.css({width:a}); + this.box.set({width:a}); + this._block.view.alignContent(); }; - a._updateRatio = function() { - var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), d = b.blockMenuContainer.height(), b = b.offset(); - this.vRatio = a = (a.height + (a.top - b.top) + 10) / d; - 1 >= a ? this.setVisible(!1) : this.setVisible(!0); + b.getTextWidth = function() { + return this.textElement ? this.textElement.getComputedTextLength() + 8 : 8; }; - a._reset = function() { - this.vY = 0; - this.vScrollbar.attr({y:this.vY}); - this.resizeScrollBar(); + b.getText = function() { + return this.getValue() + "\u00b0"; }; - a.onMouseDown = function(b) { - function a(b) { - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - b = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - var a = e.dragInstance; - e.scroll(b.pageY - a.offsetY); - a.set({offsetY:b.pageY}); - } - function d(b) { - $(document).unbind(".scroll"); - delete e.dragInstance; - } - var e = this; - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - Entry.documentMousedown && Entry.documentMousedown.notify(b); - var f; - f = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - var g = $(document); - g.bind("mousemove.scroll", a); - g.bind("mouseup.scroll", d); - g.bind("touchmove.scroll", a); - g.bind("touchend.scroll", d); - e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); - } - b.stopPropagation(); + b.modValue = function(a) { + return a % 360; }; - a._addControl = function() { - $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); + b.destroyOption = function() { + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this.svgOptionGroup && (this.svgOptionGroup.remove(), delete this.svgOptionGroup); + this.textElement.textContent = this.getText(); + this.command(); }; -})(Entry.BlockMenuScroller.prototype); -Entry.BlockView = function(a, b, c) { - var d = this; +})(Entry.FieldAngle.prototype); +Entry.FieldBlock = function(b, a, d, c, e) { Entry.Model(this, !1); - this.block = a; - this._lazyUpdatePos = _.debounce(a._updatePos.bind(a), 200); - this._board = b; - this._observers = []; - this.set(a); - this.svgGroup = b.svgBlockGroup.elem("g"); - this._schema = Entry.block[a.type]; - if (void 0 === this._schema) { - this.block.destroy(!1, !1); - } else { - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - var e = this._skeleton = Entry.skeleton[this._schema.skeleton]; - this._contents = []; - this._statements = []; - this.magnet = {}; - this._paramMap = {}; - e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); - this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; - this.mouseHandler = function() { - var b = d.block.events; - b && b.mousedown && b.mousedown.forEach(function(b) { - b(d); - }); - d.onMouseDown.apply(d, arguments); - }; - this._startRender(a, c); - this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); - this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); - this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); - this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); - this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); - this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); - this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); - this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); - this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); - this._observers.push(b.code.observe(this, "_setBoard", ["board"], !1)); - this.dragMode = Entry.DRAG_MODE_NONE; - Entry.Utils.disableContextmenu(this.svgGroup.node); - b = a.events.viewAdd; - "workspace" == Entry.type && b && !this.isInBlockMenu && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(a); - }); - } + this._blockView = a; + this._block = a.block; + this._valueBlock = null; + this.box = new Entry.BoxModel; + this.changeEvent = new Entry.Event(this); + this._index = d; + this.contentIndex = e; + this._content = b; + this.acceptType = b.accept; + this._restoreCurrent = b.restore; + this.view = this; + this.svgGroup = null; + this._position = b.position; + this.box.observe(a, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(a.getBoard(), c); }; -Entry.BlockView.PARAM_SPACE = 5; -Entry.BlockView.DRAG_RADIUS = 5; -Entry.BlockView.pngMap = {}; -(function(a) { - a.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; - a._startRender = function(b, a) { - var c = this; - b = this._skeleton; - this.svgGroup.attr({class:"block"}); - var e = b.classes; - e && 0 !== e.length && e.forEach(function(b) { - c.svgGroup.addClass(b); - }); - e = b.path(this); - this.pathGroup = this.svgGroup.elem("g"); - this._updateMagnet(); - this._path = this.pathGroup.elem("path"); - this.getBoard().patternRect && ($(this._path).mouseenter(function(b) { - c._mouseEnable && c._changeFill(!0); - }), $(this._path).mouseleave(function(b) { - c._mouseEnable && c._changeFill(!1); - })); - var f = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (f = Entry.Utils.colorLighten(f)); - this._fillColor = f; - e = {d:e, fill:f, class:"blockPath"}; - if (this.magnet.next || this._skeleton.nextShadow) { - f = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + f + ")"}); +Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); +(function(b) { + b.schema = {magneting:!1}; + b.renderStart = function(a, b) { + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this.view = this; + this._nextGroup = this.svgGroup; + this.box.set({x:0, y:0, width:0, height:20}); + var c = this.getValue(); + c && !c.view && (c.setThread(this), c.createView(a, b), c.getThread().view.setParent(this)); + this.updateValueBlock(c); + this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); + }; + b.align = function(a, b, c) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (b = this._position.y)); + var f = this._valueBlock; + f && (b = -.5 * f.view.height); + f = "translate(" + a + "," + b + ")"; + void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:b}); + }; + b.calcWH = function() { + var a = this._valueBlock; + a ? (a = a.view, this.box.set({width:a.width, height:a.height})) : this.box.set({width:15, height:20}); + }; + b.calcHeight = b.calcWH; + b.destroy = function() { + }; + b.inspectBlock = function() { + var a = null; + if (this._originBlock) { + a = this._originBlock.type, delete this._originBlock; } else { - if (this.magnet.string || this.magnet.boolean) { - e.stroke = b.outerLine; + switch(this.acceptType) { + case "boolean": + a = "True"; + break; + case "string": + a = "text"; + break; + case "param": + a = "function_field_label"; } } - b.outerLine && (e["stroke-width"] = "0.6"); - this._path.attr(e); - this._moveTo(this.x, this.y, !1); - this._startContentRender(a); - !0 !== this._board.disableMouseEvent && this._addControl(); - this.bindPrev(); + return this._createBlockByType(a); }; - a._startContentRender = function(b) { - b = void 0 === b ? Entry.Workspace.MODE_BOARD : b; - this.contentSvgGroup && this.contentSvgGroup.remove(); - var a = this._schema; - a.statements && a.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); - this._contents = []; - this.contentSvgGroup = this.svgGroup.elem("g"); - a.statements && a.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); - switch(b) { - case Entry.Workspace.MODE_BOARD: - ; - case Entry.Workspace.MODE_OVERLAYBOARD: - for (var d = /(%\d)/mi, e = (a.template ? a.template : Lang.template[this.block.type]).split(d), f = a.params, g = 0;g < e.length;g++) { - var h = e[g].trim(); - if (0 !== h.length) { - if (d.test(h)) { - var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, b, g); - this._contents.push(h); - this._paramMap[k] = h; - } else { - this._contents.push(new Entry.FieldText({text:h}, this)); - } - } - } - if ((b = a.statements) && b.length) { - for (g = 0;g < b.length;g++) { - this._statements.push(new Entry.FieldStatement(b[g], this, g)); - } - } - break; - case Entry.Workspace.MODE_VIMBOARD: - if ("basic_button" === this._schema.skeleton) { - this._startContentRender(Entry.Workspace.MODE_BOARD); - return; - } - a = this.getBoard().workspace.getCodeToText(this.block); - b = !1; - /(if)+(.|\n)+(else)+/.test(a) && (g = a.split("\n"), a = g.shift() + " " + g.shift(), b = !0, g = g.join(" ")); - a = {text:a, color:"white"}; - this.block._schema.vimModeFontColor && (a.color = this.block._schema.vimModeFontColor); - this._contents.push(new Entry.FieldText(a, this)); - b && (this._contents.push(new Entry.FieldLineBreak(null, this)), a.text = g, this._contents.push(new Entry.FieldText(a, this))); - } - this.alignContent(!1); + b._setValueBlock = function(a) { + this._restoreCurrent && (this._originBlock = this._valueBlock); + a || (a = this.inspectBlock()); + this._valueBlock = a; + this.setValue(a); + a.setThread(this); + a.getThread().view.setParent(this); + return this._valueBlock; }; - a._updateSchema = function() { - this._startContentRender(); + b.getValueBlock = function() { + return this._valueBlock; }; - a.changeType = function(b) { - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this._schema = Entry.block[b]; - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - this._updateSchema(); + b.updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._destroyObservers(); + a = this._setValueBlock(a).view; + a.bindPrev(this); + this._blockView.alignContent(); + this._posObserver = a.observe(this, "updateValueBlock", ["x", "y"], !1); + this._sizeObserver = a.observe(this, "calcWH", ["width", "height"]); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); }; - a.alignContent = function(b) { - !0 !== b && (b = !1); - for (var a = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { - var l = this._contents[k]; - l instanceof Entry.FieldLineBreak ? (this._alignStatement(b, f), l.align(f), f++, d = l.box.y, a = 8) : (l.align(a, d, b), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (a += Entry.BlockView.PARAM_SPACE)); - l = l.box; - 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); - a += l.width; - g = Math.max(g, a); - this.set({contentWidth:g, contentHeight:e}); - } - this.set({contentHeight:e + h}); - this._statements.length != f && this._alignStatement(b, f); - b = this.getContentPos(); - this.contentSvgGroup.attr("transform", "translate(" + b.x + "," + b.y + ")"); - this.contentPos = b; - this._render(); - this._updateMagnet(); + b._destroyObservers = function() { + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); }; - a._alignStatement = function(b, a) { - var c = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[a]; - e && (a = c[a]) && e.align(a.x, a.y, b); + b.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; }; - a._render = function() { - this._renderPath(); - this.set(this._skeleton.box(this)); + b.getNextBlock = function() { + return null; + }; + b.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var b = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + b.x; + a.y += this.box.y + b.y; + return a; + }; + b.dominate = function() { + this._blockView.dominate(); + }; + b.isGlobal = function() { + return !1; + }; + b.separate = function(a) { + this.getCode().createThread([a]); + this.calcWH(); + this.changeEvent.notify(); + }; + b.getCode = function() { + return this._block.thread.getCode(); + }; + b.cut = function(a) { + return this._valueBlock === a ? [a] : null; + }; + b.replace = function(a) { + "string" === typeof a && (a = this._createBlockByType(a)); + var b = this._valueBlock; + Entry.block[b.type].isPrimitive ? (b.doNotSplice = !0, b.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), b.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(b)) : (this._destroyObservers(), b.view._toGlobalCoordinate(), this.separate(b), b.view.bumpAway(30, 150)); + this.updateValueBlock(a); + a.view._toLocalCoordinate(this.svgGroup); + this.calcWH(); + this.changeEvent.notify(); }; - a._renderPath = function() { - var b = this._skeleton.path(this); - this._path.attr({d:b}); - this.set({animating:!1}); + b.setParent = function(a) { + this._parent = a; }; - a._setPosition = function(b) { - this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); + b.getParent = function() { + return this._parent; }; - a._toLocalCoordinate = function(b) { - this._moveTo(0, 0, !1); - b.appendChild(this.svgGroup); + b._createBlockByType = function(a) { + this._block.getThread(); + var b = this._blockView.getBoard(); + a = new Entry.Block({type:a}, this); + var c = b.workspace, e; + c && (e = c.getMode()); + a.createView(b, e); + return a; }; - a._toGlobalCoordinate = function(b) { - b = this.getAbsoluteCoordinate(b); - this._moveTo(b.x, b.y, !1); - this.getBoard().svgBlockGroup.appendChild(this.svgGroup); + b.spliceBlock = function() { + this.updateValueBlock(); }; - a._moveTo = function(b, a, d) { - this.set({x:b, y:a}); - this._lazyUpdatePos(); - this.visible && this.display && this._setPosition(d); + b._updateBG = function() { + this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); }; - a._moveBy = function(b, a, d) { - return this._moveTo(this.x + b, this.y + a, d); + b.getThread = function() { + return this; }; - a._addControl = function() { - var b = this; - this._mouseEnable = !0; - $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", b.mouseHandler); - var a = b.block.events; - a && a.dblclick && $(this.svgGroup).dblclick(function() { - a.dblclick.forEach(function(a) { - a && a(b); - }); - }); + b.pointer = function(a) { + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); }; - a.removeControl = function() { - this._mouseEnable = !1; - $(this.svgGroup).unbind(".blockViewMousedown"); +})(Entry.FieldBlock.prototype); +Entry.FieldColor = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = b; + this._index = d; + this._position = b.position; + this.key = b.key; + this.setValue(this.getValue() || "#FF0000"); + this._CONTENT_HEIGHT = this.getContentHeight(); + this._CONTENT_WIDTH = this.getContentWidth(); + this.renderStart(a); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldColor); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); + var a = this._CONTENT_HEIGHT, b = this._CONTENT_WIDTH, c = this._position, e; + c ? (e = c.x || 0, c = c.y || 0) : (e = 0, c = -a / 2); + this._header = this.svgGroup.elem("rect", {x:e, y:c, width:b, height:a, fill:this.getValue()}); + this._bindRenderOptions(); + this.box.set({x:e, y:c, width:b, height:a}); }; - a.onMouseDown = function(b) { - function c(b) { - b.stopPropagation(); - var c = g.workspace.getMode(), d; - c === Entry.Workspace.MODE_VIMBOARD && a.vimBoardEvent(b, "dragOver"); - d = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); - if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { - e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(b) : (b = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), b = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, - offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), b && g.generateCodeMagnetMap(), f._updateCloseBlock())); - } - } - function d(b) { - e && (clearTimeout(e), e = null); - $(document).unbind(".block"); - f.terminateDrag(b); - g && g.set({dragBlock:null}); - f._changeFill(!1); - Entry.GlobalSvg.remove(); - delete this.mouseDownCoordinate; - delete f.dragInstance; - } - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - var e = null, f = this; - this._changeFill(!1); - var g = this.getBoard(); - Entry.documentMousedown && Entry.documentMousedown.notify(b); - if (!this.readOnly && !g.viewOnly) { - g.setSelectedBlock(this); - this.dominate(); - if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - var h = b.type, k; - k = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; - var l = $(document); - l.bind("mousemove.block touchmove.block", c); - l.bind("mouseup.block touchend.block", d); - this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); - g.set({dragBlock:this}); - this.addDragging(); - this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; - "touchstart" === h && (e = setTimeout(function() { - e && (e = null, d(), f._rightClick(b)); - }, 1E3)); - } else { - Entry.Utils.isRightButton(b) && this._rightClick(b); + b.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + var b = Entry.FieldColor.getWidgetColorList(); + this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); + for (var c = 0;c < b.length;c++) { + for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < b[c].length;f++) { + var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = b[c][f]; + g.css({"background-color":h}); + g.attr({"data-color-value":h}); + (function(b, c) { + b.mousedown(function(a) { + a.stopPropagation(); + }); + b.mouseup(function(b) { + a.applyValue(c); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, h); } - g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && (vimBoard = $(".entryVimBoard>.CodeMirror")[0], document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event))); } + b = this.getAbsolutePosFromDocument(); + b.y += this.box.height / 2 + 1; + this.optionGroup.css({left:b.x, top:b.y}); }; - a.vimBoardEvent = function(b, a, d) { - b && (b = Entry.Utils.createMouseEvent(a, b), d && (b.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b)); + b.applyValue = function(a) { + this.value != a && (this.setValue(a), this._header.attr({fill:a})); }; - a.terminateDrag = function(b) { - var a = this.getBoard(), d = this.dragMode, e = this.block, f = a.workspace.getMode(); - this.removeDragging(); - this.set({visible:!0}); - this.dragMode = Entry.DRAG_MODE_NONE; - if (f === Entry.Workspace.MODE_VIMBOARD) { - a instanceof Entry.BlockMenu ? (a.terminateDrag(), this.vimBoardEvent(b, "dragEnd", e)) : a.clear(); - } else { - if (d === Entry.DRAG_MODE_DRAG) { - var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg, h = this.block.getPrevBlock(this.block); - b = !1; - switch(Entry.GlobalSvg.terminateDrag(this)) { - case g.DONE: - g = a.magnetedBlockView; - g instanceof Entry.BlockView && (g = g.block); - h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, a.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), b = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", - e); - break; - case g.RETURN: - e = this.block; - d = this.originPos; - h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); - break; - case g.REMOVE: - createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); - } - a.setMagnetedBlock(null); - b && Entry.ConnectionRipple.setView(e.view).dispose(); - } + b.getContentWidth = function() { + return Entry.isMobile() ? 20 : 14.5; + }; +})(Entry.FieldColor.prototype); +Entry.FieldColor.getWidgetColorList = function() { + return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), + "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; +}; +Entry.FieldDropdown = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = b; + this._noArrow = b.noArrow; + this._arrowColor = b.arrowColor; + this._index = d; + this.setValue(this.getValue()); + this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); + this._FONT_SIZE = this.getFontSize(b.fontSize); + this._ROUND = b.roundValue || 3; + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this instanceof Entry.FieldDropdownDynamic && this._updateValue(); + var a = this._blockView, b = Entry.isMobile(), c = b ? 33 : 20, b = b ? 24 : 10; + this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); + this.textElement = this.svgGroup.elem("text", {x:5}); + this.textElement.textContent = this.getTextByValue(this.getValue()); + a = this.textElement.getBBox(); + this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * a.height}); + c = this.textElement.getBoundingClientRect().width + c; + this._noArrow && (c -= b); + b = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:c, height:b, y:-b / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._noArrow || (a = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:a.points, fill:a.color, stroke:a.color, transform:"translate(" + (c - a.width - 5) + "," + -a.height / 2 + ")"})); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:c, height:b}); + }; + b.resize = function() { + var a = Entry.isMobile(), b = a ? 33 : 20, a = a ? 24 : 10, b = this.textElement.getBoundingClientRect().width + b; + this._noArrow ? b -= a : (a = this.getArrow(), this._arrow.attr({transform:"translate(" + (b - a.width - 5) + "," + -a.height / 2 + ")"})); + this._header.attr({width:b}); + this.box.set({width:b}); + this._block.view.alignContent(); + }; + b.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + for (var b = this._contents.options, b = this._contents.options, c = 0, e = b.length;c < e;c++) { + var f = b[c], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); + Entry.Dom("span", {class:"right", parent:h}).text(g); + this.getValue() == f && k.text("\u2713"); + (function(b, c) { + b.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + b.bind("mouseup touchend", function(b) { + b.stopPropagation(); + a.applyValue(c); + a.destroyOption(); + a._selectBlockView(); + }); + })(h, f); } - this.destroyShadow(); - delete this.originPos; - this.dominate(); + this._position(); }; - a._updateCloseBlock = function() { - var b = this.getBoard(), a; - if (this._skeleton.magnets) { - for (var d in this.magnet) { - if (a = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { - return b.setMagnetedBlock(a.view, d); - } - } - b.setMagnetedBlock(null); + b._position = function() { + var a = this.getAbsolutePosFromDocument(); + a.y += this.box.height / 2; + var b = $(document).height(), c = this.optionGroup.height(), e = this.optionGroup.width() + 30; + if (b < a.y + c + 30) { + var b = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); + this._blockView.y < b / 2 ? (a.x += this.box.width / 2 - e / 2, b -= f.y + 30, this.optionGroup.height(b)) : (a.x += this.box.width + 1, b -= b - f.y, b - 30 < c && this.optionGroup.height(b - b % 30), a.y -= this.optionGroup.height()); + } else { + a.x += this.box.width / 2 - e / 2; } + this.optionGroup.addClass("rendered"); + this.optionGroup.css({left:a.x, top:a.y, width:e}); + this.optionGroup.find(".right").width(e - 20); }; - a.dominate = function() { - this.block.getThread().view.dominate(); + b.applyValue = function(a) { + this.value != a && this.setValue(a); + this.textElement.textContent = this.getTextByValue(a); + this.resize(); }; - a.getSvgRoot = function() { - for (var b = this.getBoard().svgBlockGroup, a = this.svgGroup;a.parentNode !== b;) { - a = a.parentNode; + b.getTextByValue = function(a) { + if (!a || "null" === a) { + return Lang.Blocks.no_target; } - return a; + for (var b = this._contents.options, c = 0, e = b.length;c < e;c++) { + var f = b[c]; + if (f[1] == a) { + return f[0]; + } + } + return Lang.Blocks.no_target; }; - a.getBoard = function() { - return this._board; + b.getContentHeight = function(a) { + return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); }; - a._setBoard = function() { - this._board = this._board.code.board; + b.getArrow = function() { + var a = Entry.isMobile(); + return {color:this._arrowColor || this._blockView._schema.color, points:a ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:a ? 13 : 4.2, width:a ? 19 : 6.4}; }; - a.destroy = function(b) { - $(this.svgGroup).unbind(".blockViewMousedown"); - this._destroyObservers(); - var a = this.svgGroup; - b ? $(a).fadeOut(100, function() { - a.remove(); - }) : a.remove(); - this._contents.forEach(function(b) { - b.constructor !== Entry.Block && b.destroy(); - }); - var d = this.block; - b = d.events.viewDestroy; - "workspace" == Entry.type && b && !this.isInBlockMenu && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(d); +})(Entry.FieldDropdown.prototype); +Entry.FieldDropdownDynamic = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = b; + this._index = d; + this._arrowColor = b.arrowColor; + d = this._contents.menuName; + Entry.Utils.isFunction(d) ? this._menuGenerator = d : this._menuName = d; + this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); + this._FONT_SIZE = this.getFontSize(b.fontSize); + this._ROUND = b.roundValue || 3; + this.renderStart(a); +}; +Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); +(function(b) { + b.constructor = Entry.FieldDropDownDynamic; + b._updateValue = function() { + var a = this._block.getCode().object, b = []; + Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); + this._contents.options = b; + a = this.getValue(); + if (this._blockView.isInBlockMenu || !a || "null" == a) { + a = 0 !== b.length ? b[0][1] : null; + } + this.setValue(a); + }; + b.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); }); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - }; - a.getShadow = function() { - this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); - return this._shadow; + var b; + b = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); + this._contents.options = b; + for (var c = 0;c < b.length;c++) { + var e = b[c], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); + Entry.Dom("span", {class:"right", parent:g}).text(f); + this.getValue() == e && h.text("\u2713"); + (function(b, c) { + b.mousedown(function(a) { + a.stopPropagation(); + }); + b.mouseup(function(b) { + b.stopPropagation(); + a.applyValue(c); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, e); + } + this._position(); }; - a.destroyShadow = function() { - this._shadow && (this._shadow.remove(), delete this._shadow); +})(Entry.FieldDropdownDynamic.prototype); +Entry.FieldImage = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this._content = b; + this.box = new Entry.BoxModel; + this._size = b.size; + this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; + this._position = b.position; + this._imgElement = this._path = this.svgGroup = null; + this._index = d; + this.setValue(null); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldImage); +(function(b) { + b.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); + this.box.set({x:this._size, y:0, width:this._size, height:this._size}); }; - a._updateMagnet = function() { - if (this._skeleton.magnets) { - var b = this._skeleton.magnets(this); - b.next && this._nextGroup.attr("transform", "translate(" + b.next.x + "," + b.next.y + ")"); - this.magnet = b; - this.block.getThread().changeEvent.notify(); - } +})(Entry.FieldImage.prototype); +Entry.FieldIndicator = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; + this._size = b.size; + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? b.img.replace(".png", "_un.png") : b.img; + this._boxMultiplier = b.boxMultiplier || 2; + this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; + this._position = b.position; + this._index = d; + this._imgElement = this._path = this.svgGroup = null; + this.setValue(null); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); +(function(b) { + b.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); + var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); + this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); + this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); }; - a._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - var b = this.svgGroup; - if (this.magnet.next) { - if (b = this.magneting) { - var a = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; - if ("previous" === b) { - e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; - } else { - if ("next" === b) { - e = this.magnet.previous; - var f = this._board.dragBlock.getBelowHeight(); - e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; - } - } - $(a).attr({transform:e, display:"block"}); - this._clonedShadow = a; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - "previous" === b && (b = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:b})); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), b = this.originalHeight, void 0 !== b && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:b}), delete this.originalHeight); - } - (b = this.block.thread.changeEvent) && b.notify(); - } else { - this.magneting ? (b.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), b.addClass("outputHighlight")) : (b.removeClass("outputHighlight"), b.removeAttr("filter")); - } - } + b.enableHighlight = function() { + var a = this._path.getTotalLength(), b = this._path; + this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":a + " " + a, "stroke-dashoffset":a}); + setInterval(function() { + b.attr({"stroke-dashoffset":a}).animate({"stroke-dashoffset":0}, 300); + }, 1400, mina.easeout); + setTimeout(function() { + setInterval(function() { + b.animate({"stroke-dashoffset":-a}, 300); + }, 1400, mina.easeout); + }, 500); }; - a.addDragging = function() { - this.svgGroup.addClass("dragging"); +})(Entry.FieldIndicator.prototype); +Entry.Keyboard = {}; +Entry.FieldKeyboard = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = b.position; + this._contents = b; + this._index = d; + this.setValue(String(this.getValue())); + this._CONTENT_HEIGHT = this.getContentHeight(); + this._optionVisible = !1; + this.renderStart(a); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); + this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; + var a = this.getTextWidth() + 1, b = this._CONTENT_HEIGHT, c = this.position && this.position.y ? this.position.y : 0; + this._header = this.svgGroup.elem("rect", {x:0, y:c - b / 2, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:b}); }; - a.removeDragging = function() { - this.svgGroup.removeClass("dragging"); + b.renderOptions = function() { + Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); + this._optionVisible = !0; + this._attachDisposeEvent(); + var a = this.getAbsolutePosFromDocument(); + a.x -= this.box.width / 2; + a.y += this.box.height / 2 + 1; + this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); + this.optionGroup.css({left:a.x, top:a.y}); }; - a.addSelected = function() { - this.svgGroup.addClass("selected"); + b.destroyOption = function() { + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this._optionVisible = !1; + this.command(); + this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); }; - a.removeSelected = function() { - this.svgGroup.removeClass("selected"); + b._keyboardControl = function(a) { + a.stopPropagation(); + if (this._optionVisible) { + a = a.keyCode; + var b = Entry.getKeyCodeMap()[a]; + void 0 !== b && this.applyValue(b, a); + } }; - a.getSkeleton = function() { - return this._skeleton; + b.applyValue = function(a, b) { + this.setValue(String(b)); + this.destroyOption(); + this.textElement.textContent = a; + this.resize(); }; - a.getContentPos = function() { - return this._skeleton.contentPos(this); + b.resize = function() { + var a = this.getTextWidth() + 1; + this._header.attr({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); }; - a.renderText = function() { - this._startContentRender(Entry.Workspace.MODE_VIMBOARD); + b.getTextWidth = function() { + return this.textElement.getComputedTextLength() + 10; }; - a.renderBlock = function() { - this._startContentRender(Entry.Workspace.MODE_BOARD); + b.destroy = function() { + this.destroyOption(); + Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); }; - a._updateOpacity = function() { - this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); - this.visible && this._setPosition(); +})(Entry.FieldKeyboard.prototype); +Entry.FieldLineBreak = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this._index = d; + this.box = new Entry.BoxModel; + this.setValue(null); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); +(function(b) { + b.renderStart = function() { }; - a._updateShadow = function() { - this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); + b.align = function(a) { + var b = this._blockView; + 0 !== b._statements.length && this.box.set({y:(b._statements[a].height || 20) + Math.max(b.contentHeight % 1E3, 30)}); }; - a._setMovable = function() { - this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; +})(Entry.FieldLineBreak.prototype); +Entry.FieldOutput = function(b, a, d, c, e) { + Entry.Model(this, !1); + this._blockView = a; + this._block = a.block; + this._valueBlock = null; + this.box = new Entry.BoxModel; + this.changeEvent = new Entry.Event(this); + this._index = d; + this.contentIndex = e; + this._content = b; + this.acceptType = b.accept; + this.view = this; + this.svgGroup = null; + this._position = b.position; + this.box.observe(a, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(a.getBoard(), c); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); +(function(b) { + b.schema = {magneting:!1}; + b.renderStart = function(a, b) { + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this.view = this; + this._nextGroup = this.svgGroup; + this.box.set({x:0, y:0, width:0, height:20}); + var c = this.getValue(); + c && !c.view && (c.setThread(this), c.createView(a, b)); + this._updateValueBlock(c); + this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); }; - a._setReadOnly = function() { - this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; + b.align = function(a, b, c) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (b = this._position.y)); + var f = this._valueBlock; + f && (b = -.5 * f.view.height); + f = "translate(" + a + "," + b + ")"; + void 0 === c || c ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:b}); }; - a._setCopyable = function() { - this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; + b.calcWH = function() { + var a = this._valueBlock; + a ? (a = a.view, this.box.set({width:a.width, height:a.height})) : this.box.set({width:0, height:20}); }; - a.bumpAway = function(b, a) { - var c = this; - b = b || 15; - a ? window.setTimeout(function() { - c._moveBy(b, b, !1); - }, a) : c._moveBy(b, b, !1); + b.calcHeight = b.calcWH; + b.destroy = function() { }; - a.bindPrev = function(b) { - if (b) { - if (this._toLocalCoordinate(b.view._nextGroup), (b = b.getNextBlock()) && b !== this.block) { - var a = this.block.getLastBlock(); - a.view.magnet.next ? b.view._toLocalCoordinate(a.view._nextGroup) : (b.view._toGlobalCoordinate(), b.separate(), b.view.bumpAway(null, 100)); - } - } else { - if (b = this.block.getPrevBlock()) { - this._toLocalCoordinate(b.view._nextGroup), (b = this.block.getNextBlock()) && b.view && b.view._toLocalCoordinate(this._nextGroup); - } - } + b._inspectBlock = function() { }; - a.getAbsoluteCoordinate = function(b) { - b = void 0 !== b ? b : this.dragMode; - if (b === Entry.DRAG_MODE_DRAG) { - return {x:this.x, y:this.y}; + b._setValueBlock = function(a) { + if (a != this._valueBlock || !this._valueBlock) { + return this._valueBlock = a, this.setValue(a), a && a.setThread(this), this._valueBlock; } - b = this.block.getThread().view.requestAbsoluteCoordinate(this); - b.x += this.x; - b.y += this.y; - return b; - }; - a.getBelowHeight = function() { - return this.block.getThread().view.requestPartHeight(this); - }; - a._updateDisplay = function() { - this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); - this.display && this._setPosition(); }; - a._updateColor = function() { - var b = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (b = Entry.Utils.colorLighten(b)); - this._fillColor = b; - this._path.attr({fill:b}); - this._updateContents(); + b._updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); + (a = this._setValueBlock(a)) ? (a = a.view, a.bindPrev(), this._posObserver = a.observe(this, "_updateValueBlock", ["x", "y"], !1), this._sizeObserver = a.observe(this, "calcWH", ["width", "height"])) : this.calcWH(); + this._blockView.alignContent(); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); }; - a._updateContents = function() { - for (var b = 0;b < this._contents.length;b++) { - this._contents[b].renderStart(); - } - this.alignContent(!1); + b.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; }; - a._destroyObservers = function() { - for (var b = this._observers;b.length;) { - b.pop().destroy(); - } + b.getNextBlock = function() { + return null; }; - a._changeFill = function(b) { - var a = this.getBoard(); - if (a.patternRect && !a.dragBlock) { - var d = this._fillColor, e = this._path, a = this.getBoard(); - b ? (a.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : a.disablePattern(); - e.attr({fill:d}); - } + b.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var b = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + b.x; + a.y += this.box.y + b.y; + return a; }; - a.addActivated = function() { - this.svgGroup.addClass("activated"); + b.dominate = function() { + this._blockView.dominate(); }; - a.removeActivated = function() { - this.svgGroup.removeClass("activated"); + b.isGlobal = function() { + return !1; }; - a.reDraw = function() { - if (this.visible) { - var b = this.block; - requestAnimFrame(this._updateContents.bind(this)); - var a = b.params; - if (a) { - for (var d = 0;d < a.length;d++) { - var e = a[d]; - e instanceof Entry.Block && e.view.reDraw(); - } - } - if (b = b.statements) { - for (d = 0;d < b.length;d++) { - b[d].view.reDraw(); - } - } - } + b.separate = function(a) { + this.getCode().createThread([a]); + this.changeEvent.notify(); }; - a.getParam = function(b) { - return this._paramMap[b]; + b.getCode = function() { + return this._block.thread.getCode(); }; - a.getDataUrl = function(b, a) { - function c() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * l).replace("%H", h.height * l).replace("(defs)", (new XMLSerializer).serializeToString(n[0])).replace(/>\s+/g, ">").replace(/\s+ a && (d += "..."); - return d; + b.getValue = function() { + return this.block.statements[this._index]; }; - a.appendSvgOptionGroup = function() { - return this._block.view.getBoard().svgGroup.elem("g"); + b.requestAbsoluteCoordinate = function() { + var a = this._blockView.getAbsoluteCoordinate(); + a.x += this.x; + a.y += this.y; + return a; }; - a.getValue = function() { - return this._block.params[this._index]; + b.dominate = function() { + this._blockView.dominate(); }; - a.setValue = function(b, a) { - this.value != b && (this.value = b, this._block.params[this._index] = b, a && this._blockView.reDraw()); + b.destroy = function() { }; - a._isEditable = function() { - if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { - return !1; - } - var b = this._block.view, a = b.getBoard(); - if (!0 === a.disableMouseEvent) { - return !1; - } - var d = a.workspace.selectedBlockView; - if (!d || a != d.getBoard()) { - return !1; + b._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + if (this.magneting) { + var a = this._board.dragBlock.getShadow(), b = this.requestAbsoluteCoordinate(), b = "translate(" + b.x + "," + b.y + ")"; + $(a).attr({transform:b, display:"block"}); + this._clonedShadow = a; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + a = this._board.dragBlock.getBelowHeight(); + this.statementSvgGroup.attr({transform:"translate(0," + a + ")"}); + this.set({height:this.height + a}); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); + } + (a = this.block.thread.changeEvent) && a.notify(); } - a = b.getSvgRoot(); - return a == d.svgGroup || $(a).has($(b.svgGroup)); - }; - a._selectBlockView = function() { - var b = this._block.view; - b.getBoard().setSelectedBlock(b); }; - a._bindRenderOptions = function() { - var b = this; - $(this.svgGroup).bind("mouseup touchend", function(a) { - b._isEditable() && (b.destroyOption(), b._startValue = b.getValue(), b.renderOptions()); - }); + b.insertTopBlock = function(a) { + this._posObserver && this._posObserver.destroy(); + var b = this.firstBlock; + (this.firstBlock = a) && a.doInsert(this._thread); + return b; }; - a.pointer = function(b) { - b = b || []; - b.unshift(this._index); - b.unshift(Entry.PARAM); - return this._block.pointer(b); + b.getNextBlock = function() { + return this.firstBlock; }; - a.getFontSize = function(b) { - return b = b || this._blockView.getSkeleton().fontSize || 12; + b.checkTopBlock = function() { + var a = this._thread.getFirstBlock(); + a && this.firstBlock !== a ? (this.firstBlock = a, a.view.bindPrev(this), a._updatePos()) : a || (this.firstBlock = null); }; - a.getContentHeight = function() { - return Entry.isMobile() ? 22 : 16; +})(Entry.FieldStatement.prototype); +Entry.FieldText = function(b, a, d) { + this._block = a.block; + this._blockView = a; + this._index = d; + this.box = new Entry.BoxModel; + this._fontSize = b.fontSize || a.getSkeleton().fontSize || 12; + this._color = b.color || this._block.getSchema().fontColor || a.getSkeleton().color || "white"; + this._align = b.align || "left"; + this._text = this.getValue() || b.text; + this.setValue(null); + this.textElement = null; + this.renderStart(a); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldText); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); + this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); + this.textElement.textContent = this._text; + var a = 0, b = this.textElement.getBoundingClientRect(); + "center" == this._align && (a = -b.width / 2); + this.textElement.attr({x:a, y:.25 * b.height}); + this.box.set({x:0, y:0, width:b.width, height:b.height}); }; -})(Entry.Field.prototype); -Entry.FieldBlock = function(a, b, c, d, e) { - Entry.Model(this, !1); - this._blockView = b; - this._block = b.block; - this._valueBlock = null; +})(Entry.FieldText.prototype); +Entry.FieldTextInput = function(b, a, d) { + this._blockView = a; + this._block = a.block; this.box = new Entry.BoxModel; - this.changeEvent = new Entry.Event(this); - this._index = c; - this.contentIndex = e; - this._content = a; - this.acceptType = a.accept; - this._restoreCurrent = a.restore; - this.view = this; this.svgGroup = null; - this._position = a.position; - this.box.observe(b, "alignContent", ["width", "height"]); - this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(b.getBoard(), d); + this.position = b.position; + this._contents = b; + this._index = d; + this.value = this.getValue() || ""; + this._CONTENT_HEIGHT = this.getContentHeight(); + this.renderStart(); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); -(function(a) { - a.schema = {magneting:!1}; - a.renderStart = function(b, a) { +Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); +(function(b) { + b.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this.view = this; - this._nextGroup = this.svgGroup; - this.box.set({x:0, y:0, width:0, height:20}); - var c = this.getValue(); - c && !c.view && (c.setThread(this), c.createView(b, a), c.getThread().view.setParent(this)); - this.updateValueBlock(c); - this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); + this.svgGroup.attr({class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); + this.textElement.textContent = this.truncate(); + var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0, c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:a, height:c, y:b - c / 2, rx:3, ry:3, fill:"transparent"}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:c}); }; - a.align = function(b, a, d) { - var c = this.svgGroup; - this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); - var f = this._valueBlock; - f && (a = -.5 * f.view.height); - f = "translate(" + b + "," + a + ")"; - void 0 === d || d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); - this.box.set({x:b, y:a}); + b.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); + }); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.getValue()); + this.optionGroup.on("mousedown", function(a) { + a.stopPropagation(); + }); + this.optionGroup.on("keyup", function(b) { + var d = b.keyCode || b.which; + a.applyValue(b); + -1 < [13, 27].indexOf(d) && a.destroyOption(); + }); + var b = this.getAbsolutePosFromDocument(); + b.y -= this.box.height / 2; + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); + this.optionGroup.focus(); + b = this.optionGroup[0]; + b.setSelectionRange(0, b.value.length, "backward"); }; - a.calcWH = function() { - var b = this._valueBlock; - b ? (b = b.view, this.box.set({width:b.width, height:b.height})) : this.box.set({width:15, height:20}); + b.applyValue = function(a) { + a = this.optionGroup.val(); + this.setValue(a); + this.textElement.textContent = this.truncate(); + this.resize(); }; - a.calcHeight = a.calcWH; - a.destroy = function() { + b.resize = function() { + var a = this.getTextWidth(); + this._header.attr({width:a}); + this.optionGroup.css({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); }; - a.inspectBlock = function() { - var b = null; - if (this._originBlock) { - b = this._originBlock.type, delete this._originBlock; - } else { - switch(this.acceptType) { - case "boolean": - b = "True"; - break; - case "string": - b = "text"; - break; - case "param": - b = "function_field_label"; - } - } - return this._createBlockByType(b); + b.getTextWidth = function() { + return this.textElement.getBoundingClientRect().width + 6 + 2; }; - a._setValueBlock = function(b) { - this._restoreCurrent && (this._originBlock = this._valueBlock); - b || (b = this.inspectBlock()); - this._valueBlock = b; - this.setValue(b); - b.setThread(this); - b.getThread().view.setParent(this); - return this._valueBlock; +})(Entry.FieldTextInput.prototype); +Entry.GlobalSvg = {}; +(function(b) { + b.DONE = 0; + b._inited = !1; + b.REMOVE = 1; + b.RETURN = 2; + b.createDom = function() { + if (!this.inited) { + $("#globalSvgSurface").remove(); + $("#globalSvg").remove(); + var a = $("body"); + this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:a}); + this.svgDom = Entry.Dom($(''), {parent:this._container}); + this.svg = Entry.SVG("globalSvg"); + this.top = this.left = 0; + this._inited = !0; + } }; - a.getValueBlock = function() { - return this._valueBlock; + b.setView = function(a, b) { + if (a != this._view && !a.block.isReadOnly() && a.movable) { + return this._view = a, this._mode = b, b !== Entry.Workspace.MODE_VIMBOARD && a.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; + } }; - a.updateValueBlock = function(b) { - b instanceof Entry.Block || (b = void 0); - this._destroyObservers(); - b = this._setValueBlock(b).view; - b.bindPrev(this); - this._blockView.alignContent(); - this._posObserver = b.observe(this, "updateValueBlock", ["x", "y"], !1); - this._sizeObserver = b.observe(this, "calcWH", ["width", "height"]); - b = this._blockView.getBoard(); - b.constructor === Entry.Board && b.generateCodeMagnetMap(); + b.draw = function() { + var a = this._view; + this._svg && this.remove(); + var b = this._mode == Entry.Workspace.MODE_VIMBOARD; + this.svgGroup = Entry.SVG.createElement(a.svgGroup.cloneNode(!0), {opacity:1}); + this.svg.appendChild(this.svgGroup); + b && (a = $(this.svgGroup), a.find("g").css({filter:"none"}), a.find("path").velocity({opacity:0}, {duration:500}), a.find("text").velocity({fill:"#000000"}, {duration:530})); }; - a._destroyObservers = function() { - this._sizeObserver && this._sizeObserver.destroy(); - this._posObserver && this._posObserver.destroy(); + b.remove = function() { + this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); }; - a.getPrevBlock = function(b) { - return this._valueBlock === b ? this : null; + b.align = function() { + var a = this._view.getSkeleton().box(this._view).offsetX || 0, b = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, b = -1 * b + 1; + this._offsetX = a; + this._offsetY = b; + this.svgGroup.attr({transform:"translate(" + a + "," + b + ")"}); }; - a.getNextBlock = function() { - return null; + b.show = function() { + this._container.removeClass("entryRemove"); }; - a.requestAbsoluteCoordinate = function(b) { - b = this._blockView; - var a = b.contentPos; - b = b.getAbsoluteCoordinate(); - b.x += this.box.x + a.x; - b.y += this.box.y + a.y; - return b; + b.hide = function() { + this._container.addClass("entryRemove"); }; - a.dominate = function() { - this._blockView.dominate(); + b.position = function() { + var a = this._view; + if (a) { + var b = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); + this.left = b.x + a.left - this._offsetX; + this.top = b.y + a.top - this._offsetY; + this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); + } }; - a.isGlobal = function() { - return !1; + b.terminateDrag = function(a) { + var b = Entry.mouseCoordinate, c = a.getBoard(), e = c.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; + return b.y > c.offset().top - 20 && b.x > f + h ? this.DONE : b.y > g && b.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; }; - a.separate = function(b) { - this.getCode().createThread([b]); - this.calcWH(); - this.changeEvent.notify(); + b.addControl = function(a) { + this.onMouseDown.apply(this, arguments); }; - a.getCode = function() { - return this._block.thread.getCode(); + b.onMouseDown = function(a) { + function b(a) { + var c = a.pageX; + a = a.pageY; + var d = e.left + (c - e._startX), f = e.top + (a - e._startY); + e.svgDom.css({transform:"translate3d(" + d + "px," + f + "px, 0px)"}); + e._startX = c; + e._startY = a; + e.left = d; + e.top = f; + } + function c(a) { + $(document).unbind(".block"); + } + this._startY = a.pageY; + var e = this; + a.stopPropagation(); + a.preventDefault(); + var f = $(document); + f.bind("mousemove.block", b); + f.bind("mouseup.block", c); + f.bind("touchmove.block", b); + f.bind("touchend.block", c); + this._startX = a.pageX; + this._startY = a.pageY; }; - a.cut = function(b) { - return this._valueBlock === b ? [b] : null; +})(Entry.GlobalSvg); +Entry.Mutator = function() { +}; +(function(b) { + b.mutate = function(a, b) { + var c = Entry.block[a]; + void 0 === c.changeEvent && (c.changeEvent = new Entry.Event); + c.template = b.template; + c.params = b.params; + c.changeEvent.notify(1); }; - a.replace = function(b) { - "string" === typeof b && (b = this._createBlockByType(b)); - var a = this._valueBlock; - Entry.block[a.type].isPrimitive ? (a.doNotSplice = !0, a.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), a.view._toGlobalCoordinate(), b.getTerminateOutputBlock().view._contents[1].replace(a)) : (this._destroyObservers(), a.view._toGlobalCoordinate(), this.separate(a), a.view.bumpAway(30, 150)); - this.updateValueBlock(b); - b.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); - this.changeEvent.notify(); +})(Entry.Mutator); +(function(b) { +})(Entry.Mutator.prototype); +Entry.RenderView = function(b, a) { + this._align = a || "CENTER"; + b = "string" === typeof b ? $("#" + b) : $(b); + if ("DIV" !== b.prop("tagName")) { + return console.error("Dom is not div element"); + } + this.view = b; + this.viewOnly = !0; + this.suffix = "renderView"; + this.disableMouseEvent = this.visible = !0; + this._svgId = "renderView_" + (new Date).getTime(); + this._generateView(); + this.offset = this.svgDom.offset(); + this.setWidth(); + this.svg = Entry.SVG(this._svgId); + Entry.Utils.addFilters(this.svg, this.suffix); + this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); +}; +(function(b) { + b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; + b._generateView = function() { + this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); + this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); }; - a.setParent = function(b) { - this._parent = b; + b.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { + return console.error("You must inject code instance"); + } + this.code = a; + this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); + a.createView(this); + this.align(); + this.resize(); }; - a.getParent = function() { - return this._parent; + b.align = function() { + var a = this.code.getThreads(); + if (a && 0 !== a.length) { + for (var b = 0, c = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { + var g = a[e].getFirstBlock().view; + g._moveTo(c, b - g.offsetY, !1); + g = g.svgGroup.getBBox().height; + b += g + 15; + } + this._bBox = this.svgGroup.getBBox(); + this.height = this._bBox.height; + } }; - a._createBlockByType = function(b) { - this._block.getThread(); - var a = this._blockView.getBoard(); - b = new Entry.Block({type:b}, this); - var d = a.workspace, e; - d && (e = d.getMode()); - b.createView(a, e); - return b; + b.hide = function() { + this.view.addClass("entryRemove"); }; - a.spliceBlock = function() { - this.updateValueBlock(); + b.show = function() { + this.view.removeClass("entryRemove"); }; - a._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); + b.setWidth = function() { + this._svgWidth = this.svgDom.width(); + this.offset = this.svgDom.offset(); }; - a.getThread = function() { - return this; + b.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); }; - a.pointer = function(b) { - b.unshift(this._index); - b.unshift(Entry.PARAM); - return this._block.pointer(b); + b.resize = function() { + this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); }; -})(Entry.FieldBlock.prototype); -Entry.Scroller = function(a, b, c) { - this._horizontal = void 0 === b ? !0 : b; - this._vertical = void 0 === c ? !0 : c; - this.board = a; +})(Entry.RenderView.prototype); +Entry.Scroller = function(b, a, d) { + this._horizontal = void 0 === a ? !0 : a; + this._vertical = void 0 === d ? !0 : d; + this.board = b; this.svgGroup = null; this.vRatio = this.vY = this.vWidth = this.hRatio = this.hX = this.hWidth = 0; this._visible = !0; @@ -23707,113 +23224,113 @@ Entry.Scroller = function(a, b, c) { this._scrollCommand = _.debounce(Entry.do, 200); }; Entry.Scroller.RADIUS = 7; -(function(a) { - a.createScrollBar = function() { - var b = Entry.Scroller.RADIUS, a = this; +(function(b) { + b.createScrollBar = function() { + var a = Entry.Scroller.RADIUS, b = this; this.svgGroup = this.board.svg.elem("g").attr({class:"boardScrollbar"}); - this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * b, rx:b, ry:b}), this.hScrollbar.mousedown = function(b) { - function c(b) { - b.stopPropagation(); - b.preventDefault(); - b.originalEvent.touches && (b = b.originalEvent.touches[0]); - var c = a.dragInstance; - a.scroll((b.pageX - c.offsetX) / a.hRatio, 0); - c.set({offsetX:b.pageX, offsetY:b.pageY}); - } - function d(b) { + this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * a, rx:a, ry:a}), this.hScrollbar.mousedown = function(a) { + function e(a) { + a.stopPropagation(); + a.preventDefault(); + a.originalEvent.touches && (a = a.originalEvent.touches[0]); + var c = b.dragInstance; + b.scroll((a.pageX - c.offsetX) / b.hRatio, 0); + c.set({offsetX:a.pageX, offsetY:a.pageY}); + } + function f(a) { $(document).unbind(".scroll"); - delete a.dragInstance; + delete b.dragInstance; } - if (0 === b.button || b instanceof Touch) { - Entry.documentMousedown && Entry.documentMousedown.notify(b); + if (0 === a.button || a instanceof Touch) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); var g = $(document); - g.bind("mousemove.scroll", c); - g.bind("mouseup.scroll", d); - g.bind("touchmove.scroll", c); - g.bind("touchend.scroll", d); - a.dragInstance = new Entry.DragInstance({startX:b.pageX, startY:b.pageY, offsetX:b.pageX, offsetY:b.pageY}); + g.bind("mousemove.scroll", e); + g.bind("mouseup.scroll", f); + g.bind("touchmove.scroll", e); + g.bind("touchend.scroll", f); + b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } - b.stopPropagation(); + a.stopPropagation(); }); - this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * b, rx:b, ry:b}), this.vScrollbar.mousedown = function(b) { - function c(b) { - b.stopPropagation(); - b.preventDefault(); - b.originalEvent.touches && (b = b.originalEvent.touches[0]); - var c = a.dragInstance; - a.scroll(0, (b.pageY - c.offsetY) / a.vRatio); - c.set({offsetX:b.pageX, offsetY:b.pageY}); - } - function d(b) { + this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * a, rx:a, ry:a}), this.vScrollbar.mousedown = function(a) { + function e(a) { + a.stopPropagation(); + a.preventDefault(); + a.originalEvent.touches && (a = a.originalEvent.touches[0]); + var c = b.dragInstance; + b.scroll(0, (a.pageY - c.offsetY) / b.vRatio); + c.set({offsetX:a.pageX, offsetY:a.pageY}); + } + function f(a) { $(document).unbind(".scroll"); - delete a.dragInstance; + delete b.dragInstance; } - if (0 === b.button || b instanceof Touch) { - Entry.documentMousedown && Entry.documentMousedown.notify(b); + if (0 === a.button || a instanceof Touch) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); var g = $(document); - g.bind("mousemove.scroll", c); - g.bind("mouseup.scroll", d); - g.bind("touchmove.scroll", c); - g.bind("touchend.scroll", d); - a.dragInstance = new Entry.DragInstance({startX:b.pageX, startY:b.pageY, offsetX:b.pageX, offsetY:b.pageY}); + g.bind("mousemove.scroll", e); + g.bind("mouseup.scroll", f); + g.bind("touchmove.scroll", e); + g.bind("touchend.scroll", f); + b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } - b.stopPropagation(); + a.stopPropagation(); }); }; - a.updateScrollBar = function(b, a) { - this._horizontal && (this.hX += b * this.hRatio, this.hScrollbar.attr({x:this.hX})); - this._vertical && (this.vY += a * this.vRatio, this.vScrollbar.attr({y:this.vY})); + b.updateScrollBar = function(a, b) { + this._horizontal && (this.hX += a * this.hRatio, this.hScrollbar.attr({x:this.hX})); + this._vertical && (this.vY += b * this.vRatio, this.vScrollbar.attr({y:this.vY})); }; - a.scroll = function(b, a) { + b.scroll = function(a, b) { if (this.board.code) { var c = this.board.svgBlockGroup.getBoundingClientRect(), e = this.board.svgDom, f = c.left - this.board.offset().left, g = c.top - this.board.offset().top, h = c.height; - b = Math.max(-c.width + Entry.BOARD_PADDING - f, b); - a = Math.max(-h + Entry.BOARD_PADDING - g, a); - b = Math.min(e.width() - Entry.BOARD_PADDING - f, b); - a = Math.min(e.height() - Entry.BOARD_PADDING - g, a); - this._scroll(b, a); + a = Math.max(-c.width + Entry.BOARD_PADDING - f, a); + b = Math.max(-h + Entry.BOARD_PADDING - g, b); + a = Math.min(e.width() - Entry.BOARD_PADDING - f, a); + b = Math.min(e.height() - Entry.BOARD_PADDING - g, b); + this._scroll(a, b); this._diffs || (this._diffs = [0, 0]); - this._diffs[0] += b; - this._diffs[1] += a; + this._diffs[0] += a; + this._diffs[1] += b; this._scrollCommand("scrollBoard", this._diffs[0], this._diffs[1], !0); } }; - a._scroll = function(b, a) { - this.board.code.moveBy(b, a); - this.updateScrollBar(b, a); + b._scroll = function(a, b) { + this.board.code.moveBy(a, b); + this.updateScrollBar(a, b); }; - a.setVisible = function(b) { - b != this.isVisible() && (this._visible = b, this.svgGroup.attr({display:!0 === b ? "block" : "none"})); + b.setVisible = function(a) { + a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); }; - a.isVisible = function() { + b.isVisible = function() { return this._visible; }; - a.setOpacity = function(b) { - this._opacity != b && (this.hScrollbar.attr({opacity:b}), this.vScrollbar.attr({opacity:b}), this._opacity = b); + b.setOpacity = function(a) { + this._opacity != a && (this.hScrollbar.attr({opacity:a}), this.vScrollbar.attr({opacity:a}), this._opacity = a); }; - a.resizeScrollBar = function() { + b.resizeScrollBar = function() { if (this._visible) { - var b = this.board, a = b.svgBlockGroup.getBoundingClientRect(), d = b.svgDom, e = d.width(), d = d.height(), f = a.left - b.offset().left, b = a.top - b.offset().top, g = a.width, a = a.height; + var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), c = a.svgDom, e = c.width(), c = c.height(), f = b.left - a.offset().left, a = b.top - a.offset().top, g = b.width, b = b.height; if (this._horizontal) { var h = -g + Entry.BOARD_PADDING, k = e - Entry.BOARD_PADDING, g = (e + 2 * Entry.Scroller.RADIUS) * g / (k - h + g); isNaN(g) && (g = 0); this.hX = (f - h) / (k - h) * (e - g - 2 * Entry.Scroller.RADIUS); - this.hScrollbar.attr({width:g, x:this.hX, y:d - 2 * Entry.Scroller.RADIUS}); + this.hScrollbar.attr({width:g, x:this.hX, y:c - 2 * Entry.Scroller.RADIUS}); this.hRatio = (e - g - 2 * Entry.Scroller.RADIUS) / (k - h); } - this._vertical && (f = -a + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, a = (d + 2 * Entry.Scroller.RADIUS) * a / (g - f + a), this.vY = (b - f) / (g - f) * (d - a - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:a, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - a - 2 * Entry.Scroller.RADIUS) / (g - f)); + this._vertical && (f = -b + Entry.BOARD_PADDING, g = c - Entry.BOARD_PADDING, b = (c + 2 * Entry.Scroller.RADIUS) * b / (g - f + b), this.vY = (a - f) / (g - f) * (c - b - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:b, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (c - b - 2 * Entry.Scroller.RADIUS) / (g - f)); } }; - a._bindEvent = function() { - var b = _.debounce(this.resizeScrollBar, 200); - this.board.changeEvent.attach(this, b); - Entry.windowResized && Entry.windowResized.attach(this, b); + b._bindEvent = function() { + var a = _.debounce(this.resizeScrollBar, 200); + this.board.changeEvent.attach(this, a); + Entry.windowResized && Entry.windowResized.attach(this, a); }; })(Entry.Scroller.prototype); -Entry.Board = function(a) { +Entry.Board = function(b) { Entry.Model(this, !1); this.changeEvent = new Entry.Event(this); - this.createView(a); + this.createView(b); this.updateOffset(); this.scroller = new Entry.Scroller(this, !0, !0); this._magnetMap = {}; @@ -23829,326 +23346,325 @@ Entry.Board.OPTION_ALIGN = 1; Entry.Board.OPTION_CLEAR = 2; Entry.Board.OPTION_DOWNLOAD = 3; Entry.Board.DRAG_RADIUS = 5; -(function(a) { - a.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; - a.createView = function(b) { - var a = b.dom, a = "string" === typeof a ? $("#" + a) : $(a); - if ("DIV" !== a.prop("tagName")) { +(function(b) { + b.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; + b.createView = function(a) { + var b = a.dom, b = "string" === typeof b ? $("#" + b) : $(b); + if ("DIV" !== b.prop("tagName")) { return console.error("Dom is not div element"); } - this.view = a; + this.view = b; this._svgId = "play" + (new Date).getTime(); - this.workspace = b.workspace; + this.workspace = a.workspace; this._activatedBlockView = null; - this.wrapper = Entry.Dom("div", {parent:a, class:"entryBoardWrapper"}); + this.wrapper = Entry.Dom("div", {parent:b, class:"entryBoardWrapper"}); this.svgDom = Entry.Dom($(''), {parent:this.wrapper}); this.visible = !0; - var d = this; + var c = this; this.svg = Entry.SVG(this._svgId); $(window).scroll(function() { - d.updateOffset(); + c.updateOffset(); }); this.svgGroup = this.svg.elem("g"); this.svgThreadGroup = this.svgGroup.elem("g"); this.svgThreadGroup.board = this; this.svgBlockGroup = this.svgGroup.elem("g"); this.svgBlockGroup.board = this; - b.isOverlay ? (this.wrapper.addClass("entryOverlayBoard"), this.generateButtons(), this.suffix = "overlayBoard") : this.suffix = "board"; + a.isOverlay ? (this.wrapper.addClass("entryOverlayBoard"), this.generateButtons(), this.suffix = "overlayBoard") : this.suffix = "board"; Entry.Utils.addFilters(this.svg, this.suffix); - b = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = b.rect; - this.pattern = b.pattern; + a = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = a.rect; + this.pattern = a.pattern; }; - a.changeCode = function(b) { + b.changeCode = function(a) { this.code && this.codeListener && this.code.changeEvent.detach(this.codeListener); - this.set({code:b}); - var a = this; - b && (this.codeListener = this.code.changeEvent.attach(this, function() { - a.changeEvent.notify(); - }), b.createView(this)); + this.set({code:a}); + var b = this; + a && (this.codeListener = this.code.changeEvent.attach(this, function() { + b.changeEvent.notify(); + }), a.createView(this)); this.scroller.resizeScrollBar(); }; - a.bindCodeView = function(b) { + b.bindCodeView = function(a) { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); - this.svgBlockGroup = b.svgBlockGroup; - this.svgThreadGroup = b.svgThreadGroup; + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup); }; - a.setMagnetedBlock = function(b, a) { + b.setMagnetedBlock = function(a, b) { if (this.magnetedBlockView) { - if (this.magnetedBlockView === b) { + if (this.magnetedBlockView === a) { return; } this.magnetedBlockView.set({magneting:!1}); } - this.set({magnetedBlockView:b}); - b && (b.set({magneting:a}), b.dominate()); + this.set({magnetedBlockView:a}); + a && (a.set({magneting:b}), a.dominate()); }; - a.getCode = function() { + b.getCode = function() { return this.code; }; - a.findById = function(b) { - return this.code.findById(b); + b.findById = function(a) { + return this.code.findById(a); }; - a._addControl = function() { - var b = this.svgDom, a = this; - b.mousedown(function() { - a.onMouseDown.apply(a, arguments); + b._addControl = function() { + var a = this.svgDom, b = this; + a.mousedown(function() { + b.onMouseDown.apply(b, arguments); }); - b.bind("touchstart", function() { - a.onMouseDown.apply(a, arguments); + a.bind("touchstart", function() { + b.onMouseDown.apply(b, arguments); }); - b.on("wheel", function() { - a.mouseWheel.apply(a, arguments); + a.on("wheel", function() { + b.mouseWheel.apply(b, arguments); }); - var d = a.scroller; - d && (b.mouseenter(function(b) { - d.setOpacity(1); - }), b.mouseleave(function(b) { - d.setOpacity(0); + var c = b.scroller; + c && (a.mouseenter(function(a) { + c.setOpacity(1); + }), a.mouseleave(function(a) { + c.setOpacity(0); })); }; - a.onMouseDown = function(b) { - function a(b) { - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); - b = Entry.Utils.convertMouseEvent(b); - var a = e.mouseDownCoordinate; - Math.sqrt(Math.pow(b.pageX - a.x, 2) + Math.pow(b.pageY - a.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), a = e.dragInstance, e.scroller.scroll(b.pageX - a.offsetX, b.pageY - a.offsetY), a.set({offsetX:b.pageX, offsetY:b.pageY})); + b.onMouseDown = function(a) { + function b(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = Entry.Utils.convertMouseEvent(a); + var c = e.mouseDownCoordinate; + Math.sqrt(Math.pow(a.pageX - c.x, 2) + Math.pow(a.pageY - c.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), c = e.dragInstance, e.scroller.scroll(a.pageX - c.offsetX, a.pageY - c.offsetY), c.set({offsetX:a.pageX, offsetY:a.pageY})); } - function d(b) { + function c(a) { f && (clearTimeout(f), f = null); $(document).unbind(".entryBoard"); delete e.mouseDownCoordinate; delete e.dragInstance; } if (this.workspace.getMode() != Entry.Workspace.MODE_VIMBOARD) { - b.stopPropagation && b.stopPropagation(); - b.preventDefault && b.preventDefault(); + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); var e = this, f = null; - if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - var g = b.type, h = Entry.Utils.convertMouseEvent(b); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + var g = a.type, h = Entry.Utils.convertMouseEvent(a); Entry.documentMousedown && Entry.documentMousedown.notify(h); var k = $(document); this.mouseDownCoordinate = {x:h.pageX, y:h.pageY}; - k.bind("mousemove.entryBoard", a); - k.bind("mouseup.entryBoard", d); - k.bind("touchmove.entryBoard", a); - k.bind("touchend.entryBoard", d); + k.bind("mousemove.entryBoard", b); + k.bind("mouseup.entryBoard", c); + k.bind("touchmove.entryBoard", b); + k.bind("touchend.entryBoard", c); this.dragInstance = new Entry.DragInstance({startX:h.pageX, startY:h.pageY, offsetX:h.pageX, offsetY:h.pageY}); "touchstart" === g && (f = setTimeout(function() { - f && (f = null, d(), e._rightClick(b)); + f && (f = null, c(), e._rightClick(a)); }, 1E3)); } else { - Entry.Utils.isRightButton(b) && this._rightClick(b); + Entry.Utils.isRightButton(a) && this._rightClick(a); } } }; - a.mouseWheel = function(b) { - b = b.originalEvent; - b.preventDefault(); - var a = Entry.disposeEvent; - a && a.notify(b); - this.scroller.scroll(b.wheelDeltaX || -b.deltaX, b.wheelDeltaY || -b.deltaY); + b.mouseWheel = function(a) { + a = a.originalEvent; + a.preventDefault(); + var b = Entry.disposeEvent; + b && b.notify(a); + this.scroller.scroll(a.wheelDeltaX || -a.deltaX, a.wheelDeltaY || -a.deltaY); }; - a.setSelectedBlock = function(b) { - var a = this.selectedBlockView; - a && a.removeSelected(); - b instanceof Entry.BlockView ? b.addSelected() : b = null; - this.set({selectedBlockView:b}); + b.setSelectedBlock = function(a) { + var b = this.selectedBlockView; + b && b.removeSelected(); + a instanceof Entry.BlockView ? a.addSelected() : a = null; + this.set({selectedBlockView:a}); }; - a._keyboardControl = function(b) { - var a = this.selectedBlockView; - a && 46 == b.keyCode && a.block && !Entry.Utils.isInInput(b) && (Entry.do("destroyBlock", a.block), this.set({selectedBlockView:null})); + b._keyboardControl = function(a) { + var b = this.selectedBlockView; + b && 46 == a.keyCode && b.block && !Entry.Utils.isInInput(a) && (Entry.do("destroyBlock", b.block), this.set({selectedBlockView:null})); }; - a.hide = function() { + b.hide = function() { this.wrapper.addClass("entryRemove"); this.visible = !1; }; - a.show = function() { + b.show = function() { this.wrapper.removeClass("entryRemove"); this.visible = !0; }; - a.alignThreads = function() { - for (var b = this.svgDom.height(), a = this.code.getThreads(), d = 15, e = 0, b = b - 30, f = 50, g = 0;g < a.length;g++) { - var h = a[g].getFirstBlock(); + b.alignThreads = function() { + for (var a = this.svgDom.height(), b = this.code.getThreads(), c = 15, e = 0, a = a - 30, f = 50, g = 0;g < b.length;g++) { + var h = b[g].getFirstBlock(); if (h && (h = h.view, h.movable)) { - var k = h.svgGroup.getBBox(), l = d + 15; - l > b && (f = f + e + 10, e = 0, d = 15); + var k = h.svgGroup.getBBox(), l = c + 15; + l > a && (f = f + e + 10, e = 0, c = 15); e = Math.max(e, k.width); - l = d + 15; + l = c + 15; h._moveTo(f, l, !1); - d = d + k.height + 15; + c = c + k.height + 15; } } this.scroller.resizeScrollBar(); }; - a.clear = function() { + b.clear = function() { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); }; - a.updateOffset = function() { + b.updateOffset = function() { this._offset = this.svg.getBoundingClientRect(); - var b = $(window), a = b.scrollTop(), b = b.scrollLeft(), d = this._offset; - this.relativeOffset = {top:d.top - a, left:d.left - b}; - this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (d.width / 2 - 65) + "," + (d.height - 200) + ")"}); - }; - a.generateButtons = function() { - var b = this, a = this.svgGroup.elem("g"); - this.btnWrapper = a; - var d = a.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); - d.textContent = Lang.Buttons.save; - var e = a.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); + var a = $(window), b = a.scrollTop(), a = a.scrollLeft(), c = this._offset; + this.relativeOffset = {top:c.top - b, left:c.left - a}; + this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (c.width / 2 - 65) + "," + (c.height - 200) + ")"}); + }; + b.generateButtons = function() { + var a = this, b = this.svgGroup.elem("g"); + this.btnWrapper = b; + var c = b.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); + c.textContent = Lang.Buttons.save; + var e = b.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); e.textContent = Lang.Buttons.cancel; - var f = a.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), a = a.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); + var f = b.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), b = b.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); $(f).bind("mousedown touchstart", function() { - b.save(); + a.save(); }); - $(d).bind("mousedown touchstart", function() { - b.save(); + $(c).bind("mousedown touchstart", function() { + a.save(); }); - $(a).bind("mousedown touchstart", function() { - b.cancelEdit(); + $(b).bind("mousedown touchstart", function() { + a.cancelEdit(); }); $(e).bind("mousedown touchstart", function() { - b.cancelEdit(); + a.cancelEdit(); }); }; - a.cancelEdit = function() { + b.cancelEdit = function() { this.workspace.setMode(Entry.Workspace.MODE_BOARD, "cancelEdit"); }; - a.save = function() { + b.save = function() { this.workspace.setMode(Entry.Workspace.MODE_BOARD, "save"); }; - a.generateCodeMagnetMap = function() { - var b = this.code; - if (b && this.dragBlock) { - for (var a in this.dragBlock.magnet) { - var d = this._getCodeBlocks(b, a); - d.sort(function(b, a) { - return b.point - a.point; + b.generateCodeMagnetMap = function() { + var a = this.code; + if (a && this.dragBlock) { + for (var b in this.dragBlock.magnet) { + var c = this._getCodeBlocks(a, b); + c.sort(function(a, b) { + return a.point - b.point; }); - d.unshift({point:-Number.MAX_VALUE, blocks:[]}); - for (var e = 1;e < d.length;e++) { - var f = d[e], g = f, h = f.startBlock; + c.unshift({point:-Number.MAX_VALUE, blocks:[]}); + for (var e = 1;e < c.length;e++) { + var f = c[e], g = f, h = f.startBlock; if (h) { - for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = d[l], g);) { + for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = c[l], g);) { } delete f.startBlock; } f.endPoint = Number.MAX_VALUE; - d[e - 1].endPoint = f.point; + c[e - 1].endPoint = f.point; } - this._magnetMap[a] = d; + this._magnetMap[b] = c; } } }; - a._getCodeBlocks = function(b, a) { - b = b.getThreads(); - var c = [], e; - switch(a) { + b._getCodeBlocks = function(a, b) { + var c = a.getThreads(), e = [], f; + switch(b) { case "previous": - e = this._getNextMagnets; + f = this._getNextMagnets; break; case "next": - e = this._getPreviousMagnets; + f = this._getPreviousMagnets; break; case "string": - e = this._getFieldMagnets; + f = this._getFieldMagnets; break; case "boolean": - e = this._getFieldMagnets; + f = this._getFieldMagnets; break; case "param": - e = this._getOutputMagnets; + f = this._getOutputMagnets; break; default: return []; } - for (var f = 0;f < b.length;f++) { - var g = b[f], c = c.concat(e.call(this, g, g.view.zIndex, null, a)) + for (var g = 0;g < c.length;g++) { + var h = c[g], e = e.concat(f.call(this, h, h.view.zIndex, null, b)) } - return c; + return e; }; - a._getNextMagnets = function(b, a, d, e) { - var c = b.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < c.length;l++) { - var m = c[l], n = m.view; - n.zIndex = a; + b._getNextMagnets = function(a, b, c, e) { + var f = a.getBlocks(), g = [], h = []; + c || (c = {x:0, y:0}); + var k = c.x; + c = c.y; + for (var l = 0;l < f.length;l++) { + var m = f[l], n = m.view; + n.zIndex = b; if (n.dragInstance) { break; } - d += n.y; + c += n.y; k += n.x; - b = d + 1; - n.magnet.next && (b += n.height, h.push({point:d, endPoint:b, startBlock:m, blocks:[]}), h.push({point:b, blocks:[]}), n.absX = k); - m.statements && (a += .01); + a = c + 1; + n.magnet.next && (a += n.height, h.push({point:c, endPoint:a, startBlock:m, blocks:[]}), h.push({point:a, blocks:[]}), n.absX = k); + m.statements && (b += .01); for (var q = 0;q < m.statements.length;q++) { - b = m.statements[q]; + a = m.statements[q]; var r = m.view._statements[q]; - r.zIndex = a; + r.zIndex = b; r.absX = k + r.x; - h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); - h.push({point:r.y + d + r.height, blocks:[]}); - a += .01; - g = g.concat(this._getNextMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); + h.push({point:r.y + c - 30, endPoint:r.y + c, startBlock:r, blocks:[]}); + h.push({point:r.y + c + r.height, blocks:[]}); + b += .01; + g = g.concat(this._getNextMagnets(a, b, {x:r.x + k, y:r.y + c}, e)); } - n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getPreviousMagnets = function(b, a, d, e) { - var c = b.getBlocks(); - b = []; - d || (d = {x:0, y:0}); - e = d.x; - d = d.y; - var c = c[0], g = c.view; - g.zIndex = a; + b._getPreviousMagnets = function(a, b, c, e) { + var f = a.getBlocks(); + a = []; + c || (c = {x:0, y:0}); + e = c.x; + c = c.y; + var f = f[0], g = f.view; + g.zIndex = b; if (g.dragInstance) { return []; } - d += g.y - 15; + c += g.y - 15; e += g.x; - return g.magnet.previous ? (a = d + 1 + g.height, b.push({point:d, endPoint:a, startBlock:c, blocks:[]}), b.push({point:a, blocks:[]}), g.absX = e, b) : []; - }; - a._getFieldMagnets = function(b, a, d, e) { - var c = b.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < c.length;l++) { - var m = c[l], n = m.view; + return g.magnet.previous ? (b = c + 1 + g.height, a.push({point:c, endPoint:b, startBlock:f, blocks:[]}), a.push({point:b, blocks:[]}), g.absX = e, a) : []; + }; + b._getFieldMagnets = function(a, b, c, e) { + var f = a.getBlocks(), g = [], h = []; + c || (c = {x:0, y:0}); + var k = c.x; + c = c.y; + for (var l = 0;l < f.length;l++) { + var m = f[l], n = m.view; if (n.dragInstance) { break; } - n.zIndex = a; - d += n.y; + n.zIndex = b; + c += n.y; k += n.x; - h = h.concat(this._getFieldBlockMetaData(n, k, d, a, e)); - m.statements && (a += .01); + h = h.concat(this._getFieldBlockMetaData(n, k, c, b, e)); + m.statements && (b += .01); for (var q = 0;q < m.statements.length;q++) { - b = m.statements[q]; - var r = m.view._statements[q], g = g.concat(this._getFieldMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); + a = m.statements[q]; + var r = m.view._statements[q], g = g.concat(this._getFieldMagnets(a, b, {x:r.x + k, y:r.y + c}, e)); } - n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getFieldBlockMetaData = function(b, a, d, e, f) { - var c = b._contents, h = []; - d += b.contentPos.y; - for (var k = 0;k < c.length;k++) { - var l = c[k]; + b._getFieldBlockMetaData = function(a, b, c, e, f) { + var g = a._contents, h = []; + c += a.contentPos.y; + for (var k = 0;k < g.length;k++) { + var l = g[k]; if (l instanceof Entry.FieldBlock) { var m = l._valueBlock; if (!m.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var n = a + l.box.x, q = d + l.box.y + b.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; + var n = b + l.box.x, q = c + l.box.y + a.contentHeight % 1E3 * -.5, r = c + l.box.y + l.box.height; l.acceptType === f && (h.push({point:q, endPoint:r, startBlock:m, blocks:[]}), h.push({point:r, blocks:[]})); l = m.view; l.absX = n; @@ -24159,55 +23675,55 @@ Entry.Board.DRAG_RADIUS = 5; } return h; }; - a._getOutputMagnets = function(b, a, d, e) { - var c = b.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < c.length;l++) { - var m = c[l], n = m.view; + b._getOutputMagnets = function(a, b, c, e) { + var f = a.getBlocks(), g = [], h = []; + c || (c = {x:0, y:0}); + var k = c.x; + c = c.y; + for (var l = 0;l < f.length;l++) { + var m = f[l], n = m.view; if (n.dragInstance) { break; } - n.zIndex = a; - d += n.y; + n.zIndex = b; + c += n.y; k += n.x; - h = h.concat(this._getOutputMetaData(n, k, d, a, e)); - m.statements && (a += .01); + h = h.concat(this._getOutputMetaData(n, k, c, b, e)); + m.statements && (b += .01); for (var q = 0;q < m.statements.length;q++) { - b = m.statements[q]; - var r = m.view._statements[q], g = g.concat(this._getOutputMagnets(b, a, {x:r.x + k, y:r.y + d}, e)); + a = m.statements[q]; + var r = m.view._statements[q], g = g.concat(this._getOutputMagnets(a, b, {x:r.x + k, y:r.y + c}, e)); } - n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); + n.magnet.next && (c += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - a._getOutputMetaData = function(b, a, d, e, f) { - var c = b._contents, h = []; - a += b.contentPos.x; - d += b.contentPos.y; - for (b = 0;b < c.length;b++) { - var k = c[b], l = a + k.box.x, m = d - 24, n = d; - k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (m = k._valueBlock) && (h = h.concat(this._getOutputMetaData(m.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (m = k._valueBlock) && (m.view.dragInstance || - (h = h.concat(this._getOutputMetaData(m.view, a + k.box.x, d + k.box.y, e + .01, f))))); + b._getOutputMetaData = function(a, b, c, e, f) { + var g = a._contents, h = []; + b += a.contentPos.x; + c += a.contentPos.y; + for (a = 0;a < g.length;a++) { + var k = g[a], l = b + k.box.x, m = c - 24, n = c; + k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (m = k._valueBlock) && (h = h.concat(this._getOutputMetaData(m.view, l, c + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:m, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (m = k._valueBlock) && (m.view.dragInstance || + (h = h.concat(this._getOutputMetaData(m.view, b + k.box.x, c + k.box.y, e + .01, f))))); } return h; }; - a.getNearestMagnet = function(b, a, d) { - var c = this._magnetMap[d]; - if (c && 0 !== c.length) { - var f = 0, g = c.length - 1, h, k = null, l = "previous" === d ? a - 15 : a; - for (a = -1 < ["previous", "next"].indexOf(d) ? 20 : 0;f <= g;) { - if (h = (f + g) / 2 | 0, d = c[h], l < d.point) { + b.getNearestMagnet = function(a, b, c) { + var e = this._magnetMap[c]; + if (e && 0 !== e.length) { + var f = 0, g = e.length - 1, h, k = null, l = "previous" === c ? b - 15 : b; + for (b = -1 < ["previous", "next"].indexOf(c) ? 20 : 0;f <= g;) { + if (h = (f + g) / 2 | 0, c = e[h], l < c.point) { g = h - 1; } else { - if (l > d.endPoint) { + if (l > c.endPoint) { f = h + 1; } else { - c = d.blocks; - for (f = 0;f < c.length;f++) { - if (g = c[f].view, g.absX - a < b && b < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { - k = d.blocks[f]; + e = c.blocks; + for (f = 0;f < e.length;f++) { + if (g = e[f].view, g.absX - b < a && a < g.absX + g.width && (g = c.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { + k = c.blocks[f]; } } return k; @@ -24217,1758 +23733,2147 @@ Entry.Board.DRAG_RADIUS = 5; return null; } }; - a.dominate = function(b) { - b && (b = b.getFirstBlock()) && (this.svgBlockGroup.appendChild(b.view.svgGroup), this.code.dominate(b.thread)); + b.dominate = function(a) { + a && (a = a.getFirstBlock()) && (this.svgBlockGroup.appendChild(a.view.svgGroup), this.code.dominate(a.thread)); }; - a.setPatternRectFill = function(b) { - this.patternRect.attr({fill:b}); + b.setPatternRectFill = function(a) { + this.patternRect.attr({fill:a}); this.pattern.attr({style:""}); }; - a.disablePattern = function() { + b.disablePattern = function() { this.pattern.attr({style:"display: none"}); }; - a._removeActivated = function() { + b._removeActivated = function() { this._activatedBlockView && (this._activatedBlockView.removeActivated(), this._activatedBlockView = null); }; - a.activateBlock = function(b) { - b = b.view; - var a = b.getAbsoluteCoordinate(), d = this.svgDom, e = a.x, a = a.y, e = d.width() / 2 - e, d = d.height() / 2 - a - 100; - this.scroller.scroll(e, d); - b.addActivated(); - this._activatedBlockView = b; + b.activateBlock = function(a) { + a = a.view; + var b = a.getAbsoluteCoordinate(), c = this.svgDom, e = b.x, b = b.y, e = c.width() / 2 - e, c = c.height() / 2 - b - 100; + this.scroller.scroll(e, c); + a.addActivated(); + this._activatedBlockView = a; }; - a.reDraw = function() { + b.reDraw = function() { this.code.view.reDraw(); }; - a.separate = function(b, a) { - "string" === typeof b && (b = this.findById(b)); - b.view && b.view._toGlobalCoordinate(); - var c = b.getPrevBlock(); - b.separate(a); + b.separate = function(a, b) { + "string" === typeof a && (a = this.findById(a)); + a.view && a.view._toGlobalCoordinate(); + var c = a.getPrevBlock(); + a.separate(b); c && c.getNextBlock() && c.getNextBlock().view.bindPrev(); }; - a.insert = function(b, a, d) { - "string" === typeof b && (b = this.findById(b)); - this.separate(b, d); - 3 === a.length ? b.moveTo(a[0], a[1]) : 4 === a.length && 0 === a[3] ? (a = this.code.getThreads()[a[2]], b.thread.cut(b), a.insertToTop(b), b.getNextBlock().view.bindPrev()) : (a = a instanceof Array ? this.code.getTargetByPointer(a) : a, a instanceof Entry.Block ? ("basic" === b.getBlockType() && b.view.bindPrev(a), b.doInsert(a)) : a instanceof Entry.FieldStatement ? (b.view.bindPrev(a), a.insertTopBlock(b)) : b.doInsert(a)); + b.insert = function(a, b, c) { + "string" === typeof a && (a = this.findById(a)); + this.separate(a, c); + 3 === b.length ? a.moveTo(b[0], b[1]) : 4 === b.length && 0 === b[3] ? (b = this.code.getThreads()[b[2]], a.thread.cut(a), b.insertToTop(a), a.getNextBlock().view.bindPrev()) : (b = b instanceof Array ? this.code.getTargetByPointer(b) : b, b instanceof Entry.Block ? ("basic" === a.getBlockType() && a.view.bindPrev(b), a.doInsert(b)) : b instanceof Entry.FieldStatement ? (a.view.bindPrev(b), b.insertTopBlock(a)) : a.doInsert(b)); }; - a.adjustThreadsPosition = function() { - var b = this.code; - b && (b = b.getThreads()) && 0 !== b.length && (b = b.sort(function(b, a) { - return b.getFirstBlock().view.x - a.getFirstBlock().view.x; - }), b = b[0].getFirstBlock()) && (b = b.view, b = b.getAbsoluteCoordinate(), this.scroller.scroll(50 - b.x, 30 - b.y)); + b.adjustThreadsPosition = function() { + var a = this.code; + a && (a = a.getThreads()) && 0 !== a.length && (a = a.sort(function(a, b) { + return a.getFirstBlock().view.x - b.getFirstBlock().view.x; + }), a = a[0].getFirstBlock()) && (a = a.view, a = a.getAbsoluteCoordinate(), this.scroller.scroll(50 - a.x, 30 - a.y)); }; - a._initContextOptions = function() { - var b = this; + b._initContextOptions = function() { + var a = this; this._contextOptions = [{activated:!0, option:{text:Lang.Blocks.Paste_blocks, enable:!!Entry.clipboard, callback:function() { Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); }}}, {activated:!0, option:{text:Lang.Blocks.tidy_up_block, callback:function() { - b.alignThreads(); + a.alignThreads(); }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { - b.code.clear(); + a.code.clear(); }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome() && !Entry.isMobile(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() { - b.code.getThreads().forEach(function(b) { - (b = b.getFirstBlock()) && b.view.downloadAsImage(); + a.code.getThreads().forEach(function(a) { + (a = a.getFirstBlock()) && a.view.downloadAsImage(); }); }}}]; }; - a.activateContextOption = function(b) { - this._contextOptions[b].activated = !0; + b.activateContextOption = function(a) { + this._contextOptions[a].activated = !0; }; - a.deActivateContextOption = function(b) { - this._contextOptions[b].activated = !1; + b.deActivateContextOption = function(a) { + this._contextOptions[a].activated = !1; }; - a._bindEvent = function() { + b._bindEvent = function() { Entry.documentMousedown && (Entry.documentMousedown.attach(this, this.setSelectedBlock), Entry.documentMousedown.attach(this, this._removeActivated)); Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); if (Entry.windowResized) { - var b = _.debounce(this.updateOffset, 200); - Entry.windowResized.attach(this, b); + var a = _.debounce(this.updateOffset, 200); + Entry.windowResized.attach(this, a); } }; - a.offset = function() { + b.offset = function() { (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); return this._offset; }; - a._rightClick = function(b) { - var a = Entry.disposeEvent; - a && a.notify(b); + b._rightClick = function(a) { + var b = Entry.disposeEvent; + b && b.notify(a); if (this.visible) { - var a = [], d = this._contextOptions; - d[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; - d[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; + var b = [], c = this._contextOptions; + c[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; + c[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; for (var e = 0;e < this._contextOptions.length;e++) { - d[e].activated && a.push(d[e].option); + c[e].activated && b.push(c[e].option); } - b = Entry.Utils.convertMouseEvent(b); - Entry.ContextMenu.show(a, null, {x:b.clientX, y:b.clientY}); + a = Entry.Utils.convertMouseEvent(a); + Entry.ContextMenu.show(b, null, {x:a.clientX, y:a.clientY}); } }; })(Entry.Board.prototype); -Entry.Code = function(a, b) { - Entry.Model(this, !1); - b && (this.object = b); +Entry.skeleton = function() { +}; +Entry.skeleton.basic = {path:function(b) { + var a = b.contentWidth; + b = b.contentHeight; + b = Math.max(30, b + 2); + a = Math.max(0, a + 9 - b / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); +}, box:function(b) { + return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(b) { + return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; +}, contentPos:function(b) { + return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_create = {path:function(b) { + var a = b.contentWidth; + b = b.contentHeight; + b = Math.max(30, b + 2); + a = Math.max(0, a + 9 - b / 2); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); +}, box:function(b) { + return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(b) { + return {next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; +}, contentPos:function(b) { + return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_event = {path:function(b) { + b = b.contentWidth; + b = Math.max(0, b); + return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, b - 30); +}, box:function(b) { + return {offsetX:-19, offsetY:-7, width:b.contentWidth + 30, height:30, marginBottom:0}; +}, magnets:function(b) { + return {next:{x:0, y:(b ? Math.max(b.height + b.offsetY + 7, 30) : 30) + 1}}; +}, contentPos:function(b) { + return {x:1, y:15}; +}}; +Entry.skeleton.basic_loop = {path:function(b) { + var a = b.contentWidth, d = b.contentHeight, d = Math.max(30, d + 2), a = Math.max(0, a + 9 - d / 2); + b = b._statements[0] ? b._statements[0].height : 20; + b = Math.max(b, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, d).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h/gi, d / 2).replace(/%sh/gi, b + 1); +}, magnets:function(b) { + var a = Math.max(b.contentHeight + 2, 30), d = b._statements[0] ? b._statements[0].height : 20, d = Math.max(d, 20); + return {previous:{x:0, y:0}, next:{x:0, y:d + a + 18 + b.offsetY}}; +}, box:function(b) { + var a = b.contentWidth, d = Math.max(b.contentHeight + 2, 30); + b = b._statements[0] ? b._statements[0].height : 20; + b = Math.max(b, 20); + return {offsetX:-8, offsetY:0, width:a + 30, height:d + b + 17, marginBottom:0}; +}, statementPos:function(b) { + return [{x:16, y:Math.max(30, b.contentHeight + 2) + 1}]; +}, contentPos:function(b) { + return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_define = {path:function(b) { + var a = b.contentWidth, d = b.contentHeight, d = Math.max(30, d + 2), a = Math.max(0, a + 9 - d / 2); + b = b._statements[0] ? b._statements[0].height : 30; + b = Math.max(b, 20); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, d).replace(/%w/gi, a).replace(/%h/gi, d / 2).replace(/%bw/gi, a - 8).replace(/%sh/gi, b + 1); +}, magnets:function() { + return {}; +}, box:function(b) { + return {offsetX:0, offsetY:0, width:b.contentWidth, height:Math.max(b.contentHeight, 25) + 46, marginBottom:0}; +}, statementPos:function(b) { + return [{x:16, y:Math.max(30, b.contentHeight + 2)}]; +}, contentPos:function() { + return {x:14, y:15}; +}}; +Entry.skeleton.pebble_event = {path:function(b) { + return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; +}, box:function(b) { + return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; +}, magnets:function(b) { + return {next:{x:0, y:(b ? Math.max(b.height, 49.3) : 49.3) + b.offsetY}}; +}, contentPos:function() { + return {x:0, y:25}; +}}; +Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(b) { + b = Math.max(b._statements[0] ? b._statements[0].height : 50, 50); + return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, b + 4).replace(/%cih/gi, b - 50); +}, magnets:function(b) { + var a = Math.max(b.contentHeight + 2, 41), d = b._statements[0] ? b._statements[0].height : 20, d = Math.max(d, 51); + return {previous:{x:0, y:0}, next:{x:0, y:d + a + 13 + b.offsetY}}; +}, box:function(b) { + var a = b.contentWidth, d = Math.max(b.contentHeight + 2, 41); + b = b._statements[0] ? b._statements[0].height : 20; + b = Math.max(b, 51); + return {offsetX:-(a / 2 + 13), offsetY:0, width:a + 30, height:d + b + 13, marginBottom:0}; +}, statementPos:function(b) { + return [{x:0, y:Math.max(39, b.contentHeight + 2) + 1.5}]; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(b) { + return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; +}, magnets:function(b) { + return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 51) : 51) + b.offsetY}}; +}, box:function() { + return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.basic_string_field = {path:function(b) { + var a = b.contentWidth; + b = b.contentHeight; + b = Math.max(18, b + 2); + a = Math.max(0, a - b + 12); + return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); +}, color:"#000", outerLine:"#768dce", box:function(b) { + return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 12, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {string:{}}; +}, contentPos:function(b) { + return {x:6, y:Math.max(b.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_boolean_field = {path:function(b) { + var a = b.contentWidth; + b = b.contentHeight; + b = Math.max(18, b + 2); + a = Math.max(0, a - b + 19); + return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); +}, color:"#000", outerLine:"#768dce", box:function(b) { + return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 19, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {boolean:{}}; +}, contentPos:function(b) { + return {x:10, y:Math.max(b.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_param = {path:function(b) { + var a = b.contentWidth; + (b = b._contents[b._contents.length - 1]) && (a -= b.box.width + Entry.BlockView.PARAM_SPACE - 2); + a = Math.max(0, a); + return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, a); +}, outerLine:"#768dce", box:function(b) { + return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 11, height:24, marginBottom:0}; +}, magnets:function() { + return {param:{}}; +}, contentPos:function(b) { + return {x:11, y:12}; +}}; +Entry.skeleton.basic_button = {path:function() { + return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; +}, box:function() { + return {offsetX:-80, offsetY:0, width:140, height:30}; +}, contentPos:function() { + return {x:0, y:15}; +}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; +Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(b) { + var a = b.contentWidth; + b = b.contentHeight; + b = Math.max(30, b + 2); + a = Math.max(0, a + 9 - b / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); +}, magnets:function(b) { + return {previous:{x:0, y:0}}; +}}; +Entry.skeleton.basic_double_loop = {path:function(b) { + var a = b.contentWidth, d = b.contentHeight % 1E6, c = Math.floor(b.contentHeight / 1E6), d = Math.max(30, d + 2), c = Math.max(30, c + 2), a = Math.max(0, a + 5 - d / 2), e = b._statements; + b = e[0] ? e[0].height : 20; + e = e[1] ? e[1].height : 20; + b = Math.max(b, 20); + e = Math.max(e, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, d).replace(/%wh2/gi, c).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h1/gi, d / 2).replace(/%h2/gi, c / 2).replace(/%sh1/gi, b + 1).replace(/%sh2/gi, e + 1); +}, magnets:function(b) { + var a = Math.max(b.contentHeight % 1E6 + 2, 30), d = Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30), c = b._statements[0] ? b._statements[0].height : 20, e = b._statements[1] ? b._statements[1].height : 20, c = Math.max(c, 20), e = Math.max(e, 20); + return {previous:{x:0, y:0}, next:{x:0, y:c + e + a + d + 19 + b.offsetY}}; +}, box:function(b) { + var a = b.contentWidth, d = Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30), c = Math.max(b.contentHeight % 1E6 + 2, 30), e = b._statements[0] ? b._statements[0].height % 1E6 : 20; + b = b._statements[1] ? b._statements[1].height : 20; + e = Math.max(e, 20); + b = Math.max(b, 20); + return {offsetX:-8, offsetY:0, width:a + 30, height:d + c + e + b + 17, marginBottom:0}; +}, statementPos:function(b) { + var a = Math.max(30, b.contentHeight % 1E6 + 2) + 1; + return [{x:16, y:a}, {x:16, y:a + Math.max(b._statements[0] ? b._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30) + 1}]; +}, contentPos:function(b) { + return {x:14, y:Math.max(b.contentHeight % 1E6, 28) / 2 + 1}; +}}; +Entry.Thread = function(b, a, d) { this._data = new Entry.Collection; - this._eventMap = {}; - this._blockMap = {}; - this.executors = []; - this.executeEndEvent = new Entry.Event(this); + this._code = a; this.changeEvent = new Entry.Event(this); - this.changeEvent.attach(this, this._handleChange); - this._maxZIndex = 0; - this.load(a); + this.changeEvent.attach(this, this.handleChange); + this._event = null; + this.parent = d ? d : a; + this.load(b); }; -Entry.STATEMENT = 0; -Entry.PARAM = -1; -(function(a) { - a.schema = {view:null, board:null}; - a.load = function(b) { - b instanceof Array || (b = JSON.parse(b)); - this.clear(); - for (var a = 0;a < b.length;a++) { - this._data.push(new Entry.Thread(b[a], this)); +(function(b) { + b.load = function(a, b) { + void 0 === a && (a = []); + if (!(a instanceof Array)) { + return console.error("thread must be array"); } - return this; - }; - a.clear = function() { - for (var b = this._data.length - 1;0 <= b;b--) { - this._data[b].destroy(!1); + for (var c = 0;c < a.length;c++) { + var e = a[c]; + e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); } - this.clearExecutors(); - this._eventMap = {}; + (c = this._code.view) && this.createView(c.board, b); }; - a.createView = function(b) { - null === this.view ? this.set({view:new Entry.CodeView(this, b), board:b}) : (this.set({board:b}), b.bindCodeView(this.view)); + b.registerEvent = function(a, b) { + this._event = b; + this._code.registerEvent(a, b); }; - a.destroyView = function() { - this.view && (this.view.destroy(), delete this.view); + b.unregisterEvent = function(a, b) { + this._code.unregisterEvent(a, b); }; - a.recreateView = function() { - this.view && (this.destroyView(), this.set({view:new Entry.CodeView(this, this.board), board:this.board})); + b.createView = function(a, b) { + this.view || (this.view = new Entry.ThreadView(this, a)); + this._data.getAll().forEach(function(c) { + c.createView(a, b); + }); }; - a.registerEvent = function(b, a) { - this._eventMap[a] || (this._eventMap[a] = []); - this._eventMap[a].push(b); + b.destroyView = function() { + this.view = null; + this._data.map(function(a) { + a.destroyView(); + }); }; - a.unregisterEvent = function(b, a) { - (a = this._eventMap[a]) && 0 !== a.length && (b = a.indexOf(b), 0 > b || a.splice(b, 1)); + b.separate = function(a, b) { + if (this._data.has(a.id)) { + var c = this._data.splice(this._data.indexOf(a), b); + this._code.createThread(c); + this.changeEvent.notify(); + } }; - a.raiseEvent = function(b, a, d) { - b = this._eventMap[b]; - var c = []; - if (void 0 !== b) { - for (var f = 0;f < b.length;f++) { - var g = b[f]; - if (void 0 === d || -1 < g.params.indexOf(d)) { - g = new Entry.Executor(b[f], a), this.executors.push(g), c.push(g); - } - } - return c; + b.cut = function(a) { + a = this._data.indexOf(a); + a = this._data.splice(a); + this.changeEvent.notify(); + return a; + }; + b.insertByBlock = function(a, b) { + for (var c = a ? this._data.indexOf(a) : -1, e = 0;e < b.length;e++) { + b[e].setThread(this); } + this._data.splice.apply(this._data, [c + 1, 0].concat(b)); + this.changeEvent.notify(); + }; + b.insertToTop = function(a) { + a.setThread(this); + this._data.unshift.apply(this._data, [a]); + this.changeEvent.notify(); }; - a.getEventMap = function(b) { - return this._eventMap[b]; + b.clone = function(a, b) { + a = a || this._code; + for (var c = new Entry.Thread([], a), e = this._data, f = [], g = 0, h = e.length;g < h;g++) { + f.push(e[g].clone(c)); + } + c.load(f, b); + return c; }; - a.map = function(b) { - this._data.map(b); + b.toJSON = function(a, b) { + for (var c = [], e = void 0 === b ? 0 : b;e < this._data.length;e++) { + this._data[e] instanceof Entry.Block && c.push(this._data[e].toJSON(a)); + } + return c; }; - a.tick = function() { - for (var b = this.executors, a = 0;a < b.length;a++) { - var d = b[a]; - d.isEnd() ? (b.splice(a--, 1), 0 === b.length && this.executeEndEvent.notify()) : d.execute(); + b.destroy = function(a) { + this._code.destroyThread(this, !1); + this.view && this.view.destroy(a); + for (var b = this._data, c = b.length - 1;0 <= c;c--) { + b[c].destroy(a); } }; - a.removeExecutor = function(b) { - b = this.executors.indexOf(b); - -1 < b && this.executors.splice(b, 1); + b.getBlock = function(a) { + return this._data[a]; }; - a.clearExecutors = function() { - this.executors.forEach(function(b) { - b.end(); + b.getBlocks = function() { + return this._data.map(function(a) { + return a; }); - this.executors = []; }; - a.clearExecutorsByEntity = function(b) { - for (var a = this.executors, d = 0;d < a.length;d++) { - var e = a[d]; - e.entity === b && e.end(); + b.countBlock = function() { + for (var a = 0, b = 0;b < this._data.length;b++) { + var c = this._data[b]; + if (c.type && (a++, c = c.statements)) { + for (var e = 0;e < c.length;e++) { + a += c[e].countBlock(); + } + } } + return a; + }; + b.handleChange = function() { + 0 === this._data.length && this.destroy(); }; - a.addExecutor = function(b) { - this.executors.push(b); + b.getCode = function() { + return this._code; }; - a.createThread = function(b, a) { - if (!(b instanceof Array)) { - return console.error("blocks must be array"); - } - b = new Entry.Thread(b, this); - void 0 === a ? this._data.push(b) : this._data.insert(b, a); - return b; + b.setCode = function(a) { + this._code = a; }; - a.cloneThread = function(b, a) { - b = b.clone(this, a); - this._data.push(b); - return b; + b.spliceBlock = function(a) { + this._data.remove(a); + this.changeEvent.notify(); + }; + b.getFirstBlock = function() { + return this._data[0]; }; - a.destroyThread = function(b, a) { - a = this._data; - b = a.indexOf(b); - 0 > b || a.splice(b, 1); + b.getPrevBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a - 1); }; - a.doDestroyThread = function(b, a) { - a = this._data; - b = a.indexOf(b); - 0 > b || a.splice(b, 1); + b.getNextBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a + 1); }; - a.getThreads = function() { - return this._data.map(function(b) { - return b; - }); + b.getLastBlock = function() { + return this._data.at(this._data.length - 1); }; - a.toJSON = function() { - for (var b = this.getThreads(), a = [], d = 0, e = b.length;d < e;d++) { - a.push(b[d].toJSON()); - } - return a; + b.getRootBlock = function() { + return this._data.at(0); }; - a.countBlock = function() { - for (var b = this.getThreads(), a = 0, d = 0;d < b.length;d++) { - a += b[d].countBlock(); + b.hasBlockType = function(a) { + function b(c) { + if (a == c.type) { + return !0; + } + for (var f = c.params, g = 0;g < f.length;g++) { + var h = f[g]; + if (h && h.constructor == Entry.Block && b(h)) { + return !0; + } + } + if (c = c.statements) { + for (f = 0;f < c.length;f++) { + if (c[f].hasBlockType(a)) { + return !0; + } + } + } + return !1; } - return a; + for (var c = 0;c < this._data.length;c++) { + if (b(this._data[c])) { + return !0; + } + } + return !1; }; - a.moveBy = function(b, a) { - for (var c = this.getThreads(), e = 0, f = c.length;e < f;e++) { - var g = c[e].getFirstBlock(); - g && g.view._moveBy(b, a, !1); + b.getCount = function(a) { + var b = this._data.length; + a && (b -= this._data.indexOf(a)); + return b; + }; + b.indexOf = function(a) { + return this._data.indexOf(a); + }; + b.pointer = function(a, b) { + var c = this.indexOf(b); + a.unshift(c); + this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); + return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), c = this._data[0], a.unshift(c.y), a.unshift(c.x), a) : this.parent.pointer(a); + }; + b.getBlockList = function(a, b) { + for (var c = [], e = 0;e < this._data.length;e++) { + c = c.concat(this._data[e].getBlockList(a, b)); } - b = this.board; - b instanceof Entry.BlockMenu && b.updateSplitters(a); + return c; }; - a.stringify = function() { + b.stringify = function() { return JSON.stringify(this.toJSON()); }; - a.dominate = function(b) { - b.view.setZIndex(this._maxZIndex++); +})(Entry.Thread.prototype); +Entry.Block = function(b, a) { + var d = this; + Entry.Model(this, !1); + this._schema = null; + this.setThread(a); + this.load(b); + var c = this.getCode(); + c.registerBlock(this); + var e = this.events.dataAdd; + e && c.object && e.forEach(function(a) { + Entry.Utils.isFunction(a) && a(d); + }); +}; +Entry.Block.MAGNET_RANGE = 10; +Entry.Block.MAGNET_OFFSET = .4; +Entry.Block.DELETABLE_TRUE = 1; +Entry.Block.DELETABLE_FALSE = 2; +Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; +(function(b) { + b.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; + b.load = function(a) { + a.id || (a.id = Entry.Utils.generateId()); + this.set(a); + this.loadSchema(); }; - a.indexOf = function(b) { - return this._data.indexOf(b); + b.changeSchema = function(a) { + this.set({params:[]}); + this.loadSchema(); }; - a._handleChange = function() { - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + b.getSchema = function() { + this._schema || this.loadSchema(); + return this._schema; }; - a.hasBlockType = function(b) { - for (var a = this.getThreads(), d = 0;d < a.length;d++) { - if (a[d].hasBlockType(b)) { - return !0; + b.loadSchema = function() { + if (this._schema = Entry.block[this.type]) { + !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); + var a = this._schema.events; + if (a) { + for (var b in a) { + this.events[b] || (this.events[b] = []); + for (var c = a[b], e = 0;e < c.length;e++) { + var f = c[e]; + f && 0 > this.events[b].indexOf(f) && this.events[b].push(f); + } + } + } + this._schema.event && this.thread.registerEvent(this, this._schema.event); + a = this.params; + b = this._schema.params; + for (e = 0;b && e < b.length;e++) { + c = void 0 === a[e] || null === a[e] ? b[e].value : a[e], f = a[e] || e < a.length, !c || "Output" !== b[e].type && "Block" !== b[e].type || (c = new Entry.Block(c, this.thread)), f ? a.splice(e, 1, c) : a.push(c); + } + if (a = this._schema.statements) { + for (e = 0;e < a.length;e++) { + this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); + } } } - return !1; }; - a.findById = function(b) { - return this._blockMap[b]; + b.changeType = function(a) { + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + this.set({type:a}); + this.loadSchema(); + this.view && this.view.changeType(a); }; - a.registerBlock = function(b) { - this._blockMap[b.id] = b; + b.setThread = function(a) { + this.set({thread:a}); }; - a.unregisterBlock = function(b) { - delete this._blockMap[b.id]; + b.getThread = function() { + return this.thread; }; - a.getByPointer = function(b) { - b = b.concat(); - b.shift(); - b.shift(); - for (var a = this._data[b.shift()].getBlock(b.shift());b.length;) { - a instanceof Entry.Block || (a = a.getValueBlock()); - var d = b.shift(), e = b.shift(); - -1 < d ? a = a.statements[d].getBlock(e) : -1 === d && (a = a.view.getParam(e)); - } - return a; + b.insertAfter = function(a) { + this.thread.insertByBlock(this, a); }; - a.getTargetByPointer = function(b) { - b = b.concat(); - b.shift(); - b.shift(); - var a = this._data[b.shift()], d; - if (1 === b.length) { - d = a.getBlock(b.shift() - 1); - } else { - for (d = a.getBlock(b.shift());b.length;) { - d instanceof Entry.Block || (d = d.getValueBlock()); - var e = b.shift(), a = b.shift(); - -1 < e ? (d = d.statements[e], d = b.length ? d.getBlock(a) : 0 === a ? d.view.getParent() : d.getBlock(a - 1)) : -1 === e && (d = d.view.getParam(a)); - } - } - return d; + b._updatePos = function() { + this.view && this.set({x:this.view.x, y:this.view.y}); }; - a.getBlockList = function(b, a) { - for (var c = this.getThreads(), e = [], f = 0;f < c.length;f++) { - e = e.concat(c[f].getBlockList(b, a)); - } - return e; + b.moveTo = function(a, b) { + this.view && this.view._moveTo(a, b); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - a.removeBlocksByType = function(b) { - this.getBlockList(!1, b).forEach(function(b) { - b.doDestroy(); - }); + b.createView = function(a, b) { + this.view || (this.set({view:new Entry.BlockView(this, a, b)}), this._updatePos()); }; -})(Entry.Code.prototype); -Entry.CodeView = function(a, b) { - Entry.Model(this, !1); - this.code = a; - this.set({board:b}); - this.svgThreadGroup = b.svgGroup.elem("g"); - this.svgThreadGroup.attr({class:"svgThreadGroup"}); - this.svgThreadGroup.board = b; - this.svgBlockGroup = b.svgGroup.elem("g"); - this.svgBlockGroup.attr({class:"svgBlockGroup"}); - this.svgBlockGroup.board = b; - b.bindCodeView(this); - this.code._data.getAll().forEach(function(a) { - a.createView(b); - }); - a.observe(this, "_setBoard", ["board"]); -}; -(function(a) { - a.schema = {board:null, scrollX:0, scrollY:0}; - a._setBoard = function() { - this.set({board:this.code.board}); + b.destroyView = function() { + this.set({view:null}); }; - a.reDraw = function() { - this.code.map(function(b) { - b.view.reDraw(); + b.clone = function(a) { + return new Entry.Block(this.toJSON(!0), a); + }; + b.toJSON = function(a) { + var b = this._toJSON(); + delete b.view; + delete b.thread; + delete b.events; + a && delete b.id; + b.params = b.params.map(function(b) { + b instanceof Entry.Block && (b = b.toJSON(a)); + return b; }); + b.statements = b.statements.map(function(b) { + return b.toJSON(a); + }); + b.x = this.x; + b.y = this.y; + b.movable = this.movable; + b.deletable = this.deletable; + b.readOnly = this.readOnly; + return b; }; - a.destroy = function() { - this.code.map(function(b) { - b.destroyView(); + b.destroy = function(a, b) { + var c = this, e = this.params; + if (e) { + for (var f = 0;f < e.length;f++) { + var g = e[f]; + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); + } + } + if (e = this.statements) { + for (f = 0;f < e.length;f++) { + e[f].destroy(a); + } + } + g = this.getPrevBlock(); + f = this.getNextBlock(); + this.getCode().unregisterBlock(this); + e = this.getThread(); + this._schema && this._schema.event && e.unregisterEvent(this, this._schema.event); + f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate())); + !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; + this.view && this.view.destroy(a); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + (f = this.events.dataDestroy) && this.getCode().object && f.forEach(function(a) { + Entry.Utils.isFunction(a) && a(c); }); }; -})(Entry.CodeView.prototype); -Entry.ConnectionRipple = {}; -(function(a) { - a.createDom = function(b) { - this.svgDom || (this._ripple = b.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); - }; - a.setView = function(b) { - this._ripple || this.createDom(b); - var a = this._ripple, d = b.getBoard().svgGroup; - a.remove(); - b = b.getAbsoluteCoordinate(); - a.attr({cx:b.x, cy:b.y}); - d.appendChild(a); - a._startTime = new Date; - return this; + b.getView = function() { + return this.view; }; - a.dispose = function() { - var b = this, a = this._ripple, d = (new Date - a._startTime) / 150; - 1 < d ? a.remove() : (a.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { - b.dispose(); - }, 10)); + b.setMovable = function(a) { + this.movable != a && this.set({movable:a}); }; -})(Entry.ConnectionRipple); -Entry.Executor = function(a, b) { - this.scope = new Entry.Scope(a, this); - this.entity = b; - this._callStack = []; - this.register = {}; -}; -(function(a) { - a.execute = function() { - if (!this.isEnd()) { - for (;;) { - var b = null; - try { - var a = this.scope.block.getSchema(); - a && (b = a.func.call(this.scope, this.entity, this.scope)); - } catch (e) { - if ("AsyncError" === e.name) { - b = Entry.STATIC.BREAK; - } else { - var d = !1; - "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (d = !0); - Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", d); - } - } - if (this.isEnd()) { - break; - } - if (void 0 === b || null === b || b === Entry.STATIC.PASS) { - if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { - if (this._callStack.length) { - if (b = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== b.isLooped) { - break; - } - } else { - break; - } - } - } else { - if (b !== Entry.STATIC.CONTINUE && (b === Entry.STATIC.BREAK || this.scope === b)) { - break; - } - } - } - } + b.setCopyable = function(a) { + this.copyable != a && this.set({copyable:a}); }; - a.stepInto = function(b) { - b instanceof Entry.Thread || console.error("Must step in to thread"); - b = b.getFirstBlock(); - if (!b) { - return Entry.STATIC.BREAK; - } - this._callStack.push(this.scope); - this.scope = new Entry.Scope(b, this); - return Entry.STATIC.CONTINUE; + b.isMovable = function() { + return this.movable; }; - a.break = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - return Entry.STATIC.PASS; + b.isCopyable = function() { + return this.copyable; }; - a.breakLoop = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { - this.scope = this._callStack.pop(); - } - return Entry.STATIC.PASS; + b.setDeletable = function(a) { + this.deletable != a && this.set({deletable:a}); }; - a.end = function() { - this.scope.block = null; + b.isDeletable = function() { + return this.deletable === Entry.Block.DELETABLE_TRUE; }; - a.isEnd = function() { - return null === this.scope.block; + b.isReadOnly = function() { + return this.readOnly; }; -})(Entry.Executor.prototype); -Entry.Scope = function(a, b) { - this.type = (this.block = a) ? a.type : null; - this.executor = b; - this.entity = b.entity; -}; -(function(a) { - a.callReturn = function() { + b.getCode = function() { + return this.thread.getCode(); }; - a.getParam = function(b) { - b = this.block.params[b]; - var a = new Entry.Scope(b, this.executor); - return Entry.block[b.type].func.call(a, this.entity, a); + b.doAdd = function() { + this.getCode().changeEvent.notify(); }; - a.getParams = function() { - var b = this; - return this.block.params.map(function(a) { - if (a instanceof Entry.Block) { - var c = new Entry.Scope(a, b.executor); - return Entry.block[a.type].func.call(c, b.entity, c); - } - return a; - }); + b.doMove = function() { + this._updatePos(); + this.getCode().changeEvent.notify(); }; - a.getValue = function(b, a) { - b = this.block.params[this._getParamIndex(b, a)]; - a = new Entry.Scope(b, this.executor); - return Entry.block[b.type].func.call(a, this.entity, a); + b.doSeparate = function() { + this.separate(); }; - a.getStringValue = function(b, a) { - return String(this.getValue(b, a)); + b.doInsert = function(a) { + "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); }; - a.getNumberValue = function(b, a) { - return Number(this.getValue(b)); + b.doDestroy = function(a) { + this.destroy(a); + this.getCode().changeEvent.notify(); + return this; }; - a.getBooleanValue = function(b, a) { - return Number(this.getValue(b, a)) ? !0 : !1; + b.doDestroyBelow = function(a) { + console.log("destroyBelow", this.id, this.x, this.y); + this.destroy(a, !0); + this.getCode().changeEvent.notify(); + return this; }; - a.getField = function(b, a) { - return this.block.params[this._getParamIndex(b)]; + b.copy = function() { + var a = this.getThread(), b = []; + if (a instanceof Entry.Thread) { + for (var c = a.getBlocks().indexOf(this), a = a.toJSON(!0, c), c = 0;c < a.length;c++) { + b.push(a[c]); + } + } else { + b.push(this.toJSON(!0)); + } + a = this.view.getAbsoluteCoordinate(); + c = b[0]; + c.x = a.x + 15; + c.y = a.y + 15; + c.id = Entry.Utils.generateId(); + return b; }; - a.getStringField = function(b, a) { - return String(this.getField(b)); + b.copyToClipboard = function() { + Entry.clipboard = this.copy(); }; - a.getNumberField = function(b) { - return Number(this.getField(b)); + b.separate = function(a) { + this.thread.separate(this, a); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - a.getStatement = function(b, a) { - return this.executor.stepInto(this.block.statements[this._getStatementIndex(b, a)]); + b.insert = function(a) { + var b = this.thread.cut(this); + a instanceof Entry.Thread ? a.insertByBlock(null, b) : a.insertAfter(b); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - a._getParamIndex = function(b) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.paramsKeyMap[b]; + b.replace = function(a) { + this.thread.cut(this); + a.getThread().replace(this); + this.getCode().changeEvent.notify(); }; - a._getStatementIndex = function(b) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.statementsKeyMap[b]; + b.getPrevBlock = function() { + return this.thread.getPrevBlock(this); }; - a.die = function() { - this.block = null; - return Entry.STATIC.BREAK; + b.getNextBlock = function() { + return this.thread.getNextBlock(this) || null; }; -})(Entry.Scope.prototype); -Entry.FieldAngle = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = a.position; - this._contents = a; - this._index = c; - a = this.getValue(); - this.setValue(this.modValue(void 0 !== a ? a : 90)); - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); - this.textElement.textContent = this.getText(); - var b = this.getTextWidth(), a = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - a / 2, rx:3, ry:3, width:b, height:a, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:b, height:a}); + b.getLastBlock = function() { + return this.thread.getLastBlock(); }; - a.renderOptions = function() { - var b = this; - this._attachDisposeEvent(function() { - b.applyValue(); - b.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.value); - this.optionGroup.on("mousedown touchstart", function(b) { - b.stopPropagation(); - }); - this.optionGroup.on("keyup", function(a) { - var c = a.keyCode || a.which; - b.applyValue(a); - -1 < [13, 27].indexOf(c) && b.destroyOption(); - }); - var a = this.getAbsolutePosFromDocument(); - a.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:a.x, top:a.y, width:b.box.width}); - this.svgOptionGroup = this.appendSvgOptionGroup(); - this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); - $(this.svgOptionGroup).on("mousedown touchstart", function(a) { - a.stopPropagation(); - b._updateByCoord(a); - }); - this._dividerGroup = this.svgOptionGroup.elem("g"); - for (a = 0;360 > a;a += 15) { - this._dividerGroup.elem("line", {x1:49, y1:0, x2:49 - (0 === a % 45 ? 10 : 5), y2:0, transform:"rotate(" + a + ", 0, 0)", class:"entry-angle-divider"}); + b.getOutputBlock = function() { + for (var a = this._schema.params, b = 0;a && b < a.length;b++) { + if ("Output" === a[b].type) { + return this.params[b]; + } } - a = this.getAbsolutePosFromBoard(); - a.x += this.box.width / 2; - a.y = a.y + this.box.height / 2 + 49 + 1; - this.svgOptionGroup.attr({class:"entry-field-angle", transform:"translate(" + a.x + "," + a.y + ")"}); - $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); - $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); - this.updateGraph(); - this.optionGroup.focus(); - this.optionGroup.select(); - }; - a._updateByCoord = function(b) { - b.originalEvent && b.originalEvent.touches && (b = b.originalEvent.touches[0]); - b = [b.clientX, b.clientY]; - var a = this.getAbsolutePosFromDocument(); - this.optionGroup.val(this.modValue(function(b, a) { - var c = a[0] - b[0]; - b = a[1] - b[1] - 49 - 1; - a = Math.atan(-b / c); - a = Entry.toDegrees(a); - a = 90 - a; - 0 > c ? a += 180 : 0 < b && (a += 360); - return 15 * Math.round(a / 15); - }([a.x + this.box.width / 2, a.y + this.box.height / 2 + 1], b))); - this.applyValue(); + return null; }; - a.updateGraph = function() { - this._fillPath && this._fillPath.remove(); - var b = Entry.toRadian(this.getValue()), a = 49 * Math.sin(b), d = -49 * Math.cos(b), b = b > Math.PI ? 1 : 0; - this._fillPath = this.svgOptionGroup.elem("path", {d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X", a).replace("%Y", d).replace("%LARGE", b), class:"entry-angle-fill-area"}); - this.svgOptionGroup.appendChild(this._dividerGroup); - this._indicator && this._indicator.remove(); - this._indicator = this.svgOptionGroup.elem("line", {x1:0, y1:0, x2:a, y2:d}); - this._indicator.attr({class:"entry-angle-indicator"}); + b.getTerminateOutputBlock = function() { + for (var a = this;;) { + var b = a.getOutputBlock(); + if (!b) { + return a; + } + a = b; + } }; - a.applyValue = function() { - var b = this.optionGroup.val(); - isNaN(b) || "" === b || (b = this.modValue(b), this.setValue(b), this.updateGraph(), this.textElement.textContent = this.getValue(), this.optionGroup && this.optionGroup.val(b), this.resize()); + b.getBlockType = function() { + if (!this.view) { + return null; + } + var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); + return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; }; - a.resize = function() { - var b = this.getTextWidth(); - this._header.attr({width:b}); - this.optionGroup && this.optionGroup.css({width:b}); - this.box.set({width:b}); - this._block.view.alignContent(); + b.indexOfStatements = function(a) { + return this.statements.indexOf(a); }; - a.getTextWidth = function() { - return this.textElement ? this.textElement.getComputedTextLength() + 8 : 8; + b.pointer = function(a) { + a || (a = []); + return this.thread.pointer(a, this); }; - a.getText = function() { - return this.getValue() + "\u00b0"; + b.targetPointer = function() { + var a = this.thread.pointer([], this); + 4 === a.length && 0 === a[3] && a.pop(); + return a; }; - a.modValue = function(b) { - return b % 360; + b.getBlockList = function(a, b) { + var c = []; + if (!this._schema) { + return []; + } + if (a && this._schema.isPrimitive) { + return c; + } + (b || this.type) === this.type && c.push(this); + for (var e = this.params, f = 0;f < e.length;f++) { + var g = e[f]; + g && g.constructor == Entry.Block && (c = c.concat(g.getBlockList(a, b))); + } + if (e = this.statements) { + for (f = 0;f < e.length;f++) { + c = c.concat(e[f].getBlockList(a, b)); + } + } + return c; }; - a.destroyOption = function() { - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this.svgOptionGroup && (this.svgOptionGroup.remove(), delete this.svgOptionGroup); - this.textElement.textContent = this.getText(); - this.command(); + b.stringify = function() { + return JSON.stringify(this.toJSON()); }; -})(Entry.FieldAngle.prototype); -Entry.FieldColor = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = a; - this._index = c; - this._position = a.position; - this.key = a.key; - this.setValue(this.getValue() || "#FF0000"); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._CONTENT_WIDTH = this.getContentWidth(); - this.renderStart(b); +})(Entry.Block.prototype); +Entry.ThreadView = function(b, a) { + Entry.Model(this, !1); + this.thread = b; + this.svgGroup = a.svgThreadGroup.elem("g"); + this.parent = a; }; -Entry.Utils.inherit(Entry.Field, Entry.FieldColor); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var b = this._CONTENT_HEIGHT, a = this._CONTENT_WIDTH, d = this._position, e; - d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -b / 2); - this._header = this.svgGroup.elem("rect", {x:e, y:d, width:a, height:b, fill:this.getValue()}); - this._bindRenderOptions(); - this.box.set({x:e, y:d, width:a, height:b}); +(function(b) { + b.schema = {height:0, zIndex:0}; + b.destroy = function() { + this.svgGroup.remove(); }; - a.renderOptions = function() { - var b = this; - this._attachDisposeEvent(); - var a = Entry.FieldColor.getWidgetColorList(); - this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); - for (var d = 0;d < a.length;d++) { - for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < a[d].length;f++) { - var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = a[d][f]; - g.css({"background-color":h}); - g.attr({"data-color-value":h}); - (function(a, c) { - a.mousedown(function(b) { - b.stopPropagation(); - }); - a.mouseup(function(a) { - b.applyValue(c); - b.destroyOption(); - b._selectBlockView(); - }); - })(g, h); - } + b.setParent = function(a) { + this.parent = a; + }; + b.getParent = function() { + return this.parent; + }; + b.renderText = function() { + for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { + a[b].view.renderText(); + } + }; + b.renderBlock = function() { + for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { + a[b].view.renderBlock(); } - a = this.getAbsolutePosFromDocument(); - a.y += this.box.height / 2 + 1; - this.optionGroup.css({left:a.x, top:a.y}); }; - a.applyValue = function(b) { - this.value != b && (this.setValue(b), this._header.attr({fill:b})); + b.requestAbsoluteCoordinate = function(a) { + var b = this.thread.getBlocks(), c = b.shift(), e = {x:0, y:0}; + for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());c && c.view !== a && c.view;) { + c = c.view, e.x += c.x + c.magnet.next.x, e.y += c.y + c.magnet.next.y, c = b.shift(); + } + return e; }; - a.getContentWidth = function() { - return Entry.isMobile() ? 20 : 14.5; + b.requestPartHeight = function(a, b) { + for (var c = this.thread.getBlocks(), e = c.pop(), f = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;e && e.view !== a && e.view;) { + e = e.view, f = e.magnet.next ? f + e.magnet.next.y : f + e.height, e.dragMode === Entry.DRAG_MODE_DRAG && (f = 0), e = c.pop(); + } + return f; }; -})(Entry.FieldColor.prototype); -Entry.FieldColor.getWidgetColorList = function() { - return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), - "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; -}; -Entry.FieldDropdown = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = a; - this._noArrow = a.noArrow; - this._arrowColor = a.arrowColor; - this._index = c; - this.setValue(this.getValue()); - this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); - this._FONT_SIZE = this.getFontSize(a.fontSize); - this._ROUND = a.roundValue || 3; - this.renderStart(); + b.dominate = function() { + this.parent.dominate(this.thread); + }; + b.isGlobal = function() { + return this.parent instanceof Entry.Board; + }; + b.reDraw = function() { + for (var a = this.thread._data, b = a.length - 1;0 <= b;b--) { + a[b].view.reDraw(); + } + }; + b.setZIndex = function(a) { + this.set({zIndex:a}); + }; +})(Entry.ThreadView.prototype); +Entry.FieldTrashcan = function(b) { + b && this.setBoard(b); + this.dragBlockObserver = this.dragBlock = null; + this.isOver = !1; + Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var b = this._blockView, a = Entry.isMobile(), d = a ? 33 : 20, a = a ? 24 : 10; - this.svgGroup = b.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); - this.textElement = this.svgGroup.elem("text", {x:5}); - this.textElement.textContent = this.getTextByValue(this.getValue()); - b = this.textElement.getBBox(); - this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * b.height}); - d = this.textElement.getBoundingClientRect().width + d; - this._noArrow && (d -= a); - a = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:d, height:a, y:-a / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._noArrow || (b = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:b.points, fill:b.color, stroke:b.color, transform:"translate(" + (d - b.width - 5) + "," + -b.height / 2 + ")"})); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:d, height:a}); +(function(b) { + b._generateView = function() { + this.svgGroup = this.board.svg.elem("g"); + this.renderStart(); + this._addControl(); }; - a.resize = function() { - var b = Entry.isMobile(), a = b ? 33 : 20, b = b ? 24 : 10, a = this.textElement.getBoundingClientRect().width + a; - this._noArrow ? a -= b : (b = this.getArrow(), this._arrow.attr({transform:"translate(" + (a - b.width - 5) + "," + -b.height / 2 + ")"})); - this._header.attr({width:a}); - this.box.set({width:a}); - this._block.view.alignContent(); + b.renderStart = function() { + var a = Entry.mediaFilePath + "delete_"; + this.trashcanTop = this.svgGroup.elem("image", {href:a + "cover.png", width:60, height:20}); + this.svgGroup.elem("image", {href:a + "body.png", y:20, width:60, height:60}); }; - a.renderOptions = function() { - var b = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(b) { - b.stopPropagation(); + b._addControl = function() { + $(this.svgGroup).bind("mousedown", function(a) { + Entry.Utils.isRightButton(a) && (a.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); }); - for (var a = this._contents.options, a = this._contents.options, d = 0, e = a.length;d < e;d++) { - var f = a[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); - Entry.Dom("span", {class:"right", parent:h}).text(g); - this.getValue() == f && k.text("\u2713"); - (function(a, c) { - a.bind("mousedown touchstart", function(b) { - b.stopPropagation(); - }); - a.bind("mouseup touchend", function(a) { - a.stopPropagation(); - b.applyValue(c); - b.destroyOption(); - b._selectBlockView(); - }); - })(h, f); - } - this._position(); }; - a._position = function() { - var b = this.getAbsolutePosFromDocument(); - b.y += this.box.height / 2; - var a = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; - if (a < b.y + d + 30) { - var a = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); - this._blockView.y < a / 2 ? (b.x += this.box.width / 2 - e / 2, a -= f.y + 30, this.optionGroup.height(a)) : (b.x += this.box.width + 1, a -= a - f.y, a - 30 < d && this.optionGroup.height(a - a % 30), b.y -= this.optionGroup.height()); - } else { - b.x += this.box.width / 2 - e / 2; + b.updateDragBlock = function() { + var a = this.board.dragBlock, b = this.dragBlockObserver; + b && (b.destroy(), this.dragBlockObserver = null); + a ? this.dragBlockObserver = a.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); + this.dragBlock = a; + }; + b.checkBlock = function() { + var a = this.dragBlock; + if (a && a.block.isDeletable()) { + var b = this.board.offset(), c = this.getPosition(), e = c.x + b.left, b = c.y + b.top, f, g; + if (a = a.dragInstance) { + f = a.offsetX, g = a.offsetY; + } + this.tAnimation(f >= e && g >= b); } - this.optionGroup.addClass("rendered"); - this.optionGroup.css({left:b.x, top:b.y, width:e}); - this.optionGroup.find(".right").width(e - 20); }; - a.applyValue = function(b) { - this.value != b && this.setValue(b); - this.textElement.textContent = this.getTextByValue(b); - this.resize(); + b.align = function() { + var a = this.getPosition(); + this.svgGroup.attr({transform:"translate(" + a.x + "," + a.y + ")"}); }; - a.getTextByValue = function(b) { - if (!b || "null" === b) { - return Lang.Blocks.no_target; - } - for (var a = this._contents.options, d = 0, e = a.length;d < e;d++) { - var f = a[d]; - if (f[1] == b) { - return f[0]; - } + b.setPosition = function() { + if (this.board) { + var a = this.board.svgDom; + this._x = a.width() - 110; + this._y = a.height() - 110; + this.align(); } - return Lang.Blocks.no_target; }; - a.getContentHeight = function(b) { - return b = b || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); + b.getPosition = function() { + return {x:this._x, y:this._y}; }; - a.getArrow = function() { - var b = Entry.isMobile(); - return {color:this._arrowColor || this._blockView._schema.color, points:b ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:b ? 13 : 4.2, width:b ? 19 : 6.4}; + b.tAnimation = function(a) { + if (a !== this.isOver) { + a = void 0 === a ? !0 : a; + var b, c = this.trashcanTop; + b = a ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; + $(c).velocity(b, {duration:50}); + this.isOver = a; + } }; -})(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = a; - this._index = c; - this._arrowColor = a.arrowColor; - c = this._contents.menuName; - Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); - this._FONT_SIZE = this.getFontSize(a.fontSize); - this._ROUND = a.roundValue || 3; - this.renderStart(b); + b.setBoard = function(a) { + this._dragBlockObserver && this._dragBlockObserver.destroy(); + this.board = a; + this.svgGroup || this._generateView(); + var b = a.svg, c = b.firstChild; + c ? b.insertBefore(this.svgGroup, c) : b.appendChild(this.svgGroup); + this._dragBlockObserver = a.observe(this, "updateDragBlock", ["dragBlock"]); + this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + a.suffix + ")"}); + this.setPosition(); + }; +})(Entry.FieldTrashcan.prototype); +Entry.Vim = function(b, a) { + Entry.Vim.MAZE_MODE = 1; + Entry.Vim.WORKSPACE_MODE = 2; + Entry.Vim.TEXT_TYPE_JS = 0; + Entry.Vim.TEXT_TYPE_PY = 1; + Entry.Vim.PARSER_TYPE_JS_TO_BLOCK = 0; + Entry.Vim.PARSER_TYPE_PY_TO_BLOCK = 1; + Entry.Vim.PARSER_TYPE_BLOCK_TO_JS = 2; + Entry.Vim.PARSER_TYPE_BLOCK_TO_PY = 3; + Entry.Vim.PYTHON_IMPORT_ENTRY = "import Entry"; + Entry.Vim.PYTHON_IMPORT_HW = "import Arduino, Hamster, Albert, Bitbrick, Codeino, Dplay \n\t Neobot, Nemoino, Robotis, Sensorboard, Xbot from Hw"; + b = "string" === typeof b ? $("#" + b) : $(b); + if ("DIV" !== b.prop("tagName")) { + return console.error("Dom is not div element"); + } + this.createDom(b); + this._mode = Entry.Vim.WORKSPACE_MODE; + this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; + this._parser = new Entry.Parser(this._mode, this._parserType, this.codeMirror); + Entry.Model(this, !1); + window.eventset = []; }; -Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); -(function(a) { - a.constructor = Entry.FieldDropDownDynamic; - a._updateValue = function() { - var b = this._block.getCode().object, a = []; - Entry.container && (a = this._menuName ? Entry.container.getDropdownList(this._menuName, b) : this._menuGenerator()); - this._contents.options = a; - b = this.getValue(); - if (this._blockView.isInBlockMenu || !b || "null" == b) { - b = 0 !== a.length ? a[0][1] : null; - } - this.setValue(b); - }; - a.renderOptions = function() { - var b = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(b) { - b.stopPropagation(); - }); - var a; - a = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); - this._contents.options = a; - for (var d = 0;d < a.length;d++) { - var e = a[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); - Entry.Dom("span", {class:"right", parent:g}).text(f); - this.getValue() == e && h.text("\u2713"); - (function(a, c) { - a.mousedown(function(b) { - b.stopPropagation(); - }); - a.mouseup(function(a) { - a.stopPropagation(); - b.applyValue(c); - b.destroyOption(); - b._selectBlockView(); - }); - })(g, e); +(function(b) { + b.createDom = function(a) { + function b(a) { + var c = e.getCodeToText(a.block); + e.codeMirror.display.dragFunctions.leave(a); + var d = Entry.Utils.createMouseEvent("mousedown", a); + e.codeMirror.display.scroller.dispatchEvent(d); + var c = c.split("\n"), k = c.length - 1, l = 0; + c.forEach(function(a, b) { + e.codeMirror.replaceSelection(a); + l = e.doc.getCursor().line; + e.codeMirror.indentLine(l); + 0 !== b && k === b || e.codeMirror.replaceSelection("\n"); + }); + a = Entry.Utils.createMouseEvent("mouseup", a); + e.codeMirror.display.scroller.dispatchEvent(a); } - this._position(); + function c(a) { + e.codeMirror.display.dragFunctions.over(a); + } + var e; + this.view = Entry.Dom("div", {parent:a, class:"entryVimBoard"}); + this.codeMirror = CodeMirror(this.view[0], {lineNumbers:!0, value:"", mode:{name:"javascript", globalVars:!0}, theme:"default", indentUnit:4, indentWithTabs:!0, styleActiveLine:!0, extraKeys:{"Ctrl-Space":"autocomplete"}, lint:!0, viewportMargin:10}); + this.doc = this.codeMirror.getDoc(); + e = this; + a = this.view[0]; + a.removeEventListener("dragEnd", b); + a.removeEventListener("dragOver", c); + a.addEventListener("dragEnd", b); + a.addEventListener("dragOver", c); }; -})(Entry.FieldDropdownDynamic.prototype); -Entry.FieldImage = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this._content = a; - this.box = new Entry.BoxModel; - this._size = a.size; - this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; - this._position = a.position; - this._imgElement = this._path = this.svgGroup = null; - this._index = c; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldImage); -(function(a) { - a.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); - this.box.set({x:this._size, y:0, width:this._size, height:this._size}); + b.hide = function() { + this.view.addClass("entryRemove"); }; -})(Entry.FieldImage.prototype); -Entry.FieldIndicator = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this._size = a.size; - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? a.img.replace(".png", "_un.png") : a.img; - this._boxMultiplier = a.boxMultiplier || 2; - this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; - this._position = a.position; - this._index = c; - this._imgElement = this._path = this.svgGroup = null; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); -(function(a) { - a.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); - var b = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); - this._path = this.svgGroup.elem("path", {d:b, stroke:"none", fill:"none"}); - this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); + b.show = function() { + this.view.removeClass("entryRemove"); }; - a.enableHighlight = function() { - var b = this._path.getTotalLength(), a = this._path; - this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":b + " " + b, "stroke-dashoffset":b}); - setInterval(function() { - a.attr({"stroke-dashoffset":b}).animate({"stroke-dashoffset":0}, 300); - }, 1400, mina.easeout); - setTimeout(function() { - setInterval(function() { - a.animate({"stroke-dashoffset":-b}, 300); - }, 1400, mina.easeout); - }, 500); + b.textToCode = function(a) { + a === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : a === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); + a = this.codeMirror.getValue(); + return this._parser.parse(a); }; -})(Entry.FieldIndicator.prototype); -Entry.Keyboard = {}; -Entry.FieldKeyboard = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = a.position; - this._contents = a; - this._index = c; - this.setValue(String(this.getValue())); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._optionVisible = !1; - this.renderStart(b); + b.codeToText = function(a, b) { + var c; + b && (this._mode = b.runType); + Entry.playground && (c = Entry.playground.object, c = "# " + c.name + " \uc624\ube0c\uc81d\ud2b8\uc758 \ud30c\uc774\uc36c \ucf54\ub4dc"); + var e = b.textType; + e === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : e === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); + var f = this._parser.parse(a, Entry.Parser.PARSE_GENERAL); + e === Entry.Vim.TEXT_TYPE_PY && (f = c.concat("\n\n").concat(Entry.Vim.PYTHON_IMPORT_ENTRY).concat("\n\n").concat(f)); + this.codeMirror.setValue(f + "\n"); + e == Entry.Vim.TEXT_TYPE_PY && this.codeMirror.getDoc().markText({line:0, ch:0}, {line:4, ch:0}, {readOnly:!0}); + c = this.codeMirror.getDoc(); + c.setCursor({line:c.lastLine() - 1}); + }; + b.getCodeToText = function(a) { + var b = this.workspace.oldTextType; + b === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : b === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); + return this._parser.parse(a, Entry.Parser.PARSE_SYNTAX); + }; + b.setParserAvailableCode = function(a, b) { + this._parser.setAvailableCode(a, b); + }; +})(Entry.Vim.prototype); +Entry.Workspace = function(b) { + Entry.Model(this, !1); + this.observe(this, "_handleChangeBoard", ["selectedBoard"], !1); + this.trashcan = new Entry.FieldTrashcan; + var a = b.blockMenu; + a && (this.blockMenu = new Entry.BlockMenu(a.dom, a.align, a.categoryData, a.scroll), this.blockMenu.workspace = this, this.blockMenu.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1)); + if (a = b.board) { + a.workspace = this, this.board = new Entry.Board(a), this.board.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1), this.set({selectedBoard:this.board}); + } + if (a = b.vimBoard) { + this.vimBoard = new Entry.Vim(a.dom), this.vimBoard.workspace = this; + } + this.board && this.vimBoard && this.vimBoard.hide(); + Entry.GlobalSvg.createDom(); + this.mode = Entry.Workspace.MODE_BOARD; + Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); + this.changeEvent = new Entry.Event(this); + Entry.commander.setCurrentEditor("board", this.board); + this.textType = Entry.Vim.TEXT_TYPE_PY; }; -Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); - this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; - var b = this.getTextWidth() + 1, a = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - a / 2, width:b, height:a, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:b, height:a}); +Entry.Workspace.MODE_BOARD = 0; +Entry.Workspace.MODE_VIMBOARD = 1; +Entry.Workspace.MODE_OVERLAYBOARD = 2; +(function(b) { + b.schema = {selectedBlockView:null, selectedBoard:null}; + b.getBoard = function() { + return this.board; }; - a.renderOptions = function() { - Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); - this._optionVisible = !0; - this._attachDisposeEvent(); - var b = this.getAbsolutePosFromDocument(); - b.x -= this.box.width / 2; - b.y += this.box.height / 2 + 1; - this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); - this.optionGroup.css({left:b.x, top:b.y}); + b.getSelectedBoard = function() { + return this.selectedBoard; }; - a.destroyOption = function() { - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this._optionVisible = !1; - this.command(); - this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); + b.getBlockMenu = function() { + return this.blockMenu; }; - a._keyboardControl = function(b) { - b.stopPropagation(); - if (this._optionVisible) { - b = b.keyCode; - var a = Entry.getKeyCodeMap()[b]; - void 0 !== a && this.applyValue(a, b); + b.getVimBoard = function() { + return this.vimBoard; + }; + b.getMode = function() { + return this.mode; + }; + b.setMode = function(a, b) { + "number" === typeof a ? this.mode = a : (this.mode = a.boardType, this.runType = a.runType, this.textType = a.textType); + switch(this.mode) { + case this.oldMode: + return; + case Entry.Workspace.MODE_VIMBOARD: + try { + this.board && this.board.hide(), this.overlayBoard && this.overlayBoard.hide(), this.set({selectedBoard:this.vimBoard}), this.vimBoard.show(), this.codeToText(this.board.code, a), this.blockMenu.renderText(function() { + this.blockMenu.reDraw(); + }.bind(this)), this.board.clear(), this.oldTextType = this.textType; + } catch (c) { + } + break; + case Entry.Workspace.MODE_BOARD: + try { + this.board.show(), this.set({selectedBoard:this.board}), this.textToCode(this.oldMode, this.oldTextType), this.vimBoard && this.vimBoard.hide(), this.overlayBoard && this.overlayBoard.hide(), this.blockMenu.renderBlock(function() { + this.blockMenu.reDraw(); + }.bind(this)), this.oldTextType = this.textType; + } catch (c) { + this.board && this.board.hide(), this.set({selectedBoard:this.vimBoard}), this.mode = Entry.Workspace.MODE_VIMBOARD, this.oldTextType == Entry.Vim.PARSER_TYPE_JS_TO_BLOCK ? (a.boardType = Entry.Workspace.MODE_VIMBOARD, a.textType = Entry.Vim.TEXT_TYPE_JS, a.runType = Entry.Vim.MAZE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK, Entry.dispatchEvent("changeMode", a), Ntry.dispatchEvent("textError", a)) : this.oldTextType == Entry.Vim.PARSER_TYPE_PY_TO_BLOCK && (a.boardType = + Entry.Workspace.MODE_VIMBOARD, a.textType = Entry.Vim.TEXT_TYPE_PY, a.runType = Entry.Vim.WORKSPACE_MODE, this.oldTextType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK, Entry.dispatchEvent("changeMode", a)); + } + Entry.commander.setCurrentEditor("board", this.board); + break; + case Entry.Workspace.MODE_OVERLAYBOARD: + this.overlayBoard || this.initOverlayBoard(), this.overlayBoard.show(), this.set({selectedBoard:this.overlayBoard}), Entry.commander.setCurrentEditor("board", this.overlayBoard); + } + this.oldMode = this.mode; + this.changeEvent.notify(b); + }; + b.changeBoardCode = function(a) { + this._syncTextCode(); + this.board.changeCode(a); + this.mode === Entry.Workspace.MODE_VIMBOARD && this.codeToText(this.board.code); + }; + b.changeOverlayBoardCode = function(a) { + this.overlayBoard && this.overlayBoard.changeCode(a); + }; + b.changeBlockMenuCode = function(a) { + this.blockMenu.changeCode(a); + }; + b.textToCode = function(a, b) { + if (a == Entry.Workspace.MODE_VIMBOARD) { + var c = this, e = this.vimBoard.textToCode(b), f = this.board, g = f.code; + g.load(e); + g.createView(f); + this.board.reDraw(); + setTimeout(function() { + c.board.alignThreads(); + }, 0); } }; - a.applyValue = function(b, a) { - this.setValue(String(a)); - this.destroyOption(); - this.textElement.textContent = b; - this.resize(); + b.codeToText = function(a, b) { + return this.vimBoard.codeToText(a, b); + }; + b.getCodeToText = function(a) { + return this.vimBoard.getCodeToText(a); + }; + b._setSelectedBlockView = function() { + this.set({selectedBlockView:this.board.selectedBlockView || this.blockMenu.selectedBlockView || (this.overlayBoard ? this.overlayBoard.selectedBlockView : null)}); + }; + b.initOverlayBoard = function() { + this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); + this.overlayBoard.changeCode(new Entry.Code([])); + this.overlayBoard.workspace = this; + this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); + }; + b._keyboardControl = function(a) { + var b = a.keyCode || a.which, c = a.ctrlKey; + if (!Entry.Utils.isInInput(a)) { + var e = this.selectedBlockView; + e && !e.isInBlockMenu && e.block.isDeletable() && (8 == b || 46 == b ? (Entry.do("destroyBlock", e.block), a.preventDefault()) : c && (67 == b ? e.block.copyToClipboard() : 88 == b && (a = e.block, a.copyToClipboard(), a.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); + c && 86 == b && (b = this.selectedBoard) && b instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); + } }; - a.resize = function() { - var b = this.getTextWidth() + 1; - this._header.attr({width:b}); - this.box.set({width:b}); - this._blockView.alignContent(); + b._handleChangeBoard = function() { + var a = this.selectedBoard; + a && a.constructor === Entry.Board && this.trashcan.setBoard(a); }; - a.getTextWidth = function() { - return this.textElement.getComputedTextLength() + 10; + b._syncTextCode = function() { + if (this.mode === Entry.Workspace.MODE_VIMBOARD) { + var a = this.vimBoard.textToCode(this.textType), b = this.board, c = b.code; + c.load(a); + c.createView(b); + this.board.alignThreads(); + } }; - a.destroy = function() { - this.destroyOption(); - Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); + b.addVimBoard = function(a) { + this.vimBoard || (this.vimBoard = new Entry.Vim(a), this.vimBoard.workspace = this, this.vimBoard.hide()); }; -})(Entry.FieldKeyboard.prototype); -Entry.FieldLineBreak = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this._index = c; - this.box = new Entry.BoxModel; - this.setValue(null); - this.renderStart(); +})(Entry.Workspace.prototype); +Entry.Playground = function() { + this.enableArduino = this.isTextBGMode_ = !1; + this.viewMode_ = "default"; + var b = this; + Entry.addEventListener("textEdited", this.injectText); + Entry.addEventListener("hwChanged", this.updateHW); + Entry.addEventListener("changeMode", function(a) { + b.setMode(a); + }); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); -(function(a) { - a.renderStart = function() { - }; - a.align = function(b) { - var a = this._blockView; - 0 !== a._statements.length && this.box.set({y:(a._statements[b].height || 20) + Math.max(a.contentHeight % 1E3, 30)}); - }; -})(Entry.FieldLineBreak.prototype); -Entry.FieldOutput = function(a, b, c, d, e) { - Entry.Model(this, !1); - this._blockView = b; - this._block = b.block; - this._valueBlock = null; - this.box = new Entry.BoxModel; - this.changeEvent = new Entry.Event(this); - this._index = c; - this.contentIndex = e; - this._content = a; - this.acceptType = a.accept; - this.view = this; - this.svgGroup = null; - this._position = a.position; - this.box.observe(b, "alignContent", ["width", "height"]); - this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(b.getBoard(), d); +Entry.Playground.prototype.setMode = function(b) { + this.mainWorkspace.setMode(b); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); -(function(a) { - a.schema = {magneting:!1}; - a.renderStart = function(b, a) { - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this.view = this; - this._nextGroup = this.svgGroup; - this.box.set({x:0, y:0, width:0, height:20}); - var c = this.getValue(); - c && !c.view && (c.setThread(this), c.createView(b, a)); - this._updateValueBlock(c); - this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); +Entry.Playground.prototype.generateView = function(b, a) { + this.view_ = b; + this.view_.addClass("entryPlayground"); + if (a && "workspace" != a) { + "phone" == a && (this.view_.addClass("entryPlaygroundPhone"), d = Entry.createElement("div", "entryCategoryTab"), d.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(d, this.view_), this.generateTabView(d), this.tabView_ = d, d = Entry.createElement("div", "entryCurtain"), d.addClass("entryPlaygroundCurtainPhone"), d.addClass("entryRemove"), d.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, d.bindOnClick(function() { + Entry.engine.toggleStop(); + }), this.view_.appendChild(d), this.curtainView_ = d, Entry.pictureEditable && (d = Entry.createElement("div", "entryPicture"), d.addClass("entryPlaygroundPicturePhone"), d.addClass("entryRemove"), this.view_.appendChild(d), this.generatePictureView(d), this.pictureView_ = d), d = Entry.createElement("div", "entryText"), d.addClass("entryRemove"), this.view_.appendChild(d), this.generateTextView(d), this.textView_ = d, Entry.soundEditable && (d = Entry.createElement("div", "entrySound"), d.addClass("entryPlaygroundSoundWorkspacePhone"), + d.addClass("entryRemove"), this.view_.appendChild(d), this.generateSoundView(d), this.soundView_ = d), d = Entry.createElement("div", "entryDefault"), this.view_.appendChild(d), this.generateDefaultView(d), this.defaultView_ = d, d = Entry.createElement("div", "entryCode"), d.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(d), this.generateCodeView(d), this.codeView_ = this.codeView_ = d, Entry.addEventListener("run", function(a) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }), Entry.addEventListener("stop", function(a) { + Entry.playground.curtainView_.addClass("entryRemove"); + })); + } else { + this.view_.addClass("entryPlaygroundWorkspace"); + var d = Entry.createElement("div", "entryCategoryTab"); + d.addClass("entryPlaygroundTabWorkspace"); + this.view_.appendChild(d); + this.generateTabView(d); + this.tabView_ = d; + d = Entry.createElement("div", "entryCurtain"); + d.addClass("entryPlaygroundCurtainWorkspace"); + d.addClass("entryRemove"); + var c = Lang.Workspace.cannot_edit_click_to_stop.split("."); + d.innerHTML = c[0] + ".
" + c[1]; + d.addEventListener("click", function() { + Entry.engine.toggleStop(); + }); + this.view_.appendChild(d); + this.curtainView_ = d; + Entry.pictureEditable && (d = Entry.createElement("div", "entryPicture"), d.addClass("entryPlaygroundPictureWorkspace"), d.addClass("entryRemove"), this.view_.appendChild(d), this.generatePictureView(d), this.pictureView_ = d); + d = Entry.createElement("div", "entryText"); + d.addClass("entryPlaygroundTextWorkspace"); + d.addClass("entryRemove"); + this.view_.appendChild(d); + this.generateTextView(d); + this.textView_ = d; + Entry.soundEditable && (d = Entry.createElement("div", "entrySound"), d.addClass("entryPlaygroundSoundWorkspace"), d.addClass("entryRemove"), this.view_.appendChild(d), this.generateSoundView(d), this.soundView_ = d); + d = Entry.createElement("div", "entryDefault"); + d.addClass("entryPlaygroundDefaultWorkspace"); + this.view_.appendChild(d); + this.generateDefaultView(d); + this.defaultView_ = d; + d = Entry.createElement("div", "entryCode"); + d.addClass("entryPlaygroundCodeWorkspace"); + d.addClass("entryRemove"); + this.view_.appendChild(d); + this.generateCodeView(d); + this.codeView_ = d; + c = Entry.createElement("div"); + c.addClass("entryPlaygroundResizeWorkspace", "entryRemove"); + this.resizeHandle_ = c; + this.view_.appendChild(c); + this.initializeResizeHandle(c); + this.codeView_ = d; + Entry.addEventListener("run", function(a) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }); + Entry.addEventListener("stop", function(a) { + Entry.playground.curtainView_.addClass("entryRemove"); + }); + } +}; +Entry.Playground.prototype.generateDefaultView = function(b) { + return b; +}; +Entry.Playground.prototype.generateTabView = function(b) { + var a = this, d = Entry.createElement("ul"); + d.addClass("entryTabListWorkspace"); + this.tabList_ = d; + b.appendChild(d); + this.tabViewElements = {}; + b = Entry.createElement("li", "entryCodeTab"); + b.innerHTML = Lang.Workspace.tab_code; + b.addClass("entryTabListItemWorkspace"); + b.addClass("entryTabSelected"); + d.appendChild(b); + b.bindOnClick(function(b) { + a.changeViewMode("code"); + a.blockMenu.reDraw(); + }); + this.tabViewElements.code = b; + Entry.pictureEditable && (b = Entry.createElement("li", "entryPictureTab"), b.innerHTML = Lang.Workspace.tab_picture, b.addClass("entryTabListItemWorkspace"), d.appendChild(b), b.bindOnClick(function(a) { + Entry.playground.changeViewMode("picture"); + }), this.tabViewElements.picture = b, b = Entry.createElement("li", "entryTextboxTab"), b.innerHTML = Lang.Workspace.tab_text, b.addClass("entryTabListItemWorkspace"), d.appendChild(b), b.bindOnClick(function(a) { + Entry.playground.changeViewMode("text"); + }), this.tabViewElements.text = b, b.addClass("entryRemove")); + Entry.soundEditable && (b = Entry.createElement("li", "entrySoundTab"), b.innerHTML = Lang.Workspace.tab_sound, b.addClass("entryTabListItemWorkspace"), d.appendChild(b), b.bindOnClick(function(a) { + Entry.playground.changeViewMode("sound"); + }), this.tabViewElements.sound = b); + Entry.hasVariableManager && (b = Entry.createElement("li", "entryVariableTab"), b.innerHTML = Lang.Workspace.tab_attribute, b.addClass("entryTabListItemWorkspace"), b.addClass("entryVariableTabWorkspace"), d.appendChild(b), b.bindOnClick(function(a) { + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); + }), this.tabViewElements.variable = b); +}; +Entry.Playground.prototype.generateCodeView = function(b) { + var a = this.createVariableView(); + b.appendChild(a); + this.variableView_ = a; + b = Entry.Dom(b); + a = Entry.Dom("div", {parent:b, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); + b = Entry.Dom("div", {parent:b, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); + this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:b, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:a}}); + this.blockMenu = this.mainWorkspace.blockMenu; + this.board = this.mainWorkspace.board; + Entry.hw && this.updateHW(); +}; +Entry.Playground.prototype.generatePictureView = function(b) { + if ("workspace" == Entry.type) { + var a = Entry.createElement("div", "entryAddPicture"); + a.addClass("entryPlaygroundAddPicture"); + a.bindOnClick(function(a) { + Entry.dispatchEvent("openPictureManager"); + }); + var d = Entry.createElement("div", "entryAddPictureInner"); + d.addClass("entryPlaygroundAddPictureInner"); + d.innerHTML = Lang.Workspace.picture_add; + a.appendChild(d); + b.appendChild(a); + a = Entry.createElement("ul", "entryPictureList"); + a.addClass("entryPlaygroundPictureList"); + $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + var d = b.item.data("start_pos"), g = b.item.index(); + Entry.playground.movePicture(d, g); + }, axis:"y"}); + b.appendChild(a); + this.pictureListView_ = a; + a = Entry.createElement("div", "entryPainter"); + a.addClass("entryPlaygroundPainter"); + b.appendChild(a); + this.painter = new Entry.Painter2(a); + } else { + "phone" == Entry.type && (a = Entry.createElement("div", "entryAddPicture"), a.addClass("entryPlaygroundAddPicturePhone"), a.bindOnClick(function(a) { + Entry.dispatchEvent("openPictureManager"); + }), d = Entry.createElement("div", "entryAddPictureInner"), d.addClass("entryPlaygroundAddPictureInnerPhone"), d.innerHTML = Lang.Workspace.picture_add, a.appendChild(d), b.appendChild(a), a = Entry.createElement("ul", "entryPictureList"), a.addClass("entryPlaygroundPictureListPhone"), $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + var d = b.item.data("start_pos"), g = b.item.index(); + Entry.playground.movePicture(d, g); + }, axis:"y"}), b.appendChild(a), this.pictureListView_ = a); + } +}; +Entry.Playground.prototype.generateTextView = function(b) { + var a = Entry.createElement("div"); + b.appendChild(a); + b = Entry.createElement("div"); + b.addClass("textProperties"); + a.appendChild(b); + var d = Entry.createElement("div"); + d.addClass("entryTextFontSelect"); + b.appendChild(d); + var c = Entry.createElement("select", "entryPainterAttrFontName"); + c.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); + c.size = "1"; + c.onchange = function(a) { + Entry.playground.object.entity.setFontType(a.target.value); }; - a.align = function(b, a, d) { - var c = this.svgGroup; - this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); - var f = this._valueBlock; - f && (a = -.5 * f.view.height); - f = "translate(" + b + "," + a + ")"; - void 0 === d || d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); - this.box.set({x:b, y:a}); + for (var e = 0;e < Entry.fonts.length;e++) { + var f = Entry.fonts[e], g = Entry.createElement("option"); + g.value = f.family; + g.innerHTML = f.name; + c.appendChild(g); + } + this.fontName_ = c; + d.appendChild(c); + e = Entry.createElement("ul"); + e.addClass("entryPlayground_text_buttons"); + b.appendChild(e); + d = Entry.createElement("li"); + d.addClass("entryPlaygroundTextAlignLeft"); + d.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); + }); + e.appendChild(d); + this.alignLeftBtn = d; + d = Entry.createElement("li"); + d.addClass("entryPlaygroundTextAlignCenter"); + d.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); + }); + e.appendChild(d); + this.alignCenterBtn = d; + d = Entry.createElement("li"); + d.addClass("entryPlaygroundTextAlignRight"); + d.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); + }); + e.appendChild(d); + this.alignRightBtn = d; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; + }); + var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); + c.appendChild(h); + h.src = Entry.mediaFilePath + "text_button_bold_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + var a = !Entry.playground.object.entity.getUnderLine() || !1; + k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; + Entry.playground.object.entity.setUnderLine(a); + }); + var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); + c.appendChild(k); + k.src = Entry.mediaFilePath + "text_button_underline_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; + }); + var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); + c.appendChild(l); + l.src = Entry.mediaFilePath + "text_button_italic_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + var a = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(a); + m.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; + }); + var m = Entry.createElement("img", "entryPlaygroundText_strikeImage"); + c.appendChild(m); + m.src = Entry.mediaFilePath + "text_button_strike_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { + Entry.playground.toggleColourChooser("foreground"); + }); + c = Entry.createElement("img"); + d.appendChild(c); + c.src = Entry.mediaFilePath + "text_button_color_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + e = Entry.createElement("a"); + d.appendChild(e); + e.bindOnClick(function() { + Entry.playground.toggleColourChooser("background"); + }); + d = Entry.createElement("img"); + e.appendChild(d); + d.src = Entry.mediaFilePath + "text_button_background_false.png"; + e = Entry.createElement("div"); + e.addClass("entryPlayground_fgColorDiv"); + d = Entry.createElement("div"); + d.addClass("entryPlayground_bgColorDiv"); + b.appendChild(e); + b.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundTextColoursWrapper"); + this.coloursWrapper = c; + a.appendChild(c); + b = Entry.getColourCodes(); + for (e = 0;e < b.length;e++) { + d = Entry.createElement("div"), d.addClass("modal_colour"), d.setAttribute("colour", b[e]), d.style.backgroundColor = b[e], 0 === e && d.addClass("modalColourTrans"), d.bindOnClick(function(a) { + Entry.playground.setTextColour(a.target.getAttribute("colour")); + }), c.appendChild(d); + } + c.style.display = "none"; + c = Entry.createElement("div"); + c.addClass("entryPlaygroundTextBackgroundsWrapper"); + this.backgroundsWrapper = c; + a.appendChild(c); + for (e = 0;e < b.length;e++) { + d = Entry.createElement("div"), d.addClass("modal_colour"), d.setAttribute("colour", b[e]), d.style.backgroundColor = b[e], 0 === e && d.addClass("modalColourTrans"), d.bindOnClick(function(a) { + Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); + }), c.appendChild(d); + } + c.style.display = "none"; + b = Entry.createElement("input"); + b.addClass("entryPlayground_textBox"); + b.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); }; - a.calcWH = function() { - var b = this._valueBlock; - b ? (b = b.view, this.box.set({width:b.width, height:b.height})) : this.box.set({width:0, height:20}); + b.onblur = function() { + Entry.dispatchEvent("textEdited"); }; - a.calcHeight = a.calcWH; - a.destroy = function() { + this.textEditInput = b; + a.appendChild(b); + b = Entry.createElement("textarea"); + b.addClass("entryPlayground_textArea"); + b.style.display = "none"; + b.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); + }; + b.onblur = function() { + Entry.dispatchEvent("textEdited"); }; - a._inspectBlock = function() { + this.textEditArea = b; + a.appendChild(b); + b = Entry.createElement("div"); + b.addClass("entryPlaygroundFontSizeWrapper"); + a.appendChild(b); + this.fontSizeWrapper = b; + var n = Entry.createElement("div"); + n.addClass("entryPlaygroundFontSizeSlider"); + b.appendChild(n); + var q = Entry.createElement("div"); + q.addClass("entryPlaygroundFontSizeIndicator"); + n.appendChild(q); + this.fontSizeIndiciator = q; + var r = Entry.createElement("div"); + r.addClass("entryPlaygroundFontSizeKnob"); + n.appendChild(r); + this.fontSizeKnob = r; + e = Entry.createElement("div"); + e.addClass("entryPlaygroundFontSizeLabel"); + e.innerHTML = "\uae00\uc790 \ud06c\uae30"; + b.appendChild(e); + var t = !1, u = 0; + r.onmousedown = function(a) { + t = !0; + u = $(n).offset().left; }; - a._setValueBlock = function(b) { - if (b != this._valueBlock || !this._valueBlock) { - return this._valueBlock = b, this.setValue(b), b && b.setThread(this), this._valueBlock; + r.addEventListener("touchstart", function(a) { + t = !0; + u = $(n).offset().left; + }); + document.addEventListener("mousemove", function(a) { + t && (a = a.pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); + }); + document.addEventListener("touchmove", function(a) { + t && (a = a.touches[0].pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); + }); + document.addEventListener("mouseup", function(a) { + t = !1; + }); + document.addEventListener("touchend", function(a) { + t = !1; + }); + b = Entry.createElement("div"); + b.addClass("entryPlaygroundLinebreakWrapper"); + a.appendChild(b); + a = Entry.createElement("hr"); + a.addClass("entryPlaygroundLinebreakHorizontal"); + b.appendChild(a); + a = Entry.createElement("div"); + a.addClass("entryPlaygroundLinebreakButtons"); + b.appendChild(a); + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!1); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; + a.appendChild(e); + this.linebreakOffImage = e; + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!0); + v.innerHTML = Lang.Menus.linebreak_on_desc_1; + x.innerHTML = Lang.Menus.linebreak_on_desc_2; + y.innerHTML = Lang.Menus.linebreak_on_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; + a.appendChild(e); + this.linebreakOnImage = e; + a = Entry.createElement("div"); + a.addClass("entryPlaygroundLinebreakDescription"); + b.appendChild(a); + var v = Entry.createElement("p"); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + a.appendChild(v); + b = Entry.createElement("ul"); + a.appendChild(b); + var x = Entry.createElement("li"); + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + b.appendChild(x); + var y = Entry.createElement("li"); + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + b.appendChild(y); +}; +Entry.Playground.prototype.generateSoundView = function(b) { + if ("workspace" == Entry.type) { + var a = Entry.createElement("div", "entryAddSound"); + a.addClass("entryPlaygroundAddSound"); + a.bindOnClick(function(a) { + Entry.dispatchEvent("openSoundManager"); + }); + var d = Entry.createElement("div", "entryAddSoundInner"); + d.addClass("entryPlaygroundAddSoundInner"); + d.innerHTML = Lang.Workspace.sound_add; + a.appendChild(d); + b.appendChild(a); + a = Entry.createElement("ul", "entrySoundList"); + a.addClass("entryPlaygroundSoundList"); + $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + var d = b.item.data("start_pos"), g = b.item.index(); + Entry.playground.moveSound(d, g); + }, axis:"y"}); + b.appendChild(a); + this.soundListView_ = a; + } else { + "phone" == Entry.type && (a = Entry.createElement("div", "entryAddSound"), a.addClass("entryPlaygroundAddSoundPhone"), a.bindOnClick(function(a) { + Entry.dispatchEvent("openSoundManager"); + }), d = Entry.createElement("div", "entryAddSoundInner"), d.addClass("entryPlaygroundAddSoundInnerPhone"), d.innerHTML = Lang.Workspace.sound_add, a.appendChild(d), b.appendChild(a), a = Entry.createElement("ul", "entrySoundList"), a.addClass("entryPlaygroundSoundListPhone"), $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + var d = b.item.data("start_pos"), g = b.item.index(); + Entry.playground.moveSound(d, g); + }, axis:"y"}), b.appendChild(a), this.soundListView_ = a); + } +}; +Entry.Playground.prototype.injectObject = function(b) { + if (!b) { + this.changeViewMode("code"), this.object = null; + } else { + if (b !== this.object) { + this.object && this.object.toggleInformation(!1); + this.object = b; + this.setMenu(b.objectType); + this.injectCode(); + "sprite" == b.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == b.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); + var a = this.viewMode_; + "default" == a ? this.changeViewMode("code") : "picture" != a && "text" != a || "textBox" != b.objectType ? "text" != a && "picture" != a || "sprite" != b.objectType ? "sound" == a && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); + this.reloadPlayground(); } - }; - a._updateValueBlock = function(b) { - b instanceof Entry.Block || (b = void 0); - this._sizeObserver && this._sizeObserver.destroy(); - this._posObserver && this._posObserver.destroy(); - (b = this._setValueBlock(b)) ? (b = b.view, b.bindPrev(), this._posObserver = b.observe(this, "_updateValueBlock", ["x", "y"], !1), this._sizeObserver = b.observe(this, "calcWH", ["width", "height"])) : this.calcWH(); - this._blockView.alignContent(); - b = this._blockView.getBoard(); - b.constructor === Entry.Board && b.generateCodeMagnetMap(); - }; - a.getPrevBlock = function(b) { - return this._valueBlock === b ? this : null; - }; - a.getNextBlock = function() { - return null; - }; - a.requestAbsoluteCoordinate = function(b) { - b = this._blockView; - var a = b.contentPos; - b = b.getAbsoluteCoordinate(); - b.x += this.box.x + a.x; - b.y += this.box.y + a.y; - return b; - }; - a.dominate = function() { - this._blockView.dominate(); - }; - a.isGlobal = function() { - return !1; - }; - a.separate = function(b) { - this.getCode().createThread([b]); - this.changeEvent.notify(); - }; - a.getCode = function() { - return this._block.thread.getCode(); - }; - a.cut = function(b) { - return this._valueBlock === b ? (delete this._valueBlock, [b]) : null; - }; - a._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m -4,-12 h 3 l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2 h -3 ", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0," + (this._valueBlock ? 12 : 0) + ")"}) : this._bg && (this._bg.remove(), delete this._bg); - }; - a.replace = function(b) { - var a = this._valueBlock; - a && (a.view._toGlobalCoordinate(), b.getTerminateOutputBlock().view._contents[1].replace(a)); - this._updateValueBlock(b); - b.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); - }; - a.setParent = function(b) { - this._parent = b; - }; - a.getParent = function() { - return this._parent; - }; - a.getThread = function() { - return this; - }; - a.getValueBlock = function() { - return this._valueBlock; - }; - a.pointer = function(b) { - b.unshift(this._index); - b.unshift(Entry.PARAM); - return this._block.pointer(b); - }; -})(Entry.FieldOutput.prototype); -Entry.FieldStatement = function(a, b, c) { - Entry.Model(this, !1); - this._blockView = b; - this.block = b.block; - this.view = this; - this._index = c; - this.acceptType = a.accept; - this._thread = this.statementSvgGroup = this.svgGroup = null; - this._position = a.position; - this.observe(b, "alignContent", ["height"], !1); - this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(b.getBoard()); + } }; -(function(a) { - a.schema = {x:0, y:0, width:100, height:20, magneting:!1}; - a.magnet = {next:{x:0, y:0}}; - a.renderStart = function(b) { - this.svgGroup = this._blockView.statementSvgGroup.elem("g"); - this._nextGroup = this.statementSvgGroup = this.svgGroup.elem("g"); - this._initThread(b); - this._board = b; - }; - a._initThread = function(b) { - var a = this.getValue(); - this._thread = a; - a.createView(b); - a.view.setParent(this); - if (b = a.getFirstBlock()) { - b.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = b; - } - a.changeEvent.attach(this, this.calcHeight); - a.changeEvent.attach(this, this.checkTopBlock); - this.calcHeight(); - }; - a.align = function(b, a, d) { - d = void 0 === d ? !0 : d; - var c = this.svgGroup; - this._position && (this._position.x && (b = this._position.x), this._position.y && (a = this._position.y)); - var f = "translate(" + b + "," + a + ")"; - this.set({x:b, y:a}); - d ? c.animate({transform:f}, 300, mina.easeinout) : c.attr({transform:f}); - }; - a.calcHeight = function() { - var b = this._thread.view.requestPartHeight(null); - this.set({height:b}); - }; - a.getValue = function() { - return this.block.statements[this._index]; - }; - a.requestAbsoluteCoordinate = function() { - var b = this._blockView.getAbsoluteCoordinate(); - b.x += this.x; - b.y += this.y; - return b; - }; - a.dominate = function() { - this._blockView.dominate(); - }; - a.destroy = function() { - }; - a._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - if (this.magneting) { - var b = this._board.dragBlock.getShadow(), a = this.requestAbsoluteCoordinate(), a = "translate(" + a.x + "," + a.y + ")"; - $(b).attr({transform:a, display:"block"}); - this._clonedShadow = b; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - b = this._board.dragBlock.getBelowHeight(); - this.statementSvgGroup.attr({transform:"translate(0," + b + ")"}); - this.set({height:this.height + b}); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), b = this.originalHeight, void 0 !== b && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); +Entry.Playground.prototype.injectCode = function() { + var b = this.mainWorkspace; + b.changeBoardCode(this.object.script); + b.getBoard().adjustThreadsPosition(); +}; +Entry.Playground.prototype.injectPicture = function() { + var b = this.pictureListView_; + if (b) { + for (;b.hasChildNodes();) { + b.removeChild(b.lastChild); + } + if (this.object) { + for (var a = this.object.pictures, d = 0, c = a.length;d < c;d++) { + var e = a[d].view; + e || console.log(e); + e.orderHolder.innerHTML = d + 1; + b.appendChild(e); } - (b = this.block.thread.changeEvent) && b.notify(); + this.selectPicture(this.object.selectedPicture); + } else { + Entry.dispatchEvent("pictureClear"); } - }; - a.insertTopBlock = function(b) { - this._posObserver && this._posObserver.destroy(); - var a = this.firstBlock; - (this.firstBlock = b) && b.doInsert(this._thread); - return a; - }; - a.getNextBlock = function() { - return this.firstBlock; - }; - a.checkTopBlock = function() { - var b = this._thread.getFirstBlock(); - b && this.firstBlock !== b ? (this.firstBlock = b, b.view.bindPrev(this), b._updatePos()) : b || (this.firstBlock = null); - }; -})(Entry.FieldStatement.prototype); -Entry.FieldText = function(a, b, c) { - this._block = b.block; - this._blockView = b; - this._index = c; - this.box = new Entry.BoxModel; - this._fontSize = a.fontSize || b.getSkeleton().fontSize || 12; - this._color = a.color || this._block.getSchema().fontColor || b.getSkeleton().color || "white"; - this._align = a.align || "left"; - this._text = this.getValue() || a.text; - this.setValue(null); - this.textElement = null; - this.renderStart(b); + } }; -Entry.Utils.inherit(Entry.Field, Entry.FieldText); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); - this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); - this.textElement.textContent = this._text; - var b = 0, a = this.textElement.getBoundingClientRect(); - "center" == this._align && (b = -a.width / 2); - this.textElement.attr({x:b, y:.25 * a.height}); - this.box.set({x:0, y:0, width:a.width, height:a.height}); - }; -})(Entry.FieldText.prototype); -Entry.FieldTextInput = function(a, b, c) { - this._blockView = b; - this._block = b.block; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = a.position; - this._contents = a; - this._index = c; - this.value = this.getValue() || ""; - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); +Entry.Playground.prototype.addPicture = function(b, a) { + var d = Entry.cloneSimpleObject(b); + delete d.id; + delete d.view; + b = JSON.parse(JSON.stringify(d)); + b.id = Entry.generateHash(); + b.name = Entry.getOrderedName(b.name, this.object.pictures); + this.generatePictureElement(b); + this.object.addPicture(b); + this.injectPicture(); + this.selectPicture(b); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); -(function(a) { - a.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this.svgGroup.attr({class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); - this.textElement.textContent = this.truncate(); - var b = this.getTextWidth(), a = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:b, height:a, y:(this.position && this.position.y ? this.position.y : 0) - a / 2, rx:3, ry:3, fill:"transparent"}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:b, height:a}); - }; - a.renderOptions = function() { - var b = this; - this._attachDisposeEvent(function() { - b.applyValue(); - b.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.getValue()); - this.optionGroup.on("mousedown", function(b) { - b.stopPropagation(); - }); - this.optionGroup.on("keyup", function(a) { - var c = a.keyCode || a.which; - b.applyValue(a); - -1 < [13, 27].indexOf(c) && b.destroyOption(); - }); - var a = this.getAbsolutePosFromDocument(); - a.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:a.x, top:a.y, width:b.box.width}); - this.optionGroup.focus(); - a = this.optionGroup[0]; - a.setSelectionRange(0, a.value.length, "backward"); - }; - a.applyValue = function(b) { - b = this.optionGroup.val(); - this.setValue(b); - this.textElement.textContent = this.truncate(); - this.resize(); - }; - a.resize = function() { - var b = this.getTextWidth(); - this._header.attr({width:b}); - this.optionGroup.css({width:b}); - this.box.set({width:b}); - this._blockView.alignContent(); - }; - a.getTextWidth = function() { - return this.textElement.getBoundingClientRect().width + 6 + 2; - }; -})(Entry.FieldTextInput.prototype); -Entry.GlobalSvg = {}; -(function(a) { - a.DONE = 0; - a._inited = !1; - a.REMOVE = 1; - a.RETURN = 2; - a.createDom = function() { - if (!this.inited) { - $("#globalSvgSurface").remove(); - $("#globalSvg").remove(); - var b = $("body"); - this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:b}); - this.svgDom = Entry.Dom($(''), {parent:this._container}); - this.svg = Entry.SVG("globalSvg"); - this.top = this.left = 0; - this._inited = !0; +Entry.Playground.prototype.setPicture = function(b) { + var a = Entry.container.getPictureElement(b.id, b.objectId), d = $(a); + if (a) { + b.view = a; + a.picture = b; + a = d.find("#t_" + b.id)[0]; + if (b.fileurl) { + a.style.backgroundImage = 'url("' + b.fileurl + '")'; + } else { + var c = b.filename; + a.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + c.substring(0, 2) + "/" + c.substring(2, 4) + "/thumb/" + c + '.png")'; } - }; - a.setView = function(b, a) { - if (b != this._view && !b.block.isReadOnly() && b.movable) { - return this._view = b, this._mode = a, a !== Entry.Workspace.MODE_VIMBOARD && b.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; + d.find("#s_" + b.id)[0].innerHTML = b.dimension.width + " X " + b.dimension.height; + } + Entry.container.setPicture(b); +}; +Entry.Playground.prototype.downloadPicture = function(b) { + b = Entry.playground.object.getPicture(b); + b.fileurl ? window.open(b.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(b.filename) + "/" + encodeURIComponent(b.name) + ".png"); +}; +Entry.Playground.prototype.clonePicture = function(b) { + b = Entry.playground.object.getPicture(b); + this.addPicture(b, !0); +}; +Entry.Playground.prototype.selectPicture = function(b) { + for (var a = this.object.pictures, d = 0, c = a.length;d < c;d++) { + var e = a[d]; + e.id === b.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); + } + var f; + b && b.id && (f = Entry.container.selectPicture(b.id, b.objectId)); + this.object.id === f && Entry.dispatchEvent("pictureSelected", b); +}; +Entry.Playground.prototype.movePicture = function(b, a) { + this.object.pictures.splice(a, 0, this.object.pictures.splice(b, 1)[0]); + this.injectPicture(); + Entry.stage.sortZorder(); +}; +Entry.Playground.prototype.injectText = function() { + if (Entry.playground.object) { + Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); + Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); + Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); + if (Entry.playground.object.entity.font) { + var b = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; + $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + b + ".png"); + b = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; + $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + b + ".png"); + } + b = Entry.playground.object.entity.getUnderLine() || !1; + $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + b + ".png"); + b = Entry.playground.object.entity.getStrike() || !1; + $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + b + ".png"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); + $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); + Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); + Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); + Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); + b = Entry.playground.object.entity.getFontSize(); + Entry.playground.fontSizeIndiciator.style.width = b + "%"; + Entry.playground.fontSizeKnob.style.left = .88 * b + "px"; + } +}; +Entry.Playground.prototype.injectSound = function() { + var b = this.soundListView_; + if (b) { + for (;b.hasChildNodes();) { + b.removeChild(b.lastChild); } - }; - a.draw = function() { - var b = this._view; - this._svg && this.remove(); - var a = this._mode == Entry.Workspace.MODE_VIMBOARD; - this.svgGroup = Entry.SVG.createElement(b.svgGroup.cloneNode(!0), {opacity:1}); - this.svg.appendChild(this.svgGroup); - a && (b = $(this.svgGroup), b.find("g").css({filter:"none"}), b.find("path").velocity({opacity:0}, {duration:500}), b.find("text").velocity({fill:"#000000"}, {duration:530})); - }; - a.remove = function() { - this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); - }; - a.align = function() { - var b = this._view.getSkeleton().box(this._view).offsetX || 0, a = this._view.getSkeleton().box(this._view).offsetY || 0, b = -1 * b + 1, a = -1 * a + 1; - this._offsetX = b; - this._offsetY = a; - this.svgGroup.attr({transform:"translate(" + b + "," + a + ")"}); - }; - a.show = function() { - this._container.removeClass("entryRemove"); - }; - a.hide = function() { - this._container.addClass("entryRemove"); - }; - a.position = function() { - var b = this._view; - if (b) { - var a = b.getAbsoluteCoordinate(), b = b.getBoard().offset(); - this.left = a.x + b.left - this._offsetX; - this.top = a.y + b.top - this._offsetY; - this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); + if (this.object) { + for (var a = this.object.sounds, d = 0, c = a.length;d < c;d++) { + var e = a[d].view; + e.orderHolder.innerHTML = d + 1; + b.appendChild(e); + } } - }; - a.terminateDrag = function(b) { - var a = Entry.mouseCoordinate, d = b.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; - return a.y > d.offset().top - 20 && a.x > f + h ? this.DONE : a.y > g && a.x > f && e.visible ? b.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; - }; - a.addControl = function(b) { - this.onMouseDown.apply(this, arguments); - }; - a.onMouseDown = function(b) { - function a(a) { - var b = a.pageX; - a = a.pageY; - var c = e.left + (b - e._startX), d = e.top + (a - e._startY); - e.svgDom.css({transform:"translate3d(" + c + "px," + d + "px, 0px)"}); - e._startX = b; - e._startY = a; - e.left = c; - e.top = d; + } +}; +Entry.Playground.prototype.moveSound = function(b, a) { + this.object.sounds.splice(a, 0, this.object.sounds.splice(b, 1)[0]); + this.updateListViewOrder("sound"); + Entry.stage.sortZorder(); +}; +Entry.Playground.prototype.addSound = function(b, a) { + var d = Entry.cloneSimpleObject(b); + delete d.view; + delete d.id; + b = JSON.parse(JSON.stringify(d)); + b.id = Entry.generateHash(); + b.name = Entry.getOrderedName(b.name, this.object.sounds); + this.generateSoundElement(b); + this.object.addSound(b); + this.injectSound(); +}; +Entry.Playground.prototype.changeViewMode = function(b) { + for (var a in this.tabViewElements) { + this.tabViewElements[a].removeClass("entryTabSelected"); + } + "default" != b && this.tabViewElements[b].addClass("entryTabSelected"); + if ("variable" != b) { + var d = this.view_.children; + for (a = 0;a < d.length;a++) { + var c = d[a]; + -1 < c.id.toUpperCase().indexOf(b.toUpperCase()) ? c.removeClass("entryRemove") : c.addClass("entryRemove"); } - function d(a) { - $(document).unbind(".block"); + Entry.pictureEditable && ("picture" == b ? (this.painter.show(), this.pictureView_.object && this.pictureView_.object == this.object || (this.pictureView_.object = this.object, this.injectPicture())) : this.painter.hide()); + if ("sound" == b && (!this.soundView_.object || this.soundView_.object != this.object)) { + this.soundView_.object = this.object, this.injectSound(); + } else { + if ("text" == b && "textBox" == this.object.objectType || this.textView_.object != this.object) { + this.textView_.object = this.object, this.injectText(); + } } - this._startY = b.pageY; - var e = this; - b.stopPropagation(); - b.preventDefault(); - var f = $(document); - f.bind("mousemove.block", a); - f.bind("mouseup.block", d); - f.bind("touchmove.block", a); - f.bind("touchend.block", d); - this._startX = b.pageX; - this._startY = b.pageY; - }; -})(Entry.GlobalSvg); -Entry.Mutator = function() { + "code" == b && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); + Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); + this.viewMode_ = b; + this.toggleOffVariableView(); + } +}; +Entry.Playground.prototype.createVariableView = function() { + var b = Entry.createElement("div"); + Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && b.addClass("entryVariablePanelPhone") : b.addClass("entryVariablePanelWorkspace"); + this.variableViewWrapper_ = b; + Entry.variableContainer.createDom(b); + return b; +}; +Entry.Playground.prototype.toggleOnVariableView = function() { + Entry.playground.changeViewMode("code"); + this.hideBlockMenu(); + Entry.variableContainer.updateList(); + this.variableView_.removeClass("entryRemove"); + this.resizeHandle_.removeClass("entryRemove"); +}; +Entry.Playground.prototype.toggleOffVariableView = function() { + this.showBlockMenu(); + this.variableView_.addClass("entryRemove"); +}; +Entry.Playground.prototype.editBlock = function() { + var b = Entry.playground; + Entry.stateManager && Entry.stateManager.addCommand("edit block", b, b.restoreBlock, b.object, b.object.getScriptText()); +}; +Entry.Playground.prototype.mouseupBlock = function() { + if (Entry.reporter) { + var b = Entry.playground, a = b.object; + Entry.reporter.report(new Entry.State("edit block mouseup", b, b.restoreBlock, a, a.getScriptText())); + } +}; +Entry.Playground.prototype.restoreBlock = function(b, a) { + Entry.container.selectObject(b.id); + Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); + Blockly.Xml.textToDom(a); +}; +Entry.Playground.prototype.setMenu = function(b) { + if (this.currentObjectType != b) { + var a = this.blockMenu; + a.unbanClass(this.currentObjectType); + a.banClass(b); + a.setMenu(); + a.selectMenu(0, !0); + this.currentObjectType = b; + } +}; +Entry.Playground.prototype.hideTabs = function() { + var b = ["picture", "text", "sound", "variable"], a; + for (a in b) { + this.hideTab([b[a]]); + } +}; +Entry.Playground.prototype.hideTab = function(b) { + this.tabViewElements[b] && (this.tabViewElements[b].addClass("hideTab"), this.tabViewElements[b].removeClass("showTab")); +}; +Entry.Playground.prototype.showTabs = function() { + var b = ["picture", "text", "sound", "variable"], a; + for (a in b) { + this.showTab(b[a]); + } +}; +Entry.Playground.prototype.showTab = function(b) { + this.tabViewElements[b] && (this.tabViewElements[b].addClass("showTab"), this.tabViewElements[b].removeClass("hideTab")); +}; +Entry.Playground.prototype.initializeResizeHandle = function(b) { + $(b).bind("mousedown touchstart", function(a) { + Entry.playground.resizing = !0; + Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { + Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); + })); + }); + $(document).bind("mouseup touchend", function(a) { + if (a = Entry.playground.resizeEvent) { + Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; + } + }); }; -(function(a) { - a.mutate = function(a, c) { - a = Entry.block[a]; - void 0 === a.changeEvent && (a.changeEvent = new Entry.Event); - a.template = c.template; - a.params = c.params; - a.changeEvent.notify(1); - }; -})(Entry.Mutator); -(function(a) { -})(Entry.Mutator.prototype); -Entry.RenderView = function(a, b) { - this._align = b || "CENTER"; - a = "string" === typeof a ? $("#" + a) : $(a); - if ("DIV" !== a.prop("tagName")) { - return console.error("Dom is not div element"); +Entry.Playground.prototype.reloadPlayground = function() { + var b = this.mainWorkspace; + b && (b.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); +}; +Entry.Playground.prototype.flushPlayground = function() { + this.object = null; + if (Entry.playground && Entry.playground.view_) { + this.injectPicture(); + this.injectSound(); + var b = Entry.playground.mainWorkspace.getBoard(); + b.clear(); + b.changeCode(null); } - this.view = a; - this.viewOnly = !0; - this.suffix = "renderView"; - this.disableMouseEvent = this.visible = !0; - this._svgId = "renderView_" + (new Date).getTime(); - this._generateView(); - this.offset = this.svgDom.offset(); - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); }; -(function(a) { - a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - a._generateView = function() { - this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); - this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); - }; - a.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { - return console.error("You must inject code instance"); - } - this.code = a; - this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); - a.createView(this); - this.align(); - this.resize(); - }; - a.align = function() { - var a = this.code.getThreads(); - if (a && 0 !== a.length) { - for (var c = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { - var g = a[e].getFirstBlock().view; - g._moveTo(d, c - g.offsetY, !1); - g = g.svgGroup.getBBox().height; - c += g + 15; +Entry.Playground.prototype.refreshPlayground = function() { + Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); +}; +Entry.Playground.prototype.updateListViewOrder = function(b) { + b = "picture" == b ? this.pictureListView_.childNodes : this.soundListView_.childNodes; + for (var a = 0, d = b.length;a < d;a++) { + b[a].orderHolder.innerHTML = a + 1; + } +}; +Entry.Playground.prototype.generatePictureElement = function(b) { + function a() { + if ("" === this.value.trim()) { + Entry.deAttachEventListener(this, "blur", a), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", a); + } else { + for (var b = $(".entryPlaygroundPictureName"), c = 0;c < b.length;c++) { + if (b.eq(c).val() == f.value && b[c] != this) { + Entry.deAttachEventListener(this, "blur", a); + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + Entry.attachEventListener(this, "blur", a); + return; + } } - this._bBox = this.svgGroup.getBBox(); - this.height = this._bBox.height; + this.picture.name = this.value; + Entry.playground.reloadPlayground(); + Entry.dispatchEvent("pictureNameChanged", this.picture); } + } + var d = Entry.createElement("li", b.id); + b.view = d; + d.addClass("entryPlaygroundPictureElement"); + d.picture = b; + d.bindOnClick(function(a) { + Entry.playground.selectPicture(this.picture); + }); + Entry.Utils.disableContextmenu(b.view); + $(b.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + f.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.clonePicture(b.id); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removePicture(b.id) ? (Entry.removeElement(d), Entry.toast.success(Lang.Workspace.shape_remove_ok, b.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); + }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { + Entry.playground.downloadPicture(b.id); + }}], "workspace-contextmenu"); + }); + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundPictureOrder"); + d.orderHolder = c; + d.appendChild(c); + c = Entry.createElement("div", "t_" + b.id); + c.addClass("entryPlaygroundPictureThumbnail"); + if (b.fileurl) { + c.style.backgroundImage = 'url("' + b.fileurl + '")'; + } else { + var e = b.filename; + c.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; + } + d.appendChild(c); + var f = Entry.createElement("input"); + f.addClass("entryPlaygroundPictureName"); + f.addClass("entryEllipsis"); + f.picture = b; + f.value = b.name; + Entry.attachEventListener(f, "blur", a); + f.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; - a.hide = function() { - this.view.addClass("entryRemove"); - }; - a.show = function() { - this.view.removeClass("entryRemove"); - }; - a.setWidth = function() { - this._svgWidth = this.svgDom.width(); - this.offset = this.svgDom.offset(); - }; - a.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); - }; - a.resize = function() { - this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); - }; -})(Entry.RenderView.prototype); -Entry.ThreadView = function(a, b) { - Entry.Model(this, !1); - this.thread = a; - this.svgGroup = b.svgThreadGroup.elem("g"); - this.parent = b; + d.appendChild(f); + c = Entry.createElement("div", "s_" + b.id); + c.addClass("entryPlaygroundPictureSize"); + c.innerHTML = b.dimension.width + " X " + b.dimension.height; + d.appendChild(c); }; -(function(a) { - a.schema = {height:0, zIndex:0}; - a.destroy = function() { - this.svgGroup.remove(); - }; - a.setParent = function(a) { - this.parent = a; - }; - a.getParent = function() { - return this.parent; - }; - a.renderText = function() { - for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { - a[c].view.renderText(); - } - }; - a.renderBlock = function() { - for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { - a[c].view.renderBlock(); - } - }; - a.requestAbsoluteCoordinate = function(a) { - var b = this.thread.getBlocks(), d = b.shift(), e = {x:0, y:0}; - for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { - d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = b.shift(); - } - return e; - }; - a.requestPartHeight = function(a, c) { - c = this.thread.getBlocks(); - for (var b = c.pop(), e = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;b && b.view !== a && b.view;) { - b = b.view, e = b.magnet.next ? e + b.magnet.next.y : e + b.height, b.dragMode === Entry.DRAG_MODE_DRAG && (e = 0), b = c.pop(); - } - return e; - }; - a.dominate = function() { - this.parent.dominate(this.thread); - }; - a.isGlobal = function() { - return this.parent instanceof Entry.Board; - }; - a.reDraw = function() { - for (var a = this.thread._data, c = a.length - 1;0 <= c;c--) { - a[c].view.reDraw(); +Entry.Playground.prototype.generateSoundElement = function(b) { + var a = Entry.createElement("sound", b.id); + b.view = a; + a.addClass("entryPlaygroundSoundElement"); + a.sound = b; + Entry.Utils.disableContextmenu(b.view); + $(b.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + g.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.addSound(b, !0); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removeSound(b.id) ? (Entry.removeElement(a), Entry.toast.success(Lang.Workspace.sound_remove_ok, b.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); + Entry.removeElement(a); + }}], "workspace-contextmenu"); + }); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundSoundOrder"); + a.orderHolder = d; + a.appendChild(d); + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundThumbnail"); + c.addClass("entryPlaygroundSoundPlay"); + var e = !1, f; + c.addEventListener("click", function() { + e ? (e = !1, c.removeClass("entryPlaygroundSoundStop"), c.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, c.removeClass("entryPlaygroundSoundPlay"), c.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(b.id), f.addEventListener("complete", function(a) { + c.removeClass("entryPlaygroundSoundStop"); + c.addClass("entryPlaygroundSoundPlay"); + e = !1; + }), f.addEventListener("loop", function(a) { + }), f.addEventListener("failed", function(a) { + })); + }); + a.appendChild(c); + var g = Entry.createElement("input"); + g.addClass("entryPlaygroundSoundName"); + g.sound = b; + g.value = b.name; + var h = document.getElementsByClassName("entryPlaygroundSoundName"); + g.onblur = function() { + if ("" === this.value) { + alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); + } else { + for (var a = 0, b = 0;b < h.length;b++) { + if (h[b].value == g.value && (a += 1, 1 < a)) { + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + return; + } + } + this.sound.name = this.value; + Entry.playground.reloadPlayground(); } }; - a.setZIndex = function(a) { - this.set({zIndex:a}); + g.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; -})(Entry.ThreadView.prototype); -Entry.Vim = function(a, b) { - Entry.Vim.MAZE_MODE = 1; - Entry.Vim.WORKSPACE_MODE = 2; - Entry.Vim.TEXT_TYPE_JS = 0; - Entry.Vim.TEXT_TYPE_PY = 1; - Entry.Vim.PARSER_TYPE_JS_TO_BLOCK = 0; - Entry.Vim.PARSER_TYPE_PY_TO_BLOCK = 1; - Entry.Vim.PARSER_TYPE_BLOCK_TO_JS = 2; - Entry.Vim.PARSER_TYPE_BLOCK_TO_PY = 3; - Entry.Vim.PYTHON_IMPORT_ENTRY = "import Entry"; - Entry.Vim.PYTHON_IMPORT_HW = "import Arduino, Hamster, Albert, Bitbrick, Codeino, Dplay \n\t Neobot, Nemoino, Robotis, Sensorboard, Xbot from Hw"; - a = "string" === typeof a ? $("#" + a) : $(a); - if ("DIV" !== a.prop("tagName")) { - return console.error("Dom is not div element"); + a.appendChild(g); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundSoundLength"); + d.innerHTML = b.duration + " \ucd08"; + a.appendChild(d); +}; +Entry.Playground.prototype.toggleColourChooser = function(b) { + "foreground" === b ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === b && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); +}; +Entry.Playground.prototype.setTextColour = function(b) { + Entry.playground.object.entity.setColour(b); + Entry.playground.toggleColourChooser("foreground"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", b); +}; +Entry.Playground.prototype.setBackgroundColour = function(b) { + Entry.playground.object.entity.setBGColour(b); + Entry.playground.toggleColourChooser("background"); + $(".entryPlayground_bgColorDiv").css("backgroundColor", b); +}; +Entry.Playground.prototype.isTextBGMode = function() { + return this.isTextBGMode_; +}; +Entry.Playground.prototype.checkVariables = function() { + Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); +}; +Entry.Playground.prototype.getViewMode = function() { + return this.viewMode_; +}; +Entry.Playground.prototype.updateHW = function() { + var b = Entry.playground.mainWorkspace.blockMenu; + if (b) { + var a = Entry.hw; + a && a.connected ? (b.unbanClass("arduinoConnected", !0), b.banClass("arduinoDisconnected", !0), a.banHW(), a.hwModule && b.unbanClass(a.hwModule.name)) : (b.banClass("arduinoConnected", !0), b.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); + b.reDraw(); } - this.createDom(a); - this._mode = Entry.Vim.WORKSPACE_MODE; - this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY; - this._parser = new Entry.Parser(this._mode, this._parserType, this.codeMirror); - Entry.Model(this, !1); - window.eventset = []; }; -(function(a) { - a.createDom = function(a) { - function b(a) { - var b = e.getCodeToText(a.block); - e.codeMirror.display.dragFunctions.leave(a); - var c = Entry.Utils.createMouseEvent("mousedown", a); - e.codeMirror.display.scroller.dispatchEvent(c); - var b = b.split("\n"), d = b.length - 1, f = 0; - b.forEach(function(a, b) { - e.codeMirror.replaceSelection(a); - f = e.doc.getCursor().line; - e.codeMirror.indentLine(f); - 0 !== b && d === b || e.codeMirror.replaceSelection("\n"); - }); - a = Entry.Utils.createMouseEvent("mouseup", a); - e.codeMirror.display.scroller.dispatchEvent(a); - } - function d(a) { - e.codeMirror.display.dragFunctions.over(a); +Entry.Playground.prototype.toggleLineBreak = function(b) { + this.object && "textBox" == this.object.objectType && (b ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", + "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); +}; +Entry.Playground.prototype.setFontAlign = function(b) { + if ("textBox" == this.object.objectType) { + this.alignLeftBtn.removeClass("toggle"); + this.alignCenterBtn.removeClass("toggle"); + this.alignRightBtn.removeClass("toggle"); + switch(b) { + case Entry.TEXT_ALIGN_LEFT: + this.alignLeftBtn.addClass("toggle"); + break; + case Entry.TEXT_ALIGN_CENTER: + this.alignCenterBtn.addClass("toggle"); + break; + case Entry.TEXT_ALIGN_RIGHT: + this.alignRightBtn.addClass("toggle"); } - var e; - this.view = Entry.Dom("div", {parent:a, class:"entryVimBoard"}); - this.codeMirror = CodeMirror(this.view[0], {lineNumbers:!0, value:"", mode:{name:"javascript", globalVars:!0}, theme:"default", indentUnit:4, indentWithTabs:!0, styleActiveLine:!0, extraKeys:{"Ctrl-Space":"autocomplete"}, lint:!0, viewportMargin:10}); - this.doc = this.codeMirror.getDoc(); - e = this; - a = this.view[0]; - a.removeEventListener("dragEnd", b); - a.removeEventListener("dragOver", d); - a.addEventListener("dragEnd", b); - a.addEventListener("dragOver", d); - }; - a.hide = function() { - this.view.addClass("entryRemove"); - }; - a.show = function() { - this.view.removeClass("entryRemove"); - }; - a.textToCode = function(a) { - a === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_JS_TO_BLOCK, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : a === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_PY_TO_BLOCK, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); - a = this.codeMirror.getValue(); - return this._parser.parse(a); - }; - a.codeToText = function(a, c) { - var b; - c && (this._mode = c.runType); - Entry.playground && (b = Entry.playground.object, b = "# " + b.name + " \uc624\ube0c\uc81d\ud2b8\uc758 \ud30c\uc774\uc36c \ucf54\ub4dc"); - c = c.textType; - c === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : c === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); - a = this._parser.parse(a, Entry.Parser.PARSE_GENERAL); - c === Entry.Vim.TEXT_TYPE_PY && (a = b.concat("\n\n").concat(Entry.Vim.PYTHON_IMPORT_ENTRY).concat("\n\n").concat(a)); - this.codeMirror.setValue(a + "\n"); - c == Entry.Vim.TEXT_TYPE_PY && this.codeMirror.getDoc().markText({line:0, ch:0}, {line:4, ch:0}, {readOnly:!0}); - a = this.codeMirror.getDoc(); - a.setCursor({line:a.lastLine() - 1}); - }; - a.getCodeToText = function(a) { - var b = this.workspace.oldTextType; - b === Entry.Vim.TEXT_TYPE_JS ? (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_JS, this._parser.setParser(this._mode, this._parserType, this.codeMirror)) : b === Entry.Vim.TEXT_TYPE_PY && (this._parserType = Entry.Vim.PARSER_TYPE_BLOCK_TO_PY, this._parser.setParser(this._mode, this._parserType, this.codeMirror)); - return this._parser.parse(a, Entry.Parser.PARSE_SYNTAX); - }; - a.setParserAvailableCode = function(a, c) { - this._parser.setAvailableCode(a, c); - }; -})(Entry.Vim.prototype); + this.object.entity.setTextAlign(b); + } +}; +Entry.Playground.prototype.hideBlockMenu = function() { + this.mainWorkspace.getBlockMenu().hide(); +}; +Entry.Playground.prototype.showBlockMenu = function() { + this.mainWorkspace.getBlockMenu().show(); +}; Entry.Xml = {}; -Entry.Xml.isTypeOf = function(a, b) { - return b.getAttribute("type") == a; +Entry.Xml.isTypeOf = function(b, a) { + return a.getAttribute("type") == b; }; -Entry.Xml.getNextBlock = function(a) { - a = a.childNodes; - for (var b = 0;b < a.length;b++) { - if ("NEXT" == a[b].tagName.toUpperCase()) { - return a[b].children[0]; +Entry.Xml.getNextBlock = function(b) { + b = b.childNodes; + for (var a = 0;a < b.length;a++) { + if ("NEXT" == b[a].tagName.toUpperCase()) { + return b[a].children[0]; } } return null; }; -Entry.Xml.getStatementBlock = function(a, b) { - var c = b.getElementsByTagName("statement"); - if (!c.length) { - return b; +Entry.Xml.getStatementBlock = function(b, a) { + var d = a.getElementsByTagName("statement"); + if (!d.length) { + return a; } - for (var d in c) { - if (c[d].getAttribute("name") == a) { - return c[d].children[0]; + for (var c in d) { + if (d[c].getAttribute("name") == b) { + return d[c].children[0]; } } return null; }; -Entry.Xml.getParentLoop = function(a) { +Entry.Xml.getParentLoop = function(b) { for (;;) { - if (!a) { + if (!b) { return null; } - if ((a = a.parentNode) && "STATEMENT" == a.tagName.toUpperCase()) { - return a.parentNode; + if ((b = b.parentNode) && "STATEMENT" == b.tagName.toUpperCase()) { + return b.parentNode; } - if (a) { - a = a.parentNode; + if (b) { + b = b.parentNode; } else { return null; } } }; -Entry.Xml.getParentIterateLoop = function(a) { +Entry.Xml.getParentIterateLoop = function(b) { for (;;) { - if (!a) { + if (!b) { return null; } - if ((a = a.parentNode) && a.getAttribute("type") && "REPEAT" == a.getAttribute("type").toUpperCase().substr(0, 6)) { - return a; + if ((b = b.parentNode) && b.getAttribute("type") && "REPEAT" == b.getAttribute("type").toUpperCase().substr(0, 6)) { + return b; } - if (!a) { + if (!b) { return null; } } }; -Entry.Xml.getParentBlock = function(a) { - return (a = a.parentNode) ? a.parentNode : null; +Entry.Xml.getParentBlock = function(b) { + return (b = b.parentNode) ? b.parentNode : null; }; -Entry.Xml.callReturn = function(a) { - var b = Entry.Xml.getNextBlock(a); - return b ? b : Entry.Xml.getParentLoop(a); +Entry.Xml.callReturn = function(b) { + var a = Entry.Xml.getNextBlock(b); + return a ? a : Entry.Xml.getParentLoop(b); }; -Entry.Xml.isRootBlock = function(a) { +Entry.Xml.isRootBlock = function(b) { }; -Entry.Xml.getValue = function(a, b) { - b = b.childNodes; - if (!b.length) { +Entry.Xml.getValue = function(b, a) { + var d = a.childNodes; + if (!d.length) { return null; } - for (var c in b) { - if ("VALUE" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { - return b[c].children[0]; + for (var c in d) { + if ("VALUE" == d[c].tagName.toUpperCase() && d[c].getAttribute("name") == b) { + return d[c].children[0]; } } return null; }; -Entry.Xml.getNumberValue = function(a, b, c) { - c = c.childNodes; - if (!c.length) { +Entry.Xml.getNumberValue = function(b, a, d) { + d = d.childNodes; + if (!d.length) { return null; } - for (var d in c) { - if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return Number(Entry.Xml.operate(a, c[d].children[0])); + for (var c in d) { + if (d[c].tagName && "VALUE" == d[c].tagName.toUpperCase() && d[c].getAttribute("name") == a) { + return +Entry.Xml.operate(b, d[c].children[0]); } } return null; }; -Entry.Xml.getField = function(a, b) { - b = b.childNodes; - if (!b.length) { +Entry.Xml.getField = function(b, a) { + var d = a.childNodes; + if (!d.length) { return null; } - for (var c in b) { - if (b[c].tagName && "FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { - return b[c].textContent; + for (var c in d) { + if (d[c].tagName && "FIELD" == d[c].tagName.toUpperCase() && d[c].getAttribute("name") == b) { + return d[c].textContent; } } }; -Entry.Xml.getNumberField = function(a, b) { - b = b.childNodes; - if (!b.length) { +Entry.Xml.getNumberField = function(b, a) { + var d = a.childNodes; + if (!d.length) { return null; } - for (var c in b) { - if ("FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { - return Number(b[c].textContent); + for (var c in d) { + if ("FIELD" == d[c].tagName.toUpperCase() && d[c].getAttribute("name") == b) { + return +d[c].textContent; } } }; -Entry.Xml.getBooleanValue = function(a, b, c) { - c = c.getElementsByTagName("value"); - if (!c.length) { +Entry.Xml.getBooleanValue = function(b, a, d) { + d = d.getElementsByTagName("value"); + if (!d.length) { return null; } - for (var d in c) { - if (c[d].getAttribute("name") == b) { - return Entry.Xml.operate(a, c[d].children[0]); + for (var c in d) { + if (d[c].getAttribute("name") == a) { + return Entry.Xml.operate(b, d[c].children[0]); } } return null; }; -Entry.Xml.operate = function(a, b) { - return Entry.block[b.getAttribute("type")](a, b); +Entry.Xml.operate = function(b, a) { + return Entry.block[a.getAttribute("type")](b, a); }; -Entry.Xml.cloneBlock = function(a, b, c) { - var d = a.cloneNode(); - a.parentNode && "xml" != a.parentNode.tagName && Entry.Xml.cloneBlock(a.parentNode, d, "parent"); - for (var e = 0;e < a.childNodes.length;e++) { - var f = a.childNodes[e]; - f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(b) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); +Entry.Xml.cloneBlock = function(b, a, d) { + var c = b.cloneNode(); + b.parentNode && "xml" != b.parentNode.tagName && Entry.Xml.cloneBlock(b.parentNode, c, "parent"); + for (var e = 0;e < b.childNodes.length;e++) { + var f = b.childNodes[e]; + f instanceof Text ? c.textContent = f.textContent : "parent" == d ? c.appendChild(a) : c.appendChild(Entry.Xml.cloneBlock(f, c, "child")); } - return d; + return c; }; -Entry.Youtube = function(a) { - this.generateView(a); +Entry.Youtube = function(b) { + this.generateView(b); }; p = Entry.Youtube.prototype; -p.init = function(a) { - this.youtubeHash = a; +p.init = function(b) { + this.youtubeHash = b; this.generateView(); }; -p.generateView = function(a) { - var b = Entry.createElement("div"); - b.addClass("entryContainerMovieWorkspace"); - b.addClass("entryRemove"); - this.movieContainer = b; - b = Entry.createElement("iframe"); - b.setAttribute("id", "youtubeIframe"); - b.setAttribute("allowfullscreen", ""); - b.setAttribute("frameborder", 0); - b.setAttribute("src", "https://www.youtube.com/embed/" + a); - this.movieFrame = b; - this.movieContainer.appendChild(b); +p.generateView = function(b) { + var a = Entry.createElement("div"); + a.addClass("entryContainerMovieWorkspace"); + a.addClass("entryRemove"); + this.movieContainer = a; + a = Entry.createElement("iframe"); + a.setAttribute("id", "youtubeIframe"); + a.setAttribute("allowfullscreen", ""); + a.setAttribute("frameborder", 0); + a.setAttribute("src", "https://www.youtube.com/embed/" + b); + this.movieFrame = a; + this.movieContainer.appendChild(a); }; p.getView = function() { return this.movieContainer; }; p.resize = function() { - var a = document.getElementsByClassName("propertyContent")[0], b = document.getElementById("youtubeIframe"); - w = a.offsetWidth; - b.width = w + "px"; - b.height = 9 * w / 16 + "px"; + var b = document.getElementsByClassName("propertyContent")[0], a = document.getElementById("youtubeIframe"); + w = b.offsetWidth; + a.width = w + "px"; + a.height = 9 * w / 16 + "px"; }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 7e8264ea99..5fe37e0417 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,76 +1,77 @@ Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions);Entry.container.setObjects(b.objects); Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();Entry.Loader.isLoaded()&&Entry.Loader.handleLoad();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&& -Entry.Func.workspace.visible&&Entry.Func.cancelEdit();b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){b=[];a=jQuery.parseXML(a).getElementsByTagName("category");for(var c=0;ca?a=325:720a?a=244:400svg").css({width:a- +this.resizeElement(JSON.parse(b))}else this.resizeElement({menuWidth:280,canvasWidth:480})},resizeElement:function(b){if("workspace"==Entry.type){var a=this.interfaceState;!b.canvasWidth&&a.canvasWidth&&(b.canvasWidth=a.canvasWidth);!b.menuWidth&&this.interfaceState.menuWidth&&(b.menuWidth=a.menuWidth);Entry.engine.speedPanelOn&&Entry.engine.toggleSpeedPanel();(a=b.canvasWidth)?325>a?a=325:720a?a=244:400svg").css({width:a- 64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth();$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user? -window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target,d=0!==$(a.view_).find(c).length,c=c.tagName.toUpperCase();b=b.type;!a.isEditing||"INPUT"===c&&d||"touchstart"===b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a= -function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block[b]=a}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, +window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var d=b.target,c=0!==$(a.view_).find(d).length,d=d.tagName.toUpperCase();b=b.type;!a.isEditing||"INPUT"===d&&c||"touchstart"===b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a= +function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block[b]=a}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,d;for(d in b)a[d]=b[d];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, type:"input",pos:{x:0,y:0}},accelerationY:{name:Lang.Blocks.ALBERT_sensor_acceleration_y,type:"input",pos:{x:0,y:0}},accelerationZ:{name:Lang.Blocks.ALBERT_sensor_acceleration_z,type:"input",pos:{x:0,y:0}},frontOid:{name:Lang.Blocks.ALBERT_sensor_front_oid,type:"input",pos:{x:0,y:0}},backOid:{name:Lang.Blocks.ALBERT_sensor_back_oid,type:"input",pos:{x:0,y:0}},positionX:{name:Lang.Blocks.ALBERT_sensor_position_x,type:"input",pos:{x:0,y:0}},positionY:{name:Lang.Blocks.ALBERT_sensor_position_y,type:"input", pos:{x:0,y:0}},orientation:{name:Lang.Blocks.ALBERT_sensor_orientation,type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output",pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_left_proximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_right_proximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye,type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led_en,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led_en,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b); var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},controller:{PI:3.14159265,PI2:6.2831853,prevDirection:0,prevDirectionFine:0,directionFineCount:0,positionCount:0,finalPositionCount:0,GAIN_ANGLE:30,GAIN_ANGLE_FINE:30,GAIN_POSITION_FINE:30,STRAIGHT_SPEED:20,MAX_BASE_SPEED:20,GAIN_BASE_SPEED:1,GAIN_POSITION:35,POSITION_TOLERANCE_FINE:3,POSITION_TOLERANCE_FINE_LARGE:5,POSITION_TOLERANCE_ROUGH:5,POSITION_TOLERANCE_ROUGH_LARGE:10, -ORIENTATION_TOLERANCE_FINE:.08,ORIENTATION_TOLERANCE_ROUGH:.09,ORIENTATION_TOLERANCE_ROUGH_LARGE:.18,MINIMUM_WHEEL_SPEED:18,MINIMUM_WHEEL_SPEED_FINE:15,clear:function(){this.finalPositionCount=this.positionCount=this.directionFineCount=this.prevDirectionFine=this.prevDirection=0},controlAngleFine:function(b,a){var c=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ad*this.prevDirectionFine&&5<++this.directionFineCount)return!1; -this.prevDirectionFine=d;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);c.leftWheel=-b;c.rightWheel=b;return!0},controlAngle:function(b,a){var c=Entry.hw.sendQueue;b=this.validateRadian(a-b);a=Math.abs(b);if(ad*this.prevDirection)return!1; -this.prevDirection=d;0-this.MINIMUM_WHEEL_SPEED&&(b=-this.MINIMUM_WHEEL_SPEED));b=parseInt(b);c.leftWheel=-b;c.rightWheel=b;return!0},controlPositionFine:function(b,a,c,d,e){var f=Entry.hw.sendQueue;c=this.validateRadian(Math.atan2(e-a,d-b)-c);var g=Math.abs(c);b=d-b;a=e-a;a=Math.sqrt(b*b+a*a);if(ag?(f.leftWheel=this.STRAIGHT_SPEED,f.rightWheel=this.STRAIGHT_SPEED):(a=(this.MINIMUM_WHEEL_SPEED+.5/g)*this.GAIN_BASE_SPEED,a>this.MAX_BASE_SPEED&&(a=this.MAX_BASE_SPEED),c=0this.PI?b-this.PI2:b<-this.PI?b+this.PI2:b},toRadian:function(b){return 3.14159265* -b/180}},name:"albert"};Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){b=Entry.hw.portData;return 40f*this.prevDirectionFine&&5<++this.directionFineCount)return!1; +this.prevDirectionFine=f;f=0;0-this.MINIMUM_WHEEL_SPEED&&(f=-this.MINIMUM_WHEEL_SPEED));f=parseInt(f);d.leftWheel=-f;d.rightWheel=f;return!0},controlAngle:function(b,a){var d=Entry.hw.sendQueue,c=this.validateRadian(a-b),e=Math.abs(c);if(ef*this.prevDirection)return!1; +this.prevDirection=f;f=0;0-this.MINIMUM_WHEEL_SPEED&&(f=-this.MINIMUM_WHEEL_SPEED));f=parseInt(f);d.leftWheel=-f;d.rightWheel=f;return!0},controlPositionFine:function(b,a,d,c,e){var f=Entry.hw.sendQueue;d=this.validateRadian(Math.atan2(e-a,c-b)-d);var g=Math.abs(d);b=c-b;a=e-a;a=Math.sqrt(b*b+a*a);if(ag?(f.leftWheel=this.STRAIGHT_SPEED,f.rightWheel=this.STRAIGHT_SPEED):(a=(this.MINIMUM_WHEEL_SPEED+.5/g)*this.GAIN_BASE_SPEED,a>this.MAX_BASE_SPEED&&(a=this.MAX_BASE_SPEED),e=0,e=0this.PI?b-this.PI2:b<-this.PI?b+this.PI2:b},toRadian:function(b){return 3.14159265* +b/180}},name:"albert"};Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){var d=Entry.hw.portData;return 40a.x||0>a.y){c.leftWheel=20;c.rightWheel=-20;break}a.initialized=!0}c=b.toRadian(a.theta);0==b.controlAngle(c,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x, -a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(c.leftWheel=0,c.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX;delete a.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1; -a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();c.leftWheel=0;c.rightWheel=0;return a}; +Entry.block.albert_move_to_x_y_on_board=function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData,e=Entry.Albert.controller;if(a.isStart){if(a.isMoving){0<=c.positionX&&(a.x=c.positionX);0<=c.positionY&&(a.y=c.positionY);a.theta=c.orientation;switch(a.boardState){case 1:if(0==a.initialized){if(0>a.x||0>a.y){d.leftWheel=20;d.rightWheel=-20;break}a.initialized=!0}d=e.toRadian(a.theta);0==e.controlAngle(d,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==e.controlPosition(a.x, +a.y,e.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==e.controlPositionFine(a.x,a.y,e.toRadian(a.theta),a.targetX,a.targetY)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX;delete a.targetY;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1; +a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");e.clear();d.leftWheel=0;d.rightWheel=0;return a}; Blockly.Blocks.albert_set_orientation_on_board={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_1);this.appendValueInput("ORIENTATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_orientation_on_board=function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta);0==d.controlAngle(c,e)&&(a.boardState=2);break;case 2:c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta),0==d.controlAngleFine(c,e)&&(b.leftWheel=0,b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState; -delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");d.clear();b.leftWheel=0;b.rightWheel=0;return a}; +Entry.block.albert_set_orientation_on_board=function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData,e=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=e.toRadian(a.theta),f=e.toRadian(a.targetTheta);0==e.controlAngle(c,f)&&(a.boardState=2);break;case 2:c=e.toRadian(a.theta),f=e.toRadian(a.targetTheta),0==e.controlAngleFine(c,f)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState; +delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");e.clear();d.leftWheel=0;d.rightWheel=0;return a}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan, "3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.Blocks.ALBERT_color_white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_eye_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"LEFT"==c?b.leftEye=d:("RIGHT"!=c&&(b.leftEye=d),b.rightEye=d);return a.callReturn()}; +Entry.block.albert_set_eye_to=function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==c?d.leftEye=e:("RIGHT"!=c&&(d.leftEye=e),d.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_clear_eye=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"LEFT"==c?b.leftEye=0:("RIGHT"!=c&&(b.leftEye=0),b.rightEye=0);return a.callReturn()}; +Entry.block.albert_clear_eye=function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a);"LEFT"==c?d.leftEye=0:("RIGHT"!=c&&(d.leftEye=0),d.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_body_led=function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.bodyLed=1:b.bodyLed=0;return a.callReturn()}; +Entry.block.albert_body_led=function(b,a){var d=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?d.bodyLed=1:d.bodyLed=0;return a.callReturn()}; Blockly.Blocks.albert_front_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_front_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_front_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_front_led=function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.frontLed=1:b.frontLed=0;return a.callReturn()};Blockly.Blocks.albert_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_beep=function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c);return a}; +Entry.block.albert_front_led=function(b,a){var d=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?d.frontLed=1:d.frontLed=0;return a.callReturn()};Blockly.Blocks.albert_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_beep=function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;d.buzzer=440;d.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c);return a}; Blockly.Blocks.albert_change_buzzer_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_change_buzzer_by=function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+c:c;b.note=0;return a.callReturn()}; +Entry.block.albert_change_buzzer_by=function(b,a){var d=Entry.hw.sendQueue,c=a.getNumberValue("VALUE");d.buzzer=void 0!=d.buzzer?d.buzzer+c:c;d.note=0;return a.callReturn()}; Blockly.Blocks.albert_set_buzzer_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_buzzer_to=function(b,a){b=Entry.hw.sendQueue;b.buzzer=a.getNumberValue("VALUE");b.note=0;return a.callReturn()};Blockly.Blocks.albert_clear_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_buzzer).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_clear_buzzer=function(b,a){b=Entry.hw.sendQueue;b.buzzer=0;b.note=0;return a.callReturn()}; +Entry.block.albert_set_buzzer_to=function(b,a){var d=Entry.hw.sendQueue;d.buzzer=a.getNumberValue("VALUE");d.note=0;return a.callReturn()};Blockly.Blocks.albert_clear_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_buzzer).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_clear_buzzer=function(b,a){var d=Entry.hw.sendQueue;d.buzzer=0;d.note=0;return a.callReturn()}; Blockly.Blocks.albert_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_1).appendField(new Blockly.FieldDropdown([[Lang.General.note_c+"","4"],[Lang.General.note_c+"#","5"],[Lang.General.note_d+"","6"],[Lang.General.note_e+"b","7"],[Lang.General.note_e+"","8"],[Lang.General.note_f+"","9"],[Lang.General.note_f+"#","10"],[Lang.General.note_g+"","11"],[Lang.General.note_g+"#","12"],[Lang.General.note_a+"","13"],[Lang.General.note_b+ "b","14"],[Lang.General.note_b+"","15"]]),"NOTE").appendField(Lang.Blocks.ALBERT_play_note_for_2).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]]),"OCTAVE").appendField(Lang.Blocks.ALBERT_play_note_for_3);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_play_note_for=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.note=0;return a.callReturn()}b=a.getNumberField("NOTE",a);var d=a.getNumberField("OCTAVE",a),e=6E4*a.getNumberValue("VALUE",a)/Entry.Albert.tempo;a.isStart=!0;a.timeFlag=1;c.buzzer=0;c.note=b+12*(d-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -92,24 +93,24 @@ Entry.CODEino.getSensorKey()}):Entry.hw.sendQueue={SET:{0:{type:Entry.CODEino.se 9:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},10:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},11:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},12:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0},13:{type:Entry.CODEino.sensorTypes.DIGITAL,data:0}},TIME:Entry.CODEino.getSensorTime(Entry.CODEino.sensorTypes.DIGITAL),KEY:Entry.CODEino.getSensorKey()};Entry.hw.update()},sensorTypes:{ALIVE:0,DIGITAL:1,ANALOG:2,PWM:3,RGBLED_PIN:4,TONE:5,PULSEIN:6,ULTRASONIC:7,TIMER:8,ADDCOLOR:9},BlockState:{}}; Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.arduino_send=function(b,a){b=a.getValue("VALUE",a);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(b));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()}; +Entry.block.arduino_send=function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return Number(a.responseText)}; +Entry.block.arduino_get_number=function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return+c.responseText}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_get_string=function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return a.responseText}; +Entry.block.arduino_get_string=function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return c.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(b,a){return a.getStringField("PORT")}; Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){b=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(b[1])}; -Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){b=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(b)}; +Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var d=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(d[1])}; +Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var d=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(d)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){b=a.getNumberValue("VALUE");var c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==c?255:0);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var d=a.getNumberValue("VALUE"),c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){b=a.getNumberValue("PORT");var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(b,c);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var d=a.getNumberValue("PORT"),c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}; +Entry.block.arduino_convert_scale=function(b,a){var d=a.getNumberValue("VALUE1",a),c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(c>e)var h=c,c=e,e=h;f>g&&(h=f,f=g,g=h);d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}; Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; @@ -126,129 +127,129 @@ Entry.block.CODEino_get_sound_status=function(b,a){return"GREAT"==a.getField("ST Blockly.Blocks.CODEino_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_13).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.CODEino_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.CODEino_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]]),"PORT").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_is_button_pressed=function(b,a){b=a.getNumberField("PORT",a);return 14a?1:0;if("RIGHT"==b||"FRONT"==b)return 30a?1:0}; +Entry.block.CODEino_get_accelerometer_direction=function(b,a){var d=a.getField("DIRECTION",a),c=0;"LEFT"==d||"RIGHT"==d?c=3:"FRONT"==d||"REAR"==d?c=4:"REVERSE"==d&&(c=5);c=Entry.hw.getAnalogPortValue(c);c=180/137*(c-265);c+=-90;c=Math.min(90,c);c=Math.max(-90,c);c=Math.round(c);if("LEFT"==d||"REAR"==d)return-30>c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),d=265,e=402;b=-90;a=90;if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}; +Entry.block.CODEino_get_accelerometer_value=function(b,a){var d=265,c=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(d>c)var h=d,d=c,c=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(c-d)*(g-d);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT");b=7;"7"==c?b=7:"8"==c?b=8:"9"==c?b=9:"10"==c&&(b=10);c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==c?255:0);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var d=a.getField("PORT"),c=7;"7"==d?c=7:"8"==d?c=8:"9"==d?c=9:"10"==d&&(c=10);d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_switch_status=function(b,a){b=a.getField("PORT");var c=2;"2"==b?c=2:"4"==b&&(c=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(c)?1:0:0==Entry.hw.getDigitalPortValue(c)?1:0}; +Entry.block.dplay_get_switch_status=function(b,a){var d=a.getField("PORT"),c=2;"2"==d?c=2:"4"==d&&(c=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(c)?1:0:0==Entry.hw.getDigitalPortValue(c)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.dplay_get_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_3);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc88 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uac00\ubcc0\uc800\ud56d","ADJU"],["\ube5b\uc13c\uc11c","LIGHT"],["\uc628\ub3c4\uc13c\uc11c","TEMP"],["\uc870\uc774\uc2a4\ud2f1 X","JOYS"],["\uc870\uc774\uc2a4\ud2f1 Y","JOYS"],["\uc801\uc678\uc120", -"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(b,a){b=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(b[1])}; +"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(b,a){var d=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(d[1])}; Blockly.Blocks.dplay_get_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_tilt).appendField(new Blockly.FieldDropdown([["\uc67c\ucabd \uae30\uc6b8\uc784","LEFT"],["\uc624\ub978\ucabd \uae30\uc6b8\uc784","LIGHT"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; Entry.block.dplay_get_tilt=function(b,a){return"LIGHT"==a.getField("STATUS",a)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; Blockly.Blocks.dplay_DCmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc67c\ucabd","3"],["\uc624\ub978\ucabd","6"]]),"PORT");this.appendDummyInput().appendField(" DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){b=a.getField("PORT");var c=0;"3"==b?c=5:"6"==b&&(c=11);var d=a.getField("OPERATOR"),e=0,f=0;"FRONT"==d?(e=255,f=0):"REAR"==d?(e=0,f=255):"OFF"==d&&(f=e=0);Entry.hw.setDigitalPortValue(b,e);Entry.hw.setDigitalPortValue(c,f);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){var d=a.getField("PORT"),c=0;"3"==d?c=5:"6"==d&&(c=11);var e=a.getField("OPERATOR"),f=0,g=0;"FRONT"==e?(f=255,g=0):"REAR"==e?(f=0,g=255):"OFF"==e&&(g=f=0);Entry.hw.setDigitalPortValue(d,f);Entry.hw.setDigitalPortValue(c,g);return a.callReturn()}; Blockly.Blocks.dplay_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubd80\uc800\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\ub3c4","1"],["\ub808","2"],["\ubbf8","3"]]),"PORT");this.appendDummyInput().appendField("\ub85c");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var c=a.getField("PORT");b=2;"1"==c?b=2:"2"==c?b=4:"3"==c&&(b=7);c=a.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(b,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var d=a.getField("PORT"),c=2;"1"==d?c=2:"2"==d?c=4:"3"==d&&(c=7);d=a.getNumberValue("VALUE");d=Math.round(d);d=Math.max(d,0);d=Math.min(d,100);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; Blockly.Blocks.dplay_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4\ubaa8\ud130 \uac01\ub3c4\ub97c");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc774\ub3d9");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dplay_servo=function(b,a){b=a.getNumberValue("VALUE");b=Math.round(b);b=Math.max(b,0);b=Math.min(b,180);Entry.hw.setDigitalPortValue(9,b);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; -d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= +Entry.block.dplay_servo=function(b,a){var d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,180);Entry.hw.setDigitalPortValue(9,d);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,d=1;5>d;d++){var c=a[d];c&&(c.value||0===c.value)&&b.push([d+" - "+Lang.Blocks["BITBRICK_"+c.type],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,d=1;5>d;d++){var c=a[d]; +c&&"touch"===c.type&&b.push([d.toString(),d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,d=5;9>d;d++){var c=a[d];c&&"SERVO"===c.type&&b.push(["ABCD"[d-5],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,d=5;9>d;d++){var c=a[d];c&&"DC"===c.type&&b.push(["ABCD"[d-5],d.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b].value}; +Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){var d=a.getStringField("PORT");return Entry.hw.portData[d].value}; Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){b=a.getNumberValue("rValue");var c=a.getNumberValue("gValue"),d=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){var d=a.getNumberValue("rValue"),c=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(d,0,255);g.LEDG=f(c,0,255);g.LEDB=f(e,0,255);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){b=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(b.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(b.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(b.substr(5,2),16);return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){var d=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(d.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(d.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(d.substr(5,2),16);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){b=a.getNumberValue("VALUE");var c,d,e;b%=200;67>b?(c=200-3*b,d=3*b,e=0):134>b?(b-=67,c=0,d=200-3*b,e=3*b):201>b&&(b-=134,c=3*b,d=0,e=200-3*b);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){var d=a.getNumberValue("VALUE"),c,e,f,d=d%200;67>d?(c=200-3*d,e=3*d,f=0):134>d?(d-=67,c=0,e=200-3*d,f=3*d):201>d&&(d-=134,c=3*d,e=0,f=200-3*d);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();b=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=b;a.isStart=!0;return a}; +Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var d=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=d;a.isStart=!0;return a}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){c[a[1]]=0});b.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(b,a){var d=Entry.hw.sendQueue,c=Entry.Bitbrick;c.servoList().map(function(a){d[a[1]]=0});c.dcList().map(function(a){d[a[1]]=128});return a.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; -Entry.block.bitbrick_dc_speed=function(b,a){b=a.getNumberValue("VALUE");b=Math.min(b,Entry.Bitbrick.dcMaxValue);b=Math.max(b,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b+128;return a.callReturn()}; +Entry.block.bitbrick_dc_speed=function(b,a){var d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=d+128;return a.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){b="CW"===a.getStringField("DIRECTION");var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?c+128:128-c;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){var d="CW"===a.getStringField("DIRECTION"),c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=d?c+128:128-c;return a.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); -this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){b=a.getNumberValue("VALUE")+1;b=Math.min(b,Entry.Bitbrick.servoMaxValue);b=Math.max(b,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b;return a.callReturn()}; +this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){var d=a.getNumberValue("VALUE")+1,d=Math.min(d,Entry.Bitbrick.servoMaxValue),d=Math.max(d,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=d;return a.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(b,a){b=a.getNumberField("PORT");var c=Entry.hw.portData[b].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.bitbrick_convert_scale=function(b,a){var d=a.getNumberField("PORT"),c=Entry.hw.portData[d].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_color=function(b,a){var d=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(d=Entry.hex2rgb(d),b.brush.rgb=d,b.brush.endStroke(),b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; +Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var d=Entry.generateRgb();b.brush.rgb=d;b.brush.endStroke();b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_thickness=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=d,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_thickness=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=d,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_opacity=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity+d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_opacity=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()}; +Entry.block.brush_erase_all=function(b,a){var d=b.brush;if(d){var c=d._stroke.style,e=d._strokeStyle.width;d.clear().setStrokeStyle(e).beginStroke(c);d.moveTo(b.getX(),-1*b.getY())}d=b.parent.getStampEntities();d.map(function(a){a.removeClone()});d=null;return a.callReturn()}; Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_brush_transparency=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity-d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; +Entry.block.set_brush_tranparency=function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],null,!0,calcArrowColor),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.distance_something=function(b,a){a=a.getField("VALUE",a);if("mouse"==a)return a=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-a.x,2)+Math.pow(b.getY()-a.y,2));a=Entry.container.getEntity(a);return Math.sqrt(Math.pow(b.getX()-a.getX(),2)+Math.pow(b.getY()-a.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; +Entry.block.distance_something=function(b,a){var d=a.getField("VALUE",a);if("mouse"==d)return d=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-d.x,2)+Math.pow(b.getY()-d.y,2));d=Entry.container.getEntity(d);return Math.sqrt(Math.pow(b.getX()-d.getX(),2)+Math.pow(b.getY()-d.getY(),2))}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a);b="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1));case "picture_name":return a=b.parent,a=a.pictures,a[a.indexOf(b.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var d=a.getField("VALUE",a),d="self"==d?b:Entry.container.getEntity(d);switch(a.getField("COORDINATE",a)){case "x":return d.getX();case "y":return d.getY();case "rotation":return d.getRotation();case "direction":return d.getDirection();case "picture_index":var c=d.parent,c=c.pictures;return c.indexOf(d.picture)+1;case "size":return+d.getSize().toFixed(1);case "picture_name":return c=d.parent,c=c.pictures,c[c.indexOf(d.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_basic=function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?c+a:"MINUS"==b?c-a:"MULTI"==b?c*a:c/a};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_plus=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b+a};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_minus=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b-a};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_times=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b*a};Blockly.Blocks.calc_divide={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("/",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_divide=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b/a}; +Entry.block.calc_basic=function(b,a){var d=a.getField("OPERATOR",a),c=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==d?c+e:"MINUS"==d?c-e:"MULTI"==d?c*e:c/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_plus=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d+c};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_minus=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d-c};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_times=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d*c};Blockly.Blocks.calc_divide={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("/",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_divide=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d/c}; Blockly.Blocks.calc_mod={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_mod_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_mod=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b%a}; +Entry.block.calc_mod=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d%c}; Blockly.Blocks.calc_share={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_share=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return Math.floor(b/a)}; +Entry.block.calc_share=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return Math.floor(d/c)}; Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_2,calcFontColor);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin, "sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos,"acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round, "round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],null,!0,calcArrowColor),"VALUE");this.setOutput(!0,"Number");this.appendDummyInput().appendField(" ");this.setInputsInline(!0)}}; -Entry.block.calc_operation=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(a)&&(1b))throw Error("x range exceeded");a.indexOf("_")&&(a=a.split("_")[0]);-1<["sin","cos","tan"].indexOf(a)&&(b=Entry.toRadian(b));switch(a){case "square":a=b*b;break;case "factorial":a=Entry.factorial(b);break;case "root":a=Math.sqrt(b);break;case "log":a=Math.log(b)/Math.LN10;break;case "ln":a=Math.log(b);break;case "asin":case "acos":case "atan":a= -Entry.toDegrees(Math[a](b));break;case "unnatural":a=b-Math.floor(b);0>b&&(a=1-a);break;default:a=Math[a](b)}return Math.round(1E3*a)/1E3}; +Entry.block.calc_operation=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(c)&&(1d))throw Error("x range exceeded");c.indexOf("_")&&(c=c.split("_")[0]);-1<["sin","cos","tan"].indexOf(c)&&(d=Entry.toRadian(d));var e=0;switch(c){case "square":e=d*d;break;case "factorial":e=Entry.factorial(d);break;case "root":e=Math.sqrt(d);break;case "log":e=Math.log(d)/Math.LN10;break;case "ln":e=Math.log(d);break;case "asin":case "acos":case "atan":e= +Entry.toDegrees(Math[c](d));break;case "unnatural":e=d-Math.floor(d);0>d&&(e=1-e);break;default:e=Math[c](d)}return Math.round(1E3*e)/1E3}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var c=Math.min(b,a),d=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}; +Entry.block.calc_rand=function(b,a){var d=a.getStringValue("LEFTHAND",a),c=a.getStringValue("RIGHTHAND",a),e=Math.min(d,c),f=Math.max(d,c),d=Entry.isFloat(d);return Entry.isFloat(c)||d?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, -calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){b=a.getField("VALUE",a);a=new Date;return"YEAR"==b?a.getFullYear():"MONTH"==b?a.getMonth()+1:"DAY"==b?a.getDate():"HOUR"==b?a.getHours():"MINUTE"==b?a.getMinutes():a.getSeconds()}; +calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){var d=a.getField("VALUE",a),c=new Date;return"YEAR"==d?c.getFullYear():"MONTH"==d?c.getMonth()+1:"DAY"==d?c.getDate():"HOUR"==d?c.getHours():"MINUTE"==d?c.getMinutes():c.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(b,a){a=a.getField("VALUE",a);b=b.parent.sounds;for(var c=0;ca||a>b.length-1)throw Error();return b[a]}; +Entry.block.char_at=function(b,a){var d=a.getStringValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a)-1;if(0>c||c>d.length-1)throw Error();return d[c]}; Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){b=a.getStringValue("STRING",a);var c=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var d=b.length-1;if(0>c||0>a||c>d||a>d)throw Error();return b.substring(Math.min(c,a),Math.max(c,a)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){var d=a.getStringValue("STRING",a),c=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=d.length-1;if(0>c||0>e||c>f||e>f)throw Error();return d.substring(Math.min(c,e),Math.max(c,e)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", "String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}; Blockly.Blocks.index_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_index_of_string_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3,calcFontColor); -this.setInputsInline(!0)}};Entry.block.index_of_string=function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);a=b.indexOf(a);return-1b;b++)Entry.hw.sendQueue[b]=0;Entry.hw.update()}};Blockly.Blocks.cobl_read_ultrason={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_ultrason=function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}; +Entry.block.choose_project_timer_action=function(b,a){var d=a.getField("ACTION"),c=Entry.engine,e=c.projectTimer;"START"==d?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused=!1):c.startProjectTimer():"STOP"==d?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==d&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()};Entry.Cobl={name:"cobl",setZero:function(){for(var b=0;14>b;b++)Entry.hw.sendQueue[b]=0;Entry.hw.update()}};Blockly.Blocks.cobl_read_ultrason={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_ultrason=function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}; Blockly.Blocks.cobl_read_potenmeter={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uac00\ubcc0\uc800\ud56d \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_potenmeter=function(b,a){console.log("cobl_read_potenmeter");return Entry.hw.getAnalogPortValue("potenmeter")}; Blockly.Blocks.cobl_read_irread1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR1 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_irread1=function(b,a){return Entry.hw.getAnalogPortValue("potenmeter")};Blockly.Blocks.cobl_read_irread2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR2 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}}; Entry.block.cobl_read_irread2=function(b,a){a.getValue("irread2",a);return Entry.hw.getAnalogPortValue("irread2")};Blockly.Blocks.cobl_read_joyx={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1X\ucd95 \uc77d\uae30(1,0,-1)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_joyx=function(b,a){return Entry.hw.getAnalogPortValue("joyx")}; @@ -256,44 +257,44 @@ Blockly.Blocks.cobl_read_joyy={init:function(){this.setColour("#00979D");this.ap Entry.block.cobl_read_sens1=function(b,a){return Entry.hw.getAnalogPortValue("sens1")};Blockly.Blocks.cobl_read_sens2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc13c\uc11c2 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_sens2=function(b,a){return Entry.hw.getAnalogPortValue("sens2")}; Blockly.Blocks.cobl_read_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uae30\uc6b8\uae30\uc13c\uc11c \uc77d\uae30(0~4)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_tilt=function(b,a){return Entry.hw.getAnalogPortValue("tilt")}; Blockly.Blocks.cobl_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.cobl_get_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.cobl_read_temps={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc628\ub3c4\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_temps=function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getAnalogPortValue("temps1");if(2==b)return Entry.hw.getAnalogPortValue("temps2")}; -Blockly.Blocks.cobl_read_light={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc1d\uae30\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_light=function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getAnalogPortValue("light1");if(2==b)return Entry.hw.getAnalogPortValue("light2")}; -Blockly.Blocks.cobl_read_btn={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\ud2bc\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.cobl_read_btn=function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getDigitalPortValue("btn1");if(2==b)return Entry.hw.getDigitalPortValue("btn2")}; +Blockly.Blocks.cobl_read_temps={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc628\ub3c4\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_temps=function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getAnalogPortValue("temps1");if(2==d)return Entry.hw.getAnalogPortValue("temps2")}; +Blockly.Blocks.cobl_read_light={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc1d\uae30\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_light=function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getAnalogPortValue("light1");if(2==d)return Entry.hw.getAnalogPortValue("light2")}; +Blockly.Blocks.cobl_read_btn={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\ud2bc\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.cobl_read_btn=function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getDigitalPortValue("btn1");if(2==d)return Entry.hw.getDigitalPortValue("btn2")}; Blockly.Blocks.cobl_led_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Rainbow LED");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"]]),"PORT");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OFF","OFF"],["Red","Red"],["Orange","Orange"],["Yellow","Yellow"],["Green","Green"],["Blue","Blue"],["Dark Blue","Dark Blue"],["Purple","Purple"],["White","White"]]), -"OPERATOR");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_led_control=function(b,a){b=a.getStringField("PORT");var c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",b);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return a.callReturn()};Blockly.Blocks.cobl_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}}; +"OPERATOR");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_led_control=function(b,a){var d=a.getStringField("PORT"),c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",d);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return a.callReturn()};Blockly.Blocks.cobl_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}}; Entry.block.cobl_text=function(b,a){return a.getStringField("NAME")};Blockly.Blocks.cobl_servo_angle_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Servo");this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField("Angle-");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(15~165)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_servo_angle_control=function(b,a){console.log("servo - test");b=a.getNumberValue("PORT");var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==b&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==b&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return a.callReturn()}; +Entry.block.cobl_servo_angle_control=function(b,a){console.log("servo - test");var d=a.getNumberValue("PORT"),c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==d&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==d&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return a.callReturn()}; Blockly.Blocks.cobl_melody={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Melody");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["(Low)So","L_So"],["(Low)So#","L_So#"],["(Low)La","L_La"],["(Low)La#","L_La#"],["(Low)Ti","L_Ti"],["Do","Do"],["Do#","Do#"],["Re","Re"],["Re#","Re#"],["Mi","Mi"],["Fa","Fa"],["Fa#","Fa#"],["So","So"],["So#","So#"],["La","La"],["La#","La#"],["Ti","Ti"],["(High)Do","H_Do"],["(High)Do#","H_Do#"],["(High)Re","H_Re"],["(High)R2#", -"H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]]),"MELODY");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_melody=function(b,a){b=a.getStringField("MELODY");console.log("cobl_melody"+b);Entry.hw.setDigitalPortValue("Melody",b);return a.callReturn()}; +"H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]]),"MELODY");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_melody=function(b,a){var d=a.getStringField("MELODY");console.log("cobl_melody"+d);Entry.hw.setDigitalPortValue("Melody",d);return a.callReturn()}; Blockly.Blocks.cobl_dcmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DcMotor");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"MOTOR");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1.Clockwise","1"],["2.Counter Clockwise","2"],["3.Stop","3"]]),"DIRECTION");this.appendDummyInput().appendField(" Speed");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"SPEED");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_dcmotor=function(b,a){b=a.getStringField("MOTOR");var c=a.getStringField("DIRECTION"),d=a.getStringField("SPEED");console.log("MOTOR"+b+" Direction"+c+" speed"+d);1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d));2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d));return a.callReturn()}; +Entry.block.cobl_dcmotor=function(b,a){var d=a.getStringField("MOTOR"),c=a.getStringField("DIRECTION"),e=a.getStringField("SPEED");console.log("MOTOR"+d+" Direction"+c+" speed"+e);1==d&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",e));2==d&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",e));return a.callReturn()}; Blockly.Blocks.cobl_extention_port={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Extention Port");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"PORT");this.appendDummyInput().appendField(" Level");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"LEVEL");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_extention_port=function(b,a){b=a.getStringField("PORT");var c=a.getStringField("LEVEL");1==b&&Entry.hw.setDigitalPortValue("EXUSB1",c);2==b&&Entry.hw.setDigitalPortValue("EXUSB2",c);return a.callReturn()}; +Entry.block.cobl_extention_port=function(b,a){var d=a.getStringField("PORT"),c=a.getStringField("LEVEL");1==d&&Entry.hw.setDigitalPortValue("EXUSB1",c);2==d&&Entry.hw.setDigitalPortValue("EXUSB2",c);return a.callReturn()}; Blockly.Blocks.cobl_external_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("External LED ");this.appendValueInput("LED").setCheck(["Number","String"]);this.appendDummyInput().appendField(" (1~64)");this.appendDummyInput().appendField(" R ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"RED");this.appendDummyInput().appendField(" G ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"GREEN");this.appendDummyInput().appendField(" B ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"BLUE");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.cobl_external_led=function(b,a){b=a.getNumberValue("LED");var c=a.getStringField("RED"),d=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);return a.callReturn()}; -Blockly.Blocks.cobl_7_segment={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("7 Segment");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(0~9999)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_7_segment=function(b,a){b=a.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",b);return a.callReturn()};Entry.Codestar={name:"codestar",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/codestar.png",width:333,height:409,listPorts:{13:{name:"\uc9c4\ub3d9\ubaa8\ud130",type:"output",pos:{x:0,y:0}},6:{name:"\uc9c4\ub3d9\uc13c\uc11c",type:"input",pos:{x:0,y:0}}},ports:{7:{name:"\ube68\uac04\uc0c9",type:"output",pos:{x:238,y:108}},8:{name:"\ud30c\ub780\uc0c9",type:"output", +Entry.block.cobl_external_led=function(b,a){var d=a.getNumberValue("LED"),c=a.getStringField("RED"),e=a.getStringField("GREEN"),f=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",d);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",e);Entry.hw.setDigitalPortValue("ELED_B",f);return a.callReturn()}; +Blockly.Blocks.cobl_7_segment={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("7 Segment");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(0~9999)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_7_segment=function(b,a){var d=a.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",d);return a.callReturn()};Entry.Codestar={name:"codestar",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/codestar.png",width:333,height:409,listPorts:{13:{name:"\uc9c4\ub3d9\ubaa8\ud130",type:"output",pos:{x:0,y:0}},6:{name:"\uc9c4\ub3d9\uc13c\uc11c",type:"input",pos:{x:0,y:0}}},ports:{7:{name:"\ube68\uac04\uc0c9",type:"output",pos:{x:238,y:108}},8:{name:"\ud30c\ub780\uc0c9",type:"output", pos:{x:265,y:126}},9:{name:"3\uc0c9 \ube68\uac04\uc0c9",type:"output",pos:{x:292,y:34}},10:{name:"3\uc0c9 \ub179\uc0c9",type:"output",pos:{x:292,y:34}},11:{name:"3\uc0c9 \ud30c\ub780\uc0c9",type:"output",pos:{x:292,y:34}},12:{name:"\ubc84\ud2bc",type:"input",pos:{x:248,y:142}},a0:{name:"\uc67c\ucabd \ubcbd\uac10\uc9c0",type:"input",pos:{x:24,y:231}},a2:{name:"\ub9c8\uc774\ud06c",type:"input",pos:{x:225,y:67}},a3:{name:"\ubd80\uc800",type:"output",pos:{x:283,y:105}},a4:{name:"\uc67c\ucabd \ub77c\uc778\uac10\uc9c0", type:"input",pos:{x:37,y:353}},a5:{name:"\uc624\ub978\ucabd \ub77c\uc778\uac10\uc9c0",type:"input",pos:{x:50,y:368}},a6:{name:"\uc870\ub3c4\uc13c\uc11c",type:"input",pos:{x:273,y:22}},a7:{name:"\uc624\ub978\ucabd \ubcbd\uac10\uc9c0",type:"input",pos:{x:103,y:381}},temperature:{name:"\uc628\ub3c4\uc13c\uc11c",type:"input",pos:{x:311,y:238}},sonar:{name:"\ucd08\uc74c\ud30c",type:"input",pos:{x:7,y:277}},leftwheel:{name:"\uc67c\ucabd \ubc14\ud034",type:"output",pos:{x:177,y:370}},rightwheel:{name:"\uc624\ub978\ucabd \ubc14\ud034", type:"output",pos:{x:83,y:218}}},mode:"both"}};Entry.EV3={PORT_MAP:{A:0,B:0,C:0,D:0,1:void 0,2:void 0,3:void 0,4:void 0},motorMovementTypes:{Degrees:0,Power:1},deviceTypes:{NxtTouch:1,NxtLight:2,NxtSound:3,NxtColor:4,NxtUltrasonic:5,NxtTemperature:6,LMotor:7,MMotor:8,Touch:16,Color:29,Ultrasonic:30,Gyroscope:32,Infrared:33,Initializing:125,Empty:126,WrongPort:127,Unknown:255},colorSensorValue:" 000000 0000FF 00FF00 FFFF00 FF0000 FFFFFF A52A2A".split(" "),timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b); 0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},setZero:function(){var b=this.PORT_MAP;Object.keys(b).forEach(function(a){/[A-D]/i.test(a)?Entry.hw.sendQueue[a]={type:Entry.EV3.motorMovementTypes.Power,power:0}:Entry.hw.sendQueue[a]=b[a]});Entry.hw.update()},name:"EV3"}; -Blockly.Blocks.ev3_get_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.ev3_get_sensor_value=function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c;$.isPlainObject(b)&&(c=b.siValue||0);return c}; +Blockly.Blocks.ev3_get_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.ev3_get_sensor_value=function(b,a){a.getStringField("PORT",a);var d=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),c;$.isPlainObject(d)&&(c=d.siValue||0);return c}; Blockly.Blocks.ev3_touch_sensor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.ev3_touch_sensor=function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));a=!1;b.type==Entry.EV3.deviceTypes.Touch&&1<=Number(b.siValue)&&(a=!0);return a}; +Entry.block.ev3_touch_sensor=function(b,a){a.getStringField("PORT",a);var d=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),c=!1;d.type==Entry.EV3.deviceTypes.Touch&&1<=+d.siValue&&(c=!0);return c}; Blockly.Blocks.ev3_color_sensor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"]]),"PORT").appendField("\uc758 ").appendField(new Blockly.FieldDropdown([["RGB","RGB"],["R","R"],["G","G"],["B","B"]]),"RGB").appendField("\uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.ev3_color_sensor=function(b,a){a.getStringField("PORT",a);b=a.getStringField("RGB",a);a=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));var c="";if(a.type==Entry.EV3.deviceTypes.Color)if(0==a.siValue)c="";else switch(b){case "RGB":c=Entry.EV3.colorSensorValue[a.siValue];break;case "R":c=Entry.EV3.colorSensorValue[a.siValue].substring(0,2);break;case "G":c=Entry.EV3.colorSensorValue[a.siValue].substring(2,4);break;case "B":c=Entry.EV3.colorSensorValue[a.siValue].substring(4,6)}else c= -"\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return c};Blockly.Blocks.ev3_motor_power={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.ev3_motor_power=function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}; +Entry.block.ev3_color_sensor=function(b,a){a.getStringField("PORT",a);var d=a.getStringField("RGB",a),c=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),e="";if(c.type==Entry.EV3.deviceTypes.Color)if(0==c.siValue)e="";else switch(d){case "RGB":e=Entry.EV3.colorSensorValue[c.siValue];break;case "R":e=Entry.EV3.colorSensorValue[c.siValue].substring(0,2);break;case "G":e=Entry.EV3.colorSensorValue[c.siValue].substring(2,4);break;case "B":e=Entry.EV3.colorSensorValue[c.siValue].substring(4,6)}else e= +"\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return e};Blockly.Blocks.ev3_motor_power={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.ev3_motor_power=function(b,a){var d=a.getStringField("PORT",a),c=a.getValue("VALUE",a);Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}; Blockly.Blocks.ev3_motor_power_on_time={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("TIME").setCheck(["Number"]);this.appendDummyInput().appendField("\ucd08 \ub3d9\uc548");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)}}; -Entry.block.ev3_motor_power_on_time=function(b,a){b=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),d=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};var e=setTimeout(function(){a.timeFlag= -0;Entry.EV3.removeTimeout(e)},1E3*c);Entry.EV3.timeouts.push(e);return a}; +Entry.block.ev3_motor_power_on_time=function(b,a){var d=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),e=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:e};var f= +setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(f)},1E3*c);Entry.EV3.timeouts.push(f);return a}; Blockly.Blocks.ev3_motor_degrees={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\uc2dc\uacc4\ubc29\ud5a5","CW"],["\ubc18\uc2dc\uacc4\ubc29\ud5a5","CCW"]]),"DIRECTION").appendField("\uc73c\ub85c ");this.appendValueInput("DEGREE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub3c4 \ub9cc\ud07c \ud68c\uc804"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.ev3_motor_degrees=function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("DEGREE",a);0>=c?c=0:720<=c&&(c=720);var d=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==d?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*b*1E3);return a}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.ev3_motor_degrees=function(b,a){var d=a.getStringField("PORT",a),c=a.getValue("DEGREE",a);0>=c?c=0:720<=c&&(c=720);var e=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==e?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var d=a.getNumberValue("SECOND",a),d=60/(Entry.FPS||60)*d*1E3;setTimeout(function(){a.timeFlag=0},d);return a}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.repeat_basic=function(b,a){if(!a.isLooped){a.isLooped=!0;b=a.getNumberValue("VALUE",a);if(0>b)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(b)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; +Entry.block.repeat_basic=function(b,a){var d;if(!a.isLooped){a.isLooped=!0;d=a.getNumberValue("VALUE",a);if(0>d)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(d)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_repeat=function(b,a){return this.executor.break()}; Blockly.Blocks.wait_until_true={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -301,380 +302,380 @@ Entry.block.wait_until_true=function(b,a){return a.getBooleanValue("BOOL",a)?a.c Blockly.Blocks._if={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isLooped=!0,a.getStatement("STACK",a)):a.callReturn()}; Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();b=a.getBooleanValue("BOOL",a);a.isLooped=!0;return b?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; +this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();var d=a.getBooleanValue("BOOL",a);a.isLooped=!0;return d?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a);a=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return a};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.create_clone=function(b,a){var d=a.getField("VALUE",a),c=a.callReturn();"self"==d?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(d).addCloneEntity(b.parent,null,null);return c};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){b=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(b=!b);return(a.isLooped=b)?a.getStatement("DO",a):a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){var d=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(d=!d);return(a.isLooped=d)?a.getStatement("DO",a):a.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){a=a.getField("TARGET",a);var c=Entry.container;switch(a){case "all":return c.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; +"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){var d=a.getField("TARGET",a),c=Entry.container;switch(d){case "all":return c.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; -Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){b=b.parent.getClonedEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; +Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){var d=b.parent.getClonedEntities();d.map(function(a){a.removeClone()});d=null;return a.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_label={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#f9c535",template:"%1%2",params:[{type:"TextInput",value:"\ud568\uc218"},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_string={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#ffd974",template:"%1%2",params:[{type:"Block",accept:"stringMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_boolean={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#aeb8ff",template:"%1%2",params:[{type:"Block",accept:"booleanMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.stringHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_string=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +this.hashId);return b}};Entry.block.function_param_string=function(b,a,d){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.booleanHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,d){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(b,a){return a.callReturn()}; Entry.block.function_create={skeleton:"basic",color:"#cc7337",event:"funcDef",template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2",params:[{type:"Block",accept:"paramMagnet",value:{type:"function_field_label"}},{type:"Indicator",img:"/lib/entryjs/images/block_icon/function_03.png",size:12}],func:function(){}}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(b){var a=b.getElementsByTagName("field");this.appendDummyInput().appendField("");a.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var c=0;ca.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,b.leftWheel=45+.25*c,b.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;a.boardState=3;var d=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d); -break;case 3:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a}; +Entry.block.hamster_move_forward_once=function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData;if(a.isStart){if(a.isMoving){switch(a.boardState){case 1:2>a.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,d.leftWheel=45+.25*c,d.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;d.leftWheel=45+.25*c;d.rightWheel=45-.25*c;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); +break;case 3:c=c.leftFloor-c.rightFloor;d.leftWheel=45+.25*c;d.rightWheel=45-.25*c;break;case 4:d.leftWheel=0,d.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;d.leftWheel=45;d.rightWheel=45;Entry.Hamster.setLineTracerMode(d,0);return a}; Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_once_right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT",a),d=Number(a.getField("MODE",a));"A"==c?b.ioModeA=d:("B"!=c&&(b.ioModeA=d),b.ioModeB=d);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==c?d.ioModeA=e:("B"!=c&&(d.ioModeA=e),d.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=void 0!=b.outputA?b.outputA+d:d:("B"!=c&&(b.outputA=void 0!=b.outputA?b.outputA+d:d),b.outputB=void 0!=b.outputB?b.outputB+d:d);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==c?d.outputA=void 0!=d.outputA?d.outputA+e:e:("B"!=c&&(d.outputA=void 0!=d.outputA?d.outputA+e:e),d.outputB=void 0!=d.outputB?d.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_a_b,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=d:("B"!=c&&(b.outputA=d),b.outputB=d);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){b=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(b)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==c?d.outputA=e:("B"!=c&&(d.outputA=e),d.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var d=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(d)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a);a=b.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision;if(d)switch(b=Entry.stage.wall,c){case "wall":if(e(a,b.up,.2,!0)||e(a,b.down,.2,!0)||e(a,b.left,.2,!0)||e(a,b.right,.2,!0))return!0;break;case "wall_up":if(e(a,b.up,.2,!0))return!0;break;case "wall_down":if(e(a,b.down,.2,!0))return!0;break;case "wall_right":if(e(a,b.right,.2,!0))return!0;break;case "wall_left":if(e(a,b.left,.2,!0))return!0}else{if("mouse"== -c)return e=Entry.stage.canvas,e=a.globalToLocal(e.mouseX,e.mouseY),a.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){e=c.object.getTransformedBounds();a=a.getTransformedBounds();if(Entry.checkCollisionRect(a,e))return!0;b=c.parent.clonedEntities;c=0;for(d=b.length;c","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?c==a:"BIGGER"==b?c>a:c","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_bigger=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b>a};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_smaller=function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_comparison=function(b,a){var d=a.getField("OPERATOR",a),c=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==d?c==e:"BIGGER"==d?c>e:c","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_bigger=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d>c};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_smaller=function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){b=a.getField("OPERATOR",a);var c=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return c==a;case "GREATER":return Number(c)>Number(a);case "LESS":return Number(c)=Number(a);case "LESS_OR_EQUAL":return Number(c)<=Number(a)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var d=a.getField("OPERATOR",a),c=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(d){case "EQUAL":return c==e;case "GREATER":return+c>+e;case "LESS":return+c<+e;case "GREATER_OR_EQUAL":return+c>=+e;case "LESS_OR_EQUAL":return+c<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; +Entry.block.dialog_time=function(b,a){if(!a.isStart){var d=a.getNumberValue("SECOND",a),c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;c||"number"==typeof c||(c=" ");c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*d)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(b,a){var d=a.getStringValue("VALUE",a);d||"number"==typeof d||(d=" ");var c=a.getField("OPTION",a),d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,c);b.syncDialogVisible(b.getVisible());return a.callReturn()}; Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_nth_shape=function(b,a){var d=a.getField("VALUE",a),d=b.parent.getPicture(d);b.setImage(d);return a.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_next_shape=function(b,a){var d;d=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(d);return a.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c+b.effect.hue:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c+b.effect.brightness:"blur"!=d&&"opacity"==d&&(b.effect.alpha+=c/100));b.applyFilter();return a.callReturn()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c:"blur"!=d&&"opacity"==d&&(b.effect.alpha=c/100));b.applyFilter();return a.callReturn()}; Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; +Entry.block.change_scale_percent=function(b,a){var d=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*d);b.setScaleY(b.getScaleY()*d);return a.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}; +Entry.block.set_scale_percent=function(b,a){var d=a.getNumberValue("VALUE",a)/100,c=b.snapshot_;b.setScaleX(d*c.scaleX);b.setScaleY(d*c.scaleY);return a.callReturn()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; +Entry.block.change_scale_size=function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+d);return a.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; +Entry.block.set_scale_size=function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(d);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(b,a){var c=a.getField("VALUE",a);b=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1b)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,b-1);break;case "BACKWARD":c=Math.min(e,b+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(b,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(b,a){var d,c=a.getField("LOCATION",a),e=Entry.container.getCurrentObjects(),f=e.indexOf(b.parent),e=e.length-1;if(0>f)throw Error("object is not available for current scene");switch(c){case "FRONT":d=0;break;case "FORWARD":d=Math.max(0,f-1);break;case "BACKWARD":d=Math.min(e,f+1);break;case "BACK":d=e}Entry.container.moveElementByBlock(f,d);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_x=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_y=function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(b.getY()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){d=a.x-b.getX();var c=a.y-b.getY();d/=a.frameCount;c/=a.frameCount;b.setX(b.getX()+d);b.setY(b.getY()+c);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; +Entry.block.rotate_by_angle=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+d);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var d=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +d);return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; +Entry.block.see_angle=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; +Entry.block.see_direction=function(b,a){var d=a.getField("VALUE",a),c=Entry.container.getEntity(d),d=c.getX()-b.getX(),c=c.getY()-b.getY();0<=d?b.setRotation(Math.atan(c/d)/Math.PI*180+90):b.setRotation(Math.atan(c/d)/Math.PI*180+270);return a.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var d=a.getNumberValue("VALUE1",a);b.setX(d);d=a.getNumberValue("VALUE2",a);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_x=function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_y=function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -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(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var d=a.getField("VALUE",a),c;"mouse"==d?(d=Entry.stage.mouseCoordinate.x,c=Entry.stage.mouseCoordinate.y):(c=Entry.container.getEntity(d),d=c.getX(),c=c.getY());b.setX(+d);b.setY(+c);b.brush&&!b.brush.stop&&b.brush.lineTo(d,-1*c);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.move_xy_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dX=c/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision== -Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c? -b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): -b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, -b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; +Entry.block.bounce_wall=function(b,a){var d=b.parent.getRotateMethod(),c="free"==d?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>c&&0<=c||360>c&&270<=c){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP): +(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>c&&90<=c&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= +!1),f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360>c&&180<=c?(e=b.collision==Entry.Utils.COLLISION.LEFT, +c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()): +b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>c&&0<=c&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,c=ndgmr.checkPixelCollision(Entry.stage.wall.left, +b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}; +Entry.block.see_angle_object=function(b,a){var d=a.getField("VALUE",a),c=b.getX(),e=b.getY();if(b.parent.id==d)return a.callReturn();"mouse"==d?(d=Entry.stage.mouseCoordinate.y,c=Entry.stage.mouseCoordinate.x-c,e=d-e):(d=Entry.container.getEntity(d),c=d.getX()-c,e=d.getY()-e);e=0===c&&0===e?b.getDirection()+b.getRotation():0<=c?-Math.atan(e/c)/Math.PI*180+90:-Math.atan(e/c)/Math.PI*180+270;c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-c);return a.callReturn()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.see_angle_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; +Entry.block.see_angle_direction=function(b,a){var d=a.getNumberValue("VALUE",a),c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+d-c);return a.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.rotate_direction=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;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=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)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var d,c,e;c=a.getField("TARGET",a);d=a.getNumberValue("VALUE",a);d=Math.floor(d*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=d)"mouse"==c?(c=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(c),c=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=d,a.dX=c/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==c?(c=+e.x,e=+e.y):(e=Entry.container.getEntity(c),c=e.getX(),e=e.getY()),b.setX(c),b.setY(e),b.brush&&!b.brush.stop&& +b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; +Entry.block.rotate_absolute=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; +Entry.block.rotate_relative=function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d+b.getRotation());return a.callReturn()}; Blockly.Blocks.direction_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; +Entry.block.direction_absolute=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.direction_relative=function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var d=a.getNumberValue("VALUE",a),c=a.getNumberValue("ANGLE",a);b.setX(b.getX()+d*Math.cos((c-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((c-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var c=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dDirection=c/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, y:0}},FND:{name:"FND",type:"output",pos:{x:0,y:0}}},ports:{IN1:{name:"IN1",type:"input",pos:{x:270,y:200}},IN2:{name:"IN2",type:"input",pos:{x:325,y:200}},IN3:{name:"IN3",type:"input",pos:{x:325,y:500}},DCL:{name:"L-Motor",type:"output",pos:{x:270,y:500}},DCR:{name:"R-Motor",type:"output",pos:{x:435,y:500}},OUT1:{name:"OUT1",type:"output",pos:{x:380,y:200}},OUT2:{name:"OUT2",type:"output",pos:{x:435,y:200}},OUT3:{name:"OUT3",type:"output",pos:{x:380,y:500}}},mode:"both"}}; -Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b]}; +Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){var d=a.getStringField("PORT");return Entry.hw.portData[d]}; Blockly.Blocks.neobot_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+c;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){var d=a.getNumberField("SPEED"),c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=d+c;return a.callReturn()}; Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}; Blockly.Blocks.neobot_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+c;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){var d=a.getNumberField("SPEED"),c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=d+c;return a.callReturn()}; Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}; Blockly.Blocks.neobot_all_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc591\ucabd \ubaa8\ud130\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]]),"SPEED").appendField(" \uc758 \uc18d\ub3c4\ub85c ").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4","1"],["\ud6c4\uc9c4", "2"],["\uc81c\uc790\ub9ac \uc88c\ud68c\uc804","3"],["\uc81c\uc790\ub9ac \uc6b0\ud68c\uc804","4"],["\uc88c\ud68c\uc804","5"],["\uc6b0\ud68c\uc804","6"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_all_motor=function(b,a){a.getNumberField("TYPE");b=a.getNumberField("SPEED");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=16+b;break;case 2:Entry.hw.sendQueue.DCL=32+b;Entry.hw.sendQueue.DCR=32+b;break;case 3:Entry.hw.sendQueue.DCL=32+b;Entry.hw.sendQueue.DCR=16+b;break;case 4:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=32+b;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+b;break;case 6:Entry.hw.sendQueue.DCL= -16+b,Entry.hw.sendQueue.DCR=0}return a.callReturn()}; +Entry.block.neobot_all_motor=function(b,a){a.getNumberField("TYPE");var d=a.getNumberField("SPEED");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+d;Entry.hw.sendQueue.DCR=16+d;break;case 2:Entry.hw.sendQueue.DCL=32+d;Entry.hw.sendQueue.DCR=32+d;break;case 3:Entry.hw.sendQueue.DCL=32+d;Entry.hw.sendQueue.DCR=16+d;break;case 4:Entry.hw.sendQueue.DCL=16+d;Entry.hw.sendQueue.DCR=32+d;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+d;break;case 6:Entry.hw.sendQueue.DCL= +16+d,Entry.hw.sendQueue.DCR=0}return a.callReturn()}; Blockly.Blocks.neobot_set_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","10"],["20\ub3c4","20"],["30\ub3c4","30"],["40\ub3c4","40"],["50\ub3c4","50"],["60\ub3c4","60"],["70\ub3c4","70"],["80\ub3c4","80"],["90\ub3c4","90"],["100\ub3c4","100"],["110\ub3c4", "110"],["120\ub3c4","120"],["130\ub3c4","130"],["140\ub3c4","140"],["150\ub3c4","150"],["160\ub3c4","160"],["170\ub3c4","170"],["180\ub3c4","180"]]),"DEGREE").appendField(" \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_servo=function(b,a){b=a.getNumberField("PORT");var c=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+b]=c;3===b&&(b=4);Entry.hw.sendQueue.OPT|=b;return a.callReturn()}; +Entry.block.neobot_set_servo=function(b,a){var d=a.getNumberField("PORT"),c=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+d]=c;3===d&&(d=4);Entry.hw.sendQueue.OPT|=d;return a.callReturn()}; Blockly.Blocks.neobot_set_output={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub9cc\ud07c \ucd9c\ub825").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.neobot_set_output=function(b,a){b=a.getStringField("PORT",a);var c=a.getNumberValue("VALUE",a),d=b;0>c?c=0:255c?c=0:255b&&(b=0);Entry.hw.sendQueue.FND=b;return a.callReturn()}; +Entry.block.neobot_set_fnd=function(b,a){var d=a.getNumberValue("VALUE",a);255d&&(d=0);Entry.hw.sendQueue.FND=d;return a.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([["\ubb34\uc74c","0"],[Lang.General.note_c,"1"],[Lang.General.note_c+"#","2"],[Lang.General.note_d,"3"],[Lang.General.note_d+"#","4"],[Lang.General.note_e,"5"],[Lang.General.note_f,"6"],[Lang.General.note_f+"#","7"],[Lang.General.note_g,"8"],[Lang.General.note_g+"#","9"],[Lang.General.note_a,"10"],[Lang.General.note_a+"#","11"], [Lang.General.note_b,"12"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2","1"],["3","2"],["4","3"],["5","4"],["6","5"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"],["16\ubd84\uc74c\ud45c","16"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.SND=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberField("DURATION",a),c=c+12*d;a.isStart=!0;a.timeFlag=1;65b;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),c=a;cb;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),c=a;cb;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),d=a;db;b++)Entry.hw.sendQueue[b]=0;this.ColorPin=[0,0,0];Entry.hw.update()},setSendData:function(b){Entry.hw.sendQueue=b;Entry.hw.update();this.wait(32)},wait:function(b){for(var a=(new Date).getTime(),d=a;dd&&(d=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,c,d]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,2,c,d]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,c,d]);return a.callReturn()}; +Entry.block.schoolkit_motor=function(b,a){var d=0,c=0,d=a.getField("MODE"),e=a.getField("OPERATOR"),f=a.getNumberValue("VALUE"),d="motor1"==d?7:8;255f&&(f=0);"cw"==e?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,d,f]):"ccw"==e?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,2,d,f]):"stop"==e&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,c,d,f]);return a.callReturn()}; Blockly.Blocks.schoolkit_set_servo_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.roborobo_num_pin_1);this.appendValueInput("PIN").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.roborobo_num_pin_2);this.appendDummyInput().appendField(" : ");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.roborobo_degree);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.schoolkit_set_servo_value=function(b,a){b=a.getNumberValue("PIN");var c=a.getNumberValue("VALUE");0>c?c=0:180=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= -0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=b=(new Date).getTime();cc?c=0:180=d)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= +0},d);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var d=(new Date).getTime(),c=d;cc&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(b,a){var d=a.getField("PORT",a),c=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(d-1)*g,g,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(b,a){b=a.getField("PORT",a);var c=a.getField("LED_MODULE",a),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(b,a){var d=a.getField("PORT",a),c=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(d-1)*g,g,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){b=a.getField("PORT",a);var c=a.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){var d=a.getField("PORT",a),c=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(d-1)*g,g,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(b,a){b=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var c,d;c=a.getNumberValue("ADDRESS");d=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[b,c,65535b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()}; +Entry.block.sound_volume_change=function(b,a){var d=a.getNumberValue("VALUE",a)/100,d=d+createjs.Sound.getVolume();1d&&(d=0);createjs.Sound.setVolume(d);return a.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_volume_set=function(b,a){b=a.getNumberValue("VALUE",a)/100;1b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; +Entry.block.sound_volume_set=function(b,a){var d=a.getNumberValue("VALUE",a)/100;1d&&(d=0);createjs.Sound.setVolume(d);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id);return a.callReturn()}; +Entry.block.sound_something_with_block=function(b,a){var d=a.getStringValue("VALUE",a);(d=b.parent.getSound(d))&&createjs.Sound.play(d.id);return a.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*d});return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var d=a.getStringValue("VALUE",a),c=a.getNumberValue("SECOND",a);(d=b.parent.getSound(d))&&createjs.Sound.play(d.id,{startTime:0,duration:1E3*c});return a.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a}; +Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d))createjs.Sound.play(d.id),setTimeout(function(){a.playState=0},1E3*d.duration);return a}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*b);d.addEventListener("complete",function(a){})}return a}; +Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=createjs.Sound.play(d.id),d=a.getNumberValue("SECOND",a);setTimeout(function(){c.stop();a.playState=0},1E3*d);c.addEventListener("complete",function(a){})}return a}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var c=1E3*a.getNumberValue("START",a),d=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(d.id,{startTime:Math.min(c,e),duration:Math.max(c,e)-Math.min(c,e)})}return a.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(b.id,{startTime:c,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; +Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(c,e),c=Math.max(c,e)-f;createjs.Sound.play(d.id,{startTime:f,duration:c});setTimeout(function(){a.playState=0},c)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, "39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; @@ -686,186 +687,128 @@ Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");th Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}, whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){b=a.getField("VALUE",a);var c=Entry.isExist(b,"id",Entry.variableContainer.messages_);if("null"==b||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",b]);return a.callReturn()}; +b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){var d=a.getField("VALUE",a),c=Entry.isExist(d,"id",Entry.variableContainer.messages_);if("null"==d||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",d]);return a.callReturn()}; Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}}; -Entry.block.message_cast_wait=function(b,a){if(a.runningScript){b=a.runningScript;for(var c=b.length,d=0;db.array_.length)throw Error("can not remove value from array");b.array_.splice(d-1,1);b.updateView();return a.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(b,a){var d=a.getField("LIST",a),c=a.getValue("VALUE",a),d=Entry.variableContainer.getList(d,b);if(!d.array_||isNaN(c)||c>d.array_.length)throw Error("can not remove value from array");d.array_.splice(c-1,1);d.updateView();return a.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||0==e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:d});b.updateView();return a.callReturn()}; +Entry.block.insert_value_to_list=function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b);if(!d.array_||isNaN(e)||0==e||e>d.array_.length+1)throw Error("can not insert value to array");d.array_.splice(e-1,0,{data:c});d.updateView();return a.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=d;b.updateView();return a.callReturn()}; +Entry.block.change_value_list_index=function(b,a){var d=a.getField("LIST",a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b);if(!d.array_||isNaN(e)||e>d.array_.length)throw Error("can not insert value to array");d.array_[e-1].data=c;d.updateView();return a.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data}; -Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){b=a.getField("LIST",a);return Entry.variableContainer.getList(b).array_.length}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var d=a.getField("LIST",a),c=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b),c=Entry.getListRealIndex(c,d);if(!d.array_||isNaN(c)||c>d.array_.length)throw Error("can not insert value to array");return d.array_[c-1].data}; +Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){var d=a.getField("LIST",a);return Entry.variableContainer.getList(d).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.show_list=function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!0);return a.callReturn()}; +Entry.block.show_list=function(b,a){var d=a.getField("LIST",a);Entry.variableContainer.getList(d).setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_hide_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_hide_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hide_list=function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!1);return a.callReturn()}; +Entry.block.hide_list=function(b,a){var d=a.getField("LIST",a);Entry.variableContainer.getList(d).setVisible(!1);return a.callReturn()}; Blockly.Blocks.options_for_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField("");this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.VARIABLE_list_option_first,"FIRST"],[Lang.Blocks.VARIABLE_list_option_last,"LAST"],[Lang.Blocks.VARIABLE_list_option_random,"RANDOM"]]),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(b,a){b=a.getField("LIST",a);a=a.getStringValue("DATA",a);b=Entry.variableContainer.getList(b);if(!b)return!1;b=b.array_;for(var c=0,d=b.length;cb||0>d||b>c||d>c||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));b=c(Math.floor(b*a).toString(16));return"#"+d+e+b}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;b=Entry.Utils.hexToHsl(b);b.l+=a/100;b.l=Math.min(1,Math.max(0,b.l));return Entry.Utils.hslToHex(b)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; -Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; -Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; -Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; -Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; -Entry.Utils.addFilters=function(b,a){b=b.elem("defs");var c=b.elem("filter",{id:"entryTrashcanFilter_"+a});c.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});c.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});c=c.elem("feMerge");c.elem("feMergeNode",{"in":"offsetBlur"});c.elem("feMergeNode",{"in":"SourceGraphic"},c);c=b.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});c.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"});c.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});a=b.elem("filter",{id:"entryBlockHighlightFilter_"+a});a.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});a.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){b=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"});a=b.elem("g");for(var c=a.elem("rect",{x:0,y:0,width:125,height:33}),d=Entry.mediaFilePath+"block_pattern_(order).png",e=1;5>e;e++)a.elem("image",{class:"pattern"+e,href:d.replace("(order)",e),x:0,y:0,width:125,height:33});return{pattern:b,rect:c}}; -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&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, -!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var f=document.createElement("span");f.innerHTML="giItT1WQy@!-/#";f.style.position="absolute";f.style.left="-10000px";f.style.top="-10000px";f.style.fontSize="300px";f.style.fontFamily="sans-serif";f.style.fontVariant="normal";f.style.fontStyle="normal";f.style.fontWeight= -"normal";f.style.letterSpacing="0";document.body.appendChild(f);var k=f.offsetWidth;f.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Utils.hasSpecialCharacter=function(b){return/!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(b)};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(c){a.data[c]=b[c];Object.defineProperty(a,c,{get:function(){return a.data[c]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var c={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(c[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),c)};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 c=this;c.observers.map(function(d){var e=a;void 0!==d.attrs&&(e=Entry.Utils.intersectArray(d.attrs,a));if(e.length)d.object[d.funcName](e.map(function(a){return{name:a,object:c,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Observer=function(b,a,c,d){this.parent=b;this.object=a;this.funcName=c;this.attrs=d;b.push(this)};(function(b){b.destroy=function(){var a=this.parent,b=a.indexOf(this);-1b||0>c||b>e||c>e||a.splice.call(this,c,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1/,c;c=b instanceof HTMLElement?$(b):b instanceof jQuery?b:d.test(b)?$(b):$("<"+b+">");if(void 0===a)return c;a.id&&c.attr("id",a.id);a.class&&c.addClass(a.class);a.classes&&a.classes.map(function(a){c.addClass(a)});a.src&&c.attr("src",a.src);a.parent&&a.parent.append(c);c.bindOnClick=function(){var a,b,d=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.x+b.width+this.width?(this.object.x=b.x+b.width+ this.width/2,a+="e"):(this.object.x=b.x-this.width/2,a+="w");this.notch.type!=a&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(a),this.object.addChild(this.notch));this._isNoContentTried&&this.parent.setText("");Entry.requestUpdate=!0}; Entry.Dialog.prototype.createSpeakNotch=function(b){var a=new createjs.Shape;a.type=b;"ne"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0,this.height+this.padding-1.5).lt(-10,this.height+this.padding+20).lt(20,this.height+this.padding-1.5):"nw"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,this.height+this.padding-1.5).lt(this.width+10,this.height+this.padding+20).lt(this.width-20,this.height+this.padding-1.5):"se"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0, --this.padding+1.5).lt(-10,-this.padding-20).lt(20,-this.padding+1.5):"sw"==b&&a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,-this.padding+1.5).lt(this.width+10,-this.padding-20).lt(this.width-20,-this.padding+1.5);return a};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null;Entry.requestUpdate=!0};Entry.DoneProject=function(b){this.generateView(b)};var p=Entry.DoneProject.prototype;p.init=function(b){this.projectId=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerDoneWorkspace");this.doneContainer=a;var c=Entry.createElement("iframe");c.setAttribute("id","doneProjectframe");c.setAttribute("frameborder",0);c.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=c;this.doneContainer.appendChild(c);a.addClass("entryRemove")};p.getView=function(){return this.doneContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("doneProjectframe"),a=this.doneContainer.offsetWidth;b.width=a+"px";b.height=9*a/16+"px"};Entry.Engine=function(){function b(a){var b=a.keyCode||a.which,d=Entry.stage.inputField;32==b&&d&&d.hasFocus()||-1<[37,38,39,40,32].indexOf(b)&&a.preventDefault()}this.state="stop";this.popup=null;this.isUpdating=!0;this.speeds=[1,15,30,45,60];this._mouseMoved=!1;Entry.keyPressed&&Entry.keyPressed.attach(this,this.captureKeyEvent);Entry.addEventListener("canvasClick",function(a){Entry.engine.fireEvent("mouse_clicked")});Entry.addEventListener("canvasClickCanceled",function(a){Entry.engine.fireEvent("mouse_click_cancled")}); +-this.padding+1.5).lt(-10,-this.padding-20).lt(20,-this.padding+1.5):"sw"==b&&a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,-this.padding+1.5).lt(this.width+10,-this.padding-20).lt(this.width-20,-this.padding+1.5);return a};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null;Entry.requestUpdate=!0};Entry.DoneProject=function(b){this.generateView(b)};var p=Entry.DoneProject.prototype;p.init=function(b){this.projectId=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerDoneWorkspace");this.doneContainer=a;var d=Entry.createElement("iframe");d.setAttribute("id","doneProjectframe");d.setAttribute("frameborder",0);d.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=d;this.doneContainer.appendChild(d);a.addClass("entryRemove")};p.getView=function(){return this.doneContainer}; +p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("doneProjectframe"),a=this.doneContainer.offsetWidth;b.width=a+"px";b.height=9*a/16+"px"};Entry.Engine=function(){function b(a){var b=[37,38,39,40,32],c=a.keyCode||a.which,e=Entry.stage.inputField;32==c&&e&&e.hasFocus()||-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); -a=Math.floor((a.clientX-80)/(5*d)*5);0>a||4d;d++)(function(d){var c=Entry.createElement("td","progressCell"+d);c.bindOnClick(function(){Entry.engine.setSpeedMeter(a[d])});b.appendChild(c)})(d);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); +a=Math.floor((a.clientX-80)/(5*c)*5);0>a||4a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(b=!1;a&&Entry.engine.isContinue&&!b;){Entry.engine.isContinue=!a.isRepeat;var c=a.run();b=c&&c===a;a=c}return a};Entry.Engine.prototype.isState=function(b){return-1=a&&Entry.stage.moveSprite(b)}; +Entry.Engine.prototype.captureKeyEvent=function(b){var a=b.keyCode,d=Entry.type;b.ctrlKey&&"workspace"==d?83==a?(b.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==a?(b.preventDefault(),Entry.engine.run()):90==a&&(b.preventDefault(),Entry.dispatchEvent(b.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",a]);Entry.engine.isState("stop")&&"workspace"===d&&37<=a&&40>=a&&Entry.stage.moveSprite(b)}; Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=a.length;d=n?e=[1,0,0,0,0,0,m,f,0,0,0,-1*f,m,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=n?e=[m,0,f,0,0,0,1,0,0,0,f,0,m,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=n&&(e=[m,f,0,0,0,-1*f,m,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c})(c,d),d.cache(0, +Entry.EntityObject.prototype.applyFilter=function(b){function a(a,b){for(var d in a)if(a[d]!==b[d])return!1;return!0}var d=this.effect,c=this.object;if(b||!a(d,this.getInitialEffectValue()))(function(a,b){var d=[],c=Entry.adjustValueWithMaxMin;a.brightness=a.brightness;var k=new createjs.ColorMatrix;k.adjustColor(c(a.brightness,-100,100),0,0,0);k=new createjs.ColorMatrixFilter(k);d.push(k);a.hue=a.hue.mod(360);k=new createjs.ColorMatrix;k.adjustColor(0,0,0,a.hue);k=new createjs.ColorMatrixFilter(k); +d.push(k);var k=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],l=10.8*a.hsv*Math.PI/180,m=Math.cos(l),l=Math.sin(l),n=Math.abs(a.hsv/100);1=n?k=[1,0,0,0,0,0,m,l,0,0,0,-1*l,m,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=n?k=[m,0,l,0,0,0,1,0,0,0,l,0,m,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=n&&(k=[m,l,0,0,0,-1*l,m,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);d.push(k);b.alpha=a.alpha=c(a.alpha,0,1);b.filters=d})(d,c),c.cache(0, 0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0};Entry.EntityObject.prototype.resetFilter=function(){"sprite"==this.parent.objectType&&(this.object.filters=[],this.setInitialEffectValue(),this.object.alpha=this.effect.alpha,this.object.cache(0,0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.updateDialog=function(){this.dialog&&this.dialog.update();Entry.requestUpdate=!0}; Entry.EntityObject.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON();this.collision=Entry.Utils.COLLISION.NONE};Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture());Entry.requestUpdate=!0}; Entry.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var b=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(b,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; @@ -940,154 +883,83 @@ Entry.EntityObject.prototype.toJSON=function(){var b={};b.x=Entry.cutDecimal(thi this.parent.objectType&&(b.colour=this.getColour(),b.text=this.getText(),b.textAlign=this.getTextAlign(),b.lineBreak=this.getLineBreak(),b.bgColor=this.getBGColour(),b.underLine=this.getUnderLine(),b.strike=this.getStrike(),b.fontSize=this.getFontSize());return b};Entry.EntityObject.prototype.setInitialEffectValue=function(){this.effect=this.getInitialEffectValue();Entry.requestUpdate=!0}; Entry.EntityObject.prototype.getInitialEffectValue=function(){return{blur:0,hue:0,hsv:0,brightness:0,contrast:0,saturation:0,alpha:1}};Entry.EntityObject.prototype.removeBrush=function(){Entry.stage.selectedObjectContainer.removeChild(this.shape);this.shape=this.brush=null}; Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var b=this.getWidth(),a=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b/2,-a/2,b,a);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=b/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-b/2}}}; -Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var b=this.textObject;if(this.lineBreak){var a=b.getMeasuredLineHeight();b.y=a/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:b.x=0;break;case Entry.TEXT_ALIGN_LEFT:b.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:b.x=this.getWidth()/2}b.maxHeight=this.getHeight()}else b.x=0,b.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};Entry.generateFunctionSchema(this.id);if(b){b=this.content._blockMap;for(var a in b)Entry.Func.registerParamBlock(b[a].type);Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={}; -Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}};Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}}; -Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()};Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()}; -Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);b.recreateView();a.changeOverlayBoardCode(b);b.view.board.alignThreads();this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)};Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}}; -Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0;b=b.split(" ");var c="",d;d=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; -Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= -this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)a[c]= -b[c];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)delete a[c];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){b=this[b].elem("g");b.addClass("hwComponent");var c;c=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3});var e=b.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),f=b.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});f.textContent=a.name;f=f.getComputedTextLength(); -b.elem("rect").attr({x:f+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var g=b.elem("text").attr({x:f+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});g.textContent=0;f+=40;e.attr({width:f});return{group:b,value:g,type:a.type,path:c,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:f},width:f}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* -this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a;a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3-5,-27); -a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){var a;a=this._hwModule.monitorTemplate.listPorts;for(var b=a.length,d=0;db-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};b._movePort=function(a,b,d,e){var c=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(c=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+c+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster, -"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit,"12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1");var c=0,d=null,d=setInterval(function(){try{this._w.location.href}catch(n){this._bNotInstalled=!0}if(10(0"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:c};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; -b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); -b.contentDom.removeClass("entryRemove");b.obj.resize&&b.obj.resize();b.obj.visible=!0;this.selected=a};b.initializeSplitter=function(a){var b=this;a.bind("mousedown touchstart",function(a){b._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.clientX||a.x})}))});$(document).bind("mouseup touchend", -function(a){if(a=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(a),b._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;"tablet"=== -this.device?this.view_.setAttribute("class","entry tablet"):this.view_.setAttribute("class","entry");Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload= -this.beforeUnload;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); -Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3",Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting");Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()}; -Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), +Entry.EntryObject.prototype.addCloneEntity=function(b,a,d){this.clonedEntities.length>Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0=b&&0=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; +Entry.Painter.prototype.matchTolerance=function(b,a,d,c,e){var f=this.colorLayerData.data[b],g=this.colorLayerData.data[b+1];b=this.colorLayerData.data[b+2];return f>=a-e/100*a&&f<=a+e/100*a&&g>=d-e/100*d&&g<=d+e/100*d&&b>=c-e/100*c&&b<=c+e/100*c};Entry.Painter.prototype.matchColorOnly=function(b,a,d,c){return a===this.colorLayerData.data[b]&&d===this.colorLayerData.data[b+1]&&c===this.colorLayerData.data[b+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(b,a,d,c,e){return a===this.colorLayerData.data[b]&&d===this.colorLayerData.data[b+1]&&c===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,d,c,e){e||(e=255);this.stroke.transparent&&(e=c=d=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=d;this.colorLayerData.data[b+2]=c;this.colorLayerData.data[b+3]=e}; Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+d+'px "'+c+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; @@ -1146,49 +1018,49 @@ Entry.Painter.prototype.stagemousemove=function(b){"picture"==Entry.playground.g this.move_rect(b):"circle"===this.toolbox.selected?this.move_circle(b):"erase"===this.toolbox.selected&&this.move_erase(b)),this.painterTopStageXY.innerHTML="x:"+b.stageX.toFixed(1)+", y:"+b.stageY.toFixed(1))}; Entry.Painter.prototype.stagemouseup=function(b){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected?(this.selectArea.x1=this.oldPt.x,this.selectArea.y1=this.oldPt.y,this.selectArea.x2=b.stageX-this.oldPt.x,this.selectArea.y2=b.stageY-this.oldPt.y,this.stage.removeChild(this._handle),this.stage.update(),0this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var m=Entry.createElement("div");m.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(m);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});m.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){n.style.zIndex= -"1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dthis.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); +this.objectRotateInput.defaultValue="0";c.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var m=Entry.createElement("div");m.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(m);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +c=Entry.createElement("div","entryPainterAttrCircle");c.addClass("painterAttrCircle");this.attrCircleArea.appendChild(c);this.attrCircleArea.painterAttrCircle=c;c=Entry.createElement("input","entryPainterAttrCircleInput");c.value="#000000";c.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(c);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); +Entry.getColourCodes().forEach(function(b){var d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?d.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":d.style.backgroundColor=b;d.bindOnClick(function(d){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});m.appendChild(d)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);c=Entry.createElement("legend");c.addClass("painterAttrThickName");c.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(c); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);c=Entry.createElement("div");c.addClass("paintAttrThickTop");n.appendChild(c);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(c=1;10>=c;c++)d=Entry.createElement("option"),d.value=c,d.innerHTML=c,e.appendChild(d);n.appendChild(e); +c=Entry.createElement("div","entryPainterShapeLineColor");c.addClass("painterAttrShapeLineColor");d=Entry.createElement("div","entryPainterShapeInnerBackground");d.addClass("painterAttrShapeInnerBackground");c.appendChild(d);n.appendChild(c);this.attrThickArea.painterAttrShapeLineColor=c;n.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);c=Entry.createElement("fieldset","entryPainterAttrbackground");c.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(c);d=Entry.createElement("div");d.addClass("paintAttrBackgroundTop");c.appendChild(d);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;d.appendChild(q);var r=!1;q.bindOnClick(function(a){n.style.zIndex= +"1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);c=Entry.createElement("div");c.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(c);c=Entry.createElement("legend");c.addClass("panterAttrFontTitle");c.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", +"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(c=0;c=c;c++)d=Entry.createElement("option"),d.value=c,d.innerHTML=c,k.appendChild(d);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(c);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(c=0;c":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var d=0;d":h=b-c;break;case ">=":h=b+1-c}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var c=0;c >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.LogicalExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.LogicalOperator=function(){return["||","&&"]};b.MemberExpression=function(a){var b= -a.object,d=a.property;console.log(b.type);b=this[b.type](b);console.log(b);d=this[d.type](d,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=d;if(!b)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +a.object,c=a.property;console.log(b.type);b=this[b.type](b);console.log(b);c=this[c.type](c,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=c;if(!b)throw{message:c+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.CallExpression=function(a){a=a.callee;return{type:this[a.type](a)}};b.NewExpression=function(a){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:a};};b.SequenceExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; -(function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, -clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){1===c&&(a+="\n");return(-1=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Workspace=function(b){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var a=b.blockMenu;a&&(this.blockMenu=new Entry.BlockMenu(a.dom,a.align,a.categoryData,a.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(a=b.board)a.workspace=this,this.board=new Entry.Board(a),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); -if(a=b.vimBoard)this.vimBoard=new Entry.Vim(a.dom),this.vimBoard.workspace=this;this.board&&this.vimBoard&&this.vimBoard.hide();Entry.GlobalSvg.createDom();this.mode=Entry.Workspace.MODE_BOARD;Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl);this.changeEvent=new Entry.Event(this);Entry.commander.setCurrentEditor("board",this.board);this.textType=Entry.Vim.TEXT_TYPE_PY};Entry.Workspace.MODE_BOARD=0;Entry.Workspace.MODE_VIMBOARD=1;Entry.Workspace.MODE_OVERLAYBOARD=2; -(function(b){b.schema={selectedBlockView:null,selectedBoard:null};b.getBoard=function(){return this.board};b.getSelectedBoard=function(){return this.selectedBoard};b.getBlockMenu=function(){return this.blockMenu};b.getVimBoard=function(){return this.vimBoard};b.getMode=function(){return this.mode};b.setMode=function(a,b){"number"===typeof a?this.mode=a:(this.mode=a.boardType,this.runType=a.runType,this.textType=a.textType);switch(this.mode){case this.oldMode:return;case Entry.Workspace.MODE_VIMBOARD:try{this.board&& -this.board.hide(),this.overlayBoard&&this.overlayBoard.hide(),this.set({selectedBoard:this.vimBoard}),this.vimBoard.show(),this.codeToText(this.board.code,a),this.blockMenu.renderText(function(){this.blockMenu.reDraw()}.bind(this)),this.board.clear(),this.oldTextType=this.textType}catch(d){}break;case Entry.Workspace.MODE_BOARD:try{this.board.show(),this.set({selectedBoard:this.board}),this.textToCode(this.oldMode,this.oldTextType),this.vimBoard&&this.vimBoard.hide(),this.overlayBoard&&this.overlayBoard.hide(), -this.blockMenu.renderBlock(function(){this.blockMenu.reDraw()}.bind(this)),this.oldTextType=this.textType}catch(d){this.board&&this.board.hide(),this.set({selectedBoard:this.vimBoard}),this.mode=Entry.Workspace.MODE_VIMBOARD,this.oldTextType==Entry.Vim.PARSER_TYPE_JS_TO_BLOCK?(a.boardType=Entry.Workspace.MODE_VIMBOARD,a.textType=Entry.Vim.TEXT_TYPE_JS,a.runType=Entry.Vim.MAZE_MODE,this.oldTextType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK,Entry.dispatchEvent("changeMode",a),Ntry.dispatchEvent("textError", -a)):this.oldTextType==Entry.Vim.PARSER_TYPE_PY_TO_BLOCK&&(a.boardType=Entry.Workspace.MODE_VIMBOARD,a.textType=Entry.Vim.TEXT_TYPE_PY,a.runType=Entry.Vim.WORKSPACE_MODE,this.oldTextType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK,Entry.dispatchEvent("changeMode",a))}Entry.commander.setCurrentEditor("board",this.board);break;case Entry.Workspace.MODE_OVERLAYBOARD:this.overlayBoard||this.initOverlayBoard(),this.overlayBoard.show(),this.set({selectedBoard:this.overlayBoard}),Entry.commander.setCurrentEditor("board", -this.overlayBoard)}this.oldMode=this.mode;this.changeEvent.notify(b)};b.changeBoardCode=function(a){this._syncTextCode();this.board.changeCode(a);this.mode===Entry.Workspace.MODE_VIMBOARD&&this.codeToText(this.board.code)};b.changeOverlayBoardCode=function(a){this.overlayBoard&&this.overlayBoard.changeCode(a)};b.changeBlockMenuCode=function(a){this.blockMenu.changeCode(a)};b.textToCode=function(a,b){if(a==Entry.Workspace.MODE_VIMBOARD){var c=this;a=this.vimBoard.textToCode(b);b=this.board;var e=b.code; -e.load(a);e.createView(b);this.board.reDraw();setTimeout(function(){c.board.alignThreads()},0)}};b.codeToText=function(a,b){return this.vimBoard.codeToText(a,b)};b.getCodeToText=function(a){return this.vimBoard.getCodeToText(a)};b._setSelectedBlockView=function(){this.set({selectedBlockView:this.board.selectedBlockView||this.blockMenu.selectedBlockView||(this.overlayBoard?this.overlayBoard.selectedBlockView:null)})};b.initOverlayBoard=function(){this.overlayBoard=new Entry.Board({dom:this.board.view, -workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};b._keyboardControl=function(a){var b=a.keyCode||a.which,d=a.ctrlKey;if(!Entry.Utils.isInInput(a)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==b||46==b?(Entry.do("destroyBlock",e.block),a.preventDefault()):d&&(67==b?e.block.copyToClipboard():88==b&&(a=e.block,a.copyToClipboard(), -a.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==b&&(b=this.selectedBoard)&&b instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};b._handleChangeBoard=function(){var a=this.selectedBoard;a&&a.constructor===Entry.Board&&this.trashcan.setBoard(a)};b._syncTextCode=function(){if(this.mode===Entry.Workspace.MODE_VIMBOARD){var a=this.vimBoard.textToCode(this.textType),b=this.board,d=b.code;d.load(a);d.createView(b);this.board.alignThreads()}}; -b.addVimBoard=function(a){this.vimBoard||(this.vimBoard=new Entry.Vim(a),this.vimBoard.workspace=this,this.vimBoard.hide())}})(Entry.Workspace.prototype);Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var c={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return c;for(var d=0;d"+a[1], -b.addEventListener("click",function(){Entry.engine.toggleStop()}),this.view_.appendChild(b),this.curtainView_=b,Entry.pictureEditable&&(b=Entry.createElement("div","entryPicture"),b.addClass("entryPlaygroundPictureWorkspace"),b.addClass("entryRemove"),this.view_.appendChild(b),this.generatePictureView(b),this.pictureView_=b),b=Entry.createElement("div","entryText"),b.addClass("entryPlaygroundTextWorkspace"),b.addClass("entryRemove"),this.view_.appendChild(b),this.generateTextView(b),this.textView_= -b,Entry.soundEditable&&(b=Entry.createElement("div","entrySound"),b.addClass("entryPlaygroundSoundWorkspace"),b.addClass("entryRemove"),this.view_.appendChild(b),this.generateSoundView(b),this.soundView_=b),b=Entry.createElement("div","entryDefault"),b.addClass("entryPlaygroundDefaultWorkspace"),this.view_.appendChild(b),this.generateDefaultView(b),this.defaultView_=b,b=Entry.createElement("div","entryCode"),b.addClass("entryPlaygroundCodeWorkspace"),b.addClass("entryRemove"),this.view_.appendChild(b), -this.generateCodeView(b),this.codeView_=b,a=Entry.createElement("div"),a.addClass("entryPlaygroundResizeWorkspace","entryRemove"),this.resizeHandle_=a,this.view_.appendChild(a),this.initializeResizeHandle(a),this.codeView_=b,Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")}),Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")}))};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;b.appendChild(c);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");c.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", -"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= -Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); -Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= -this.mainWorkspace.board;Entry.hw&&this.updateHW()}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){a=b.item.data("start_pos");b=b.item.index();Entry.playground.movePicture(a,b)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter2(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"),a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}), -c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){a=b.item.data("start_pos");b=b.item.index();Entry.playground.movePicture(a,b)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:c})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; +(function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var c=acorn.parse(a),b=this._parser.Program(c)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, +clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,d){var c="";1===d&&(a+="\n");c=-1d+55)&&a>40+b*(g-d)&&(g=c.getNextScene())&&(g=$(g.view),$(document).trigger("mouseup"), -g.trigger("mousedown"))}),b=Entry.createElement("ul"),b.addClass("entrySceneListWorkspace"),Entry.sceneEditable&&$&&$(b).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){a=b.item.data("start_pos");b=b.item.index();Entry.scene.moveScene(a,b)},axis:"x",tolerance:"pointer"}),this.view_.appendChild(b),this.listView_=b,Entry.sceneEditable&&(b=Entry.createElement("span"),b.addClass("entrySceneElementWorkspace"),b.addClass("entrySceneAddButtonWorkspace"), -b.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(b),this.addButton_=b))}; -Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),10"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:c};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; +b.removeMode=function(a){this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));(a=Object.keys(this.modes))&&0c+55)&&a>40+b*(h-c)&&(h=d.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), +h.trigger("mousedown"))});var c=Entry.createElement("ul");c.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(c).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var d=b.item.data("start_pos"),c=b.item.index();Entry.scene.moveScene(d,c)},axis:"x",tolerance:"pointer"});this.view_.appendChild(c);this.listView_=c;Entry.sceneEditable&&(c=Entry.createElement("span"),c.addClass("entrySceneElementWorkspace"),c.addClass("entrySceneAddButtonWorkspace"), +c.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(c),this.addButton_=c)}}; +Entry.Scene.prototype.generateElement=function(b){var a=this,d=Entry.createElement("li",b.id);d.addClass("entrySceneElementWorkspace");d.addClass("entrySceneButtonWorkspace");d.addClass("minValue");$(d).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var c=Entry.createElement("input");c.addClass("entrySceneFieldWorkspace");c.value=b.name;Entry.sceneEditable||(c.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); +d.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);d.appendChild(f);b.inputWrapper=f;c.onkeyup=function(d){d=d.keyCode;Entry.isArrowOrBackspace(d)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==d&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),c=0;c=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),d=0;d=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; -Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"),$(d.inputWrapper).width(c)): -d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};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=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));c instanceof Entry.Script&& -(this.parentScript=c);b=b.childNodes;for(a=0;a"==a||"<"==a||">="==a||"<="==a||"+"==a||"-"==a||"*"==a||"/"==a?!0:!1};b.binaryOperatorConvert= -function(a){switch(a){case "==":a="EQUAL";break;case ">":a="GREATER";break;case "<":a="LESS";break;case ">=":a="GREATER_OR_EQUAL";break;case "<=":a="LESS_OR_EQUAL";break;case "+":a="PLUS";break;case "-":a="MINUS";break;case "*":a="MULTIFLY";break;case "/":a="DIVIDE"}return a};b.logicalExpressionConvert=function(a){switch(a){case "&&":a=null;break;case "||":a=null}return a};b.dropdownDynamicValueConvertor=function(a,b){var c=b.options,e;for(e in c){var f=c[e];if("null"==f[1])return c={};if("mouse"== -a||"wall"==a||"wall_up"==a||"wall_down"==a||"wall_right"==a||"wall_left"==a)return a;if(a==f[1])return console.log("dropdownDynamicValueConvertor value",a,f[1]),c=f[0]}c=a;if("variables"==b.menuName){var g=Entry.variableContainer.variables_,h;for(h in g){var k=g[h];if(k.id_==a){c=k.name_;break}}}else if("lists"==b.menuName)for(h in g=Entry.variableContainer.lists,g){if(k=g[h],k.id_==a){c=k.name_;break}}else if("pictures"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b=h[g],b=b.pictures, -b){if(e=b[k],e.id==a)return c=e.name}else if("sounds"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in b=h[g],b=b.sounds,b)if(e=b[k],e.id==a)return c=e.name;return c};b.binaryOperatorValueConvertor=function(a){switch(a){case "EQUAL":a="==";break;case "GREATER":a=">";break;case "LESS":a="<";break;case "GREATER_OR_EQUAL":a=">=";break;case "LESS_OR_EQUAL":a="<=";break;case "\uadf8\ub9ac\uace0":a="&&";break;case "\ub610\ub294":a="||";break;case "PLUS":a="+";break;case "MINUS":a="-";break; -case "MULTI":a="*";break;case "DIVIDE":a="/"}return a};b.variableFilter=function(a,b,d){var c=d;a=a.data.type;"change_variable"==a||"set_variable"==a||"get_variable"==a?1==b&&(c=eval(d)):"length_of_list"==a||"is_included_in_list"==a?2==b&&(c=eval(d)):"value_of_index_from_list"==a?2==b?c=eval(d):4==b&&this.isNumeric(d)&&(c=d-1):"remove_value_from_list"==a?2==b?c=eval(d):1==b&&this.isNumeric(d)&&(c=d-1):"insert_value_to_list"==a?2==b?c=eval(d):3==b&&this.isNumeric(d)&&(c=d-1):"change_value_list_index"== -a?1==b?c=eval(d):2==b&&this.isNumeric(d)&&(c=d-1):"add_value_to_list"==a&&2==b&&(c=eval(d));return c};b.isGlobalVariableExisted=function(a){var b=Entry.variableContainer.variables_,d;for(d in b){var e=b[d];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalVariable=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){variable={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,value:b,name:a,isCloud:f.isClud_};f.syncModel_(variable); -Entry.variableContainer.updateList();break}}};b.createGlobalVariable=function(a,b){this.isGlobalVariableExisted(a)||(Entry.variableContainer.addVariable({name:a,value:b,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariableExisted=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalVariable=function(a,b,d){var c=Entry.variableContainer.variables_,f;for(f in c){var g=c[f];if(g.object_=== -d.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,value:b,name:a,isCloud:g.isClud_});Entry.variableContainer.updateList();break}}};b.createLocalVariable=function(a,b,d){this.isLocalVariableExisted(a,d)||(Entry.variableContainer.addVariable({name:a,value:b,object:d.id,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariable=function(a){var b=Entry.playground.object,d=Entry.variableContainer.variables_,e;for(e in d){var f=d[e];if(f.object_==b.id&&f.id_== -a)return!0}return!1};b.isGlobalListExisted=function(a){var b=Entry.variableContainer.lists_,d;for(d in b){var e=b[d];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalList=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){list={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,name:a,isCloud:f.isClud_,width:f.width_,height:f.height_,array:b};f.syncModel_(list);f.updateView();Entry.variableContainer.updateList();break}}};b.createGlobalList= -function(a,b){this.isGlobalListExisted(a)||(Entry.variableContainer.addList({name:a,array:b,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalListExisted=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalList=function(a,b,d){var c=Entry.variableContainer.lists_,f;for(f in c){var g=c[f];if(g.object_===d.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,name:a,isCloud:g.isClud_, -width:g.width_,height:g.height_,array:b});g.updateView();Entry.variableContainer.updateList();break}}};b.createLocalList=function(a,b,d){this.isLocalListExisted(a,d)||(Entry.variableContainer.addList({name:a,array:b,object:d.id,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalList=function(a){var b=Entry.playground.object,d=Entry.variableContainer.lists_,e;for(e in d){var f=d[e];if(f.object_==b.id&&f.id_==a)return!0}return!1};b.isLocalType=function(a,b){if("get_variable"==a.data.type|| -"set_variable"==a.data.type||"change_variable"==a.data.type){if(this.isLocalVariable(b))return!0}else if(("value_of_index_from_list"==a.data.type||"add_value_to_list"==a.data.type||"remove_value_from_list"==a.data.type||"insert_value_to_list"==a.data.type||"change_value_list_index"==a.data.type||"length_of_list"==a.data.type||"is_included_in_list"==a.data.type)&&this.isLocalList(b))return!0};b.isEventBlock=function(a){a=a.data.type;return"when_run_button_click"==a||"when_some_key_pressed"==a||"mouse_clicked"== -a||"mouse_click_cancled"==a||"when_object_click"==a||"when_object_click_canceled"==a||"when_message_cast"==a||"when_scene_start"==a||"when_clone_start"==a?!0:!1};b.makeDefinition=function(a){var b=/(%.)/mi;a=Entry.block[a.data.type].syntax.py[0].split(b);for(var d="",e=0;e":b="BIGGER";break;case ">=":b="BIGGER_EQUAL";break;case "==":b="EQUAL";break;case "<":b="SMALLER"; -break;case "<=":b="SMALLER_EQUAL"}return b};b.radarVariableConvertor=function(a){return a.split("_")[1].toUpperCase()};b.tTobDropdownValueConvertor=function(a){return"stone"==a?"OBSTACLE":"wall"==a?a.toUpperCase():"item"==a?a.toUpperCase():a}})(Entry.TextCodingUtil.prototype);Entry.BlockToJsParser=function(b){this.syntax=b;this._iterVariableCount=0;this._iterVariableChunk=["i","j","k"]}; -(function(b){b.Code=function(a,b){this._parseMode=b;if(a instanceof Entry.Block)return this.Block(a);b="";a=a._data;for(var c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var d=b.length-1;0<=d;d--)Entry.container.addCloneObject(b[d],a.id)}}; +Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,d=b[0];if(0!==b.length&&d){var c=$(d.view).offset().left,d=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-c,f=0,g;for(g in b){var c=b[g],h=c.view;h.addClass("minValue");$(c.inputWrapper).width(Entry.computeInputWidth(c.name));h=$(h);f=f+h.width()+d}if(f>e)for(g in e-=$(a.view).width(),d=e/(b.length-1)-(Entry.Scene.viewBasicWidth+d),b)c=b[g],a.id!=c.id?(c.view.removeClass("minValue"),$(c.inputWrapper).width(d)): +c.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; +p.init=function(b,a,d){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+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));d instanceof Entry.Script&&(this.parentScript= +d);b=b.childNodes;for(a=0;a"==a||"<"==a||">="==a||"<="==a||"+"==a||"-"==a||"*"==a||"/"==a?!0:!1};b.binaryOperatorConvert= +function(a){switch(a){case "==":a="EQUAL";break;case ">":a="GREATER";break;case "<":a="LESS";break;case ">=":a="GREATER_OR_EQUAL";break;case "<=":a="LESS_OR_EQUAL";break;case "+":a="PLUS";break;case "-":a="MINUS";break;case "*":a="MULTIFLY";break;case "/":a="DIVIDE";break}return a};b.logicalExpressionConvert=function(a){switch(a){case "&&":a=null;break;case "||":a=null;break}return a};b.dropdownDynamicValueConvertor=function(a,b){var c=b.options,e=null,f;for(f in c){e=c[f];if("null"==e[1])return e= +{};if("mouse"==a||"wall"==a||"wall_up"==a||"wall_down"==a||"wall_right"==a||"wall_left"==a)return a;if(a==e[1])return console.log("dropdownDynamicValueConvertor value",a,e[1]),e=e[0]}e=a;if("variables"==b.menuName){var g=Entry.variableContainer.variables_,h;for(h in g){var k=g[h];if(k.id_==a){e=k.name_;break}}}else if("lists"==b.menuName)for(h in g=Entry.variableContainer.lists,g){if(k=g[h],k.id_==a){e=k.name_;break}}else if("pictures"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in c= +h[g],c=c.pictures,c){if(f=c[k],f.id==a)return e=f.name}else if("sounds"==b.menuName)for(g in h=Entry.container.getAllObjects(),h)for(k in c=h[g],c=c.sounds,c)if(f=c[k],f.id==a)return e=f.name;return e};b.binaryOperatorValueConvertor=function(a){switch(a){case "EQUAL":a="==";break;case "GREATER":a=">";break;case "LESS":a="<";break;case "GREATER_OR_EQUAL":a=">=";break;case "LESS_OR_EQUAL":a="<=";break;case "\uadf8\ub9ac\uace0":a="&&";break;case "\ub610\ub294":a="||";break;case "PLUS":a="+";break;case "MINUS":a= +"-";break;case "MULTI":a="*";break;case "DIVIDE":a="/";break}return a};b.variableFilter=function(a,b,c){var e=c;a=a.data.type;"change_variable"==a||"set_variable"==a||"get_variable"==a?1==b&&(e=eval(c)):"length_of_list"==a||"is_included_in_list"==a?2==b&&(e=eval(c)):"value_of_index_from_list"==a?2==b?e=eval(c):4==b&&this.isNumeric(c)&&(e=c-1):"remove_value_from_list"==a?2==b?e=eval(c):1==b&&this.isNumeric(c)&&(e=c-1):"insert_value_to_list"==a?2==b?e=eval(c):3==b&&this.isNumeric(c)&&(e=c-1):"change_value_list_index"== +a?1==b?e=eval(c):2==b&&this.isNumeric(c)&&(e=c-1):"add_value_to_list"==a&&2==b&&(e=eval(c));return e};b.isGlobalVariableExisted=function(a){var b=Entry.variableContainer.variables_,c;for(c in b){var e=b[c];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalVariable=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){variable={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,value:b,name:a,isCloud:f.isClud_};f.syncModel_(variable); +Entry.variableContainer.updateList();break}}};b.createGlobalVariable=function(a,b){this.isGlobalVariableExisted(a)||(Entry.variableContainer.addVariable({name:a,value:b,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariableExisted=function(a,b){var c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalVariable=function(a,b,c){var e=Entry.variableContainer.variables_,f;for(f in e){var g=e[f];if(g.object_=== +c.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,value:b,name:a,isCloud:g.isClud_});Entry.variableContainer.updateList();break}}};b.createLocalVariable=function(a,b,c){this.isLocalVariableExisted(a,c)||(Entry.variableContainer.addVariable({name:a,value:b,object:c.id,variableType:"variable"}),Entry.variableContainer.updateList())};b.isLocalVariable=function(a){var b=Entry.playground.object,c=Entry.variableContainer.variables_,e;for(e in c){var f=c[e];if(f.object_==b.id&&f.id_== +a)return!0}return!1};b.isGlobalListExisted=function(a){var b=Entry.variableContainer.lists_,c;for(c in b){var e=b[c];if(null===e.object_&&e.name_==a)return!0}return!1};b.updateGlobalList=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(null===f.object_&&f.name_==a){list={x:f.x_,y:f.y_,id:f.id_,visible:f.visible_,name:a,isCloud:f.isClud_,width:f.width_,height:f.height_,array:b};f.syncModel_(list);f.updateView();Entry.variableContainer.updateList();break}}};b.createGlobalList= +function(a,b){this.isGlobalListExisted(a)||(Entry.variableContainer.addList({name:a,array:b,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalListExisted=function(a,b){var c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_===b.id&&f.name_==a)return!0}return!1};b.updateLocalList=function(a,b,c){var e=Entry.variableContainer.lists_,f;for(f in e){var g=e[f];if(g.object_===c.id&&g.name_==a){g.syncModel_({x:g.x_,y:g.y_,id:g.id_,visible:g.visible_,name:a,isCloud:g.isClud_, +width:g.width_,height:g.height_,array:b});g.updateView();Entry.variableContainer.updateList();break}}};b.createLocalList=function(a,b,c){this.isLocalListExisted(a,c)||(Entry.variableContainer.addList({name:a,array:b,object:c.id,variableType:"list"}),Entry.variableContainer.updateList())};b.isLocalList=function(a){var b=Entry.playground.object,c=Entry.variableContainer.lists_,e;for(e in c){var f=c[e];if(f.object_==b.id&&f.id_==a)return!0}return!1};b.isLocalType=function(a,b){if("get_variable"==a.data.type|| +"set_variable"==a.data.type||"change_variable"==a.data.type){if(this.isLocalVariable(b))return!0}else if(("value_of_index_from_list"==a.data.type||"add_value_to_list"==a.data.type||"remove_value_from_list"==a.data.type||"insert_value_to_list"==a.data.type||"change_value_list_index"==a.data.type||"length_of_list"==a.data.type||"is_included_in_list"==a.data.type)&&this.isLocalList(b))return!0};b.isEventBlock=function(a){a=a.data.type;return"when_run_button_click"==a||"when_some_key_pressed"==a||"mouse_clicked"== +a||"mouse_click_cancled"==a||"when_object_click"==a||"when_object_click_canceled"==a||"when_message_cast"==a||"when_scene_start"==a||"when_clone_start"==a?!0:!1};b.makeDefinition=function(a){var b=/(%.)/mi;a=Entry.block[a.data.type].syntax.py[0].split(b);for(var c="",e=0;e":b="BIGGER";break;case ">=":b="BIGGER_EQUAL";break;case "==":b="EQUAL";break;case "<":b= +"SMALLER";break;case "<=":b="SMALLER_EQUAL"}return b};b.radarVariableConvertor=function(a){return a.split("_")[1].toUpperCase()};b.tTobDropdownValueConvertor=function(a){return"stone"==a?"OBSTACLE":"wall"==a?a.toUpperCase():"item"==a?a.toUpperCase():a}})(Entry.TextCodingUtil.prototype);Entry.BlockToJsParser=function(b){this.syntax=b;this._iterVariableCount=0;this._iterVariableChunk=["i","j","k"]}; +(function(b){b.Code=function(a,b){this._parseMode=b;if(a instanceof Entry.Block)return this.Block(a);for(var c="",e=a._data,f=0;f":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement= -function(a){var b=[];a=a.body;for(var d=0;d":h=b-c;break;case ">=":h=b+1-c}return this.BasicIteration(a,h,f)};b.BlockStatement= +function(a){var b=[];a=a.body;for(var c=0;c >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; -b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.BinaryExpression=function(a){var b,d={};b=String(a.operator);var e=a.left.name;switch(b){case "==":var f="object_up"==e||"object_right"==e||"object_down"==e?"ai_boolean_object":"radar_up"==e||"radar_right"==e||"radar_down"==e?"ai_boolean_distance": -null;break;case "<":f="ai_boolean_distance";break;case "<=":f="ai_boolean_distance";break;case ">":f="ai_boolean_distance";break;case ">=":f="ai_boolean_distance"}if(f){e=[];b=a.left;if("Literal"==b.type||"Identifier"==b.type){arguments=[];arguments.push(b);b=Entry.block[f].params;for(var g in b){var h=b[g].type;"Indicator"==h?(h={raw:null,type:"Literal",value:null},g>= >>>= ,= ^= &=".split(" ")};b.BinaryExpression=function(a){var b={},c={},b=String(a.operator),e=a.left.name;switch(b){case "==":var f="object_up"==e||"object_right"==e||"object_down"==e?"ai_boolean_object":"radar_up"==e||"radar_right"==e||"radar_down"==e?"ai_boolean_distance": +null;break;case "<":f="ai_boolean_distance";break;case "<=":f="ai_boolean_distance";break;case ">":f="ai_boolean_distance";break;case ">=":f="ai_boolean_distance"}if(f){e=[];b=a.left;if("Literal"==b.type||"Identifier"==b.type){arguments=[];arguments.push(b);var b=Entry.block[f].params,g;for(g in b){var h=b[g].type;"Indicator"==h?(h={raw:null,type:"Literal",value:null},g":f="(%1 %2boolean_compare# %3)";break;case ">=":f= +b);return b};b.ForStatement=function(a){console.log("ForStatement component",a);var b={statements:[]},c=this.getBlockType("for i in range");b.type=c;if(c=a.init)var e=this[c.type](c);b.init=e;console.log("ForStatement init",c);e=a.body.body;console.log("ForStatement bodies",e);if(e)for(var f in e)0!=f&&(c=e[f],console.log("ForStatement bodyData",c,"index",f),c=this[c.type](c),console.log("ForStatement bodyData result",c,"index",f),b.statements.push(c));console.log("ForStatement bodyData result",b); +if(f=a.test)var g=this[f.type](f);b.test=g;console.log("ForStatement testData",g);if(a=a.update)var h=this[a.type](a);b.update=h;console.log("ForStatement updateData",h);console.log("ForStatement result",b);return b};b.ForInStatement=function(a){console.log("ForInStatement component",a);a=null;console.log("ForInStatement result",a);return a};b.BreakStatement=function(a){console.log("BreakStatement component",a);a={};var b=this.getBlockType("break");console.log("BreakStatement type",b);a.type=b;console.log("BreakStatement result", +a);return a};b.UnaryExpression=function(a){console.log("UnaryExpression component",a);var b;a.prefix&&(b=a.operator,a=a.argument,console.log("UnaryExpression operator",b),a.value=+b.concat(a.value),b=this[a.type](a),console.log("UnaryExpression data",b));a=b;console.log("UnaryExpression result",a);return a};b.LogicalExpression=function(a){console.log("LogicalExpression component",a);var b;b={};var c=String(a.operator);switch(c){case "&&":var e="(%1 and %3)";break;case "||":e="(%1 or %3)";break;default:e= +"(%1 and %3)"}var e=this.getBlockType(e),f=[],c=a.left;if("Literal"==c.type||"Identifier"==c.type){arguments=[];arguments.push(c);var c=Entry.block[e].params,g=Entry.block[e].def.params;console.log("LogicalExpression paramsMeta",c);console.log("LogicalExpression paramsDefMeta",g);for(var h in c){var k=c[h].type;"Indicator"==k?(k={raw:null,type:"Literal",value:null},h":f="(%1 %2boolean_compare# %3)";break;case ">=":f= "(%1 %2boolean_compare# %3)";break;case "+":f="(%1 %2calc_basic# %3)";break;case "-":f="(%1 %2calc_basic# %3)";break;case "*":f="(%1 %2calc_basic# %3)";break;case "/":f="(%1 %2calc_basic# %3)"}console.log("BinaryExpression operator",e);console.log("BinaryExpression syntax",f);if(f=this.getBlockType(f)){console.log("BinaryExpression type",f);b=[];e=a.left;console.log("BinaryExpression left",e);if("Literal"==e.type||"Identifier"==e.type){arguments=[];arguments.push(e);var e=Entry.block[f].params,g= Entry.block[f].def.params;console.log("BinaryExpression paramsMeta",e);console.log("BinaryExpression paramsDefMeta",g);for(var h in e){var k=e[h].type;"Indicator"==k?(k={raw:null,type:"Literal",value:null},h=b.keyCode||167==b.keyCode||190==b.keyCode)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});break;case "blockJs":this._parser=new Entry.BlockToJsParser(this.syntax);d=this.syntax;break;case "blockPy":this._parser= -new Entry.BlockToPyParser(this.syntax),d=this.syntax}}; -(function(b){b.setParser=function(a,b,d){this._mode=a;this._type=b;this._cm=d;this.syntax=this.mappingSyntax(a);switch(b){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:this._parser=new Entry.JsToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:this._parser=new Entry.PyToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:this._parser=new Entry.BlockToJsParser(this.syntax); -a=this.syntax;var c={},f;for(f in a.Scope)c[f+"();\n"]=a.Scope[f];d.on("keydown",function(a,b){var d=b.keyCode;(65<=d&&95>=d||167==d||!b.shiftKey&&190==d)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:c})});this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:this._parser=new Entry.BlockToPyParser(this.syntax),d.setOption("mode",{name:"python",globalVars:!0}),d.markText({line:0,ch:0},{line:5},{readOnly:!0}),this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY}}; -b.parse=function(a,b){var c=null;switch(this._type){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:try{var e=[];e.push(a);var f=[],g;for(g in e){var h=e[g],h=h.trim(),k=acorn.parse(h);f.push(k)}c=this._parser.Program(f)}catch(q){if(this.codeMirror){q instanceof SyntaxError?(a={from:{line:q.loc.line-1,ch:0},to:{line:q.loc.line-1,ch:q.loc.column}},q.message="\ubb38\ubc95(Syntax) \uc624\ub958\uc785\ub2c8\ub2e4.",q.type=1):(a=this.getLineNumber(q.node.start,q.node.end),a.message=q.message,a.severity="converting error", -q.type=2);this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a,clearOnEnter:!0});a=q.title?q.title:"\ubb38\ubc95 \uc624\ub958";if(2==q.type&&q.message)var l=q.message;else 2!=q.type||q.message?1==q.type&&(l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694."):l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694.";Entry.toast.alert(a,l);l={};l.boardType=Entry.Workspace.MODE_BOARD; +this[e.type](e))&&b.push(m);console.log("BinaryExpression right param",m);c.type=f;c.params=b}else return b;console.log("BinaryExpression params",b);b=c;console.log("BinaryExpression result",b);return b};b.UpdateExpression=function(a){console.log("UpdateExpression",a);var b={},c=a.argument;if(c)var e=this[c.type](c);b.argument=e;b.operator=a.operator;b.prefix=a.prefix;console.log("UpdateExpression result",b);return b};b.AssignmentExpression=function(a){console.log("AssignmentExpression component", +a);var b={},c,e=[],f,g=a.left;g.type&&(f=this[g.type](g),console.log("AssignmentExpression leftData",f));console.log("AssignmentExpression leftData",f);b.left=f;operator=String(a.operator);console.log("AssignmentExpression operator",operator);g=a.right;if(g.type){var h=this[g.type](g);console.log("AssignmentExpression rightData",h)}b.right=h;switch(operator){case "=":if(h.callee&&h.callee.object)var k=h.callee.object.object.name.concat(".").concat(h.callee.object.property.name).concat(".").concat(h.callee.property.name); +if("__pythonRuntime.objects.list"==k&&"self"==f.object.name){var l=f.property.name;c=[];var arguments=h.arguments,m;for(m in arguments){var n={};n.data=String(arguments[m].params[0]);c.push(n)}n=Entry.playground.object;Entry.TextCodingUtil.prototype.isLocalListExisted(l,n)?Entry.TextCodingUtil.prototype.updateLocalList(l,c,n):Entry.TextCodingUtil.prototype.createLocalList(l,c,n)}if(f.property&&"__pythonRuntime.ops.subscriptIndex"==f.property.callee)var l="%1[%2] = %3",q=this.getBlockType(l);else g.arguments&& +g.arguments[0]?(c=a.left.name?a.left.name:a.left.object.name.concat(a.left.property.name),l=a.right.arguments[0].name?a.right.arguments[0].name:a.right.arguments[0].object.name.concat(a.right.arguments[0].property.name),console.log("AssignmentExpression leftEx",c,"rightEx",l),l=a.right.arguments&&c==l?"%1 += %2":"%1 = %2"):l="%1 = %2",q=this.getBlockType(l);c=q}if(operator)var r=Entry.TextCodingUtil.prototype.logicalExpressionConvert(operator);b.operator=r;console.log("AssignmentExpression syntax", +l);f.object?n=f.object:f.name&&(n=f.name);if(f.proprty)var t=f.property;else f.name&&(t=f.name);console.log("AssignmentExpression object property value",n,t);if("%1[%2] = %3"==l){n=Entry.block[q];k=n.params;r=n.def.params;t=f.params[1];console.log("AssignmentExpression listName",t);if(!t)return b;e.push(t);f=f.property.arguments[0];console.log("AssignmentExpression param 1",f);console.log("AssignmentExpression param 2",f);e.push(f);e.push(h)}else if("%1 = %2"==l)console.log("AssignmentExpression calleeName check", +k),n&&"self"==n.name&&"__pythonRuntime.objects.list"!=k?(n=Entry.block[q],k=n.params,r=n.def.params,l=t.name,(f="number"==h.type||"text"==h.type?h.params[0]:NaN)&&NaN!=f&&(n=Entry.playground.object,console.log("final value",f),console.log("final object",n),Entry.TextCodingUtil.prototype.isLocalVariableExisted(l,n)?Entry.TextCodingUtil.prototype.updateLocalVariable(l,f,n):Entry.TextCodingUtil.prototype.createLocalVariable(l,f,n)),l=this.ParamDropdownDynamic(l,k[0],r[0]),e.push(l)):(n=Entry.block[q], +k=n.params,r=n.def.params,console.log("property 123",t),l=t,(f="number"==h.type||"text"==h.type?h.params[0]:NaN)&&NaN!=f&&(n=Entry.playground.object,console.log("final object",n),console.log("final value",f),Entry.TextCodingUtil.prototype.isGlobalVariableExisted(l,n)?Entry.TextCodingUtil.prototype.updateGlobalVariable(l,f,n):Entry.TextCodingUtil.prototype.createGlobalVariable(l,f,n)),l=this.ParamDropdownDynamic(l,k[0],r[0]),e.push(l),h.callee&&delete h.callee),e.push(h);else if("%1 += %2"==l){if(n&& +"self"==n.name){if(n=Entry.block[q],k=n.params,r=n.def.params,l=t.name,n=Entry.playground.object,console.log("final object",n),!Entry.TextCodingUtil.prototype.isLocalVariableExisted(l,n))return b}else if(n=Entry.block[q],k=n.params,r=n.def.params,l=t,!Entry.TextCodingUtil.prototype.isGlobalVariableExisted(l))return b;l=this.ParamDropdownDynamic(l,k[0],r[0]);e.push(l);e.push(h.params[2])}b.type=c;b.params=e;console.log("AssignmentExpression result",b);return b};b.FunctionDeclaration=function(a){console.log("FunctionDeclaration component", +a);var b={},c=a.body;a=a.id;if("__getParam0"==a.name)return b;var e=this[c.type](c);console.log("FunctionDeclaration bodyData",e);if("Identifier"==a.type)var f=this[a.type](a);console.log("FunctionDeclaration idData",f);c=[];a=[];var f=f.name,e=e.data,g;for(g in e)if(e[g].declarations){var h=e[g].declarations;0=b.keyCode||167==b.keyCode||190==b.keyCode)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});break;case "blockJs":this._parser=new Entry.BlockToJsParser(this.syntax);c=this.syntax;break;case "blockPy":this._parser= +new Entry.BlockToPyParser(this.syntax),c=this.syntax}}; +(function(b){b.setParser=function(a,b,c){this._mode=a;this._type=b;this._cm=c;this.syntax=this.mappingSyntax(a);switch(b){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:this._parser=new Entry.JsToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:this._parser=new Entry.PyToBlockParser(this.syntax);this._parserType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:this._parser=new Entry.BlockToJsParser(this.syntax); +a=this.syntax;var e={},f;for(f in a.Scope)e[f+"();\n"]=a.Scope[f];c.on("keydown",function(a,b){var d=b.keyCode;(65<=d&&95>=d||167==d||!b.shiftKey&&190==d)&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:e})});this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK;break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:this._parser=new Entry.BlockToPyParser(this.syntax),c.setOption("mode",{name:"python",globalVars:!0}),c.markText({line:0,ch:0},{line:5},{readOnly:!0}),this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY}}; +b.parse=function(a,b){var c=null;switch(this._type){case Entry.Vim.PARSER_TYPE_JS_TO_BLOCK:try{var e=[];e.push(a);var f=[],g;for(g in e){var h=e[g],h=h.trim(),k=acorn.parse(h);f.push(k)}c=this._parser.Program(f)}catch(q){if(this.codeMirror){q instanceof SyntaxError?(c={from:{line:q.loc.line-1,ch:0},to:{line:q.loc.line-1,ch:q.loc.column}},q.message="\ubb38\ubc95(Syntax) \uc624\ub958\uc785\ub2c8\ub2e4.",q.type=1):(c=this.getLineNumber(q.node.start,q.node.end),c.message=q.message,c.severity="converting error", +q.type=2);this.codeMirror.markText(c.from,c.to,{className:"CodeMirror-lint-mark-error",__annotation:c,clearOnEnter:!0});c=q.title?q.title:"\ubb38\ubc95 \uc624\ub958";if(2==q.type&&q.message)var l=q.message;else 2!=q.type||q.message?1==q.type&&(l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694."):l="\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694.";Entry.toast.alert(c,l);l={};l.boardType=Entry.Workspace.MODE_BOARD; l.textType=Entry.Vim.TEXT_TYPE_JS;l.runType=Entry.Vim.MAZE_MODE;Ntry.dispatchEvent("textError",l);throw q;}c=[]}break;case Entry.Vim.PARSER_TYPE_PY_TO_BLOCK:try{var m=new Entry.PyAstGenerator,e=a.split("\n\n"),n;for(n in e)h=e[n],-1!=h.search("import")?e[n]="":(h=Entry.TextCodingUtil.prototype.entryEventFuncFilter(h),e[n]=h);f=[];for(g in e)h=e[g],k=m.generate(h),"Program"==k.type&&0!=k.body.length&&f.push(k);c=this._parser.Program(f);this._parser._variableMap.clear()}catch(q){if(this.codeMirror)throw q instanceof -SyntaxError?(a={from:{line:q.loc.line-1,ch:q.loc.column-2},to:{line:q.loc.line-1,ch:q.loc.column+1}},q.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(q.node.start,q.node.end),a.message=q.message,a.severity="error"),l=parseInt(a.to.line)+1,a.from.line=l-1,a.to.line=l,this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a,clearOnEnter:!0}),a=q.title?q.title:"\ubb38\ubc95 \uc624\ub958",l=q.message&&l?q.message+" (line: "+l+")":"\ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \ud655\uc778\ud574\uc8fc\uc138\uc694", -Entry.toast.alert(a,l),q;c=[]}break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_JS:c=l=this._parser.Code(a,b);break;case Entry.Vim.PARSER_TYPE_BLOCK_TO_PY:l=this._parser.Code(a,b),this._pyHinter||(this._pyHinter=new Entry.PyHint),c=l}return c};b.getLineNumber=function(a,b){var c=this.codeMirror.getValue(),e={from:{},to:{}};a=c.substring(0,a).split(/\n/gi);e.from.line=a.length-1;e.from.ch=a[a.length-1].length;b=c.substring(0,b).split(/\n/gi);e.to.line=b.length-1;e.to.ch=b[b.length-1].length;return e};b.mappingSyntax= -function(a){for(var b=Object.keys(Entry.block),d={},e=0;e":b=a.operator;break;case ">=":b=a.operator;break;case "<<":b=a.operator;break;case ">>":b=a.operator;break;case ">>>":b=a.operator;break;case "+":b=a.operator;break;case "-":b=a.operator;break;case "*":b=a.operator;break;case "/":b=a.operator;break;case "%":b=a.operator;break;case "|":b=a.operator;break;case "^":b=a.operator;break;case "|":b=a.operator;break; -case "&":b=a.operator;break;case "in":b=a.operator;break;case "instanceof":b=a.operator;break;default:b=null}var d=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b,left:d,right:e}};b.AssignmentExpression=function(a){console.log("AssignmentExpression",a);var b;switch(a.operator){case "=":b=a.operator;break;case "+=":b=a.operator;break;case "-=":b=a.operator;break;case "*=":b=a.operator;break;case "/=":b=a.operator;break;case "%=":b=a.operator;break;case "<<=":b= -a.operator;break;case ">>=":b=a.operator;break;case "|=":b=a.operator;break;case "^=":b=a.operator;break;case "&=":b=a.operator;break;default:b=null}var d;d=a.left;var e=this[a.right.type](a.right);return{type:a.type,operator:b,left:d,right:e}};b.LogicalExpression=function(a){console.log("LogicalExpression",a);var b;switch(a.operator){case "||":b=a.operator;break;case "&&":b=a.operator;break;default:b=null}var d=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b, -left:d,right:e}};b.MemberExpression=function(a){console.log("MemberExpression",a);var b=this[a.object.type](a.object),d=this[a.property.type](a.property),e=a.computed;console.log("object",b);console.log("property",d);return{type:a.type,object:b,property:d,computed:e}};b.ConditionalExpression=function(a){console.log("ConditionalExpression",a);var b=this[a.callee.type](a.callee),d;for(d in a.arguments){var e=a.arguments[d],e=this[e.type](e);(void 0).push(e)}return{type:a.type,callee:b,arguments:void 0}}; -b.CallExpression=function(a){console.log("CallExpression",a);var b=this[a.callee.type](a.callee),d=[],e;for(e in a.arguments){var f=a.arguments[e],f=this[f.type](f);d.push(f)}console.log("callee",b);console.log("arguments",d);return{type:a.type,callee:b,arguments:d}};b.NewExpression=function(a){console.log("NewExpression",a);return{type:a.type}};b.SequenceExpression=function(a){console.log("SequenceExpression",a);for(var b in a.expressions){var d=a.expressions[b],d=this[d.type](d);(void 0).push(d)}return{type:a.type, +case "&":b=a.operator;break;case "in":b=a.operator;break;case "instanceof":b=a.operator;break;default:b=null}var c=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b,left:c,right:e}};b.AssignmentExpression=function(a){console.log("AssignmentExpression",a);var b;switch(a.operator){case "=":b=a.operator;break;case "+=":b=a.operator;break;case "-=":b=a.operator;break;case "*=":b=a.operator;break;case "/=":b=a.operator;break;case "%=":b=a.operator;break;case "<<=":b= +a.operator;break;case ">>=":b=a.operator;break;case "|=":b=a.operator;break;case "^=":b=a.operator;break;case "&=":b=a.operator;break;default:b=null}var c;c=a.left;var e=this[a.right.type](a.right);return{type:a.type,operator:b,left:c,right:e}};b.LogicalExpression=function(a){console.log("LogicalExpression",a);var b;switch(a.operator){case "||":b=a.operator;break;case "&&":b=a.operator;break;default:b=null}var c=this[a.left.type](a.left),e=this[a.right.type](a.right);return{type:a.type,operator:b, +left:c,right:e}};b.MemberExpression=function(a){console.log("MemberExpression",a);var b=this[a.object.type](a.object),c=this[a.property.type](a.property),e=a.computed;console.log("object",b);console.log("property",c);return{type:a.type,object:b,property:c,computed:e}};b.ConditionalExpression=function(a){console.log("ConditionalExpression",a);var b=this[a.callee.type](a.callee),c;for(c in a.arguments){var e=a.arguments[c],e=this[e.type](e);(void 0).push(e)}return{type:a.type,callee:b,arguments:void 0}}; +b.CallExpression=function(a){console.log("CallExpression",a);var b=this[a.callee.type](a.callee),c=[],e;for(e in a.arguments){var f=a.arguments[e],f=this[f.type](f);c.push(f)}console.log("callee",b);console.log("arguments",c);return{type:a.type,callee:b,arguments:c}};b.NewExpression=function(a){console.log("NewExpression",a);return{type:a.type}};b.SequenceExpression=function(a){console.log("SequenceExpression",a);for(var b in a.expressions){var c=a.expressions[b],c=this[c.type](c);(void 0).push(c)}return{type:a.type, expressions:void 0}}})(Entry.PyToBlockParserTemp.prototype);Entry.Toast=function(){this.toasts_=[];var b=document.getElementById("entryToastContainer");b&&document.body.removeChild(b);this.body_=Entry.createElement("div","entryToastContainer");this.body_.addClass("entryToastContainer");document.body.appendChild(this.body_)}; -Entry.Toast.prototype.warning=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastWarning");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(b){b.visible=!1;b._hideEvent=null;b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(a){a.stopPropagation()});Entry.Utils.disableContextmenu(this.dom)};b.show=function(a,b,d){this._hideEvent=Entry.documentMousedown.attach(this,function(){this.hide()});this.dom||this.createDom();if(0!==a.length){var c=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var f=this.dom;f.empty();for(var g=0,h=a.length;g< -h;g++){var k=a[g],l=k.text,m=!1!==k.enable,n=Entry.Dom("li",{parent:f});if(k.divider)b="divider";else{b=m?"menuAble":"menuDisable";var q=Entry.Dom("span",{parent:n});q.text(l);m&&k.callback&&function(a,b){a.mousedown(function(a){a.preventDefault();c.hide();b(a)})}(q,k.callback)}n.addClass(b)}f.removeClass("entryRemove");this.visible=!0;this.position(d||Entry.mouseCoordinate)}};b.position=function(a){var b=this.dom;b.css({left:0,top:0});var d=b.width(),e=b.height(),f=$(window),g=f.width(),f=f.height(); -a.x+d>g&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className);this._hideEvent&&(Entry.documentMousedown.detach(this._hideEvent),this._hideEvent=null)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0,loaded:!1};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(this.totalCount=0,this.handleLoad())};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Loader.isLoaded=function(){return!this.queueCount&&!this.totalCount}; -Entry.Loader.handleLoad=function(){this.loaded||(this.loaded=!0,Entry.dispatchEvent("loadComplete"))};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;this._valueWidth=this._nameWidth=null;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type?(this.setMinValue(b.minValue),this.setMaxValue(b.maxValue)):"list"==this.type&&(this.array_=b.array? +Entry.Toast.prototype.warning=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastWarning");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= +1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.removeElement(c));c.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastSuccess");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= +1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.removeElement(c));c.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(b,a,d){var c=Entry.createElement("div","entryToast");c.addClass("entryToast");c.addClass("entryToastAlert");c.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;c.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;c.appendChild(b);this.toasts_.push(c);this.body_.appendChild(c);d||window.setTimeout(function(){c.style.opacity= +1;var a=setInterval(function(){.05>c.style.opacity&&(clearInterval(a),c.style.display="none",Entry.toast.body_.removeChild(c));c.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; +(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var c={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return c;for(var e=0;eg&&(a.x-=c+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className);this._hideEvent&&(Entry.documentMousedown.detach(this._hideEvent),this._hideEvent=null)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0,loaded:!1};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(this.totalCount=0,this.handleLoad())};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Loader.isLoaded=function(){return!this.queueCount&&!this.totalCount}; +Entry.Loader.handleLoad=function(){this.loaded||(this.loaded=!0,Entry.dispatchEvent("loadComplete"))};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3,COMMAND_TYPES:{addThread:101,destroyThread:102,destroyBlock:103,recoverBlock:104,insertBlock:105,separateBlock:106,moveBlock:107,cloneBlock:108,uncloneBlock:109,scrollBoard:110,setFieldValue:111,selectObject:201,"do":301,undo:302,redo:303,editPicture:401, +uneditPicture:402,processPicture:403,unprocessPicture:404}};Entry.Command={};(function(b){b.do={type:Entry.STATIC.COMMAND_TYPES["do"],log:function(a){return[b["do"].type]}};b.undo={type:Entry.STATIC.COMMAND_TYPES.undo,log:function(a){return[b.undo.type]}};b.redo={type:Entry.STATIC.COMMAND_TYPES.redo,log:function(a){return[b.redo.type]}}})(Entry.Command);Entry.Commander=function(b){if("workspace"==b||"phone"==b)Entry.stateManager=new Entry.StateManager;Entry.do=this.do.bind(this);Entry.undo=this.undo.bind(this);this.editor={};this.reporters=[];this._tempStorage=null;Entry.Command.editor=this.editor}; +(function(b){b.do=function(a){var b=this,c=Array.prototype.slice.call(arguments);c.shift();var e=Entry.Command[a];Entry.stateManager&&Entry.stateManager.addCommand.apply(Entry.stateManager,[a,this,this.do,e.undo].concat(e.state.apply(this,c)));e=Entry.Command[a].do.apply(this,c);setTimeout(function(){b.report("do");b.report(a,c)},0);return{value:e,isPass:this.isPass.bind(this)}};b.undo=function(){var a=Array.prototype.slice.call(arguments),b=a.shift(),c=Entry.Command[b];this.report("undo");Entry.stateManager&& +Entry.stateManager.addCommand.apply(Entry.stateManager,[b,this,this.do,c.undo].concat(c.state.apply(this,a)));return{value:Entry.Command[b].do.apply(this,a),isPass:this.isPass.bind(this)}};b.redo=function(){var a=Array.prototype.slice.call(arguments),b=a.shift(),c=Entry.Command[b];that.report("redo");Entry.stateManager&&Entry.stateManager.addCommand.apply(Entry.stateManager,[b,this,this.undo,b].concat(c.state.apply(null,a)));c.undo.apply(this,a)};b.setCurrentEditor=function(a,b){this.editor[a]=b}; +b.isPass=function(a){a=void 0===a?!0:a;if(Entry.stateManager){var b=Entry.stateManager.getLastCommand();b&&(b.isPass=a)}};b.addReporter=function(a){this.reporters.push(a)};b.removeReporter=function(a){a=this.reporters.indexOf(a);-1=a.x&&e-d<=a.y&&e+b.height+d>=a.y}; +Entry.Utils.colorDarken=function(b,a){function d(a){2!=a.length&&(a="0"+a);return a}var c,e,f;7===b.length?(c=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(c=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;c=d(Math.floor(c*a).toString(16));e=d(Math.floor(e*a).toString(16));f=d(Math.floor(f*a).toString(16));return"#"+c+e+f}; +Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var d=Entry.Utils.hexToHsl(b);d.l+=a/100;d.l=Math.min(1,Math.max(0,d.l));return Entry.Utils.hslToHex(d)};Entry.Utils.bound01=function(b,a){var d=b;"string"==typeof d&&-1!=d.indexOf(".")&&1===parseFloat(d)&&(b="100%");d="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));d&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; +Entry.Utils.hexToHsl=function(b){var a,d;7===b.length?(a=parseInt(b.substr(1,2),16),d=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),d=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);d=Entry.Utils.bound01(d,255);b=Entry.Utils.bound01(b,255);var c=Math.max(a,d,b),e=Math.min(a,d,b),f,g=(c+e)/2;if(c==e)f=e=0;else{var h=c-e,e=.5d&&(d+=1);1d?b:d<2/3?a+(b-a)*(2/3-d)*6:a}function d(a){return 1==a.length?"0"+a:""+a}var c,e;e=Entry.Utils.bound01(b.h,360);c=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===c)c=b=e=b;else{var f=.5>b?b*(1+c):b+c-b*c,g=2*b-f;c=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[d(Math.round(255*c).toString(16)),d(Math.round(b).toString(16)),d(Math.round(e).toString(16))].join("")}; +Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; +Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var d=0,c=this.events_[b].length;d=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; +Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,d){return"#"+(16777216+(b<<16)+(a<<8)+d).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,d){return b>d?d:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},d;for(d in b)a[d]=b[d];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),d=-1,c=b.length;++d!==c;a[d]=b[d]);return a}; +Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],d=0;dc&&(c=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,d){setTimeout(function(){b.addEventListener(a,d)},0)};Entry.deAttachEventListener=function(b,a,d){b.removeEventListener(a,d)}; +Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function d(){}d.prototype=b.prototype;a.prototype=new d;return a}; +Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; +Entry.Utils.addFilters=function(b,a){var d=b.elem("defs"),c=d.elem("filter",{id:"entryTrashcanFilter_"+a});c.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});c.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});c=c.elem("feMerge");c.elem("feMergeNode",{"in":"offsetBlur"});c.elem("feMergeNode",{"in":"SourceGraphic"},c);c=d.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});c.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"});c.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});d=d.elem("filter",{id:"entryBlockHighlightFilter_"+a});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});d.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 d=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"}),c=d.elem("g"),e=c.elem("rect",{x:0,y:0,width:125,height:33}),f=Entry.mediaFilePath+"block_pattern_(order).png",g=1;5>g;g++)c.elem("image",{class:"pattern"+g,href:f.replace("(order)",g),x:0,y:0,width:125,height:33});return{pattern:d,rect:e}}; +Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var d=document.createEvent("MouseEvent");d.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return d};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var d in b){var c=b[d];if(c.tagName){var e={category:c.getAttribute("id"),blocks:[]},c=c.childNodes;for(d in c){var f=c[d];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; +Entry.Utils.stopProjectWithToast=function(b,a,d){var c=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!d&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?c=b.block.funcBlock:b.funcExecutor&&(c=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),c&&(Entry.container.selectObject(c.getCode().object.id, +!0),c.view.getBoard().activateBlock(c)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; +Entry.Utils.waitForWebfonts=function(b,a){for(var d=0,c=0,e=b.length;c=b.length&&(l&&clearInterval(l),d==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= +"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=c;var l;e()||(l=setInterval(e,50))})(b[c])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); +Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Utils.hasSpecialCharacter=function(b){return/!|@|#|\$|%|\^|&|\*|\(|\)|\+|=|-|\[|\]|\\|\'|;|,|\.|\/|{|}|\||\"|:|<|>|\?/g.test(b)};Entry.Model=function(b,a){var d=Entry.Model;d.generateSchema(b);d.generateSetter(b);d.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 c in b)(function(c){a.data[c]=b[c];Object.defineProperty(a,c,{get:function(){return a.data[c]}})})(c);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var c={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(c[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),c)};b.generateObserve= +function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,c,e){c=new Entry.Observer(this.observers,a,b,c);if(!1!==e)a[b]([]);return c};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var c=this;c.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:c,oldValue:b[a]}}))})};b._toJSON=function(){var a= +{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};Entry.generateFunctionSchema(this.id);if(b){b=this.content._blockMap;for(var a in b)Entry.Func.registerParamBlock(b[a].type);Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={}; +Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}};Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}}; +Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()};Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()}; +Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);b.recreateView();a.changeOverlayBoardCode(b);b.view.board.alignThreads();this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)};Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}}; +Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; +Entry.Func.syncFuncName=function(b){var a=0,d=[],d=b.split(" "),c="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=d)}}; +Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; +Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= +this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],c;for(c in a){var e=this.generatePortView(a[c],"_svgGroup");this._portViews[c]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= +this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)a[c]= +b[c];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var c in b)delete a[c];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],c;for(c in a){var e=this.generatePortView(a[c],"_svglistGroup");this._listPortViews[c]=e;b.push(e)}var f=this._portMapList; +b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var c=this[b].elem("g");c.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=c.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=c.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); +c.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=c.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:c,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,c=this._hwModule.monitorTemplate.mode, +e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==c)f=this._listPortViews;else if("both"==c){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(c=f[h],"input"==c.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* +this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a=[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3- +5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,c=0;cc-(l.width+m.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,c,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; +b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= +null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, +"12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); +break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect");d.isOpenHardware?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; +p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1");var d=0,c=null,c=setInterval(function(){try{this._w.location.href}catch(a){this._bNotInstalled=!0}if(10(0this.offsetX?0:a+c.maxWidth+10>this.offsetX?this.offsetX-a:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); +"pointer";this.valueSetter_.on("mousedown",function(a){Entry.engine.isState("run")&&(d.isAdjusting=!0,this.offsetX=-(this.x-.75*a.stageX+240))});this.valueSetter_.on("pressmove",function(a){if(Entry.engine.isState("run")){var b=this.offsetX;this.offsetX=-(this.x-.75*a.stageX+240);b!==this.offsetX&&(a=d.getX(),d.setSlideCommandX(a+10>this.offsetX?0:a+d.maxWidth+10>this.offsetX?this.offsetX-a:d.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){d.isAdjusting=!1});this.view_.addChild(this.valueSetter_); a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(),y:.75*a.stageY- this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(a){this.cursor= @@ -1640,793 +1558,752 @@ b=this.textView_.text,a=this.object_?(a=Entry.container.getObject(this.object_)) b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, --2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type? +-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ad.length?d+"..":d;this.elementView.valueView.text=d;d=this.elementView.clone(!0);d.y=20*(a-this.scrollPosition)+23;this.view_.addChild(d)}}else"answer"==this.type? (this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.rect_.graphics.clear().f("#ffffff").ss(1, 2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""): this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1,2,0).s("orange").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7));Entry.requestUpdate=!0}};Entry.Variable.prototype.getName=function(){return this.name_}; -Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){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=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+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_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");this.visible!==b&&(this.visible_=this.view_.visible=b,this.updateView())};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1d&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b=b||0;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; -Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); -d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_add;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; -var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(b){b=a._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=b.lastSelector&&b.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& +Entry.VariableContainer.prototype.renderMessageReference=function(b){for(var a=this,d=this._messageRefs,c=b.id,e=[],f=0;fb.x_&&a.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,d=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var d=a.info;b={name:b,isCloud:d.isCloud,object:d.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; -Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; +Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),d=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,d);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,d)}; Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", +Entry.VariableContainer.prototype.createMessageView=function(b){var a=this,d=Entry.createElement("li");d.addClass("entryVariableListElementWorkspace");d.addClass("entryMessageElementWorkspace");d.bindOnClick(function(d){a.select(b)});var c=Entry.createElement("button");c.addClass("entryVariableListElementDeleteWorkspace");c.bindOnClick(function(d){d.stopPropagation();a.removeMessage(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementEditWorkspace");e.bindOnClick(function(a){a.stopPropagation(); +g.removeAttribute("disabled");g.focus();f.removeClass("entryRemove");this.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.addClass("entryRemove");f.bindOnClick(function(a){a.stopPropagation();g.blur();e.removeClass("entryRemove");this.addClass("entryRemove")});var g=Entry.createElement("input");g.addClass("entryVariableListElementNameWorkspace");g.value=b.name;g.bindOnClick(function(a){a.stopPropagation()});g.onblur=function(d){(d= +this.value.trim())&&0!==d.length?(a.changeMessageName(b,this.value),e.removeClass("entryRemove"),f.addClass("entryRemove"),g.setAttribute("disabled","disabled")):(Entry.toast.alert(Lang.Msgs.warn,Lang.Msgs.sign_can_not_space),this.value=b.name)};g.onkeydown=function(a){13==a.keyCode&&this.blur()};d.nameField=g;d.appendChild(g);d.appendChild(e);d.appendChild(f);d.appendChild(c);b.listElement=d}; +Entry.VariableContainer.prototype.addList=function(b){if(!b){var a=this.listAddPanel;b=a.view.name.value.trim();b&&0!==b.length||(b=Lang.Workspace.list);var d=a.info;b.length>this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:d.isCloud,object:d.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; -Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");b.object_?c.addClass("entryListLocalElementWorkspace"):b.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); -e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); -g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, -Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +Entry.VariableContainer.prototype.generateVariableSettingView=function(){var b=this,a=Entry.createElement("div");a.bindOnClick(function(a){a.stopPropagation()});this.variableSettingView=a;a.addClass("entryVariableSettingWorkspace");this.listView_.appendChild(a);a.addClass("entryRemove");var d=Entry.createElement("div");d.addClass("entryVariableSettingVisibleWrapperWorkspace");d.bindOnClick(function(a){a=b.selectedVariable;var d=b.variableSettingView.visibleCheck;a.setVisible(!a.isVisible());a.isVisible()? +d.addClass("entryVariableSettingChecked"):d.removeClass("entryVariableSettingChecked")});a.appendChild(d);var c=Entry.createElement("span");c.innerHTML=Lang.Workspace.show_variable;d.appendChild(c);c=Entry.createElement("span");c.addClass("entryVariableSettingCheckWorkspace");a.visibleCheck=c;d.appendChild(c);d=Entry.createElement("div");d.addClass("entryVariableSettingInitValueWrapperWorkspace");a.appendChild(d);c=Entry.createElement("span");c.innerHTML=Lang.Workspace.default_value;d.appendChild(c); +c=Entry.createElement("input");c.addClass("entryVariableSettingInitValueInputWorkspace");a.initValueInput=c;c.value=0;c.onkeyup=function(a){b.selectedVariable.setValue(this.value)};c.onblur=function(a){b.selectedVariable.setValue(this.value)};a.initValueInput=c;d.appendChild(c);d=Entry.createElement("div");d.addClass("entryVariableSettingSplitterWorkspace");a.appendChild(d);d=Entry.createElement("div");d.addClass("entryVariableSettingSlideWrapperWorkspace");a.appendChild(d);c=Entry.createElement("span"); +c.innerHTML=Lang.Workspace.slide;d.appendChild(c);c=Entry.createElement("span");c.addClass("entryVariableSettingCheckWorkspace");a.slideCheck=c;d.appendChild(c);d.bindOnClick(function(a){var d;a=b.selectedVariable;var c=b.variables_,f=a.getType();"variable"==f?(d=a.toJSON(),d.variableType="slide",d=new Entry.Variable(d),c.splice(c.indexOf(a),0,d),0>d.getValue()&&d.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; +Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],d=this;this.mapVariable(function(b,d){b.object_&&b.object_==d&&a.push(b)},b);a.map(function(a){d.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; -Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b){b=a.type.substr(5);for(var d=Entry.variableContainer.functions_[b].content.getBlockList(),e=0;ethis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&ea.x||0>a.y){c.leftWheel=20;c.rightWheel= --20;break}a.initialized=!0}c=b.toRadian(a.theta);0==b.controlAngle(c,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==b.controlPosition(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==b.controlPositionFine(a.x,a.y,b.toRadian(a.theta),a.targetX,a.targetY)&&(c.leftWheel=0,c.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y;delete a.theta;delete a.targetX; -delete a.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1;a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");b.clear();c.leftWheel=0;c.rightWheel=0;return a}},albert_set_orientation_on_board:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["0"]},null],type:"albert_set_orientation_on_board"},paramsKeyMap:{ORIENTATION:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta);0==d.controlAngle(c,e)&&(a.boardState=2);break;case 2:c=d.toRadian(a.theta),e=d.toRadian(a.targetTheta),0==d.controlAngleFine(c,e)&&(b.leftWheel=0, -b.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState;delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");d.clear();b.leftWheel=0;b.rightWheel=0;return a}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye, -"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.ALBERT_color_red,"4"],[Lang.Blocks.ALBERT_color_yellow,"6"],[Lang.Blocks.ALBERT_color_green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.Blocks.ALBERT_color_blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.Blocks.ALBERT_color_white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"}, -paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"LEFT"==c?b.leftEye=d:("RIGHT"!=c&&(b.leftEye=d),b.rightEye=d);return a.callReturn()},syntax:{js:[],py:["Albert.set_eye(%1, %2)"]}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes, -"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"},paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"LEFT"==c?b.leftEye=0:("RIGHT"!=c&&(b.leftEye=0),b.rightEye=0);return a.callReturn()},syntax:{js:[],py:["Albert.clear_eye(%1)"]}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", -options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.bodyLed=1:b.bodyLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.body_led(%1)"]}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?b.frontLed=1:b.frontLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.front_led(%1)"]}},albert_beep:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;b.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.buzzer=440;b.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c); -return a},syntax:{js:[],py:["Albert.beep()"]}},albert_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"albert_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberValue("VALUE");b.buzzer=void 0!=b.buzzer?b.buzzer+c:c;b.note=0;return a.callReturn()}, -syntax:{js:[],py:["Albert.change_buzzer(%1)"]}},albert_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["1000"]},null],type:"albert_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;b.buzzer=a.getNumberValue("VALUE");b.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.set_buzzer(%1)"]}}, -albert_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_clear_buzzer"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){b=Entry.hw.sendQueue;b.buzzer=0;b.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_buzzer()"]}},albert_play_note_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_note_c+"","4"], -[Lang.Blocks.ALBERT_note_c+"#","5"],[Lang.Blocks.ALBERT_note_d+"","6"],[Lang.Blocks.ALBERT_note_e+"b","7"],[Lang.Blocks.ALBERT_note_e+"","8"],[Lang.Blocks.ALBERT_note_f+"","9"],[Lang.Blocks.ALBERT_note_f+"#","10"],[Lang.Blocks.ALBERT_note_g+"","11"],[Lang.Blocks.ALBERT_note_g+"#","12"],[Lang.Blocks.ALBERT_note_a+"","13"],[Lang.Blocks.ALBERT_note_b+"b","14"],[Lang.Blocks.ALBERT_note_b+"","15"]],value:"4",fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6", -"6"],["7","7"]],value:"1",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.note=0;return a.callReturn()}b=a.getNumberField("NOTE", -a);var d=a.getNumberField("OCTAVE",a),e=6E4*a.getNumberValue("VALUE",a)/Entry.Albert.tempo;a.isStart=!0;a.timeFlag=1;c.buzzer=0;c.note=b+12*(d-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.change_tempo(%1)"]}},albert_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE"); -1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.set_tempo(%1)"]}},albert_move_forward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;b.leftWheel= -30;b.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_forward()"]}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return b.leftWheel=-30,b.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart= -!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_backward()"]}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_left,"LEFT"],[Lang.Blocks.ALBERT_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){b=Entry.hw.sendQueue;if(a.isStart){if(1== -a.timeFlag)return b.leftWheel=a.leftValue,b.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}b="LEFT"==a.getField("DIRECTION",a);a.leftValue=b?-30:30;a.rightValue=b?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.turn_around()"]}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", -options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"],[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_red,"4"],[Lang.Blocks.HAMSTER_color_yellow,"6"],[Lang.Blocks.HAMSTER_color_green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.Blocks.HAMSTER_color_blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.Blocks.HAMSTER_color_white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a),d=Number(a.getField("COLOR",a));"FRONT"==c?(b.leftEye=d,b.rightEye=d):"LEFT"==c?b.leftEye=d:b.rightEye=d;return a.callReturn()},syntax:{js:[],py:["Albert.set_led(%1, %2)"]}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"], -[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION",a);"FRONT"==c?(b.leftEye=0,b.rightEye=0):"LEFT"==c?b.leftEye=0:b.rightEye=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_led(%1)"]}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel, -"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?b.leftWheel=void 0!=b.leftWheel?b.leftWheel+e:c.leftWheel+e:("RIGHT"!=d&&(b.leftWheel=void 0!= -b.leftWheel?b.leftWheel+e:c.leftWheel+e),b.rightWheel=void 0!=b.rightWheel?b.rightWheel+e:c.rightWheel+e);return a.callReturn()},syntax:{js:[],py:["Albert.change_wheels(%1, %2)"]}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("DIRECTION"),d=a.getNumberValue("VALUE");"LEFT"==c?b.leftWheel=d:("RIGHT"!=c&&(b.leftWheel=d),b.rightWheel=d);return a.callReturn()},syntax:{js:[],py:["Albert.set_wheels(%1, %2)"]}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}, -syntax:{js:[],py:["%1arduino_text#"]}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(b));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()},syntax:{js:[],py:["Arduino.send(%1)"]}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field", -statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return Number(a.responseText)},syntax:{js:[],py:["Arduino.number(%1)"]}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, -paramsKeyMap:{VALUE:0},func:function(b,a){b=a.getValue("VALUE",a);a=new XMLHttpRequest;a.open("POST","http://localhost:23518/arduino/",!1);a.send(String(b));Entry.assert(200==a.status,"arduino is not connected");return a.responseText},syntax:{js:[],py:["Arduino.string(%1)"]}},arduino_get_sensor_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}], -events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]}, -paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_pwm_port_number#"]}}, -arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){b=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(b[1])},syntax:{js:[],py:["Arduino.sensor_value(%1)"]}},arduino_get_digital_value:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(b)},syntax:{js:[],py:["Arduino.digital_value(%1)"]}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("VALUE");var c=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(b,"on"==c?255:0);return a.callReturn()}, -syntax:{js:[],py:["Arduino.toggle_led(%1, %2)"]}},arduino_toggle_pwm:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){b=a.getNumberValue("PORT");var c= -a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(b,c);return a.callReturn()},syntax:{js:[],py:["Arduino.toggle_pwm(%1, %2)"]}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value", -params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(d>e)var f=d,d= -e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)},syntax:{js:[],py:["Arduino.convert_scale(%1, %2, %3, %4, %5)"]}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet", -isNotFor:["ArduinoExt"],func:function(b,a){b=a.getField("PORT",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64=e[0]?1:0;throw new Entry.Utils.AsyncError;}a.isStart=!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT", -fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("STATUS",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64e[1]?1:0:800>=e[1]?1:0;throw new Entry.Utils.AsyncError;}a.isStart= -!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7, -"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);if(10>b){var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.DIGITAL;if(a.isStart){if(d&&d===a.stamp||64e[b-14]?1:0;throw new Entry.Utils.AsyncError;}a.isStart= -!0;a.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:b-14};throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19, -"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"},paramsKeyMap:{DIRECTION:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getField("DIRECTION",a);var c=0,d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0;a=a.executor.scope;var f=Entry.hw.portData.ANALOG;"LEFT"==b||"RIGHT"==b?c=3:"FRONT"==b||"REAR"==b?c=4:"REVERSE"==b&&(c=5);if(a.isStart)if(e&& -e===a.stamp){delete a.isStart;delete a.stamp;c=f[c];c=Math.min(90,180/137*(c-265)+-90);c=Math.max(-90,c);c=Math.round(c);if("LEFT"==b||"REAR"==b)return-30>c?1:0;if("RIGHT"==b||"FRONT"==b)return 30c?1:0}else if(64c?1:0;if("RIGHT"==b||"FRONT"==b)return 30c?1:0}else throw new Entry.Utils.AsyncError; -else throw a.isStart=!0,a.stamp=d,Entry.hw.sendQueue.TIME=d,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(),Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:c},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0}, -"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){b=a.getNumberField("PORT",a);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),d=Entry.hw.portData.TIME||0;a=a.executor.scope;var e=Entry.hw.portData.ANALOG;if(a.isStart){if(d&&d===a.stamp||64e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}},CODEino_set_rgb_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791", -"19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getNumberField("PORT",a),d=a.getNumberValue("VALUE",a),d=Math.min(255,d),d=Math.max(0,d);17==c?CODEINO_RED=d:18==c?CODEINO_GREEN=d:CODEINO_BLUE=d;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); -b.SET||(b.SET={});b.SET[c]={type:4,data:d};return a.callReturn()}},CODEino_set_rgb_add_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791","19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_add_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b, -a){b=Entry.hw.sendQueue;var c=a.getNumberField("PORT",a),d=a.getNumberValue("VALUE",a),d=Math.min(255,d),d=Math.max(0,d);17==c&&(CODEINO_RED+=d,CODEINO_RED=Math.min(255,CODEINO_RED),d=CODEINO_RED=Math.max(0,CODEINO_RED));18==c&&(CODEINO_GREEN+=d,CODEINO_GREEN=Math.min(255,CODEINO_GREEN),d=CODEINO_GREEN=Math.max(0,CODEINO_GREEN));19==c&&(CODEINO_BLUE+=d,CODEINO_BLUE=Math.min(255,CODEINO_BLUE),d=CODEINO_BLUE=Math.max(0,CODEINO_BLUE));b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey(); -b.SET||(b.SET={});b.SET[c]={type:4,data:d};return a.callReturn()}},CODEino_rgb_set_color:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_rgb_set_color"},paramsKeyMap:{VALUE:0},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=a.getStringField("VALUE");CODEINO_RED=parseInt(b.substr(1,2),16);CODEINO_GREEN=parseInt(b.substr(3,2),16);CODEINO_BLUE=parseInt(b.substr(5, -2),16);b=Entry.hw.sendQueue;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_RED};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}}, -CODEino_set_rgb_off:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_set_rgb_off"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;CODEINO_GREEN=CODEINO_BLUE=CODEINO_RED=0;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4); -b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:0};return a.callReturn()}},CODEino_set__led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", -params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"CODEino_set__led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){CODEINO_RED=a.getNumberValue("rValue");CODEINO_GREEN=a.getNumberValue("gValue");CODEINO_BLUE=a.getNumberValue("bValue");b=Entry.hw.sendQueue;var c=17;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_RED}; -b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_GREEN};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}},CODEino_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], -type:"CODEino_led_by_value"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){b=Entry.hw.sendQueue;var c=17;CODEINO_BLUE=CODEINO_GREEN=CODEINO_RED=100;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};b=Entry.hw.sendQueue;c=18;b.TIME=Entry.ArduinoExt.getSensorTime(4);b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};b=Entry.hw.sendQueue;c=19;b.TIME=Entry.ArduinoExt.getSensorTime(4); -b.KEY=Entry.ArduinoExt.getSensorKey();b.SET||(b.SET={});b.SET[c]={type:4,data:100};return a.callReturn()}},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["hw.CODEino_get_number_sensor_value(%1)"]}},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null], -type:"CODEino_toggle_led"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_led(%1)"]}},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_pwm(%1, %2)"]}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field", -statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){b=a.getNumberField("PORT",a);return 14a?1:0;if("RIGHT"==b||"FRONT"==b)return 30a?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=Entry.hw.getAnalogPortValue(a.getField("PORT",a)),d=265,e=402;b=-90;a=90;if(d>e)var f=d,d=e,e=f;b>a&&(f=b,b=a,a=f);c=(a-b)/(e-d)* -(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b].value},syntax:{js:[], -py:["Bitbrick.sensor_value(%1)"]}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value},syntax:{js:[],py:["Bitbrick.is_touch_pressed(%1)"]}},bitbrick_turn_off_color_led:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_color_led()"]}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("rValue");var c=a.getNumberValue("gValue"),d=a.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin, -f=Entry.hw.sendQueue;f.LEDR=e(b,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_rgb(%1, %2, %3)"]}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getStringField("VALUE"); -Entry.hw.sendQueue.LEDR=parseInt(b.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(b.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(b.substr(5,2),16);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_picker(%1)"]}},bitbrick_turn_on_color_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"}, -paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("VALUE");var c,d,e;b%=200;67>b?(c=200-3*b,d=3*b,e=0):134>b?(b-=67,c=0,d=200-3*b,e=3*b):201>b&&(b-=134,c=3*b,d=0,e=200-3*b);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_value(%1)"]}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();b=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=b;a.isStart=!0;return a},syntax:{js:[],py:["Bitbrick.buzzer(%1)"]}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue;b=Entry.Bitbrick;b.servoList().map(function(a){c[a[1]]=0});b.dcList().map(function(a){c[a[1]]=128});return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_all_motors()"]}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberValue("VALUE");b=Math.min(b,Entry.Bitbrick.dcMaxValue);b=Math.max(b,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b+128;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_speed(%1, %2)"]}}, -bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0, -DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b="CW"===a.getStringField("DIRECTION");var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=b?c+128:128-c;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_direction_speed(%1, %2, %3)"]}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1);b=Math.min(b,Entry.Bitbrick.servoMaxValue);b=Math.max(b,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=b;return a.callReturn()},syntax:{js:[], -py:["Bitbrick.servomotor_angle(%1, %2)"]}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}], -type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){b=a.getNumberField("PORT");var c=Entry.hw.portData[b].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);b=a.getNumberValue("VALUE4",a);a=a.getNumberValue("VALUE5",a);if(b>a){var f=b;b=a;a=f}c=(a-b)/(e-d)*(c-d);c+=b;c=Math.min(a,c);c=Math.max(b,c);return Math.round(c)},syntax:{js:[],py:["Bitbrick.convert_scale(%1, %2, %3, %4, %5)"]}}, -cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("potenmeter")}}, -cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread1")}},cobl_read_irread2:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread2")}}, -cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyy")}}, -cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)",def:{type:"cobl_read_tilt"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0}, -class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getAnalogPortValue("temps1");if(2==b)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE", -a);if(1==b)return Entry.hw.getAnalogPortValue("light1");if(2==b)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getValue("VALUE",a);if(1==b)return Entry.hw.getDigitalPortValue("btn1"); -if(2==b)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["\ube68\uac15","Red"],["\uc8fc\ud669","Orange"],["\ub178\ub791","Yellow"],["\ucd08\ub85d","Green"],["\ud30c\ub791","Blue"],["\ub0a8\uc0c9","Dark Blue"],["\ubcf4\ub77c","Purple"],["\ud770\uc0c9","White"]],fontSize:11}, -{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+b,c);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+b];return a.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165) %2", -params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("VALUE");b=Math.round(b);b=Math.max(b,15);b=Math.min(b,165);Entry.hw.setDigitalPortValue("Servo1",b);Entry.hw.update();delete Entry.hw.sendQueue.Servo1;return a.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1 ,%2", -params:[{type:"Dropdown",options:[["((\ub0ae\uc740)\uc194","L_So"],["(\ub0ae\uc740)\uc194#","L_So#"],["(\ub0ae\uc740)\ub77c","L_La"],["(\ub0ae\uc740)\ub77c#","L_La#"],["(\ub0ae\uc740)\uc2dc","L_Ti"],["\ub3c4","Do"],["\ub3c4#","Do#"],["\ub808","Re"],["\ub808#","Re#"],["\ubbf8","Mi"],["\ud30c","Fa"],["\ud30c#","Fa#"],["\uc194","So"],["\uc194#","So#"],["\ub77c","La"],["\ub77c#","La#"],["\uc2dc","Ti"],["(\ub192\uc740)\ub3c4","H_Do"],["(\ub192\uc740)\ub3c4#","H_Do#"],["(\ub192\uc740)\ub808","H_Re"],["(\ub192\uc740)\ub808#", -"H_Re#"],["(\ub192\uc740)\ubbf8#","H_Mi"],["(\ub192\uc740)\ud30c","H_Fa"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["Do"],type:"cobl_melody"},paramsKeyMap:{MELODY:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("MELODY");Entry.hw.setDigitalPortValue("Melody",b);Entry.hw.update();delete Entry.hw.sendQueue.Melody;return a.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3 %4", -params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.\uc2dc\uacc4\ubc29\ud5a5","1"],["2.\ubc18\uc2dc\uacc4\ubc29\ud5a5","2"],["3.\uc815\uc9c0","3"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:1,SPEED:2},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("MOTOR"); -var c=a.getStringField("DIRECTION"),d=a.getStringField("SPEED");1==b&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC1_DIR,delete Entry.hw.sendQueue.DC1_SPEED);2==b&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC2_DIR,delete Entry.hw.sendQueue.DC2_SPEED);return a.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff", -skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","0"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getStringField("PORT");var c=a.getStringField("LEVEL");1==b&&(Entry.hw.setDigitalPortValue("EXUSB1", -c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB1);2==b&&(Entry.hw.setDigitalPortValue("EXUSB2",c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB2);return a.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4 %5",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown", -options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:1,GREEN:2,BLUE:3},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("LED"); -var c=a.getStringField("RED"),d=a.getStringField("GREEN"),e=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",b);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);Entry.hw.update();delete Entry.hw.sendQueue.ELED_IDX;delete Entry.hw.sendQueue.ELED_R;delete Entry.hw.sendQueue.ELED_G;delete Entry.hw.sendQueue.ELED_B;return a.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999) %2", -params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){b=a.getNumberField("VALUE");Entry.hw.setDigitalPortValue("7SEG",b);Entry.hw.update();delete Entry.hw.sendQueue["7SEG"];return a.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"}, -"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.start_drawing()"]}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop= -!0);return a.callReturn()},syntax:{js:[],py:["Entry.stop_drawing()"]}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+ -c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color(%1)"]}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb= -c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color_random()"]}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness", -isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_size(%1)"]}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}], -events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_size(%1)"]}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/ -100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0); -b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(b, -a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}b=b.parent.getStampEntities();b.map(function(a){a.removeClone()});b=null;return a.callReturn()},syntax:{js:[],py:["Entry.clear_drawing()"]}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(b, -a){b.parent.addStampEntity(b);return a.callReturn()},syntax:{js:[],py:["Entry.stamp()"]}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), -b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_transparency(%1)"]}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[], +[Lang.Blocks.ALBERT_sensor_orientation,"orientation"],[Lang.Blocks.ALBERT_sensor_light,"light"],[Lang.Blocks.ALBERT_sensor_temperature,"temperature"],[Lang.Blocks.ALBERT_sensor_battery,"battery"],[Lang.Blocks.ALBERT_sensor_signal_strength,"signalStrength"]],value:"leftProximity",fontSize:11}],events:{},def:{params:[null],type:"albert_value"},paramsKeyMap:{DEVICE:0},"class":"albert_sensor",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.portData,c=a.getField("DEVICE");return d[c]},syntax:{js:[], +py:["Albert.value(%1)"]}},albert_move_forward_for_secs:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["1"]},null],type:"albert_move_forward_for_secs"},paramsKeyMap:{VALUE:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= +!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;d.leftWheel=30;d.rightWheel=30;var d=1E3*a.getNumberValue("VALUE"),c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},d);Entry.Albert.timeouts.push(c);return a},syntax:{js:[],py:["Albert.move_forward_for_secs(%1)"]}},albert_move_backward_for_secs:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, +def:{params:[{type:"text",params:["1"]},null],type:"albert_move_backward_for_secs"},paramsKeyMap:{VALUE:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;d.leftWheel=-30;d.rightWheel=-30;var d=1E3*a.getNumberValue("VALUE"),c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)}, +d);Entry.Albert.timeouts.push(c);return a},syntax:{js:[],py:["Albert.move_backward_for_secs(%1)"]}},albert_turn_for_secs:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_left,"LEFT"],[Lang.Blocks.ALBERT_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["1"]},null],type:"albert_turn_for_secs",id:"como"},paramsKeyMap:{DIRECTION:0, +VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;"LEFT"==a.getField("DIRECTION",a)?(d.leftWheel=-30,d.rightWheel=30):(d.leftWheel=30,d.rightWheel=-30);var d=1E3*a.getNumberValue("VALUE"),c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)},d);Entry.Albert.timeouts.push(c); +return a},syntax:{js:[],py:["Albert.turn_for_secs(%1, %2)"]}},albert_change_both_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["10"]},{type:"text",params:["10"]},null],type:"albert_change_both_wheels_by"},paramsKeyMap:{LEFT:0,RIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue, +c=a.getNumberValue("LEFT"),e=a.getNumberValue("RIGHT");d.leftWheel=void 0!=d.leftWheel?d.leftWheel+c:c;d.rightWheel=void 0!=d.rightWheel?d.rightWheel+e:e;return a.callReturn()},syntax:{js:[],py:["Albert.change_both_wheels(%1, %2)"]}},albert_set_both_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["30"]},{type:"text", +params:["30"]},null],type:"albert_set_both_wheels_to"},paramsKeyMap:{LEFT:0,RIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;d.leftWheel=a.getNumberValue("LEFT");d.rightWheel=a.getNumberValue("RIGHT");return a.callReturn()},syntax:{js:[],py:["Albert.set_both_wheels(%1, %2)"]}},albert_change_wheel_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel, +"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"BOTH"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"albert_change_wheel_by"},paramsKeyMap:{DIRECTION:0,VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==c?d.leftWheel=void 0!=d.leftWheel?d.leftWheel+e:e:("RIGHT"!= +c&&(d.leftWheel=void 0!=d.leftWheel?d.leftWheel+e:e),d.rightWheel=void 0!=d.rightWheel?d.rightWheel+e:e);return a.callReturn()},syntax:{js:[],py:["Albert.change_wheel(%1, %2)"]}},albert_set_wheel_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"BOTH"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,{type:"text",params:["30"]},null],type:"albert_set_wheel_to"},paramsKeyMap:{DIRECTION:0,VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==c?d.leftWheel=e:("RIGHT"!=c&&(d.leftWheel=e),d.rightWheel=e);return a.callReturn()},syntax:{js:[],py:["Albert.set_wheel(%1, %2)"]}},albert_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_stop",id:"4adb"},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;d.leftWheel=0;d.rightWheel=0;return a.callReturn()},syntax:{js:[],py:["Albert.stop()"]}},albert_set_pad_size_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", +params:["108"]},{type:"text",params:["76"]},null],type:"albert_set_pad_size_to",id:"5mhg"},paramsKeyMap:{WIDTH:0,HEIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;d.padWidth=a.getNumberValue("WIDTH");d.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()},syntax:{js:[],py:["Albert.set_pad_size(%1, %2)"]}},albert_move_to_x_y_on_board:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"albert_move_to_x_y_on_board"},paramsKeyMap:{X:0,Y:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData,e=Entry.Albert.controller;if(a.isStart){if(a.isMoving){0<=c.positionX&&(a.x=c.positionX);0<=c.positionY&&(a.y=c.positionY);a.theta=c.orientation;switch(a.boardState){case 1:if(0==a.initialized){if(0> +a.x||0>a.y){d.leftWheel=20;d.rightWheel=-20;break}a.initialized=!0}d=e.toRadian(a.theta);0==e.controlAngle(d,Math.atan2(a.targetY-a.y,a.targetX-a.x))&&(a.boardState=2);break;case 2:0==e.controlPosition(a.x,a.y,e.toRadian(a.theta),a.targetX,a.targetY)&&(a.boardState=3);break;case 3:0==e.controlPositionFine(a.x,a.y,e.toRadian(a.theta),a.targetX,a.targetY)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.initialized;delete a.boardState;delete a.x;delete a.y; +delete a.theta;delete a.targetX;delete a.targetY;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.initialized=!1;a.boardState=1;a.x=-1;a.y=-1;a.theta=-200;a.targetX=a.getNumberValue("X");a.targetY=a.getNumberValue("Y");e.clear();d.leftWheel=0;d.rightWheel=0;return a}},albert_set_orientation_on_board:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[{type:"number",params:["0"]},null],type:"albert_set_orientation_on_board"},paramsKeyMap:{ORIENTATION:0},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData,e=Entry.Albert.controller;if(a.isStart){if(a.isMoving){a.theta=c.orientation;switch(a.boardState){case 1:var c=e.toRadian(a.theta),f=e.toRadian(a.targetTheta);0==e.controlAngle(c,f)&&(a.boardState=2);break;case 2:c=e.toRadian(a.theta),f=e.toRadian(a.targetTheta),0==e.controlAngleFine(c, +f)&&(d.leftWheel=0,d.rightWheel=0,a.isMoving=!1)}return a}delete a.isStart;delete a.isMoving;delete a.boardState;delete a.theta;delete a.targetTheta;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.boardState=1;a.theta=-200;a.targetTheta=a.getNumberValue("ORIENTATION");e.clear();d.leftWheel=0;d.rightWheel=0;return a}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye, +"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.ALBERT_color_red,"4"],[Lang.Blocks.ALBERT_color_yellow,"6"],[Lang.Blocks.ALBERT_color_green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.Blocks.ALBERT_color_blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.Blocks.ALBERT_color_white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, +null,null],type:"albert_set_eye_to"},paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==c?d.leftEye=e:("RIGHT"!=c&&(d.leftEye=e),d.rightEye=e);return a.callReturn()},syntax:{js:[],py:["Albert.set_eye(%1, %2)"]}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye, +"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"},paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a);"LEFT"==c?d.leftEye=0:("RIGHT"!=c&&(d.leftEye=0),d.rightEye=0);return a.callReturn()},syntax:{js:[],py:["Albert.clear_eye(%1)"]}},albert_body_led:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?d.bodyLed=1:d.bodyLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.body_led(%1)"]}},albert_front_led:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?d.frontLed=1:d.frontLed=0;return a.callReturn()},syntax:{js:[],py:["Albert.front_led(%1)"]}}, +albert_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;d.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;d.buzzer=440;d.note=0;var c=setTimeout(function(){a.timeFlag=0;Entry.Albert.removeTimeout(c)}, +200);Entry.Albert.timeouts.push(c);return a},syntax:{js:[],py:["Albert.beep()"]}},albert_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"albert_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getNumberValue("VALUE");d.buzzer=void 0!=d.buzzer? +d.buzzer+c:c;d.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.change_buzzer(%1)"]}},albert_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["1000"]},null],type:"albert_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;d.buzzer=a.getNumberValue("VALUE");d.note= +0;return a.callReturn()},syntax:{js:[],py:["Albert.set_buzzer(%1)"]}},albert_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_clear_buzzer"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;d.buzzer=0;d.note=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_buzzer()"]}},albert_play_note_for:{color:"#00979D",skeleton:"basic",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_note_c+"","4"],[Lang.Blocks.ALBERT_note_c+"#","5"],[Lang.Blocks.ALBERT_note_d+"","6"],[Lang.Blocks.ALBERT_note_e+"b","7"],[Lang.Blocks.ALBERT_note_e+"","8"],[Lang.Blocks.ALBERT_note_f+"","9"],[Lang.Blocks.ALBERT_note_f+"#","10"],[Lang.Blocks.ALBERT_note_g+"","11"],[Lang.Blocks.ALBERT_note_g+"#","12"],[Lang.Blocks.ALBERT_note_a+"","13"],[Lang.Blocks.ALBERT_note_b+"b","14"],[Lang.Blocks.ALBERT_note_b+"","15"]],value:"4",fontSize:11},{type:"Dropdown", +options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]],value:"1",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= +!1;d.note=0;return a.callReturn()}var c=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberValue("VALUE",a),g=Entry.Albert.tempo,f=6E4*f/g;a.isStart=!0;a.timeFlag=1;d.buzzer=0;d.note=c+12*(e-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.change_tempo(%1)"]}},albert_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"], +func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()},syntax:{js:[],py:["Albert.set_tempo(%1)"]}},albert_move_forward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;d.leftWheel= +0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;d.leftWheel=30;d.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_forward()"]}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return d.leftWheel=-30,d.rightWheel=-30,a;delete a.timeFlag;delete a.isStart; +Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.move_backward()"]}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_turn_left,"LEFT"],[Lang.Blocks.ALBERT_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]}, +paramsKeyMap:{DIRECTION:0},func:function(b,a){var d=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return d.leftWheel=a.leftValue,d.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}d="LEFT"==a.getField("DIRECTION",a);a.leftValue=d?-30:30;a.rightValue=d?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a},syntax:{js:[],py:["Albert.turn_around()"]}}, +albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_left_led,"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"],[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_red,"4"],[Lang.Blocks.HAMSTER_color_yellow,"6"],[Lang.Blocks.HAMSTER_color_green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.Blocks.HAMSTER_color_blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.Blocks.HAMSTER_color_white, +"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==c?(d.leftEye=e,d.rightEye=e):"LEFT"==c?d.leftEye=e:d.rightEye=e;return a.callReturn()},syntax:{js:[],py:["Albert.set_led(%1, %2)"]}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_left_led, +"LEFT"],[Lang.Blocks.HAMSTER_right_led,"RIGHT"],[Lang.Blocks.HAMSTER_both_leds,"FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION",a);"FRONT"==c?(d.leftEye=0,d.rightEye=0):"LEFT"==c?d.leftEye=0:d.rightEye=0;return a.callReturn()},syntax:{js:[],py:["Albert.clear_led(%1)"]}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var d=Entry.hw.sendQueue,c=Entry.hw.portData,e=a.getField("DIRECTION"),f=a.getNumberValue("VALUE");"LEFT"==e?d.leftWheel=void 0!= +d.leftWheel?d.leftWheel+f:c.leftWheel+f:("RIGHT"!=e&&(d.leftWheel=void 0!=d.leftWheel?d.leftWheel+f:c.leftWheel+f),d.rightWheel=void 0!=d.rightWheel?d.rightWheel+f:c.rightWheel+f);return a.callReturn()},syntax:{js:[],py:["Albert.change_wheels(%1, %2)"]}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.ALBERT_left_wheel,"LEFT"],[Lang.Blocks.ALBERT_right_wheel,"RIGHT"],[Lang.Blocks.ALBERT_both_wheels,"FRONT"]],value:"LEFT",fontSize:11}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==c?d.leftWheel=e:("RIGHT"!=c&&(d.leftWheel=e),d.rightWheel=e);return a.callReturn()},syntax:{js:[],py:["Albert.set_wheels(%1, %2)"]}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", +value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")},syntax:{js:[],py:["%1arduino_text#"]}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return a.callReturn()}, +syntax:{js:[],py:["Arduino.send(%1)"]}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return+c.responseText},syntax:{js:[],py:["Arduino.number(%1)"]}},arduino_get_string:{color:"#00979D", +skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var d=a.getValue("VALUE",a),c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(d));Entry.assert(200==c.status,"arduino is not connected");return c.responseText},syntax:{js:[],py:["Arduino.string(%1)"]}},arduino_get_sensor_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown", +options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"], +["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_sensor_number#"]}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}], +events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")},syntax:{js:[],py:["%1arduino_get_pwm_port_number#"]}},arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var d=a.getValue("VALUE", +a);return Entry.hw.getAnalogPortValue(d[1])},syntax:{js:[],py:["Arduino.sensor_value(%1)"]}},arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var d=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(d)},syntax:{js:[], +py:["Arduino.digital_value(%1)"]}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set", +isNotFor:["arduino"],func:function(b,a){var d=a.getNumberValue("VALUE"),c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()},syntax:{js:[],py:["Arduino.toggle_led(%1, %2)"]}},arduino_toggle_pwm:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]}, +null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var d=a.getNumberValue("PORT"),c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(d,c);return a.callReturn()},syntax:{js:[],py:["Arduino.toggle_pwm(%1, %2)"]}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var d=a.getNumberValue("VALUE1", +a),c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(c>e)var h=c,c=e,e=h;f>g&&(h=f,f=g,g=h);d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)},syntax:{js:[],py:["Arduino.convert_scale(%1, %2, %3, %4, %5)"]}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4", +"4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var d=a.getField("PORT",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64=g[0]?1:0;throw new Entry.Utils.AsyncError;}f.isStart= +!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"}, +paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("STATUS",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64g[1]?1:0:800>=g[1]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(); +Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"}, +paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getNumberField("PORT",a);if(10>d){var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.DIGITAL;if(f.isStart){if(e&&e===f.stamp||64g[d-14]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET= +{type:Entry.ArduinoExt.sensorTypes.ANALOG,port:d-14};throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19,"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"}, +paramsKeyMap:{DIRECTION:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("DIRECTION",a),c=0,e=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),f=Entry.hw.portData.TIME||0,g=a.executor.scope,h=Entry.hw.portData.ANALOG;"LEFT"==d||"RIGHT"==d?c=3:"FRONT"==d||"REAR"==d?c=4:"REVERSE"==d&&(c=5);if(g.isStart)if(f&&f===g.stamp){delete g.isStart;delete g.stamp;c=h[c];c=180/137*(c-265);c+=-90;c=Math.min(90,c);c=Math.max(-90,c);c=Math.round(c);if("LEFT"== +d||"REAR"==d)return-30>c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else if(64c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else throw new Entry.Utils.AsyncError;else throw g.isStart=!0,g.stamp=e,Entry.hw.sendQueue.TIME=e,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(), +Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:c},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getNumberField("PORT",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), +e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG,h=0;if(f.isStart){if(e&&e===f.stamp)return delete f.isStart,delete f.stamp,h=g[d],h=Math.min(90,1.46*(h-333)),h=Math.max(-90,h),Math.round(h);if(64e)var h=c,c=e,e=h;f>g&&(h=f,f=g,g=h);d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},CODEino_set_rgb_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791","19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{type:"CODEino_set_rgb_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getNumberField("PORT",a),e=a.getNumberValue("VALUE",a),e=Math.min(255,e),e=Math.max(0,e);17==c?CODEINO_RED=e:18==c?CODEINO_GREEN=e:CODEINO_BLUE=e;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:e};return a.callReturn()}},CODEino_set_rgb_add_value:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ube68\uac15","17"],["\ucd08\ub85d","18"],["\ud30c\ub791","19"]],value:"17",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{type:"CODEino_set_rgb_add_value"},paramsKeyMap:{PORT:0,VALUE:1},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getNumberField("PORT",a),e=a.getNumberValue("VALUE",a),e=Math.min(255,e),e= +Math.max(0,e);17==c&&(CODEINO_RED+=e,CODEINO_RED=Math.min(255,CODEINO_RED),e=CODEINO_RED=Math.max(0,CODEINO_RED));18==c&&(CODEINO_GREEN+=e,CODEINO_GREEN=Math.min(255,CODEINO_GREEN),e=CODEINO_GREEN=Math.max(0,CODEINO_GREEN));19==c&&(CODEINO_BLUE+=e,CODEINO_BLUE=Math.min(255,CODEINO_BLUE),e=CODEINO_BLUE=Math.max(0,CODEINO_BLUE));d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:e};return a.callReturn()}},CODEino_rgb_set_color:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_rgb_set_color"},paramsKeyMap:{VALUE:0},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){var d=a.getStringField("VALUE");CODEINO_RED=parseInt(d.substr(1,2),16);CODEINO_GREEN=parseInt(d.substr(3,2),16);CODEINO_BLUE=parseInt(d.substr(5,2),16);var d=Entry.hw.sendQueue,c=17;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey(); +d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_RED};d=Entry.hw.sendQueue;c=18;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_GREEN};d=Entry.hw.sendQueue;c=19;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}},CODEino_set_rgb_off:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null],type:"CODEino_set_rgb_off"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){var d=Entry.hw.sendQueue;CODEINO_GREEN=CODEINO_BLUE=CODEINO_RED=0;var c=17;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:0};d=Entry.hw.sendQueue;c=18;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:0};d=Entry.hw.sendQueue; +c=19;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:0};return a.callReturn()}},CODEino_set__led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null], +type:"CODEino_set__led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b,a){CODEINO_RED=a.getNumberValue("rValue");CODEINO_GREEN=a.getNumberValue("gValue");CODEINO_BLUE=a.getNumberValue("bValue");var d=Entry.hw.sendQueue,c=17;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_RED};d=Entry.hw.sendQueue;c=18;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey(); +d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_GREEN};d=Entry.hw.sendQueue;c=19;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:CODEINO_BLUE};return a.callReturn()}},CODEino_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"CODEino_led_by_value"},"class":"CODEino_RGBLED_mode",isNotFor:["CODEino"],func:function(b, +a){var d=Entry.hw.sendQueue,c=17;CODEINO_BLUE=CODEINO_GREEN=CODEINO_RED=100;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:100};d=Entry.hw.sendQueue;c=18;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:100};d=Entry.hw.sendQueue;c=19;d.TIME=Entry.ArduinoExt.getSensorTime(4);d.KEY=Entry.ArduinoExt.getSensorKey();d.SET||(d.SET={});d.SET[c]={type:4,data:100};return a.callReturn()}}, +CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["hw.CODEino_get_number_sensor_value(%1)"]}},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_led(%1)"]}},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set",syntax:{js:[],py:["hw.CODEino_toggle_pwm(%1, %2)"]}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B", +"4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c", +"SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"], +["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var d=a.getNumberField("PORT",a);return 14c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown", +options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var d=265,c=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(d>c)var h=d,d=c,c=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(c-d)*(g-d);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[], +params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=a.getStringField("PORT");return Entry.hw.portData[d].value},syntax:{js:[],py:["Bitbrick.sensor_value(%1)"]}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic", +value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value},syntax:{js:[],py:["Bitbrick.is_touch_pressed(%1)"]}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led", +id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_color_led()"]}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", +params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=a.getNumberValue("rValue"),c=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(d,0,255);g.LEDG=f(c,0,255);g.LEDB=f(e,0,255);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_rgb(%1, %2, %3)"]}}, +bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(d.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(d.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(d.substr(5, +2),16);return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_picker(%1)"]}},bitbrick_turn_on_color_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=a.getNumberValue("VALUE"),c,e,f,d=d%200;67> +d?(c=200-3*d,e=3*d,f=0):134>d?(d-=67,c=0,e=200-3*d,f=3*d):201>d&&(d-=134,c=3*d,e=0,f=200-3*d);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()},syntax:{js:[],py:["Bitbrick.color_led_by_value(%1)"]}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0}, +"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var d=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=d;a.isStart=!0;return a},syntax:{js:[],py:["Bitbrick.buzzer(%1)"]}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"], +func:function(b,a){var d=Entry.hw.sendQueue,c=Entry.Bitbrick;c.servoList().map(function(a){d[a[1]]=0});c.dcList().map(function(a){d[a[1]]=128});return a.callReturn()},syntax:{js:[],py:["Bitbrick.turn_off_all_motors()"]}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text", +params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=d+128;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_speed(%1, %2)"]}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11, +menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d="CW"===a.getStringField("DIRECTION"), +c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[a.getStringField("PORT")]=d?c+128:128-c;return a.callReturn()},syntax:{js:[],py:["Bitbrick.dc_direction_speed(%1, %2, %3)"]}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, +{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var d=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),d=Math.min(d,Entry.Bitbrick.servoMaxValue),d=Math.max(d,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=d;return a.callReturn()},syntax:{js:[],py:["Bitbrick.servomotor_angle(%1, %2)"]}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"], +func:function(b,a){var d=a.getNumberField("PORT"),c=Entry.hw.portData[d].value,d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)},syntax:{js:[],py:["Bitbrick.convert_scale(%1, %2, %3, %4, %5)"]}},cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)", +def:{type:"cobl_read_ultrason"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)", +def:{type:"cobl_read_irread1"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread1")}},cobl_read_irread2:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("irread2")}},cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)", +def:{type:"cobl_read_joyx"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("joyy")}},cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)", +def:{type:"cobl_read_tilt"},class:"cobl",isNotFor:["cobl"],func:function(b,a){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getAnalogPortValue("temps1"); +if(2==d)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getAnalogPortValue("light1");if(2==d)return Entry.hw.getAnalogPortValue("light2")}}, +cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getValue("VALUE",a);if(1==d)return Entry.hw.getDigitalPortValue("btn1");if(2==d)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff", +skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["\ube68\uac15","Red"],["\uc8fc\ud669","Orange"],["\ub178\ub791","Yellow"],["\ucd08\ub85d","Green"],["\ud30c\ub791","Blue"],["\ub0a8\uc0c9","Dark Blue"],["\ubcf4\ub77c","Purple"],["\ud770\uc0c9","White"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","OFF"],type:"cobl_led_control"}, +paramsKeyMap:{PORT:0,OPERATOR:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getStringField("PORT"),c=a.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+d,c);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+d];return a.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165) %2",params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getNumberField("VALUE"),d=Math.round(d),d=Math.max(d,15),d=Math.min(d,165);Entry.hw.setDigitalPortValue("Servo1",d);Entry.hw.update();delete Entry.hw.sendQueue.Servo1;return a.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1 ,%2",params:[{type:"Dropdown",options:[["((\ub0ae\uc740)\uc194","L_So"],["(\ub0ae\uc740)\uc194#", +"L_So#"],["(\ub0ae\uc740)\ub77c","L_La"],["(\ub0ae\uc740)\ub77c#","L_La#"],["(\ub0ae\uc740)\uc2dc","L_Ti"],["\ub3c4","Do"],["\ub3c4#","Do#"],["\ub808","Re"],["\ub808#","Re#"],["\ubbf8","Mi"],["\ud30c","Fa"],["\ud30c#","Fa#"],["\uc194","So"],["\uc194#","So#"],["\ub77c","La"],["\ub77c#","La#"],["\uc2dc","Ti"],["(\ub192\uc740)\ub3c4","H_Do"],["(\ub192\uc740)\ub3c4#","H_Do#"],["(\ub192\uc740)\ub808","H_Re"],["(\ub192\uc740)\ub808#","H_Re#"],["(\ub192\uc740)\ubbf8#","H_Mi"],["(\ub192\uc740)\ud30c","H_Fa"]], +fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["Do"],type:"cobl_melody"},paramsKeyMap:{MELODY:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getStringField("MELODY");Entry.hw.setDigitalPortValue("Melody",d);Entry.hw.update();delete Entry.hw.sendQueue.Melody;return a.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3 %4",params:[{type:"Dropdown",options:[["1","1"], +["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.\uc2dc\uacc4\ubc29\ud5a5","1"],["2.\ubc18\uc2dc\uacc4\ubc29\ud5a5","2"],["3.\uc815\uc9c0","3"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:1,SPEED:2},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getStringField("MOTOR"),c=a.getStringField("DIRECTION"), +e=a.getStringField("SPEED");1==d&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",e),Entry.hw.update(),delete Entry.hw.sendQueue.DC1_DIR,delete Entry.hw.sendQueue.DC1_SPEED);2==d&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",e),Entry.hw.update(),delete Entry.hw.sendQueue.DC2_DIR,delete Entry.hw.sendQueue.DC2_SPEED);return a.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2 %3", +params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","0"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:1},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getStringField("PORT"),c=a.getStringField("LEVEL");1==d&&(Entry.hw.setDigitalPortValue("EXUSB1",c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB1); +2==d&&(Entry.hw.setDigitalPortValue("EXUSB2",c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB2);return a.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4 %5",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3", +"3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:1,GREEN:2,BLUE:3},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getNumberField("LED"),c=a.getStringField("RED"), +e=a.getStringField("GREEN"),f=a.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",d);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",e);Entry.hw.setDigitalPortValue("ELED_B",f);Entry.hw.update();delete Entry.hw.sendQueue.ELED_IDX;delete Entry.hw.sendQueue.ELED_R;delete Entry.hw.sendQueue.ELED_G;delete Entry.hw.sendQueue.ELED_B;return a.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999) %2", +params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"cobl",isNotFor:["cobl"],func:function(b,a){var d=a.getNumberField("VALUE");Entry.hw.setDigitalPortValue("7SEG",d);Entry.hw.update();delete Entry.hw.sendQueue["7SEG"];return a.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null], +type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.start_drawing()"]}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b, +a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()},syntax:{js:[],py:["Entry.stop_drawing()"]}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var d=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(d=Entry.hex2rgb(d),b.brush.rgb=d,b.brush.endStroke(), +b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color(%1)"]}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var d= +Entry.generateRgb();b.brush.rgb=d;b.brush.endStroke();b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_color_random()"]}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0}, +"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=d,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_size(%1)"]}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=d,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.set_brush_size(%1)"]}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity+d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+ +d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), +b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:[""]}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"], +func:function(b,a){var d=b.brush;if(d){var c=d._stroke.style,e=d._strokeStyle.width;d.clear().setStrokeStyle(e).beginStroke(c);d.moveTo(b.getX(),-1*b.getY())}d=b.parent.getStampEntities();d.map(function(a){a.removeClone()});d=null;return a.callReturn()},syntax:{js:[],py:["Entry.clear_drawing()"]}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], +func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()},syntax:{js:[],py:["Entry.stamp()"]}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), +b.brush.stop=!0);d=Entry.adjustValueWithMaxMin(b.brush.opacity-d,0,100);b.brush&&(b.brush.opacity=d,b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[],py:["Entry.add_brush_transparency(%1)"]}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{}, +def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(d,0,100),b.brush.endStroke(),d=b.brush.rgb,b.brush.beginStroke("rgba("+d.r+","+d.g+","+d.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()},syntax:{js:[], py:["Entry.set_brush_transparency(%1)"]}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0,syntax:{js:["Scope","%1"],py:["%1number#"]}},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}, syntax:{js:[],py:["%1angle#"]}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()},syntax:{js:[],py:[""]}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()},syntax:{js:[],py:[""]}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))},syntax:{js:[],py:[""]}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value, "ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))},syntax:{js:[],py:[""]}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1, -color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){a=a.getField("VALUE",a);if("mouse"==a)return a=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-a.x,2)+Math.pow(b.getY()-a.y,2));a=Entry.container.getEntity(a); -return Math.sqrt(Math.pow(b.getX()-a.getX(),2)+Math.pow(b.getY()-a.getY(),2))},syntax:{js:[],py:["Entry.value_of_distance(%2)"]}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null, -null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1},"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)},syntax:{js:[],py:["Entry.coordinate_of_mouse(%2)"]}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, +color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);if("mouse"==d)return d=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-d.x,2)+Math.pow(b.getY()-d.y,2));d=Entry.container.getEntity(d); +return Math.sqrt(Math.pow(b.getX()-d.getX(),2)+Math.pow(b.getY()-d.getY(),2))},syntax:{js:[],py:["Entry.value_of_distance(%2)"]}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null, +null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1},"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y},syntax:{js:[],py:["Entry.coordinate_of_mouse(%2)"]}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, {type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], -events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return b.getX();case "y":return b.getY();case "rotation":return b.getRotation();case "direction":return b.getDirection();case "picture_index":return a=b.parent,a=a.pictures,a.indexOf(b.picture)+1;case "size":return Number(b.getSize().toFixed(1)); -case "picture_name":return a=b.parent,a=a.pictures,a[a.indexOf(b.picture)].name}},syntax:{js:[],py:["Entry.value_of(%2, %4)"]}},calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"}, -defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){b=a.getField("OPERATOR", -a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"PLUS"==b?c+a:"MINUS"==b?c-a:"MULTI"==b?c*a:c/a},syntax:{js:[],py:["(%1 %2calc_basic# %3)"]}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND", -a);return b+a},syntax:{js:[],py:[""]}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b-a},syntax:{js:[],py:[""]}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", -accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b*a},syntax:{js:[],py:[""]}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0, -RIGHTHAND:2},func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b/a},syntax:{js:[],py:[""]}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0, -RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b%a},syntax:{js:[],py:["Entry.get_remainder(%1, %3)"]}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}, -null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return Math.floor(b/a)},syntax:{js:[],py:[""]}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square, -"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos,"acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor, -"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getField("VALUE",a); -if(-1<["asin_radian","acos_radian"].indexOf(a)&&(1b))throw Error("x range exceeded");a.indexOf("_")&&(a=a.split("_")[0]);-1<["sin","cos","tan"].indexOf(a)&&(b=Entry.toRadian(b));switch(a){case "square":a=b*b;break;case "factorial":a=Entry.factorial(b);break;case "root":a=Math.sqrt(b);break;case "log":a=Math.log(b)/Math.LN10;break;case "ln":a=Math.log(b);break;case "asin":case "acos":case "atan":a=Entry.toDegrees(Math[a](b));break;case "unnatural":a=b-Math.floor(b);0>b&&(a=1-a);break;default:a= -Math[a](b)}return a},syntax:{js:[],py:["Entry.value_of_math_operation(%2, %4)"]}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]}, -null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);var c=Math.min(b,a),d=Math.max(b,a);b=Entry.isFloat(b);return Entry.isFloat(a)||b?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)},syntax:{js:[],py:["random.randint(%2, %4)"]}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"}, -{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date", -isNotFor:[],func:function(b,a){b=a.getField("VALUE",a);a=new Date;return"YEAR"==b?a.getFullYear():"MONTH"==b?a.getMonth()+1:"DAY"==b?a.getDate():"HOUR"==b?a.getHours():"MINUTE"==b?a.getMinutes():a.getSeconds()},syntax:{js:[],py:["Entry.value_of_date_time(%2)"]}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(b,a){a=a.getField("VALUE",a);b=b.parent.sounds;for(var c=0;ca||a>b.length-1)throw Error();return b[a]},syntax:{js:[],py:["Entry.string_index_of(%2, %4)"]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"}, -{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length},syntax:{js:[],py:["Entry.string_length(%2)"]}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"}, -{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string", -isNotFor:[],func:function(b,a){b=a.getStringValue("STRING",a);var c=a.getNumberValue("START",a)-1;a=a.getNumberValue("END",a)-1;var d=b.length-1;if(0>c||0>a||c>d||a>d)throw Error();return b.substring(Math.min(c,a),Math.max(c,a)+1)},syntax:{js:[],py:["Entry.string_substring(%2, %4, %6)"]}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b, -a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))},syntax:{js:[],py:["Entry.string_replace(%2, %4, %6)"]}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1, -"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()},syntax:{js:[],py:["Entry.string_case(%2, %4)"]}}, -index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"}, -paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){b=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);a=b.indexOf(a);return-1b)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(b)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)},syntax:{js:[],py:["for i in range(%1):\n$1"]}},repeat_inf:{color:"#498deb",skeleton:"basic_loop", -statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")},syntax:{js:[],py:["while True:\n$1"]}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b, -a){return this.executor.breakLoop()},syntax:{js:[],py:["break"]}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a},syntax:{js:[],py:["Entry.wait_until(%1)"]}},_if:{color:"#498deb",skeleton:"basic_loop", -statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()},syntax:{js:[],py:["if %1:\n$1"]}},if_else:{color:"#498deb",skeleton:"basic_double_loop", -statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();b=a.getBooleanValue("BOOL",a);a.isCondition=!0;return b?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE", -a)},syntax:{js:[],py:["if %1:\n$1\nelse:\n$2"]}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);a=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null): -Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return a},syntax:{js:[],py:["Entry.create_clone(%1)"]}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()},syntax:{js:[],py:["Entry.remove_clone()"]}},when_clone_start:{color:"#498deb", -skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start",syntax:{js:[],py:["def entry_event_clone_create():"]}},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b, -a){return Entry.engine.toggleStop()},syntax:{js:[],py:[""]}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"}, -paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){b=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(b=!b);return(a.isLooped=b)?a.getStatement("DO",a):a.callReturn()},syntax:{js:[],py:["not yet supported in textcoding"]}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread, -"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.mapObject(function(a){a.script.clearExecutors()},null),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;b=b.parent.script;for(var d=b.executors,e=0;ea.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,b.leftWheel=45+.25*c,b.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;a.boardState=3;var d=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c= -c.leftFloor-c.rightFloor;b.leftWheel=45+.25*c;b.rightWheel=45-.25*c;break;case 4:b.leftWheel=0,b.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;b.leftWheel=0;b.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;b.leftWheel=45;b.rightWheel=45;Entry.Hamster.setLineTracerMode(b,0);return a},syntax:{js:[],py:["Hamster.move_forward()"]}},hamster_turn_once:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2> -a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50c.rightFloor&&(a.boardState= -3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.add_tempo(%1)"]}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b, -a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.set_tempo(%1)"]}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output, -"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT",a),d=Number(a.getField("MODE",a));"A"==c?b.ioModeA=d:("B"!=c&&(b.ioModeA=d),b.ioModeB=d);return a.callReturn()},syntax:{js:[],py:["Hamster.set_port(%1, %2)"]}}, -hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b, -a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=void 0!=b.outputA?b.outputA+d:d:("B"!=c&&(b.outputA=void 0!=b.outputA?b.outputA+d:d),b.outputB=void 0!=b.outputB?b.outputB+d:d);return a.callReturn()},syntax:{js:[],py:["Hamster.add_output(%1, %2)"]}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]], -value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){b=Entry.hw.sendQueue;var c=a.getField("PORT"),d=a.getNumberValue("VALUE");"A"==c?b.outputA=d:("B"!=c&&(b.outputA=d),b.outputB=d);return a.callReturn()},syntax:{js:[],py:["Hamster.set_output(%1, %2)"]}}, -is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"},"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick},syntax:{js:[],py:["Entry.is_mouse_clicked()"]}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2, -color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){b=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(b)},syntax:{js:[],py:["Entry.is_pressed(%1)"]}},reach_something:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a);a=b.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision;if(d)switch(b=Entry.stage.wall,c){case "wall":return!!(e(a,b.up,.2,!0)||e(a,b.down,.2,!0)||e(a,b.left,.2,!0)||e(a,b.right, -.2,!0));case "wall_up":return!!e(a,b.up,.2,!0);case "wall_down":return!!e(a,b.down,.2,!0);case "wall_right":return!!e(a,b.right,.2,!0);case "wall_left":return!!e(a,b.left,.2,!0)}else{if("mouse"==c)return e=Entry.stage.canvas,e=a.globalToLocal(e.mouseX,e.mouseY),a.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){e=c.object.getTransformedBounds();a=a.getTransformedBounds();if(Entry.checkCollisionRect(a,e))return!0;b=c.parent.clonedEntities;c=0;for(d=b.length;c< -d;c++){var f=b[c];if(!f.isStamp&&f.getVisible()&&Entry.checkCollisionRect(a,f.object.getTransformedBounds()))return!0}}else{if(c.getVisible()&&e(a,c.object,.2,!0))return!0;b=c.parent.clonedEntities;c=0;for(d=b.length;c","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){b=a.getField("OPERATOR",a);var c=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==b?c==a:"BIGGER"==b?c>a:c", -color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b>a},syntax:{js:[],py:[""]}},boolean_smaller:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"}, -{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getNumberValue("LEFTHAND",a);a=a.getNumberValue("RIGHTHAND",a);return b","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text", -params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text", -params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){b=a.getField("OPERATOR",a);var c=a.getStringValue("LEFTHAND",a);a=a.getStringValue("RIGHTHAND",a);switch(b){case "EQUAL":return c==a;case "GREATER":return Number(c)>Number(a);case "LESS":return Number(c)=Number(a);case "LESS_OR_EQUAL":return Number(c)<= -Number(a)}},syntax:{js:[],py:["(%1 %2boolean_compare# %3)"]}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show()"]}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"}, -"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()},syntax:{js:[],py:["Entry.hide()"]}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]}, -{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}if(0==a.timeFlag)return delete a.timeFlag, -delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(b,d,e),b.syncDialogVisible(b.getVisible()));return a},syntax:{js:[],py:["Entry.print_for_seconds(%1, %2, %3)"]}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()},syntax:{js:[], +events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),d="self"==d?b:Entry.container.getEntity(d);switch(a.getField("COORDINATE",a)){case "x":return d.getX();case "y":return d.getY();case "rotation":return d.getRotation();case "direction":return d.getDirection();case "picture_index":var c=d.parent,c=c.pictures;return c.indexOf(d.picture)+1;case "size":return+d.getSize().toFixed(1); +case "picture_name":return c=d.parent,c=c.pictures,c[c.indexOf(d.picture)].name}},syntax:{js:[],py:["Entry.value_of(%2, %4)"]}},calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"}, +defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getField("OPERATOR", +a),c=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==d?c+e:"MINUS"==d?c-e:"MULTI"==d?c*e:c/e},syntax:{js:[],py:["(%1 %2calc_basic# %3)"]}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND", +a);return d+c},syntax:{js:[],py:[""]}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d-c},syntax:{js:[],py:[""]}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", +accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d*c},syntax:{js:[],py:[""]}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0, +RIGHTHAND:2},func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d/c},syntax:{js:[],py:[""]}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0, +RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d%c},syntax:{js:[],py:["Entry.get_remainder(%1, %3)"]}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}, +null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return Math.floor(d/c)},syntax:{js:[],py:[""]}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown", +options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos,"acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural, +"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var d= +a.getNumberValue("LEFTHAND",a),c=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(c)&&(1d))throw Error("x range exceeded");c.indexOf("_")&&(c=c.split("_")[0]);-1<["sin","cos","tan"].indexOf(c)&&(d=Entry.toRadian(d));var e=0;switch(c){case "square":e=d*d;break;case "factorial":e=Entry.factorial(d);break;case "root":e=Math.sqrt(d);break;case "log":e=Math.log(d)/Math.LN10;break;case "ln":e=Math.log(d);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[c](d));break; +case "unnatural":e=d-Math.floor(d);0>d&&(e=1-e);break;default:e=Math[c](d)}return e},syntax:{js:[],py:["Entry.value_of_math_operation(%2, %4)"]}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null, +{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b,a){var d=a.getStringValue("LEFTHAND",a),c=a.getStringValue("RIGHTHAND",a),e=Math.min(d,c),f=Math.max(d,c),d=Entry.isFloat(d);return Entry.isFloat(c)||d?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)},syntax:{js:[],py:["random.randint(%2, %4)"]}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null, +"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),c=new Date;return"YEAR"==d?c.getFullYear():"MONTH"==d?c.getMonth()+1:"DAY"==d?c.getDate():"HOUR"==d?c.getHours():"MINUTE"==d?c.getMinutes():c.getSeconds()},syntax:{js:[],py:["Entry.value_of_date_time(%2)"]}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"}, +{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(b,a){for(var d=a.getField("VALUE",a),c=b.parent.sounds,e=0;ec||c>d.length-1)throw Error();return d[c]},syntax:{js:[],py:["Entry.string_index_of(%2, %4)"]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", +text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length},syntax:{js:[],py:["Entry.string_length(%2)"]}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", +text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"}, +paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b,a){var d=a.getStringValue("STRING",a),c=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=d.length-1;if(0>c||0>e||c>f||e>f)throw Error();return d.substring(Math.min(c,e),Math.max(c,e)+1)},syntax:{js:[],py:["Entry.string_substring(%2, %4, %6)"]}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block", +accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1, +OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))},syntax:{js:[],py:["Entry.string_replace(%2, %4, %6)"]}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2, +color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING", +a)[a.getField("CASE",a)]()},syntax:{js:[],py:["Entry.string_case(%2, %4)"]}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]}, +null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var d=a.getStringValue("LEFTHAND",a),c=a.getStringValue("RIGHTHAND",a),d=d.indexOf(c);return-1d)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(d)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO", +a)},syntax:{js:[],py:["for i in range(%1):\n$1"]}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")},syntax:{js:[],py:["while True:\n$1"]}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png", +size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()},syntax:{js:[],py:["break"]}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)? +a.callReturn():a},syntax:{js:[],py:["Entry.wait_until(%1)"]}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK", +a)):a.callReturn()},syntax:{js:[],py:["if %1:\n$1"]}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn(); +var d=a.getBooleanValue("BOOL",a);a.isCondition=!0;return d?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)},syntax:{js:[],py:["if %1:\n$1\nelse:\n$2"]}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[], +func:function(b,a){var d=a.getField("VALUE",a),c=a.callReturn();"self"==d?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(d).addCloneEntity(b.parent,null,null);return c},syntax:{js:[],py:["Entry.create_clone(%1)"]}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn(); +b.removeClone();return this.die()},syntax:{js:[],py:["Entry.remove_clone()"]}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start",syntax:{js:[],py:["def entry_event_clone_create():"]}},stop_run:{color:"#498deb",skeleton:"basic",statements:[], +params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()},syntax:{js:[],py:[""]}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", +img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var d=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(d=!d);return(a.isLooped=d)?a.getStatement("DO",a):a.callReturn()},syntax:{js:[],py:["not yet supported in textcoding"]}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all, +"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var d=a.getField("TARGET",a),c=Entry.container;switch(d){case "all":return c.mapObject(function(a){a.script.clearExecutors()}, +null),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var d=this.executor,c=b.parent.script,e=c.executors,f=0;fa.count?(50>c.leftFloor&&50>c.rightFloor?a.count++:a.count=0,c=c.leftFloor-c.rightFloor,d.leftWheel=45+.25*c,d.rightWheel=45-.25*c):(a.count=0,a.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;d.leftWheel=45+.25*c;d.rightWheel=45-.25*c;a.boardState=3;var e= +setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:c=c.leftFloor-c.rightFloor;d.leftWheel=45+.25*c;d.rightWheel=45-.25*c;break;case 4:d.leftWheel=0,d.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;d.leftWheel=0;d.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;d.leftWheel=45;d.rightWheel=45;Entry.Hamster.setLineTracerMode(d, +0);return a},syntax:{js:[],py:["Hamster.move_forward()"]}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var d=Entry.hw.sendQueue, +c=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50c.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count? +50c.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>c.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.add_tempo(%1)"]}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]}, +null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()},syntax:{js:[],py:["Hamster.set_tempo(%1)"]}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11}, +{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT", +a),e=+a.getField("MODE",a);"A"==c?d.ioModeA=e:("B"!=c&&(d.ioModeA=e),d.ioModeB=e);return a.callReturn()},syntax:{js:[],py:["Hamster.set_port(%1, %2)"]}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, +{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==c?d.outputA=void 0!=d.outputA?d.outputA+e:e:("B"!=c&&(d.outputA=void 0!=d.outputA?d.outputA+e:e),d.outputB=void 0!=d.outputB?d.outputB+e:e);return a.callReturn()},syntax:{js:[],py:["Hamster.add_output(%1, %2)"]}},hamster_set_output_to:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var d=Entry.hw.sendQueue,c=a.getField("PORT"),e=a.getNumberValue("VALUE"); +"A"==c?d.outputA=e:("B"!=c&&(d.outputA=e),d.outputB=e);return a.callReturn()},syntax:{js:[],py:["Hamster.set_output(%1, %2)"]}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"},"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick},syntax:{js:[],py:["Entry.is_mouse_clicked()"]}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field", +statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var d=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(d)},syntax:{js:[],py:["Entry.is_pressed(%1)"]}},reach_something:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1, +color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var d=a.getField("VALUE",a),c=b.object,e=/wall/.test(d),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,d){case "wall":return!!(f(c, +e.up,.2,!0)||f(c,e.down,.2,!0)||f(c,e.left,.2,!0)||f(c,e.right,.2,!0));case "wall_up":return!!f(c,e.up,.2,!0);case "wall_down":return!!f(c,e.down,.2,!0);case "wall_right":return!!f(c,e.right,.2,!0);case "wall_left":return!!f(c,e.left,.2,!0)}else{if("mouse"==d)return f=Entry.stage.canvas,f=c.globalToLocal(f.mouseX,f.mouseY),c.hitTest(f.x,f.y);d=Entry.container.getEntity(d);if("textBox"==d.type||"textBox"==b.type){f=d.object.getTransformedBounds();c=c.getTransformedBounds();if(Entry.checkCollisionRect(c, +f))return!0;for(var d=d.parent.clonedEntities,e=0,g=d.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var d=a.getField("OPERATOR",a),c=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"EQUAL"==d?c==e:"BIGGER"==d?c>e:c",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d>c},syntax:{js:[],py:[""]}},boolean_smaller:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[], +params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var d=a.getNumberValue("LEFTHAND",a),c=a.getNumberValue("RIGHTHAND",a);return d","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block", +accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL", +{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var d=a.getField("OPERATOR",a),c=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(d){case "EQUAL":return c==e;case "GREATER":return+c>+e;case "LESS":return+c<+e;case "GREATER_OR_EQUAL":return+c>=+e; +case "LESS_OR_EQUAL":return+c<=+e}},syntax:{js:[],py:["(%1 %2boolean_compare# %3)"]}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show()"]}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{}, +def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()},syntax:{js:[],py:["Entry.hide()"]}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text", +params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var d=a.getNumberValue("SECOND",a),c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;c||"number"==typeof c||(c=" ");c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*d)}if(0==a.timeFlag)return delete a.timeFlag, +delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(c=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),c||"number"==typeof c||(c=" "),c=Entry.convertToRoundedDecimals(c,3),new Entry.Dialog(b,c,e),b.syncDialogVisible(b.getVisible()));return a},syntax:{js:[],py:["Entry.print_for_seconds(%1, %2, %3)"]}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var d=a.getStringValue("VALUE",a);d||"number"==typeof d||(d=" ");var c=a.getField("OPTION",a),d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,c);b.syncDialogVisible(b.getVisible());return a.callReturn()},syntax:{js:[], py:["Entry.print(%1)"]}},remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()},syntax:{js:[],py:["Entry.print_remove()"]}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator", -img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()},syntax:{js:[],py:[""]}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_shape_of(%1)"]}},set_effect_volume:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a); -"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:["Entry.add_effect(%1, %2)"]}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter(!0); +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),d=b.parent.getPicture(d);b.setImage(d);return a.callReturn()},syntax:{js:[],py:[""]}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var d;d="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_shape_of(%1)"]}},set_effect_volume:{color:"#EC4466",skeleton:"basic", +statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a); +"color"==d?b.effect.hue=c+b.effect.hue:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c+b.effect.brightness:"blur"!=d&&"opacity"==d&&(b.effect.alpha+=c/100));b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:["Entry.add_effect(%1, %2)"]}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c:"lens"!=d&&"swriling"!=d&&"pixel"!=d&&"mosaic"!=d&&("brightness"==d?b.effect.brightness=c:"blur"!=d&&"opacity"==d&&(b.effect.alpha=c/100));b.applyFilter(!0); return a.callReturn()},syntax:{js:[],py:["Entry.set_effect(%1, %2)"]}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()},syntax:{js:[],py:["Entry.clear_effect()"]}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()},syntax:{js:[],py:[""]}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()},syntax:{js:[],py:[""]}},change_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()},syntax:{js:[],py:["Entry.add_size(%1)"]}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0}, -"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_size(%1)"]}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()},syntax:{js:[],py:["Entry.flip_vertical()"]}},flip_x:{color:"#EC4466",skeleton:"basic", +{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*d);b.setScaleY(b.getScaleY()*d);return a.callReturn()},syntax:{js:[],py:[""]}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a)/100,c=b.snapshot_;b.setScaleX(d*c.scaleX);b.setScaleY(d*c.scaleY);return a.callReturn()},syntax:{js:[],py:[""]}},change_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+d);return a.callReturn()},syntax:{js:[],py:["Entry.add_size(%1)"]}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0}, +"class":"scale",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setSize(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_size(%1)"]}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()},syntax:{js:[],py:["Entry.flip_vertical()"]}},flip_x:{color:"#EC4466",skeleton:"basic", statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()},syntax:{js:[],py:["Entry.flip_horizontal()"]}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"set_object_order"},paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1b)throw Error("object is not available for current scene");switch(d){case "FRONT":c= -0;break;case "FORWARD":c=Math.max(0,b-1);break;case "BACKWARD":c=Math.min(e,b+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(b,c);return a.callReturn()},syntax:{js:[],py:["Entry.set_layer(%1)"]}},move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move(%1)"]}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_x(%1)"]}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null], -type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_y(%1)"]}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount= -Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"}, -paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0}, -"class":"ebs",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()},syntax:{js:[],py:[""]}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c); -return a.callReturn()},syntax:{js:[],py:[""]}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI* -180+270);return a.callReturn()},syntax:{js:[],py:[""]}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a); -b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_xy(%1, %2)"]}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c); -b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_x(%1)"]}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_y(%1)"]}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func: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(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()},syntax:{js:[],py:["Entry.set_location(%1)"]}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, -def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount= -Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"}, -paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:[""]}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=b.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+ -180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision= -Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360> -d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"== -c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()},syntax:{js:[],py:["Entry.bounce_wall()"]}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]}, +a){var d=a.getField("EFFECT",a),c=a.getNumberValue("VALUE",a);"color"==d?b.effect.hue=c:"brightness"==d?b.effect.brightness=c:"transparency"==d&&(b.effect.alpha=1-c/100);b.applyFilter(!0);return a.callReturn()},syntax:{js:[],py:[""]}},change_object_index:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_object_index_sub_1,"FRONT"],[Lang.Blocks.LOOKS_change_object_index_sub_2,"FORWARD"],[Lang.Blocks.LOOKS_change_object_index_sub_3,"BACKWARD"], +[Lang.Blocks.LOOKS_change_object_index_sub_4,"BACK"]],value:"FRONT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_object_index"},paramsKeyMap:{LOCATION:0},"class":"z-index",isNotFor:[],func:function(b,a){var d,c=a.getField("LOCATION",a),e=Entry.container.getCurrentObjects(),f=e.indexOf(b.parent),e=e.length-1;if(0>f)throw Error("object is not available for current scene");switch(c){case "FRONT":d= +0;break;case "FORWARD":d=Math.max(0,f-1);break;case "BACKWARD":d=Math.min(e,f+1);break;case "BACK":d=e}Entry.container.moveElementByBlock(f,d);return a.callReturn()},syntax:{js:[],py:["Entry.set_layer(%1)"]}},move_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[], +func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move(%1)"]}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(b.getX()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_x(%1)"]}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null], +type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(b.getY()+d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_y(%1)"]}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, +def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function d(){var d=a.x-b.getX(),c=a.y-b.getY(),d=d/a.frameCount,c=c/a.frameCount;b.setX(b.getX()+d);b.setY(b.getY()+c);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount= +Math.max(Math.floor(c*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"}, +paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+d);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0}, +"class":"ebs",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +d);return a.callReturn()},syntax:{js:[],py:[""]}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d); +return a.callReturn()},syntax:{js:[],py:[""]}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var d=a.getField("VALUE",a),c=Entry.container.getEntity(d),d=c.getX()-b.getX(),c=c.getY()-b.getY();0<=d?b.setRotation(Math.atan(c/d)/Math.PI*180+90):b.setRotation(Math.atan(c/d)/Math.PI* +180+270);return a.callReturn()},syntax:{js:[],py:[""]}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE1",a),c=a.getNumberValue("VALUE2",a); +b.setX(d);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.set_xy(%1, %2)"]}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setX(d); +b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_x(%1)"]}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setY(d);b.brush&&!b.brush.stop&& +b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_y(%1)"]}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),c;"mouse"== +d?(d=Entry.stage.mouseCoordinate.x,c=Entry.stage.mouseCoordinate.y):(c=Entry.container.getEntity(d),d=c.getX(),c=c.getY());b.setX(+d);b.setY(+c);b.brush&&!b.brush.stop&&b.brush.lineTo(d,-1*c);return a.callReturn()},syntax:{js:[],py:["Entry.set_location(%1)"]}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function d(){b.setX(b.getX()+a.dX);b.setY(b.getY()+a.dY);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(c*Entry.FPS), +1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_xy_for_seconds(%1, %2, %3)"]}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1}, +"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var c=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(d*Entry.FPS);a.dAngle=c/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:[""]}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}], +events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var d=b.parent.getRotateMethod(),c="free"==d?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>c&&0<=c||360>c&&270<=c){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+ +180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>c&&90<=c&&(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision= +Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP)));360> +c&&180<=c?(e=b.collision==Entry.Utils.COLLISION.LEFT,c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"== +d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>c&&0<=c&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,c=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c?("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT, +c=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!c&&e&&(b.collision=Entry.Utils.COLLISION.NONE),c&&e&&(c=!1),c&&("free"==d?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()},syntax:{js:[],py:["Entry.bounce_wall()"]}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]}, func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()},syntax:{js:[],py:[""]}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()},syntax:{js:[],py:[""]}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e? -b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()},syntax:{js:[],py:["Entry.look_at_object(%1)"]}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b, -a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()},syntax:{js:[],py:[""]}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0, -TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;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=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)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_location_for_seconds(%1, %2)"]}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_rotation(%1)"]}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"}, -paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation(%1)"]}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()},syntax:{js:[],py:["Entry.set_direction(%1)"]}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection()); -return a.callReturn()},syntax:{js:[],py:["Entry.add_direction(%1)"]}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE", -a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_degree(%1, %2)"]}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"}, -paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation_for_seconds(%1, %2)"]}},direction_relative_duration:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()},syntax:{js:[],py:["Entry.add_direction_for_seconds(%1, %2)"]}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"], -["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){b=a.getStringField("PORT");return Entry.hw.portData[b]},syntax:{js:[],py:["Neobot.sensor_value(%1)"]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", +fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var d=a.getField("VALUE",a),c=b.getX(),e=b.getY();if(b.parent.id==d)return a.callReturn();"mouse"==d?(d=Entry.stage.mouseCoordinate.y,c=Entry.stage.mouseCoordinate.x-c,e=d-e):(d=Entry.container.getEntity(d),c=d.getX()-c,e=d.getY()-e);e=0===c&&0===e? +b.getDirection()+b.getRotation():0<=c?-Math.atan(e/c)/Math.PI*180+90:-Math.atan(e/c)/Math.PI*180+270;c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-c);return a.callReturn()},syntax:{js:[],py:["Entry.look_at_object(%1)"]}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0}, +"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a),c=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+d-c);return a.callReturn()},syntax:{js:[],py:[""]}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b, +a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()},syntax:{js:[],py:[""]}},locate_object_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0, +TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var d,c,e;c=a.getField("TARGET",a);d=a.getNumberValue("VALUE",a);d=Math.floor(d*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=d)"mouse"==c?(c=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(c),c=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=d,a.dX=c/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==c?(c=+e.x,e=+e.y):(e=Entry.container.getEntity(c),c=e.getX(),e=e.getY()),b.setX(c),b.setY(e), +b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.set_location_for_seconds(%1, %2)"]}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}], +events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_rotation(%1)"]}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0}, +"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setRotation(d+b.getRotation());return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation(%1)"]}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var d= +a.getNumberValue("VALUE",a);b.setDirection(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_direction(%1)"]}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a);b.setDirection(d+b.getDirection());return a.callReturn()}, +syntax:{js:[],py:["Entry.add_direction(%1)"]}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a),c=a.getNumberValue("ANGLE",a);b.setX(b.getX()+d*Math.cos((c- +90)/180*Math.PI));b.setY(b.getY()-d*Math.sin((c-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()},syntax:{js:[],py:["Entry.move_degree(%1, %2)"]}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0, +ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function d(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(c*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;return a.callReturn()},syntax:{js:[],py:["Entry.add_rotation_for_seconds(%1, %2)"]}},direction_relative_duration:{color:"#A751E3", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function d(){b.setDirection(b.getDirection()+a.dDirection);a.frameCount--}if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT", +a);a.isStart=!0;a.frameCount=Math.max(Math.floor(c*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&d()}if(0!=a.frameCount)return d(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()},syntax:{js:[],py:["Entry.add_direction_for_seconds(%1, %2)"]}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"], +["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var d=a.getStringField("PORT");return Entry.hw.portData[d]},syntax:{js:[],py:["Neobot.sensor_value(%1)"]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){b=a.getStringField("PORT");b=Entry.hw.portData[b];var c=a.getNumberValue("OMIN",a),d=a.getNumberValue("OMAX",a),e=a.getNumberValue("MIN",a);a=a.getNumberValue("MAX",a);if(c>d)var f=c,c=d,d=f;e>a&&(f=e,e=a,a=f);b=Math.min(a,(a-e)/(d-c)*(b-c)+e);b=Math.max(e,b);return Math.round(b)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", +paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var d=a.getStringField("PORT"),d=Entry.hw.portData[d],c=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(c>e)var h=c,c=e,e=h;f>g&&(h=f,f=g,g=h);d=(g-f)/(e-c)*(d-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=b+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_left(%1, %2)"]}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], +null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var d=a.getNumberField("SPEED"),c=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=d+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_left(%1, %2)"]}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null], type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()},syntax:{js:[],py:["Neobot.stop_left()"]}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown", -options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("SPEED");var c= -a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=b+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_right(%1, %2)"]}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}, +options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var d=a.getNumberField("SPEED"),c= +a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=d+c;return a.callReturn()},syntax:{js:[],py:["Neobot.turn_right(%1, %2)"]}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}, syntax:{js:[],py:["Neobot.stop_right()"]}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30", "6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"}, -paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}b=a.getNumberField("SPEED");var c=a.getNumberField("DIRECTION"),d=a.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=16+b;break;case 2:Entry.hw.sendQueue.DCL=32+b; -Entry.hw.sendQueue.DCR=32+b;break;case 3:Entry.hw.sendQueue.DCL=32+b;Entry.hw.sendQueue.DCR=16+b;break;case 4:Entry.hw.sendQueue.DCL=16+b;Entry.hw.sendQueue.DCR=32+b;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+b;break;case 6:Entry.hw.sendQueue.DCL=16+b,Entry.hw.sendQueue.DCR=0}if(0===d)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*d);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1", +paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("SPEED"),c=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+d;Entry.hw.sendQueue.DCR=16+d;break;case 2:Entry.hw.sendQueue.DCL=32+d; +Entry.hw.sendQueue.DCR=32+d;break;case 3:Entry.hw.sendQueue.DCL=32+d;Entry.hw.sendQueue.DCR=16+d;break;case 4:Entry.hw.sendQueue.DCL=16+d;Entry.hw.sendQueue.DCR=32+d;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+d;break;case 6:Entry.hw.sendQueue.DCL=16+d,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1", params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return a.callReturn()},syntax:{js:[],py:["Neobot.run_motor(%1, %2, %3, %4)"]}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1", -"1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){b=a.getNumberField("PORT");var c=a.getNumberValue("DEGREE");0>c?c=0:180c?c=0:180c?c=0:255b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address= -void 0;return a},syntax:{js:[],py:["Robotis.opencm70_cm_custom_value(%1, %2)"]}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"}, -paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.executor.scope;if(!b.isStart){b.isStart=!0;b.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0;a=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==a?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==a&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();b.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;a=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return a},syntax:{js:[],py:["Robotis.opencm70_sensor_value(%1)"]}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3", +paramsKeyMap:{PORT:0,VALUE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var d=a.getStringField("PORT",a),c=a.getNumberValue("VALUE",a),e=d;0>c?c=0:255d.count)throw d.count++,new Entry.Utils.AsyncError;d.isStart=!1;c=Entry.hw.portData[d.data_default_address]; +d.data_default_address=void 0;return c},syntax:{js:[],py:["Robotis.opencm70_cm_custom_value(%1, %2)"]}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"}, +paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var d=a.executor.scope;if(!d.isStart){d.isStart=!0;d.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): +"CM_SOUND_DETECTING"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==k&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); +g+=0*h;Entry.Robotis_carCont.setRobotisData([[c,e,f,0,h]]);Entry.Robotis_carCont.update();d.data_default_address=g;throw new Entry.Utils.AsyncError;}if(2>d.count)throw d.count++,new Entry.Utils.AsyncError;d.isStart=!1;c=Entry.hw.portData[d.data_default_address];d.data_default_address=void 0;return c},syntax:{js:[],py:["Robotis.opencm70_sensor_value(%1)"]}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3", "PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"], -[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.executor.scope; -if(!b.isStart){b.isStart=!0;b.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=a.getStringField("PORT");a=a.getStringField("SENSOR");var h=0;"PORT_3"==g?h=2:"PORT_4"==g?h=3:"PORT_5"==g?h=4:"PORT_6"==g&&(h=5);"AUX_SERVO_POSITION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], -d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], -d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]): -"AUX_ULTRASONIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], -d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==a?(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==a&&(e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);e+=h*f;Entry.Robotis_carCont.setRobotisData([[c,e,d,0,f]]);Entry.Robotis_carCont.update(); -b.data_default_address=e;console.log(e);throw new Entry.Utils.AsyncError;}if(2>b.count)throw b.count++,new Entry.Utils.AsyncError;b.isStart=!1;c=Entry.hw.portData[b.data_default_address];b.data_default_address=void 0;return c},syntax:{js:[],py:["Robotis.opencm70_aux_sensor_value(%1, %2)"]}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"], +[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var d=a.executor.scope; +if(!d.isStart){d.isStart=!0;d.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=a.getStringField("PORT"),k=a.getStringField("SENSOR"),l=0;"PORT_3"==h?l=2:"PORT_4"==h?l=3:"PORT_5"==h?l=4:"PORT_6"==h&&(l=5);"AUX_SERVO_POSITION"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]): +"AUX_ULTRASONIC"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==k?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==k&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=l*g;Entry.Robotis_carCont.setRobotisData([[c,f,e,0,g]]);Entry.Robotis_carCont.update(); +d.data_default_address=f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>d.count)throw d.count++,new Entry.Utils.AsyncError;d.isStart=!1;c=Entry.hw.portData[d.data_default_address];d.data_default_address=void 0;return c},syntax:{js:[],py:["Robotis.opencm70_aux_sensor_value(%1, %2)"]}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"], [Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"], [Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+ "(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+ -"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b= -a.getField("CM_BUZZER_INDEX",a);var c=a.getNumberValue("CM_BUZZER_TIME",a),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50c&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_servo_position(%1, %2)"]}},robotis_openCM70_aux_led_module:{color:"#00979D", +isNotFor:["robotis_openCM70"],func:function(b,a){var d=a.getField("PORT",a),c=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(d-1)*g,g,c]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_servo_position(%1, %2)"]}},robotis_openCM70_aux_led_module:{color:"#00979D", skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+ -Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.getField("PORT",a);var c=a.getField("LED_MODULE",a),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; -return Entry.Robotis_carCont.postCallReturn(a,[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_led_module(%1, %2)"]}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){b=a.getField("PORT",a);var c=a.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a, -[[d,e+(b-1)*f,f,c]],Entry.Robotis_openCM70.delay)},syntax:{js:[],py:["Robotis.opencm70_aux_custom(%1, %2)"]}},robotis_openCM70_cm_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom", -isNotFor:["robotis_openCM70"],func:function(b,a){b=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var c,d;c=a.getNumberValue("ADDRESS");d=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[b,c,65535b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()},syntax:{js:[],py:["Entry.add_volume(%1)"]}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"}, -paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){b=a.getNumberValue("VALUE",a)/100;1b&&(b=0);createjs.Sound.setVolume(b);return a.callReturn()},syntax:{js:[],py:["Entry.set_volume(%1)"]}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}, -syntax:{js:[],py:["Entry.stop_sound()"]}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")},syntax:{js:[],py:["%1get_sounds#"]}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id);return a.callReturn()},syntax:{js:[],py:["Entry.play_sound(%1)"]}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(b=b.parent.getSound(c))&&createjs.Sound.play(b.id,{startTime:0,duration:1E3*d});return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_for_seconds(%1, %2)"]}}, -sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b= -b.parent.getSound(c))createjs.Sound.play(b.id),setTimeout(function(){a.playState=0},1E3*b.duration);return a},syntax:{js:[],py:["Entry.play_sound_and_wait(%1)"]}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"}, -paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=createjs.Sound.play(b.id);b=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*b);d.addEventListener("complete",function(a){})}return a},syntax:{js:[],py:["Entry.play_sound_for_seconds_and_wait(%1, %2)"]}}, -sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var c= -1E3*a.getNumberValue("START",a),d=1E3*a.getNumberValue("END",a);createjs.Sound.play(b.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_from_to_seconds(%1, %2, %3)"]}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(b=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(b.id,{startTime:c, -duration:d});setTimeout(function(){a.playState=0},d)}return a},syntax:{js:[],py:["Entry.play_sound_from_to_seconds_and_wait(%1, %2, %3)"]}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start",syntax:{js:[],py:["def entry_event_start():"]}},press_some_key:{color:"#3BBD70", -skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator", -img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1},func:function(b,a){return a.callReturn()},syntax:{js:[],py:[""]}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b, -a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["def entry_event_key(%2):"]}},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked",syntax:{js:[],py:["def entry_event_mouse_down():"]}},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event", -statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_click_cancled",syntax:{js:[],py:["def entry_event_mouse_up():"]}},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null], -type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click",syntax:{js:[],py:["def entry_event_object_down():"]}},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled", -syntax:{js:[],py:["def entry_event_object_up():"]}},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["Entry.on_key_press_down(%1)"]}},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17, -position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b,a){return a.callReturn()},event:"when_message_cast",syntax:{js:[], -py:["def entry_event_signal(%2):"]}},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"},paramsKeyMap:{VALUE:0}, -"class":"message",isNotFor:["message"],func:function(b,a){b=a.getField("VALUE",a);var c=Entry.isExist(b,"id",Entry.variableContainer.messages_);if("null"==b||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",b]);return a.callReturn()},syntax:{js:[],py:["Entry.send_signal(%1)"]}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){b=a.runningScript;for(var c=b.length,d=0;db.array_.length)throw Error("can not remove value from array");b.array_.splice(d-1,1);b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.pop(%1)"]}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)||0== -e||e>b.array_.length+1)throw Error("can not insert value to array");b.array_.splice(e-1,0,{data:d});b.updateView();return a.callReturn()},syntax:{js:[],py:["%2.insert(%3, %1)"]}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);if(!b.array_||isNaN(e)|| -e>b.array_.length)throw Error("can not insert value to array");b.array_[e-1].data=d;b.updateView();return a.callReturn()},syntax:{js:[],py:["%1[%2] = %3"]}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2, -color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b, -a){var c=a.getField("LIST",a);a=a.getValue("INDEX",a);b=Entry.variableContainer.getList(c,b);a=Entry.getListRealIndex(a,b);if(!b.array_||isNaN(a)||a>b.array_.length)throw Error("can not insert value to array");return b.array_[a-1].data},syntax:{js:[],py:["%2[%4]"]}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, -{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){a=a.getField("LIST",a);return Entry.variableContainer.getList(a,b).array_.length},syntax:{js:[],py:["len(%2)"]}}, -show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility", -isNotFor:["list","listNotExist"],func:function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show_list(%1)"]}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){b=a.getField("LIST",a);Entry.variableContainer.getList(b).setVisible(!1);return a.callReturn()},syntax:{js:[],py:["Entry.hide_list(%1)"]}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8", -"FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)},syntax:{js:[],py:[""]}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", -img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.answer_mode(%1)"]}}, -is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer; -a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);a=a.getStringValue("DATA",a);b=Entry.variableContainer.getList(c,b);if(!b)return!1;b=b.array_;for(var c=0,d=b.length;cd&&(d=0);createjs.Sound.setVolume(d);return a.callReturn()},syntax:{js:[],py:["Entry.add_volume(%1)"]}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var d=a.getNumberValue("VALUE",a)/100;1d&&(d=0);createjs.Sound.setVolume(d);return a.callReturn()},syntax:{js:[],py:["Entry.set_volume(%1)"]}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}], +events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()},syntax:{js:[],py:["Entry.stop_sound()"]}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}, +syntax:{js:[],py:["%1get_sounds#"]}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(b,a){var d=a.getStringValue("VALUE",a);(d=b.parent.getSound(d))&&createjs.Sound.play(d.id);return a.callReturn()},syntax:{js:[],py:["Entry.play_sound(%1)"]}}, +sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(b,a){var d=a.getStringValue("VALUE",a),c=a.getNumberValue("SECOND",a);(d=b.parent.getSound(d))&& +createjs.Sound.play(d.id,{startTime:0,duration:1E3*c});return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_for_seconds(%1, %2)"]}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a; +delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d))createjs.Sound.play(d.id),setTimeout(function(){a.playState=0},1E3*d.duration);return a},syntax:{js:[],py:["Entry.play_sound_and_wait(%1)"]}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{}, +def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=createjs.Sound.play(d.id),d=a.getNumberValue("SECOND",a);setTimeout(function(){c.stop();a.playState=0},1E3*d);c.addEventListener("complete", +function(a){})}return a},syntax:{js:[],py:["Entry.play_sound_for_seconds_and_wait(%1, %2)"]}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[], +func:function(b,a){var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(d.id,{startTime:Math.min(c,e),duration:Math.max(c,e)-Math.min(c,e)})}return a.callReturn()},syntax:{js:[],py:["Entry.play_sound_from_to_seconds(%1, %2, %3)"]}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var d=a.getStringValue("VALUE",a);if(d=b.parent.getSound(d)){var c=1E3*a.getNumberValue("START", +a),e=1E3*a.getNumberValue("END",a),f=Math.min(c,e),c=Math.max(c,e)-f;createjs.Sound.play(d.id,{startTime:f,duration:c});setTimeout(function(){a.playState=0},c)}return a},syntax:{js:[],py:["Entry.play_sound_from_to_seconds_and_wait(%1, %2, %3)"]}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[], +func:function(b,a){return a.callReturn()},event:"start",syntax:{js:[],py:["def entry_event_start():"]}},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"], +["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1},func:function(b,a){return a.callReturn()},syntax:{js:[],py:[""]}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard", +value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["def entry_event_key(%2):"]}},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, +event:"mouse_clicked",syntax:{js:[],py:["def entry_event_mouse_down():"]}},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_click_cancled",syntax:{js:[],py:["def entry_event_mouse_up():"]}},when_object_click:{color:"#3BBD70",skeleton:"basic_event", +statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click",syntax:{js:[],py:["def entry_event_object_down():"]}},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null], +type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled",syntax:{js:[],py:["def entry_event_object_up():"]}},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress",syntax:{js:[],py:["Entry.on_key_press_down(%1)"]}}, +when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"}, +paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b,a){return a.callReturn()},event:"when_message_cast",syntax:{js:[],py:["def entry_event_signal(%2):"]}},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", +b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var d=a.getField("VALUE",a),c=Entry.isExist(d,"id",Entry.variableContainer.messages_);if("null"==d||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",d]);return a.callReturn()},syntax:{js:[], +py:["Entry.send_signal(%1)"]}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"}, +paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var d=a.runningScript,c=d.length,e=0;ed.array_.length)throw Error("can not remove value from array");d.array_.splice(c-1,1);d.updateView();return a.callReturn()},syntax:{js:[],py:["%2.pop(%1)"]}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST", +a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b);if(!d.array_||isNaN(e)||0==e||e>d.array_.length+1)throw Error("can not insert value to array");d.array_.splice(e-1,0,{data:c});d.updateView();return a.callReturn()},syntax:{js:[],py:["%2.insert(%3, %1)"]}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST", +a),c=a.getValue("DATA",a),e=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b);if(!d.array_||isNaN(e)||e>d.array_.length)throw Error("can not insert value to array");d.array_[e-1].data=c;d.updateView();return a.callReturn()},syntax:{js:[],py:["%1[%2] = %3"]}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"}, +paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a),c=a.getValue("INDEX",a),d=Entry.variableContainer.getList(d,b),c=Entry.getListRealIndex(c,d);if(!d.array_||isNaN(c)||c>d.array_.length)throw Error("can not insert value to array");return d.array_[c-1].data},syntax:{js:[],py:["%2[%4]"]}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1, +color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"], +func:function(b,a){var d=a.getField("LIST",a);return Entry.variableContainer.getList(d,b).array_.length},syntax:{js:[],py:["len(%2)"]}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; +a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a);Entry.variableContainer.getList(d).setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.show_list(%1)"]}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", +img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a);Entry.variableContainer.getList(d).setVisible(!1);return a.callReturn()},syntax:{js:[],py:["Entry.hide_list(%1)"]}}, +options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)},syntax:{js:[],py:[""]}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, +"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): +Entry.container.inputValue.setVisible(!0);return a.callReturn()},syntax:{js:[],py:["Entry.answer_mode(%1)"]}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text", +text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var d=a.getField("LIST",a),c=a.getStringValue("DATA",a),d=Entry.variableContainer.getList(d, +b);if(!d)return!1;for(var d=d.array_,e=0,f=d.length;eh&&(h=Math.round(h-155),f=-h,g=0,Entry.dplay.vel_value=f);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5, -0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,f),Entry.hw.setDigitalPortValue(e,g),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var k=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(k)},50);Entry.dplay.timeouts.push(k);return a}},syntax:{js:[],py:["Dplay.dc_motor_speed(%1, %2)"]}}, +VALUE:1},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){var d=0,c=0,e=0,f=0,g=0,h=0,k=0,k=a.getField("PORT");"1"==k?(d=3,c=5):"2"==k?(d=11,c=6):"3"==k&&(d=3,c=5,e=11,f=6);k=a.getNumberValue("VALUE",a);k=Math.max(k,-100);k=Math.min(k,100);0==k?(h=g=0,Entry.dplay.vel_value=h):0k&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5, +0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(d,g),Entry.hw.setDigitalPortValue(c,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}},syntax:{js:[],py:["Dplay.dc_motor_speed(%1, %2)"]}}, dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30",params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown", options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= -!1;return a.callReturn()}b=a.getNumberField("NOTE",a);var c=a.getNumberField("OCTAVE",a),d=a.getNumberValue("VALUE"),c=b+12*(c-1),d=6E4*d/60;a.isStart=!0;a.timeFlag=1;100==b?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,c);if(100n?(l=Math.round(n-155),f=-l,g=0,Entry.dplay.Left_value=f):0==n&&(g=f=0,Entry.dplay.Left_value=0));"2"==m&&(d=6,e=11,0n?(l=Math.round(n-155),h=-l,k=0,Entry.dplay.Right_value=h):0==n&&(k=h=0,Entry.dplay.Right_value=h));"3"==m&&(b=3,c=5,d=6,e=11,0n?(l=Math.round(n-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==n&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(b,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,k),Entry.hw.setDigitalPortValue(e, -h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var q=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(q)},50);Entry.dplay.timeouts.push(q);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=b=0,d=0,e=0,f=0,f=0,f=a.getNumberValue("L_VALUE",a),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),b=-f,c=0,Entry.dplay.Left_value=b):0==f&&(c=b=0,Entry.dplay.Left_value= -0);f=a.getNumberValue("R_VALUE",a);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),d=-f,e=0,Entry.dplay.Right_value=d):0==f&&(e=d=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,b),Entry.hw.setDigitalPortValue(5,c), -Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,d),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var g=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return a}},syntax:{js:[],py:["Dplay.robot_speed_sel(%1, %2)"]}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator", +params:["1"]},null,null],type:"dplay_Robot_run_sec"},paramsKeyMap:{VALUE:0,PORT:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var d=0,c=0,e=0,f=0,g=Entry.dplay.Left_value,h=Entry.dplay.Right_value,k=a.getField("PORT");if(a.isStart){if(1==a.timeFlag)return"1"==k?(d=0,c=g,e=h,f=0):"2"==k?(d=g,e=c=0,f=h):"3"==k?(d=0,c=g,f=e=0):"4"==k&&(c=d=0,e=h,f=0),Entry.hw.setDigitalPortValue(3,d),Entry.hw.setDigitalPortValue(5,c),Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11, +f),a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;f=e=c=d=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var d=1E3*a.getNumberValue("VALUE"),l=setTimeout(function(){a.timeFlag=0;Entry.dplay.removeTimeout(l)},d);Entry.dplay.timeouts.push(l);return a},syntax:{js:[],py:["Dplay.robot_run_sec(%1, %2)"]}},dplay_robot_speed_sel:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"%1 \ubc14\ud034 \uc18d\ub3c4\ub97c %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Dropdown", +options:[["\uc67c\ucabd","1"],["\uc624\ub978\ucabd","2"],["\uc591\ucabd","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"dplay_robot_speed_sel"},paramsKeyMap:{PORT:0,VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var d=0,c=0,e=0,f=0,g=0,h=0,k=0,l=0,m=0,n=a.getField("PORT"),q=a.getNumberValue("VALUE", +a),q=Math.max(q,-100),q=Math.min(q,100);"1"==n&&(d=3,c=5,0q?(m=Math.round(q-155),g=-m,h=0,Entry.dplay.Left_value=g):0==q&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0q?(m=Math.round(q-155),k=-m,l=0,Entry.dplay.Right_value=k):0==q&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(d=3,c=5,e=6,f=11,0q?(m=Math.round(q-155),g=-m,h=0,k=-m,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==q&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(d,g),Entry.hw.setDigitalPortValue(c,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f, +k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var d=0,c=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0g?(g=Math.round(g-155),d=-g,c=0,Entry.dplay.Left_value=d):0==g&&(c=d=0,Entry.dplay.Left_value= +0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,d),Entry.hw.setDigitalPortValue(5,c), +Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}},syntax:{js:[],py:["Dplay.robot_speed_sel(%1, %2)"]}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator", img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()},syntax:{js:[],py:["Dplay.robot_stop()"]}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], type:"nemoino_get_number_sensor_value"},"class":"arduino_value",syntax:{js:[],py:["Nemoino.sensor_value(%1)"]}},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value",syntax:{js:[],py:["Nemoino.digital_value(%1)"]}},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"}, "class":"arduino_set",syntax:{js:[],py:["Nemoino.toggle_led(%1)"]}},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set",syntax:{js:[],py:["Nemoino.toggle_pwm(%1, %2)"]}},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, @@ -2439,270 +2316,402 @@ isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",para joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, "wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}},ai_move_right:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","move"],params:[{type:"Image",img:"/img/assets/week/blocks/moveStep.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return Entry.STATIC.BREAK;delete a.isAction;delete a.isStart}else{a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id, -Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.EAST;var c=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO,animateValue:0});c.x++;return Entry.STATIC.BREAK}}},ai_move_up:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","up"],params:[{type:"Image",img:"/img/assets/week/blocks/ai_move_up.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return a;delete a.isAction;delete a.isStart; -return a.callReturn()}a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id,Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.NORTH;var c=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO,animateValue:-45});c.x++;c.y--;return a}},ai_move_down:{skeleton:"basic",mode:"maze",color:"#A751E3",syntax:["Scope","down"],params:[{type:"Image", -img:"/img/assets/week/blocks/ai_move_down.png",size:24}],func:function(b,a){if(a.isStart){if(a.isAction)return a;delete a.isAction;delete a.isStart;return a.callReturn()}a.isStart=!0;a.isAction=!0;Ntry.dispatchEvent("gridChange",function(){a.isAction=!1});Ntry.entityManager.getComponent(b.id,Ntry.STATIC.SPACE_SHIP).direction=Ntry.STATIC.SOUTH;var c=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);Ntry.entityManager.addComponent(b.id,{type:Ntry.STATIC.ANIMATE,animateType:Ntry.STATIC.ROTATE_TO, -animateValue:45});c.x++;c.y++;return a}},ai_repeat_until_reach:{skeleton:"basic_loop",mode:"maze",color:"#498DEB",syntax:["BasicWhile","true"],statements:[{accept:"basic"}],params:[{type:"Image",img:"/img/assets/week/blocks/for.png",size:24}],func:function(){var b=this.block.statements[0];if(0!==b.getBlocks().length)return this.executor.stepInto(b)}},ai_if_else_1:{skeleton:"basic_double_loop",mode:"maze",color:"#498DEB",syntax:["BasicIf","front == 'stone'"],statements:[{accept:"basic"},{accept:"basic"}], -params:[{type:"Image",img:"/img/assets/ntry/bitmap/ai/obstacle_1.png",size:24},{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"LineBreak"}],func:function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR);var c=this.block.statements,d=1;a.isLooped=!0;b.center.type==Ntry.STATIC.AI_METEO&&1==b.center.distance&&(d=0);this.executor.stepInto(c[d]);return Entry.STATIC.BREAK}},ai_boolean_distance:{skeleton:"basic_boolean_field", -mode:"maze",color:"#2fc9f0",fontColor:"#fff",syntax:["Scope","radar_%1 %2 %3#"],params:[{type:"Dropdown",options:[[Lang.Menus.ai_above,"UP"],[Lang.Menus.ai_front,"RIGHT"],[Lang.Menus.ai_under,"DOWN"]],value:"RIGHT",fontSize:11},{type:"Dropdown",options:[[">","BIGGER"],[">=","BIGGER_EQUAL"],["=","EQUAL"],["<","SMALLER"],["<=","SMALLER_EQUAL"]],value:"BIGGER",fontSize:11},{type:"Block",accept:"string"}],func:function(b,a){b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR);var c=this.block.params; -a=c[0];var c=c[1],d=this.getParam(2),e;switch(a){case "UP":e=b.left;break;case "RIGHT":e=b.center;break;case "DOWN":e=b.right}e=e.type==Ntry.STATIC.AI_GOAL?Number.MAX_VALUE:e.distance;switch(c){case "BIGGER":return e>d;case "BIGGER_EQUAL":return e>=d;case "EQUAL":return e==d;case "SMALLER":return e","BIGGER"],[">=","BIGGER_EQUAL"],["=","EQUAL"],["<","SMALLER"],["<=","SMALLER_EQUAL"]],value:"BIGGER",fontSize:11},{type:"Block",accept:"string"}],func:function(b,a){var d=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.RADAR),c=this.block.params, +e=c[0],c=c[1],f=this.getParam(2),g;switch(e){case "UP":g=d.left;break;case "RIGHT":g=d.center;break;case "DOWN":g=d.right}g=g.type==Ntry.STATIC.AI_GOAL?Number.MAX_VALUE:g.distance;switch(c){case "BIGGER":return g>f;case "BIGGER_EQUAL":return g>=f;case "EQUAL":return g==f;case "SMALLER":return g=c?c=0:720<=c&&(c=720);var d=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==d?50:-50};return a.callReturn()}},ev3_motor_power:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c \ucd9c\ub825 %3",params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[null,{type:"number",params:["50"]}],type:"ev3_motor_power"},paramsKeyMap:{PORT:0,VALUE:1},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);var c=a.getValue("VALUE",a);Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}},ev3_motor_power_on_time:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \ucd08 \ub3d9\uc548 %3 \uc73c\ub85c \ucd9c\ub825 %4", -params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["2"]},{type:"number",params:["50"]}],type:"ev3_motor_power_on_time"},paramsKeyMap:{PORT:0,TIME:1,VALUE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){b=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a; -delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),d=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[b]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};var e=setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(e)},1E3*c);Entry.EV3.timeouts.push(e);return a}},ev3_touch_sensor:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"%1 \uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_touch_sensor"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);b=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a));a=!1;b.type==Entry.EV3.deviceTypes.Touch&& -1<=Number(b.siValue)&&(a=!0);return a}},roduino_on_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_on_block"},paramsKeyMap:{},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){return"1"}},roduino_off_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_off_block"}, +params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/if.png",size:12},{type:"LineBreak"}],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var d=this.getParam(0);a.isCondition=!0;return d?this.executor.stepInto(this.block.statements[0]):this.executor.stepInto(this.block.statements[1])},syntax:["BasicIf","true"]},ev3_color_sensor:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc758 %2 \uac12",params:[{type:"Dropdown", +options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11},{type:"Dropdown",options:[["RGB","RGB"],["R","R"],["G","G"],["B","B"]],value:"RGB",fontSize:11}],events:{},def:{params:[null,null],type:"ev3_color_sensor"},paramsKeyMap:{PORT:0,RGB:1},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);var d=a.getStringField("RGB",a),c=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),e="";if(c.type==Entry.EV3.deviceTypes.Color)if(0==c.siValue)e="";else switch(d){case "RGB":e= +Entry.EV3.colorSensorValue[c.siValue];break;case "R":e=Entry.EV3.colorSensorValue[c.siValue].substring(0,2);break;case "G":e=Entry.EV3.colorSensorValue[c.siValue].substring(2,4);break;case "B":e=Entry.EV3.colorSensorValue[c.siValue].substring(4,6)}else e="\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8";return e}},ev3_get_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc758 \uac12",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4", +"4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_get_sensor_value"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);var d=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),c;$.isPlainObject(d)&&(c=d.siValue||0);return c}},ev3_motor_degrees:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c %3 \ub3c4 \ub9cc\ud07c \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["A", +"A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Dropdown",options:[["\uc2dc\uacc4\ubc29\ud5a5","CW"],["\ubc18\uc2dc\uacc4\ubc29\ud5a5","CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"angle"}],type:"ev3_motor_degrees"},paramsKeyMap:{PORT:0,DIRECTION:1,DEGREE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){var d=a.getStringField("PORT",a),c=a.getValue("DEGREE", +a);0>=c?c=0:720<=c&&(c=720);var e=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:c,power:"CW"==e?50:-50};return a.callReturn()}},ev3_motor_power:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c \ucd9c\ub825 %3",params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,{type:"number",params:["50"]}],type:"ev3_motor_power"},paramsKeyMap:{PORT:0,VALUE:1},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){var d=a.getStringField("PORT",a),c=a.getValue("VALUE",a);Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:c};return a.callReturn()}},ev3_motor_power_on_time:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \ucd08 \ub3d9\uc548 %3 \uc73c\ub85c \ucd9c\ub825 %4", +params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["2"]},{type:"number",params:["50"]}],type:"ev3_motor_power_on_time"},paramsKeyMap:{PORT:0,TIME:1,VALUE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){var d=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a; +delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var c=a.getValue("TIME",a),e=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[d]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:e};var f=setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(f)},1E3*c);Entry.EV3.timeouts.push(f);return a}},ev3_touch_sensor:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"%1 \uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_touch_sensor"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);var d=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)),c=!1;d.type==Entry.EV3.deviceTypes.Touch&& +1<=+d.siValue&&(c=!0);return c}},roduino_on_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_on_block"},paramsKeyMap:{},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){return"1"}},roduino_off_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"roduino_off_block"}, paramsKeyMap:{},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){return"0"}},roduino_get_analog_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},roduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field", statements:[],params:[{type:"Dropdown",options:[["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"2",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},roduino_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"roduino_get_analog_number"}],type:"roduino_get_analog_value"}, -paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=parseInt(a.getValue("VALUE",a));Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.ANALOG_READ,b]);return Entry.hw.getAnalogPortValue(b)}},roduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"roduino_get_port_number"}],type:"roduino_get_digital_value"},paramsKeyMap:{VALUE:0}, -"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_READ,b]);return Entry.hw.portData[b-2]}},roduino_get_color:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_color_red,"red"],[Lang.Blocks.roborobo_color_green,"green"],[Lang.Blocks.roborobo_color_blue,"blue"],[Lang.Blocks.roborobo_color_yellow, -"yellow"]],value:"red",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null],type:"roduino_get_color"},paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){b=0;a=a.getField("VALUE",a);var c=[Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2]-2]];switch(a){case "red":1==c[0]&&0==c[1]&&0==c[2]&&(b=1);break;case "green":0== -c[0]&&1==c[1]&&0==c[2]&&(b=1);break;case "blue":0==c[0]&&0==c[1]&&1==c[2]&&(b=1);break;case "yellow":1==c[0]&&1==c[1]&&1==c[2]&&(b=1)}return b}},roduino_set_digital:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"roduino_get_port_number"}, -null,null],type:"roduino_set_digital"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("VALUE",a);var c=a.getField("OPERATOR");Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE,b,"on"==c?1:0]);return a.callReturn()}},roduino_motor:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]], -value:"motor1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor_CW,"cw"],[Lang.Blocks.roborobo_motor_CCW,"ccw"],[Lang.Blocks.roborobo_motor_stop,"stop"]],value:"cw",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"roduino_motor"},paramsKeyMap:{MODE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){pin2= -0;var c;value2=0;b=a.getField("MODE");c=a.getField("OPERATOR");"motor1"==b?(b=9,pin2=10):(b=11,pin2=12);"cw"==c?(c=1,value2=0):"ccw"==c?(c=0,value2=1):value2=c=0;Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR,b,c,pin2,value2]);return a.callReturn()}},roduino_set_color_pin:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["3"]},{type:"number",params:["4"]},null],type:"roduino_set_color_pin"},paramsKeyMap:{RED:0,GREEN:1,BLUE:2},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){b=a.getNumberValue("RED",a);var c=a.getNumberValue("GREEN",a),d=a.getNumberValue("BLUE",a);Entry.Roborobo_Roduino.ColorPin=[b,c,d];Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR,b,c,d]);return a.callReturn()}}, +paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){var d=parseInt(a.getValue("VALUE",a));Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.ANALOG_READ,d]);return Entry.hw.getAnalogPortValue(d)}},roduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"roduino_get_port_number"}],type:"roduino_get_digital_value"},paramsKeyMap:{VALUE:0}, +"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){var d=a.getNumberValue("VALUE",a);Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_READ,d]);return Entry.hw.portData[d-2]}},roduino_get_color:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_color_red,"red"],[Lang.Blocks.roborobo_color_green,"green"],[Lang.Blocks.roborobo_color_blue,"blue"],[Lang.Blocks.roborobo_color_yellow, +"yellow"]],value:"red",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null],type:"roduino_get_color"},paramsKeyMap:{VALUE:0},"class":"roduino_value",isNotFor:["roborobo_roduino"],func:function(b,a){var d=0,c=a.getField("VALUE",a),e=[Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[0]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[1]-2],Entry.hw.portData[Entry.Roborobo_Roduino.ColorPin[2]-2]];switch(c){case "red":1==e[0]&&0==e[1]&&0==e[2]&&(d=1);break;case "green":0== +e[0]&&1==e[1]&&0==e[2]&&(d=1);break;case "blue":0==e[0]&&0==e[1]&&1==e[2]&&(d=1);break;case "yellow":1==e[0]&&1==e[1]&&1==e[2]&&(d=1)}return d}},roduino_set_digital:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"roduino_get_port_number"}, +null,null],type:"roduino_set_digital"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){var d=a.getNumberValue("VALUE",a),c="on"==a.getField("OPERATOR")?1:0;Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.DIGITAL_WRITE,d,c]);return a.callReturn()}},roduino_motor:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]], +value:"motor1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor_CW,"cw"],[Lang.Blocks.roborobo_motor_CCW,"ccw"],[Lang.Blocks.roborobo_motor_stop,"stop"]],value:"cw",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"roduino_motor"},paramsKeyMap:{MODE:0,OPERATOR:1},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){var d= +pin2=0,c=value2=0,d=a.getField("MODE"),c=a.getField("OPERATOR");"motor1"==d?(d=9,pin2=10):(d=11,pin2=12);"cw"==c?(c=1,value2=0):"ccw"==c?(c=0,value2=1):value2=c=0;Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.MOTOR,d,c,pin2,value2]);return a.callReturn()}},roduino_set_color_pin:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["3"]},{type:"number",params:["4"]},null],type:"roduino_set_color_pin"},paramsKeyMap:{RED:0,GREEN:1,BLUE:2},"class":"roduino_set",isNotFor:["roborobo_roduino"],func:function(b,a){var d=a.getNumberValue("RED",a),c=a.getNumberValue("GREEN",a),e=a.getNumberValue("BLUE",a);Entry.Roborobo_Roduino.ColorPin=[d,c,e];Entry.Roborobo_Roduino.setSendData([Entry.Roborobo_Roduino.INSTRUCTION.COLOR,d,c,e]);return a.callReturn()}}, schoolkit_on_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"schoolkit_on_block"},paramsKeyMap:{},"class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){return"1"}},schoolkit_off_block:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"schoolkit_off_block"},paramsKeyMap:{}, "class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){return"0"}},schoolkit_get_out_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["OUT1",2],["OUT2",3],["OUT3",4],["OUT4",5],["OUT5",6]],value:2,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getNumberField("PORT")}},schoolkit_get_in_port_number:{color:"#00979D",skeleton:"basic_string_field", statements:[],params:[{type:"Dropdown",options:[["IN1",7],["IN2",8],["IN3",9],["IN4",10],["IN5",11],["IN6",12],["IN7",13]],value:7,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getNumberField("PORT")}},schoolkit_set_output:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_on,"on"],[Lang.Blocks.roborobo_off,"off"]],value:"on",fontSize:11, -arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},null,null],type:"schoolkit_set_output"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("VALUE",a);var c=a.getField("OPERATOR");Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE,b,"on"==c?1:0]);return a.callReturn()}},schoolkit_get_input_value:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"schoolkit_get_in_port_number"}],type:"schoolkit_get_input_value"},paramsKeyMap:{VALUE:0},"class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("VALUE",a);Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_READ,b]);return Entry.hw.portData[b-7]}},schoolkit_motor:{color:"#00979D",skeleton:"basic", +arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},null,null],type:"schoolkit_set_output"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){var d=a.getNumberValue("VALUE",a),c="on"==a.getField("OPERATOR")?1:0;Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_WRITE,d,c]);return a.callReturn()}},schoolkit_get_input_value:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"schoolkit_get_in_port_number"}],type:"schoolkit_get_input_value"},paramsKeyMap:{VALUE:0},"class":"schoolkit_value",isNotFor:["roborobo_schoolkit"],func:function(b,a){var d=a.getNumberValue("VALUE",a);Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.DIGITAL_READ,d]);return Entry.hw.portData[d-7]}},schoolkit_motor:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor1,"motor1"],[Lang.Blocks.roborobo_motor2,"motor2"]],value:"motor1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.roborobo_motor_CW,"cw"],[Lang.Blocks.roborobo_motor_CCW,"ccw"],[Lang.Blocks.roborobo_motor_stop,"stop"]],value:"cw",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,{type:"number",params:["0"]},null,null],type:"schoolkit_motor"},paramsKeyMap:{MODE:0,VALUE:1,OPERATOR:2},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){var c;c=a.getField("MODE");b=a.getField("OPERATOR");var d=a.getNumberValue("VALUE");c="motor1"==c?7:8;255d&&(d=0);"cw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,c,d]):"ccw"==b?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, -2,c,d]):"stop"==b&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,0,c,d]);return a.callReturn()}},schoolkit_set_servo_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},{type:"number",params:["0"]},null],type:"schoolkit_set_servo_value"},paramsKeyMap:{PIN:0,VALUE:1},"class":"schoolkit_set", -isNotFor:["roborobo_schoolkit"],func:function(b,a){b=a.getNumberValue("PIN",a);var c=a.getNumberValue("VALUE");0>c?c=0:180b&& -(d=0);255b&&(c=2+c,b*=-1);b=Math.round(b/30);Entry.hw.setDigitalPortValue(14,128+(c<<5)+b);return a.callReturn()}},codestar_light:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ubc1d\uae30\uc13c\uc11c",params:[],events:{},def:{params:[],type:"codestar_light"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("6")}},codestar_button:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ubc84\ud2bc",params:[],events:{},def:{params:[],type:"codestar_button"},paramsKeyMap:{},class:"codestar_input_sensor", -isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("12")}},codestar_ir:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["0"],type:"codestar_ir"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){b=a.getField("PORT");return Entry.hw.getAnalogPortValue(b)}},codestar_sonar:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ucd08\uc74c\ud30c",params:[],events:{},def:{params:[],type:"codestar_sonar"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.sonar}},codestar_variable_R:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\uac00\ubcc0\uc800\ud56d %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["1"], -type:"codestar_variable_R"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){b=a.getField("PORT");return Entry.hw.getAnalogPortValue(b)}},codestar_mic:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ub9c8\uc774\ud06c",params:[],events:{},def:{params:[],type:"codestar_mic"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("2")}},codestar_temperature:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\uc628\ub3c4",params:[],events:{},def:{params:[],type:"codestar_temperature"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.temperature}},codestar_gyroscope:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc790\uc774\ub85c %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator", -size:11}],events:{},def:{params:["x",null],type:"codestar_gyroscope"},paramsKeyMap:{AXIS:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("gyro_"+axis)}},codestar_geomagnetic:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc9c0\uc790\uae30 %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator",size:11}],events:{},def:{params:["x",null],type:"codestar_geomagnetic"}, -paramsKeyMap:{AXIS:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){b=a.getField("AXIS");return Entry.hw.getAnalogPortValue("geo_"+b)}},codestar_irR:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR \ub9ac\ubaa8\ucf58",params:[],events:{},def:{params:[],type:"codestar_irR"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("4")}},codestar_tilt:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ud2f8\ud2b8",params:[],events:{},def:{params:[],type:"codestar_tilt"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("6")}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this.setAlign(this._align);this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId); -Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this), +def:{params:[null,{type:"number",params:["0"]},null,null],type:"schoolkit_motor"},paramsKeyMap:{MODE:0,VALUE:1,OPERATOR:2},"class":"schoolkit_set",isNotFor:["roborobo_schoolkit"],func:function(b,a){var d=0,c=0,d=a.getField("MODE"),e=a.getField("OPERATOR"),f=a.getNumberValue("VALUE"),d="motor1"==d?7:8;255f&&(f=0);"cw"==e?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,1,d,f]):"ccw"==e?Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR, +2,d,f]):"stop"==e&&Entry.Roborobo_SchoolKit.setSendData([Entry.Roborobo_SchoolKit.INSTRUCTION.MOTOR,c,d,f]);return a.callReturn()}},schoolkit_set_servo_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"schoolkit_get_out_port_number"},{type:"number",params:["0"]},null],type:"schoolkit_set_servo_value"},paramsKeyMap:{PIN:0,VALUE:1},"class":"schoolkit_set", +isNotFor:["roborobo_schoolkit"],func:function(b,a){var d=a.getNumberValue("PIN",a),c=a.getNumberValue("VALUE");0>c?c=0:180d&& +(e=0);255d&&(c=2+c,d*=-1);d=Math.round(d/30);Entry.hw.setDigitalPortValue(14,128+(c<<5)+d);return a.callReturn()}},codestar_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +statements:[],template:"\ubc1d\uae30\uc13c\uc11c",params:[],events:{},def:{params:[],type:"codestar_light"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("6")}},codestar_button:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ubc84\ud2bc",params:[],events:{},def:{params:[],type:"codestar_button"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("12")}}, +codestar_ir:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["0"],type:"codestar_ir"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){var d=a.getField("PORT");return Entry.hw.getAnalogPortValue(d)}},codestar_sonar:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ucd08\uc74c\ud30c", +params:[],events:{},def:{params:[],type:"codestar_sonar"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.sonar}},codestar_variable_R:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\uac00\ubcc0\uc800\ud56d %1",params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A4","4"],["A5","5"]]}],events:{},def:{params:["1"],type:"codestar_variable_R"},paramsKeyMap:{PORT:0},class:"codestar_input_sensor", +isNotFor:["codestar"],func:function(b,a){var d=a.getField("PORT");return Entry.hw.getAnalogPortValue(d)}},codestar_mic:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"\ub9c8\uc774\ud06c",params:[],events:{},def:{params:[],type:"codestar_mic"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("2")}},codestar_temperature:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[], +template:"\uc628\ub3c4",params:[],events:{},def:{params:[],type:"codestar_temperature"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.portData.temperature}},codestar_gyroscope:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc790\uc774\ub85c %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator",size:11}],events:{},def:{params:["x",null],type:"codestar_gyroscope"}, +paramsKeyMap:{AXIS:0},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getAnalogPortValue("gyro_"+axis)}},codestar_geomagnetic:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uc9c0\uc790\uae30 %1 \ucd95 %2",params:[{type:"Dropdown",options:[["x","x"],["y","y"],["z","z"]]},{type:"Indicator",size:11}],events:{},def:{params:["x",null],type:"codestar_geomagnetic"},paramsKeyMap:{AXIS:0},class:"codestar_input_sensor", +isNotFor:["codestar"],func:function(b,a){var d=a.getField("AXIS");return Entry.hw.getAnalogPortValue("geo_"+d)}},codestar_irR:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"IR \ub9ac\ubaa8\ucf58",params:[],events:{},def:{params:[],type:"codestar_irR"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("4")}},codestar_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +statements:[],template:"\ud2f8\ud2b8",params:[],events:{},def:{params:[],type:"codestar_tilt"},paramsKeyMap:{},class:"codestar_input_sensor",isNotFor:["codestar"],func:function(b,a){return Entry.hw.getDigitalPortValue("6")}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var d=function(){};d.prototype=Entry.block[a.parent];var d=new d,c;for(c in a)d[c]=a[c];Entry.block[b]=d}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,d,c){Entry.Model(this,!1);this._align=a||"CENTER";this.setAlign(this._align);this._scroll=void 0!==c?c:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=d;this._generateView(d);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId); +Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);d&&this._generateCategoryCodes(d);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this), this._addControl(b));Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& -d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.workspace.getMode();this.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD? +(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,c=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){c._scroller&& +c._scroller.setOpacity(1);a=c.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=c.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(c._scroller&&c._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, +200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){c.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.workspace.getMode();this.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD? a.mode&&"code"!==a.mode||this.renderText():"text"===a.mode&&this.renderBlock();this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw(); -a=b.getThreads();for(var b=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&& -this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){a=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b; -for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a);this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;bthis._bannedClass.indexOf(a)&& +this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var c=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems, +b;for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var c=a[b];c.constructor==Entry.Code&&c.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a);this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var b=e.dragInstance; -e.scroll(a.pageY-b.offsetY);b.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){var d=this;Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];if(void 0===this._schema)this.block.destroy(!1,!1);else{this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var e=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements= -[];this.magnet={};this._paramMap={};e.magnets&&e.magnets(this).next&&(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;this.mouseHandler=function(){var a=d.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(d)});d.onMouseDown.apply(d,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable", +function(){var a=this.board,b=a.svgBlockGroup.getBoundingClientRect(),c=a.blockMenuContainer.height(),a=a.offset();this.vRatio=b=(b.height+(b.top-a.top)+10)/c;1>=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var d=e.dragInstance; +e.scroll(a.pageY-d.offsetY);d.set({offsetY:a.pageY})}function c(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",c);g.bind("touchmove.scroll", +b);g.bind("touchend.scroll",c);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,d){var c=this;Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];if(void 0===this._schema)this.block.destroy(!1,!1);else{this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var e=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements= +[];this.magnet={};this._paramMap={};e.magnets&&e.magnets(this).next&&(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;this.mouseHandler=function(){var a=c.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(c)});c.onMouseDown.apply(c,arguments)};this._startRender(b,d);this._observers.push(this.block.observe(this,"_setMovable", ["movable"]));this._observers.push(this.block.observe(this,"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow", ["shadow"]));this._observers.push(this.observe(this,"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})}};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; -(function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var c=this;a=this._skeleton;this.svgGroup.attr({class:"block"});var e=a.classes;e&&0!==e.length&&e.forEach(function(a){c.svgGroup.addClass(a)});e=a.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& -($(this._path).mouseenter(function(a){c._mouseEnable&&c._changeFill(!0)}),$(this._path).mouseleave(function(a){c._mouseEnable&&c._changeFill(!1)}));var f=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(f=Entry.Utils.colorLighten(f));this._fillColor=f;e={d:e,fill:f,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)f=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+f+")"});else if(this.magnet.string||this.magnet.boolean)e.stroke= -a.outerLine;a.outerLine&&(e["stroke-width"]="0.6");this._path.attr(e);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(d),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(),f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),a= -!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block");f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove(); +function(a){!0!==a&&(a=!1);for(var b=0,c=0,e=0,f=0,g=0,h=0,k=0;kEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(),f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,d),a= +!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),d=f.dragInstance,f._moveBy(c.pageX-d.offsetX,c.pageY-d.offsetY,!1),d.set({offsetX:c.pageX,offsetY:c.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function c(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block");f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove(); delete this.mouseDownCoordinate;delete f.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var h=a.type,k;k=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate={x:k.pageX, -y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&&this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& -a&&(vimBoard=$(".entryVimBoard>.CodeMirror")[0],document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event)))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE; -if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d, -b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(), -f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b="next"===d?this.getBoard().getNearestMagnet(this.x, -this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers(); -var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); +y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",d);l.bind("mouseup.block touchend.block",c);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,c(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&&this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&& +a&&(vimBoard=$(".entryVimBoard>.CodeMirror")[0],document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event)))}};b.vimBoardEvent=function(a,b,c){a&&(a=Entry.Utils.createMouseEvent(b,a),c&&(a.block=c),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),c=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE; +if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(c===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode= +c,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;c=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(), +f instanceof Entry.Board?this._moveTo(c.x,c.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var c in this.magnet)if(b="next"===c?this.getBoard().getNearestMagnet(this.x, +this.y+this.getBelowHeight(),c):this.getBoard().getNearestMagnet(this.x,this.y,c))return a.setMagnetedBlock(b.view,c);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers(); +var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var c=this.block;a=c.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(c)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, +c=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(c.x+e.x)+","+(c.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(c.x+e.x)+","+(c.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var c=this;a=a||15;b?window.setTimeout(function(){c._moveBy(a,a,!1)},b):c._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g, -">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0); -a=this._skeleton.box(this);var l=b?1:1.5,m=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),u= -0;ub&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; -var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| -[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(b,a,c,d,e){Entry.Model(this,!1);this._blockView=a;this._block=a.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=b;this.acceptType=b.accept;this._restoreCurrent=b.restore;this.view=this;this.svgGroup=null;this._position=b.position;this.box.observe(a,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(a.getBoard(),d)}; -Entry.Utils.inherit(Entry.Field,Entry.FieldBlock); -(function(b){b.schema={magneting:!1};b.renderStart=function(a,b){this.svgGroup=this._blockView.contentSvgGroup.elem("g");this.view=this;this._nextGroup=this.svgGroup;this.box.set({x:0,y:0,width:0,height:20});var c=this.getValue();c&&!c.view&&(c.setThread(this),c.createView(a,b),c.getThread().view.setParent(this));this.updateValueBlock(c);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};b.align=function(a,b,d){var c=this.svgGroup;this._position&&(this._position.x&& -(a=this._position.x),this._position.y&&(b=this._position.y));var f=this._valueBlock;f&&(b=-.5*f.view.height);f="translate("+a+","+b+")";void 0===d||d?c.animate({transform:f},300,mina.easeinout):c.attr({transform:f});this.box.set({x:a,y:b})};b.calcWH=function(){var a=this._valueBlock;a?(a=a.view,this.box.set({width:a.width,height:a.height})):this.box.set({width:15,height:20})};b.calcHeight=b.calcWH;b.destroy=function(){};b.inspectBlock=function(){var a=null;if(this._originBlock)a=this._originBlock.type, -delete this._originBlock;else switch(this.acceptType){case "boolean":a="True";break;case "string":a="text";break;case "param":a="function_field_label"}return this._createBlockByType(a)};b._setValueBlock=function(a){this._restoreCurrent&&(this._originBlock=this._valueBlock);a||(a=this.inspectBlock());this._valueBlock=a;this.setValue(a);a.setThread(this);a.getThread().view.setParent(this);return this._valueBlock};b.getValueBlock=function(){return this._valueBlock};b.updateValueBlock=function(a){a instanceof -Entry.Block||(a=void 0);this._destroyObservers();a=this._setValueBlock(a).view;a.bindPrev(this);this._blockView.alignContent();this._posObserver=a.observe(this,"updateValueBlock",["x","y"],!1);this._sizeObserver=a.observe(this,"calcWH",["width","height"]);a=this._blockView.getBoard();a.constructor===Entry.Board&&a.generateCodeMagnetMap()};b._destroyObservers=function(){this._sizeObserver&&this._sizeObserver.destroy();this._posObserver&&this._posObserver.destroy()};b.getPrevBlock=function(a){return this._valueBlock=== -a?this:null};b.getNextBlock=function(){return null};b.requestAbsoluteCoordinate=function(a){a=this._blockView;var b=a.contentPos;a=a.getAbsoluteCoordinate();a.x+=this.box.x+b.x;a.y+=this.box.y+b.y;return a};b.dominate=function(){this._blockView.dominate()};b.isGlobal=function(){return!1};b.separate=function(a){this.getCode().createThread([a]);this.calcWH();this.changeEvent.notify()};b.getCode=function(){return this._block.thread.getCode()};b.cut=function(a){return this._valueBlock===a?[a]:null};b.replace= -function(a){"string"===typeof a&&(a=this._createBlockByType(a));var b=this._valueBlock;Entry.block[b.type].isPrimitive?(b.doNotSplice=!0,b.destroy()):"param"===this.acceptType?(this._destroyObservers(),b.view._toGlobalCoordinate(),a.getTerminateOutputBlock().view._contents[1].replace(b)):(this._destroyObservers(),b.view._toGlobalCoordinate(),this.separate(b),b.view.bumpAway(30,150));this.updateValueBlock(a);a.view._toLocalCoordinate(this.svgGroup);this.calcWH();this.changeEvent.notify()};b.setParent= -function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var d=b.workspace,e;d&&(e=d.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, -transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.Scroller=function(b,a,c){this._horizontal=void 0===a?!0:a;this._vertical=void 0===c?!0:c;this.board=b;this.svgGroup=null;this.vRatio=this.vY=this.vWidth=this.hRatio=this.hX=this.hWidth=0;this._visible=!0;this._opacity=-1;this.createScrollBar();this.setOpacity(0);this._bindEvent();this._scrollCommand=_.debounce(Entry.do,200)};Entry.Scroller.RADIUS=7; -(function(b){b.createScrollBar=function(){var a=Entry.Scroller.RADIUS,b=this;this.svgGroup=this.board.svg.elem("g").attr({class:"boardScrollbar"});this._horizontal&&(this.hScrollbar=this.svgGroup.elem("rect",{height:2*a,rx:a,ry:a}),this.hScrollbar.mousedown=function(a){function c(a){a.stopPropagation();a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll((a.pageX-c.offsetX)/b.hRatio,0);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".scroll"); -delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",c);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll",c);g.bind("touchend.scroll",d);b.dragInstance=new Entry.DragInstance({startX:a.pageX,startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}a.stopPropagation()});this._vertical&&(this.vScrollbar=this.svgGroup.elem("rect",{width:2*a,rx:a,ry:a}),this.vScrollbar.mousedown=function(a){function c(a){a.stopPropagation(); -a.preventDefault();a.originalEvent.touches&&(a=a.originalEvent.touches[0]);var c=b.dragInstance;b.scroll(0,(a.pageY-c.offsetY)/b.vRatio);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete b.dragInstance}if(0===a.button||a instanceof Touch){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var g=$(document);g.bind("mousemove.scroll",c);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll",c);g.bind("touchend.scroll",d);b.dragInstance=new Entry.DragInstance({startX:a.pageX, -startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}a.stopPropagation()})};b.updateScrollBar=function(a,b){this._horizontal&&(this.hX+=a*this.hRatio,this.hScrollbar.attr({x:this.hX}));this._vertical&&(this.vY+=b*this.vRatio,this.vScrollbar.attr({y:this.vY}))};b.scroll=function(a,b){if(this.board.code){var c=this.board.svgBlockGroup.getBoundingClientRect(),e=this.board.svgDom,f=c.left-this.board.offset().left,g=c.top-this.board.offset().top,h=c.height;a=Math.max(-c.width+Entry.BOARD_PADDING-f,a);b=Math.max(-h+ -Entry.BOARD_PADDING-g,b);a=Math.min(e.width()-Entry.BOARD_PADDING-f,a);b=Math.min(e.height()-Entry.BOARD_PADDING-g,b);this._scroll(a,b);this._diffs||(this._diffs=[0,0]);this._diffs[0]+=a;this._diffs[1]+=b;this._scrollCommand("scrollBoard",this._diffs[0],this._diffs[1],!0)}};b._scroll=function(a,b){this.board.code.moveBy(a,b);this.updateScrollBar(a,b)};b.setVisible=function(a){a!=this.isVisible()&&(this._visible=a,this.svgGroup.attr({display:!0===a?"block":"none"}))};b.isVisible=function(){return this._visible}; -b.setOpacity=function(a){this._opacity!=a&&(this.hScrollbar.attr({opacity:a}),this.vScrollbar.attr({opacity:a}),this._opacity=a)};b.resizeScrollBar=function(){if(this._visible){var a=this.board,b=a.svgBlockGroup.getBoundingClientRect(),d=a.svgDom,e=d.width(),d=d.height(),f=b.left-a.offset().left,a=b.top-a.offset().top,g=b.width,b=b.height;if(this._horizontal){var h=-g+Entry.BOARD_PADDING,k=e-Entry.BOARD_PADDING,g=(e+2*Entry.Scroller.RADIUS)*g/(k-h+g);isNaN(g)&&(g=0);this.hX=(f-h)/(k-h)*(e-g-2*Entry.Scroller.RADIUS); -this.hScrollbar.attr({width:g,x:this.hX,y:d-2*Entry.Scroller.RADIUS});this.hRatio=(e-g-2*Entry.Scroller.RADIUS)/(k-h)}this._vertical&&(f=-b+Entry.BOARD_PADDING,g=d-Entry.BOARD_PADDING,b=(d+2*Entry.Scroller.RADIUS)*b/(g-f+b),this.vY=(a-f)/(g-f)*(d-b-2*Entry.Scroller.RADIUS),this.vScrollbar.attr({height:b,y:this.vY,x:e-2*Entry.Scroller.RADIUS}),this.vRatio=(d-b-2*Entry.Scroller.RADIUS)/(g-f))}};b._bindEvent=function(){var a=_.debounce(this.resizeScrollBar,200);this.board.changeEvent.attach(this,a); -Entry.windowResized&&Entry.windowResized.attach(this,a)}})(Entry.Scroller.prototype);Entry.Board=function(b){Entry.Model(this,!1);this.changeEvent=new Entry.Event(this);this.createView(b);this.updateOffset();this.scroller=new Entry.Scroller(this,!0,!0);this._magnetMap={};Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING=100;this._initContextOptions();Entry.Utils.disableContextmenu(this.svgDom);this._addControl();this._bindEvent()};Entry.Board.OPTION_PASTE=0;Entry.Board.OPTION_ALIGN=1;Entry.Board.OPTION_CLEAR=2;Entry.Board.OPTION_DOWNLOAD=3;Entry.Board.DRAG_RADIUS=5; -(function(b){b.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};b.createView=function(a){var b=a.dom,b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this._svgId="play"+(new Date).getTime();this.workspace=a.workspace;this._activatedBlockView=null;this.wrapper=Entry.Dom("div",{parent:b,class:"entryBoardWrapper"});this.svgDom=Entry.Dom($(''), -{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, -this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); -this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var b=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-b.x,2)+Math.pow(a.pageY-b.y,2))a&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()}; -b.updateOffset=function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33, -class:"entryFunctionButtonText"});e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD, -"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE; -d[e-1].endPoint=f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){a=a.getThreads();var c=[],e;switch(b){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fd.endPoint)f=h+1;else{c=d.blocks;for(f=0;f\s+/g, +">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0), +l=this._skeleton.box(this),m=b?1:1.5,n=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),v=0;va||b.splice(a,1))};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var c=[];if(void 0!==a){for(var f=0;fa||b.splice(a,1)};b.doDestroyThread=function(a,b){b=this._data;a=b.indexOf(a);0>a||b.splice(a,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a=this.getThreads(),b=[],d=0,e=a.length;de||c.splice(e,1)}};b.raiseEvent=function(a,b,c){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fe||c.splice(e,1)};b.doDestroyThread=function(a,b){var c=this._data,e=c.indexOf(a);0>e||c.splice(e,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a=this.getThreads(),b=[],c=0,e=a.length;cb;b+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0=== -b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/2;b.y=b.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+b.x+","+b.y+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()};b._updateByCoord= -function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var c=b[0]-a[0];a=b[1]-a[1]-49-1;b=Math.atan(-a/c);b=Entry.toDegrees(b);b=90-b;0>c?b+=180:0Math.PI?1:0;this._fillPath=this.svgOptionGroup.elem("path",{d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X",b).replace("%Y",d).replace("%LARGE",a),class:"entry-angle-fill-area"});this.svgOptionGroup.appendChild(this._dividerGroup);this._indicator&&this._indicator.remove();this._indicator=this.svgOptionGroup.elem("line",{x1:0,y1:0,x2:b,y2:d});this._indicator.attr({class:"entry-angle-indicator"})};b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)|| +(function(b){b.callReturn=function(){};b.getParam=function(a){a=this.block.params[a];var b=new Entry.Scope(a,this.executor);return Entry.block[a.type].func.call(b,this.entity,b)};b.getParams=function(){var a=this;return this.block.params.map(function(b){if(b instanceof Entry.Block){var c=new Entry.Scope(b,a.executor);return Entry.block[b.type].func.call(c,a.entity,c)}return b})};b.getValue=function(a,b){var c=this.block.params[this._getParamIndex(a,b)],e=new Entry.Scope(c,this.executor);return Entry.block[c.type].func.call(e, +this.entity,e)};b.getStringValue=function(a,b){return String(this.getValue(a,b))};b.getNumberValue=function(a,b){return+this.getValue(a)};b.getBooleanValue=function(a,b){return+this.getValue(a,b)?!0:!1};b.getField=function(a,b){return this.block.params[this._getParamIndex(a)]};b.getStringField=function(a,b){return String(this.getField(a))};b.getNumberField=function(a){return+this.getField(a)};b.getStatement=function(a,b){return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, +b)])};b._getParamIndex=function(a){this._schema||(this._schema=Entry.block[this.type]);return this._schema.paramsKeyMap[a]};b._getStatementIndex=function(a){this._schema||(this._schema=Entry.block[this.type]);return this._schema.statementsKeyMap[a]};b.die=function(){this.block=null;return Entry.STATIC.BREAK}})(Entry.Scope.prototype);Entry.Field=function(){}; +(function(b){b.TEXT_LIMIT_LENGTH=20;b.destroy=function(){$(this.svgGroup).unbind("mouseup touchend");this.destroyOption()};b.command=function(){this._startValue&&(this._startValue===this.getValue()||this._blockView.isInBlockMenu||Entry.do("setFieldValue",this._block,this,this.pointer(),this._startValue,this.getValue()));delete this._startValue};b.destroyOption=function(){this.documentDownEvent&&(Entry.documentMousedown.detach(this.documentDownEvent),delete this.documentDownEvent);this.disposeEvent&& +(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.command()};b._attachDisposeEvent=function(a){var b=this;b.disposeEvent=Entry.disposeEvent.attach(b,a||function(){b.destroyOption()})};b.align=function(a,b,c){var e=this.svgGroup;this._position&&(this._position.x&&(a=this._position.x),this._position.y&&(b=this._position.y));var f="translate("+a+","+b+")";void 0===c||c?e.animate({transform:f},300,mina.easeinout): +e.attr({transform:f});this.box.set({x:a,y:b})};b.getAbsolutePosFromBoard=function(){var a=this._block.view,b=a.getContentPos(),a=a.getAbsoluteCoordinate();return{x:a.x+this.box.x+b.x,y:a.y+this.box.y+b.y}};b.getAbsolutePosFromDocument=function(){var a=this._block.view,b=a.getContentPos(),c=a.getAbsoluteCoordinate(),a=a.getBoard().svgDom.offset();return{x:c.x+this.box.x+b.x+a.left,y:c.y+this.box.y+b.y+a.top}};b.getRelativePos=function(){var a=this._block.view.getContentPos(),b=this.box;return{x:b.x+ +a.x,y:b.y+a.y}};b.truncate=function(){var a=String(this.getValue()),b=this.TEXT_LIMIT_LENGTH,c=a.substring(0,b);a.length>b&&(c+="...");return c};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; +var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var c=b.workspace.selectedBlockView;if(!c||b!=c.getBoard())return!1;b=a.getSvgRoot();return b==c.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| +[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,d){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=d;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this._CONTENT_HEIGHT=this.getContentHeight();this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); +(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this._CONTENT_HEIGHT,c=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:c-b/2,rx:3,ry:3,width:a,height:b,rx:3,ry:3,fill:"#fff","fill-opacity":.4}); +this.svgGroup.appendChild(this.textElement);this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:b})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown touchstart",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var d=b.keyCode||b.which;a.applyValue(b);-1< +[13,27].indexOf(d)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument();b.y-=this.box.height/2;this.optionGroup.css({height:this._CONTENT_HEIGHT,left:b.x,top:b.y,width:a.box.width});this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});$(this.svgOptionGroup).on("mousedown touchstart",function(b){b.stopPropagation();a._updateByCoord(b)});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;b+=15)this._dividerGroup.elem("line", +{x1:49,y1:0,x2:49-(0===b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/2;b.y=b.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+b.x+","+b.y+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()}; +b._updateByCoord=function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var d=b[0]-a[0],g=b[1]-a[1]-49-1,h=Math.atan(-g/d),h=Entry.toDegrees(h),h=90-h;0>d?h+=180:0Math.PI?1:0;this._fillPath=this.svgOptionGroup.elem("path",{d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X",b).replace("%Y",c).replace("%LARGE",a),class:"entry-angle-fill-area"});this.svgOptionGroup.appendChild(this._dividerGroup);this._indicator&&this._indicator.remove();this._indicator=this.svgOptionGroup.elem("line",{x1:0,y1:0,x2:b,y2:c});this._indicator.attr({class:"entry-angle-indicator"})};b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)|| ""===a||(a=this.modValue(a),this.setValue(a),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(a),this.resize())};b.resize=function(){var a=this.getTextWidth();this._header.attr({width:a});this.optionGroup&&this.optionGroup.css({width:a});this.box.set({width:a});this._block.view.alignContent()};b.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+8:8};b.getText=function(){return this.getValue()+"\u00b0"};b.modValue= -function(a){return a%360};b.destroyOption=function(){this.disposeEvent&&(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.svgOptionGroup&&(this.svgOptionGroup.remove(),delete this.svgOptionGroup);this.textElement.textContent=this.getText();this.command()}})(Entry.FieldAngle.prototype);Entry.FieldColor=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=b;this._index=c;this._position=b.position;this.key=b.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(a)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._CONTENT_HEIGHT,b=this._CONTENT_WIDTH,d=this._position,e;d?(e=d.x||0,d=d.y||0):(e=0,d=-a/2);this._header=this.svgGroup.elem("rect",{x:e,y:d,width:b,height:a,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:d,width:b,height:a})};b.renderOptions=function(){var a=this;this._attachDisposeEvent();var b=Entry.FieldColor.getWidgetColorList(); -this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; b.setView=function(a,b){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=b,b!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};b.draw=function(){var a=this._view;this._svg&&this.remove();var b=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);b&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, {duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};b.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};b.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,b=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,b=-1*b+1;this._offsetX=a;this._offsetY=b;this.svgGroup.attr({transform:"translate("+a+","+b+ -")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, -h=e.visible?e.svgDom.width():0;return b.y>d.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var b=a.pageX;a=a.pageY;var c=e.left+(b-e._startX),d=e.top+(a-e._startY);e.svgDom.css({transform:"translate3d("+c+"px,"+d+"px, 0px)"});e._startX=b;e._startY=a;e.left=c;e.top=d}function d(a){$(document).unbind(".block")}this._startY=a.pageY; -var e=this;a.stopPropagation();a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",d);f.bind("touchmove.block",b);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){a=Entry.block[a];void 0===a.changeEvent&&(a.changeEvent=new Entry.Event);a.template=b.template;a.params=b.params;a.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= +")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,c=a.getBoard(),e=c.workspace.blockMenu,f=e.offset().left,g=e.offset().top, +h=e.visible?e.svgDom.width():0;return b.y>c.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var c=a.pageX;a=a.pageY;var d=e.left+(c-e._startX),f=e.top+(a-e._startY);e.svgDom.css({transform:"translate3d("+d+"px,"+f+"px, 0px)"});e._startX=c;e._startY=a;e.left=d;e.top=f}function c(a){$(document).unbind(".block")}this._startY=a.pageY; +var e=this;a.stopPropagation();a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",c);f.bind("touchmove.block",b);f.bind("touchend.block",c);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){var c=Entry.block[a];void 0===c.changeEvent&&(c.changeEvent=new Entry.Event);c.template=b.template;c.params=b.params;c.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; (function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'), +{parent:this.wrapper});this.visible=!0;var c=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){c.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, +this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); +this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, +arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var c=b.scroller;c&&(a.mouseenter(function(a){c.setOpacity(1)}),a.mouseleave(function(a){c.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var c=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-c.x,2)+Math.pow(a.pageY-c.y,2))a&&(f=f+e+10,e=0,c=15);e=Math.max(e,k.width);l=c+15;h._moveTo(f,l,!1);c=c+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()}; +b.updateOffset=function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),c=this._offset;this.relativeOffset={top:c.top-b,left:c.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(c.width/2-65)+","+(c.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var c=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});c.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33, +class:"entryFunctionButtonText"});e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(c).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD, +"cancelEdit")};b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var c=this._getCodeBlocks(a,b);c.sort(function(a,b){return a.point-b.point});c.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=c[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE; +c[e-1].endPoint=f.point}this._magnetMap[b]=c}};b._getCodeBlocks=function(a,b){var c=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gc.endPoint)f=h+1;else{e=c.blocks;for(f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,c=this.trashcanTop;b=a?{translateX:15,translateY:-25, +rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(c).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,c=b.firstChild;c?b.insertBefore(this.svgGroup,c):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Vim=function(b,a){Entry.Vim.MAZE_MODE=1;Entry.Vim.WORKSPACE_MODE=2;Entry.Vim.TEXT_TYPE_JS=0;Entry.Vim.TEXT_TYPE_PY=1;Entry.Vim.PARSER_TYPE_JS_TO_BLOCK=0;Entry.Vim.PARSER_TYPE_PY_TO_BLOCK=1;Entry.Vim.PARSER_TYPE_BLOCK_TO_JS=2;Entry.Vim.PARSER_TYPE_BLOCK_TO_PY=3;Entry.Vim.PYTHON_IMPORT_ENTRY="import Entry";Entry.Vim.PYTHON_IMPORT_HW="import Arduino, Hamster, Albert, Bitbrick, Codeino, Dplay \n\t Neobot, Nemoino, Robotis, Sensorboard, Xbot from Hw";b="string"===typeof b?$("#"+b):$(b);if("DIV"!== b.prop("tagName"))return console.error("Dom is not div element");this.createDom(b);this._mode=Entry.Vim.WORKSPACE_MODE;this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY;this._parser=new Entry.Parser(this._mode,this._parserType,this.codeMirror);Entry.Model(this,!1);window.eventset=[]}; -(function(b){b.createDom=function(a){function b(a){var b=e.getCodeToText(a.block);e.codeMirror.display.dragFunctions.leave(a);var c=Entry.Utils.createMouseEvent("mousedown",a);e.codeMirror.display.scroller.dispatchEvent(c);var b=b.split("\n"),d=b.length-1,f=0;b.forEach(function(a,b){e.codeMirror.replaceSelection(a);f=e.doc.getCursor().line;e.codeMirror.indentLine(f);0!==b&&d===b||e.codeMirror.replaceSelection("\n")});a=Entry.Utils.createMouseEvent("mouseup",a);e.codeMirror.display.scroller.dispatchEvent(a)} -function d(a){e.codeMirror.display.dragFunctions.over(a)}var e;this.view=Entry.Dom("div",{parent:a,class:"entryVimBoard"});this.codeMirror=CodeMirror(this.view[0],{lineNumbers:!0,value:"",mode:{name:"javascript",globalVars:!0},theme:"default",indentUnit:4,indentWithTabs:!0,styleActiveLine:!0,extraKeys:{"Ctrl-Space":"autocomplete"},lint:!0,viewportMargin:10});this.doc=this.codeMirror.getDoc();e=this;a=this.view[0];a.removeEventListener("dragEnd",b);a.removeEventListener("dragOver",d);a.addEventListener("dragEnd", -b);a.addEventListener("dragOver",d)};b.hide=function(){this.view.addClass("entryRemove")};b.show=function(){this.view.removeClass("entryRemove")};b.textToCode=function(a){a===Entry.Vim.TEXT_TYPE_JS?(this._parserType=Entry.Vim.PARSER_TYPE_JS_TO_BLOCK,this._parser.setParser(this._mode,this._parserType,this.codeMirror)):a===Entry.Vim.TEXT_TYPE_PY&&(this._parserType=Entry.Vim.PARSER_TYPE_PY_TO_BLOCK,this._parser.setParser(this._mode,this._parserType,this.codeMirror));a=this.codeMirror.getValue();return this._parser.parse(a)}; -b.codeToText=function(a,b){var c;b&&(this._mode=b.runType);Entry.playground&&(c=Entry.playground.object,c="# "+c.name+" \uc624\ube0c\uc81d\ud2b8\uc758 \ud30c\uc774\uc36c \ucf54\ub4dc");b=b.textType;b===Entry.Vim.TEXT_TYPE_JS?(this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_JS,this._parser.setParser(this._mode,this._parserType,this.codeMirror)):b===Entry.Vim.TEXT_TYPE_PY&&(this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY,this._parser.setParser(this._mode,this._parserType,this.codeMirror));a=this._parser.parse(a, -Entry.Parser.PARSE_GENERAL);b===Entry.Vim.TEXT_TYPE_PY&&(a=c.concat("\n\n").concat(Entry.Vim.PYTHON_IMPORT_ENTRY).concat("\n\n").concat(a));this.codeMirror.setValue(a+"\n");b==Entry.Vim.TEXT_TYPE_PY&&this.codeMirror.getDoc().markText({line:0,ch:0},{line:4,ch:0},{readOnly:!0});a=this.codeMirror.getDoc();a.setCursor({line:a.lastLine()-1})};b.getCodeToText=function(a){var b=this.workspace.oldTextType;b===Entry.Vim.TEXT_TYPE_JS?(this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_JS,this._parser.setParser(this._mode, -this._parserType,this.codeMirror)):b===Entry.Vim.TEXT_TYPE_PY&&(this._parserType=Entry.Vim.PARSER_TYPE_BLOCK_TO_PY,this._parser.setParser(this._mode,this._parserType,this.codeMirror));return this._parser.parse(a,Entry.Parser.PARSE_SYNTAX)};b.setParserAvailableCode=function(a,b){this._parser.setAvailableCode(a,b)}})(Entry.Vim.prototype);Entry.Xml={};Entry.Xml.isTypeOf=function(b,a){return a.getAttribute("type")==b};Entry.Xml.getNextBlock=function(b){b=b.childNodes;for(var a=0;a"+c[1];d.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(d);this.curtainView_=d;Entry.pictureEditable&&(d=Entry.createElement("div","entryPicture"),d.addClass("entryPlaygroundPictureWorkspace"),d.addClass("entryRemove"),this.view_.appendChild(d),this.generatePictureView(d),this.pictureView_=d);d=Entry.createElement("div","entryText");d.addClass("entryPlaygroundTextWorkspace");d.addClass("entryRemove");this.view_.appendChild(d);this.generateTextView(d); +this.textView_=d;Entry.soundEditable&&(d=Entry.createElement("div","entrySound"),d.addClass("entryPlaygroundSoundWorkspace"),d.addClass("entryRemove"),this.view_.appendChild(d),this.generateSoundView(d),this.soundView_=d);d=Entry.createElement("div","entryDefault");d.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(d);this.generateDefaultView(d);this.defaultView_=d;d=Entry.createElement("div","entryCode");d.addClass("entryPlaygroundCodeWorkspace");d.addClass("entryRemove");this.view_.appendChild(d); +this.generateCodeView(d);this.codeView_=d;c=Entry.createElement("div");c.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=c;this.view_.appendChild(c);this.initializeResizeHandle(c);this.codeView_=d;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; +Entry.Playground.prototype.generateTabView=function(b){var a=this,d=Entry.createElement("ul");d.addClass("entryTabListWorkspace");this.tabList_=d;b.appendChild(d);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");d.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", +"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),d.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),d.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= +Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),d.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),d.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); +Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; +Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= +this.mainWorkspace.board;Entry.hw&&this.updateHW()}; +Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var d=Entry.createElement("div","entryAddPictureInner");d.addClass("entryPlaygroundAddPictureInner");d.innerHTML=Lang.Workspace.picture_add;a.appendChild(d);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); +$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var d=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(d,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter2(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"),a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}), +d=Entry.createElement("div","entryAddPictureInner"),d.addClass("entryPlaygroundAddPictureInnerPhone"),d.innerHTML=Lang.Workspace.picture_add,a.appendChild(d),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var d=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(d,g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; +Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var d=Entry.createElement("div");d.addClass("entryTextFontSelect");b.appendChild(d);var c=Entry.createElement("select","entryPainterAttrFontName");c.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");c.size="1";c.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= +0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); +Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,d=0,c=a.length;d -1) { this.tlsSocketIo = this.connectWebSocket('https://hardware.play-entry.org:23518', { query:{ 'client': true, 'roomId' : this.sessionRoomId } }); + } else if(Entry.isOffline){ + this.tlsSocketIo = this.connectWebSocket('http://127.0.0.1:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); } else { - try{ - this.socketIo = this.connectWebSocket('https://127.0.0.1:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); + try { + this.socketIo = this.connectWebSocket('http://127.0.0.1:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); } catch(e) { } - - try{ + try { this.tlsSocketIo = this.connectWebSocket('https://hardware.play-entry.org:23518', { query:{'client': true, 'roomId' : this.sessionRoomId } }); } catch(e) { } } @@ -163,7 +168,19 @@ p.initSocket = function() { } catch(e) {} }; +p.checkOldClient = function() { + try { + var hw = this; + var websocket = new WebSocket('wss://hardware.play-entry.org:23518'); + websocket.onopen = function() { + hw.popupHelper.show('newVersion', true); + websocket.close(); + } + } catch(e) {} +}; + p.retryConnect = function() { + this.isOpenHardware = false; Entry.HW.TRIAL_LIMIT = 5; this.initSocket(); }; @@ -187,19 +204,15 @@ p.initHardware = function(socket) { if (Entry.playground && Entry.playground.object) { Entry.playground.setMenu(Entry.playground.object.objectType); } -}; +} p.disconnectHardware = function() { Entry.propertyPanel.removeMode("hw"); this.selectedDevice = undefined; this.hwModule = undefined; Entry.dispatchEvent("hwChanged"); - // Entry.toast.alert( - // "하드웨어 연결 종료", - // "하드웨어의 연결이 종료되었습니다.", - // false - // ); } + p.disconnectedSocket = function() { this.tlsSocketIo.close(); if(this.socketIo) { @@ -215,7 +228,7 @@ p.disconnectedSocket = function() { Entry.dispatchEvent("hwChanged"); Entry.toast.alert( "하드웨어 프로그램 연결 종료", - "하드웨어 프로그램과 사이의 연결이 종료되었습니다.", + "하드웨어 프로그램과의 연결이 종료되었습니다.", false ); } @@ -303,8 +316,7 @@ p.closeConnection = function() { }; p.downloadConnector = function() { - var url = "http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe"; - var win = window.open(url, '_blank'); + var win = window.open(this.downloadPath, '_blank'); win.focus(); }; @@ -365,12 +377,13 @@ p.checkDevice = function(data) { p.banHW = function() { var hwOptions = this.hwInfo; - for (var i in hwOptions) + for (var i in hwOptions) { Entry.playground.mainWorkspace.blockMenu.banClass(hwOptions[i].name, true); - + } }; p.executeHardware = function() { + var hw = this; var executeIeCustomLauncher = { _bNotInstalled : false, init : function(sUrl, fpCallback) { @@ -379,7 +392,7 @@ p.executeHardware = function() { var left = window.screenLeft; var top = window.screenTop; var settings = 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left; - this._w = window.open('', "comic_viewer_launcher", settings); + this._w = window.open('', "entry_hw_launcher", settings); var fnInterval = null; fnInterval = setTimeout(function() { executeIeCustomLauncher.runViewer(sUrl, fpCallback); @@ -422,8 +435,8 @@ p.executeHardware = function() { this._bNotInstalled = true; } }; - var entryHardwareUrl = 'entryhw://-roomId:' + this.sessionRoomId; + var entryHardwareUrl = 'entryhw://-roomId:' + this.sessionRoomId; if(navigator.userAgent.indexOf("MSIE") > 0 || navigator.userAgent.indexOf("Trident") > 0){ if (navigator.msLaunchUri != undefined) { executeIe(entryHardwareUrl); @@ -436,13 +449,12 @@ p.executeHardware = function() { } if (ieVersion < 9) { - alert("지원하지 않는 브라우저입니다."); + alert(Lang.msgs.not_support_browser); } else { executeIeCustomLauncher.init(entryHardwareUrl, function(bInstalled) { if (bInstalled == false) { - alert('설치안됬엉'); - // window.open(VIWER_DOWNLOAD_URL, "comic_viewer_download", "width=530, height=400, resizable=yes"); + hw.popupHelper.show('hwDownload', true); } } ); @@ -455,7 +467,7 @@ p.executeHardware = function() { else if(navigator.userAgent.indexOf("Chrome") > 0 || navigator.userAgent.indexOf("Safari") > 0) { executeChrome(entryHardwareUrl); } else { - alert("지원하지 않는 브라우저입니다."); + alert(Lang.msgs.not_support_browser); } function executeIe(customUrl) { @@ -463,13 +475,7 @@ p.executeHardware = function() { function() { }, function() { - alert('설치안됬엉'); - // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=510, height=360, resizable=yes"); - // if(window.focus){ - // setTimeout(function(){ - // popup.focus(); - // }, 500); - // } + hw.popupHelper.show('hwDownload', true); } ); } @@ -492,17 +498,7 @@ p.executeHardware = function() { } if(!isInstalled) { - alert('설치안됬엉'); - // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=510, height=360, resizable=yes"); - // if(window.focus){ - // setTimeout(function(){ - // if (popup == null || typeof(popup)=='undefined') { - // alert("Firefox 설정에 팝업 창 차단을 해제해주세요."); - // } else { - // popup.focus(); - // } - // }, 500); - // } + hw.popupHelper.show('hwDownload', true); } document.getElementsByTagName("body")[0].removeChild(iFrame); @@ -520,16 +516,130 @@ p.executeHardware = function() { location.assign(encodeURI(customUrl)); setTimeout(function() { if (isInstalled == false || navigator.userAgent.indexOf("Edge") > 0) { - alert('설치 안됬엉'); - // var popup = window.open(VIWER_DOWNLOAD_URL, "comic_viewer_launcher", "width=530, height=400, resizable=yes"); - // if(window.focus){ - // setTimeout(function(){ - // popup.focus(); - // }, 500); - // } + hw.popupHelper.show('hwDownload', true); } window.onblur = null; }, 1500); } } +p.hwPopupCreate = function () { + var hw = this; + if(!this.popupHelper) { + if(window.popupHelper) { + this.popupHelper = window.popupHelper + } else { + this.popupHelper = new Entry.popupHelper(true); + } + } + + this.popupHelper.addPopup('newVersion', { + type: 'confirm', + title: Lang.Msgs.new_version_title, + setPopupLayout : function (popup) { + var content = Entry.Dom('div', { + class: 'contentArea' + }); + var text = Entry.Dom('div', { + class : 'textArea', + parent: content + }); + var text1 = Entry.Dom('div', { + class : 'text1', + parent: text + }); + var text2 = Entry.Dom('div', { + class : 'text2', + parent: text + }); + var text3 = Entry.Dom('div', { + class : 'text3', + parent: text + }); + var text4 = Entry.Dom('div', { + class : 'text4', + parent: text + }); + var cancel = Entry.Dom('div', { + classes : ['popupCancelBtn', 'popupDefaultBtn'], + parent: content + }); + var ok = Entry.Dom('div', { + classes : ['popupOkBtn', 'popupDefaultBtn'], + parent: content + }); + text1.text(Lang.Msgs.new_version_text1); + text2.html(Lang.Msgs.new_version_text2); + text3.text(Lang.Msgs.new_version_text3); + text4.text(Lang.Msgs.new_version_text4); + cancel.text(Lang.Buttons.cancel); + ok.html(Lang.Msgs.new_version_download); + + content.bindOnClick('.popupDefaultBtn', function (e) { + var $this = $(this); + if($this.hasClass('popupOkBtn')) { + hw.downloadConnector(); + } else { + hw.popupHelper.hide('newVersion'); + } + }); + + popup.append(content); + } + }); + + this.popupHelper.addPopup('hwDownload', { + type: 'confirm', + title: Lang.Msgs.not_install_title, + setPopupLayout : function (popup) { + var content = Entry.Dom('div', { + class: 'contentArea' + }); + var text = Entry.Dom('div', { + class : 'textArea', + parent: content + }); + var text1 = Entry.Dom('div', { + class : 'text1', + parent: text + }); + var text2 = Entry.Dom('div', { + class : 'text2', + parent: text + }); + var text3 = Entry.Dom('div', { + class : 'text3', + parent: text + }); + var text4 = Entry.Dom('div', { + class : 'text4', + parent: text + }); + var cancel = Entry.Dom('div', { + classes : ['popupCancelBtn', 'popupDefaultBtn'], + parent: content + }); + var ok = Entry.Dom('div', { + classes : ['popupOkBtn', 'popupDefaultBtn'], + parent: content + }); + text1.text(Lang.Msgs.hw_download_text1); + text2.html(Lang.Msgs.hw_download_text2); + text3.text(Lang.Msgs.hw_download_text3); + text4.text(Lang.Msgs.hw_download_text4); + cancel.text(Lang.Buttons.cancel); + ok.html(Lang.Msgs.hw_download_btn); + + content.bindOnClick('.popupDefaultBtn', function (e) { + var $this = $(this); + if($this.hasClass('popupOkBtn')) { + hw.downloadConnector(); + } else { + hw.popupHelper.hide('hwDownload'); + } + }); + + popup.append(content); + } + }); +} diff --git a/src/popup_helper.js b/src/popup_helper.js index 1171ae0ffd..9111f6accb 100644 --- a/src/popup_helper.js +++ b/src/popup_helper.js @@ -9,6 +9,7 @@ */ Entry.popupHelper = function(reset) { this.popupList = {}; + this.nextPopupList = []; this.nowContent; if(reset) { window.popupHelper = null; @@ -19,37 +20,26 @@ Entry.popupHelper = function(reset) { var spanArea = ['entryPopupHelperTopSpan', 'entryPopupHelperBottomSpan', 'entryPopupHelperLeftSpan', 'entryPopupHelperRightSpan']; this.body_ = Entry.Dom('div', { classes: ['entryPopup', 'hiddenPopup', 'popupHelper'], - }) - var that = this; - this.body_.bindOnClick(function(e) { - if(that.nowContent && ignoreCloseType.indexOf(that.nowContent.prop('type')) > -1) { - return; - } - var $target = $(e.target); - spanArea.forEach((function (className) { - if($target.hasClass(className)) { - this.popup.hide(); - } - }).bind(this)); - if (e.target==this) { - this.popup.hide(); - } }); + var that = this; - this.body_.bind('touchstart', function(e) { + function popupClickEvent(e) { if(that.nowContent && ignoreCloseType.indexOf(that.nowContent.prop('type')) > -1) { return; } var $target = $(e.target); - spanArea.forEach((function (className) { + spanArea.forEach(function (className) { if($target.hasClass(className)) { - this.popup.hide(); + that.hide(); } - }).bind(this)); - if (e.target==this) { - this.popup.hide(); + }); + if (e.target==that) { + that.hide(); } - }); + } + + this.body_.bindOnClick(popupClickEvent); + this.body_.bind('touchstart', popupClickEvent); window.popupHelper = this; this.body_.prop('popup', this); @@ -154,10 +144,14 @@ Entry.popupHelper.prototype.remove = function(key) { if(this.window_.children().length > 0) { this.window_.children().remove(); } - this.window_.remove(); + // 지워지면 안되는 요소인데 지워지고 있었음. 이유는? 잠시동안만 유지. + // this.window_.remove(); delete this.popupList[key]; this.nowContent = undefined; this.body_.addClass('hiddenPopup'); + if(this.nextPopupList.length > 0) { + this.show(this.nextPopupList.shift()); + } }; /** @@ -168,17 +162,32 @@ Entry.popupHelper.prototype.resize = function(e) { }; -Entry.popupHelper.prototype.show = function(key) { - if(this.window_.children().length > 0) { +Entry.popupHelper.prototype.show = function(key, isNext) { + var that = this; + function showContent(key) { + that.window_.append(that.popupList[key]); + that.nowContent = that.popupList[key]; + that.body_.removeClass('hiddenPopup'); + } + if(!isNext) { this.window_.children().detach(); + showContent(key); + } else { + if(this.window_.children().length > 0) { + this.nextPopupList.push(key) + } else { + this.window_.children().detach(); + showContent(key); + } } - this.window_.append(this.popupList[key]); - this.nowContent = this.popupList[key]; - this.body_.removeClass('hiddenPopup'); }; Entry.popupHelper.prototype.hide = function() { this.nowContent = undefined; this.body_.addClass('hiddenPopup'); + this.window_.children().detach(); + if(this.nextPopupList.length > 0) { + this.show(this.nextPopupList.shift()); + } }; \ No newline at end of file From e8c6bcd241eaf0319db6f35f928d2ac9b4cee312 Mon Sep 17 00:00:00 2001 From: jykim Date: Tue, 25 Oct 2016 17:06:58 +0900 Subject: [PATCH 07/17] =?UTF-8?q?win7=20=EC=84=A4=EC=B9=98=20=ED=8C=9D?= =?UTF-8?q?=EC=97=85=20=EA=B4=80=EB=A0=A8=20=EC=98=A4=EB=A5=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 691 ++++++++++++++++++++++++++++++---------------- dist/entry.min.js | 7 +- src/hw.js | 6 +- 3 files changed, 464 insertions(+), 240 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 0e5663e523..81946d6d30 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -7005,7 +7005,8 @@ Entry.Container.prototype.removeObject = function(b) { this.objects_.splice(a, 1); this.setCurrentObjects(); Entry.stage.sortZorder(); - this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); + a = this.getCurrentObjects(); + a.length ? this.selectObject(a[0].id) : (this.selectObject(), Entry.playground.flushPlayground()); Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg); Entry.variableContainer.removeLocalVariables(b.id); Entry.playground.reloadPlayground(); @@ -7402,9 +7403,9 @@ Entry.Dom = function(b, a) { }; return c; }; -Entry.SVG = function(b) { - b = document.getElementById(b); - return Entry.SVG.createElement(b); +Entry.SVG = function(b, a) { + var d = a ? a : document.getElementById(b); + return Entry.SVG.createElement(d); }; Entry.SVG.NS = "http://www.w3.org/2000/svg"; Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; @@ -7425,6 +7426,7 @@ Entry.SVG.createElement = function(b, a) { d.hasClass = Entry.SVG.hasClass; d.remove = Entry.SVG.remove; d.removeAttr = Entry.SVG.removeAttr; + "text" === b && d.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"); return d; }; Entry.SVG.attr = function(b, a) { @@ -7593,6 +7595,7 @@ Entry.Engine = function() { setInterval(function() { this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); }.bind(this), 100); + Entry.message = new Entry.Event(window); }; Entry.Engine.prototype.generateView = function(b, a) { if (a && "workspace" != a) { @@ -7820,13 +7823,7 @@ Entry.Engine.prototype.toggleRun = function() { }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")); this.state = "run"; "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"); - this.pauseButton.innerHTML = Lang.Workspace.pause; - this.runButton.addClass("run"); - this.runButton.addClass("entryRemove"); - this.stopButton.removeClass("entryRemove"); - this.pauseButton && this.pauseButton.removeClass("entryRemove"); - this.runButton2 && this.runButton2.addClass("entryRemove"); - this.stopButton2 && this.stopButton2.removeClass("entryRemove"); + this.runButton && (this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("run"), this.runButton.addClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.pauseButton && this.pauseButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove"), this.stopButton2 && this.stopButton2.removeClass("entryRemove")); this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0); Entry.stage.selectObject(); Entry.dispatchEvent("run"); @@ -7859,22 +7856,18 @@ Entry.Engine.prototype.toggleStop = function() { createjs.Sound.setVolume(1); createjs.Sound.stop(); this.view_.removeClass("entryEngineBlueWorkspace"); - this.runButton.removeClass("entryRemove"); - this.stopButton.addClass("entryRemove"); - this.pauseButton && this.pauseButton.addClass("entryRemove"); - this.runButton2 && this.runButton2.removeClass("entryRemove"); - this.stopButton2 && this.stopButton2.addClass("entryRemove"); + this.runButton && (this.runButton.removeClass("entryRemove"), this.stopButton.addClass("entryRemove"), this.pauseButton && this.pauseButton.addClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove"), this.stopButton2 && this.stopButton2.addClass("entryRemove")); this.state = "stop"; Entry.dispatchEvent("stop"); Entry.stage.hideInputField(); }; Entry.Engine.prototype.togglePause = function() { var b = Entry.engine.projectTimer; - "pause" == this.state ? (b.pausedTime += (new Date).getTime() - b.pauseStart, b.isPaused ? b.pauseStart = (new Date).getTime() : delete b.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", b.isPaused && (b.pausedTime += (new Date).getTime() - b.pauseStart), b.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, - this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); + "pause" == this.state ? (b.pausedTime += (new Date).getTime() - b.pauseStart, b.isPaused ? b.pauseStart = (new Date).getTime() : delete b.pauseStart, this.state = "run", this.runButton && (this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove"))) : (this.state = "pause", b.isPaused && (b.pausedTime += (new Date).getTime() - b.pauseStart), b.pauseStart = (new Date).getTime(), this.runButton && (this.pauseButton.innerHTML = + Lang.Workspace.restart, this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove"))); }; Entry.Engine.prototype.fireEvent = function(b) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, b); + "run" === this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, b); }; Entry.Engine.prototype.raiseEvent = function(b, a) { b.parent.script.raiseEvent(a, b); @@ -7958,6 +7951,10 @@ Entry.Engine.prototype.updateProjectTimer = function(b) { "undefined" == typeof b ? d.isPaused || a.isState("pause") || d.setValue((c - d.start - d.pausedTime) / 1E3) : (d.setValue(b), d.pausedTime = 0, d.start = c); } }; +Entry.Engine.prototype.raiseMessage = function(b) { + Entry.message.notify(Entry.variableContainer.getMessage(b)); + return Entry.container.mapEntityIncludeCloneOnScene(this.raiseKeyEvent, ["when_message_cast", b]); +}; Entry.EntityObject = function(b) { this.parent = b; this.type = b.objectType; @@ -10672,6 +10669,7 @@ Entry.Painter.prototype.selectToolbox = function(b) { }; Entry.Painter2 = function(b) { this.view = b; + this.baseUrl = Entry.painterBaseUrl || "/lib/literallycanvas/lib/img"; this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; Entry.addEventListener("pictureImport", function(a) { this.addPicture(a); @@ -10681,10 +10679,10 @@ Entry.Painter2 = function(b) { (function(b) { b.initialize = function() { if (!this.lc) { - var a = new Image; - a.src = "/lib/literallycanvas/lib/img/transparent-pattern.png"; - this.lc = LC.init(this.view, {imageURLPrefix:"/lib/literallycanvas/lib/img", zoomMax:3, zoomMin:.5, toolbarPosition:"bottom", imageSize:{width:960, height:540}, backgroundShapes:[LC.createShape("Rectangle", {x:0, y:0, width:960, height:540, strokeWidth:0, strokeColor:"transparent"})]}); - a.onload = function() { + var a = this.baseUrl, b = new Image; + b.src = a + "/transparent-pattern.png"; + this.lc = LC.init(this.view, {imageURLPrefix:a, zoomMax:3, zoomMin:.5, toolbarPosition:"bottom", imageSize:{width:960, height:540}, backgroundShapes:[LC.createShape("Rectangle", {x:0, y:0, width:960, height:540, strokeWidth:0, strokeColor:"transparent"})]}); + b.onload = function() { this.lc.repaintLayer("background"); }.bind(this); a = function(a) { @@ -11366,25 +11364,23 @@ Entry.Popup.prototype.resize = function(b) { Entry.stage && Entry.stage.updateBoundRect(); }; Entry.popupHelper = function(b) { - function a(a) { - if (!(e.nowContent && -1 < d.indexOf(e.nowContent.prop("type")))) { - var b = $(a.target); - c.forEach(function(a) { - b.hasClass(a) && e.hide(); - }); - a.target == e && e.hide(); - } - } this.popupList = {}; this.nextPopupList = []; this.nowContent; b && (window.popupHelper = null); Entry.assert(!window.popupHelper, "Popup exist"); - var d = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; + var a = ["confirm", "spinner"], d = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var e = this; - this.body_.bindOnClick(a); - this.body_.bind("touchstart", a); + var c = this; + this.body_.bindOnClick(function(b) { + if (!(c.nowContent && -1 < a.indexOf(c.nowContent.prop("type")))) { + var f = $(b.target); + d.forEach(function(a) { + f.hasClass(a) && c.hide(); + }); + b.target == c && c.hide(); + } + }); window.popupHelper = this; this.body_.prop("popup", this); Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); @@ -11405,18 +11401,15 @@ Entry.popupHelper.prototype.addPopup = function(b, a) { c.bindOnClick(function() { a.closeEvent ? a.closeEvent(this) : this.hide(); }.bind(this)); - var e = this; - c.bind("touchstart", function() { - a.closeEvent ? a.closeEvent(e) : e.hide(); - }); - var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - f.append(c); - a.title && (c = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(c), c.text(a.title)); + var e = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); + e.append(c); + a.title && (c = Entry.Dom("div", {class:"entryPopupHelperTitle"}), e.append(c), c.text(a.title)); d.addClass(b); - d.append(f); - d.popupWrapper_ = f; + d.append(e); + d.popupWrapper_ = e; d.prop("type", a.type); "function" === typeof a.setPopupLayout && a.setPopupLayout(d); + d._obj = a; this.popupList[b] = d; }; Entry.popupHelper.prototype.hasPopup = function(b) { @@ -11441,6 +11434,9 @@ Entry.popupHelper.prototype.show = function(b, a) { } var c = this; a ? 0 < this.window_.children().length ? this.nextPopupList.push(b) : (this.window_.children().detach(), d(b)) : (this.window_.children().detach(), d(b)); + if (this.nowContent && this.nowContent._obj && this.nowContent._obj.onShow) { + this.nowContent._obj.onShow(); + } }; Entry.popupHelper.prototype.hide = function() { this.nowContent = void 0; @@ -11506,6 +11502,7 @@ Entry.PropertyPanel = function() { var b = this; a.bind("mousedown touchstart", function(a) { b._cover.removeClass("entryRemove"); + b._cover._isVisible = !0; Entry.container.disableSort(); Entry.container.splitterEnable = !0; Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(a) { @@ -11514,8 +11511,9 @@ Entry.PropertyPanel = function() { }); $(document).bind("mouseup touchend", function(a) { if (a = Entry.container.resizeEvent) { - Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(a), b._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; + Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(a), delete Entry.container.resizeEvent; } + b._cover._isVisible && (b._cover._isVisible = !1, b._cover.addClass("entryRemove")); Entry.container.enableSort(); }); }; @@ -16007,20 +16005,13 @@ Entry.ContextMenu = {}; f.empty(); for (var g = 0, h = a.length;g < h;g++) { var k = a[g], l = k.text, m = !1 !== k.enable, n = Entry.Dom("li", {parent:f}); - if (k.divider) { - b = "divider"; - } else { - b = m ? "menuAble" : "menuDisable"; - var q = Entry.Dom("span", {parent:n}); - q.text(l); - m && k.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - e.hide(); - b(a); - }); - }(q, k.callback); - } + k.divider ? b = "divider" : (b = m ? "menuAble" : "menuDisable", Entry.Dom("span", {parent:n}).text(l), m && k.callback && function(a, b) { + a.mousedown(function(a) { + a.preventDefault(); + e.hide(); + b(a); + }); + }(n, k.callback)); n.addClass(b); } f.removeClass("entryRemove"); @@ -17008,10 +16999,10 @@ Entry.Utils.addFilters = function(b, a) { d.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 d = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), c = d.elem("g"), e = c.elem("rect", {x:0, y:0, width:125, height:33}), f = Entry.mediaFilePath + "block_pattern_(order).png", g = 1;5 > g;g++) { - c.elem("image", {class:"pattern" + g, href:f.replace("(order)", g), x:0, y:0, width:125, height:33}); + for (var d = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), c = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { + d.elem("image", {class:"pattern" + e, href:c.replace("(order)", e), x:0, y:0, width:125, height:33}); } - return {pattern:d, rect:e}; + return {pattern:d}; }; Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; Entry.Utils.createMouseEvent = function(b, a) { @@ -17888,13 +17879,13 @@ p.executeHardware = function() { }, 1500); } var c = this, e = {_bNotInstalled:!1, init:function(a, b) { - this._w = window.open("", "entry_hw_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); + this._w = window.open("/views/hwLoading.html", "entry_hw_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); var c = null, c = setTimeout(function() { e.runViewer(a, b); clearInterval(c); }, 1E3); }, runViewer:function(a, b) { - this._w.document.write(""); + this._w.document.write(""); var c = 0, d = null, d = setInterval(function() { try { this._w.location.href; @@ -17915,7 +17906,9 @@ p.executeHardware = function() { }.bind(this), 100); }, set:function() { this._bNotInstalled = !0; - }}, f = "entryhw://-roomId:" + this.sessionRoomId; + }}; + c.ieLauncher = e; + var f = "entryhw://-roomId:" + this.sessionRoomId; 0 < navigator.userAgent.indexOf("MSIE") || 0 < navigator.userAgent.indexOf("Trident") ? void 0 != navigator.msLaunchUri ? b(f) : 9 > (0 < document.documentMode ? document.documentMode : navigator.userAgent.match(/(?:MSIE) ([0-9.]+)/)[1]) ? alert(Lang.msgs.not_support_browser) : e.init(f, function(a) { 0 == a && c.popupHelper.show("hwDownload", !0); }) : 0 < navigator.userAgent.indexOf("Firefox") ? a(f) : 0 < navigator.userAgent.indexOf("Chrome") || 0 < navigator.userAgent.indexOf("Safari") ? d(f) : alert(Lang.msgs.not_support_browser); @@ -18804,6 +18797,11 @@ Entry.VariableContainer.prototype.select = function(b) { this.selected && (this.selected.listElement.removeClass("selected"), this.selected.callerListElement && (this.listView_.removeChild(this.selected.callerListElement), delete this.selected.callerListElement), this.selected = null); b && (b.listElement.addClass("selected"), this.selected = b, b instanceof Entry.Variable ? (this.renderVariableReference(b), b.object_ && Entry.container.selectObject(b.object_, !0)) : b instanceof Entry.Func ? this.renderFunctionReference(b) : this.renderMessageReference(b)); }; +Entry.VariableContainer.prototype.getMessage = function(b) { + return this.messages_.filter(function(a) { + return a.id === b; + })[0]; +}; Entry.VariableContainer.prototype.renderMessageReference = function(b) { for (var a = this, d = this._messageRefs, c = b.id, e = [], f = 0;f < d.length;f++) { -1 < d[f].block.params.indexOf(c) && e.push(d[f]); @@ -20486,9 +20484,7 @@ Entry.BlockMenu = function(b, a, d, c) { this.setWidth(); this.svg = Entry.SVG(this._svgId); Entry.Utils.addFilters(this.svg, this.suffix); - a = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = a.rect; - this.pattern = a.pattern; + this.pattern = Entry.Utils.addBlockPattern(this.svg, this.suffix).pattern; this.svgGroup = this.svg.elem("g"); this.svgThreadGroup = this.svgGroup.elem("g"); this.svgThreadGroup.board = this; @@ -20568,7 +20564,7 @@ Entry.BlockMenu = function(b, a, d, c) { if (g.code && (b = e.block, c = b.getThread(), b && c)) { b = c.toJSON(!0); this._boardBlockView = Entry.do("addThread", b).value.getFirstBlock().view; - var g = this.offset().top - g.offset().top, h, k; + var g = this.offset().top - g.offset().top - $(window).scrollTop(), h, k; if (b = this.dragBlock.mouseDownCoordinate) { h = a.pageX - b.x, k = a.pageY - b.y; } @@ -20795,9 +20791,8 @@ Entry.BlockMenu = function(b, a, d, c) { var b = a.keyCode, c = Entry.type; a.ctrlKey && "workspace" == c && 48 < b && 58 > b && (a.preventDefault(), this.selectMenu(b - 49)); }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); + b.enablePattern = function() { + this.pattern.removeAttribute("style"); }; b.disablePattern = function() { this.pattern.attr({style:"display: none"}); @@ -20893,6 +20888,7 @@ Entry.BlockMenuScroller = function(b) { this.createScrollBar(); this.setOpacity(0); this._addControl(); + this._domHeight = 0; Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); }; Entry.BlockMenuScroller.RADIUS = 7; @@ -20904,10 +20900,11 @@ Entry.BlockMenuScroller.RADIUS = 7; }; b.resizeScrollBar = function() { this._updateRatio(); - if (this._visible && 0 !== this.vRatio) { - var a = this.board.blockMenuContainer; - this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); + var a = this.board.blockMenuContainer, b = a.height(); + if (b !== this._domHeight) { + return this._domHeight = b, this.board.align(); } + this._visible && 0 !== this.vRatio && this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); }; b.updateScrollBar = function(a) { this.vY += a; @@ -20932,9 +20929,10 @@ Entry.BlockMenuScroller.RADIUS = 7; return this._visible; }; b._updateRatio = function() { - var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), c = a.blockMenuContainer.height(), a = a.offset(); - this.vRatio = b = (b.height + (b.top - a.top) + 10) / c; - 1 >= b ? this.setVisible(!1) : this.setVisible(!0); + var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), c = a.blockMenuContainer.height(); + a.offset(); + this.vRatio = a = (b.height + 20) / c; + 1 >= a ? this.setVisible(!1) : this.setVisible(!0); }; b._reset = function() { this.vY = 0; @@ -20983,17 +20981,21 @@ Entry.BlockView = function(b, a, d) { this._observers = []; this.set(b); this.svgGroup = a.svgBlockGroup.elem("g"); - this._schema = Entry.block[b.type]; + this._schema = Entry.skinContainer.getSkin(b); if (void 0 === this._schema) { this.block.destroy(!1, !1); } else { + this._schema.deletable && this.block.setDeletable(this._schema.deletable); + this._schema.copyable && this.block.setCopyable(this._schema.copyable); + !1 === this._schema.display && this.set({display:!1}); this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); var e = this._skeleton = Entry.skeleton[this._schema.skeleton]; this._contents = []; this._statements = []; + this._extensions = []; this.magnet = {}; this._paramMap = {}; - e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); + e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g", {class:"entryBlockNextGroup"}), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; this.mouseHandler = function() { var a = c.block.events; @@ -21029,6 +21031,7 @@ Entry.BlockView.pngMap = {}; b._startRender = function(a, b) { var c = this, e = this._skeleton; this.svgGroup.attr({class:"block"}); + this._schema.css && this.svgGroup.attr({style:this._schema.css}); var f = e.classes; f && 0 !== f.length && f.forEach(function(a) { c.svgGroup.addClass(a); @@ -21037,7 +21040,7 @@ Entry.BlockView.pngMap = {}; this.pathGroup = this.svgGroup.elem("g"); this._updateMagnet(); this._path = this.pathGroup.elem("path"); - this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { + Entry.isMobile() || ($(this._path).mouseenter(function(a) { c._mouseEnable && c._changeFill(!0); }), $(this._path).mouseleave(function(a) { c._mouseEnable && c._changeFill(!1); @@ -21057,23 +21060,27 @@ Entry.BlockView.pngMap = {}; this._path.attr(f); this._moveTo(this.x, this.y, !1); this._startContentRender(b); + this._startExtension(b); !0 !== this._board.disableMouseEvent && this._addControl(); + (e = this.guideSvgGroup) && this.svgGroup.insertBefore(e, this.svgGroup.firstChild); this.bindPrev(); }; b._startContentRender = function(a) { a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; - this.contentSvgGroup && this.contentSvgGroup.remove(); var b = this._schema; - b.statements && b.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); + this.contentSvgGroup && this.contentSvgGroup.remove(); + this.statementSvgGroup && this.statementSvgGroup.remove(); this._contents = []; - this.contentSvgGroup = this.svgGroup.elem("g"); - b.statements && b.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); + this.contentSvgGroup = this.svgGroup.elem("g", {class:"contentsGroup"}); + b.statements && b.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g", {class:"statementGroup"})); switch(a) { case Entry.Workspace.MODE_BOARD: ; case Entry.Workspace.MODE_OVERLAYBOARD: for (var c = /(%\d)/mi, e = (b.template ? b.template : Lang.template[this.block.type]).split(c), f = b.params, g = 0;g < e.length;g++) { - var h = e[g].trim(); + var h = e[g]; + " " === h[0] && (h = h.substring(1)); + " " === h[h.length - 1] && (h = h.substring(0, h.length - 1)); if (0 !== h.length) { if (c.test(h)) { var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); @@ -21105,6 +21112,11 @@ Entry.BlockView.pngMap = {}; } this.alignContent(!1); }; + b._startExtension = function(a) { + this._extensions = this.block.extensions.map(function(b) { + return new Entry["Ext" + b.type](b, this, a); + }.bind(this)); + }; b._updateSchema = function() { this._startContentRender(); }; @@ -21145,6 +21157,7 @@ Entry.BlockView.pngMap = {}; var a = this._skeleton.path(this); this._path.attr({d:a}); this.set({animating:!1}); + this._setBackgroundPath(); }; b._setPosition = function(a) { this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); @@ -21159,7 +21172,7 @@ Entry.BlockView.pngMap = {}; this.getBoard().svgBlockGroup.appendChild(this.svgGroup); }; b._moveTo = function(a, b, c) { - this.set({x:a, y:b}); + this.display ? this.set({x:a, y:b}) : this.set({x:-99999, y:-99999}); this._lazyUpdatePos(); this.visible && this.display && this._setPosition(c); }; @@ -21247,8 +21260,7 @@ Entry.BlockView.pngMap = {}; var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg; a = !1; var h = this.block.getPrevBlock(this.block); - a = !1; - switch(Entry.GlobalSvg.terminateDrag(this)) { + switch(g.terminateDrag(this)) { case g.DONE: g = b.magnetedBlockView; g instanceof Entry.BlockView && (g = g.block); @@ -21307,6 +21319,9 @@ Entry.BlockView.pngMap = {}; this._contents.forEach(function(a) { a.constructor !== Entry.Block && a.destroy(); }); + this._statements.forEach(function(a) { + a.destroy(); + }); var c = this.block; a = c.events.viewDestroy; "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { @@ -21332,7 +21347,7 @@ Entry.BlockView.pngMap = {}; b._updateBG = function() { if (this._board.dragBlock && this._board.dragBlock.dragInstance) { var a = this.svgGroup; - if (this.magnet.next) { + if (this.magnet.next || this.magnet.previous) { if (a = this.magneting) { var b = this._board.dragBlock.getShadow(), c = this.getAbsoluteCoordinate(), e; if ("previous" === a) { @@ -21404,15 +21419,17 @@ Entry.BlockView.pngMap = {}; c._moveBy(a, a, !1); }, b) : c._moveBy(a, a, !1); }; - b.bindPrev = function(a) { + b.bindPrev = function(a, b) { if (a) { - if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { - var b = this.block.getLastBlock(); - b.view.magnet.next ? a.view._toLocalCoordinate(b.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); + this._toLocalCoordinate(a.view._nextGroup); + var c = a.getNextBlock(); + if (c && c && c !== this.block) { + var e = this.block.getLastBlock(); + b ? c.view._toLocalCoordinate(a.view._nextGroup) : e.view.magnet.next ? c.view._toLocalCoordinate(e.view._nextGroup) : (c.view._toGlobalCoordinate(), c.separate(), c.view.bumpAway(null, 100)); } } else { if (a = this.block.getPrevBlock()) { - this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); + this._toLocalCoordinate(a.view._nextGroup), (c = this.block.getNextBlock()) && c.view && c.view._toLocalCoordinate(this._nextGroup); } } }; @@ -21453,9 +21470,9 @@ Entry.BlockView.pngMap = {}; }; b._changeFill = function(a) { var b = this.getBoard(); - if (b.patternRect && !b.dragBlock) { + if (!b.dragBlock) { var c = this._fillColor, e = this._path, b = this.getBoard(); - a ? (b.setPatternRectFill(c), c = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : b.disablePattern(); + a ? (c = "url(#blockHoverPattern_" + this.getBoard().suffix + ")", b.enablePattern()) : b.disablePattern(); e.attr({fill:c}); } }; @@ -21473,7 +21490,7 @@ Entry.BlockView.pngMap = {}; if (b) { for (var c = 0;c < b.length;c++) { var e = b[c]; - e instanceof Entry.Block && e.view.reDraw(); + e instanceof Entry.Block && e.view && e.view.reDraw(); } } if (a = a.statements) { @@ -21481,6 +21498,11 @@ Entry.BlockView.pngMap = {}; a[c].view.reDraw(); } } + if (a = this._extensions) { + for (c = 0;c < a.length;c++) { + b = a[c], b.updatePos && b.updatePos(); + } + } } }; b.getParam = function(a) { @@ -21562,12 +21584,14 @@ Entry.BlockView.pngMap = {}; } return f.promise(); }; - b.downloadAsImage = function() { - this.getDataUrl().then(function(a) { - var b = document.createElement("a"); - b.href = a.src; - b.download = "\uc5d4\ud2b8\ub9ac \ube14\ub85d.png"; - b.click(); + b.downloadAsImage = function(a) { + this.getDataUrl().then(function(b) { + var c = document.createElement("a"); + c.href = b.src; + b = "\uc5d4\ud2b8\ub9ac \ube14\ub85d"; + a && (b += a); + c.download = b + ".png"; + c.click(); }); }; b._rightClick = function(a) { @@ -21592,6 +21616,17 @@ Entry.BlockView.pngMap = {}; Entry.ContextMenu.show(b, null, {x:a.clientX, y:a.clientY}); } }; + b.clone = function() { + return this.svgGroup.cloneNode(!0); + }; + b._setBackgroundPath = function() { + this._backgroundPath && $(this._backgroundPath).remove(); + var a = this._path.cloneNode(!0); + a.setAttribute("class", "blockBackgroundPath"); + a.setAttribute("fill", this._fillColor); + this._backgroundPath = a; + this.pathGroup.insertBefore(a, this._path); + }; })(Entry.BlockView.prototype); Entry.Code = function(b, a) { Entry.Model(this, !1); @@ -21618,12 +21653,12 @@ Entry.PARAM = -1; } return this; }; - b.clear = function() { - for (var a = this._data.length - 1;0 <= a;a--) { - this._data[a].destroy(!1); + b.clear = function(a) { + a = void 0 === a ? !1 : a; + for (var b = this._data.length - 1;0 <= b;b--) { + this._data[b].destroy(!1, a); } this.clearExecutors(); - this._eventMap = {}; }; b.createView = function(a) { null === this.view ? this.set({view:new Entry.CodeView(this, a), board:a}) : (this.set({board:a}), a.bindCodeView(this.view)); @@ -21695,6 +21730,7 @@ Entry.PARAM = -1; } var c = new Entry.Thread(a, this); void 0 === b ? this._data.push(c) : this._data.insert(c, b); + this.changeEvent.notify(); return c; }; b.cloneThread = function(a, b) { @@ -21715,11 +21751,11 @@ Entry.PARAM = -1; return a; }); }; - b.toJSON = function() { - for (var a = this.getThreads(), b = [], c = 0, e = a.length;c < e;c++) { - b.push(a[c].toJSON()); + b.toJSON = function(a) { + for (var b = this.getThreads(), c = [], e = 0, f = b.length;e < f;e++) { + c.push(b[e].toJSON(!1, void 0, a)); } - return b; + return c; }; b.countBlock = function() { for (var a = this.getThreads(), b = 0, c = 0;c < a.length;c++) { @@ -21735,8 +21771,8 @@ Entry.PARAM = -1; c = this.board; c instanceof Entry.BlockMenu && c.updateSplitters(b); }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + b.stringify = function(a) { + return JSON.stringify(this.toJSON(a)); }; b.dominate = function(a) { a.view.setZIndex(this._maxZIndex++); @@ -21990,6 +22026,79 @@ Entry.Scope = function(b, a) { return Entry.STATIC.BREAK; }; })(Entry.Scope.prototype); +Entry.BlockExtension = function(b, a) { +}; +(function(b) { +})(Entry.BlockExtension.prototype); +Entry.ExtGuide = function(b, a, d) { + this.blockView = a; + this.block = a.block; + this.model = b.model ? b.model : []; + this.render(); +}; +(function(b) { + b.render = function() { + if (this.model) { + var a = this.blockView.getBoard(); + this.svgGroup = this.blockView.svgGroup.elem("g", {class:"extension guideGroup"}); + this.blockView.guideSvgGroup = this.svgGroup; + $(this.svgGroup).bind("mousedown touchstart", function(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + }); + var b = this.block.getCode(); + this.model[0].x = -99999; + this.model[0].y = -99999; + b = b.createThread(this.model); + !b.view && b.createView(a); + a = b.getFirstBlock().view.clone(); + a.removeAttribute("transform"); + this.svgGroup.appendChild(a); + this.updatePos(); + this.block.getThread().view.setHasGuide(!0); + b.destroy(!1); + } + }; + b.updatePos = function() { + this.svgGroup.attr("transform", this._getTransform()); + }; + b._getTransform = function() { + return "translate(0,%y)".replace("%y", this.blockView.magnet.next.y); + }; +})(Entry.ExtGuide.prototype); +Entry.ExtSideTag = function(b, a, d) { + this.blockView = a; + this.color = b.color ? b.color : "#EBC576"; + this.text = b.text ? b.text : ""; + this.height = b.height ? +b.height : 31 * +b.count; + this.render(); + this.updatePos(); +}; +(function(b) { + b.render = function() { + this.svgGroup = this.blockView.svgGroup.elem("g"); + $(this.svgGroup).bind("mousedown touchstart", function(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + }); + this.path = this.svgGroup.elem("path").attr({d:"m0,2 h-9 v" + (this.height - 4) + " h9", stroke:this.color, fill:"transparent", "stroke-width":"3"}); + this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":"10px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:"#000000"}); + this.tspans = this.text.split("\n").map(function(a) { + var b = this.textElement.elem("tspan").attr({dy:"1.2em", x:"0", "class":"extension sideTagTspan"}); + b.textContent = a; + return b; + }.bind(this)); + }; + b.updatePos = function() { + this.positionX = 8 * -(this.blockView.block.pointer().length - 2); + this.svgGroup.attr("transform", "translate(" + this.positionX + ",0)"); + this.textElement.attr({y:this.height / 2 - 12 * (this.tspans.length - 1) - 2}); + var a = this.textElement.getBoundingClientRect(); + this.tspans.map(function(b) { + b.attr({x:-a.width - 14}); + }); + }; +})(Entry.ExtSideTag.prototype); Entry.Field = function() { }; (function(b) { @@ -22042,10 +22151,27 @@ Entry.Field = function() { return this._block.view.getBoard().svgGroup.elem("g"); }; b.getValue = function() { - return this._block.params[this._index]; + var a = this._block.params[this._index]; + if (this._contents && this._contents.reference && this._contents.reference.length) { + var b = this._contents.reference.concat(); + "%" === b[0][0] && (a = this._block.params[parseInt(b.shift().substr(1)) - 1]); + return a ? a.getDataByPointer(b) : a; + } + return a; }; b.setValue = function(a, b) { - this.value != a && (this.value = a, this._block.params[this._index] = a, b && this._blockView.reDraw()); + if (this.value != a) { + this.value = a; + if (this._contents && this._contents.reference && this._contents.reference.length) { + var c = this._contents.reference.concat(), e = c.pop(), f = this._block.params[this._index]; + c.length && "%" === c[0][0] && (f = this._block.params[parseInt(c.shift().substr(1)) - 1]); + c.length && (f = f.getDataByPointer(c)); + f.params[e] = a; + } else { + this._block.params[this._index] = a; + } + b && this._blockView.reDraw(); + } }; b._isEditable = function() { if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { @@ -22510,7 +22636,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); this.resize(); }; b.getTextByValue = function(a) { - if (!a || "null" === a) { + if (!a && "number" !== typeof a || "null" === a) { return Lang.Blocks.no_target; } for (var b = this._contents.options, c = 0, e = b.length;c < e;c++) { @@ -22519,7 +22645,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); return f[0]; } } - return Lang.Blocks.no_target; + return "?" === a ? a : Lang.Blocks.no_target; }; b.getContentHeight = function(a) { return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); @@ -22614,7 +22740,7 @@ Entry.FieldIndicator = function(b, a, d) { this._blockView = a; this.box = new Entry.BoxModel; this._size = b.size; - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? b.img.replace(".png", "_un.png") : b.img; + b.img ? this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? b.img.replace(".png", "_un.png") : b.img : b.color && (this._color = b.color); this._boxMultiplier = b.boxMultiplier || 2; this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; this._position = b.position; @@ -22628,9 +22754,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); b.renderStart = function() { this.svgGroup && this.svgGroup.remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); - var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); - this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); + this._imgUrl && (this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size})); + var a = "m %s,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); + this._path = this.svgGroup.elem("path", {d:a, x:this._position ? -1 * this._size : 0, y:-1 * this._size, stroke:"none", fill:this._color ? this._color : "none"}); this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); }; b.enableHighlight = function() { @@ -22865,6 +22991,7 @@ Entry.FieldStatement = function(b, a, d) { this.acceptType = b.accept; this._thread = this.statementSvgGroup = this.svgGroup = null; this._position = b.position; + this._events = []; this.observe(a, "alignContent", ["height"], !1); this.observe(this, "_updateBG", ["magneting"], !1); this.renderStart(a.getBoard()); @@ -22886,8 +23013,10 @@ Entry.FieldStatement = function(b, a, d) { if (a = b.getFirstBlock()) { a.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = a; } - b.changeEvent.attach(this, this.calcHeight); - b.changeEvent.attach(this, this.checkTopBlock); + a = b.changeEvent.attach(this, this.calcHeight); + var c = b.changeEvent.attach(this, this.checkTopBlock); + this._events.push([b.changeEvent, a]); + this._events.push([b.changeEvent, c]); this.calcHeight(); }; b.align = function(a, b, c) { @@ -22915,6 +23044,10 @@ Entry.FieldStatement = function(b, a, d) { this._blockView.dominate(); }; b.destroy = function() { + for (;this._events.length;) { + var a = this._events.pop(); + a[0].detach(a[1]); + } }; b._updateBG = function() { if (this._board.dragBlock && this._board.dragBlock.dragInstance) { @@ -23141,7 +23274,7 @@ Entry.Mutator = function() { })(Entry.Mutator); (function(b) { })(Entry.Mutator.prototype); -Entry.RenderView = function(b, a) { +Entry.RenderView = function(b, a, d) { this._align = a || "CENTER"; b = "string" === typeof b ? $("#" + b) : $(b); if ("DIV" !== b.prop("tagName")) { @@ -23150,12 +23283,14 @@ Entry.RenderView = function(b, a) { this.view = b; this.viewOnly = !0; this.suffix = "renderView"; + this._scale = void 0 === d ? 1 : d; this.disableMouseEvent = this.visible = !0; this._svgId = "renderView_" + (new Date).getTime(); this._generateView(); this.offset = this.svgDom.offset(); - this.setWidth(); - this.svg = Entry.SVG(this._svgId); + this._minBlockOffsetX = 0; + this._setSize(); + this.svg = Entry.SVG(this._svgId, this.svgDom[0]); Entry.Utils.addFilters(this.svg, this.suffix); this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); }; @@ -23170,7 +23305,7 @@ Entry.RenderView = function(b, a) { return console.error("You must inject code instance"); } this.code = a; - this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); + this.svg || (this.svg = Entry.SVG(this._svgId, this.svgDom[0]), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); a.createView(this); this.align(); this.resize(); @@ -23178,14 +23313,18 @@ Entry.RenderView = function(b, a) { b.align = function() { var a = this.code.getThreads(); if (a && 0 !== a.length) { - for (var b = 0, c = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { - var g = a[e].getFirstBlock().view; - g._moveTo(c, b - g.offsetY, !1); - g = g.svgGroup.getBBox().height; - b += g + 15; + for (var b = 0, c = this._getHorizontalPadding(), e = 0, f = a.length;e < f;e++) { + var g = a[e].getFirstBlock().view, h = g.svgGroup.getBBox().height, k = 0, l = $(g.svgGroup).find(".extension"); + if (l) { + for (e = 0;e < l.length;e++) { + var m = parseFloat(l[e].getAttribute("x")), k = Math.min(k, m) + } + } + this._minBlockOffsetX = Math.min(this._minBlockOffsetX, g.offsetX); + g._moveTo(c - k - g.offsetX, b - g.offsetY, !1); + b += h + 15; } - this._bBox = this.svgGroup.getBBox(); - this.height = this._bBox.height; + this._setSize(); } }; b.hide = function() { @@ -23194,9 +23333,9 @@ Entry.RenderView = function(b, a) { b.show = function() { this.view.removeClass("entryRemove"); }; - b.setWidth = function() { - this._svgWidth = this.svgDom.width(); - this.offset = this.svgDom.offset(); + b._setSize = function() { + this.svgDom && (this._svgWidth = this.svgDom.width(), this.offset = this.svgDom.offset()); + this.svgGroup && (this._bBox = this.svgGroup.getBBox()); }; b.bindCodeView = function(a) { this.svgBlockGroup.remove(); @@ -23207,7 +23346,29 @@ Entry.RenderView = function(b, a) { this.svgGroup.appendChild(this.svgBlockGroup); }; b.resize = function() { - this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); + this.svg && this._bBox && setTimeout(function() { + this._setSize(); + var a = Math.round(this._bBox.width), b = Math.round(this._bBox.height); + 0 !== a && 0 !== b && ($(this.svg).css({width:a + this._getHorizontalPadding() - this._minBlockOffsetX, height:b + 5}), setTimeout(function() { + var c = this.svgGroup.getBBox(); + Math.round(c.width) === a && Math.round(c.height) === b || this.resize(); + }.bind(this), 1E3)); + }.bind(this), 0); + }; + b.setDomSize = function() { + this.svgBlockGroup && this.svgBlockGroup.attr("transform", "scale(1)"); + this.code.view.reDraw(); + this.align(); + this.resize(); + 1 !== this._scale && window.setTimeout(function() { + this.svgBlockGroup.attr("transform", "scale(%scale)".replace("%scale", this._scale)); + this.align(); + this.resize(); + }.bind(this), 0); + }; + b._getHorizontalPadding = function() { + var a = {LEFT:20, LEFT_MOST:0}[this._align]; + return void 0 !== a ? a : this.svgDom.width() / 2; }; })(Entry.RenderView.prototype); Entry.Scroller = function(b, a, d) { @@ -23372,9 +23533,7 @@ Entry.Board.DRAG_RADIUS = 5; this.svgBlockGroup.board = this; a.isOverlay ? (this.wrapper.addClass("entryOverlayBoard"), this.generateButtons(), this.suffix = "overlayBoard") : this.suffix = "board"; Entry.Utils.addFilters(this.svg, this.suffix); - a = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = a.rect; - this.pattern = a.pattern; + this.pattern = Entry.Utils.addBlockPattern(this.svg, this.suffix).pattern; }; b.changeCode = function(a) { this.code && this.codeListener && this.code.changeEvent.detach(this.codeListener); @@ -23496,7 +23655,7 @@ Entry.Board.DRAG_RADIUS = 5; l > a && (f = f + e + 10, e = 0, c = 15); e = Math.max(e, k.width); l = c + 15; - h._moveTo(f, l, !1); + h._moveTo(f - k.x, l, !1); c = c + k.height + 15; } } @@ -23540,25 +23699,28 @@ Entry.Board.DRAG_RADIUS = 5; this.workspace.setMode(Entry.Workspace.MODE_BOARD, "save"); }; b.generateCodeMagnetMap = function() { - var a = this.code; - if (a && this.dragBlock) { - for (var b in this.dragBlock.magnet) { - var c = this._getCodeBlocks(a, b); - c.sort(function(a, b) { - return a.point - b.point; - }); - c.unshift({point:-Number.MAX_VALUE, blocks:[]}); - for (var e = 1;e < c.length;e++) { - var f = c[e], g = f, h = f.startBlock; - if (h) { - for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = c[l], g);) { + var a = this.code, b = this.dragBlock; + if (a && b) { + this._magnetMap = {}; + for (var c in b.magnet) { + if ("next" !== c || void 0 !== b.block.getLastBlock().view.magnet.next) { + var e = this._getCodeBlocks(a, c); + e.sort(function(a, b) { + return a.point - b.point; + }); + e.unshift({point:-Number.MAX_VALUE, blocks:[]}); + for (var f = 1;f < e.length;f++) { + var g = e[f], h = g, k = g.startBlock; + if (k) { + for (var l = g.endPoint, m = f;l > h.point && (h.blocks.push(k), m++, h = e[m], h);) { + } + delete g.startBlock; } - delete f.startBlock; + g.endPoint = Number.MAX_VALUE; + e[f - 1].endPoint = g.point; } - f.endPoint = Number.MAX_VALUE; - c[e - 1].endPoint = f.point; + this._magnetMap[c] = e; } - this._magnetMap[b] = c; } } }; @@ -23572,8 +23734,7 @@ Entry.Board.DRAG_RADIUS = 5; f = this._getPreviousMagnets; break; case "string": - f = this._getFieldMagnets; - break; + ; case "boolean": f = this._getFieldMagnets; break; @@ -23736,9 +23897,8 @@ Entry.Board.DRAG_RADIUS = 5; b.dominate = function(a) { a && (a = a.getFirstBlock()) && (this.svgBlockGroup.appendChild(a.view.svgGroup), this.code.dominate(a.thread)); }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); + b.enablePattern = function() { + this.pattern.removeAttribute("style"); }; b.disablePattern = function() { this.pattern.attr({style:"display: none"}); @@ -23781,10 +23941,15 @@ Entry.Board.DRAG_RADIUS = 5; }}}, {activated:!0, option:{text:Lang.Blocks.tidy_up_block, callback:function() { a.alignThreads(); }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { - a.code.clear(); + a.code.clear(!0); }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome() && !Entry.isMobile(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() { - a.code.getThreads().forEach(function(a) { - (a = a.getFirstBlock()) && a.view.downloadAsImage(); + var b = a.code.getThreads(), c = []; + b.forEach(function(a, f) { + var g = a.getFirstBlock(); + g && (console.log("threads.length=", b.length), 1 < b.length && Entry.isOffline ? g.view.getDataUrl().then(function(a) { + c.push(a); + c.length == b.length && Entry.dispatchEvent("saveBlockImages", {images:c}); + }) : g.view.downloadAsImage(++f)); }); }}}]; }; @@ -24002,6 +24167,44 @@ Entry.skeleton.basic_double_loop = {path:function(b) { }, contentPos:function(b) { return {x:14, y:Math.max(b.contentHeight % 1E6, 28) / 2 + 1}; }}; +Entry.skinContainer = {_skins:{}}; +(function(b) { + b.skinSchema = {type:"", condition:[]}; + b.loadSkins = function(a) { + a.map(this.addSkin.bind(this)); + }; + b.addSkin = function(a) { + var b = function() { + }; + b.prototype = Entry.block[a.type]; + var b = new b, c; + for (c in a) { + b[c] = a[c]; + } + this._skins[a.type] || (this._skins[a.type] = []); + this._skins[a.type].push(b); + }; + b.getSkin = function(a) { + if (this._skins[a.type]) { + for (var b = this._skins[a.type], c = 0;c < b.length;c++) { + var e = b[c]; + if (!e.conditions || !e.conditions.length) { + return e; + } + for (var f = 0;f < e.conditions.length;f++) { + var g = e.conditions[f]; + if (a.getDataByPointer(g.pointer) !== g.value) { + break; + } + if (f === e.conditions.length - 1) { + return e; + } + } + } + } + return Entry.block[a.type]; + }; +})(Entry.skinContainer); Entry.Thread = function(b, a, d) { this._data = new Entry.Collection; this._code = a; @@ -24075,18 +24278,19 @@ Entry.Thread = function(b, a, d) { c.load(f, b); return c; }; - b.toJSON = function(a, b) { - for (var c = [], e = void 0 === b ? 0 : b;e < this._data.length;e++) { - this._data[e] instanceof Entry.Block && c.push(this._data[e].toJSON(a)); + b.toJSON = function(a, b, c) { + var e = []; + for (b = void 0 === b ? 0 : b;b < this._data.length;b++) { + this._data[b] instanceof Entry.Block && e.push(this._data[b].toJSON(a, c)); } - return c; + return e; }; - b.destroy = function(a) { - this._code.destroyThread(this, !1); + b.destroy = function(a, b) { this.view && this.view.destroy(a); - for (var b = this._data, c = b.length - 1;0 <= c;c--) { - b[c].destroy(a); + for (var c = this._data, e = c.length - 1;0 <= e;e--) { + c[e].destroy(a, null, b); } + !c.length && this._code.destroyThread(this, !1); }; b.getBlock = function(a) { return this._data[a]; @@ -24180,12 +24384,13 @@ Entry.Thread = function(b, a, d) { }; b.getBlockList = function(a, b) { for (var c = [], e = 0;e < this._data.length;e++) { - c = c.concat(this._data[e].getBlockList(a, b)); + var f = this._data[e]; + f.constructor === Entry.Block && (c = c.concat(f.getBlockList(a, b))); } return c; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + b.stringify = function(a) { + return JSON.stringify(this.toJSON(void 0, void 0, a)); }; })(Entry.Thread.prototype); Entry.Block = function(b, a) { @@ -24207,7 +24412,7 @@ Entry.Block.DELETABLE_TRUE = 1; Entry.Block.DELETABLE_FALSE = 2; Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; (function(b) { - b.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; + b.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}, extensions:[]}; b.load = function(a) { a.id || (a.id = Entry.Utils.generateId()); this.set(a); @@ -24274,56 +24479,62 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; this.view || (this.set({view:new Entry.BlockView(this, a, b)}), this._updatePos()); }; b.destroyView = function() { + this.view.destroy(); this.set({view:null}); }; b.clone = function(a) { return new Entry.Block(this.toJSON(!0), a); }; - b.toJSON = function(a) { - var b = this._toJSON(); - delete b.view; - delete b.thread; - delete b.events; - a && delete b.id; - b.params = b.params.map(function(b) { - b instanceof Entry.Block && (b = b.toJSON(a)); - return b; + b.toJSON = function(a, b) { + var c = this._toJSON(); + delete c.view; + delete c.thread; + delete c.events; + a && delete c.id; + c.params = c.params.map(function(c) { + c instanceof Entry.Block && (c = c.toJSON(a, b)); + return c; }); - b.statements = b.statements.map(function(b) { - return b.toJSON(a); + c.statements = c.statements.map(function(c) { + return c.toJSON(a, void 0, b); }); - b.x = this.x; - b.y = this.y; - b.movable = this.movable; - b.deletable = this.deletable; - b.readOnly = this.readOnly; - return b; + c.x = this.x; + c.y = this.y; + c.movable = this.movable; + c.deletable = this.deletable; + c.readOnly = this.readOnly; + b && b instanceof Array && b.forEach(function(a) { + delete c[a]; + }); + return c; }; - b.destroy = function(a, b) { - var c = this, e = this.params; - if (e) { - for (var f = 0;f < e.length;f++) { - var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); + b.destroy = function(a, b, c) { + if (!c || this.deletable === Entry.Block.DELETABLE_TRUE) { + var e = this, f = this.params; + if (f) { + for (c = 0;c < f.length;c++) { + var g = f[c]; + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); + } } - } - if (e = this.statements) { - for (f = 0;f < e.length;f++) { - e[f].destroy(a); + if (f = this.statements) { + for (c = 0;c < f.length;c++) { + f[c].destroy(a); + } } + g = this.getPrevBlock(); + c = this.getNextBlock(); + this.getCode().unregisterBlock(this); + f = this.getThread(); + this._schema && this._schema.event && f.unregisterEvent(this, this._schema.event); + c && (b ? c.destroy(a, b) : g ? c.view && c.view.bindPrev(g, !0) : (b = this.getThread().view.getParent(), b.constructor === Entry.FieldStatement ? (c.view && c.view.bindPrev(b), b.insertTopBlock(c)) : b.constructor === Entry.FieldStatement ? c.replace(b._valueBlock) : c.view._toGlobalCoordinate())); + !this.doNotSplice && f.spliceBlock ? f.spliceBlock(this) : delete this.doNotSplice; + this.view && this.view.destroy(a); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + (a = this.events.dataDestroy) && this.getCode().object && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(e); + }); } - g = this.getPrevBlock(); - f = this.getNextBlock(); - this.getCode().unregisterBlock(this); - e = this.getThread(); - this._schema && this._schema.event && e.unregisterEvent(this, this._schema.event); - f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate())); - !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; - this.view && this.view.destroy(a); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - (f = this.events.dataDestroy) && this.getCode().object && f.forEach(function(a) { - Entry.Utils.isFunction(a) && a(c); - }); }; b.getView = function() { return this.view; @@ -24456,6 +24667,11 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; 4 === a.length && 0 === a[3] && a.pop(); return a; }; + b.getDataByPointer = function(a) { + a = a.concat(); + var b = this.params[a.shift()]; + return a.length ? b.getDataByPointer ? b.getDataByPointer(a) : null : b; + }; b.getBlockList = function(a, b) { var c = []; if (!this._schema) { @@ -24471,13 +24687,13 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; } if (e = this.statements) { for (f = 0;f < e.length;f++) { - c = c.concat(e[f].getBlockList(a, b)); + g = e[f], g.constructor === Entry.Thread && (c = c.concat(g.getBlockList(a, b))); } } return c; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + b.stringify = function(a) { + return JSON.stringify(this.toJSON(!1, a)); }; })(Entry.Block.prototype); Entry.ThreadView = function(b, a) { @@ -24485,6 +24701,7 @@ Entry.ThreadView = function(b, a) { this.thread = b; this.svgGroup = a.svgThreadGroup.elem("g"); this.parent = a; + this._hasGuide = !1; }; (function(b) { b.schema = {height:0, zIndex:0}; @@ -24521,7 +24738,7 @@ Entry.ThreadView = function(b, a) { return f; }; b.dominate = function() { - this.parent.dominate(this.thread); + !this._hasGuide && this.parent.dominate(this.thread); }; b.isGlobal = function() { return this.parent instanceof Entry.Board; @@ -24534,6 +24751,9 @@ Entry.ThreadView = function(b, a) { b.setZIndex = function(a) { this.set({zIndex:a}); }; + b.setHasGuide = function(a) { + this._hasGuide = a; + }; })(Entry.ThreadView.prototype); Entry.FieldTrashcan = function(b) { b && this.setBoard(b); @@ -24609,16 +24829,6 @@ Entry.FieldTrashcan = function(b) { }; })(Entry.FieldTrashcan.prototype); Entry.Vim = function(b, a) { - Entry.Vim.MAZE_MODE = 1; - Entry.Vim.WORKSPACE_MODE = 2; - Entry.Vim.TEXT_TYPE_JS = 0; - Entry.Vim.TEXT_TYPE_PY = 1; - Entry.Vim.PARSER_TYPE_JS_TO_BLOCK = 0; - Entry.Vim.PARSER_TYPE_PY_TO_BLOCK = 1; - Entry.Vim.PARSER_TYPE_BLOCK_TO_JS = 2; - Entry.Vim.PARSER_TYPE_BLOCK_TO_PY = 3; - Entry.Vim.PYTHON_IMPORT_ENTRY = "import Entry"; - Entry.Vim.PYTHON_IMPORT_HW = "import Arduino, Hamster, Albert, Bitbrick, Codeino, Dplay \n\t Neobot, Nemoino, Robotis, Sensorboard, Xbot from Hw"; b = "string" === typeof b ? $("#" + b) : $(b); if ("DIV" !== b.prop("tagName")) { return console.error("Dom is not div element"); @@ -24630,6 +24840,16 @@ Entry.Vim = function(b, a) { Entry.Model(this, !1); window.eventset = []; }; +Entry.Vim.MAZE_MODE = 1; +Entry.Vim.WORKSPACE_MODE = 2; +Entry.Vim.TEXT_TYPE_JS = 0; +Entry.Vim.TEXT_TYPE_PY = 1; +Entry.Vim.PARSER_TYPE_JS_TO_BLOCK = 0; +Entry.Vim.PARSER_TYPE_PY_TO_BLOCK = 1; +Entry.Vim.PARSER_TYPE_BLOCK_TO_JS = 2; +Entry.Vim.PARSER_TYPE_BLOCK_TO_PY = 3; +Entry.Vim.PYTHON_IMPORT_ENTRY = "import Entry"; +Entry.Vim.PYTHON_IMPORT_HW = "import Arduino, Hamster, Albert, Bitbrick, Codeino, Dplay \n\t Neobot, Nemoino, Robotis, Sensorboard, Xbot from Hw"; (function(b) { b.createDom = function(a) { function b(a) { @@ -24712,7 +24932,7 @@ Entry.Workspace = function(b) { Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); this.changeEvent = new Entry.Event(this); Entry.commander.setCurrentEditor("board", this.board); - this.textType = Entry.Vim.TEXT_TYPE_PY; + this.textType = void 0 !== b.textType ? b.textType : Entry.Vim.TEXT_TYPE_PY; }; Entry.Workspace.MODE_BOARD = 0; Entry.Workspace.MODE_VIMBOARD = 1; @@ -24735,7 +24955,8 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - "number" === typeof a ? this.mode = a : (this.mode = a.boardType, this.runType = a.runType, this.textType = a.textType); + isNaN(a) ? (this.mode = a.boardType, this.runType = a.runType, this.textType = a.textType) : this.mode = a; + this.mode = +this.mode; switch(this.mode) { case this.oldMode: return; diff --git a/dist/entry.min.js b/dist/entry.min.js index f0f21686b2..7d435a01fe 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1503,9 +1503,10 @@ p.checkDevice=function(b){void 0!==b.company&&(b=[Entry.Utils.convertIntToHex(b. (this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule,this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))}; p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)}; p.executeHardware=function(){function b(a){navigator.msLaunchUri(a,function(){},function(){c.popupHelper.show("hwDownload",!0)})}function a(a){var b=document.createElement("iframe");b.src="about:blank";b.style="display:none";document.getElementsByTagName("body")[0].appendChild(b);var d=null,d=setTimeout(function(){var e=!1;try{b.contentWindow.location.href=a,e=!0}catch(f){"NS_ERROR_UNKNOWN_PROTOCOL"==f.name&&(e=!1)}e||c.popupHelper.show("hwDownload",!0);document.getElementsByTagName("body")[0].removeChild(b); -clearTimeout(d)},500)}function d(a){var b=!1;window.focus();window.onblur=function(){b=!0};location.assign(encodeURI(a));setTimeout(function(){(0==b||0");var d=0,c=null,c=setInterval(function(){try{this._w.location.href}catch(a){this._bNotInstalled=!0}if(10(0");var d=0,c=null,c=setInterval(function(){try{this._w.location.href}catch(a){this._bNotInstalled=!0}if(10(0"); + this._w.document.write(""); var nCounter = 0; var bNotInstalled = false; var nInterval = null; @@ -436,6 +436,8 @@ p.executeHardware = function() { } }; + hw.ieLauncher = executeIeCustomLauncher; + var entryHardwareUrl = 'entryhw://-roomId:' + this.sessionRoomId; if(navigator.userAgent.indexOf("MSIE") > 0 || navigator.userAgent.indexOf("Trident") > 0){ if (navigator.msLaunchUri != undefined) { From 08e6ff3f8c61a094e30460a7e9ac3697e023d6ba Mon Sep 17 00:00:00 2001 From: jykim Date: Tue, 25 Oct 2016 19:00:25 +0900 Subject: [PATCH 08/17] change disconnect logic --- dist/entry.js | 3 ++- dist/entry.min.js | 4 ++-- src/hw.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 81946d6d30..1c26286aee 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17685,6 +17685,7 @@ p.connectWebSocket = function(b, a) { }); c.on("mode", function(a) { 0 === c.mode && 1 === a && d.disconnectHardware(); + d.socketMode = a; c.mode = a; }); c.on("message", function(a) { @@ -17700,7 +17701,7 @@ p.connectWebSocket = function(b, a) { }); c.on("disconnect", function() { console.log("disconnect"); - d.isOpenHardware ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); + d.isOpenHardware || 1 === d.socketMode ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); }); return c; }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 7d435a01fe..aeb0b9e8a9 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1488,8 +1488,8 @@ b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,c){for(var e=-thi b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; -p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); -break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect");d.isOpenHardware?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); +break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect");d.isOpenHardware||1===d.socketMode?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1 Date: Wed, 26 Oct 2016 14:22:46 +0900 Subject: [PATCH 09/17] =?UTF-8?q?=EB=B8=94=EB=A1=9D=EB=AA=85=EC=B9=AD=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/workspace/block_entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index fce1424e9c..48f33cb4da 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -2905,7 +2905,7 @@ Entry.block = { { "type": "Text", //TODO: 다국어 적용 - "text": '하드웨어 프로그램 열기', + "text": Lang.Blocks.ARDUINO_program, "color": "#333", "align": "center" } From 1580cf617b97f504365fda7edd9f18d7e1e8e89c Mon Sep 17 00:00:00 2001 From: jykim Date: Wed, 26 Oct 2016 15:47:03 +0900 Subject: [PATCH 10/17] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 2 +- dist/entry.min.js | 30 +++++++++++++++--------------- src/hw.js | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 1c26286aee..29d49463fb 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17880,7 +17880,7 @@ p.executeHardware = function() { }, 1500); } var c = this, e = {_bNotInstalled:!1, init:function(a, b) { - this._w = window.open("/views/hwLoading.html", "entry_hw_launcher", "width=1, height=1, top=" + window.screenTop + ", left=" + window.screenLeft); + this._w = window.open("/views/hwLoading.html", "entry_hw_launcher", "width=220, height=225, top=" + window.screenTop + ", left=" + window.screenLeft); var c = null, c = setTimeout(function() { e.runViewer(a, b); clearInterval(c); diff --git a/dist/entry.min.js b/dist/entry.min.js index aeb0b9e8a9..48d4dcd98f 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1503,7 +1503,7 @@ p.checkDevice=function(b){void 0!==b.company&&(b=[Entry.Utils.convertIntToHex(b. (this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule,this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))}; p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)}; p.executeHardware=function(){function b(a){navigator.msLaunchUri(a,function(){},function(){c.popupHelper.show("hwDownload",!0)})}function a(a){var b=document.createElement("iframe");b.src="about:blank";b.style="display:none";document.getElementsByTagName("body")[0].appendChild(b);var d=null,d=setTimeout(function(){var e=!1;try{b.contentWindow.location.href=a,e=!0}catch(f){"NS_ERROR_UNKNOWN_PROTOCOL"==f.name&&(e=!1)}e||c.popupHelper.show("hwDownload",!0);document.getElementsByTagName("body")[0].removeChild(b); -clearTimeout(d)},500)}function d(a){var b=!1;window.focus();window.onblur=function(){b=!0};location.assign(encodeURI(a));setTimeout(function(){(0==b||0");var d=0,c=null,c=setInterval(function(){try{this._w.location.href}catch(a){this._bNotInstalled=!0}if(10(0=g[0]?1:0;throw new Entry.Utils.AsyncError;}f.isStart= -!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"}, -paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("STATUS",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64g[1]?1:0:800>=g[1]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(); -Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"}, -paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getNumberField("PORT",a);if(10>d){var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.DIGITAL;if(f.isStart){if(e&&e===f.stamp||64g[d-14]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET= -{type:Entry.ArduinoExt.sensorTypes.ANALOG,port:d-14};throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19,"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"}, -paramsKeyMap:{DIRECTION:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("DIRECTION",a),c=0,e=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),f=Entry.hw.portData.TIME||0,g=a.executor.scope,h=Entry.hw.portData.ANALOG;"LEFT"==d||"RIGHT"==d?c=3:"FRONT"==d||"REAR"==d?c=4:"REVERSE"==d&&(c=5);if(g.isStart)if(f&&f===g.stamp){delete g.isStart;delete g.stamp;c=h[c];c=180/137*(c-265);c+=-90;c=Math.min(90,c);c=Math.max(-90,c);c=Math.round(c);if("LEFT"== -d||"REAR"==d)return-30>c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else if(64c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else throw new Entry.Utils.AsyncError;else throw g.isStart=!0,g.stamp=e,Entry.hw.sendQueue.TIME=e,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(), -Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:c},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getNumberField("PORT",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), +align:"center"}],events:{mousedown:[function(){Entry.hw.retryConnect()}]}},arduino_open:{skeleton:"basic_button",color:"#eee",isNotFor:[""],template:"%1",params:[{type:"Text",text:Lang.Blocks.ARDUINO_program,color:"#333",align:"center"}],events:{mousedown:[function(){Entry.hw.openHardwareProgram()}]}},CODEino_get_sensor_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"],["6","A6"]], +value:"A0",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},CODEino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_sensor_name_0,"0"],[Lang.Blocks.CODEino_sensor_name_1,"1"],[Lang.Blocks.CODEino_sensor_name_2,"2"],[Lang.Blocks.CODEino_sensor_name_3,"3"],[Lang.Blocks.CODEino_sensor_name_4,"4"],[Lang.Blocks.CODEino_sensor_name_5, +"5"],[Lang.Blocks.CODEino_sensor_name_6,"6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("PORT",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64=g[0]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(); +Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:0};throw new Entry.Utils.AsyncError;}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b, +a){var d=a.getField("STATUS",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64g[1]?1:0:800>=g[1]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG, +port:1};throw new Entry.Utils.AsyncError;}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"], +func:function(b,a){var d=a.getNumberField("PORT",a);if(10>d){var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.DIGITAL;if(f.isStart){if(e&&e===f.stamp||64g[d-14]?1:0;throw new Entry.Utils.AsyncError;}f.isStart=!0;f.stamp=c;Entry.hw.sendQueue.TIME=c;Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey();Entry.hw.sendQueue.GET={type:Entry.ArduinoExt.sensorTypes.ANALOG,port:d-14}; +throw new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_direction:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_16,"LEFT"],[Lang.Blocks.CODEino_string_17,"RIGHT"],[Lang.Blocks.CODEino_string_18,"FRONT"],[Lang.Blocks.CODEino_string_19,"REAR"],[Lang.Blocks.CODEino_string_20,"REVERSE"]],value:"LEFT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_direction"},paramsKeyMap:{DIRECTION:0}, +"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getField("DIRECTION",a),c=0,e=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG),f=Entry.hw.portData.TIME||0,g=a.executor.scope,h=Entry.hw.portData.ANALOG;"LEFT"==d||"RIGHT"==d?c=3:"FRONT"==d||"REAR"==d?c=4:"REVERSE"==d&&(c=5);if(g.isStart)if(f&&f===g.stamp){delete g.isStart;delete g.stamp;c=h[c];c=180/137*(c-265);c+=-90;c=Math.min(90,c);c=Math.max(-90,c);c=Math.round(c);if("LEFT"==d||"REAR"==d)return-30>c?1: +0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else if(64c?1:0;if("RIGHT"==d||"FRONT"==d)return 30c?1:0}else throw new Entry.Utils.AsyncError;else throw g.isStart=!0,g.stamp=e,Entry.hw.sendQueue.TIME=e,Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey(),Entry.hw.sendQueue.GET= +{type:Entry.ArduinoExt.sensorTypes.ANALOG,port:c},new Entry.Utils.AsyncError;}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino_sensor",isNotFor:["CODEino"],func:function(b,a){var d=a.getNumberField("PORT",a),c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), e=Entry.hw.portData.TIME||0,f=a.executor.scope,g=Entry.hw.portData.ANALOG,h=0;if(f.isStart){if(e&&e===f.stamp)return delete f.isStart,delete f.stamp,h=g[d],h=Math.min(90,1.46*(h-333)),h=Math.max(-90,h),Math.round(h);if(64 Date: Wed, 26 Oct 2016 17:09:29 +0900 Subject: [PATCH 12/17] =?UTF-8?q?isMatched=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 35 ++++++++++++++++++----------------- dist/entry.min.js | 11 ++++++----- src/hw.js | 8 ++++---- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 759b2070ea..eab308f2c5 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17659,6 +17659,7 @@ Entry.HW = function() { this.outputQueue = {}; this.settingQueue = {}; this.socketType = this.hwModule = this.selectedDevice = null; + this.isMatched = !1; Entry.addEventListener("stop", this.setZero); this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino, "10.1":Entry.Roborobo_Roduino, "10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3, "B.1":Entry.Codestar}; }; @@ -17671,25 +17672,25 @@ p.createRandomRoomId = function() { }); }; p.connectWebSocket = function(b, a) { - var d = this, c = !1, e = io(b, a); - e.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); - e.io.reconnectionDelayMax(1E3); - e.io.timeout(1E3); - e.on("connect", function() { + var d = this, c = io(b, a); + c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT); + c.io.reconnectionDelayMax(1E3); + c.io.timeout(1E3); + c.on("connect", function() { console.log("connect"); d.socketType = "WebSocket"; - d.initHardware(e); + d.initHardware(c); }); - e.on("matched", function(a) { - c = !0; - e.emit("matchTarget", {target:a}); + c.on("matched", function(a) { + d.isMatched = !0; + c.emit("matchTarget", {target:a}); }); - e.on("mode", function(a) { - 0 === e.mode && 1 === a && d.disconnectHardware(); + c.on("mode", function(a) { + 0 === c.mode && 1 === a && d.disconnectHardware(); d.socketMode = a; - e.mode = a; + c.mode = a; }); - e.on("message", function(a) { + c.on("message", function(a) { if (a.data && "string" === typeof a.data) { switch(a.data) { case "disconnectHardware": @@ -17700,12 +17701,11 @@ p.connectWebSocket = function(b, a) { } } }); - e.on("disconnect", function() { + c.on("disconnect", function() { console.log("disconnect"); - d.isOpenHardware || 1 === d.socketMode || c ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); - c = !1; + d.isOpenHardware || 1 === d.socketMode || d.isMatched ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); }); - return e; + return c; }; p.initSocket = function() { try { @@ -17766,6 +17766,7 @@ p.disconnectHardware = function() { Entry.dispatchEvent("hwChanged"); }; p.disconnectedSocket = function() { + this.isMatched = !1; this.tlsSocketIo.close(); this.socketIo && this.socketIo.close(); Entry.propertyPanel.removeMode("hw"); diff --git a/dist/entry.min.js b/dist/entry.min.js index 04c64886d8..21b68afd08 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1486,16 +1486,17 @@ listVLine=wholeHeight=0;mode=this._hwModule.monitorTemplate;for(f=0;fc-(l.width+m.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,c,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= -null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, +null;this.isMatched=!1;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; -p.connectWebSocket=function(b,a){var d=this,c=!1,e=io(b,a);e.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);e.io.reconnectionDelayMax(1E3);e.io.timeout(1E3);e.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(e)});e.on("matched",function(a){c=!0;e.emit("matchTarget",{target:a})});e.on("mode",function(a){0===e.mode&&1===a&&d.disconnectHardware();d.socketMode=a;e.mode=a});e.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); -break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});e.on("disconnect",function(){console.log("disconnect");d.isOpenHardware||1===d.socketMode||c?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket();c=!1});return e}; +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){d.isMatched=!0;c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); +break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect");d.isOpenHardware||1===d.socketMode||d.isMatched?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1 Date: Wed, 26 Oct 2016 17:20:27 +0900 Subject: [PATCH 13/17] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EB=A1=A4=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 7 ++----- dist/entry.min.js | 11 +++++------ src/hw.js | 7 ++----- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index eab308f2c5..2b241a5e78 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17659,7 +17659,6 @@ Entry.HW = function() { this.outputQueue = {}; this.settingQueue = {}; this.socketType = this.hwModule = this.selectedDevice = null; - this.isMatched = !1; Entry.addEventListener("stop", this.setZero); this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino, "10.1":Entry.Roborobo_Roduino, "10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3, "B.1":Entry.Codestar}; }; @@ -17682,7 +17681,6 @@ p.connectWebSocket = function(b, a) { d.initHardware(c); }); c.on("matched", function(a) { - d.isMatched = !0; c.emit("matchTarget", {target:a}); }); c.on("mode", function(a) { @@ -17702,8 +17700,8 @@ p.connectWebSocket = function(b, a) { } }); c.on("disconnect", function() { - console.log("disconnect"); - d.isOpenHardware || 1 === d.socketMode || d.isMatched ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); + console.log("disconnect", c, d.isOpenHardware, d.socketMode); + d.isOpenHardware || 1 === d.socketMode ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); }); return c; }; @@ -17766,7 +17764,6 @@ p.disconnectHardware = function() { Entry.dispatchEvent("hwChanged"); }; p.disconnectedSocket = function() { - this.isMatched = !1; this.tlsSocketIo.close(); this.socketIo && this.socketIo.close(); Entry.propertyPanel.removeMode("hw"); diff --git a/dist/entry.min.js b/dist/entry.min.js index 21b68afd08..3aa812168e 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1486,17 +1486,16 @@ listVLine=wholeHeight=0;mode=this._hwModule.monitorTemplate;for(f=0;fc-(l.width+m.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,c,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= -null;this.isMatched=!1;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, +null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; -p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){d.isMatched=!0;c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); -break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect");d.isOpenHardware||1===d.socketMode||d.isMatched?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); +break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect",c,d.isOpenHardware,d.socketMode);d.isOpenHardware||1===d.socketMode?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1 Date: Wed, 26 Oct 2016 18:10:19 +0900 Subject: [PATCH 14/17] =?UTF-8?q?disconnect=20event=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 3 +-- dist/entry.min.js | 2 +- src/hw.js | 15 ++++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 2b241a5e78..c8d1710549 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17700,8 +17700,7 @@ p.connectWebSocket = function(b, a) { } }); c.on("disconnect", function() { - console.log("disconnect", c, d.isOpenHardware, d.socketMode); - d.isOpenHardware || 1 === d.socketMode ? (d.isOpenHardware = !1, d.initSocket()) : "WebSocket" === d.socketType && d.disconnectedSocket(); + d.initSocket(); }); return c; }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 3aa812168e..27566b2288 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1489,7 +1489,7 @@ b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); -break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){console.log("disconnect",c,d.isOpenHardware,d.socketMode);d.isOpenHardware||1===d.socketMode?(d.isOpenHardware=!1,d.initSocket()):"WebSocket"===d.socketType&&d.disconnectedSocket()});return c}; +break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){d.initSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1 Date: Wed, 26 Oct 2016 19:08:05 +0900 Subject: [PATCH 15/17] =?UTF-8?q?matched=20=EA=B0=80=20=EB=B0=9C=EC=83=9D?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EB=A5=BC=20=EB=8C=80=EB=B9=84=EC=97=90=20connect=EC=97=90=20?= =?UTF-8?q?=EC=9D=B4=EC=A0=84=20=EC=A0=95=EB=B3=B4=20=EB=8D=98=EC=A7=80?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 3 ++- dist/entry.min.js | 2 +- src/hw.js | 29 +++++++---------------------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index c8d1710549..b399340cc1 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17676,11 +17676,12 @@ p.connectWebSocket = function(b, a) { c.io.reconnectionDelayMax(1E3); c.io.timeout(1E3); c.on("connect", function() { - console.log("connect"); d.socketType = "WebSocket"; d.initHardware(c); + d.lastTarget && c.emit("matchTarget", {target:d.lastTarget}); }); c.on("matched", function(a) { + d.lastTarget = a; c.emit("matchTarget", {target:a}); }); c.on("mode", function(a) { diff --git a/dist/entry.min.js b/dist/entry.min.js index 27566b2288..eeecd55183 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1488,7 +1488,7 @@ b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,c){for(var e=-thi b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; -p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){console.log("connect");d.socketType="WebSocket";d.initHardware(c)});c.on("matched",function(a){c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){d.socketType="WebSocket";d.initHardware(c);d.lastTarget&&c.emit("matchTarget",{target:d.lastTarget})});c.on("matched",function(a){d.lastTarget=a;c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){d.initSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1= Entry.HW.TRIAL_LIMIT) { - // if (!hw.isFirstConnect) - // Entry.toast.alert(Lang.Menus.connect_hw, - // Lang.Menus.connect_fail, - // false); - // hw.isFirstConnect = false; - // socketSecurity.close(); - // } else if(hw.socketType === 'WebSocket') { - // // hw.socket = null; - // } - // }); - return socket; } From 8247a8240cacebf49b67ab8ab934d83d7d1de122 Mon Sep 17 00:00:00 2001 From: jykim Date: Wed, 26 Oct 2016 19:33:22 +0900 Subject: [PATCH 16/17] =?UTF-8?q?match=20=EA=B3=BC=EC=A0=95=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 5 ----- dist/entry.min.js | 4 ++-- src/hw.js | 13 ------------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index b399340cc1..c698394918 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17678,11 +17678,6 @@ p.connectWebSocket = function(b, a) { c.on("connect", function() { d.socketType = "WebSocket"; d.initHardware(c); - d.lastTarget && c.emit("matchTarget", {target:d.lastTarget}); - }); - c.on("matched", function(a) { - d.lastTarget = a; - c.emit("matchTarget", {target:a}); }); c.on("mode", function(a) { 0 === c.mode && 1 === a && d.disconnectHardware(); diff --git a/dist/entry.min.js b/dist/entry.min.js index eeecd55183..58c70265c4 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1488,8 +1488,8 @@ b,tP,h),this._movePort(rPort,b,bP,k))};b._alignNS=function(a,b,c){for(var e=-thi b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; -p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){d.socketType="WebSocket";d.initHardware(c);d.lastTarget&&c.emit("matchTarget",{target:d.lastTarget})});c.on("matched",function(a){d.lastTarget=a;c.emit("matchTarget",{target:a})});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware(); -break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}});c.on("disconnect",function(){d.initSocket()});return c}; +p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){d.socketType="WebSocket";d.initHardware(c)});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware();break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}}); +c.on("disconnect",function(){d.initSocket()});return c}; p.initSocket=function(){try{this.connected=!1;this.tlsSocketIo&&this.tlsSocketIo.removeAllListeners();this.socketIo&&this.socketIo.removeAllListeners();this.isOpenHardware||this.checkOldClient();if(-1 Date: Tue, 1 Nov 2016 18:33:13 +0900 Subject: [PATCH 17/17] download link modify --- dist/entry.js | 2 +- dist/entry.min.js | 2 +- src/hw.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index c698394918..d0d10ffaea 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -17650,7 +17650,7 @@ Entry.HW = function() { this.sessionRoomId || (this.sessionRoomId = this.createRandomRoomId(), localStorage.setItem("entryhwRoomId", this.sessionRoomId)); this.connectTrial = 0; this.isFirstConnect = !0; - this.downloadPath = "http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe"; + this.downloadPath = "http://download.play-entry.org/apps/Entry_HW_1.6.0_Setup.exe"; this.hwPopupCreate(); this.initSocket(); this.connected = !1; diff --git a/dist/entry.min.js b/dist/entry.min.js index 58c70265c4..ab946ccda3 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1485,7 +1485,7 @@ this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgD listVLine=wholeHeight=0;mode=this._hwModule.monitorTemplate;for(f=0;fc-(l.width+m.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,c,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= +b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+c+"L"+g+","+h:"M"+(b+e)/2+","+c+"l0,"+(h>c?28:-3)+"H"+g+"L"+g+","+h):b=bc?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+c+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.sessionRoomId=localStorage.getItem("entryhwRoomId");this.sessionRoomId||(this.sessionRoomId=this.createRandomRoomId(),localStorage.setItem("entryhwRoomId",this.sessionRoomId));this.connectTrial=0;this.isFirstConnect=!0;this.downloadPath="http://download.play-entry.org/apps/Entry_HW_1.6.0_Setup.exe";this.hwPopupCreate();this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice= null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster,"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino,"10.1":Entry.Roborobo_Roduino,"10.2":Entry.Roborobo_SchoolKit, "12.1":Entry.EV3,"B.1":Entry.Codestar}};Entry.HW.TRIAL_LIMIT=2;p=Entry.HW.prototype;p.createRandomRoomId=function(){return"xxxxxxxxyx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&3|8).toString(16)})}; p.connectWebSocket=function(b,a){var d=this,c=io(b,a);c.io.reconnectionAttempts(Entry.HW.TRIAL_LIMIT);c.io.reconnectionDelayMax(1E3);c.io.timeout(1E3);c.on("connect",function(){d.socketType="WebSocket";d.initHardware(c)});c.on("mode",function(a){0===c.mode&&1===a&&d.disconnectHardware();d.socketMode=a;c.mode=a});c.on("message",function(a){if(a.data&&"string"===typeof a.data)switch(a.data){case "disconnectHardware":d.disconnectHardware();break;default:a=JSON.parse(a.data),d.checkDevice(a),d.updatePortData(a)}}); diff --git a/src/hw.js b/src/hw.js index 60046b687e..c79d066187 100644 --- a/src/hw.js +++ b/src/hw.js @@ -15,7 +15,7 @@ Entry.HW = function() { this.connectTrial = 0; this.isFirstConnect = true; - this.downloadPath = "http://download.play-entry.org/apps/Entry_HW_1.5.11_Setup.exe"; + this.downloadPath = "http://download.play-entry.org/apps/Entry_HW_1.6.0_Setup.exe"; this.hwPopupCreate(); this.initSocket(); this.connected = false;