Upgrade perseus API to v1

Summary:
I'm going to up the api version of perseus now, so that when
we start making prop upgrades, i'll have something to test
the mobile app's versioning against.

Test Plan:
make build; see that perseus-1.js and perseus-1.css are built

Auditors: joel, charlie
Adding Khan-specific note
Adding missing cd/
KA/khan
Fix MovableLine modify semantics

Summary:
Fixes a couple subtle semantic issues with MovableLine I introduced
when changing Interactive2's update/modify semantics:

1. I wasn't passing a coord to movable.grab(), which should be an error
2. I was using local variables created in `update` to store mouse state,
   but these were getting recreated whenever a new `update` or `modify`
   happened, which is every move while in a <Graphie> component

Test Plan: Cherry-picked this on top of D10783 and saw that it worked now

Reviewers: charlie, eater

Reviewed By: eater

Differential Revision: http://phabricator.khanacademy.org/D10784
New props for measurer

Summary:
Changes the props `imageUrl`, `imageTop`, `imageLeft` to
`image: {url, top, left}`.

There are two motivations for this:
1. This makes the props somewhat nicer looking
2. More importantly, this gives us a widget with a new major version that
   doesn't exist in perseus-0, so we can test versioning more

This commit happens to make some of the code uglier (in my opinion), but
not horribly so, and I think the benefit of being able to test this on
a relatively benign widget will be very important.

Test Plan:
 * Made an item with a measurer and changed its image, top, and left
   parameters, and made sure that it displayed correctly.
 * Made the same item at http://khan.github.io/perseus/, and made sure it
   displayed the same way
 * Copied the item from http://khan.github.io/perseus/ (which is version
   0.0) to http://localhost:9000/test.html (which is at version 1.0),
   and made sure that it still rendered correctly, and that taking its
   JSON gave the new props with the correct values

Reviewers: joel, charlie

Reviewed By: joel, charlie

Subscribers: eater

Differential Revision: http://phabricator.khanacademy.org/D10896
GraphieClasses constructor is now preserved through setting of prototype

Test Plan:
- Ran Simulator, which uses lots of Graphie classes.
- Made sure that classes which were different did not have equality of constructor.
- "#yolo!" -Jack

Auditors: jack
Remove unused line.

Auditors: kevin
remove handleLoseFocus

Test plan: none

Auditors: jack
Add iframe/program widget

Summary:
This adds an iframe widget that can be used for embedding
generic iframes or our programs.

For programs, we can pass settings to them that are exposed
 via Program.settings(), and they can communicate success
 via Program.runTest(), like:
  Program.runTest(function() {
           if (searchOrder[0] === 7) {
               println("Sending true");
               return true;
           } else {
               println("Sending false");
               return false;
           }
        });

