Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
ddcf1ac9
Commit
ddcf1ac9
authored
Jan 26, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out hues into constants.
parent
816aa869
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
183 additions
and
165 deletions
+183
-165
blocks/colour.js
blocks/colour.js
+6
-4
blocks/lists.js
blocks/lists.js
+14
-12
blocks/logic.js
blocks/logic.js
+12
-10
blocks/loops.js
blocks/loops.js
+8
-6
blocks/math.js
blocks/math.js
+15
-13
blocks/procedures.js
blocks/procedures.js
+9
-7
blocks/text.js
blocks/text.js
+18
-16
blocks/variables.js
blocks/variables.js
+4
-2
blocks_compressed.js
blocks_compressed.js
+97
-95
No files found.
blocks/colour.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.colour');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.colour');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
colour
.
HUE
=
20
;
Blockly
.
Blocks
[
'
colour_picker
'
]
=
{
Blockly
.
Blocks
[
'
colour_picker
'
]
=
{
/**
/**
* Block for colour picker.
* Block for colour picker.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['colour_picker'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['colour_picker'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_PICKER_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_PICKER_HELPURL
);
this
.
setColour
(
20
);
this
.
setColour
(
Blockly
.
Blocks
.
colour
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
new
Blockly
.
FieldColour
(
'
#ff0000
'
),
'
COLOUR
'
);
.
appendField
(
new
Blockly
.
FieldColour
(
'
#ff0000
'
),
'
COLOUR
'
);
this
.
setOutput
(
true
,
'
Colour
'
);
this
.
setOutput
(
true
,
'
Colour
'
);
...
@@ -51,7 +53,7 @@ Blockly.Blocks['colour_random'] = {
...
@@ -51,7 +53,7 @@ Blockly.Blocks['colour_random'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_RANDOM_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_RANDOM_HELPURL
);
this
.
setColour
(
20
);
this
.
setColour
(
Blockly
.
Blocks
.
colour
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
COLOUR_RANDOM_TITLE
);
.
appendField
(
Blockly
.
Msg
.
COLOUR_RANDOM_TITLE
);
this
.
setOutput
(
true
,
'
Colour
'
);
this
.
setOutput
(
true
,
'
Colour
'
);
...
@@ -66,7 +68,7 @@ Blockly.Blocks['colour_rgb'] = {
...
@@ -66,7 +68,7 @@ Blockly.Blocks['colour_rgb'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_RGB_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_RGB_HELPURL
);
this
.
setColour
(
20
);
this
.
setColour
(
Blockly
.
Blocks
.
colour
.
HUE
);
this
.
appendValueInput
(
'
RED
'
)
this
.
appendValueInput
(
'
RED
'
)
.
setCheck
(
'
Number
'
)
.
setCheck
(
'
Number
'
)
.
setAlign
(
Blockly
.
ALIGN_RIGHT
)
.
setAlign
(
Blockly
.
ALIGN_RIGHT
)
...
@@ -92,7 +94,7 @@ Blockly.Blocks['colour_blend'] = {
...
@@ -92,7 +94,7 @@ Blockly.Blocks['colour_blend'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_BLEND_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
COLOUR_BLEND_HELPURL
);
this
.
setColour
(
20
);
this
.
setColour
(
Blockly
.
Blocks
.
colour
.
HUE
);
this
.
appendValueInput
(
'
COLOUR1
'
)
this
.
appendValueInput
(
'
COLOUR1
'
)
.
setCheck
(
'
Colour
'
)
.
setCheck
(
'
Colour
'
)
.
setAlign
(
Blockly
.
ALIGN_RIGHT
)
.
setAlign
(
Blockly
.
ALIGN_RIGHT
)
...
...
blocks/lists.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.lists');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.lists');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
lists
.
HUE
=
260
;
Blockly
.
Blocks
[
'
lists_create_empty
'
]
=
{
Blockly
.
Blocks
[
'
lists_create_empty
'
]
=
{
/**
/**
* Block for creating an empty list.
* Block for creating an empty list.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['lists_create_empty'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['lists_create_empty'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_CREATE_EMPTY_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_CREATE_EMPTY_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
setOutput
(
true
,
'
Array
'
);
this
.
setOutput
(
true
,
'
Array
'
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_EMPTY_TITLE
);
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_EMPTY_TITLE
);
...
@@ -51,7 +53,7 @@ Blockly.Blocks['lists_create_with'] = {
...
@@ -51,7 +53,7 @@ Blockly.Blocks['lists_create_with'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
itemCount_
=
3
;
this
.
itemCount_
=
3
;
this
.
updateShape_
();
this
.
updateShape_
();
this
.
setOutput
(
true
,
'
Array
'
);
this
.
setOutput
(
true
,
'
Array
'
);
...
@@ -174,7 +176,7 @@ Blockly.Blocks['lists_create_with_container'] = {
...
@@ -174,7 +176,7 @@ Blockly.Blocks['lists_create_with_container'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_CONTAINER_TITLE_ADD
);
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_CONTAINER_TITLE_ADD
);
this
.
appendStatementInput
(
'
STACK
'
);
this
.
appendStatementInput
(
'
STACK
'
);
...
@@ -189,7 +191,7 @@ Blockly.Blocks['lists_create_with_item'] = {
...
@@ -189,7 +191,7 @@ Blockly.Blocks['lists_create_with_item'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_ITEM_TITLE
);
.
appendField
(
Blockly
.
Msg
.
LISTS_CREATE_WITH_ITEM_TITLE
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
...
@@ -206,7 +208,7 @@ Blockly.Blocks['lists_repeat'] = {
...
@@ -206,7 +208,7 @@ Blockly.Blocks['lists_repeat'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_REPEAT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_REPEAT_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
setOutput
(
true
,
'
Array
'
);
this
.
setOutput
(
true
,
'
Array
'
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_REPEAT_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_REPEAT_TITLE
,
[
'
ITEM
'
,
null
,
Blockly
.
ALIGN_RIGHT
],
[
'
ITEM
'
,
null
,
Blockly
.
ALIGN_RIGHT
],
...
@@ -223,7 +225,7 @@ Blockly.Blocks['lists_length'] = {
...
@@ -223,7 +225,7 @@ Blockly.Blocks['lists_length'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_LENGTH_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_LENGTH_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_LENGTH_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_LENGTH_TITLE
,
[
'
VALUE
'
,
[
'
Array
'
,
'
String
'
],
Blockly
.
ALIGN_RIGHT
],
[
'
VALUE
'
,
[
'
Array
'
,
'
String
'
],
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -239,7 +241,7 @@ Blockly.Blocks['lists_isEmpty'] = {
...
@@ -239,7 +241,7 @@ Blockly.Blocks['lists_isEmpty'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_IS_EMPTY_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_IS_EMPTY_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_IS_EMPTY_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
LISTS_IS_EMPTY_TITLE
,
[
'
VALUE
'
,
[
'
Array
'
,
'
String
'
],
Blockly
.
ALIGN_RIGHT
],
[
'
VALUE
'
,
[
'
Array
'
,
'
String
'
],
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -259,7 +261,7 @@ Blockly.Blocks['lists_indexOf'] = {
...
@@ -259,7 +261,7 @@ Blockly.Blocks['lists_indexOf'] = {
[[
Blockly
.
Msg
.
LISTS_INDEX_OF_FIRST
,
'
FIRST
'
],
[[
Blockly
.
Msg
.
LISTS_INDEX_OF_FIRST
,
'
FIRST
'
],
[
Blockly
.
Msg
.
LISTS_INDEX_OF_LAST
,
'
LAST
'
]];
[
Blockly
.
Msg
.
LISTS_INDEX_OF_LAST
,
'
LAST
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_INDEX_OF_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_INDEX_OF_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendValueInput
(
'
VALUE
'
)
this
.
appendValueInput
(
'
VALUE
'
)
.
setCheck
(
'
Array
'
)
.
setCheck
(
'
Array
'
)
...
@@ -288,7 +290,7 @@ Blockly.Blocks['lists_getIndex'] = {
...
@@ -288,7 +290,7 @@ Blockly.Blocks['lists_getIndex'] = {
[
Blockly
.
Msg
.
LISTS_GET_INDEX_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
LISTS_GET_INDEX_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
LISTS_GET_INDEX_RANDOM
,
'
RANDOM
'
]];
[
Blockly
.
Msg
.
LISTS_GET_INDEX_RANDOM
,
'
RANDOM
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_GET_INDEX_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_GET_INDEX_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
var
modeMenu
=
new
Blockly
.
FieldDropdown
(
MODE
,
function
(
value
)
{
var
modeMenu
=
new
Blockly
.
FieldDropdown
(
MODE
,
function
(
value
)
{
var
isStatement
=
(
value
==
'
REMOVE
'
);
var
isStatement
=
(
value
==
'
REMOVE
'
);
this
.
sourceBlock_
.
updateStatement_
(
isStatement
);
this
.
sourceBlock_
.
updateStatement_
(
isStatement
);
...
@@ -419,7 +421,7 @@ Blockly.Blocks['lists_setIndex'] = {
...
@@ -419,7 +421,7 @@ Blockly.Blocks['lists_setIndex'] = {
[
Blockly
.
Msg
.
LISTS_GET_INDEX_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
LISTS_GET_INDEX_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
LISTS_GET_INDEX_RANDOM
,
'
RANDOM
'
]];
[
Blockly
.
Msg
.
LISTS_GET_INDEX_RANDOM
,
'
RANDOM
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_SET_INDEX_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_SET_INDEX_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
appendValueInput
(
'
LIST
'
)
this
.
appendValueInput
(
'
LIST
'
)
.
setCheck
(
'
Array
'
)
.
setCheck
(
'
Array
'
)
.
appendField
(
Blockly
.
Msg
.
LISTS_SET_INDEX_INPUT_IN_LIST
);
.
appendField
(
Blockly
.
Msg
.
LISTS_SET_INDEX_INPUT_IN_LIST
);
...
@@ -520,7 +522,7 @@ Blockly.Blocks['lists_getSublist'] = {
...
@@ -520,7 +522,7 @@ Blockly.Blocks['lists_getSublist'] = {
[
Blockly
.
Msg
.
LISTS_GET_SUBLIST_END_FROM_END
,
'
FROM_END
'
],
[
Blockly
.
Msg
.
LISTS_GET_SUBLIST_END_FROM_END
,
'
FROM_END
'
],
[
Blockly
.
Msg
.
LISTS_GET_SUBLIST_END_LAST
,
'
LAST
'
]];
[
Blockly
.
Msg
.
LISTS_GET_SUBLIST_END_LAST
,
'
LAST
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_GET_SUBLIST_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_GET_SUBLIST_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
appendValueInput
(
'
LIST
'
)
this
.
appendValueInput
(
'
LIST
'
)
.
setCheck
(
'
Array
'
)
.
setCheck
(
'
Array
'
)
.
appendField
(
Blockly
.
Msg
.
LISTS_GET_SUBLIST_INPUT_IN_LIST
);
.
appendField
(
Blockly
.
Msg
.
LISTS_GET_SUBLIST_INPUT_IN_LIST
);
...
@@ -631,7 +633,7 @@ Blockly.Blocks['lists_split'] = {
...
@@ -631,7 +633,7 @@ Blockly.Blocks['lists_split'] = {
}
}
});
});
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_SPLIT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LISTS_SPLIT_HELPURL
);
this
.
setColour
(
260
);
this
.
setColour
(
Blockly
.
Blocks
.
lists
.
HUE
);
this
.
appendValueInput
(
'
INPUT
'
)
this
.
appendValueInput
(
'
INPUT
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
.
appendField
(
dropdown
,
'
MODE
'
);
.
appendField
(
dropdown
,
'
MODE
'
);
...
...
blocks/logic.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.logic');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.logic');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
logic
.
HUE
=
210
;
Blockly
.
Blocks
[
'
controls_if
'
]
=
{
Blockly
.
Blocks
[
'
controls_if
'
]
=
{
/**
/**
* Block for if/elseif/else condition.
* Block for if/elseif/else condition.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['controls_if'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['controls_if'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_IF_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_IF_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
appendValueInput
(
'
IF0
'
)
this
.
appendValueInput
(
'
IF0
'
)
.
setCheck
(
'
Boolean
'
)
.
setCheck
(
'
Boolean
'
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_MSG_IF
);
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_MSG_IF
);
...
@@ -215,7 +217,7 @@ Blockly.Blocks['controls_if_if'] = {
...
@@ -215,7 +217,7 @@ Blockly.Blocks['controls_if_if'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_IF_TITLE_IF
);
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_IF_TITLE_IF
);
this
.
appendStatementInput
(
'
STACK
'
);
this
.
appendStatementInput
(
'
STACK
'
);
...
@@ -230,7 +232,7 @@ Blockly.Blocks['controls_if_elseif'] = {
...
@@ -230,7 +232,7 @@ Blockly.Blocks['controls_if_elseif'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_ELSEIF_TITLE_ELSEIF
);
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_ELSEIF_TITLE_ELSEIF
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
...
@@ -246,7 +248,7 @@ Blockly.Blocks['controls_if_else'] = {
...
@@ -246,7 +248,7 @@ Blockly.Blocks['controls_if_else'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_ELSE_TITLE_ELSE
);
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_ELSE_TITLE_ELSE
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
...
@@ -277,7 +279,7 @@ Blockly.Blocks['logic_compare'] = {
...
@@ -277,7 +279,7 @@ Blockly.Blocks['logic_compare'] = {
[
'
\
u2265
'
,
'
GTE
'
]
[
'
\
u2265
'
,
'
GTE
'
]
];
];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_COMPARE_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_COMPARE_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
appendValueInput
(
'
A
'
);
this
.
appendValueInput
(
'
A
'
);
this
.
appendValueInput
(
'
B
'
)
this
.
appendValueInput
(
'
B
'
)
...
@@ -310,7 +312,7 @@ Blockly.Blocks['logic_operation'] = {
...
@@ -310,7 +312,7 @@ Blockly.Blocks['logic_operation'] = {
[[
Blockly
.
Msg
.
LOGIC_OPERATION_AND
,
'
AND
'
],
[[
Blockly
.
Msg
.
LOGIC_OPERATION_AND
,
'
AND
'
],
[
Blockly
.
Msg
.
LOGIC_OPERATION_OR
,
'
OR
'
]];
[
Blockly
.
Msg
.
LOGIC_OPERATION_OR
,
'
OR
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_OPERATION_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_OPERATION_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
appendValueInput
(
'
A
'
)
this
.
appendValueInput
(
'
A
'
)
.
setCheck
(
'
Boolean
'
);
.
setCheck
(
'
Boolean
'
);
...
@@ -338,7 +340,7 @@ Blockly.Blocks['logic_negate'] = {
...
@@ -338,7 +340,7 @@ Blockly.Blocks['logic_negate'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_NEGATE_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_NEGATE_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
LOGIC_NEGATE_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
LOGIC_NEGATE_TITLE
,
[
'
BOOL
'
,
'
Boolean
'
,
Blockly
.
ALIGN_RIGHT
],
[
'
BOOL
'
,
'
Boolean
'
,
Blockly
.
ALIGN_RIGHT
],
...
@@ -357,7 +359,7 @@ Blockly.Blocks['logic_boolean'] = {
...
@@ -357,7 +359,7 @@ Blockly.Blocks['logic_boolean'] = {
[[
Blockly
.
Msg
.
LOGIC_BOOLEAN_TRUE
,
'
TRUE
'
],
[[
Blockly
.
Msg
.
LOGIC_BOOLEAN_TRUE
,
'
TRUE
'
],
[
Blockly
.
Msg
.
LOGIC_BOOLEAN_FALSE
,
'
FALSE
'
]];
[
Blockly
.
Msg
.
LOGIC_BOOLEAN_FALSE
,
'
FALSE
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_BOOLEAN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_BOOLEAN_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
setOutput
(
true
,
'
Boolean
'
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
new
Blockly
.
FieldDropdown
(
BOOLEANS
),
'
BOOL
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
BOOLEANS
),
'
BOOL
'
);
...
@@ -372,7 +374,7 @@ Blockly.Blocks['logic_null'] = {
...
@@ -372,7 +374,7 @@ Blockly.Blocks['logic_null'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_NULL_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_NULL_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
setOutput
(
true
);
this
.
setOutput
(
true
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
LOGIC_NULL
);
.
appendField
(
Blockly
.
Msg
.
LOGIC_NULL
);
...
@@ -387,7 +389,7 @@ Blockly.Blocks['logic_ternary'] = {
...
@@ -387,7 +389,7 @@ Blockly.Blocks['logic_ternary'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_TERNARY_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
LOGIC_TERNARY_HELPURL
);
this
.
setColour
(
210
);
this
.
setColour
(
Blockly
.
Blocks
.
logic
.
HUE
);
this
.
appendValueInput
(
'
IF
'
)
this
.
appendValueInput
(
'
IF
'
)
.
setCheck
(
'
Boolean
'
)
.
setCheck
(
'
Boolean
'
)
.
appendField
(
Blockly
.
Msg
.
LOGIC_TERNARY_CONDITION
);
.
appendField
(
Blockly
.
Msg
.
LOGIC_TERNARY_CONDITION
);
...
...
blocks/loops.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.loops');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.loops');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
loops
.
HUE
=
120
;
Blockly
.
Blocks
[
'
controls_repeat
'
]
=
{
Blockly
.
Blocks
[
'
controls_repeat
'
]
=
{
/**
/**
* Block for repeat n times (internal number).
* Block for repeat n times (internal number).
...
@@ -36,7 +38,7 @@ Blockly.Blocks['controls_repeat'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['controls_repeat'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_REPEAT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_REPEAT_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
CONTROLS_REPEAT_TITLE_REPEAT
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_REPEAT_TITLE_REPEAT
)
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
10
'
,
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
10
'
,
...
@@ -57,7 +59,7 @@ Blockly.Blocks['controls_repeat_ext'] = {
...
@@ -57,7 +59,7 @@ Blockly.Blocks['controls_repeat_ext'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_REPEAT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_REPEAT_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
CONTROLS_REPEAT_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
CONTROLS_REPEAT_TITLE
,
[
'
TIMES
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
[
'
TIMES
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -80,7 +82,7 @@ Blockly.Blocks['controls_whileUntil'] = {
...
@@ -80,7 +82,7 @@ Blockly.Blocks['controls_whileUntil'] = {
[[
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_OPERATOR_WHILE
,
'
WHILE
'
],
[[
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_OPERATOR_WHILE
,
'
WHILE
'
],
[
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_OPERATOR_UNTIL
,
'
UNTIL
'
]];
[
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_OPERATOR_UNTIL
,
'
UNTIL
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_WHILEUNTIL_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
appendValueInput
(
'
BOOL
'
)
this
.
appendValueInput
(
'
BOOL
'
)
.
setCheck
(
'
Boolean
'
)
.
setCheck
(
'
Boolean
'
)
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
MODE
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
MODE
'
);
...
@@ -108,7 +110,7 @@ Blockly.Blocks['controls_for'] = {
...
@@ -108,7 +110,7 @@ Blockly.Blocks['controls_for'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FOR_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FOR_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
CONTROLS_FOR_INPUT_WITH
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_FOR_INPUT_WITH
)
.
appendField
(
new
Blockly
.
FieldVariable
(
null
),
'
VAR
'
);
.
appendField
(
new
Blockly
.
FieldVariable
(
null
),
'
VAR
'
);
...
@@ -176,7 +178,7 @@ Blockly.Blocks['controls_forEach'] = {
...
@@ -176,7 +178,7 @@ Blockly.Blocks['controls_forEach'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FOREACH_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FOREACH_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
appendValueInput
(
'
LIST
'
)
this
.
appendValueInput
(
'
LIST
'
)
.
setCheck
(
'
Array
'
)
.
setCheck
(
'
Array
'
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_FOREACH_INPUT_ITEM
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_FOREACH_INPUT_ITEM
)
...
@@ -231,7 +233,7 @@ Blockly.Blocks['controls_flow_statements'] = {
...
@@ -231,7 +233,7 @@ Blockly.Blocks['controls_flow_statements'] = {
[[
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK
,
'
BREAK
'
],
[[
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK
,
'
BREAK
'
],
[
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE
,
'
CONTINUE
'
]];
[
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE
,
'
CONTINUE
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
CONTROLS_FLOW_STATEMENTS_HELPURL
);
this
.
setColour
(
120
);
this
.
setColour
(
Blockly
.
Blocks
.
loops
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
FLOW
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
FLOW
'
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
...
...
blocks/math.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.math');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.math');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
math
.
HUE
=
230
;
Blockly
.
Blocks
[
'
math_number
'
]
=
{
Blockly
.
Blocks
[
'
math_number
'
]
=
{
/**
/**
* Block for numeric value.
* Block for numeric value.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['math_number'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['math_number'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_NUMBER_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_NUMBER_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
0
'
,
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
0
'
,
Blockly
.
FieldTextInput
.
numberValidator
),
'
NUM
'
);
Blockly
.
FieldTextInput
.
numberValidator
),
'
NUM
'
);
...
@@ -58,7 +60,7 @@ Blockly.Blocks['math_arithmetic'] = {
...
@@ -58,7 +60,7 @@ Blockly.Blocks['math_arithmetic'] = {
[
Blockly
.
Msg
.
MATH_DIVISION_SYMBOL
,
'
DIVIDE
'
],
[
Blockly
.
Msg
.
MATH_DIVISION_SYMBOL
,
'
DIVIDE
'
],
[
Blockly
.
Msg
.
MATH_POWER_SYMBOL
,
'
POWER
'
]];
[
Blockly
.
Msg
.
MATH_POWER_SYMBOL
,
'
POWER
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ARITHMETIC_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ARITHMETIC_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendValueInput
(
'
A
'
)
this
.
appendValueInput
(
'
A
'
)
.
setCheck
(
'
Number
'
);
.
setCheck
(
'
Number
'
);
...
@@ -97,7 +99,7 @@ Blockly.Blocks['math_single'] = {
...
@@ -97,7 +99,7 @@ Blockly.Blocks['math_single'] = {
[
'
e^
'
,
'
EXP
'
],
[
'
e^
'
,
'
EXP
'
],
[
'
10^
'
,
'
POW10
'
]];
[
'
10^
'
,
'
POW10
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_SINGLE_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_SINGLE_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
interpolateMsg
(
'
%1 %2
'
,
this
.
interpolateMsg
(
'
%1 %2
'
,
[
'
OP
'
,
new
Blockly
.
FieldDropdown
(
OPERATORS
)],
[
'
OP
'
,
new
Blockly
.
FieldDropdown
(
OPERATORS
)],
...
@@ -135,7 +137,7 @@ Blockly.Blocks['math_trig'] = {
...
@@ -135,7 +137,7 @@ Blockly.Blocks['math_trig'] = {
[
Blockly
.
Msg
.
MATH_TRIG_ACOS
,
'
ACOS
'
],
[
Blockly
.
Msg
.
MATH_TRIG_ACOS
,
'
ACOS
'
],
[
Blockly
.
Msg
.
MATH_TRIG_ATAN
,
'
ATAN
'
]];
[
Blockly
.
Msg
.
MATH_TRIG_ATAN
,
'
ATAN
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_TRIG_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_TRIG_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendValueInput
(
'
NUM
'
)
this
.
appendValueInput
(
'
NUM
'
)
.
setCheck
(
'
Number
'
)
.
setCheck
(
'
Number
'
)
...
@@ -171,7 +173,7 @@ Blockly.Blocks['math_constant'] = {
...
@@ -171,7 +173,7 @@ Blockly.Blocks['math_constant'] = {
[
'
sqrt(
\
u00bd)
'
,
'
SQRT1_2
'
],
[
'
sqrt(
\
u00bd)
'
,
'
SQRT1_2
'
],
[
'
\
u221e
'
,
'
INFINITY
'
]];
[
'
\
u221e
'
,
'
INFINITY
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CONSTANT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CONSTANT_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
new
Blockly
.
FieldDropdown
(
CONSTANTS
),
'
CONSTANT
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
CONSTANTS
),
'
CONSTANT
'
);
...
@@ -194,7 +196,7 @@ Blockly.Blocks['math_number_property'] = {
...
@@ -194,7 +196,7 @@ Blockly.Blocks['math_number_property'] = {
[
Blockly
.
Msg
.
MATH_IS_POSITIVE
,
'
POSITIVE
'
],
[
Blockly
.
Msg
.
MATH_IS_POSITIVE
,
'
POSITIVE
'
],
[
Blockly
.
Msg
.
MATH_IS_NEGATIVE
,
'
NEGATIVE
'
],
[
Blockly
.
Msg
.
MATH_IS_NEGATIVE
,
'
NEGATIVE
'
],
[
Blockly
.
Msg
.
MATH_IS_DIVISIBLE_BY
,
'
DIVISIBLE_BY
'
]];
[
Blockly
.
Msg
.
MATH_IS_DIVISIBLE_BY
,
'
DIVISIBLE_BY
'
]];
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
appendValueInput
(
'
NUMBER_TO_CHECK
'
)
this
.
appendValueInput
(
'
NUMBER_TO_CHECK
'
)
.
setCheck
(
'
Number
'
);
.
setCheck
(
'
Number
'
);
var
dropdown
=
new
Blockly
.
FieldDropdown
(
PROPERTIES
,
function
(
option
)
{
var
dropdown
=
new
Blockly
.
FieldDropdown
(
PROPERTIES
,
function
(
option
)
{
...
@@ -254,7 +256,7 @@ Blockly.Blocks['math_change'] = {
...
@@ -254,7 +256,7 @@ Blockly.Blocks['math_change'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CHANGE_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CHANGE_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
interpolateMsg
(
this
.
interpolateMsg
(
// TODO: Combine these messages instead of using concatenation.
// TODO: Combine these messages instead of using concatenation.
Blockly
.
Msg
.
MATH_CHANGE_TITLE_CHANGE
+
'
%1
'
+
Blockly
.
Msg
.
MATH_CHANGE_TITLE_CHANGE
+
'
%1
'
+
...
@@ -304,7 +306,7 @@ Blockly.Blocks['math_round'] = {
...
@@ -304,7 +306,7 @@ Blockly.Blocks['math_round'] = {
[
Blockly
.
Msg
.
MATH_ROUND_OPERATOR_ROUNDUP
,
'
ROUNDUP
'
],
[
Blockly
.
Msg
.
MATH_ROUND_OPERATOR_ROUNDUP
,
'
ROUNDUP
'
],
[
Blockly
.
Msg
.
MATH_ROUND_OPERATOR_ROUNDDOWN
,
'
ROUNDDOWN
'
]];
[
Blockly
.
Msg
.
MATH_ROUND_OPERATOR_ROUNDDOWN
,
'
ROUNDDOWN
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ROUND_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ROUND_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendValueInput
(
'
NUM
'
)
this
.
appendValueInput
(
'
NUM
'
)
.
setCheck
(
'
Number
'
)
.
setCheck
(
'
Number
'
)
...
@@ -332,7 +334,7 @@ Blockly.Blocks['math_on_list'] = {
...
@@ -332,7 +334,7 @@ Blockly.Blocks['math_on_list'] = {
// Assign 'this' to a variable for use in the closures below.
// Assign 'this' to a variable for use in the closures below.
var
thisBlock
=
this
;
var
thisBlock
=
this
;
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ONLIST_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_ONLIST_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
var
dropdown
=
new
Blockly
.
FieldDropdown
(
OPERATORS
,
function
(
newOp
)
{
var
dropdown
=
new
Blockly
.
FieldDropdown
(
OPERATORS
,
function
(
newOp
)
{
if
(
newOp
==
'
MODE
'
)
{
if
(
newOp
==
'
MODE
'
)
{
...
@@ -368,7 +370,7 @@ Blockly.Blocks['math_modulo'] = {
...
@@ -368,7 +370,7 @@ Blockly.Blocks['math_modulo'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_MODULO_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_MODULO_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_MODULO_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_MODULO_TITLE
,
[
'
DIVIDEND
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
[
'
DIVIDEND
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
...
@@ -386,7 +388,7 @@ Blockly.Blocks['math_constrain'] = {
...
@@ -386,7 +388,7 @@ Blockly.Blocks['math_constrain'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CONSTRAIN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_CONSTRAIN_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_CONSTRAIN_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_CONSTRAIN_TITLE
,
[
'
VALUE
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
[
'
VALUE
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
...
@@ -405,7 +407,7 @@ Blockly.Blocks['math_random_int'] = {
...
@@ -405,7 +407,7 @@ Blockly.Blocks['math_random_int'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_RANDOM_INT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_RANDOM_INT_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_RANDOM_INT_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
MATH_RANDOM_INT_TITLE
,
[
'
FROM
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
[
'
FROM
'
,
'
Number
'
,
Blockly
.
ALIGN_RIGHT
],
...
@@ -423,7 +425,7 @@ Blockly.Blocks['math_random_float'] = {
...
@@ -423,7 +425,7 @@ Blockly.Blocks['math_random_float'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_RANDOM_FLOAT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
MATH_RANDOM_FLOAT_HELPURL
);
this
.
setColour
(
230
);
this
.
setColour
(
Blockly
.
Blocks
.
math
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
MATH_RANDOM_FLOAT_TITLE_RANDOM
);
.
appendField
(
Blockly
.
Msg
.
MATH_RANDOM_FLOAT_TITLE_RANDOM
);
...
...
blocks/procedures.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.procedures');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.procedures');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
procedures
.
HUE
=
290
;
Blockly
.
Blocks
[
'
procedures_defnoreturn
'
]
=
{
Blockly
.
Blocks
[
'
procedures_defnoreturn
'
]
=
{
/**
/**
* Block for defining a procedure with no return value.
* Block for defining a procedure with no return value.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_DEFNORETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_DEFNORETURN_HELPURL
);
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
var
name
=
Blockly
.
Procedures
.
findLegalName
(
var
name
=
Blockly
.
Procedures
.
findLegalName
(
Blockly
.
Msg
.
PROCEDURES_DEFNORETURN_PROCEDURE
,
this
);
Blockly
.
Msg
.
PROCEDURES_DEFNORETURN_PROCEDURE
,
this
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
...
@@ -329,7 +331,7 @@ Blockly.Blocks['procedures_defreturn'] = {
...
@@ -329,7 +331,7 @@ Blockly.Blocks['procedures_defreturn'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_DEFRETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_DEFRETURN_HELPURL
);
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
var
name
=
Blockly
.
Procedures
.
findLegalName
(
var
name
=
Blockly
.
Procedures
.
findLegalName
(
Blockly
.
Msg
.
PROCEDURES_DEFRETURN_PROCEDURE
,
this
);
Blockly
.
Msg
.
PROCEDURES_DEFRETURN_PROCEDURE
,
this
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
...
@@ -376,7 +378,7 @@ Blockly.Blocks['procedures_mutatorcontainer'] = {
...
@@ -376,7 +378,7 @@ Blockly.Blocks['procedures_mutatorcontainer'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_MUTATORCONTAINER_TITLE
);
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_MUTATORCONTAINER_TITLE
);
this
.
appendStatementInput
(
'
STACK
'
);
this
.
appendStatementInput
(
'
STACK
'
);
...
@@ -394,7 +396,7 @@ Blockly.Blocks['procedures_mutatorarg'] = {
...
@@ -394,7 +396,7 @@ Blockly.Blocks['procedures_mutatorarg'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_MUTATORARG_TITLE
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_MUTATORARG_TITLE
)
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
x
'
,
this
.
validator_
),
'
NAME
'
);
.
appendField
(
new
Blockly
.
FieldTextInput
(
'
x
'
,
this
.
validator_
),
'
NAME
'
);
...
@@ -425,7 +427,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
...
@@ -425,7 +427,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_HELPURL
);
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_CALL
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLNORETURN_CALL
)
.
appendField
(
''
,
'
NAME
'
)
.
appendField
(
''
,
'
NAME
'
)
...
@@ -628,7 +630,7 @@ Blockly.Blocks['procedures_callreturn'] = {
...
@@ -628,7 +630,7 @@ Blockly.Blocks['procedures_callreturn'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_HELPURL
);
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_CALL
)
.
appendField
(
Blockly
.
Msg
.
PROCEDURES_CALLRETURN_CALL
)
.
appendField
(
''
,
'
NAME
'
)
.
appendField
(
''
,
'
NAME
'
)
...
@@ -656,7 +658,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
...
@@ -656,7 +658,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
'
http://c2.com/cgi/wiki?GuardClause
'
);
this
.
setHelpUrl
(
'
http://c2.com/cgi/wiki?GuardClause
'
);
this
.
setColour
(
290
);
this
.
setColour
(
Blockly
.
Blocks
.
procedures
.
HUE
);
this
.
appendValueInput
(
'
CONDITION
'
)
this
.
appendValueInput
(
'
CONDITION
'
)
.
setCheck
(
'
Boolean
'
)
.
setCheck
(
'
Boolean
'
)
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_MSG_IF
);
.
appendField
(
Blockly
.
Msg
.
CONTROLS_IF_MSG_IF
);
...
...
blocks/text.js
View file @
ddcf1ac9
...
@@ -24,11 +24,13 @@
...
@@ -24,11 +24,13 @@
*/
*/
'
use strict
'
;
'
use strict
'
;
goog
.
provide
(
'
Blockly.Blocks.text
'
);
goog
.
provide
(
'
Blockly.Blocks.text
s
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
texts
.
HUE
=
160
;
Blockly
.
Blocks
[
'
text
'
]
=
{
Blockly
.
Blocks
[
'
text
'
]
=
{
/**
/**
* Block for text value.
* Block for text value.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['text'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['text'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_TEXT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_TEXT_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
this
.
newQuote_
(
true
))
.
appendField
(
this
.
newQuote_
(
true
))
.
appendField
(
new
Blockly
.
FieldTextInput
(
''
),
'
TEXT
'
)
.
appendField
(
new
Blockly
.
FieldTextInput
(
''
),
'
TEXT
'
)
...
@@ -67,7 +69,7 @@ Blockly.Blocks['text_join'] = {
...
@@ -67,7 +69,7 @@ Blockly.Blocks['text_join'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_JOIN_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_JOIN_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
itemCount_
=
2
;
this
.
itemCount_
=
2
;
this
.
updateShape_
();
this
.
updateShape_
();
this
.
setOutput
(
true
,
'
String
'
);
this
.
setOutput
(
true
,
'
String
'
);
...
@@ -193,7 +195,7 @@ Blockly.Blocks['text_create_join_container'] = {
...
@@ -193,7 +195,7 @@ Blockly.Blocks['text_create_join_container'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
TEXT_CREATE_JOIN_TITLE_JOIN
);
.
appendField
(
Blockly
.
Msg
.
TEXT_CREATE_JOIN_TITLE_JOIN
);
this
.
appendStatementInput
(
'
STACK
'
);
this
.
appendStatementInput
(
'
STACK
'
);
...
@@ -208,7 +210,7 @@ Blockly.Blocks['text_create_join_item'] = {
...
@@ -208,7 +210,7 @@ Blockly.Blocks['text_create_join_item'] = {
* @this Blockly.Block
* @this Blockly.Block
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
TEXT_CREATE_JOIN_ITEM_TITLE_ITEM
);
.
appendField
(
Blockly
.
Msg
.
TEXT_CREATE_JOIN_ITEM_TITLE_ITEM
);
this
.
setPreviousStatement
(
true
);
this
.
setPreviousStatement
(
true
);
...
@@ -225,7 +227,7 @@ Blockly.Blocks['text_append'] = {
...
@@ -225,7 +227,7 @@ Blockly.Blocks['text_append'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_APPEND_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_APPEND_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendValueInput
(
'
TEXT
'
)
this
.
appendValueInput
(
'
TEXT
'
)
.
appendField
(
Blockly
.
Msg
.
TEXT_APPEND_TO
)
.
appendField
(
Blockly
.
Msg
.
TEXT_APPEND_TO
)
.
appendField
(
new
Blockly
.
FieldVariable
(
.
appendField
(
new
Blockly
.
FieldVariable
(
...
@@ -269,7 +271,7 @@ Blockly.Blocks['text_length'] = {
...
@@ -269,7 +271,7 @@ Blockly.Blocks['text_length'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_LENGTH_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_LENGTH_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_LENGTH_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_LENGTH_TITLE
,
[
'
VALUE
'
,
[
'
String
'
,
'
Array
'
],
Blockly
.
ALIGN_RIGHT
],
[
'
VALUE
'
,
[
'
String
'
,
'
Array
'
],
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -285,7 +287,7 @@ Blockly.Blocks['text_isEmpty'] = {
...
@@ -285,7 +287,7 @@ Blockly.Blocks['text_isEmpty'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_ISEMPTY_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_ISEMPTY_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_ISEMPTY_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_ISEMPTY_TITLE
,
[
'
VALUE
'
,
[
'
String
'
,
'
Array
'
],
Blockly
.
ALIGN_RIGHT
],
[
'
VALUE
'
,
[
'
String
'
,
'
Array
'
],
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -304,7 +306,7 @@ Blockly.Blocks['text_indexOf'] = {
...
@@ -304,7 +306,7 @@ Blockly.Blocks['text_indexOf'] = {
[[
Blockly
.
Msg
.
TEXT_INDEXOF_OPERATOR_FIRST
,
'
FIRST
'
],
[[
Blockly
.
Msg
.
TEXT_INDEXOF_OPERATOR_FIRST
,
'
FIRST
'
],
[
Blockly
.
Msg
.
TEXT_INDEXOF_OPERATOR_LAST
,
'
LAST
'
]];
[
Blockly
.
Msg
.
TEXT_INDEXOF_OPERATOR_LAST
,
'
LAST
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_INDEXOF_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_INDEXOF_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
setOutput
(
true
,
'
Number
'
);
this
.
appendValueInput
(
'
VALUE
'
)
this
.
appendValueInput
(
'
VALUE
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
...
@@ -333,7 +335,7 @@ Blockly.Blocks['text_charAt'] = {
...
@@ -333,7 +335,7 @@ Blockly.Blocks['text_charAt'] = {
[
Blockly
.
Msg
.
TEXT_CHARAT_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
TEXT_CHARAT_LAST
,
'
LAST
'
],
[
Blockly
.
Msg
.
TEXT_CHARAT_RANDOM
,
'
RANDOM
'
]];
[
Blockly
.
Msg
.
TEXT_CHARAT_RANDOM
,
'
RANDOM
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_CHARAT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_CHARAT_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
setOutput
(
true
,
'
String
'
);
this
.
setOutput
(
true
,
'
String
'
);
this
.
appendValueInput
(
'
VALUE
'
)
this
.
appendValueInput
(
'
VALUE
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
...
@@ -421,7 +423,7 @@ Blockly.Blocks['text_getSubstring'] = {
...
@@ -421,7 +423,7 @@ Blockly.Blocks['text_getSubstring'] = {
[
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_END_FROM_END
,
'
FROM_END
'
],
[
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_END_FROM_END
,
'
FROM_END
'
],
[
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_END_LAST
,
'
LAST
'
]];
[
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_END_LAST
,
'
LAST
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendValueInput
(
'
STRING
'
)
this
.
appendValueInput
(
'
STRING
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
.
appendField
(
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_INPUT_IN_TEXT
);
.
appendField
(
Blockly
.
Msg
.
TEXT_GET_SUBSTRING_INPUT_IN_TEXT
);
...
@@ -522,7 +524,7 @@ Blockly.Blocks['text_changeCase'] = {
...
@@ -522,7 +524,7 @@ Blockly.Blocks['text_changeCase'] = {
[
Blockly
.
Msg
.
TEXT_CHANGECASE_OPERATOR_LOWERCASE
,
'
LOWERCASE
'
],
[
Blockly
.
Msg
.
TEXT_CHANGECASE_OPERATOR_LOWERCASE
,
'
LOWERCASE
'
],
[
Blockly
.
Msg
.
TEXT_CHANGECASE_OPERATOR_TITLECASE
,
'
TITLECASE
'
]];
[
Blockly
.
Msg
.
TEXT_CHANGECASE_OPERATOR_TITLECASE
,
'
TITLECASE
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_CHANGECASE_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_CHANGECASE_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendValueInput
(
'
TEXT
'
)
this
.
appendValueInput
(
'
TEXT
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
CASE
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
CASE
'
);
...
@@ -542,7 +544,7 @@ Blockly.Blocks['text_trim'] = {
...
@@ -542,7 +544,7 @@ Blockly.Blocks['text_trim'] = {
[
Blockly
.
Msg
.
TEXT_TRIM_OPERATOR_LEFT
,
'
LEFT
'
],
[
Blockly
.
Msg
.
TEXT_TRIM_OPERATOR_LEFT
,
'
LEFT
'
],
[
Blockly
.
Msg
.
TEXT_TRIM_OPERATOR_RIGHT
,
'
RIGHT
'
]];
[
Blockly
.
Msg
.
TEXT_TRIM_OPERATOR_RIGHT
,
'
RIGHT
'
]];
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_TRIM_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_TRIM_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
appendValueInput
(
'
TEXT
'
)
this
.
appendValueInput
(
'
TEXT
'
)
.
setCheck
(
'
String
'
)
.
setCheck
(
'
String
'
)
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
MODE
'
);
.
appendField
(
new
Blockly
.
FieldDropdown
(
OPERATORS
),
'
MODE
'
);
...
@@ -558,7 +560,7 @@ Blockly.Blocks['text_print'] = {
...
@@ -558,7 +560,7 @@ Blockly.Blocks['text_print'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PRINT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PRINT_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_PRINT_TITLE
,
this
.
interpolateMsg
(
Blockly
.
Msg
.
TEXT_PRINT_TITLE
,
[
'
TEXT
'
,
null
,
Blockly
.
ALIGN_RIGHT
],
[
'
TEXT
'
,
null
,
Blockly
.
ALIGN_RIGHT
],
Blockly
.
ALIGN_RIGHT
);
Blockly
.
ALIGN_RIGHT
);
...
@@ -580,7 +582,7 @@ Blockly.Blocks['text_prompt'] = {
...
@@ -580,7 +582,7 @@ Blockly.Blocks['text_prompt'] = {
// Assign 'this' to a variable for use in the closure below.
// Assign 'this' to a variable for use in the closure below.
var
thisBlock
=
this
;
var
thisBlock
=
this
;
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PROMPT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PROMPT_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
var
dropdown
=
new
Blockly
.
FieldDropdown
(
TYPES
,
function
(
newOp
)
{
var
dropdown
=
new
Blockly
.
FieldDropdown
(
TYPES
,
function
(
newOp
)
{
if
(
newOp
==
'
NUMBER
'
)
{
if
(
newOp
==
'
NUMBER
'
)
{
thisBlock
.
changeOutput
(
'
Number
'
);
thisBlock
.
changeOutput
(
'
Number
'
);
...
@@ -617,7 +619,7 @@ Blockly.Blocks['text_prompt_ext'] = {
...
@@ -617,7 +619,7 @@ Blockly.Blocks['text_prompt_ext'] = {
// Assign 'this' to a variable for use in the closure below.
// Assign 'this' to a variable for use in the closure below.
var
thisBlock
=
this
;
var
thisBlock
=
this
;
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PROMPT_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
TEXT_PROMPT_HELPURL
);
this
.
setColour
(
160
);
this
.
setColour
(
Blockly
.
Blocks
.
texts
.
HUE
);
var
dropdown
=
new
Blockly
.
FieldDropdown
(
TYPES
,
function
(
newOp
)
{
var
dropdown
=
new
Blockly
.
FieldDropdown
(
TYPES
,
function
(
newOp
)
{
if
(
newOp
==
'
NUMBER
'
)
{
if
(
newOp
==
'
NUMBER
'
)
{
thisBlock
.
changeOutput
(
'
Number
'
);
thisBlock
.
changeOutput
(
'
Number
'
);
...
...
blocks/variables.js
View file @
ddcf1ac9
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.variables');
...
@@ -29,6 +29,8 @@ goog.provide('Blockly.Blocks.variables');
goog
.
require
(
'
Blockly.Blocks
'
);
goog
.
require
(
'
Blockly.Blocks
'
);
Blockly
.
Blocks
.
variables
.
HUE
=
330
;
Blockly
.
Blocks
[
'
variables_get
'
]
=
{
Blockly
.
Blocks
[
'
variables_get
'
]
=
{
/**
/**
* Block for variable getter.
* Block for variable getter.
...
@@ -36,7 +38,7 @@ Blockly.Blocks['variables_get'] = {
...
@@ -36,7 +38,7 @@ Blockly.Blocks['variables_get'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
VARIABLES_GET_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
VARIABLES_GET_HELPURL
);
this
.
setColour
(
330
);
this
.
setColour
(
Blockly
.
Blocks
.
variables
.
HUE
);
this
.
appendDummyInput
()
this
.
appendDummyInput
()
.
appendField
(
Blockly
.
Msg
.
VARIABLES_GET_TITLE
)
.
appendField
(
Blockly
.
Msg
.
VARIABLES_GET_TITLE
)
.
appendField
(
new
Blockly
.
FieldVariable
(
.
appendField
(
new
Blockly
.
FieldVariable
(
...
@@ -92,7 +94,7 @@ Blockly.Blocks['variables_set'] = {
...
@@ -92,7 +94,7 @@ Blockly.Blocks['variables_set'] = {
*/
*/
init
:
function
()
{
init
:
function
()
{
this
.
setHelpUrl
(
Blockly
.
Msg
.
VARIABLES_SET_HELPURL
);
this
.
setHelpUrl
(
Blockly
.
Msg
.
VARIABLES_SET_HELPURL
);
this
.
setColour
(
330
);
this
.
setColour
(
Blockly
.
Blocks
.
variables
.
HUE
);
this
.
interpolateMsg
(
this
.
interpolateMsg
(
// TODO: Combine these messages instead of using concatenation.
// TODO: Combine these messages instead of using concatenation.
Blockly
.
Msg
.
VARIABLES_SET_TITLE
+
'
%1
'
+
Blockly
.
Msg
.
VARIABLES_SET_TITLE
+
'
%1
'
+
...
...
blocks_compressed.js
View file @
ddcf1ac9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment