46 lines
1.4 KiB
JSON
46 lines
1.4 KiB
JSON
{
|
|
"source": "JSON",
|
|
"data": "BLOCK",
|
|
"version": "0.0.1",
|
|
"type": "text",
|
|
"language": "javascript",
|
|
"extension": "webaudio",
|
|
"help": "Text",
|
|
"label": "Text",
|
|
"color": "50:150:250:150",
|
|
"group": "GUI",
|
|
"codes": {
|
|
"declaration": "\n// block_$id$ = $label$\nvar $port[value]$ = [];\n\nvar $port[invalue]$ = function(value){\n document.getElementById(\"block_$id$\").value = value;\n return true;\n };\n\n",
|
|
"execution": "\nfunction enter_value$id$(e){\n e = e || window.event;\n if (e.keyCode != 13) //Ignore if it is not enter\n return;\n value = document.getElementById(\"block_$id$\").value;\n for (var i = 0; i < $port[value]$.length ; i++){\n $port[value]$[i](value);\n }\n};\n",
|
|
"html": "\n$prop[label]$ <input type=\"text\" value=\"$prop[value]$\" onkeypress=\"enter_value$id$(event);\"\nid=\"block_$id$\"><br>\n"
|
|
},
|
|
"properties": [
|
|
{
|
|
"name": "value",
|
|
"label": "Value",
|
|
"type": "String",
|
|
"value": ""
|
|
},
|
|
{
|
|
"name": "label",
|
|
"label": "Label",
|
|
"type": "String",
|
|
"value": "Label"
|
|
}
|
|
],
|
|
"ports": [
|
|
{
|
|
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
|
|
"label": "Value",
|
|
"conn_type": "Output",
|
|
"name": "value"
|
|
},
|
|
{
|
|
"type": "mosaicode_lib_javascript_webaudio.extensions.ports.string",
|
|
"label": "Value",
|
|
"conn_type": "Input",
|
|
"name": "invalue"
|
|
}
|
|
]
|
|
}
|