Non-program iframes can also parse the settings from the URL
 and communicate via iframe, as long as they follow the
 protocol ({forPerseus: true, passed: true/false}

This is primarily for use with the Algorithms curriculum,
but will likely also be useful for Physics, Chemistry, etc.

Test Plan:
- I tested with the following in test.html:

```
"iframe 1": {
                "type": "iframe",
                "graded": true,
                "options": {
                    "url": "http://127.0.0.1:8080/cs/ignore-for-testing/6258007868440576/embedded?buttons=no&embed=yes&editor=no&author=no",
                    "width": "400px",
                    "height": "400px"
                },
                "version": {
                    "major": 0,
                    "minor": 0
                }
            },
```

Reviewers: jack

Reviewed By: jack

Subscribers: charlie, #cs, #perseus

Differential Revision: http://phabricator.khanacademy.org/D10937
Make iframe widget hidden in menu (can still be used by folks in the know)

Test Plan: - Load perseus, dont see widget in dropdown

Reviewers: eater

Subscribers: jack

Differential Revision: http://phabricator.khanacademy.org/D11035
Improve test.html permalinks

Summary:
permalinks were annoying because they could still include parens,
which made them unusable as link targets in markdown.

This diff escapes parens in permalinks, so that we can happily
embed them in our markdown.

Test Plan:
pressed `permalink` (from the default test.html question, which
includes images and uses parens for them), and made the following
link in phabricator:
[test](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22This%20is%20a%20rectangle.%20%20%20%5Cn%21%5B%5D%28https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fda8df81c78b22f5c69d477d8eabfb583968eaf84.png%29%5Cn%5CnLet%27s%20measure%20the%20%24%5C%5Cgreen%7B%5C%5Ctext%7Bgreen%20line%7D%7D%24%20below%20using%20both%20rectangles%20and%20a%20centimeter%20ruler%3A%5Cn%5Cn%21%5B%5D%28https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fb59fc02ca1aae800977b8793ed22f647a1aa75ee.png%29%5Cn%5Cn%2A%2AThe%20line%20is%20%5B%5B%E2%98%83%20input-number%201%5D%5D%20rectangle%28s%29%20long.%20%2A%2A%20%20%5Cn%20%20%5Cn%2A%2AThe%20line%20is%20%5B%5B%E2%98%83%20input-number%202%5D%5D%20centimeters%20long.%2A%2A%20%20%20%20%5Cn%5Cn%2A%2AThe%20length%20of%20each%20rectangle%20is%20%5B%5B%E2%98%83%20dropdown%201%5D%5D%20than%20a%20centimeter.%2A%2A%5Cn%5Cn%2A%2ASo%2C%20it%20takes%20%5B%5B%E2%98%83%20dropdown%202%5D%5D%20rectangles%20than%20centimeters%20to%20measure%20the%20line.%2A%2A%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fda8df81c78b22f5c69d477d8eabfb583968eaf84.png%22%3A%7B%22width%22%3A400%2C%22height%22%3A70%7D%2C%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fb59fc02ca1aae800977b8793ed22f647a1aa75ee.png%22%3A%7B%22width%22%3A425%2C%22height%22%3A150%7D%7D%2C%22widgets%22%3A%7B%22input-number%201%22%3A%7B%22type%22%3A%22input-number%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22value%22%3A1%2C%22simplify%22%3A%22required%22%2C%22size%22%3A%22small%22%2C%22inexact%22%3Afalse%2C%22maxError%22%3A0.1%2C%22answerType%22%3A%22number%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%2C%22input-number%202%22%3A%7B%22type%22%3A%22input-number%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22value%22%3A2%2C%22simplify%22%3A%22required%22%2C%22size%22%3A%22small%22%2C%22inexact%22%3Afalse%2C%22maxError%22%3A0.1%2C%22answerType%22%3A%22number%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%2C%22dropdown%201%22%3A%7B%22type%22%3A%22dropdown%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22choices%22%3A%5B%7B%22content%22%3A%22shorter%22%2C%22correct%22%3Afalse%7D%2C%7B%22content%22%3A%22longer%22%2C%22correct%22%3Atrue%7D%5D%2C%22placeholder%22%3A%22%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%2C%22dropdown%202%22%3A%7B%22type%22%3A%22dropdown%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22choices%22%3A%5B%7B%22content%22%3A%22fewer%22%2C%22correct%22%3Atrue%7D%2C%7B%22content%22%3A%22more%22%2C%22correct%22%3Afalse%7D%5D%2C%22placeholder%22%3A%22%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22Fill%20in%20the%20blanks%20and%20select%20the%20correct%20answers.%20%20%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22itemDataVersion%22%3A%7B%22major%22%3A0%2C%22minor%22%3A1%7D%2C%22hints%22%3A%5B%7B%22content%22%3A%22The%20line%20is%20%24%5C%5Cred1%24%20rectangle%20long.%20%20%5CnThe%20line%20is%20%24%5C%5Cblue2%24%20centimeters%20long.%5Cn%20%20%20%5Cn%2A%2AThe%20length%20of%20each%20rectangle%20is%20%2Alonger%2A%20than%20a%20centimeter.%2A%2A%5Cn%5Cn%2A%2ASo%2C%20it%20takes%20%2Afewer%2A%20rectangles%20than%20centimeters%20to%20measure%20the%20line.%2A%2A%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%5D%7D)

I also tried this using a permalink from http://khan.github.io/perseus ,
and it didn't work (which I won't replicate here because the output is
ugly).

Auditors: charlie
Re-add line-height in unpadded sortables

Summary:
line-height: 0 makes unpadded sortables with text look
ugly:
http://khan.github.io/perseus/#content=%7B%22question%22%3A%7B%22content%22%3A%22**Which%20shape%20are%20the%20clues%20describing%3F**%5Cn%5Cn%5B%5B%E2%98%83%20matcher%201%5D%5D%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F1379734e507821433c3bda2f1177fda47da3f10e.png%22%3A%7B%22width%22%3A400%2C%22height%22%3A266%7D%7D%2C%22widgets%22%3A%7B%22matcher%201%22%3A%7B%22type%22%3A%22matcher%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22left%22%3A%5B%22**is%20not%20round**%2C%20so%20it%20is%20not%3A%20%20If%20I%20add%20some%20more%20words%2C%20it%20gets%20yucky!!%22%2C%22**is%20a%20quadrilateral**%2C%20so%20it%20is%20not%3A%22%2C%22**has%20%244%24%20right%20angles**%2C%20so%20it%20is%20not%3A%22%2C%22**has%20%244%24%20sides%20of%20equal%20length**%2C%20so%20it%20is%20not%3A%22%2C%22must%20be%3A%22%5D%2C%22right%22%3A%5B%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fd7e87a3d879924b2a1dbf230d26c2ff999761993.png)%22%5D%2C%22labels%22%3A%5B%22**The%20shape%3A**%22%2C%22%24%24%22%5D%2C%22orderMatters%22%3Afalse%2C%22padding%22%3Afalse%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22Arrange%20the%20cards%20in%20the%20correct%20order.%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%7B%22content%22%3A%22The%20shape%20is%20not%20round%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20is%20a%20quadrilateral%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20has%20%244%24%20right%20angles%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20has%20%244%24%20sides%20of%20equal%20length%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%5D%7D

