[Finishes #75389304] Add when run block to all levels

This ended up being a much larger work item than I expected.  Here are the major changes I made.  I'm also going to make a couple line item comments.

(1) Added a run block to all levels.  If you specify start blocks without a when run block, we'll insert one.  This ended up being more difficult to do than I expected, in particular getting it to work both in the browser and in node (for unit tests).  I made this run block be the same color as the run button.  This means there are some other blocks that are now close in color (https://www.pivotaltracker.com/story/show/76555132).  Screenshots of the when run block in different contexts:
K1: 
![image](https://cloud.githubusercontent.com/assets/1767466/3848867/e90f3adc-1e73-11e4-9d5e-fe4f8188cc61.png)

artist:
![image](https://cloud.githubusercontent.com/assets/1767466/3848877/00855192-1e74-11e4-92b6-ce731c632f24.png)

studio:
![image](https://cloud.githubusercontent.com/assets/1767466/3848886/1573bb52-1e74-11e4-880e-81abc6b6088d.png)
(just noticed we should get rid of when run from toolbox. https://www.pivotaltracker.com/story/show/76558840)

flappy:
note, here I flipped the ordering of when run/when click so that when run is always in the top left for all apps
![image](https://cloud.githubusercontent.com/assets/1767466/3848908/5ae19772-1e74-11e4-8c68-7dc22938fa9e.png)

(2)
We should no longer ever have empty top level blocks.  Instead of running through the code and then giving you an error, we'll now alert immediately and not animate/draw.

(3)
This threw off the block numbering for UI tests.  I'll have a separate dashboard PR fixing those.
Even better, I think I should do a string search for when_run before doing
anything, so that I find one even if it isn't the first block for some
reason.


On Thu, Aug 7, 2014 at 3:09 PM, Brian Jordan <notifications@github.com>
wrote:

> In src/utils.js:
>
> > + * Takes a set of start blocks, and returns them with a When Run block inserted
> > + * at the front - todo validate comment
> > + */
> > +exports.insertWhenRunBlock = function (input) {
> > +  var root = xml.parseElement(input);
> > +
> > +  // todo (brent) hacky - but works in both browser and node
> > +  var doc = root.parentNode;
> > +
> > +  var whenRun = doc.createElement('block');
> > +  whenRun.setAttribute('type', 'when_run');
> > +  whenRun.setAttribute('movable', 'false');
> > +
> > +  var numChildren = root.childNodes ? root.childNodes.length : 0;
> > +
> > +  // find the first non-function definition block and extract it
>
> maybe add note about returning early if we find an existing when_run block
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/code-dot-org/blockly/pull/795/files#r15967746>.
>