diff --git a/demos/blocklyfactory/factory.css b/demos/blocklyfactory/factory.css index 5a6600eeb..dad8922c3 100644 --- a/demos/blocklyfactory/factory.css +++ b/demos/blocklyfactory/factory.css @@ -430,8 +430,9 @@ td { padding-right: 20px; } -.test { - border: 1px solid black; +.disabled { + background-color: white; + opacity: 0.5; } #toolbox_div { @@ -466,17 +467,6 @@ td { margin-top: 2%; } -#disable_div { - background-color: white; - height: 100%; - left: 0; - opacity: .5; - position: absolute; - top: 0; - width: 100%; - z-index: -1; /* Start behind workspace */ -} - /* Rules for Closure popup color picker */ .goog-palette { outline: none; diff --git a/demos/blocklyfactory/factory_utils.js b/demos/blocklyfactory/factory_utils.js index f8ce4c861..89e421663 100644 --- a/demos/blocklyfactory/factory_utils.js +++ b/demos/blocklyfactory/factory_utils.js @@ -913,3 +913,40 @@ FactoryUtils.sameBlockXml = function(blockXml1, blockXml2) { return blockXmlText1 == blockXmlText2; }; +/* + * Checks if a block has a variable field. Blocks with variable fields cannot + * be shadow blocks. + * + * @param {Blockly.Block} block The block to check if a variable field exists. + * @return {boolean} True if the block has a variable field, false otherwise. + */ +FactoryUtils.hasVariableField = function(block) { + if (!block) { + return false; + } + for (var i = 0, input; input = block.inputList[i]; i++) { + for (var j = 0, field; field = input.fieldRow[j]; j++) { + if (field.name == 'VAR') { + return true; + } + } + } + return false; +}; + +/** + * Checks if a block is a procedures block. If procedures block names are + * ever updated or expanded, this function should be updated as well (no + * other known markers for procedure blocks beyond name). + * + * @param {Blockly.Block} block The block to check. + * @return {boolean} True if hte block is a procedure block, false otherwise. + */ +FactoryUtils.isProcedureBlock = function(block) { + return block && + (block.type == 'procedures_defnoreturn' || + block.type == 'procedures_defreturn' || + block.type == 'procedures_callnoreturn' || + block.type == 'procedures_callreturn' || + block.type == 'procedures_ifreturn'); +}; diff --git a/demos/blocklyfactory/index.html b/demos/blocklyfactory/index.html index 641ec2e16..8a5e8fd23 100644 --- a/demos/blocklyfactory/index.html +++ b/demos/blocklyfactory/index.html @@ -180,7 +180,6 @@
-