Skip to content

Commit

Permalink
feat (blockly): new Blockly example
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed May 17, 2024
1 parent 25b05c1 commit dac1465
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frameworks/blockly/01--conta-passo1/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Blockly.Blocks['conta'] = {
init: function () {
this.jsonInit({
message0: 'conta'
})
}
}
17 changes: 17 additions & 0 deletions frameworks/blockly/01--conta-passo1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
<script src="blocks.js"></script>
</head>
<body>
<div id="blocklyDiv" style="height: 768px; width: 1024px;"></div>
<xml id="toolbox" style="display: none">
<block type="conta"></block>
</xml>
<script>
var workspace = Blockly.inject('blocklyDiv',
{toolbox: document.getElementById('toolbox')});
</script>
</body>
</html>
18 changes: 18 additions & 0 deletions frameworks/blockly/02--conta-passo2/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Blockly.Blocks['conta'] = {
init: function () {
this.jsonInit({
message0: 'conta: %1 + %2',
args0: [
{
type: 'field_number',
name: 'A'
},
{
type: 'field_number',
name: 'B'
}
],
colour: 160
})
}
}
17 changes: 17 additions & 0 deletions frameworks/blockly/02--conta-passo2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
<script src="blocks.js"></script>
</head>
<body>
<div id="blocklyDiv" style="height: 768px; width: 1024px;"></div>
<xml id="toolbox" style="display: none">
<block type="conta"></block>
</xml>
<script>
var workspace = Blockly.inject('blocklyDiv',
{toolbox: document.getElementById('toolbox')});
</script>
</body>
</html>
39 changes: 39 additions & 0 deletions frameworks/blockly/03--conta-passo3/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Blockly.Blocks['conta'] = {
init: function () {
this.jsonInit({
message0: 'conta: %1 + %2 %3',
args0: [
{
type: 'field_number',
name: 'A'
},
{
type: 'field_number',
name: 'B'
},
{
type: 'input_value',
name: 'C',
check: 'encaixe'
}
],
colour: 160
})
}
}

Blockly.Blocks['resultado'] = {
init: function () {
this.jsonInit({
message0: 'resultado: %1',
args0: [
{
type: 'field_number',
name: 'R'
}
],
colour: 80,
output: 'encaixe'
})
}
}
18 changes: 18 additions & 0 deletions frameworks/blockly/03--conta-passo3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
<script src="blocks.js"></script>
</head>
<body>
<div id="blocklyDiv" style="height: 768px; width: 1024px;"></div>
<xml id="toolbox" style="display: none">
<block type="conta"></block>
<block type="resultado"></block>
</xml>
<script>
var workspace = Blockly.inject('blocklyDiv',
{toolbox: document.getElementById('toolbox')});
</script>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.

0 comments on commit dac1465

Please sign in to comment.