The line-height: 0 was to make sure the image wasn't positioned above a non-existant text baseline, unnecessarily making the sortable card larger. Instead, this diff uses `vertical-align: bottom;` on images to have the same effect on image sizing without making text appear on top of itself.

Test Plan:
Loaded this item:
http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22**Which%20shape%20are%20the%20clues%20describing%3F**%5Cn%5Cn%5B%5B%E2%98%83%20matcher%201%5D%5D%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F1379734e507821433c3bda2f1177fda47da3f10e.png%22%3A%7B%22width%22%3A400%2C%22height%22%3A266%7D%7D%2C%22widgets%22%3A%7B%22matcher%201%22%3A%7B%22type%22%3A%22matcher%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22left%22%3A%5B%22**is%20not%20round**%2C%20so%20it%20is%20not%3A%20%20If%20I%20add%20some%20more%20words%2C%20it%20gets%20yucky!!%22%2C%22**is%20a%20quadrilateral**%2C%20so%20it%20is%20not%3A%22%2C%22**has%20%244%24%20right%20angles**%2C%20so%20it%20is%20not%3A%22%2C%22**has%20%244%24%20sides%20of%20equal%20length**%2C%20so%20it%20is%20not%3A%22%2C%22must%20be%3A%22%5D%2C%22right%22%3A%5B%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png)%22%2C%22!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fd7e87a3d879924b2a1dbf230d26c2ff999761993.png)%22%5D%2C%22labels%22%3A%5B%22**The%20shape%3A**%22%2C%22%24%24%22%5D%2C%22orderMatters%22%3Afalse%2C%22padding%22%3Afalse%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22Arrange%20the%20cards%20in%20the%20correct%20order.%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%7B%22content%22%3A%22The%20shape%20is%20not%20round%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F9bf34a29bc62816f07057d9e571de844df484cd9.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20is%20a%20quadrilateral%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F199a93b886364a922bb38008d9c0a08221ca4dac.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20has%20%244%24%20right%20angles%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F5b842c6adbdf4de4dba70296479b1954a2362785.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22The%20shape%20has%20%244%24%20sides%20of%20equal%20length%2C%20so%20it%20cannot%20be%20a%3A%20%20%5Cn!%5B%5D(https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png)%22%2C%22images%22%3A%7B%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F4a8715a6c6537a0708df913e628906bc0494fd05.png%22%3A%7B%22width%22%3A100%2C%22height%22%3A100%7D%7D%2C%22widgets%22%3A%7B%7D%7D%2C%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%5D%7D
locally, and made sure that images didn't have much padding and were centered in their sortable cards
 * also added random text to the sortable cards and made sure they still looked good.

Reviewers: alex

Reviewed By: alex

Differential Revision: http://phabricator.khanacademy.org/D10979
Util: Move `.` to the next line

Test Plan: #yolo

Auditors: alex
Address jack's additional comments in code review

Test Plan:
- Load my modified test.html, check iframe to see that it has origin=localhost appended to its URL

Auditors: jack
Use https agnostic cdn.mathjax.org

This allows the page to operate from https://khan.github.io/perseus/ as well.
update `make demo` to work with v1
Added iOS-related build commands to Makefile

Summary: New commands (similar to those that exist for webapp) for building Perseus
to mobile. This commit is paired with a change in the mobile repo that builds its
necessary JavaScript.

Test Plan: See rGIc95d0bb23244.

Auditors: jack
Allow configurable button sets.

Summary:
Four functions always available, with addons.

Issues remaining:
* I don't remember exactly what button sets we wanted.

Test Plan:
In Perseus test mode, repeatedly select and unselect button sets, verifying
that they do show up as expected. All of the buttons insert the symbol or
construct I would expect of them.

Reviewers: jack

Reviewed By: jack

Differential Revision: http://phabricator.khanacademy.org/D10910
Change expression version.

Test plan:
`node node/echo-item-version.js` shows the new version

Auditors: jack