code-dot-org/code-dot-org — pull request #326 by cpirich (2014-11-04 05:35:19+00:00)
Title: add new APIs for webapp

![screen shot 2014-11-03 at 8 57 51 pm](https://cloud.githubusercontent.com/assets/5429146/4895182/7a1fab24-63e3-11e4-89aa-512bd2c6453d.png)

Added 6 new APIs to webapp for composing HTML elements: createButton, createTextInput, getText, setStyle, replaceHtmlBlock, and deleteHtmlBlock
Also added a random() function so that the built-in droplet block works with webapp. We need to think about "common" droplet blocks and where/how those should be implemented.
Modified generateCodeAliases to support functions that don't take a blockId (which is blockly only) - that is used for the new random function.
Modified droplet palette/modeOptions code to support categories of blocks (random is in a 'hidden' category since it is already part of the palette, getText is in a 'value' category since it returns a value).
Removed placeholder turnBlack API from webapp.
Changed Webapp.callCmd to combine all of the cases into one Webapp[cmd.name] function invocation.
Changed Webapp APIs to enforce that elements are children of the divWebapp element, so they can't be used to modify random elements on our page.