├── .gitattributes ├── app ├── edit │ ├── scripts │ │ ├── ace │ │ │ └── mode-text.js │ │ ├── vendor │ │ │ ├── d3 │ │ │ │ ├── .gitmodules │ │ │ │ ├── src │ │ │ │ │ ├── end.js │ │ │ │ │ ├── start.js │ │ │ │ │ ├── geo │ │ │ │ │ │ ├── geo.js │ │ │ │ │ │ ├── gnomonic.js │ │ │ │ │ │ ├── orthographic.js │ │ │ │ │ │ ├── equirectangular.js │ │ │ │ │ │ ├── stereographic.js │ │ │ │ │ │ ├── compose.js │ │ │ │ │ │ ├── spherical.js │ │ │ │ │ │ ├── azimuthal-equal-area.js │ │ │ │ │ │ ├── azimuthal-equidistant.js │ │ │ │ │ │ ├── mercator.js │ │ │ │ │ │ ├── azimuthal.js │ │ │ │ │ │ ├── bounds.js │ │ │ │ │ │ ├── cartesian.js │ │ │ │ │ │ ├── albers.js │ │ │ │ │ │ ├── interpolate.js │ │ │ │ │ │ ├── path-area.js │ │ │ │ │ │ ├── path-context.js │ │ │ │ │ │ ├── path-buffer.js │ │ │ │ │ │ └── rotation.js │ │ │ │ │ ├── svg │ │ │ │ │ │ ├── svg.js │ │ │ │ │ │ ├── area-radial.js │ │ │ │ │ │ ├── line-radial.js │ │ │ │ │ │ ├── diagonal-radial.js │ │ │ │ │ │ └── diagonal.js │ │ │ │ │ ├── geom │ │ │ │ │ │ ├── geom.js │ │ │ │ │ │ └── delaunay.js │ │ │ │ │ ├── layout │ │ │ │ │ │ ├── layout.js │ │ │ │ │ │ └── partition.js │ │ │ │ │ ├── behavior │ │ │ │ │ │ └── behavior.js │ │ │ │ │ ├── core │ │ │ │ │ │ ├── noop.js │ │ │ │ │ │ ├── true.js │ │ │ │ │ │ ├── identity.js │ │ │ │ │ │ ├── number.js │ │ │ │ │ │ ├── collapse.js │ │ │ │ │ │ ├── transpose.js │ │ │ │ │ │ ├── selection-empty.js │ │ │ │ │ │ ├── merge.js │ │ │ │ │ │ ├── ascending.js │ │ │ │ │ │ ├── descending.js │ │ │ │ │ │ ├── color.js │ │ │ │ │ │ ├── keys.js │ │ │ │ │ │ ├── values.js │ │ │ │ │ │ ├── round.js │ │ │ │ │ │ ├── functor.js │ │ │ │ │ │ ├── requote.js │ │ │ │ │ │ ├── entries.js │ │ │ │ │ │ ├── format-locale.js │ │ │ │ │ │ ├── xml.js │ │ │ │ │ │ ├── selection-call.js │ │ │ │ │ │ ├── text.js │ │ │ │ │ │ ├── selection-datum.js │ │ │ │ │ │ ├── permute.js │ │ │ │ │ │ ├── json.js │ │ │ │ │ │ ├── shuffle.js │ │ │ │ │ │ ├── median.js │ │ │ │ │ │ ├── transition-remove.js │ │ │ │ │ │ ├── xyz.js │ │ │ │ │ │ ├── quantile.js │ │ │ │ │ │ ├── transition-text.js │ │ │ │ │ │ ├── core.js │ │ │ │ │ │ ├── selection-remove.js │ │ │ │ │ │ ├── selection-node.js │ │ │ │ │ │ ├── html.js │ │ │ │ │ │ ├── class.js │ │ │ │ │ │ ├── touches.js │ │ │ │ │ │ ├── uninterpolate.js │ │ │ │ │ │ ├── transition-ease.js │ │ │ │ │ │ ├── sum.js │ │ │ │ │ │ ├── transition-delay.js │ │ │ │ │ │ ├── zip.js │ │ │ │ │ │ ├── mean.js │ │ │ │ │ │ ├── selection-html.js │ │ │ │ │ │ ├── transition-duration.js │ │ │ │ │ │ ├── selection-text.js │ │ │ │ │ │ ├── selection-order.js │ │ │ │ │ │ ├── selection-sort.js │ │ │ │ │ │ ├── selection-append.js │ │ │ │ │ │ ├── selection-each.js │ │ │ │ │ │ ├── max.js │ │ │ │ │ │ ├── min.js │ │ │ │ │ │ ├── selection-enter.js │ │ │ │ │ │ ├── selection-root.js │ │ │ │ │ │ ├── transition-filter.js │ │ │ │ │ │ ├── selection-insert.js │ │ │ │ │ │ ├── selection-transition.js │ │ │ │ │ │ ├── extent.js │ │ │ │ │ │ ├── ns.js │ │ │ │ │ │ ├── rebind.js │ │ │ │ │ │ ├── transition-each.js │ │ │ │ │ │ ├── range.js │ │ │ │ │ │ ├── transition-transition.js │ │ │ │ │ │ ├── selection-selectAll.js │ │ │ │ │ │ ├── selection-enter-select.js │ │ │ │ │ │ ├── selection-filter.js │ │ │ │ │ │ ├── formatPrefix.js │ │ │ │ │ │ ├── transition-tween.js │ │ │ │ │ │ ├── transition-select.js │ │ │ │ │ │ ├── random.js │ │ │ │ │ │ ├── bisect.js │ │ │ │ │ │ ├── array.js │ │ │ │ │ │ ├── transition-selectAll.js │ │ │ │ │ │ ├── selection-select.js │ │ │ │ │ │ ├── selection.js │ │ │ │ │ │ ├── hcl.js │ │ │ │ │ │ ├── mouse.js │ │ │ │ │ │ ├── map.js │ │ │ │ │ │ ├── selection-property.js │ │ │ │ │ │ ├── hsl.js │ │ │ │ │ │ └── dispatch.js │ │ │ │ │ ├── dsv │ │ │ │ │ │ ├── csv.js │ │ │ │ │ │ └── tsv.js │ │ │ │ │ ├── compat │ │ │ │ │ │ ├── date.js │ │ │ │ │ │ └── style.js │ │ │ │ │ ├── scale │ │ │ │ │ │ ├── sqrt.js │ │ │ │ │ │ ├── bilinear.js │ │ │ │ │ │ ├── scale.js │ │ │ │ │ │ ├── nice.js │ │ │ │ │ │ ├── polylinear.js │ │ │ │ │ │ ├── threshold.js │ │ │ │ │ │ ├── identity.js │ │ │ │ │ │ ├── quantize.js │ │ │ │ │ │ ├── quantile.js │ │ │ │ │ │ ├── pow.js │ │ │ │ │ │ └── category.js │ │ │ │ │ ├── component.js │ │ │ │ │ ├── time │ │ │ │ │ │ ├── month.js │ │ │ │ │ │ ├── year.js │ │ │ │ │ │ ├── format-locale.js │ │ │ │ │ │ ├── minute.js │ │ │ │ │ │ ├── second.js │ │ │ │ │ │ ├── hour.js │ │ │ │ │ │ ├── format-iso.js │ │ │ │ │ │ ├── day.js │ │ │ │ │ │ ├── format-utc.js │ │ │ │ │ │ ├── week.js │ │ │ │ │ │ └── scale-utc.js │ │ │ │ │ ├── package.js │ │ │ │ │ └── locale.js │ │ │ │ ├── test │ │ │ │ │ ├── data │ │ │ │ │ │ ├── sample.txt │ │ │ │ │ │ ├── sample.csv │ │ │ │ │ │ ├── sample.tsv │ │ │ │ │ │ ├── sample.json │ │ │ │ │ │ ├── sample.html │ │ │ │ │ │ └── sample.xml │ │ │ │ │ ├── env-fragment.js │ │ │ │ │ ├── core │ │ │ │ │ │ ├── version-test.js │ │ │ │ │ │ ├── mouse-test.html │ │ │ │ │ │ ├── transition-test-id.js │ │ │ │ │ │ ├── transform-null-test.html │ │ │ │ │ │ ├── transform-null-matrix-test.html │ │ │ │ │ │ ├── merge-test.js │ │ │ │ │ │ ├── functor-test.js │ │ │ │ │ │ ├── selection-enter-test.js │ │ │ │ │ │ ├── keys-test.js │ │ │ │ │ │ ├── random-test.js │ │ │ │ │ │ ├── transition-test-text.js │ │ │ │ │ │ ├── values-test.js │ │ │ │ │ │ ├── zip-test.js │ │ │ │ │ │ ├── transform-rotate-origin-test.html │ │ │ │ │ │ ├── selection-order-test.js │ │ │ │ │ │ ├── json-test.js │ │ │ │ │ │ ├── transition-test-call.js │ │ │ │ │ │ ├── html-test.js │ │ │ │ │ │ ├── transpose-test.js │ │ │ │ │ │ ├── selection-test.js │ │ │ │ │ │ ├── entries-test.js │ │ │ │ │ │ ├── selection-remove-test.js │ │ │ │ │ │ ├── transition-test-time.js │ │ │ │ │ │ ├── select-test.js │ │ │ │ │ │ ├── ascending-test.js │ │ │ │ │ │ ├── text-test.js │ │ │ │ │ │ ├── descending-test.js │ │ │ │ │ │ ├── touch-test.html │ │ │ │ │ │ ├── selection-node-test.js │ │ │ │ │ │ ├── selection-empty-test.js │ │ │ │ │ │ ├── xml-test.js │ │ │ │ │ │ ├── requote-test.js │ │ │ │ │ │ ├── mean-test.js │ │ │ │ │ │ ├── selectAll-test.js │ │ │ │ │ │ ├── median-test.js │ │ │ │ │ │ └── sum-test.js │ │ │ │ │ ├── env.js │ │ │ │ │ ├── time │ │ │ │ │ │ ├── dayOfYear-test.js │ │ │ │ │ │ └── time.js │ │ │ │ │ ├── geo │ │ │ │ │ │ ├── projection-test.js │ │ │ │ │ │ ├── circle-test.js │ │ │ │ │ │ └── equirectangular-test.js │ │ │ │ │ ├── layout │ │ │ │ │ │ ├── pie-test.js │ │ │ │ │ │ ├── hierarchy-test.js │ │ │ │ │ │ ├── tree-test.js │ │ │ │ │ │ ├── cluster-test.js │ │ │ │ │ │ └── partition-test.js │ │ │ │ │ └── env-xhr.js │ │ │ │ ├── .gitignore │ │ │ │ ├── .npmignore │ │ │ │ ├── index-browserify.js │ │ │ │ ├── lib │ │ │ │ │ ├── science │ │ │ │ │ │ ├── science.lin.min.js │ │ │ │ │ │ ├── science.lin.js │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── queue │ │ │ │ │ │ ├── queue.min.js │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── sizzle │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── jit │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── polymaps │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── protovis │ │ │ │ │ │ └── LICENSE │ │ │ │ │ └── penner │ │ │ │ │ │ └── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ ├── component.json │ │ │ │ └── LICENSE │ │ │ ├── underscore-amd │ │ │ │ ├── .gitignore │ │ │ │ ├── CNAME │ │ │ │ ├── .npmignore │ │ │ │ ├── index.js │ │ │ │ ├── favicon.ico │ │ │ │ ├── docs │ │ │ │ │ ├── favicon.ico │ │ │ │ │ └── images │ │ │ │ │ │ ├── background.png │ │ │ │ │ │ └── underscore.png │ │ │ │ ├── Rakefile │ │ │ │ ├── package.json │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ └── test │ │ │ │ │ └── index.html │ │ │ └── underscore.string │ │ │ │ ├── Gemfile │ │ │ │ ├── .travis.yml │ │ │ │ ├── Gemfile.lock │ │ │ │ ├── test │ │ │ │ ├── strings_standalone.js │ │ │ │ ├── test_standalone.html │ │ │ │ ├── run-qunit.js │ │ │ │ ├── test.html │ │ │ │ └── test_underscore │ │ │ │ │ └── index.html │ │ │ │ ├── Rakefile │ │ │ │ └── package.json │ │ └── d3ext.coffee │ ├── editor.ico │ └── styles │ │ └── cmx.css ├── robots.txt ├── favicon.ico ├── fonts │ ├── xkcd.eot │ ├── xkcd.ttf │ ├── xkcd.woff │ └── humor-sans.ttf ├── img │ ├── ce-badge.png │ ├── cmx-preview.png │ ├── cmx-teaser.png │ ├── github-16px.png │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── lib │ ├── cmx │ │ ├── bone.coffee │ │ ├── view.coffee │ │ ├── models │ │ │ ├── actor_model.coffee │ │ │ ├── label_model.coffee │ │ │ ├── bubble_model.coffee │ │ │ └── scene_model.coffee │ │ ├── entities │ │ │ ├── drawing.coffee │ │ │ └── label.coffee │ │ ├── controller.coffee │ │ └── gizmos │ │ │ ├── drawing_gizmo.coffee │ │ │ ├── label_gizmo.coffee │ │ │ └── bubble_gizmo.coffee │ └── cmx.coffee └── scripts │ ├── social-fadein.coffee │ └── 404.coffee ├── .bowerrc ├── .gitignore ├── component.json ├── .jshintrc ├── .editorconfig ├── package.json ├── test ├── runner │ └── mocha.js └── index.html └── license.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /app/edit/scripts/ace/mode-text.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/end.js: -------------------------------------------------------------------------------- 1 | })(); 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/start.js: -------------------------------------------------------------------------------- 1 | (function(){ -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/.gitignore: -------------------------------------------------------------------------------- 1 | raw -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "app/components" 3 | } 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/geo.js: -------------------------------------------------------------------------------- 1 | d3.geo = {}; 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/svg/svg.js: -------------------------------------------------------------------------------- 1 | d3.svg = {}; 2 | -------------------------------------------------------------------------------- /app/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org/ 2 | 3 | User-agent: * 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geom/geom.js: -------------------------------------------------------------------------------- 1 | d3.geom = {}; 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/layout/layout.js: -------------------------------------------------------------------------------- 1 | d3.layout = {}; 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.txt: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/CNAME: -------------------------------------------------------------------------------- 1 | underscorejs.org 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/behavior/behavior.js: -------------------------------------------------------------------------------- 1 | d3.behavior = {}; 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/noop.js: -------------------------------------------------------------------------------- 1 | function d3_noop() {} 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | node_modules 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/.npmignore: -------------------------------------------------------------------------------- 1 | test/ 2 | Rakefile 3 | docs/ -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/dsv/csv.js: -------------------------------------------------------------------------------- 1 | d3.csv = d3_dsv(",", "text/csv"); 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.csv: -------------------------------------------------------------------------------- 1 | Hello,World 2 | 42,"""fish""" 3 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.tsv: -------------------------------------------------------------------------------- 1 | Hello World 2 | 42 """fish""" 3 | -------------------------------------------------------------------------------- /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | temp 3 | dist 4 | .sass-cache 5 | app/components 6 | .tmp/ -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/.npmignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | test/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/index-browserify.js: -------------------------------------------------------------------------------- 1 | require("./d3"); 2 | module.exports = d3; -------------------------------------------------------------------------------- /app/fonts/xkcd.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/fonts/xkcd.eot -------------------------------------------------------------------------------- /app/fonts/xkcd.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/fonts/xkcd.ttf -------------------------------------------------------------------------------- /app/edit/editor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/edit/editor.ico -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/true.js: -------------------------------------------------------------------------------- 1 | function d3_true() { 2 | return true; 3 | } 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.json: -------------------------------------------------------------------------------- 1 | [{"Hello": 42, "World": "\"fish\""}] 2 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./underscore'); 2 | -------------------------------------------------------------------------------- /app/fonts/xkcd.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/fonts/xkcd.woff -------------------------------------------------------------------------------- /app/img/ce-badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/ce-badge.png -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/dsv/tsv.js: -------------------------------------------------------------------------------- 1 | d3.tsv = d3_dsv("\t", "text/tab-separated-values"); 2 | -------------------------------------------------------------------------------- /app/img/cmx-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/cmx-preview.png -------------------------------------------------------------------------------- /app/img/cmx-teaser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/cmx-teaser.png -------------------------------------------------------------------------------- /app/img/github-16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/github-16px.png -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/identity.js: -------------------------------------------------------------------------------- 1 | function d3_identity(d) { 2 | return d; 3 | } 4 | -------------------------------------------------------------------------------- /app/fonts/humor-sans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/fonts/humor-sans.ttf -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | gem 'uglifier' 4 | gem 'rake' -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/number.js: -------------------------------------------------------------------------------- 1 | function d3_number(x) { 2 | return x != null && !isNaN(x); 3 | } 4 | -------------------------------------------------------------------------------- /app/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /app/lib/cmx/bone.coffee: -------------------------------------------------------------------------------- 1 | define -> 2 | 3 | class Bone 4 | 5 | constructor: (@name, @x, @y, @type="") -> 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/compat/date.js: -------------------------------------------------------------------------------- 1 | if (!Date.now) Date.now = function() { 2 | return +new Date; 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/collapse.js: -------------------------------------------------------------------------------- 1 | function d3_collapse(s) { 2 | return s.trim().replace(/\s+/g, " "); 3 | } 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/sqrt.js: -------------------------------------------------------------------------------- 1 | d3.scale.sqrt = function() { 2 | return d3.scale.pow().exponent(.5); 3 | }; 4 | -------------------------------------------------------------------------------- /app/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transpose.js: -------------------------------------------------------------------------------- 1 | d3.transpose = function(matrix) { 2 | return d3.zip.apply(d3, matrix); 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-empty.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.empty = function() { 2 | return !this.node(); 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/merge.js: -------------------------------------------------------------------------------- 1 | d3.merge = function(arrays) { 2 | return Array.prototype.concat.apply([], arrays); 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello & world!

5 | 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/ascending.js: -------------------------------------------------------------------------------- 1 | d3.ascending = function(a, b) { 2 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/data/sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/descending.js: -------------------------------------------------------------------------------- 1 | d3.descending = function(a, b) { 2 | return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; 3 | }; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/edit/scripts/vendor/underscore-amd/favicon.ico -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/color.js: -------------------------------------------------------------------------------- 1 | function d3_Color() {} 2 | 3 | d3_Color.prototype.toString = function() { 4 | return this.rgb() + ""; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/keys.js: -------------------------------------------------------------------------------- 1 | d3.keys = function(map) { 2 | var keys = []; 3 | for (var key in map) keys.push(key); 4 | return keys; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/edit/scripts/vendor/underscore-amd/docs/favicon.ico -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/values.js: -------------------------------------------------------------------------------- 1 | d3.values = function(map) { 2 | var values = []; 3 | for (var key in map) values.push(map[key]); 4 | return values; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/round.js: -------------------------------------------------------------------------------- 1 | d3.round = function(x, n) { 2 | return n 3 | ? Math.round(x * (n = Math.pow(10, n))) / n 4 | : Math.round(x); 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/docs/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/edit/scripts/vendor/underscore-amd/docs/images/background.png -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/docs/images/underscore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darwin/cmx.js/master/app/edit/scripts/vendor/underscore-amd/docs/images/underscore.png -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/functor.js: -------------------------------------------------------------------------------- 1 | function d3_functor(v) { 2 | return typeof v === "function" ? v : function() { return v; }; 3 | } 4 | 5 | d3.functor = d3_functor; 6 | -------------------------------------------------------------------------------- /app/scripts/social-fadein.coffee: -------------------------------------------------------------------------------- 1 | $ -> 2 | fn = -> 3 | $(".bs-docs-social-buttons").css("opacity", 0).css("display", "block").animate opacity: 1 4 | 5 | setTimeout fn, 2000 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/requote.js: -------------------------------------------------------------------------------- 1 | d3.requote = function(s) { 2 | return s.replace(d3_requote_re, "\\$&"); 3 | }; 4 | 5 | var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/entries.js: -------------------------------------------------------------------------------- 1 | d3.entries = function(map) { 2 | var entries = []; 3 | for (var key in map) entries.push({key: key, value: map[key]}); 4 | return entries; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/format-locale.js: -------------------------------------------------------------------------------- 1 | var d3_format_decimalPoint = {decimal_point}, 2 | d3_format_thousandsSeparator = {thousands_sep}, 3 | d3_format_grouping = {grouping}; 4 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 1.9.3 4 | 5 | before_script: 6 | - "export DISPLAY=:99.0" 7 | - "sh -e /etc/init.d/xvfb start" 8 | - sleep 2 -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/component.js: -------------------------------------------------------------------------------- 1 | require("./core/core"); 2 | 3 | require("util").puts(JSON.stringify({ 4 | "name": "d3", 5 | "version": d3.version, 6 | "main": "./d3.js" 7 | }, null, 2)); 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/xml.js: -------------------------------------------------------------------------------- 1 | d3.xml = function() { 2 | return d3.xhr.apply(d3, arguments).response(d3_xml); 3 | }; 4 | 5 | function d3_xml(request) { 6 | return request.responseXML; 7 | } 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-call.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.call = function(callback) { 2 | var args = d3_array(arguments); 3 | callback.apply(args[0] = this, args); 4 | return this; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/text.js: -------------------------------------------------------------------------------- 1 | d3.text = function() { 2 | return d3.xhr.apply(d3, arguments).response(d3_text); 3 | }; 4 | 5 | function d3_text(request) { 6 | return request.responseText; 7 | } 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-datum.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.datum = function(value) { 2 | return arguments.length 3 | ? this.property("__data__", value) 4 | : this.property("__data__"); 5 | }; 6 | -------------------------------------------------------------------------------- /app/lib/cmx/view.coffee: -------------------------------------------------------------------------------- 1 | define -> 2 | 3 | class View 4 | 5 | constructor: (@scene) -> 6 | @subviews = [] 7 | 8 | add: (view) -> 9 | view.parentView = @ 10 | @subviews.push view 11 | view 12 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test2", 3 | "version": "0.0.0", 4 | "dependencies": { 5 | "requirejs": "~2.1.4", 6 | "modernizr": "~2.6.2", 7 | "jquery": "~1.9.1" 8 | }, 9 | "devDependencies": {} 10 | } 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/permute.js: -------------------------------------------------------------------------------- 1 | d3.permute = function(array, indexes) { 2 | var permutes = [], 3 | i = -1, 4 | n = indexes.length; 5 | while (++i < n) permutes[i] = array[indexes[i]]; 6 | return permutes; 7 | }; 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/json.js: -------------------------------------------------------------------------------- 1 | d3.json = function(url, callback) { 2 | return d3.xhr(url, "application/json", callback).response(d3_json); 3 | }; 4 | 5 | function d3_json(request) { 6 | return JSON.parse(request.responseText); 7 | } 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/shuffle.js: -------------------------------------------------------------------------------- 1 | d3.shuffle = function(array) { 2 | var m = array.length, t, i; 3 | while (m) { 4 | i = Math.random() * m-- | 0; 5 | t = array[m], array[m] = array[i], array[i] = t; 6 | } 7 | return array; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/science/science.lin.min.js: -------------------------------------------------------------------------------- 1 | (function(){science.lin={},science.lin.tridag=function(a,b,c,d,e,f){var g,h;for(g=1;g=0;g--)e[g]=(d[g]-c[g]*e[g+1])/b[g]}})() -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/median.js: -------------------------------------------------------------------------------- 1 | d3.median = function(array, f) { 2 | if (arguments.length > 1) array = array.map(f); 3 | array = array.filter(d3_number); 4 | return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; 5 | }; 6 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-remove.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.remove = function() { 2 | return this.each("end.transition", function() { 3 | var p; 4 | if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); 5 | }); 6 | }; 7 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/env-fragment.js: -------------------------------------------------------------------------------- 1 | var jsdom = require("jsdom"); 2 | 3 | document.createRange = function() { 4 | return { 5 | selectNode: function() {}, 6 | createContextualFragment: function(html) { return jsdom.jsdom(html); } 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/xyz.js: -------------------------------------------------------------------------------- 1 | function d3_xyz_lab(x) { 2 | return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; 3 | } 4 | 5 | function d3_xyz_rgb(r) { 6 | return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055)); 7 | } 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/gnomonic.js: -------------------------------------------------------------------------------- 1 | var d3_geo_gnomonic = d3_geo_azimuthal( 2 | function(cosλcosφ) { return 1 / cosλcosφ; }, 3 | Math.atan 4 | ); 5 | 6 | (d3.geo.gnomonic = function() { 7 | return d3_geo_projection(d3_geo_gnomonic); 8 | }).raw = d3_geo_gnomonic; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/orthographic.js: -------------------------------------------------------------------------------- 1 | var d3_geo_orthographic = d3_geo_azimuthal( 2 | function() { return 1; }, 3 | Math.asin 4 | ); 5 | 6 | (d3.geo.orthographic = function() { 7 | return d3_geo_projection(d3_geo_orthographic); 8 | }).raw = d3_geo_orthographic; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/bilinear.js: -------------------------------------------------------------------------------- 1 | function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { 2 | var u = uninterpolate(domain[0], domain[1]), 3 | i = interpolate(range[0], range[1]); 4 | return function(x) { 5 | return i(u(x)); 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/Rakefile: -------------------------------------------------------------------------------- 1 | desc "Use Uglify JS to compress Underscore.js" 2 | task :build do 3 | sh "uglifyjs underscore.js -c -m -o underscore-min.js" 4 | end 5 | 6 | desc "Build the docco documentation" 7 | task :doc do 8 | sh "docco underscore.js" 9 | end 10 | 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/equirectangular.js: -------------------------------------------------------------------------------- 1 | function d3_geo_equirectangular(λ, φ) { 2 | return [λ, φ]; 3 | } 4 | 5 | (d3.geo.equirectangular = function() { 6 | return d3_geo_projection(d3_geo_equirectangular).scale(250 / π); 7 | }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; 8 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/quantile.js: -------------------------------------------------------------------------------- 1 | // R-7 per 2 | d3.quantile = function(values, p) { 3 | var H = (values.length - 1) * p + 1, 4 | h = Math.floor(H), 5 | v = +values[h - 1], 6 | e = H - h; 7 | return e ? v + e * (values[h] - v) : v; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-text.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.text = function(value) { 2 | return d3_transition_tween(this, "text", value, d3_transition_text); 3 | }; 4 | 5 | function d3_transition_text(b) { 6 | if (b == null) b = ""; 7 | return function() { this.textContent = b; }; 8 | } 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/core.js: -------------------------------------------------------------------------------- 1 | d3 = {version: "3.0.4"}; // semver 2 | 3 | var π = Math.PI, 4 | ε = 1e-6, 5 | d3_radians = π / 180, 6 | d3_degrees = 180 / π; 7 | 8 | function d3_target(d) { 9 | return d.target; 10 | } 11 | 12 | function d3_source(d) { 13 | return d.source; 14 | } 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-remove.js: -------------------------------------------------------------------------------- 1 | // TODO remove(selector)? 2 | // TODO remove(node)? 3 | // TODO remove(function)? 4 | d3_selectionPrototype.remove = function() { 5 | return this.each(function() { 6 | var parent = this.parentNode; 7 | if (parent) parent.removeChild(this); 8 | }); 9 | }; 10 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-node.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.node = function() { 2 | for (var j = 0, m = this.length; j < m; j++) { 3 | for (var group = this[j], i = 0, n = group.length; i < n; i++) { 4 | var node = group[i]; 5 | if (node) return node; 6 | } 7 | } 8 | return null; 9 | }; 10 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/stereographic.js: -------------------------------------------------------------------------------- 1 | var d3_geo_stereographic = d3_geo_azimuthal( 2 | function(cosλcosφ) { return 1 / (1 + cosλcosφ); }, 3 | function(ρ) { return 2 * Math.atan(ρ); } 4 | ); 5 | 6 | (d3.geo.stereographic = function() { 7 | return d3_geo_projection(d3_geo_stereographic); 8 | }).raw = d3_geo_stereographic; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/html.js: -------------------------------------------------------------------------------- 1 | d3.html = function(url, callback) { 2 | return d3.xhr(url, "text/html", callback).response(d3_html); 3 | }; 4 | 5 | function d3_html(request) { 6 | var range = document.createRange(); 7 | range.selectNode(document.body); 8 | return range.createContextualFragment(request.responseText); 9 | } 10 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/compose.js: -------------------------------------------------------------------------------- 1 | function d3_geo_compose(a, b) { 2 | 3 | function compose(x, y) { 4 | return x = a(x, y), b(x[0], x[1]); 5 | } 6 | 7 | if (a.invert && b.invert) compose.invert = function(x, y) { 8 | return x = b.invert(x, y), x && a.invert(x[0], x[1]); 9 | }; 10 | 11 | return compose; 12 | } 13 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/spherical.js: -------------------------------------------------------------------------------- 1 | function d3_geo_spherical(cartesian) { 2 | return [ 3 | Math.atan2(cartesian[1], cartesian[0]), 4 | Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) 5 | ]; 6 | } 7 | 8 | function d3_geo_sphericalEqual(a, b) { 9 | return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε; 10 | } 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/class.js: -------------------------------------------------------------------------------- 1 | function d3_class(ctor, properties) { 2 | try { 3 | for (var key in properties) { 4 | Object.defineProperty(ctor.prototype, key, { 5 | value: properties[key], 6 | enumerable: false 7 | }); 8 | } 9 | } catch (e) { 10 | ctor.prototype = properties; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/touches.js: -------------------------------------------------------------------------------- 1 | d3.touches = function(container, touches) { 2 | if (arguments.length < 2) touches = d3_eventSource().touches; 3 | return touches ? d3_array(touches).map(function(touch) { 4 | var point = d3_mousePoint(container, touch); 5 | point.identifier = touch.identifier; 6 | return point; 7 | }) : []; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/uninterpolate.js: -------------------------------------------------------------------------------- 1 | function d3_uninterpolateNumber(a, b) { 2 | b = b - (a = +a) ? 1 / (b - a) : 0; 3 | return function(x) { return (x - a) * b; }; 4 | } 5 | 6 | function d3_uninterpolateClamp(a, b) { 7 | b = b - (a = +a) ? 1 / (b - a) : 0; 8 | return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; 9 | } 10 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/scale.js: -------------------------------------------------------------------------------- 1 | d3.scale = {}; 2 | 3 | function d3_scaleExtent(domain) { 4 | var start = domain[0], stop = domain[domain.length - 1]; 5 | return start < stop ? [start, stop] : [stop, start]; 6 | } 7 | 8 | function d3_scaleRange(scale) { 9 | return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); 10 | } 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-ease.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.ease = function(value) { 2 | var id = this.id; 3 | if (arguments.length < 1) return this.node().__transition__[id].ease; 4 | if (typeof value !== "function") value = d3.ease.apply(d3, arguments); 5 | return d3_selection_each(this, function(node) { node.__transition__[id].ease = value; }); 6 | }; 7 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/azimuthal-equal-area.js: -------------------------------------------------------------------------------- 1 | var d3_geo_azimuthalEqualArea = d3_geo_azimuthal( 2 | function(cosλcosφ) { return Math.sqrt(2 / (1 + cosλcosφ)); }, 3 | function(ρ) { return 2 * Math.asin(ρ / 2); } 4 | ); 5 | 6 | (d3.geo.azimuthalEqualArea = function() { 7 | return d3_geo_projection(d3_geo_azimuthalEqualArea); 8 | }).raw = d3_geo_azimuthalEqualArea; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/azimuthal-equidistant.js: -------------------------------------------------------------------------------- 1 | var d3_geo_azimuthalEquidistant = d3_geo_azimuthal( 2 | function(cosλcosφ) { var c = Math.acos(cosλcosφ); return c && c / Math.sin(c); }, 3 | d3_identity 4 | ); 5 | 6 | (d3.geo.azimuthalEquidistant = function() { 7 | return d3_geo_projection(d3_geo_azimuthalEquidistant); 8 | }).raw = d3_geo_azimuthalEquidistant; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/sum.js: -------------------------------------------------------------------------------- 1 | d3.sum = function(array, f) { 2 | var s = 0, 3 | n = array.length, 4 | a, 5 | i = -1; 6 | 7 | if (arguments.length === 1) { 8 | while (++i < n) if (!isNaN(a = +array[i])) s += a; 9 | } else { 10 | while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; 11 | } 12 | 13 | return s; 14 | }; 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-delay.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.delay = function(value) { 2 | var id = this.id; 3 | return d3_selection_each(this, typeof value === "function" 4 | ? function(node, i, j) { node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0; } 5 | : (value |= 0, function(node) { node.__transition__[id].delay = value; })); 6 | }; 7 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | execjs (1.4.0) 5 | multi_json (~> 1.0) 6 | multi_json (1.3.6) 7 | rake (0.9.2.2) 8 | uglifier (1.3.0) 9 | execjs (>= 0.3.0) 10 | multi_json (~> 1.0, >= 1.0.2) 11 | 12 | PLATFORMS 13 | ruby 14 | 15 | DEPENDENCIES 16 | rake 17 | uglifier 18 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/test/strings_standalone.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | module("String extensions"); 4 | 5 | test("underscore not included", function() { 6 | raises(function() { _("foo") }, /TypeError/); 7 | }); 8 | 9 | test("provides standalone functions", function() { 10 | equals(typeof _.str.trim, "function"); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/month.js: -------------------------------------------------------------------------------- 1 | d3.time.month = d3_time_interval(function(date) { 2 | date = d3.time.day(date); 3 | date.setDate(1); 4 | return date; 5 | }, function(date, offset) { 6 | date.setMonth(date.getMonth() + offset); 7 | }, function(date) { 8 | return date.getMonth(); 9 | }); 10 | 11 | d3.time.months = d3.time.month.range; 12 | d3.time.months.utc = d3.time.month.utc.range; 13 | -------------------------------------------------------------------------------- /app/edit/scripts/d3ext.coffee: -------------------------------------------------------------------------------- 1 | define -> 2 | 3 | -> 4 | d3.selection.prototype.parents = (selector) -> 5 | res = [] 6 | p = this.node() 7 | while p = p.parentNode 8 | try 9 | klass = d3.select(p).attr("class") 10 | catch e 11 | 12 | continue unless klass 13 | items = klass.split(" ") 14 | res.push p if selector in items 15 | 16 | res 17 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/year.js: -------------------------------------------------------------------------------- 1 | d3.time.year = d3_time_interval(function(date) { 2 | date = d3.time.day(date); 3 | date.setMonth(0, 1); 4 | return date; 5 | }, function(date, offset) { 6 | date.setFullYear(date.getFullYear() + offset); 7 | }, function(date) { 8 | return date.getFullYear(); 9 | }); 10 | 11 | d3.time.years = d3.time.year.range; 12 | d3.time.years.utc = d3.time.year.utc.range; 13 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/zip.js: -------------------------------------------------------------------------------- 1 | d3.zip = function() { 2 | if (!(n = arguments.length)) return []; 3 | for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { 4 | for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { 5 | zip[j] = arguments[j][i]; 6 | } 7 | } 8 | return zips; 9 | }; 10 | 11 | function d3_zipLength(d) { 12 | return d.length; 13 | } 14 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/compat/style.js: -------------------------------------------------------------------------------- 1 | try { 2 | document.createElement("div").style.setProperty("opacity", 0, ""); 3 | } catch (error) { 4 | var d3_style_prototype = CSSStyleDeclaration.prototype, 5 | d3_style_setProperty = d3_style_prototype.setProperty; 6 | d3_style_prototype.setProperty = function(name, value, priority) { 7 | d3_style_setProperty.call(this, name, value + "", priority); 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/mean.js: -------------------------------------------------------------------------------- 1 | d3.mean = function(array, f) { 2 | var n = array.length, 3 | a, 4 | m = 0, 5 | i = -1, 6 | j = 0; 7 | if (arguments.length === 1) { 8 | while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; 9 | } else { 10 | while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; 11 | } 12 | return j ? m : undefined; 13 | }; 14 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-html.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.html = function(value) { 2 | return arguments.length 3 | ? this.each(typeof value === "function" 4 | ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null 5 | ? function() { this.innerHTML = ""; } 6 | : function() { this.innerHTML = value; }) 7 | : this.node().innerHTML; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-duration.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.duration = function(value) { 2 | var id = this.id; 3 | return d3_selection_each(this, typeof value === "function" 4 | ? function(node, i, j) { node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0); } 5 | : (value = Math.max(1, value | 0), function(node) { node.__transition__[id].duration = value; })); 6 | }; 7 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-text.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.text = function(value) { 2 | return arguments.length 3 | ? this.each(typeof value === "function" 4 | ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null 5 | ? function() { this.textContent = ""; } 6 | : function() { this.textContent = value; }) 7 | : this.node().textContent; 8 | }; 9 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/format-locale.js: -------------------------------------------------------------------------------- 1 | // The date and time format (%c), date format (%x) and time format (%X). 2 | var d3_time_formatDateTime = {d_t_fmt}, 3 | d3_time_formatDate = {d_fmt}, 4 | d3_time_formatTime = {t_fmt}; 5 | 6 | // The weekday and month names. 7 | var d3_time_days = {day}, 8 | d3_time_dayAbbreviations = {abday}, 9 | d3_time_months = {mon}, 10 | d3_time_monthAbbreviations = {abmon}; 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/minute.js: -------------------------------------------------------------------------------- 1 | d3.time.minute = d3_time_interval(function(date) { 2 | return new d3_time(Math.floor(date / 6e4) * 6e4); 3 | }, function(date, offset) { 4 | date.setTime(date.getTime() + Math.floor(offset) * 6e4); // DST breaks setMinutes 5 | }, function(date) { 6 | return date.getMinutes(); 7 | }); 8 | 9 | d3.time.minutes = d3.time.minute.range; 10 | d3.time.minutes.utc = d3.time.minute.utc.range; 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/second.js: -------------------------------------------------------------------------------- 1 | d3.time.second = d3_time_interval(function(date) { 2 | return new d3_time(Math.floor(date / 1e3) * 1e3); 3 | }, function(date, offset) { 4 | date.setTime(date.getTime() + Math.floor(offset) * 1e3); // DST breaks setSeconds 5 | }, function(date) { 6 | return date.getSeconds(); 7 | }); 8 | 9 | d3.time.seconds = d3.time.second.range; 10 | d3.time.seconds.utc = d3.time.second.utc.range; 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/svg/area-radial.js: -------------------------------------------------------------------------------- 1 | d3.svg.area.radial = function() { 2 | var area = d3_svg_area(d3_svg_lineRadial); 3 | area.radius = area.x, delete area.x; 4 | area.innerRadius = area.x0, delete area.x0; 5 | area.outerRadius = area.x1, delete area.x1; 6 | area.angle = area.y, delete area.y; 7 | area.startAngle = area.y0, delete area.y0; 8 | area.endAngle = area.y1, delete area.y1; 9 | return area; 10 | }; 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-order.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.order = function() { 2 | for (var j = -1, m = this.length; ++j < m;) { 3 | for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { 4 | if (node = group[i]) { 5 | if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); 6 | next = node; 7 | } 8 | } 9 | } 10 | return this; 11 | }; 12 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/version-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.version"); 7 | 8 | suite.addBatch({ 9 | "semantic versioning": { 10 | topic: d3.version, 11 | "has the form major.minor.patch": function(version) { 12 | assert.match(version, /^[0-9]+\.[0-9]+\.[0-9]+/); 13 | } 14 | } 15 | }); 16 | 17 | suite.export(module); 18 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/mercator.js: -------------------------------------------------------------------------------- 1 | function d3_geo_mercator(λ, φ) { 2 | return [ 3 | λ / (2 * π), 4 | Math.max(-.5, Math.min(+.5, Math.log(Math.tan(π / 4 + φ / 2)) / (2 * π))) 5 | ]; 6 | } 7 | 8 | d3_geo_mercator.invert = function(x, y) { 9 | return [ 10 | 2 * π * x, 11 | 2 * Math.atan(Math.exp(2 * π * y)) - π / 2 12 | ]; 13 | }; 14 | 15 | (d3.geo.mercator = function() { 16 | return d3_geo_projection(d3_geo_mercator).scale(500); 17 | }).raw = d3_geo_mercator; 18 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/hour.js: -------------------------------------------------------------------------------- 1 | d3.time.hour = d3_time_interval(function(date) { 2 | var timezone = date.getTimezoneOffset() / 60; 3 | return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); 4 | }, function(date, offset) { 5 | date.setTime(date.getTime() + Math.floor(offset) * 36e5); // DST breaks setHours 6 | }, function(date) { 7 | return date.getHours(); 8 | }); 9 | 10 | d3.time.hours = d3.time.hour.range; 11 | d3.time.hours.utc = d3.time.hour.utc.range; 12 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "es5": true, 5 | "esnext": true, 6 | "bitwise": true, 7 | "camelcase": true, 8 | "curly": true, 9 | "eqeqeq": true, 10 | "immed": true, 11 | "indent": 4, 12 | "latedef": true, 13 | "newcap": true, 14 | "noarg": true, 15 | "quotmark": "single", 16 | "regexp": true, 17 | "undef": true, 18 | "unused": true, 19 | "strict": true, 20 | "trailing": true, 21 | "smarttabs": true 22 | } 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-sort.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.sort = function(comparator) { 2 | comparator = d3_selection_sortComparator.apply(this, arguments); 3 | for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); 4 | return this.order(); 5 | }; 6 | 7 | function d3_selection_sortComparator(comparator) { 8 | if (!arguments.length) comparator = d3.ascending; 9 | return function(a, b) { 10 | return comparator(a && a.__data__, b && b.__data__); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-append.js: -------------------------------------------------------------------------------- 1 | // TODO append(node)? 2 | // TODO append(function)? 3 | d3_selectionPrototype.append = function(name) { 4 | name = d3.ns.qualify(name); 5 | 6 | function append() { 7 | return this.appendChild(document.createElementNS(this.namespaceURI, name)); 8 | } 9 | 10 | function appendNS() { 11 | return this.appendChild(document.createElementNS(name.space, name.local)); 12 | } 13 | 14 | return this.select(name.local ? appendNS : append); 15 | }; 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 4 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-each.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.each = function(callback) { 2 | return d3_selection_each(this, function(node, i, j) { 3 | callback.call(node, node.__data__, i, j); 4 | }); 5 | }; 6 | 7 | function d3_selection_each(groups, callback) { 8 | for (var j = 0, m = groups.length; j < m; j++) { 9 | for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { 10 | if (node = group[i]) callback(node, i, j); 11 | } 12 | } 13 | return groups; 14 | } 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/format-iso.js: -------------------------------------------------------------------------------- 1 | var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); 2 | 3 | d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; 4 | 5 | function d3_time_formatIsoNative(date) { 6 | return date.toISOString(); 7 | } 8 | 9 | d3_time_formatIsoNative.parse = function(string) { 10 | var date = new Date(string); 11 | return isNaN(date) ? null : date; 12 | }; 13 | 14 | d3_time_formatIsoNative.toString = d3_time_formatIso.toString; 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/env.js: -------------------------------------------------------------------------------- 1 | document = require("jsdom").jsdom(""); 2 | window = document.createWindow(); 3 | navigator = window.navigator; 4 | CSSStyleDeclaration = window.CSSStyleDeclaration; 5 | 6 | require("../lib/sizzle/sizzle"); 7 | Sizzle = window.Sizzle; 8 | getComputedStyle = window.getComputedStyle; 9 | 10 | process.env.TZ = "America/Los_Angeles"; 11 | 12 | require("./env-assert"); 13 | require("./env-xhr"); 14 | require("./env-fragment"); 15 | 16 | require("../d3"); 17 | -------------------------------------------------------------------------------- /app/scripts/404.coffee: -------------------------------------------------------------------------------- 1 | # discuss comments may reference comments with disqus url 2 | # redirect /gist/123456 -> /#123456 3 | m = location.pathname.match /^\/gist\/([^#?\/]+)/ 4 | if m 5 | window.location = "/##{m[1]}" 6 | return 7 | 8 | # GA links may reference error pages 9 | # redirect /error/123456 -> /#123456 10 | m = location.pathname.match /^\/error\/([^#?\/]+)/ 11 | if m 12 | window.location = "/##{m[1]}" 13 | return 14 | 15 | # no redirect, display 404 content 16 | document.getElementById("body").style.display = "block" -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/nice.js: -------------------------------------------------------------------------------- 1 | function d3_scale_nice(domain, nice) { 2 | var i0 = 0, 3 | i1 = domain.length - 1, 4 | x0 = domain[i0], 5 | x1 = domain[i1], 6 | dx; 7 | 8 | if (x1 < x0) { 9 | dx = i0, i0 = i1, i1 = dx; 10 | dx = x0, x0 = x1, x1 = dx; 11 | } 12 | 13 | if (nice = nice(x1 - x0)) { 14 | domain[i0] = nice.floor(x0); 15 | domain[i1] = nice.ceil(x1); 16 | } 17 | 18 | return domain; 19 | } 20 | 21 | function d3_scale_niceDefault() { 22 | return Math; 23 | } 24 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "underscore", 3 | "description" : "JavaScript's functional programming helper library.", 4 | "homepage" : "http://underscorejs.org", 5 | "keywords" : ["util", "functional", "server", "client", "browser"], 6 | "author" : "Jeremy Ashkenas ", 7 | "repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"}, 8 | "main" : "underscore.js", 9 | "version" : "1.4.3" 10 | } 11 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/max.js: -------------------------------------------------------------------------------- 1 | d3.max = function(array, f) { 2 | var i = -1, 3 | n = array.length, 4 | a, 5 | b; 6 | if (arguments.length === 1) { 7 | while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; 8 | while (++i < n) if ((b = array[i]) != null && b > a) a = b; 9 | } else { 10 | while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; 11 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; 12 | } 13 | return a; 14 | }; 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/min.js: -------------------------------------------------------------------------------- 1 | d3.min = function(array, f) { 2 | var i = -1, 3 | n = array.length, 4 | a, 5 | b; 6 | if (arguments.length === 1) { 7 | while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; 8 | while (++i < n) if ((b = array[i]) != null && a > b) a = b; 9 | } else { 10 | while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; 11 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; 12 | } 13 | return a; 14 | }; 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/mouse-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | HTML Mouse Test 4 | 5 | 6 | 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/queue/queue.min.js: -------------------------------------------------------------------------------- 1 | (function(){function a(a){function l(){if(g&&d 0); 12 | assert.equal(~~id, id); 13 | }, 14 | "increases monotonically across transitions": function(transition) { 15 | var t0 = d3.select("body").append("div").transition(), 16 | t1 = d3.select("body").append("div").transition(); 17 | assert.isTrue(t1.id > t0.id); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-root.js: -------------------------------------------------------------------------------- 1 | var d3_selectionRoot = d3_selection([[document]]); 2 | 3 | d3_selectionRoot[0].parentNode = d3_selectRoot; 4 | 5 | // TODO fast singleton implementation! 6 | // TODO select(function) 7 | d3.select = function(selector) { 8 | return typeof selector === "string" 9 | ? d3_selectionRoot.select(selector) 10 | : d3_selection([[selector]]); // assume node 11 | }; 12 | 13 | // TODO selectAll(function) 14 | d3.selectAll = function(selector) { 15 | return typeof selector === "string" 16 | ? d3_selectionRoot.selectAll(selector) 17 | : d3_selection([d3_array(selector)]); // assume node[] 18 | }; 19 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-filter.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.filter = function(filter) { 2 | var subgroups = [], 3 | subgroup, 4 | group, 5 | node; 6 | 7 | if (typeof filter !== "function") filter = d3_selection_filter(filter); 8 | 9 | for (var j = 0, m = this.length; j < m; j++) { 10 | subgroups.push(subgroup = []); 11 | for (var group = this[j], i = 0, n = group.length; i < n; i++) { 12 | if ((node = group[i]) && filter.call(node, node.__data__, i)) { 13 | subgroup.push(node); 14 | } 15 | } 16 | } 17 | 18 | return d3_transition(subgroups, this.id, this.time).ease(this.ease()); 19 | }; 20 | -------------------------------------------------------------------------------- /app/lib/cmx/models/actor_model.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/model', 'cmx/entities/actor'], (Model, Actor) -> 2 | 3 | class ActorModel extends Model 4 | 5 | constructor: -> 6 | @defaults = 7 | "t": "" 8 | "pose": "0,0|0,106|0,90|0,80|0,70|0,50|-10,30|-10,0|10,30|10,0|-10,70|-10,50|10,70|10,50" 9 | 10 | super 11 | 12 | materialize: (parent) -> 13 | o = new Actor parent.scene 14 | o.setFrame @props["t"] 15 | o.setPose @unserializePose(@props["pose"]) 16 | parent.add o 17 | 18 | super o 19 | 20 | read: -> 21 | @props["t"] = @view.getFrame() 22 | @props["pose"] = @serializePose(@view.getPose()) 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-insert.js: -------------------------------------------------------------------------------- 1 | // TODO insert(node, function)? 2 | // TODO insert(function, string)? 3 | // TODO insert(function, function)? 4 | d3_selectionPrototype.insert = function(name, before) { 5 | name = d3.ns.qualify(name); 6 | 7 | function insert() { 8 | return this.insertBefore( 9 | document.createElementNS(this.namespaceURI, name), 10 | d3_select(before, this)); 11 | } 12 | 13 | function insertNS() { 14 | return this.insertBefore( 15 | document.createElementNS(name.space, name.local), 16 | d3_select(before, this)); 17 | } 18 | 19 | return this.select(name.local ? insertNS : insert); 20 | }; 21 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-transition.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.transition = function() { 2 | var id = d3_transitionInheritId || ++d3_transitionId, 3 | subgroups = [], 4 | subgroup, 5 | node, 6 | transition = Object.create(d3_transitionInherit); 7 | 8 | transition.time = Date.now(); 9 | 10 | for (var j = -1, m = this.length; ++j < m;) { 11 | subgroups.push(subgroup = []); 12 | for (var group = this[j], i = -1, n = group.length; ++i < n;) { 13 | if (node = group[i]) d3_transitionNode(node, i, id, transition); 14 | subgroup.push(node); 15 | } 16 | } 17 | 18 | return d3_transition(subgroups, id); 19 | }; 20 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/polylinear.js: -------------------------------------------------------------------------------- 1 | function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { 2 | var u = [], 3 | i = [], 4 | j = 0, 5 | k = Math.min(domain.length, range.length) - 1; 6 | 7 | // Handle descending domains. 8 | if (domain[k] < domain[0]) { 9 | domain = domain.slice().reverse(); 10 | range = range.slice().reverse(); 11 | } 12 | 13 | while (++j <= k) { 14 | u.push(uninterpolate(domain[j - 1], domain[j])); 15 | i.push(interpolate(range[j - 1], range[j])); 16 | } 17 | 18 | return function(x) { 19 | var j = d3.bisect(domain, x, 1, k) - 1; 20 | return i[j](u[j](x)); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/threshold.js: -------------------------------------------------------------------------------- 1 | d3.scale.threshold = function() { 2 | return d3_scale_threshold([.5], [0, 1]); 3 | }; 4 | 5 | function d3_scale_threshold(domain, range) { 6 | 7 | function scale(x) { 8 | return range[d3.bisect(domain, x)]; 9 | } 10 | 11 | scale.domain = function(_) { 12 | if (!arguments.length) return domain; 13 | domain = _; 14 | return scale; 15 | }; 16 | 17 | scale.range = function(_) { 18 | if (!arguments.length) return range; 19 | range = _; 20 | return scale; 21 | }; 22 | 23 | scale.copy = function() { 24 | return d3_scale_threshold(domain, range); 25 | }; 26 | 27 | return scale; 28 | }; 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/format-utc.js: -------------------------------------------------------------------------------- 1 | d3.time.format.utc = function(template) { 2 | var local = d3.time.format(template); 3 | 4 | function format(date) { 5 | try { 6 | d3_time = d3_time_utc; 7 | var utc = new d3_time(); 8 | utc._ = date; 9 | return local(utc); 10 | } finally { 11 | d3_time = Date; 12 | } 13 | } 14 | 15 | format.parse = function(string) { 16 | try { 17 | d3_time = d3_time_utc; 18 | var date = local.parse(string); 19 | return date && date._; 20 | } finally { 21 | d3_time = Date; 22 | } 23 | }; 24 | 25 | format.toString = local.toString; 26 | 27 | return format; 28 | }; 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/extent.js: -------------------------------------------------------------------------------- 1 | d3.extent = function(array, f) { 2 | var i = -1, 3 | n = array.length, 4 | a, 5 | b, 6 | c; 7 | if (arguments.length === 1) { 8 | while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; 9 | while (++i < n) if ((b = array[i]) != null) { 10 | if (a > b) a = b; 11 | if (c < b) c = b; 12 | } 13 | } else { 14 | while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; 15 | while (++i < n) if ((b = f.call(array, array[i], i)) != null) { 16 | if (a > b) a = b; 17 | if (c < b) c = b; 18 | } 19 | } 20 | return [a, c]; 21 | }; 22 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/ns.js: -------------------------------------------------------------------------------- 1 | var d3_nsPrefix = { 2 | svg: "http://www.w3.org/2000/svg", 3 | xhtml: "http://www.w3.org/1999/xhtml", 4 | xlink: "http://www.w3.org/1999/xlink", 5 | xml: "http://www.w3.org/XML/1998/namespace", 6 | xmlns: "http://www.w3.org/2000/xmlns/" 7 | }; 8 | 9 | d3.ns = { 10 | prefix: d3_nsPrefix, 11 | qualify: function(name) { 12 | var i = name.indexOf(":"), 13 | prefix = name; 14 | if (i >= 0) { 15 | prefix = name.substring(0, i); 16 | name = name.substring(i + 1); 17 | } 18 | return d3_nsPrefix.hasOwnProperty(prefix) 19 | ? {space: d3_nsPrefix[prefix], local: name} 20 | : name; 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/azimuthal.js: -------------------------------------------------------------------------------- 1 | // Abstract azimuthal projection. 2 | function d3_geo_azimuthal(scale, angle) { 3 | function azimuthal(λ, φ) { 4 | var cosλ = Math.cos(λ), 5 | cosφ = Math.cos(φ), 6 | k = scale(cosλ * cosφ); 7 | return [ 8 | k * cosφ * Math.sin(λ), 9 | k * Math.sin(φ) 10 | ]; 11 | } 12 | 13 | azimuthal.invert = function(x, y) { 14 | var ρ = Math.sqrt(x * x + y * y), 15 | c = angle(ρ), 16 | sinc = Math.sin(c), 17 | cosc = Math.cos(c); 18 | return [ 19 | Math.atan2(x * sinc, ρ * cosc), 20 | Math.asin(ρ && y * sinc / ρ) 21 | ]; 22 | }; 23 | 24 | return azimuthal; 25 | } 26 | -------------------------------------------------------------------------------- /app/lib/cmx/models/label_model.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/model', 'cmx/entities/label'], (Model, Label) -> 2 | 3 | class LabelModel extends Model 4 | 5 | constructor: -> 6 | @defaults = 7 | "t": "" 8 | "pose": "0,-10|0,0" 9 | "content": 'hello world' 10 | super 11 | 12 | materialize: (parent) -> 13 | o = new Label parent.scene 14 | o.setFrame @props["t"] 15 | o.setPose @unserializePose(@props["pose"]) 16 | o.setContent @props.content 17 | parent.add o 18 | 19 | super o 20 | 21 | read: -> 22 | @props["pose"] = @serializePose(@view.getPose()) 23 | @props["t"] = @view.getFrame() 24 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/rebind.js: -------------------------------------------------------------------------------- 1 | // Copies a variable number of methods from source to target. 2 | d3.rebind = function(target, source) { 3 | var i = 1, n = arguments.length, method; 4 | while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); 5 | return target; 6 | }; 7 | 8 | // Method is assumed to be a standard D3 getter-setter: 9 | // If passed with no arguments, gets the value. 10 | // If passed with arguments, sets the value and returns the target. 11 | function d3_rebind(target, source, method) { 12 | return function() { 13 | var value = method.apply(source, arguments); 14 | return arguments.length ? target : value; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/layout/pie-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.layout.pie"); 7 | 8 | suite.addBatch({ 9 | "pie": { 10 | topic: d3.layout.pie, 11 | "arcs are in same order as original data": function(pie) { 12 | assert.deepEqual(pie([5, 30, 15]).map(function(d) { return d.data; }), [ 13 | 5, 30, 15 14 | ]); 15 | assert.deepEqual(pie([ 16 | 84, 90, 48, 61, 58, 8, 6, 31, 45, 18 17 | ]).map(function(d) { return d.data; }), [ 18 | 84, 90, 48, 61, 58, 8, 6, 31, 45, 18 19 | ]); 20 | } 21 | } 22 | }); 23 | 24 | suite.export(module); 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute to Underscore.js 2 | 3 | * Before you open a ticket or send a pull request, [search](https://github.com/documentcloud/underscore/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. 4 | 5 | * Before sending a pull request for a feature, be sure to have [tests](http://underscorejs.org/test/test.html). 6 | 7 | * Use the same coding style as the rest of the [codebase](https://github.com/documentcloud/underscore/blob/master/underscore.js). 8 | 9 | * In your pull request, do not add documentation or re-build the minified `underscore-min.js` file. We'll do those things before cutting a new release. -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/svg/diagonal-radial.js: -------------------------------------------------------------------------------- 1 | d3.svg.diagonal.radial = function() { 2 | var diagonal = d3.svg.diagonal(), 3 | projection = d3_svg_diagonalProjection, 4 | projection_ = diagonal.projection; 5 | 6 | diagonal.projection = function(x) { 7 | return arguments.length 8 | ? projection_(d3_svg_diagonalRadialProjection(projection = x)) 9 | : projection; 10 | }; 11 | 12 | return diagonal; 13 | }; 14 | 15 | function d3_svg_diagonalRadialProjection(projection) { 16 | return function() { 17 | var d = projection.apply(this, arguments), 18 | r = d[0], 19 | a = d[1] + d3_svg_arcOffset; 20 | return [r * Math.cos(a), r * Math.sin(a)]; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-each.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.each = function(type, listener) { 2 | var id = this.id; 3 | if (arguments.length < 2) { 4 | var inherit = d3_transitionInherit, 5 | inheritId = d3_transitionInheritId; 6 | d3_transitionInheritId = id; 7 | d3_selection_each(this, function(node, i, j) { 8 | d3_transitionInherit = node.__transition__[id]; 9 | type.call(node, node.__data__, i, j); 10 | }); 11 | d3_transitionInherit = inherit; 12 | d3_transitionInheritId = inheritId; 13 | } else { 14 | d3_selection_each(this, function(node) { 15 | node.__transition__[id].event.on(type, listener); 16 | }); 17 | } 18 | return this; 19 | }; 20 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transform-null-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/index.js: -------------------------------------------------------------------------------- 1 | var self = this, 2 | globals = ["document", "window", "navigator", "CSSStyleDeclaration", "d3", "Sizzle"], 3 | globalValues = {}; 4 | 5 | globals.forEach(function(global) { 6 | if (global in self) globalValues[global] = self[global]; 7 | }); 8 | 9 | document = require("jsdom").jsdom(""); 10 | window = document.createWindow(); 11 | navigator = window.navigator; 12 | CSSStyleDeclaration = window.CSSStyleDeclaration; 13 | 14 | Sizzle = require("sizzle"); 15 | 16 | require("./d3"); 17 | 18 | module.exports = d3; 19 | 20 | globals.forEach(function(global) { 21 | if (global in globalValues) self[global] = globalValues[global]; 22 | else delete self[global]; 23 | }); 24 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/science/science.lin.js: -------------------------------------------------------------------------------- 1 | (function(){science.lin = {}; 2 | /** 3 | * Solves tridiagonal systems of linear equations. 4 | * 5 | * Source: http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm 6 | * 7 | * @param {number[]} a 8 | * @param {number[]} b 9 | * @param {number[]} c 10 | * @param {number[]} d 11 | * @param {number[]} x 12 | * @param {number} n 13 | */ 14 | science.lin.tridag = function(a, b, c, d, x, n) { 15 | var i, 16 | m; 17 | for (i = 1; i < n; i++) { 18 | m = a[i] / b[i - 1]; 19 | b[i] -= m * c[i - 1]; 20 | d[i] -= m * d[i - 1]; 21 | } 22 | x[n - 1] = d[n - 1] / b[n - 1]; 23 | for (i = n - 2; i >= 0; i--) { 24 | x[i] = (d[i] - c[i] * x[i + 1]) / b[i]; 25 | } 26 | }; 27 | })() -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/range.js: -------------------------------------------------------------------------------- 1 | d3.range = function(start, stop, step) { 2 | if (arguments.length < 3) { 3 | step = 1; 4 | if (arguments.length < 2) { 5 | stop = start; 6 | start = 0; 7 | } 8 | } 9 | if ((stop - start) / step === Infinity) throw new Error("infinite range"); 10 | var range = [], 11 | k = d3_range_integerScale(Math.abs(step)), 12 | i = -1, 13 | j; 14 | start *= k, stop *= k, step *= k; 15 | if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); 16 | else while ((j = start + step * ++i) < stop) range.push(j / k); 17 | return range; 18 | }; 19 | 20 | function d3_range_integerScale(x) { 21 | var k = 1; 22 | while (x * k % 1) k *= 10; 23 | return k; 24 | } 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transform-null-matrix-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-transition.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.transition = function() { 2 | var id0 = this.id, 3 | id1 = ++d3_transitionId, 4 | subgroups = [], 5 | subgroup, 6 | group, 7 | node, 8 | transition; 9 | 10 | for (var j = 0, m = this.length; j < m; j++) { 11 | subgroups.push(subgroup = []); 12 | for (var group = this[j], i = 0, n = group.length; i < n; i++) { 13 | if (node = group[i]) { 14 | transition = Object.create(node.__transition__[id0]); 15 | transition.delay += transition.duration; 16 | d3_transitionNode(node, i, id1, transition); 17 | } 18 | subgroup.push(node); 19 | } 20 | } 21 | 22 | return d3_transition(subgroups, id1); 23 | }; 24 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/identity.js: -------------------------------------------------------------------------------- 1 | d3.scale.identity = function() { 2 | return d3_scale_identity([0, 1]); 3 | }; 4 | 5 | function d3_scale_identity(domain) { 6 | 7 | function identity(x) { return +x; } 8 | 9 | identity.invert = identity; 10 | 11 | identity.domain = identity.range = function(x) { 12 | if (!arguments.length) return domain; 13 | domain = x.map(identity); 14 | return identity; 15 | }; 16 | 17 | identity.ticks = function(m) { 18 | return d3_scale_linearTicks(domain, m); 19 | }; 20 | 21 | identity.tickFormat = function(m) { 22 | return d3_scale_linearTickFormat(domain, m); 23 | }; 24 | 25 | identity.copy = function() { 26 | return d3_scale_identity(domain); 27 | }; 28 | 29 | return identity; 30 | } 31 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-selectAll.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.selectAll = function(selector) { 2 | var subgroups = [], 3 | subgroup, 4 | node; 5 | 6 | if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); 7 | 8 | for (var j = -1, m = this.length; ++j < m;) { 9 | for (var group = this[j], i = -1, n = group.length; ++i < n;) { 10 | if (node = group[i]) { 11 | subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); 12 | subgroup.parentNode = node; 13 | } 14 | } 15 | } 16 | 17 | return d3_selection(subgroups); 18 | }; 19 | 20 | function d3_selection_selectorAll(selector) { 21 | return function() { 22 | return d3_selectAll(selector, this); 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-enter-select.js: -------------------------------------------------------------------------------- 1 | d3_selection_enterPrototype.select = function(selector) { 2 | var subgroups = [], 3 | subgroup, 4 | subnode, 5 | upgroup, 6 | group, 7 | node; 8 | 9 | for (var j = -1, m = this.length; ++j < m;) { 10 | upgroup = (group = this[j]).update; 11 | subgroups.push(subgroup = []); 12 | subgroup.parentNode = group.parentNode; 13 | for (var i = -1, n = group.length; ++i < n;) { 14 | if (node = group[i]) { 15 | subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); 16 | subnode.__data__ = node.__data__; 17 | } else { 18 | subgroup.push(null); 19 | } 20 | } 21 | } 22 | 23 | return d3_selection(subgroups); 24 | }; 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/test/test_standalone.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Underscore.strings Test Suite 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Underscore.string Test Suite

14 |

15 |

16 |
    17 | 18 | 19 | -------------------------------------------------------------------------------- /app/lib/cmx/models/bubble_model.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/model', 'cmx/entities/bubble'], (Model, Bubble) -> 2 | 3 | class BubbleModel extends Model 4 | 5 | constructor: -> 6 | @defaults = 7 | "t": "" 8 | "pose": "0,0|-20,10|-40,50|0,50|-20,90|-60,85" 9 | "content": 'hello world' 10 | "attach": "head" 11 | super 12 | 13 | materialize: (parent) -> 14 | o = new Bubble parent.scene 15 | o.setFrame @props["t"] 16 | o.setPose @unserializePose(@props["pose"]) 17 | o.setContent @props.content 18 | o.setAttachBone @props.attach 19 | parent.add o 20 | 21 | super o 22 | 23 | read: -> 24 | @props["t"] = @view.getFrame() 25 | @props["pose"] = @serializePose(@view.getPose()) 26 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-filter.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.filter = function(filter) { 2 | var subgroups = [], 3 | subgroup, 4 | group, 5 | node; 6 | 7 | if (typeof filter !== "function") filter = d3_selection_filter(filter); 8 | 9 | for (var j = 0, m = this.length; j < m; j++) { 10 | subgroups.push(subgroup = []); 11 | subgroup.parentNode = (group = this[j]).parentNode; 12 | for (var i = 0, n = group.length; i < n; i++) { 13 | if ((node = group[i]) && filter.call(node, node.__data__, i)) { 14 | subgroup.push(node); 15 | } 16 | } 17 | } 18 | 19 | return d3_selection(subgroups); 20 | }; 21 | 22 | function d3_selection_filter(selector) { 23 | return function() { 24 | return d3_selectMatches(this, selector); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/formatPrefix.js: -------------------------------------------------------------------------------- 1 | var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); 2 | 3 | d3.formatPrefix = function(value, precision) { 4 | var i = 0; 5 | if (value) { 6 | if (value < 0) value *= -1; 7 | if (precision) value = d3.round(value, d3_format_precision(value, precision)); 8 | i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); 9 | i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); 10 | } 11 | return d3_formatPrefixes[8 + i / 3]; 12 | }; 13 | 14 | function d3_formatPrefix(d, i) { 15 | var k = Math.pow(10, Math.abs(8 - i) * 3); 16 | return { 17 | scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; }, 18 | symbol: d 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-tween.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.tween = function(name, tween) { 2 | var id = this.id; 3 | if (arguments.length < 2) return this.node().__transition__[id].tween.get(name); 4 | return d3_selection_each(this, tween == null 5 | ? function(node) { node.__transition__[id].tween.remove(name); } 6 | : function(node) { node.__transition__[id].tween.set(name, tween); }); 7 | }; 8 | 9 | function d3_transition_tween(groups, name, value, tween) { 10 | var id = groups.id; 11 | return d3_selection_each(groups, typeof value === "function" 12 | ? function(node, i, j) { node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j))); } 13 | : (value = tween(value), function(node) { node.__transition__[id].tween.set(name, value); })); 14 | } 15 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/merge-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.merge"); 7 | 8 | suite.addBatch({ 9 | "merge": { 10 | "merges an array of arrays": function() { 11 | var a = {}, b = {}, c = {}, d = {}, e = {}, f = {}; 12 | assert.deepEqual(d3.merge([[a], [b, c], [d, e, f]]), [a, b, c, d, e, f]); 13 | }, 14 | "returns a new array": function() { 15 | var input = [[1, 2, 3], [4, 5], [6]]; 16 | assert.isFalse(d3.merge(input) === input); 17 | }, 18 | "does not modify the input arrays": function() { 19 | var input = [[1, 2, 3], [4, 5], [6]]; 20 | d3.merge(input); 21 | assert.deepEqual(input, [[1, 2, 3], [4, 5], [6]]); 22 | } 23 | } 24 | }); 25 | 26 | suite.export(module); 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-select.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.select = function(selector) { 2 | var id = this.id, 3 | subgroups = [], 4 | subgroup, 5 | subnode, 6 | node; 7 | 8 | if (typeof selector !== "function") selector = d3_selection_selector(selector); 9 | 10 | for (var j = -1, m = this.length; ++j < m;) { 11 | subgroups.push(subgroup = []); 12 | for (var group = this[j], i = -1, n = group.length; ++i < n;) { 13 | if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) { 14 | if ("__data__" in node) subnode.__data__ = node.__data__; 15 | d3_transitionNode(subnode, i, id, node.__transition__[id]); 16 | subgroup.push(subnode); 17 | } else { 18 | subgroup.push(null); 19 | } 20 | } 21 | } 22 | 23 | return d3_transition(subgroups, id); 24 | }; 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/functor-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.functor"); 7 | 8 | suite.addBatch({ 9 | "functor": { 10 | topic: function() { 11 | return d3.functor; 12 | }, 13 | "when passed a function, returns the function": function(functor) { 14 | function foo() {} 15 | assert.strictEqual(functor(foo), foo); 16 | }, 17 | "when passed a non-function, returns a wrapper function": function(functor) { 18 | var a = {}; 19 | assert.isNull(functor(null)()); 20 | assert.isUndefined(functor(undefined)()); 21 | assert.strictEqual(functor(a)(), a); 22 | assert.strictEqual(functor(1)(), 1); 23 | assert.deepEqual(functor([1])(), [1]); 24 | } 25 | } 26 | }); 27 | 28 | suite.export(module); 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-enter-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("selection.enter"); 7 | 8 | suite.addBatch({ 9 | "selectAll(div)": { 10 | topic: function() { 11 | return d3.select("body").html("").selectAll("div").data(d3.range(2)).enter(); 12 | }, 13 | "is an instanceof d3.selection.enter": function(enter) { 14 | assert.instanceOf(enter, d3.selection.enter); 15 | }, 16 | "selection prototype can be extended": function(enter) { 17 | d3.selection.enter.prototype.foo = function() { return this.append("foo"); }; 18 | var selection = enter.foo(); 19 | assert.equal(document.body.innerHTML, ""); 20 | delete d3.selection.enter.prototype.foo; 21 | } 22 | } 23 | }); 24 | 25 | suite.export(module); 26 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/keys-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.keys"); 7 | 8 | suite.addBatch({ 9 | "keys": { 10 | topic: function() { 11 | return d3.keys; 12 | }, 13 | "enumerates every defined key": function(keys) { 14 | assert.deepEqual(keys({a: 1, b: 1}), ["a", "b"]); 15 | }, 16 | "includes keys defined on prototypes": function(keys) { 17 | function abc() { 18 | this.a = 1; 19 | this.b = 2; 20 | } 21 | abc.prototype.c = 3; 22 | assert.deepEqual(keys(new abc()), ["a", "b", "c"]); 23 | }, 24 | "includes keys with null or undefined values": function(keys) { 25 | assert.deepEqual(keys({a: undefined, b: null, c: NaN}), ["a", "b", "c"]); 26 | } 27 | } 28 | }); 29 | 30 | suite.export(module); 31 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/random.js: -------------------------------------------------------------------------------- 1 | d3.random = { 2 | normal: function(µ, σ) { 3 | var n = arguments.length; 4 | if (n < 2) σ = 1; 5 | if (n < 1) µ = 0; 6 | return function() { 7 | var x, y, r; 8 | do { 9 | x = Math.random() * 2 - 1; 10 | y = Math.random() * 2 - 1; 11 | r = x * x + y * y; 12 | } while (!r || r > 1); 13 | return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); 14 | }; 15 | }, 16 | logNormal: function(µ, σ) { 17 | var n = arguments.length; 18 | if (n < 2) σ = 1; 19 | if (n < 1) µ = 0; 20 | var random = d3.random.normal(); 21 | return function() { 22 | return Math.exp(µ + σ * random()); 23 | }; 24 | }, 25 | irwinHall: function(m) { 26 | return function() { 27 | for (var s = 0, j = 0; j < m; j++) s += Math.random(); 28 | return s / m; 29 | }; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/random-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.random"); 7 | 8 | suite.addBatch({ 9 | "normal": { 10 | "topic": function() { 11 | return d3.random.normal(); 12 | }, 13 | "returns a number": function(random) { 14 | assert.typeOf(random(), "number"); 15 | } 16 | }, 17 | "logNormal": { 18 | "topic": function() { 19 | return d3.random.logNormal(); 20 | }, 21 | "returns a number": function(random) { 22 | assert.typeOf(random(), "number"); 23 | } 24 | }, 25 | "irwinHall": { 26 | "topic": function() { 27 | return d3.random.irwinHall(10); 28 | }, 29 | "returns a number": function(random) { 30 | assert.typeOf(random(), "number"); 31 | } 32 | } 33 | }); 34 | 35 | suite.export(module); 36 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/bisect.js: -------------------------------------------------------------------------------- 1 | d3.bisector = function(f) { 2 | return { 3 | left: function(a, x, lo, hi) { 4 | if (arguments.length < 3) lo = 0; 5 | if (arguments.length < 4) hi = a.length; 6 | while (lo < hi) { 7 | var mid = lo + hi >>> 1; 8 | if (f.call(a, a[mid], mid) < x) lo = mid + 1; 9 | else hi = mid; 10 | } 11 | return lo; 12 | }, 13 | right: function(a, x, lo, hi) { 14 | if (arguments.length < 3) lo = 0; 15 | if (arguments.length < 4) hi = a.length; 16 | while (lo < hi) { 17 | var mid = lo + hi >>> 1; 18 | if (x < f.call(a, a[mid], mid)) hi = mid; 19 | else lo = mid + 1; 20 | } 21 | return lo; 22 | } 23 | }; 24 | }; 25 | 26 | var d3_bisector = d3.bisector(function(d) { return d; }); 27 | d3.bisectLeft = d3_bisector.left; 28 | d3.bisect = d3.bisectRight = d3_bisector.right; 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/quantize.js: -------------------------------------------------------------------------------- 1 | d3.scale.quantize = function() { 2 | return d3_scale_quantize(0, 1, [0, 1]); 3 | }; 4 | 5 | function d3_scale_quantize(x0, x1, range) { 6 | var kx, i; 7 | 8 | function scale(x) { 9 | return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; 10 | } 11 | 12 | function rescale() { 13 | kx = range.length / (x1 - x0); 14 | i = range.length - 1; 15 | return scale; 16 | } 17 | 18 | scale.domain = function(x) { 19 | if (!arguments.length) return [x0, x1]; 20 | x0 = +x[0]; 21 | x1 = +x[x.length - 1]; 22 | return rescale(); 23 | }; 24 | 25 | scale.range = function(x) { 26 | if (!arguments.length) return range; 27 | range = x; 28 | return rescale(); 29 | }; 30 | 31 | scale.copy = function() { 32 | return d3_scale_quantize(x0, x1, range); // copy on write 33 | }; 34 | 35 | return rescale(); 36 | } 37 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/bounds.js: -------------------------------------------------------------------------------- 1 | d3.geo.bounds = d3_geo_bounds(d3_identity); 2 | 3 | function d3_geo_bounds(projectStream) { 4 | var x0, y0, x1, y1; 5 | 6 | var bound = { 7 | point: boundPoint, 8 | lineStart: d3_noop, 9 | lineEnd: d3_noop, 10 | 11 | // While inside a polygon, ignore points in holes. 12 | polygonStart: function() { bound.lineEnd = boundPolygonLineEnd; }, 13 | polygonEnd: function() { bound.point = boundPoint; } 14 | }; 15 | 16 | function boundPoint(x, y) { 17 | if (x < x0) x0 = x; 18 | if (x > x1) x1 = x; 19 | if (y < y0) y0 = y; 20 | if (y > y1) y1 = y; 21 | } 22 | 23 | function boundPolygonLineEnd() { 24 | bound.point = bound.lineEnd = d3_noop; 25 | } 26 | 27 | return function(feature) { 28 | y1 = x1 = -(x0 = y0 = Infinity); 29 | d3.geo.stream(feature, projectStream(bound)); 30 | return [[x0, y0], [x1, y1]]; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/array.js: -------------------------------------------------------------------------------- 1 | var d3_array = d3_arraySlice; // conversion for NodeLists 2 | 3 | function d3_arrayCopy(pseudoarray) { 4 | var i = -1, n = pseudoarray.length, array = []; 5 | while (++i < n) array.push(pseudoarray[i]); 6 | return array; 7 | } 8 | 9 | function d3_arraySlice(pseudoarray) { 10 | return Array.prototype.slice.call(pseudoarray); 11 | } 12 | 13 | try { 14 | d3_array(document.documentElement.childNodes)[0].nodeType; 15 | } catch(e) { 16 | d3_array = d3_arrayCopy; 17 | } 18 | 19 | var d3_arraySubclass = [].__proto__? 20 | 21 | // Until ECMAScript supports array subclassing, prototype injection works well. 22 | function(array, prototype) { 23 | array.__proto__ = prototype; 24 | }: 25 | 26 | // And if your browser doesn't support __proto__, we'll use direct extension. 27 | function(array, prototype) { 28 | for (var property in prototype) array[property] = prototype[property]; 29 | }; 30 | -------------------------------------------------------------------------------- /app/lib/cmx.coffee: -------------------------------------------------------------------------------- 1 | define [ 2 | 'cmx/controller' 3 | 'cmx/model', 4 | 'cmx/view', 5 | 'cmx/drawable', 6 | 'cmx/xkcd', 7 | 'cmx/bone', 8 | 'cmx/skelet', 9 | 'cmx/scene', 10 | 'cmx/entity', 11 | 'cmx/gizmo', 12 | 'cmx/renderer', 13 | 'cmx/overlay', 14 | 'cmx/parser', 15 | 'cmx/entities/actor', 16 | 'cmx/entities/bubble', 17 | 'cmx/entities/drawing', 18 | 'cmx/entities/label', 19 | 'cmx/gizmos/entity_gizmo', 20 | 'cmx/gizmos/actor_gizmo', 21 | 'cmx/gizmos/bubble_gizmo', 22 | 'cmx/gizmos/drawing_gizmo', 23 | 'cmx/gizmos/label_gizmo', 24 | 'cmx/models/scene_model', 25 | 'cmx/models/actor_model', 26 | 'cmx/models/bubble_model', 27 | 'cmx/models/drawing_model', 28 | 'cmx/models/label_model' 29 | ], (classes...) -> 30 | 31 | # build CMX instance... 32 | cmx = new classes[0] # Controller 33 | # mix all constructors into cmx 34 | for klass in classes 35 | cmx[klass.name] = klass 36 | cmx -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/Rakefile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | task default: :test 3 | 4 | desc 'Use UglifyJS to compress Underscore.string' 5 | task :build do 6 | require 'uglifier' 7 | source = File.read('lib/underscore.string.js') 8 | compressed = Uglifier.compile(source, copyright: false) 9 | File.open('dist/underscore.string.min.js', 'w'){ |f| f.write compressed } 10 | compression_rate = compressed.length.to_f/source.length 11 | puts "compressed dist/underscore.string.min.js: #{compressed.length}/#{source.length} #{(compression_rate * 100).round}%" 12 | end 13 | 14 | desc 'Run tests' 15 | task :test do 16 | puts "Running underscore.string test suite." 17 | result1 = system %{phantomjs ./test/run-qunit.js "test/test.html"} 18 | 19 | puts "Running Underscore test suite." 20 | result2 = system %{phantomjs ./test/run-qunit.js "test/test_underscore/index.html"} 21 | 22 | exit(result1 && result2 ? 0 : 1) 23 | end -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/transition-selectAll.js: -------------------------------------------------------------------------------- 1 | d3_transitionPrototype.selectAll = function(selector) { 2 | var id = this.id, 3 | subgroups = [], 4 | subgroup, 5 | subnodes, 6 | node, 7 | subnode, 8 | transition; 9 | 10 | if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); 11 | 12 | for (var j = -1, m = this.length; ++j < m;) { 13 | for (var group = this[j], i = -1, n = group.length; ++i < n;) { 14 | if (node = group[i]) { 15 | transition = node.__transition__[id]; 16 | subnodes = selector.call(node, node.__data__, i); 17 | subgroups.push(subgroup = []); 18 | for (var k = -1, o = subnodes.length; ++k < o;) { 19 | d3_transitionNode(subnode = subnodes[k], k, id, transition); 20 | subgroup.push(subnode); 21 | } 22 | } 23 | } 24 | } 25 | 26 | return d3_transition(subgroups, id); 27 | }; 28 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/package.js: -------------------------------------------------------------------------------- 1 | require("./core/core"); 2 | 3 | require("util").puts(JSON.stringify({ 4 | "name": "d3", 5 | "version": d3.version, 6 | "description": "A small, free JavaScript library for manipulating documents based on data.", 7 | "keywords": ["dom", "w3c", "visualization", "svg", "animation", "canvas"], 8 | "homepage": "http://d3js.org", 9 | "author": {"name": "Mike Bostock", "url": "http://bost.ocks.org/mike"}, 10 | "repository": {"type": "git", "url": "https://github.com/mbostock/d3.git"}, 11 | "main": "index.js", 12 | "browserify" : "index-browserify.js", 13 | "jam": { 14 | "main": "d3.js", 15 | "shim": { 16 | "exports": "d3" 17 | } 18 | }, 19 | "dependencies": { 20 | "jsdom": "0.2.14", 21 | "sizzle": "1.1.x" 22 | }, 23 | "devDependencies": { 24 | "uglify-js": "2.2.2", 25 | "vows": "0.6.x" 26 | }, 27 | "scripts": {"test": "./node_modules/vows/bin/vows"} 28 | }, null, 2)); 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-select.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.select = function(selector) { 2 | var subgroups = [], 3 | subgroup, 4 | subnode, 5 | group, 6 | node; 7 | 8 | if (typeof selector !== "function") selector = d3_selection_selector(selector); 9 | 10 | for (var j = -1, m = this.length; ++j < m;) { 11 | subgroups.push(subgroup = []); 12 | subgroup.parentNode = (group = this[j]).parentNode; 13 | for (var i = -1, n = group.length; ++i < n;) { 14 | if (node = group[i]) { 15 | subgroup.push(subnode = selector.call(node, node.__data__, i)); 16 | if (subnode && "__data__" in node) subnode.__data__ = node.__data__; 17 | } else { 18 | subgroup.push(null); 19 | } 20 | } 21 | } 22 | 23 | return d3_selection(subgroups); 24 | }; 25 | 26 | function d3_selection_selector(selector) { 27 | return function() { 28 | return d3_select(selector, this); 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transition-test-text.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var assert = require("assert"); 4 | 5 | module.exports = { 6 | topic: function() { 7 | return d3.select("body").append("div").text("foo").transition().text("bar"); 8 | }, 9 | "sets the text tween": function(div) { 10 | assert.typeOf(div.tween("text"), "function"); 11 | }, 12 | "start": { 13 | topic: function(div) { 14 | var cb = this.callback, 15 | tween = div.tween("text"); 16 | div.tween("text", function() { 17 | var result = tween.apply(this, arguments); 18 | cb(null, {transition: div, tween: result}); 19 | return result; 20 | }); 21 | }, 22 | "sets the text content as a string": function(result) { 23 | assert.equal(result.transition[0][0].textContent, "bar"); 24 | }, 25 | "does not interpolate text": function(result) { 26 | assert.isTrue(!result.tween); 27 | } 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cmx", 3 | "version": "0.0.1", 4 | "dependencies": {}, 5 | "devDependencies": { 6 | "grunt": "0.4.0rc7", 7 | "grunt-contrib-copy": "0.4.0rc7", 8 | "grunt-contrib-concat": "0.1.2rc6", 9 | "grunt-contrib-coffee": "0.4.0rc7", 10 | "grunt-contrib-uglify": "0.1.1rc6", 11 | "grunt-contrib-compass": "0.1.1rc8", 12 | "grunt-contrib-jshint": "0.1.1rc6", 13 | "grunt-contrib-mincss": "0.4.0rc7", 14 | "grunt-contrib-connect": "0.1.1rc6", 15 | "grunt-contrib-clean": "0.4.0rc6", 16 | "grunt-contrib-htmlmin": "0.1.1rc7", 17 | "grunt-contrib-imagemin": "0.1.1rc8", 18 | "grunt-contrib-livereload": "0.1.0rc8", 19 | "grunt-bower-hooks": "~0.2.0", 20 | "grunt-usemin": "~0.1.7", 21 | "grunt-regarde": "~0.1.1", 22 | "grunt-requirejs": "~0.3.1", 23 | "grunt-mocha": "~0.2.2", 24 | "grunt-open": "~0.1.0", 25 | "matchdep": "~0.1.1" 26 | }, 27 | "engines": { 28 | "node": ">=0.8.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/values-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.values"); 7 | 8 | suite.addBatch({ 9 | "values": { 10 | topic: function() { 11 | return d3.values; 12 | }, 13 | "enumerates every value": function(values) { 14 | assert.deepEqual(values({a: 1, b: 2}), [1, 2]); 15 | }, 16 | "includes values defined on prototypes": function(values) { 17 | function abc() { 18 | this.a = 1; 19 | this.b = 2; 20 | } 21 | abc.prototype.c = 3; 22 | assert.deepEqual(values(new abc()), [1, 2, 3]); 23 | }, 24 | "includes null or undefined values": function(values) { 25 | var v = values({a: undefined, b: null, c: NaN}); 26 | assert.isUndefined(v[0]); 27 | assert.isNull(v[1]); 28 | assert.isNaN(v[2]); 29 | assert.equal(v.length, 3); 30 | } 31 | } 32 | }); 33 | 34 | suite.export(module); 35 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d3", 3 | "version": "3.0.4", 4 | "description": "A small, free JavaScript library for manipulating documents based on data.", 5 | "keywords": [ 6 | "dom", 7 | "w3c", 8 | "visualization", 9 | "svg", 10 | "animation", 11 | "canvas" 12 | ], 13 | "homepage": "http://d3js.org", 14 | "author": { 15 | "name": "Mike Bostock", 16 | "url": "http://bost.ocks.org/mike" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/mbostock/d3.git" 21 | }, 22 | "main": "index.js", 23 | "browserify": "index-browserify.js", 24 | "jam": { 25 | "main": "d3.js", 26 | "shim": { 27 | "exports": "d3" 28 | } 29 | }, 30 | "dependencies": { 31 | "jsdom": "0.2.14", 32 | "sizzle": "1.1.x" 33 | }, 34 | "devDependencies": { 35 | "uglify-js": "2.2.2", 36 | "vows": "0.6.x" 37 | }, 38 | "scripts": { 39 | "test": "./node_modules/vows/bin/vows" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geom/delaunay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param vertices [[x1, y1], [x2, y2], …] 3 | * @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] 4 | */ 5 | d3.geom.delaunay = function(vertices) { 6 | var edges = vertices.map(function() { return []; }), 7 | triangles = []; 8 | 9 | // Use the Voronoi tessellation to determine Delaunay edges. 10 | d3_voronoi_tessellate(vertices, function(e) { 11 | edges[e.region.l.index].push(vertices[e.region.r.index]); 12 | }); 13 | 14 | // Reconnect the edges into counterclockwise triangles. 15 | edges.forEach(function(edge, i) { 16 | var v = vertices[i], 17 | cx = v[0], 18 | cy = v[1]; 19 | edge.forEach(function(v) { 20 | v.angle = Math.atan2(v[0] - cx, v[1] - cy); 21 | }); 22 | edge.sort(function(a, b) { 23 | return a.angle - b.angle; 24 | }); 25 | for (var j = 0, m = edge.length - 1; j < m; j++) { 26 | triangles.push([v, edge[j], edge[j + 1]]); 27 | } 28 | }); 29 | 30 | return triangles; 31 | }; 32 | -------------------------------------------------------------------------------- /app/lib/cmx/models/scene_model.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/model', 'cmx/scene'], (Model, Scene) -> 2 | 3 | class SceneModel extends Model 4 | 5 | constructor: -> 6 | @defaults = 7 | "width": [250, "int"] 8 | "height": [350, "int"] 9 | "frame": [yes, "bool"] 10 | "margin-x": [10, "int"] 11 | "margin-y": [20, "int"] 12 | 13 | super 14 | 15 | applyDefaults: (props) -> 16 | super 17 | 18 | if props["margin"] isnt undefined 19 | props["margin-x"] = props["margin"] 20 | props["margin-y"] = props["margin"] 21 | 22 | props 23 | 24 | materialize: ($where) -> 25 | $wrapper = $("
    ").attr('class', 'cmx-scene') 26 | id = $(@source).attr("id") 27 | $wrapper.addClass("cmx-user-#{id}") if id 28 | $where.after $wrapper 29 | 30 | scene = new Scene @cmx, $wrapper.get(0), @props["width"], @props["height"], @props["frame"], @props["margin-x"], @props["margin-y"] 31 | super scene 32 | scene.drawScene() 33 | scene 34 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/layout/hierarchy-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.layout.hierarchy"); 7 | 8 | suite.addBatch({ 9 | "hierarchy": { 10 | topic: function() { 11 | return d3.layout.treemap(); // hierarchy is abstract, so test a subclass 12 | }, 13 | "doesn't overwrite the value of a node that has an empty children array": function(hierarchy) { 14 | var nodes = hierarchy.sticky(true).nodes({value: 1, children: []}); 15 | assert.equal(nodes[0].value, 1); 16 | hierarchy.nodes(nodes[0]); 17 | assert.equal(nodes[0].value, 1); 18 | }, 19 | "a valueless node that has an empty children array gets a value of 0": function(hierarchy) { 20 | var nodes = hierarchy.sticky(true).nodes({children: []}); 21 | assert.equal(nodes[0].value, 0); 22 | hierarchy.nodes(nodes[0]); 23 | assert.equal(nodes[0].value, 0); 24 | } 25 | } 26 | }); 27 | 28 | suite.export(module); 29 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/week.js: -------------------------------------------------------------------------------- 1 | d3_time_daySymbols.forEach(function(day, i) { 2 | day = day.toLowerCase(); 3 | i = 7 - i; 4 | 5 | var interval = d3.time[day] = d3_time_interval(function(date) { 6 | (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); 7 | return date; 8 | }, function(date, offset) { 9 | date.setDate(date.getDate() + Math.floor(offset) * 7); 10 | }, function(date) { 11 | var day = d3.time.year(date).getDay(); 12 | return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); 13 | }); 14 | 15 | d3.time[day + "s"] = interval.range; 16 | d3.time[day + "s"].utc = interval.utc.range; 17 | 18 | d3.time[day + "OfYear"] = function(date) { 19 | var day = d3.time.year(date).getDay(); 20 | return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); 21 | }; 22 | }); 23 | 24 | d3.time.week = d3.time.sunday; 25 | d3.time.weeks = d3.time.sunday.range; 26 | d3.time.weeks.utc = d3.time.sunday.utc.range; 27 | d3.time.weekOfYear = d3.time.sundayOfYear; 28 | -------------------------------------------------------------------------------- /app/lib/cmx/entities/drawing.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/entity', 'cmx/gizmos/drawing_gizmo'], (Entity, DrawingGizmo) -> 2 | 3 | class Drawing extends Entity 4 | 5 | constructor: (scene, drawlist=[]) -> 6 | # HACK: find proper way how to do deep clone 7 | @drawlist = drawlist.map (call) -> call.map (x) -> _(x).clone() 8 | super(scene) 9 | 10 | @drawingBones = @skelet.addBones [ 11 | ['HNDL', 0, 0, "h"], # handle 12 | ] 13 | 14 | buildGizmo: (root) -> 15 | @gizmo = new DrawingGizmo @, root 16 | 17 | setPose: (pose) -> 18 | @skelet.setPose pose, @drawingBones 19 | 20 | getPose: -> 21 | @skelet.getPose @drawingBones 22 | 23 | drawLayer: (layer) -> 24 | super 25 | 26 | itemsToBeRendered = _(@drawlist).filter (item) -> layer is item[0] 27 | return unless itemsToBeRendered.length 28 | 29 | @openFrame (=> @prepareFrame(@skelet.bone('HNDL'))) 30 | for item in itemsToBeRendered 31 | @scene.renderer[item[1]].apply(@scene.renderer, item[2..-1]) 32 | @closeFrame() 33 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/zip-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.zip"); 7 | 8 | suite.addBatch({ 9 | "zip": { 10 | topic: function() { 11 | return d3.zip; 12 | }, 13 | "transposes a square matrix": function(zip) { 14 | assert.deepEqual(d3.zip([1, 2], [3, 4]), [[1, 3], [2, 4]]); 15 | }, 16 | "transposes a non-square matrix": function(zip) { 17 | assert.deepEqual(d3.zip([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]); 18 | }, 19 | "transposes a single-row matrix": function(zip) { 20 | assert.deepEqual(d3.zip([1, 2, 3, 4, 5]), [[1], [2], [3], [4], [5]]); 21 | }, 22 | "transposes an empty matrix": function(zip) { 23 | assert.deepEqual(d3.zip(), []); 24 | }, 25 | "ignores extra elements given an irregular matrix": function(zip) { 26 | assert.deepEqual(d3.zip([1, 2], [3, 4], [5, 6, 7]), [[1, 3, 5], [2, 4, 6]]); 27 | } 28 | } 29 | }); 30 | 31 | suite.export(module); 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection.js: -------------------------------------------------------------------------------- 1 | function d3_selection(groups) { 2 | d3_arraySubclass(groups, d3_selectionPrototype); 3 | return groups; 4 | } 5 | 6 | var d3_select = function(s, n) { return n.querySelector(s); }, 7 | d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, 8 | d3_selectRoot = document.documentElement, 9 | d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, 10 | d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; 11 | 12 | // Prefer Sizzle, if available. 13 | if (typeof Sizzle === "function") { 14 | d3_select = function(s, n) { return Sizzle(s, n)[0] || null; }; 15 | d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; 16 | d3_selectMatches = Sizzle.matchesSelector; 17 | } 18 | 19 | var d3_selectionPrototype = []; 20 | 21 | d3.selection = function() { 22 | return d3_selectionRoot; 23 | }; 24 | 25 | d3.selection.prototype = d3_selectionPrototype; 26 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/svg/diagonal.js: -------------------------------------------------------------------------------- 1 | d3.svg.diagonal = function() { 2 | var source = d3_source, 3 | target = d3_target, 4 | projection = d3_svg_diagonalProjection; 5 | 6 | function diagonal(d, i) { 7 | var p0 = source.call(this, d, i), 8 | p3 = target.call(this, d, i), 9 | m = (p0.y + p3.y) / 2, 10 | p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; 11 | p = p.map(projection); 12 | return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; 13 | } 14 | 15 | diagonal.source = function(x) { 16 | if (!arguments.length) return source; 17 | source = d3_functor(x); 18 | return diagonal; 19 | }; 20 | 21 | diagonal.target = function(x) { 22 | if (!arguments.length) return target; 23 | target = d3_functor(x); 24 | return diagonal; 25 | }; 26 | 27 | diagonal.projection = function(x) { 28 | if (!arguments.length) return projection; 29 | projection = x; 30 | return diagonal; 31 | }; 32 | 33 | return diagonal; 34 | }; 35 | 36 | function d3_svg_diagonalProjection(d) { 37 | return [d.x, d.y]; 38 | } 39 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/time/time.js: -------------------------------------------------------------------------------- 1 | var offset = 0; 2 | 3 | exports.local = function(year, month, day, hours, minutes, seconds, milliseconds) { 4 | var date = new Date(); 5 | date.setFullYear(year, month, day); 6 | date.setHours(hours || 0, offset + (minutes || 0), seconds || 0, milliseconds || 0); 7 | return date; 8 | }; 9 | 10 | exports.utc = function(year, month, day, hours, minutes, seconds, milliseconds) { 11 | var date = new Date(); 12 | date.setUTCFullYear(year, month, day); 13 | date.setUTCHours(hours || 0, minutes || 0, seconds || 0, milliseconds || 0); 14 | return date; 15 | }; 16 | 17 | exports.zone = function(tzOffset, scope) { 18 | return function() { 19 | var o = Date.prototype.getTimezoneOffset; 20 | try { 21 | // Note: assumes the dates are not in DST. 22 | offset = -tzOffset - new Date(0).getTimezoneOffset(); 23 | Date.prototype.getTimezoneOffset = function() { return offset; }; 24 | scope.apply(this, arguments); 25 | } finally { 26 | offset = 0; 27 | Date.prototype.getTimezoneOffset = o; 28 | } 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /test/runner/mocha.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var runner = mocha.run(); 3 | 4 | if(!window.PHANTOMJS) return; 5 | 6 | runner.on('test', function(test) { 7 | sendMessage('testStart', test.title); 8 | }); 9 | 10 | runner.on('test end', function(test) { 11 | sendMessage('testDone', test.title, test.state); 12 | }); 13 | 14 | runner.on('suite', function(suite) { 15 | sendMessage('suiteStart', suite.title); 16 | }); 17 | 18 | runner.on('suite end', function(suite) { 19 | if (suite.root) return; 20 | sendMessage('suiteDone', suite.title); 21 | }); 22 | 23 | runner.on('fail', function(test, err) { 24 | sendMessage('testFail', test.title, err); 25 | }); 26 | 27 | runner.on('end', function() { 28 | var output = { 29 | failed : this.failures, 30 | passed : this.total - this.failures, 31 | total : this.total 32 | }; 33 | 34 | sendMessage('done', output.failed,output.passed, output.total); 35 | }); 36 | 37 | function sendMessage() { 38 | var args = [].slice.call(arguments); 39 | alert(JSON.stringify(args)); 40 | } 41 | })(); 42 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transform-rotate-origin-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/locale.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"), 2 | puts = require("util").puts, 3 | formats = {}, 4 | kvRe = /=/, 5 | valueRe = /;/g, 6 | quotedRe = /"([^"]*?)"/g, 7 | data = []; 8 | 9 | process.stdin.resume(); 10 | process.stdin.setEncoding("utf8"); 11 | process.stdin.on("data", function(chunk) { data.push(chunk); }); 12 | process.stdin.on("end", write); 13 | 14 | function write() { 15 | data.join("\n").split(/\n/g).forEach(function(line) { 16 | var i = line.match(kvRe); 17 | if (i && (i = i.index)) { 18 | var value = line.substring(i + 1).replace(quotedRe, "$1").split(valueRe); 19 | formats[line.substring(0, i)] = value; 20 | } 21 | }); 22 | 23 | puts(fs.readFileSync(process.argv[2], "utf8").replace(/\{([^\}]+)\}/g, function(d, k) { 24 | d = formats[k]; 25 | return k === "grouping" 26 | ? d === "127" || d === "0" ? null : "[" + d.map(Number).join(", ") + "]" 27 | : d == null ? null : d.length > 1 ? "[" + d.map(quote).join(", ") + "]" : quote(d[0]); 28 | })); 29 | } 30 | 31 | function quote(d) { return '"' + d + '"'; } 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/quantile.js: -------------------------------------------------------------------------------- 1 | d3.scale.quantile = function() { 2 | return d3_scale_quantile([], []); 3 | }; 4 | 5 | function d3_scale_quantile(domain, range) { 6 | var thresholds; 7 | 8 | function rescale() { 9 | var k = 0, 10 | q = range.length; 11 | thresholds = []; 12 | while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); 13 | return scale; 14 | } 15 | 16 | function scale(x) { 17 | if (isNaN(x = +x)) return NaN; 18 | return range[d3.bisect(thresholds, x)]; 19 | } 20 | 21 | scale.domain = function(x) { 22 | if (!arguments.length) return domain; 23 | domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); 24 | return rescale(); 25 | }; 26 | 27 | scale.range = function(x) { 28 | if (!arguments.length) return range; 29 | range = x; 30 | return rescale(); 31 | }; 32 | 33 | scale.quantiles = function() { 34 | return thresholds; 35 | }; 36 | 37 | scale.copy = function() { 38 | return d3_scale_quantile(domain, range); // copy on write! 39 | }; 40 | 41 | return rescale(); 42 | } 43 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/hcl.js: -------------------------------------------------------------------------------- 1 | d3.hcl = function(h, c, l) { 2 | return arguments.length === 1 3 | ? (h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) 4 | : (h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) 5 | : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b))) 6 | : d3_hcl(+h, +c, +l); 7 | }; 8 | 9 | function d3_hcl(h, c, l) { 10 | return new d3_Hcl(h, c, l); 11 | } 12 | 13 | function d3_Hcl(h, c, l) { 14 | this.h = h; 15 | this.c = c; 16 | this.l = l; 17 | } 18 | 19 | var d3_hclPrototype = d3_Hcl.prototype = new d3_Color; 20 | 21 | d3_hclPrototype.brighter = function(k) { 22 | return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); 23 | }; 24 | 25 | d3_hclPrototype.darker = function(k) { 26 | return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); 27 | }; 28 | 29 | d3_hclPrototype.rgb = function() { 30 | return d3_hcl_lab(this.h, this.c, this.l).rgb(); 31 | }; 32 | 33 | function d3_hcl_lab(h, c, l) { 34 | return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); 35 | } 36 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/cartesian.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // cross and scale return new vectors, 3 | // whereas add and normalize operate in-place 4 | 5 | function d3_geo_cartesian(spherical) { 6 | var λ = spherical[0], 7 | φ = spherical[1], 8 | cosφ = Math.cos(φ); 9 | return [ 10 | cosφ * Math.cos(λ), 11 | cosφ * Math.sin(λ), 12 | Math.sin(φ) 13 | ]; 14 | } 15 | 16 | function d3_geo_cartesianDot(a, b) { 17 | return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 18 | } 19 | 20 | function d3_geo_cartesianCross(a, b) { 21 | return [ 22 | a[1] * b[2] - a[2] * b[1], 23 | a[2] * b[0] - a[0] * b[2], 24 | a[0] * b[1] - a[1] * b[0] 25 | ]; 26 | } 27 | 28 | function d3_geo_cartesianAdd(a, b) { 29 | a[0] += b[0]; 30 | a[1] += b[1]; 31 | a[2] += b[2]; 32 | } 33 | 34 | function d3_geo_cartesianScale(vector, k) { 35 | return [ 36 | vector[0] * k, 37 | vector[1] * k, 38 | vector[2] * k 39 | ]; 40 | } 41 | 42 | function d3_geo_cartesianNormalize(d) { 43 | var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); 44 | d[0] /= l; 45 | d[1] /= l; 46 | d[2] /= l; 47 | } 48 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-order-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("selection.order"); 7 | 8 | suite.addBatch({ 9 | "selectAll(div)": { 10 | topic: function() { 11 | return d3.select("body").html("").selectAll("div") 12 | .data([1, 2, 10, 20]) 13 | .enter().append("div") 14 | .attr("id", String); 15 | }, 16 | "orders elements by data": function(div) { 17 | div = div.data([1, 10, 20, 2], String).order(); 18 | assert.domNull(div[0][0].previousSibling); 19 | assert.domEqual(div[0][1].previousSibling, div[0][0]); 20 | assert.domEqual(div[0][2].previousSibling, div[0][1]); 21 | assert.domEqual(div[0][3].previousSibling, div[0][2]); 22 | assert.domNull(div[0][3].nextSibling); 23 | }, 24 | "returns the current selection": function(span) { 25 | span = d3.select("body"); // https://github.com/tmpvar/jsdom/issues/277 26 | assert.isTrue(span.order() === span); 27 | } 28 | } 29 | }); 30 | 31 | suite.export(module); 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/albers.js: -------------------------------------------------------------------------------- 1 | function d3_geo_albers(φ0, φ1) { 2 | var sinφ0 = Math.sin(φ0), 3 | n = (sinφ0 + Math.sin(φ1)) / 2, 4 | C = 1 + sinφ0 * (2 * n - sinφ0), 5 | ρ0 = Math.sqrt(C) / n; 6 | 7 | function albers(λ, φ) { 8 | var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; 9 | return [ 10 | ρ * Math.sin(λ *= n), 11 | ρ0 - ρ * Math.cos(λ) 12 | ]; 13 | } 14 | 15 | albers.invert = function(x, y) { 16 | var ρ0_y = ρ0 - y; 17 | return [ 18 | Math.atan2(x, ρ0_y) / n, 19 | Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) 20 | ]; 21 | }; 22 | 23 | return albers; 24 | } 25 | 26 | (d3.geo.albers = function() { 27 | var φ0 = 29.5 * d3_radians, 28 | φ1 = 45.5 * d3_radians, 29 | m = d3_geo_projectionMutator(d3_geo_albers), 30 | p = m(φ0, φ1); 31 | 32 | p.parallels = function(_) { 33 | if (!arguments.length) return [φ0 * d3_degrees, φ1 * d3_degrees]; 34 | return m(φ0 = _[0] * d3_radians, φ1 = _[1] * d3_radians); 35 | }; 36 | 37 | return p.rotate([98, 0]).center([0, 38]).scale(1000); 38 | }).raw = d3_geo_albers; 39 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/interpolate.js: -------------------------------------------------------------------------------- 1 | d3.geo.interpolate = function(source, target) { 2 | return d3_geo_interpolate( 3 | source[0] * d3_radians, source[1] * d3_radians, 4 | target[0] * d3_radians, target[1] * d3_radians 5 | ); 6 | } 7 | 8 | function d3_geo_interpolate(x0, y0, x1, y1) { 9 | var cy0 = Math.cos(y0), 10 | sy0 = Math.sin(y0), 11 | cy1 = Math.cos(y1), 12 | sy1 = Math.sin(y1), 13 | kx0 = cy0 * Math.cos(x0), 14 | ky0 = cy0 * Math.sin(x0), 15 | kx1 = cy1 * Math.cos(x1), 16 | ky1 = cy1 * Math.sin(x1), 17 | d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), 18 | k = 1 / Math.sin(d); 19 | 20 | function interpolate(t) { 21 | var B = Math.sin(t *= d) * k, 22 | A = Math.sin(d - t) * k, 23 | x = A * kx0 + B * kx1, 24 | y = A * ky0 + B * ky1, 25 | z = A * sy0 + B * sy1; 26 | return [ 27 | Math.atan2(y, x) / d3_radians, 28 | Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_radians 29 | ]; 30 | } 31 | 32 | interpolate.distance = d; 33 | 34 | return interpolate; 35 | }; 36 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/json-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.json"); 7 | 8 | suite.addBatch({ 9 | "json": { 10 | topic: function() { 11 | var cb = this.callback; 12 | d3.json("test/data/sample.json", function(error, json) { 13 | cb(null, json); 14 | }); 15 | }, 16 | "invokes the callback with the loaded JSON": function(json) { 17 | assert.deepEqual(json, [{"Hello":42,"World":"\"fish\""}]); 18 | }, 19 | "overrides the mime type to application/json": function(json) { 20 | assert.equal(XMLHttpRequest._last._info.mimeType, "application/json"); 21 | }, 22 | "": { 23 | topic: function() { 24 | var cb = this.callback; 25 | d3.json("//does/not/exist.json", function(error, json) { 26 | cb(null, json); 27 | }); 28 | }, 29 | "invokes the callback with undefined when an error occurs": function(json) { 30 | assert.isUndefined(json); 31 | } 32 | } 33 | } 34 | }); 35 | 36 | suite.export(module); 37 | -------------------------------------------------------------------------------- /app/lib/cmx/entities/label.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/entity', 'cmx/gizmos/label_gizmo'], (Entity, LabelGizmo) -> 2 | 3 | class Label extends Entity 4 | 5 | constructor: (scene, content) -> 6 | super(scene) 7 | 8 | @labelBones = @skelet.addBones [ 9 | ['HNDL', 0, 0, "h"], # handle 10 | ['TEXT', -60, 0, "t"], # text origin 11 | ] 12 | 13 | @skelet.addStructure 14 | 'HNDL': ['TEXT'] 15 | 16 | @setContent content 17 | 18 | buildGizmo: (root) -> 19 | @gizmo = new LabelGizmo @, root 20 | 21 | setPose: (pose) -> 22 | @skelet.setPose pose, @labelBones 23 | 24 | getPose: -> 25 | @skelet.getPose @labelBones 26 | 27 | setContent: (@content) -> 28 | 29 | drawText: -> 30 | f = (bone) => " #{bone.x},#{bone.y}" 31 | @register @scene.renderer.openGroup t:(=> "translate (#{f @skelet.bone 'TEXT'})") 32 | @register @scene.renderer.text @content, border:yes 33 | @register @scene.renderer.closeGroup() 34 | 35 | drawLayer: (layer) -> 36 | super 37 | 38 | @drawText() if layer is 0 # draw in non-zoomable layer on top frame -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mocha Spec Runner 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transition-test-call.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var assert = require("assert"); 4 | 5 | module.exports = { 6 | topic: function() { 7 | return d3.select("body").append("div").transition(); 8 | }, 9 | "calls the function once": function(transition) { 10 | var count = 0; 11 | transition.call(function() { ++count; }); 12 | assert.equal(count, 1); 13 | }, 14 | "passes any optional arguments": function(transition) { 15 | var abc; 16 | transition.call(function(selection, a, b, c) { abc = [a, b, c]; }, "a", "b", "c"); 17 | assert.deepEqual(abc, ["a", "b", "c"]); 18 | }, 19 | "passes the transition as the first argument": function(transition) { 20 | var t; 21 | transition.call(function(x) { t = x; }); 22 | assert.isTrue(t === transition); 23 | }, 24 | "uses the transition as the context": function(transition) { 25 | var t; 26 | transition.call(function() { t = this; }); 27 | assert.isTrue(t === transition); 28 | }, 29 | "returns the current transition": function(transition) { 30 | assert.isTrue(transition.call(function() {}) === transition); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/html-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.html"); 7 | 8 | suite.addBatch({ 9 | "html": { 10 | topic: function() { 11 | var cb = this.callback; 12 | d3.html("test/data/sample.html", function(error, document) { 13 | cb(null, document); 14 | }); 15 | }, 16 | "invokes the callback with the loaded html": function(document) { 17 | assert.equal(document.getElementsByTagName("H1")[0].textContent, "Hello & world!"); 18 | }, 19 | "override the mime type to text/html": function(xml) { 20 | assert.equal(XMLHttpRequest._last._info.mimeType, "text/html"); 21 | }, 22 | "": { 23 | topic: function() { 24 | var cb = this.callback; 25 | d3.html("//does/not/exist.html", function(error, document) { 26 | cb(null, document); 27 | }); 28 | }, 29 | "invokes the callback with undefined when an error occurs": function(document) { 30 | assert.isUndefined(document); 31 | } 32 | } 33 | } 34 | }); 35 | 36 | suite.export(module); 37 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transpose-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.transpose"); 7 | 8 | suite.addBatch({ 9 | "transpose": { 10 | topic: function() { 11 | return d3.transpose; 12 | }, 13 | "transposes a square matrix": function(transpose) { 14 | assert.deepEqual(d3.transpose([[1, 2], [3, 4]]), [[1, 3], [2, 4]]); 15 | }, 16 | "transposes a non-square matrix": function(transpose) { 17 | assert.deepEqual(d3.transpose([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]); 18 | }, 19 | "transposes a single-row matrix": function(transpose) { 20 | assert.deepEqual(d3.transpose([[1, 2, 3, 4, 5]]), [[1], [2], [3], [4], [5]]); 21 | }, 22 | "transposes an empty matrix": function(transpose) { 23 | assert.deepEqual(d3.transpose([]), []); 24 | }, 25 | "ignores extra elements given an irregular matrix": function(transpose) { 26 | assert.deepEqual(d3.transpose([[1, 2], [3, 4], [5, 6, 7]]), [[1, 3, 5], [2, 4, 6]]); 27 | } 28 | } 29 | }); 30 | 31 | suite.export(module); 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2012 Jeremy Ashkenas, DocumentCloud 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/path-area.js: -------------------------------------------------------------------------------- 1 | // TODO Unify this code with d3.geom.polygon area? 2 | 3 | var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { 4 | point: d3_noop, 5 | lineStart: d3_noop, 6 | lineEnd: d3_noop, 7 | 8 | // Only count area for polygon rings. 9 | polygonStart: function() { 10 | d3_geo_pathAreaPolygon = 0; 11 | d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; 12 | }, 13 | polygonEnd: function() { 14 | d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; 15 | d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2); 16 | } 17 | }; 18 | 19 | function d3_geo_pathAreaRingStart() { 20 | var x00, y00, x0, y0; 21 | 22 | // For the first point, … 23 | d3_geo_pathArea.point = function(x, y) { 24 | d3_geo_pathArea.point = nextPoint; 25 | x00 = x0 = x, y00 = y0 = y; 26 | }; 27 | 28 | // For subsequent points, … 29 | function nextPoint(x, y) { 30 | d3_geo_pathAreaPolygon += y0 * x - x0 * y; 31 | x0 = x, y0 = y; 32 | } 33 | 34 | // For the last point, return to the start. 35 | d3_geo_pathArea.lineEnd = function() { 36 | nextPoint(x00, y00); 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/path-context.js: -------------------------------------------------------------------------------- 1 | function d3_geo_pathContext(context) { 2 | var pointRadius = 4.5; 3 | 4 | var stream = { 5 | point: point, 6 | 7 | // While inside a line, override point to moveTo then lineTo. 8 | lineStart: function() { stream.point = pointLineStart; }, 9 | lineEnd: lineEnd, 10 | 11 | // While inside a polygon, override lineEnd to closePath. 12 | polygonStart: function() { stream.lineEnd = lineEndPolygon; }, 13 | polygonEnd: function() { stream.lineEnd = lineEnd; stream.point = point; }, 14 | 15 | pointRadius: function(_) { 16 | pointRadius = _; 17 | return stream; 18 | }, 19 | 20 | result: d3_noop 21 | }; 22 | 23 | function point(x, y) { 24 | context.moveTo(x, y); 25 | context.arc(x, y, pointRadius, 0, 2 * π); 26 | } 27 | 28 | function pointLineStart(x, y) { 29 | context.moveTo(x, y); 30 | stream.point = pointLine; 31 | } 32 | 33 | function pointLine(x, y) { 34 | context.lineTo(x, y); 35 | } 36 | 37 | function lineEnd() { 38 | stream.point = point; 39 | } 40 | 41 | function lineEndPolygon() { 42 | context.closePath(); 43 | } 44 | 45 | return stream; 46 | } 47 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013 2 | Antonin Hildebrand (antonin@hildebrand.cz) 3 | and contributors (https://github.com/darwin/cmx.js/contributors) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/README.md: -------------------------------------------------------------------------------- 1 | __ 2 | /\ \ __ 3 | __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____ 4 | /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\ 5 | \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\ 6 | \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/ 7 | \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/ 8 | \ \____/ 9 | \/___/ 10 | 11 | Underscore.js is a utility-belt library for JavaScript that provides 12 | support for the usual functional suspects (each, map, reduce, filter...) 13 | without extending any core JavaScript objects. 14 | 15 | For Docs, License, Tests, and pre-packed downloads, see: 16 | http://underscorejs.org 17 | 18 | Many thanks to our contributors: 19 | https://github.com/documentcloud/underscore/contributors 20 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/layout/tree-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.layout.tree"); 7 | 8 | suite.addBatch({ 9 | "tree": { 10 | topic: d3.layout.tree, 11 | "can handle an empty children array": function(tree) { 12 | assert.deepEqual(tree.nodes({children: []}).map(layout), [ 13 | {depth: 0, x: 0.5, y: 0} 14 | ]); 15 | assert.deepEqual(tree.nodes({children: [ 16 | {children: []}, 17 | {children: [{}]}, 18 | {children: [{}]} 19 | ]}).map(layout), [ 20 | {depth: 0, x: .5, y: 0}, 21 | {depth: 1, x: .125, y: 0.5}, 22 | {depth: 1, x: .375, y: 0.5}, 23 | {depth: 2, x: .375, y: 1}, 24 | {depth: 1, x: .875, y: 0.5}, 25 | {depth: 2, x: .875, y: 1} 26 | ]); 27 | }, 28 | "can handle a single node": function(tree) { 29 | assert.deepEqual(tree.nodes({value: 0}).map(layout), [ 30 | {depth: 0, x: 0.5, y: 0} 31 | ]); 32 | } 33 | } 34 | }); 35 | 36 | function layout(node) { 37 | return { 38 | depth: node.depth, 39 | x: node.x, 40 | y: node.y 41 | }; 42 | } 43 | 44 | suite.export(module); 45 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.selection"); 7 | 8 | suite.addBatch({ 9 | "selection": { 10 | topic: function() { 11 | return d3.selection(); 12 | }, 13 | "selects the document": function(selection) { 14 | assert.equal(selection.length, 1); 15 | assert.equal(selection[0].length, 1); 16 | assert.equal(selection[0][0], document); 17 | }, 18 | "is an instanceof d3.selection": function(selection) { 19 | assert.instanceOf(selection, d3.selection); 20 | }, 21 | "subselections are also instanceof d3.selection": function(selection) { 22 | assert.instanceOf(selection.select("body"), d3.selection); 23 | assert.instanceOf(selection.selectAll("body"), d3.selection); 24 | }, 25 | "selection prototype can be extended": function(selection) { 26 | d3.selection.prototype.foo = function(v) { return this.attr("foo", v); }; 27 | selection.select("body").foo(42); 28 | assert.equal(document.body.getAttribute("foo"), "42"); 29 | delete d3.selection.prototype.foo; 30 | } 31 | } 32 | }); 33 | 34 | suite.export(module); 35 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/mouse.js: -------------------------------------------------------------------------------- 1 | d3.mouse = function(container) { 2 | return d3_mousePoint(container, d3_eventSource()); 3 | }; 4 | 5 | // https://bugs.webkit.org/show_bug.cgi?id=44083 6 | var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; 7 | 8 | function d3_mousePoint(container, e) { 9 | var svg = container.ownerSVGElement || container; 10 | if (svg.createSVGPoint) { 11 | var point = svg.createSVGPoint(); 12 | if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) { 13 | svg = d3.select(document.body) 14 | .append("svg") 15 | .style("position", "absolute") 16 | .style("top", 0) 17 | .style("left", 0); 18 | var ctm = svg[0][0].getScreenCTM(); 19 | d3_mouse_bug44083 = !(ctm.f || ctm.e); 20 | svg.remove(); 21 | } 22 | if (d3_mouse_bug44083) { 23 | point.x = e.pageX; 24 | point.y = e.pageY; 25 | } else { 26 | point.x = e.clientX; 27 | point.y = e.clientY; 28 | } 29 | point = point.matrixTransform(container.getScreenCTM().inverse()); 30 | return [point.x, point.y]; 31 | } 32 | var rect = container.getBoundingClientRect(); 33 | return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop]; 34 | }; 35 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/entries-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.entries"); 7 | 8 | suite.addBatch({ 9 | "entries": { 10 | topic: function() { 11 | return d3.entries; 12 | }, 13 | "enumerates every entry": function(entries) { 14 | assert.deepEqual(entries({a: 1, b: 2}), [ 15 | {key: "a", value: 1}, 16 | {key: "b", value: 2} 17 | ]); 18 | }, 19 | "includes entries defined on prototypes": function(entries) { 20 | function abc() { 21 | this.a = 1; 22 | this.b = 2; 23 | } 24 | abc.prototype.c = 3; 25 | assert.deepEqual(entries(new abc()), [ 26 | {key: "a", value: 1}, 27 | {key: "b", value: 2}, 28 | {key: "c", value: 3} 29 | ]); 30 | }, 31 | "includes null or undefined values": function(entries) { 32 | var v = entries({a: undefined, b: null, c: NaN}); 33 | assert.equal(v.length, 3); 34 | assert.deepEqual(v[0], {key: "a", value: undefined}); 35 | assert.deepEqual(v[1], {key: "b", value: null}); 36 | assert.equal(v[2].key, "c"); 37 | assert.isNaN(v[2].value); 38 | } 39 | } 40 | }); 41 | 42 | suite.export(module); 43 | -------------------------------------------------------------------------------- /app/lib/cmx/controller.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/gizmo'], (Gizmo) -> 2 | 3 | instanceNumber = 0 4 | 5 | class Controller 6 | 7 | constructor: (@scenes=[]) -> 8 | @instanceNumber = ++instanceNumber 9 | @undoStack = [] 10 | @redoStack = [] 11 | 12 | makeEditable: -> 13 | for sceneModel in @scenes 14 | scene = sceneModel.view 15 | scene.buildGizmos() 16 | $(scene.rootElement).addClass("cmx-editable") 17 | 18 | $("html").bind("click", (event) => 19 | return if (d3.select(event.target).parents("cmx-selected").length>0) 20 | @unselectAll() 21 | ) 22 | 23 | unselectAll: -> 24 | return unless @previousSelection 25 | @previousSelection.unselect() 26 | @previousSelection = undefined 27 | $(".cmx-has-selected-gizmo").removeClass("cmx-has-selected-gizmo") 28 | $("html").removeClass("cmx-active-selection") 29 | 30 | registerUndo: (fn) -> 31 | @undoStack.push(fn) 32 | 33 | undo: -> 34 | return unless @undoStack.length 35 | action = @undoStack.pop() 36 | action() 37 | 38 | registerRedo: (fn) -> 39 | @redoStack.push(fn) 40 | 41 | redo: -> 42 | return unless @redoStack.length 43 | action = @redoStack.pop() 44 | action() 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-remove-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("selection.remove"); 7 | 8 | suite.addBatch({ 9 | "select(body)": { 10 | topic: function() { 11 | return d3.select("body"); 12 | }, 13 | "removes the matching elements": function(body) { 14 | var div = body.append("div"); 15 | div.remove(); 16 | assert.domNull(div[0][0].parentNode); 17 | }, 18 | "does not remove non-matching elements": function(body) { 19 | var div1 = body.append("div"), div2 = body.append("div"); 20 | div1.remove(); 21 | assert.domEqual(div2[0][0].parentNode, document.body); 22 | }, 23 | "ignores null nodes": function(body) { 24 | var div = body.html("").selectAll("div").data([0, 1]).enter().append("div"), 25 | some = d3.selectAll("div"); 26 | some[0][0] = null; 27 | some.remove(); 28 | assert.domEqual(div[0][0].parentNode, document.body); 29 | assert.domNull(div[0][1].parentNode); 30 | }, 31 | "returns the current selection": function(body) { 32 | var div = body.append("div"); 33 | assert.isTrue(div.remove() === div); 34 | } 35 | } 36 | }); 37 | 38 | suite.export(module); 39 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore.string", 3 | "version": "2.3.1", 4 | "description": "String manipulation extensions for Underscore.js javascript library.", 5 | "homepage": "http://epeli.github.com/underscore.string/", 6 | "contributors": [ 7 | "Esa-Matti Suuronen (http://esa-matti.suuronen.org/)", 8 | "Edward Tsech ", 9 | "Pavel Pravosud ()", 10 | "Sasha Koss (http://koss.nocorp.me/)", 11 | "Vladimir Dronnikov ", 12 | "Pete Kruckenberg ()", 13 | "Paul Chavard ()", 14 | "Ed Finkler ()" 15 | ], 16 | "keywords": [ 17 | "underscore", 18 | "string" 19 | ], 20 | "main": "./lib/underscore.string", 21 | "directories": { 22 | "lib": "./lib" 23 | }, 24 | "engines": { 25 | "node": "*" 26 | }, 27 | "repository": { 28 | "type": "git", 29 | "url": "https://github.com/epeli/underscore.string.git" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/epeli/underscore.string/issues" 33 | }, 34 | "licenses" : [ 35 | { "type" : "MIT" } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d3", 3 | "version": "3.0.4", 4 | "main": "./d3.js", 5 | "gitHead": "11a19ec03d21a2908ce2d0ceed954e6a41a58cfc", 6 | "readme": "# Data-Driven Documents\n\n**D3.js** is a JavaScript library for manipulating documents based on data. **D3** helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.\n\nWant to learn more? [See the wiki.](https://github.com/mbostock/d3/wiki)\n\nFor examples, [see the gallery](https://github.com/mbostock/d3/wiki/Gallery) and [mbostock’s bl.ocks](http://bl.ocks.org/mbostock).\n", 7 | "readmeFilename": "README.md", 8 | "_id": "d3@3.0.4", 9 | "description": "**D3.js** is a JavaScript library for manipulating documents based on data. **D3** helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/mbostock/d3.git" 13 | } 14 | } -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/layout/partition.js: -------------------------------------------------------------------------------- 1 | d3.layout.partition = function() { 2 | var hierarchy = d3.layout.hierarchy(), 3 | size = [1, 1]; // width, height 4 | 5 | function position(node, x, dx, dy) { 6 | var children = node.children; 7 | node.x = x; 8 | node.y = node.depth * dy; 9 | node.dx = dx; 10 | node.dy = dy; 11 | if (children && (n = children.length)) { 12 | var i = -1, 13 | n, 14 | c, 15 | d; 16 | dx = node.value ? dx / node.value : 0; 17 | while (++i < n) { 18 | position(c = children[i], x, d = c.value * dx, dy); 19 | x += d; 20 | } 21 | } 22 | } 23 | 24 | function depth(node) { 25 | var children = node.children, 26 | d = 0; 27 | if (children && (n = children.length)) { 28 | var i = -1, 29 | n; 30 | while (++i < n) d = Math.max(d, depth(children[i])); 31 | } 32 | return 1 + d; 33 | } 34 | 35 | function partition(d, i) { 36 | var nodes = hierarchy.call(this, d, i); 37 | position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); 38 | return nodes; 39 | } 40 | 41 | partition.size = function(x) { 42 | if (!arguments.length) return size; 43 | size = x; 44 | return partition; 45 | }; 46 | 47 | return d3_layout_hierarchyRebind(partition, hierarchy); 48 | }; 49 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/transition-test-time.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var assert = require("assert"); 4 | 5 | module.exports = { 6 | topic: function() { 7 | return d3.select("body").append("div").transition(); 8 | }, 9 | "is approximately equal to now": function(transition) { 10 | var time = transition[0][0].__transition__[transition.id].time; 11 | assert.inDelta(time, Date.now(), 20); 12 | }, 13 | "increases monotonically across transitions": function(transition) { 14 | var now = Date.now, then = Date.now(); 15 | try { 16 | Date.now = function() { return ++then; }; 17 | var t0 = d3.select("body").append("div").transition(), 18 | t1 = d3.select("body").append("div").transition(); 19 | assert.isTrue(t1[0][0].__transition__[t1.id].time > t0[0][0].__transition__[t0.id].time); 20 | } finally { 21 | Date.now = now; 22 | } 23 | }, 24 | "is inherited by subtransitions": function(transition) { 25 | var now = Date.now, then = Date.now(); 26 | try { 27 | Date.now = function() { return ++then; }; 28 | var t0 = d3.select("body").append("div").transition(), 29 | t1 = t0.transition(); 30 | assert.equal(t1[0][0].__transition__[t1.id].time, t0[0][0].__transition__[t0.id].time); 31 | } finally { 32 | Date.now = now; 33 | } 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/layout/cluster-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.layout.cluster"); 7 | 8 | suite.addBatch({ 9 | "cluster": { 10 | topic: d3.layout.cluster, 11 | "can handle an empty children array": function(cluster) { 12 | assert.deepEqual(cluster.nodes({value: 1, children: [{value: 1, children: []}, {value: 1}]}).map(layout), [ 13 | {value: 1, depth: 0, x: 0.5, y: 0}, 14 | {value: 1, depth: 1, x: 0.25, y: 1}, 15 | {value: 1, depth: 1, x: 0.75, y: 1} 16 | ]); 17 | }, 18 | "can handle zero-valued nodes": function(cluster) { 19 | assert.deepEqual(cluster.nodes({value: 0, children: [{value: 0}, {value: 1}]}).map(layout), [ 20 | {value: 0, depth: 0, x: 0.5, y: 0}, 21 | {value: 0, depth: 1, x: 0.25, y: 1}, 22 | {value: 1, depth: 1, x: 0.75, y: 1} 23 | ]); 24 | }, 25 | "can handle a single node": function(cluster) { 26 | assert.deepEqual(cluster.nodes({value: 0}).map(layout), [ 27 | {value: 0, depth: 0, x: 0.5, y: 0} 28 | ]); 29 | } 30 | } 31 | }); 32 | 33 | function layout(node) { 34 | return { 35 | value: node.value, 36 | depth: node.depth, 37 | x: node.x, 38 | y: node.y 39 | }; 40 | } 41 | 42 | suite.export(module); 43 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/path-buffer.js: -------------------------------------------------------------------------------- 1 | function d3_geo_pathBuffer() { 2 | var pointCircle = d3_geo_pathCircle(4.5), 3 | buffer = []; 4 | 5 | var stream = { 6 | point: point, 7 | 8 | // While inside a line, override point to moveTo then lineTo. 9 | lineStart: function() { stream.point = pointLineStart; }, 10 | lineEnd: lineEnd, 11 | 12 | // While inside a polygon, override lineEnd to closePath. 13 | polygonStart: function() { stream.lineEnd = lineEndPolygon; }, 14 | polygonEnd: function() { stream.lineEnd = lineEnd; stream.point = point; }, 15 | 16 | pointRadius: function(_) { 17 | pointCircle = d3_geo_pathCircle(_); 18 | return stream; 19 | }, 20 | 21 | result: function() { 22 | if (buffer.length) { 23 | var result = buffer.join(""); 24 | buffer = []; 25 | return result; 26 | } 27 | } 28 | }; 29 | 30 | function point(x, y) { 31 | buffer.push("M", x, ",", y, pointCircle); 32 | } 33 | 34 | function pointLineStart(x, y) { 35 | buffer.push("M", x, ",", y); 36 | stream.point = pointLine; 37 | } 38 | 39 | function pointLine(x, y) { 40 | buffer.push("L", x, ",", y); 41 | } 42 | 43 | function lineEnd() { 44 | stream.point = point; 45 | } 46 | 47 | function lineEndPolygon() { 48 | buffer.push("Z"); 49 | } 50 | 51 | return stream; 52 | } 53 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/select-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.select"); 7 | 8 | suite.addBatch({ 9 | "select": { 10 | topic: function() { 11 | var body = d3.select("body").html(""); 12 | body.append("span").attr("class", "f00").attr("id", "b4r").attr("name", "b4z"); 13 | body.append("div").attr("class", "foo").attr("id", "bar").attr("name", "baz"); 14 | return body; 15 | }, 16 | "selects by element name": function() { 17 | var div = d3.select("div"); 18 | assert.equal(div[0][0].tagName, "DIV"); 19 | }, 20 | "selects by class name": function() { 21 | var div = d3.select(".foo"); 22 | assert.equal(div[0][0].className, "foo"); 23 | }, 24 | "selects by id": function() { 25 | var div = d3.select("div#bar"); 26 | assert.equal(div[0][0].id, "bar"); 27 | }, 28 | "selects by attribute value": function() { 29 | var div = d3.select("[name=baz]"); 30 | assert.equal(div[0][0].getAttribute("name"), "baz"); 31 | }, 32 | "selects by node": function() { 33 | var div = d3.select(document.body.lastChild); 34 | assert.isTrue(div[0][0] === document.body.lastChild); 35 | assert.lengthOf(div, 1); 36 | assert.lengthOf(div[0], 1); 37 | } 38 | } 39 | }); 40 | 41 | suite.export(module); 42 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/map.js: -------------------------------------------------------------------------------- 1 | d3.map = function(object) { 2 | var map = new d3_Map; 3 | for (var key in object) map.set(key, object[key]); 4 | return map; 5 | }; 6 | 7 | function d3_Map() {} 8 | 9 | d3_class(d3_Map, { 10 | has: function(key) { 11 | return d3_map_prefix + key in this; 12 | }, 13 | get: function(key) { 14 | return this[d3_map_prefix + key]; 15 | }, 16 | set: function(key, value) { 17 | return this[d3_map_prefix + key] = value; 18 | }, 19 | remove: function(key) { 20 | key = d3_map_prefix + key; 21 | return key in this && delete this[key]; 22 | }, 23 | keys: function() { 24 | var keys = []; 25 | this.forEach(function(key) { keys.push(key); }); 26 | return keys; 27 | }, 28 | values: function() { 29 | var values = []; 30 | this.forEach(function(key, value) { values.push(value); }); 31 | return values; 32 | }, 33 | entries: function() { 34 | var entries = []; 35 | this.forEach(function(key, value) { entries.push({key: key, value: value}); }); 36 | return entries; 37 | }, 38 | forEach: function(f) { 39 | for (var key in this) { 40 | if (key.charCodeAt(0) === d3_map_prefixCode) { 41 | f.call(this, key.substring(1), this[key]); 42 | } 43 | } 44 | } 45 | }); 46 | 47 | var d3_map_prefix = "\0", // prevent collision with built-ins 48 | d3_map_prefixCode = d3_map_prefix.charCodeAt(0); 49 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/test/run-qunit.js: -------------------------------------------------------------------------------- 1 | function waitFor(test, complete, timeout) { 2 | var result, start = new Date().getTime() 3 | setInterval(function interval() { 4 | if ((new Date().getTime() - start < timeout) && !result) { 5 | result = test() 6 | } else { 7 | if (!result) { 8 | phantom.exit(1) 9 | } else { 10 | complete() 11 | clearInterval(interval) 12 | } 13 | } 14 | }, 100) 15 | } 16 | 17 | 18 | var fs = require('fs'), page = require('webpage').create(); 19 | var url = 'file://localhost' + fs.workingDirectory + '/' + phantom.args[0]; 20 | 21 | page.onConsoleMessage = function(msg) { 22 | console.log(msg) 23 | } 24 | 25 | page.open(url, function(status) { 26 | waitFor(function() { 27 | return page.evaluate(function(){ 28 | var el = document.getElementById('qunit-testresult') 29 | return el && el.innerText.match('completed') 30 | }) 31 | }, function() { 32 | var failures = page.evaluate(function() { 33 | var el = document.getElementById('qunit-testresult'), 34 | fails = document.getElementsByClassName('fail') 35 | 36 | for (var i = 0; i < fails.length; i++) 37 | console.log(fails[i].innerText) 38 | 39 | console.log(el.innerText) 40 | 41 | return parseInt(el.getElementsByClassName('failed')[0].innerHTML) 42 | }) 43 | phantom.exit(failures > 0 ? 1 : 0) 44 | }, 10000) 45 | }) -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/ascending-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.ascending"); 7 | 8 | suite.addBatch({ 9 | "numbers": { 10 | "returns a negative number if a < b": function() { 11 | assert.isTrue(d3.ascending(0, 1) < 0); 12 | }, 13 | "returns a positive number if a > b": function() { 14 | assert.isTrue(d3.ascending(1, 0) > 0); 15 | }, 16 | "returns zero if a == b": function() { 17 | assert.equal(d3.ascending(0, 0), 0); 18 | }, 19 | "returns NaN if a or b is undefined": function() { 20 | assert.isNaN(d3.ascending(0, undefined)); 21 | assert.isNaN(d3.ascending(undefined, 0)); 22 | assert.isNaN(d3.ascending(undefined, undefined)); 23 | }, 24 | "returns NaN if a or b is NaN": function() { 25 | assert.isNaN(d3.ascending(0, NaN)); 26 | assert.isNaN(d3.ascending(NaN, 0)); 27 | assert.isNaN(d3.ascending(NaN, NaN)); 28 | } 29 | } 30 | }); 31 | 32 | suite.addBatch({ 33 | "strings": { 34 | "returns a negative number if a < b": function() { 35 | assert.isTrue(d3.ascending("a", "b") < 0); 36 | }, 37 | "returns a positive number if a > b": function() { 38 | assert.isTrue(d3.ascending("b", "a") > 0); 39 | }, 40 | "returns zero if a == b": function() { 41 | assert.equal(d3.ascending("a", "a"), 0); 42 | } 43 | } 44 | }); 45 | 46 | suite.export(module); 47 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/text-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.text"); 7 | 8 | suite.addBatch({ 9 | "text": { 10 | topic: function() { 11 | var cb = this.callback; 12 | d3.text("test/data/sample.txt", function(error, text) { 13 | cb(null, text); 14 | }); 15 | }, 16 | "invokes the callback with the loaded text": function(text) { 17 | assert.equal(text, "Hello, world!\n"); 18 | }, 19 | "does not override the mime type by default": function(text) { 20 | assert.isUndefined(XMLHttpRequest._last._info.mimeType); 21 | }, 22 | "": { 23 | topic: function() { 24 | var cb = this.callback; 25 | d3.text("test/data/sample.txt", "text/plain+sample", function(error, text) { 26 | cb(null, text); 27 | }); 28 | }, 29 | "observes the optional mime type": function(text) { 30 | assert.equal(XMLHttpRequest._last._info.mimeType, "text/plain+sample"); 31 | } 32 | }, 33 | " ": { 34 | topic: function() { 35 | var cb = this.callback; 36 | d3.text("//does/not/exist.txt", function(error, text) { 37 | cb(null, text); 38 | }); 39 | }, 40 | "invokes the callback with undefined when an error occurs": function(text) { 41 | assert.isUndefined(text); 42 | } 43 | } 44 | } 45 | }); 46 | 47 | suite.export(module); 48 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/descending-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.descending"); 7 | 8 | suite.addBatch({ 9 | "numbers": { 10 | "returns a negative number if a > b": function() { 11 | assert.isTrue(d3.descending(1, 0) < 0); 12 | }, 13 | "returns a positive number if a < b": function() { 14 | assert.isTrue(d3.descending(0, 1) > 0); 15 | }, 16 | "returns zero if a == b": function() { 17 | assert.equal(d3.descending(0, 0), 0); 18 | }, 19 | "returns NaN if a or b is undefined": function() { 20 | assert.isNaN(d3.descending(0, undefined)); 21 | assert.isNaN(d3.descending(undefined, 0)); 22 | assert.isNaN(d3.descending(undefined, undefined)); 23 | }, 24 | "returns NaN if a or b is NaN": function() { 25 | assert.isNaN(d3.descending(0, NaN)); 26 | assert.isNaN(d3.descending(NaN, 0)); 27 | assert.isNaN(d3.descending(NaN, NaN)); 28 | } 29 | } 30 | }); 31 | 32 | suite.addBatch({ 33 | "strings": { 34 | "returns a negative number if a > b": function() { 35 | assert.isTrue(d3.descending("b", "a") < 0); 36 | }, 37 | "returns a positive number if a < b": function() { 38 | assert.isTrue(d3.descending("a", "b") > 0); 39 | }, 40 | "returns zero if a == b": function() { 41 | assert.equal(d3.descending("a", "a"), 0); 42 | } 43 | } 44 | }); 45 | 46 | suite.export(module); 47 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/touch-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | 62 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/pow.js: -------------------------------------------------------------------------------- 1 | d3.scale.pow = function() { 2 | return d3_scale_pow(d3.scale.linear(), 1); 3 | }; 4 | 5 | function d3_scale_pow(linear, exponent) { 6 | var powp = d3_scale_powPow(exponent), 7 | powb = d3_scale_powPow(1 / exponent); 8 | 9 | function scale(x) { 10 | return linear(powp(x)); 11 | } 12 | 13 | scale.invert = function(x) { 14 | return powb(linear.invert(x)); 15 | }; 16 | 17 | scale.domain = function(x) { 18 | if (!arguments.length) return linear.domain().map(powb); 19 | linear.domain(x.map(powp)); 20 | return scale; 21 | }; 22 | 23 | scale.ticks = function(m) { 24 | return d3_scale_linearTicks(scale.domain(), m); 25 | }; 26 | 27 | scale.tickFormat = function(m) { 28 | return d3_scale_linearTickFormat(scale.domain(), m); 29 | }; 30 | 31 | scale.nice = function() { 32 | return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); 33 | }; 34 | 35 | scale.exponent = function(x) { 36 | if (!arguments.length) return exponent; 37 | var domain = scale.domain(); 38 | powp = d3_scale_powPow(exponent = x); 39 | powb = d3_scale_powPow(1 / exponent); 40 | return scale.domain(domain); 41 | }; 42 | 43 | scale.copy = function() { 44 | return d3_scale_pow(linear.copy(), exponent); 45 | }; 46 | 47 | return d3_scale_linearRebind(scale, linear); 48 | } 49 | 50 | function d3_scale_powPow(e) { 51 | return function(x) { 52 | return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Underscore.strings Test Suite 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

    Underscore.string Test Suite

    17 |

    18 |

    19 |
      20 |
      21 |

      Underscore.string Speed Suite

      22 | 29 |
      30 | 31 | 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-node-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("selection.node"); 7 | 8 | suite.addBatch({ 9 | "select(body)": { 10 | topic: function() { 11 | return d3.select("body").html(""); 12 | }, 13 | "returns null for empty selections": function(body) { 14 | assert.isNull(body.select("foo").node()); 15 | }, 16 | "returns the first element for non-empty selections": function(body) { 17 | assert.isTrue(body.node() === document.body); 18 | }, 19 | "ignores null nodes": function(body) { 20 | var some = d3.select("body"); 21 | some[0][0] = null; 22 | assert.isNull(some.node()); 23 | } 24 | } 25 | }); 26 | 27 | suite.addBatch({ 28 | "selectAll(div)": { 29 | topic: function() { 30 | var body = d3.select("body").html(""); 31 | body.append("div").append("span"); 32 | body.append("div"); 33 | return body.selectAll("div"); 34 | }, 35 | "returns null for empty selections": function(div) { 36 | assert.isNull(div.select("foo").node()); 37 | }, 38 | "returns the first element for non-empty selections": function(div) { 39 | assert.isTrue(div.node() === div[0][0]); 40 | }, 41 | "ignores null nodes": function(div) { 42 | var some = d3.selectAll("div"); 43 | some[0][0] = null; 44 | assert.isTrue(some.node() === div[0][1]); 45 | } 46 | } 47 | }); 48 | 49 | suite.export(module); 50 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Michael Bostock 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * The name Michael Bostock may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selection-empty-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("selection.empty"); 7 | 8 | suite.addBatch({ 9 | "select(body)": { 10 | topic: function() { 11 | return d3.select("body").html(""); 12 | }, 13 | "returns true for empty selections": function(body) { 14 | assert.isTrue(body.select("foo").empty()); 15 | }, 16 | "returns false for non-empty selections": function(body) { 17 | assert.isFalse(body.empty()); 18 | }, 19 | "ignores null nodes": function(body) { 20 | var some = d3.select("body"); 21 | some[0][0] = null; 22 | assert.isTrue(some.empty()); 23 | } 24 | } 25 | }); 26 | 27 | suite.addBatch({ 28 | "selectAll(div)": { 29 | topic: function() { 30 | var body = d3.select("body").html(""); 31 | body.append("div").append("span"); 32 | body.append("div"); 33 | return body.selectAll("div"); 34 | }, 35 | "returns true for empty selections": function(div) { 36 | assert.isTrue(div.select("foo").empty()); 37 | }, 38 | "returns false for non-empty selections": function(div) { 39 | assert.isFalse(div.empty()); 40 | assert.isFalse(div.select("span").empty()); 41 | }, 42 | "ignores null nodes": function(div) { 43 | var some = d3.selectAll("div"); 44 | some[0][0] = null; 45 | assert.isTrue(some.select("span").empty()); 46 | } 47 | } 48 | }); 49 | 50 | suite.export(module); 51 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/queue/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Michael Bostock 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * The name Michael Bostock may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/science/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Jason Davies 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * The name Jason Davies may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/selection-property.js: -------------------------------------------------------------------------------- 1 | d3_selectionPrototype.property = function(name, value) { 2 | if (arguments.length < 2) { 3 | 4 | // For property(string), return the property value for the first node. 5 | if (typeof name === "string") return this.node()[name]; 6 | 7 | // For property(object), the object specifies the names and values of the 8 | // properties to set or remove. The values may be functions that are 9 | // evaluated for each element. 10 | for (value in name) this.each(d3_selection_property(value, name[value])); 11 | return this; 12 | } 13 | 14 | // Otherwise, both a name and a value are specified, and are handled as below. 15 | return this.each(d3_selection_property(name, value)); 16 | }; 17 | 18 | function d3_selection_property(name, value) { 19 | 20 | // For property(name, null), remove the property with the specified name. 21 | function propertyNull() { 22 | delete this[name]; 23 | } 24 | 25 | // For property(name, string), set the property with the specified name. 26 | function propertyConstant() { 27 | this[name] = value; 28 | } 29 | 30 | // For property(name, function), evaluate the function for each element, and 31 | // set or remove the property as appropriate. 32 | function propertyFunction() { 33 | var x = value.apply(this, arguments); 34 | if (x == null) delete this[name]; 35 | else this[name] = x; 36 | } 37 | 38 | return value == null 39 | ? propertyNull : (typeof value === "function" 40 | ? propertyFunction : propertyConstant); 41 | } 42 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/xml-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.xml"); 7 | 8 | suite.addBatch({ 9 | "xml": { 10 | topic: function() { 11 | var cb = this.callback; 12 | d3.xml("test/data/sample.xml", function(error, xml) { 13 | cb(null, xml); 14 | }); 15 | }, 16 | "invokes the callback with the loaded xml": function(xml) { 17 | assert.deepEqual(xml, {_xml: "\n\n \n\n"}); 18 | }, 19 | "does not override the mime type by default": function(xml) { 20 | assert.isUndefined(XMLHttpRequest._last._info.mimeType); 21 | }, 22 | "": { 23 | topic: function() { 24 | var cb = this.callback; 25 | d3.xml("test/data/sample.txt", "application/xml+sample", function(error, xml) { 26 | cb(null, xml); 27 | }); 28 | }, 29 | "observes the optional mime type": function(xml) { 30 | assert.equal(XMLHttpRequest._last._info.mimeType, "application/xml+sample"); 31 | } 32 | }, 33 | " ": { 34 | topic: function() { 35 | var cb = this.callback; 36 | d3.xml("//does/not/exist.xml", function(error, xml) { 37 | cb(null, xml); 38 | }); 39 | }, 40 | "invokes the callback with undefined when an error occurs": function(xml) { 41 | assert.isUndefined(xml); 42 | } 43 | } 44 | } 45 | }); 46 | 47 | suite.export(module); 48 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/env-xhr.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | 3 | XMLHttpRequest = function() { 4 | var self = this, 5 | info = self._info = {}, 6 | headers = {}, 7 | url; 8 | 9 | // TODO handle file system errors? 10 | 11 | self.open = function(m, u, a) { 12 | info.url = u; 13 | info.async = a; 14 | self.send = a ? read : readSync; 15 | }; 16 | 17 | self.setRequestHeader = function(n, v) { 18 | if (/^Accept$/i.test(n)) info.mimeType = v.split(/,/g)[0]; 19 | }; 20 | 21 | function read() { 22 | fs.readFile(info.url, "binary", function(e, d) { 23 | if (e) { 24 | self.status = 404; // assumed 25 | } else { 26 | self.status = 200; 27 | self.responseText = d; 28 | self.responseXML = {_xml: d}; 29 | headers["Content-Length"] = d.length; 30 | } 31 | self.readyState = 4; 32 | XMLHttpRequest._last = self; 33 | if (self.onreadystatechange) self.onreadystatechange(); 34 | }); 35 | } 36 | 37 | function readSync() { 38 | try { 39 | var d = fs.readFileSync(info.url, "binary"); 40 | self.status = 200; 41 | self.responseText = d; 42 | self.responseXML = {_xml: d}; 43 | headers["Content-Length"] = d.length; 44 | } catch (e) { 45 | self.status = 404; // assumed 46 | } 47 | self.readyState = 4; 48 | XMLHttpRequest._last = self; 49 | if (self.onreadystatechange) self.onreadystatechange(); 50 | } 51 | 52 | self.getResponseHeader = function(n) { 53 | return headers[n]; 54 | }; 55 | }; 56 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore-amd/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Underscore Test Suite 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
      21 |
      22 |
      23 |
      24 |
      25 |
      26 |
      27 |
      28 |

      Underscore Speed Suite

      29 |

      30 | A representative sample of the functions are benchmarked here, to provide 31 | a sense of how fast they might run in different browsers. 32 | Each iteration runs on an array of 1000 elements.

      33 | For example, the 'intersection' test measures the number of times you can 34 | find the intersection of two thousand-element arrays in one second. 35 |

      36 |
      37 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/sizzle/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, John Resig 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY John Resig ''AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/jit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Nicolas Garcia Belmonte 2 | All rights reserved 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the organization nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY NICOLAS GARCIA BELMONTE ``AS IS'' AND ANY EXPRESS 19 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 21 | EVENT SHALL NICOLAS GARCIA BELMONTE BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/requote-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.requote"); 7 | 8 | suite.addBatch({ 9 | "requote": { 10 | topic: function() { 11 | return d3.requote; 12 | }, 13 | "quotes backslashes": function(quote) { 14 | assert.equal(quote("\\"), "\\\\"); 15 | }, 16 | "quotes carets": function(quote) { 17 | assert.equal(quote("^"), "\\^"); 18 | }, 19 | "quotes dollar signs": function(quote) { 20 | assert.equal(quote("$"), "\\$"); 21 | }, 22 | "quotes stars": function(quote) { 23 | assert.equal(quote("*"), "\\*"); 24 | }, 25 | "quotes plusses": function(quote) { 26 | assert.equal(quote("+"), "\\+"); 27 | }, 28 | "quotes question marks": function(quote) { 29 | assert.equal(quote("?"), "\\?"); 30 | }, 31 | "quotes periods": function(quote) { 32 | assert.equal(quote("."), "\\."); 33 | }, 34 | "quotes parentheses": function(quote) { 35 | assert.equal(quote("("), "\\("); 36 | assert.equal(quote(")"), "\\)"); 37 | }, 38 | "quotes pipes": function(quote) { 39 | assert.equal(quote("|"), "\\|"); 40 | }, 41 | "quotes curly braces": function(quote) { 42 | assert.equal(quote("{"), "\\{"); 43 | assert.equal(quote("}"), "\\}"); 44 | }, 45 | "quotes square brackets": function(quote) { 46 | assert.equal(quote("["), "\\["); 47 | assert.equal(quote("]"), "\\]"); 48 | } 49 | } 50 | }); 51 | 52 | suite.export(module); 53 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/time/scale-utc.js: -------------------------------------------------------------------------------- 1 | var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { 2 | return [m[0].utc, m[1]]; 3 | }); 4 | 5 | var d3_time_scaleUTCFormats = [ 6 | [d3.time.format.utc("%Y"), d3_true], 7 | [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }], 8 | [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }], 9 | [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }], 10 | [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }], 11 | [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }], 12 | [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); }], 13 | [d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); }] 14 | ]; 15 | 16 | var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); 17 | 18 | function d3_time_scaleUTCSetYear(y) { 19 | var d = new Date(Date.UTC(y, 0, 1)); 20 | d.setUTCFullYear(y); // Y2K fail 21 | return d; 22 | } 23 | 24 | function d3_time_scaleUTCGetYear(d) { 25 | var y = d.getUTCFullYear(), 26 | d0 = d3_time_scaleUTCSetYear(y), 27 | d1 = d3_time_scaleUTCSetYear(y + 1); 28 | return y + (d - d0) / (d1 - d0); 29 | } 30 | 31 | d3_time_scaleUTCMethods.year = function(extent, m) { 32 | return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); 33 | }; 34 | 35 | d3.time.scale.utc = function() { 36 | return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); 37 | }; 38 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/polymaps/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, SimpleGeo and Stamen Design 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of SimpleGeo nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL SIMPLEGEO BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /app/edit/styles/cmx.css: -------------------------------------------------------------------------------- 1 | scene { 2 | display: none; 3 | } 4 | 5 | @font-face { 6 | font-family: 'xkcd'; 7 | src: url('/fonts/xkcd.eot'); 8 | src: url('/fonts/xkcd.eot?#iefix') format('embedded-opentype'), 9 | url('/fonts/xkcd.woff') format('woff'), 10 | url('/fonts/xkcd.ttf') format('tff'); 11 | font-weight: normal; 12 | font-style: normal; 13 | } 14 | 15 | .cmx-scene { 16 | float: left; 17 | 18 | font-family: "xkcd", sans-serif; 19 | font-size: 14px; 20 | background-color: white; 21 | margin: 0px; 22 | position: relative; 23 | 24 | -moz-transition: all 0.6s ease-out; 25 | -o-transition: all 0.6s ease-out; 26 | -webkit-transition: all 0.6s ease-out; 27 | -ms-transition: all 0.6s ease-out; 28 | transition: all 0.6s ease-out; 29 | } 30 | 31 | .cmx-scene svg { 32 | display: block; 33 | } 34 | 35 | .cmx-path { 36 | fill: none; 37 | stroke-width: 2.5px; 38 | stroke-linecap: round; 39 | stroke-linejoin: round; 40 | } 41 | 42 | .cmx-back { 43 | stroke: white; 44 | } 45 | 46 | .cmx-back .cmx-text { 47 | shape-rendering: optimizeSpeed; 48 | text-rendering: optimizeSpeed; 49 | fill: none; 50 | stroke-opacity: 1; 51 | stroke-width: 8px; 52 | stroke-linecap: butt; 53 | stroke-linejoin: miter; 54 | } 55 | 56 | .cmx-back .cmx-path { 57 | stroke-width: 6px; 58 | } 59 | 60 | .cmx-front { 61 | stroke: black; 62 | } 63 | 64 | .cmx-front .cmx-path { 65 | stroke-width: 3px; 66 | } 67 | 68 | .cmx-front .cmx-text { 69 | stroke: none; 70 | } 71 | 72 | .cmx-text-border .cmx-path { 73 | stroke: black; 74 | fill: white; 75 | stroke-width: 2px; 76 | } -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/protovis/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Stanford Visualization Group 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Stanford University nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/underscore.string/test/test_underscore/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Underscore Test Suite 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
      22 |
      23 |
      24 |
      25 |
      26 |
      27 |
      28 |
      29 |

      Underscore Speed Suite

      30 |

      31 | A representative sample of the functions are benchmarked here, to provide 32 | a sense of how fast they might run in different browsers. 33 | Each iteration runs on an array of 1000 elements.

      34 | For example, the 'intersection' test measures the number of times you can 35 | find the intersection of two thousand-element arrays in one second. 36 |

      37 |
      38 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/lib/cmx/gizmos/drawing_gizmo.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/gizmos/entity_gizmo'], (EntityGizmo) -> 2 | 3 | class DrawingGizmo extends EntityGizmo 4 | 5 | update: -> 6 | super 7 | 8 | @ΔskeletonGizmo?.selectAll(".cmx-control") 9 | .attr("cx", (bone) -> bone.x) 10 | .attr("cy", (bone) -> bone.y) 11 | .style("display", (bone) => 12 | return 13 | ) 14 | 15 | build: -> 16 | base = super 17 | 18 | @ΔskeletonGizmo = base.append("g").attr("class", "cmx-gizmo cmx-drawing") 19 | 20 | resetBone = (bone) => 21 | @entity.skelet.moveBone(bone.name, 0, 0, yes) 22 | @entity.throttledUpdate() 23 | 24 | doubleClick = (bone) => 25 | d3.event.preventDefault() 26 | return resetBone(bone) if bone.name is 'HNDL' 27 | 28 | drag = d3.behavior.drag() 29 | .on "dragstart", (bone) => 30 | @controlUndoOpen "pose" 31 | @controlDragStart(bone) 32 | .on "dragend", (bone) => 33 | @controlDragEnd(bone) 34 | @controlUndoClose() 35 | .on "drag", (bone) => 36 | @entity.skelet.moveBone(bone.name, d3.event.dx, d3.event.dy, no) 37 | @entity.throttledUpdate() 38 | 39 | data = @entity.skelet.bonesWithIndices @entity.drawingBones 40 | @ΔskeletonGizmo.selectAll(".cmx-control") 41 | .data(data) 42 | .enter() 43 | .append("circle") 44 | .attr("class", (bone) -> "cmx-control cmx-#{bone.type}") 45 | .attr("r", @CONTROL_POINT_RADIUS) 46 | .on("dblclick", doubleClick) 47 | .call(drag) 48 | 49 | @ΔskeletonGizmo 50 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/geo/circle-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.geo.circle"); 7 | 8 | suite.addBatch({ 9 | "circle": { 10 | topic: d3.geo.circle, 11 | "generates a Polygon": function(circle) { 12 | var o = circle(); 13 | assert.equal(o.type, "Polygon"); 14 | assert.inDelta(o.coordinates, [[[-78.690067, -90], [-90, -84], [-90, -78], [-90, -72], [-90, -66], [-90, -60], [-90, -54], [-90, -48], [-90, -42], [-90, -36], [-90, -30], [-90, -24], [-90, -18], [-90, -12], [-90, -6], [-90, 0], [-90, 6], [-90, 12], [-90, 18], [-90, 24], [-90, 30], [-90, 36], [-90, 42], [-90, 48], [-90, 54], [-90, 60], [-90, 66], [-90, 72], [-90, 78], [-90, 84], [-89.596672, 90], [90, 84], [90, 78], [90, 72], [90, 66], [90, 60], [90, 54], [90, 48], [90, 42], [90, 36], [90, 30], [90, 24], [90, 18], [90, 12], [90, 6], [90, 0], [90, -6], [90, -12], [90, -18], [90, -24], [90, -30], [90, -36], [90, -42], [90, -48], [90, -54], [90, -60], [90, -66], [90, -72], [90, -78], [90, -84], [89.569782, -90]]], 1e-6); 15 | }, 16 | "origin([0, 90])": function(circle) { 17 | var o = circle.origin([0, 90])(); 18 | assert.equal(o.type, "Polygon"); 19 | assert.inDelta(o.coordinates, [d3.range(360, -1, -6).map(function(x) { return [x >= 180 ? x - 360 : x, 0]; })], 1e-6); 20 | }, 21 | "origin([45, 45])": function(circle) { 22 | var o = circle.origin([45, 45]).angle(0)(); 23 | assert.equal(o.type, "Polygon"); 24 | assert.inDelta(o.coordinates[0][0], [45, 45], 1e-6); 25 | } 26 | } 27 | }); 28 | 29 | suite.export(module); 30 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/layout/partition-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.layout.partition"); 7 | 8 | suite.addBatch({ 9 | "partition": { 10 | topic: function() { 11 | return d3.layout.partition; 12 | }, 13 | "ignores zero values": function(partition) { 14 | var p = partition().size([3, 3]); 15 | assert.deepEqual(p.nodes({children: [{value: 1}, {value: 0}, {value: 2}, {children: [{value: 0}, {value: 0}]}]}).map(metadata), [ 16 | {x: 0, y: 0, dx: 3, dy: 1}, 17 | {x: 2, y: 1, dx: 1, dy: 1}, 18 | {x: 3, y: 1, dx: 0, dy: 1}, 19 | {x: 0, y: 1, dx: 2, dy: 1}, 20 | {x: 3, y: 1, dx: 0, dy: 1}, 21 | {x: 3, y: 2, dx: 0, dy: 1}, 22 | {x: 3, y: 2, dx: 0, dy: 1} 23 | ]); 24 | }, 25 | "can handle an empty children array": function(partition) { 26 | var p = partition(); 27 | assert.deepEqual(p.nodes({children: []}).map(metadata), [ 28 | {x: 0, y: 0, dx: 1, dy: 1} 29 | ]); 30 | assert.deepEqual(p.nodes({children: [{children: []}, {value: 1}]}).map(metadata), [ 31 | {x: 0, y: 0, dx: 1, dy: 0.5}, 32 | {x: 1, y: 0.5, dx: 0, dy: 0.5}, 33 | {x: 0, y: 0.5, dx: 1, dy: 0.5} 34 | ]); 35 | } 36 | } 37 | }); 38 | 39 | function metadata(node) { 40 | var metadata = {}; 41 | if ("x" in node) metadata.x = node.x; 42 | if ("y" in node) metadata.y = node.y; 43 | if ("dx" in node) metadata.dx = node.dx; 44 | if ("dy" in node) metadata.dy = node.dy; 45 | return metadata; 46 | } 47 | 48 | suite.export(module); 49 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/mean-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.mean"); 7 | 8 | suite.addBatch({ 9 | "mean": { 10 | topic: function() { 11 | return d3.mean; 12 | }, 13 | "returns the mean value for numbers": function(mean) { 14 | assert.equal(mean([1]), 1); 15 | assert.equal(mean([5, 1, 2, 3, 4]), 3); 16 | assert.equal(mean([20, 3]), 11.5); 17 | assert.equal(mean([3, 20]), 11.5); 18 | }, 19 | "ignores null, undefined and NaN": function(mean) { 20 | assert.equal(mean([NaN, 1, 2, 3, 4, 5]), 3); 21 | assert.equal(mean([1, 2, 3, 4, 5, NaN]), 3); 22 | assert.equal(mean([10, null, 3, undefined, 5, NaN]), 6); 23 | }, 24 | "can handle large numbers without overflowing": function(mean) { 25 | assert.equal(mean([Number.MAX_VALUE, Number.MAX_VALUE]), Number.MAX_VALUE); 26 | assert.equal(mean([-Number.MAX_VALUE, -Number.MAX_VALUE]), -Number.MAX_VALUE); 27 | }, 28 | "returns undefined for empty array": function(mean) { 29 | assert.isUndefined(mean([])); 30 | assert.isUndefined(mean([null])); 31 | assert.isUndefined(mean([undefined])); 32 | assert.isUndefined(mean([NaN])); 33 | assert.isUndefined(mean([NaN, NaN])); 34 | }, 35 | "applies the optional accessor function": function(mean) { 36 | assert.equal(d3.mean([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]], function(d) { return d3.mean(d); }), 4.5); 37 | assert.equal(d3.mean([1, 2, 3, 4, 5], function(d, i) { return i; }), 2); 38 | } 39 | } 40 | }); 41 | 42 | suite.export(module); 43 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/geo/rotation.js: -------------------------------------------------------------------------------- 1 | // Note: |δλ| and |δφ| must be < 2π 2 | function d3_geo_rotation(δλ, δφ, δγ) { 3 | return δλ ? (δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) 4 | : d3_geo_rotationλ(δλ)) 5 | : (δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) 6 | : d3_geo_equirectangular); 7 | } 8 | 9 | function d3_geo_forwardRotationλ(δλ) { 10 | return function(λ, φ) { 11 | return λ += δλ, [λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ]; 12 | }; 13 | } 14 | 15 | function d3_geo_rotationλ(δλ) { 16 | var rotation = d3_geo_forwardRotationλ(δλ); 17 | rotation.invert = d3_geo_forwardRotationλ(-δλ); 18 | return rotation; 19 | } 20 | 21 | function d3_geo_rotationφγ(δφ, δγ) { 22 | var cosδφ = Math.cos(δφ), 23 | sinδφ = Math.sin(δφ), 24 | cosδγ = Math.cos(δγ), 25 | sinδγ = Math.sin(δγ); 26 | 27 | function rotation(λ, φ) { 28 | var cosφ = Math.cos(φ), 29 | x = Math.cos(λ) * cosφ, 30 | y = Math.sin(λ) * cosφ, 31 | z = Math.sin(φ), 32 | k = z * cosδφ + x * sinδφ; 33 | return [ 34 | Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), 35 | Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) 36 | ]; 37 | } 38 | 39 | rotation.invert = function(λ, φ) { 40 | var cosφ = Math.cos(φ), 41 | x = Math.cos(λ) * cosφ, 42 | y = Math.sin(λ) * cosφ, 43 | z = Math.sin(φ), 44 | k = z * cosδγ - y * sinδγ; 45 | return [ 46 | Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), 47 | Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) 48 | ]; 49 | }; 50 | 51 | return rotation; 52 | } 53 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/selectAll-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.selectAll"); 7 | 8 | suite.addBatch({ 9 | "selectAll": { 10 | topic: function() { 11 | var body = d3.select("body").html(""); 12 | body.append("span").attr("class", "f00").attr("id", "b4r").attr("name", "b4z"); 13 | body.append("div").attr("class", "foo").attr("id", "bar").attr("name", "baz"); 14 | return body; 15 | }, 16 | "selects by element name": function() { 17 | var div = d3.selectAll("div"); 18 | assert.equal(div[0][0].tagName, "DIV"); 19 | }, 20 | "selects by class name": function() { 21 | var div = d3.selectAll(".foo"); 22 | assert.equal(div[0][0].className, "foo"); 23 | }, 24 | "selects by id": function() { 25 | var div = d3.select("div#bar"); 26 | assert.equal(div[0][0].id, "bar"); 27 | }, 28 | "selects by attribute value": function() { 29 | var div = d3.selectAll("[name=baz]"); 30 | assert.equal(div[0][0].getAttribute("name"), "baz"); 31 | }, 32 | "selects by array": function() { 33 | var div = d3.selectAll([document.body.lastChild]); 34 | assert.isTrue(div[0][0] === document.body.lastChild); 35 | assert.lengthOf(div, 1); 36 | assert.lengthOf(div[0], 1); 37 | }, 38 | "groups are not instances of NodeList": function() { 39 | var div = d3.select("body").selectAll(function() { return this.getElementsByClassName("div"); }); 40 | assert.isFalse(div[0] instanceof window.NodeList); 41 | } 42 | } 43 | }); 44 | 45 | suite.export(module); 46 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/geo/equirectangular-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.geo.equirectangular"); 7 | 8 | suite.addBatch({ 9 | "equirectangular": { 10 | topic: function() { 11 | return d3.geo.equirectangular(); 12 | }, 13 | 14 | "scale": { 15 | "defaults to 500 / 2π": function(projection) { 16 | assert.equal(projection.scale(), 500 / (2 * Math.PI)); 17 | }, 18 | "is coerced to a number": function(projection) { 19 | assert.strictEqual(projection.scale("400"), projection); 20 | assert.strictEqual(projection.scale(), 400); 21 | projection.scale(500 / (2 * Math.PI)); 22 | } 23 | }, 24 | 25 | "translate": { 26 | "defaults to [480, 250]": function(projection) { 27 | assert.deepEqual(projection.translate(), [480, 250]); 28 | }, 29 | "is coerced to two numbers": function(projection) { 30 | assert.strictEqual(projection.translate(["23", "141"]), projection); 31 | assert.strictEqual(projection.translate()[0], 23); 32 | assert.strictEqual(projection.translate()[1], 141); 33 | projection.translate([480, 250]); 34 | } 35 | }, 36 | 37 | "of San Francisco, CA": { 38 | "is at location [-122.446, 37.767]": function(projection) { 39 | assert.inDelta(projection.invert([310, 198]), [-122.446, 37.767], .5); 40 | }, 41 | "is at point [310, 198]": function(projection) { 42 | assert.inDelta(projection([-122.446, 37.767]), [310, 198], .5); 43 | } 44 | } 45 | } 46 | }); 47 | 48 | suite.export(module); 49 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/lib/penner/LICENSE: -------------------------------------------------------------------------------- 1 | TERMS OF USE - EASING EQUATIONS 2 | 3 | Open source under the BSD License. 4 | 5 | Copyright 2001 Robert Penner 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | - Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the author nor the names of contributors may be used to 19 | endorse or promote products derived from this software without specific prior 20 | written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/hsl.js: -------------------------------------------------------------------------------- 1 | d3.hsl = function(h, s, l) { 2 | return arguments.length === 1 3 | ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) 4 | : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) 5 | : d3_hsl(+h, +s, +l); 6 | }; 7 | 8 | function d3_hsl(h, s, l) { 9 | return new d3_Hsl(h, s, l); 10 | } 11 | 12 | function d3_Hsl(h, s, l) { 13 | this.h = h; 14 | this.s = s; 15 | this.l = l; 16 | } 17 | 18 | var d3_hslPrototype = d3_Hsl.prototype = new d3_Color; 19 | 20 | d3_hslPrototype.brighter = function(k) { 21 | k = Math.pow(0.7, arguments.length ? k : 1); 22 | return d3_hsl(this.h, this.s, this.l / k); 23 | }; 24 | 25 | d3_hslPrototype.darker = function(k) { 26 | k = Math.pow(0.7, arguments.length ? k : 1); 27 | return d3_hsl(this.h, this.s, k * this.l); 28 | }; 29 | 30 | d3_hslPrototype.rgb = function() { 31 | return d3_hsl_rgb(this.h, this.s, this.l); 32 | }; 33 | 34 | function d3_hsl_rgb(h, s, l) { 35 | var m1, 36 | m2; 37 | 38 | /* Some simple corrections for h, s and l. */ 39 | h = h % 360; if (h < 0) h += 360; 40 | s = s < 0 ? 0 : s > 1 ? 1 : s; 41 | l = l < 0 ? 0 : l > 1 ? 1 : l; 42 | 43 | /* From FvD 13.37, CSS Color Module Level 3 */ 44 | m2 = l <= .5 ? l * (1 + s) : l + s - l * s; 45 | m1 = 2 * l - m2; 46 | 47 | function v(h) { 48 | if (h > 360) h -= 360; 49 | else if (h < 0) h += 360; 50 | if (h < 60) return m1 + (m2 - m1) * h / 60; 51 | if (h < 180) return m2; 52 | if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; 53 | return m1; 54 | } 55 | 56 | function vv(h) { 57 | return Math.round(v(h) * 255); 58 | } 59 | 60 | return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); 61 | } 62 | -------------------------------------------------------------------------------- /app/lib/cmx/gizmos/label_gizmo.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/gizmos/entity_gizmo'], (EntityGizmo) -> 2 | 3 | class LabelGizmo extends EntityGizmo 4 | 5 | update: -> 6 | super 7 | 8 | @ΔskeletonGizmo?.selectAll(".cmx-control") 9 | .attr("cx", (bone) -> bone.x) 10 | .attr("cy", (bone) -> bone.y) 11 | .style("display", (bone) => 12 | return 13 | ) 14 | 15 | build: -> 16 | base = super 17 | 18 | @ΔskeletonGizmo = base.append("g").attr("class", "cmx-gizmo cmx-label") 19 | 20 | resetBone = (bone) => 21 | @entity.skelet.moveBone(bone.name, 0, 0, yes) 22 | @entity.throttledUpdate() 23 | 24 | doubleClick = (bone) => 25 | d3.event.preventDefault() 26 | return resetBone(bone) if bone.name is 'HNDL' 27 | return resetBone(bone) if bone.name is 'TEXT' 28 | 29 | drag = d3.behavior.drag() 30 | .on "dragstart", (bone) => 31 | @controlUndoOpen "pose" 32 | @controlDragStart bone 33 | .on "dragend", (bone) => 34 | @controlDragEnd(bone) 35 | @controlUndoClose() 36 | .on "drag", (bone) => 37 | @entity.skelet.moveBone(bone.name, d3.event.dx, d3.event.dy, no) 38 | @entity.throttledUpdate() 39 | 40 | data = @entity.skelet.bonesWithIndices @entity.labelBones 41 | @ΔskeletonGizmo.selectAll(".cmx-control") 42 | .data(data) 43 | .enter() 44 | .append("circle") 45 | .attr("class", (bone) -> "cmx-control cmx-#{bone.type}") 46 | .attr("r", @CONTROL_POINT_RADIUS) 47 | .on("dblclick", doubleClick) 48 | .call(drag) 49 | 50 | @ΔskeletonGizmo 51 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/scale/category.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This product includes color specifications and designs developed by Cynthia 3 | * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. 4 | */ 5 | 6 | d3.scale.category10 = function() { 7 | return d3.scale.ordinal().range(d3_category10); 8 | }; 9 | 10 | d3.scale.category20 = function() { 11 | return d3.scale.ordinal().range(d3_category20); 12 | }; 13 | 14 | d3.scale.category20b = function() { 15 | return d3.scale.ordinal().range(d3_category20b); 16 | }; 17 | 18 | d3.scale.category20c = function() { 19 | return d3.scale.ordinal().range(d3_category20c); 20 | }; 21 | 22 | var d3_category10 = [ 23 | "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", 24 | "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" 25 | ]; 26 | 27 | var d3_category20 = [ 28 | "#1f77b4", "#aec7e8", 29 | "#ff7f0e", "#ffbb78", 30 | "#2ca02c", "#98df8a", 31 | "#d62728", "#ff9896", 32 | "#9467bd", "#c5b0d5", 33 | "#8c564b", "#c49c94", 34 | "#e377c2", "#f7b6d2", 35 | "#7f7f7f", "#c7c7c7", 36 | "#bcbd22", "#dbdb8d", 37 | "#17becf", "#9edae5" 38 | ]; 39 | 40 | var d3_category20b = [ 41 | "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", 42 | "#637939", "#8ca252", "#b5cf6b", "#cedb9c", 43 | "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", 44 | "#843c39", "#ad494a", "#d6616b", "#e7969c", 45 | "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" 46 | ]; 47 | 48 | var d3_category20c = [ 49 | "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", 50 | "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", 51 | "#31a354", "#74c476", "#a1d99b", "#c7e9c0", 52 | "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", 53 | "#636363", "#969696", "#bdbdbd", "#d9d9d9" 54 | ]; 55 | -------------------------------------------------------------------------------- /app/lib/cmx/gizmos/bubble_gizmo.coffee: -------------------------------------------------------------------------------- 1 | define ['cmx/gizmos/entity_gizmo'], (EntityGizmo) -> 2 | 3 | class BubbleGizmo extends EntityGizmo 4 | 5 | update: -> 6 | super 7 | 8 | @ΔskeletonGizmo?.selectAll(".cmx-control") 9 | .attr("cx", (bone) -> bone.x) 10 | .attr("cy", (bone) -> bone.y) 11 | .style("display", (bone) => 12 | return 13 | ) 14 | 15 | build: -> 16 | base = super 17 | 18 | @ΔskeletonGizmo = base.append("g").attr("class", "cmx-gizmo cmx-bubble") 19 | 20 | resetBone = (bone) => 21 | @entity.skelet.moveBone(bone.name, 0, 0, yes) 22 | @entity.throttledUpdate() 23 | 24 | doubleClick = (bone) => 25 | d3.event.preventDefault() 26 | return resetBone(bone) if bone.name is 'HNDL' 27 | return resetBone(bone) if bone.name is 'TEXT' 28 | 29 | drag = d3.behavior.drag() 30 | .on "dragstart", (bone) => 31 | @controlUndoOpen "pose" 32 | @controlDragStart(bone) 33 | .on "dragend", (bone) => 34 | @controlDragEnd(bone) 35 | @controlUndoClose() 36 | .on "drag", (bone) => 37 | @entity.skelet.moveBone(bone.name, d3.event.dx, d3.event.dy, no) 38 | @entity.throttledUpdate() 39 | 40 | data = @entity.skelet.bonesWithIndices @entity.bubbleBones 41 | @ΔskeletonGizmo.selectAll(".cmx-control") 42 | .data(data) 43 | .enter() 44 | .append("circle") 45 | .attr("class", (bone) -> "cmx-control cmx-#{bone.type}") 46 | .attr("r", @CONTROL_POINT_RADIUS) 47 | .on("dblclick", doubleClick) 48 | .call(drag) 49 | 50 | 51 | @ΔskeletonGizmo 52 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/median-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.median"); 7 | 8 | suite.addBatch({ 9 | "median": { 10 | topic: function() { 11 | return d3.median; 12 | }, 13 | "returns the median value for numbers": function(median) { 14 | assert.equal(median([1]), 1); 15 | assert.equal(median([5, 1, 2, 3, 4]), 3); 16 | assert.equal(median([20, 3]), 11.5); 17 | assert.equal(median([3, 20]), 11.5); 18 | }, 19 | "ignores null, undefined and NaN": function(median) { 20 | assert.equal(median([NaN, 1, 2, 3, 4, 5]), 3); 21 | assert.equal(median([1, 2, 3, 4, 5, NaN]), 3); 22 | assert.equal(median([10, null, 3, undefined, 5, NaN]), 5); 23 | }, 24 | "can handle large numbers without overflowing": function(median) { 25 | assert.equal(median([Number.MAX_VALUE, Number.MAX_VALUE]), Number.MAX_VALUE); 26 | assert.equal(median([-Number.MAX_VALUE, -Number.MAX_VALUE]), -Number.MAX_VALUE); 27 | }, 28 | "returns undefined for empty array": function(median) { 29 | assert.isUndefined(median([])); 30 | assert.isUndefined(median([null])); 31 | assert.isUndefined(median([undefined])); 32 | assert.isUndefined(median([NaN])); 33 | assert.isUndefined(median([NaN, NaN])); 34 | }, 35 | "applies the optional accessor function": function(median) { 36 | assert.equal(d3.median([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]], function(d) { return d3.median(d); }), 4.5); 37 | assert.equal(d3.median([1, 2, 3, 4, 5], function(d, i) { return i; }), 2); 38 | } 39 | } 40 | }); 41 | 42 | suite.export(module); 43 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/src/core/dispatch.js: -------------------------------------------------------------------------------- 1 | d3.dispatch = function() { 2 | var dispatch = new d3_dispatch, 3 | i = -1, 4 | n = arguments.length; 5 | while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); 6 | return dispatch; 7 | }; 8 | 9 | function d3_dispatch() {} 10 | 11 | d3_dispatch.prototype.on = function(type, listener) { 12 | var i = type.indexOf("."), 13 | name = ""; 14 | 15 | // Extract optional namespace, e.g., "click.foo" 16 | if (i > 0) { 17 | name = type.substring(i + 1); 18 | type = type.substring(0, i); 19 | } 20 | 21 | return arguments.length < 2 22 | ? this[type].on(name) 23 | : this[type].on(name, listener); 24 | }; 25 | 26 | function d3_dispatch_event(dispatch) { 27 | var listeners = [], 28 | listenerByName = new d3_Map; 29 | 30 | function event() { 31 | var z = listeners, // defensive reference 32 | i = -1, 33 | n = z.length, 34 | l; 35 | while (++i < n) if (l = z[i].on) l.apply(this, arguments); 36 | return dispatch; 37 | } 38 | 39 | event.on = function(name, listener) { 40 | var l = listenerByName.get(name), 41 | i; 42 | 43 | // return the current listener, if any 44 | if (arguments.length < 2) return l && l.on; 45 | 46 | // remove the old listener, if any (with copy-on-write) 47 | if (l) { 48 | l.on = null; 49 | listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); 50 | listenerByName.remove(name); 51 | } 52 | 53 | // add the new listener, if any 54 | if (listener) listeners.push(listenerByName.set(name, {on: listener})); 55 | 56 | return dispatch; 57 | }; 58 | 59 | return event; 60 | } 61 | -------------------------------------------------------------------------------- /app/edit/scripts/vendor/d3/test/core/sum-test.js: -------------------------------------------------------------------------------- 1 | require("../env"); 2 | 3 | var vows = require("vows"), 4 | assert = require("assert"); 5 | 6 | var suite = vows.describe("d3.sum"); 7 | 8 | suite.addBatch({ 9 | "sum": { 10 | topic: function() { 11 | return d3.sum; 12 | }, 13 | "sums numbers": function(sum) { 14 | assert.equal(d3.sum([1]), 1); 15 | assert.equal(d3.sum([5, 1, 2, 3, 4]), 15); 16 | assert.equal(d3.sum([20, 3]), 23); 17 | assert.equal(d3.sum([3, 20]), 23); 18 | }, 19 | "sums types that can be coerced to numbers": function(sum) { 20 | assert.equal(d3.sum(["20", "3"]), 23); 21 | assert.equal(d3.sum(["3", "20"]), 23); 22 | assert.equal(d3.sum(["3", 20]), 23); 23 | assert.equal(d3.sum([20, "3"]), 23); 24 | assert.equal(d3.sum([3, "20"]), 23); 25 | assert.equal(d3.sum(["20", 3]), 23); 26 | }, 27 | "ignores non-numeric types": function(sum) { 28 | assert.equal(d3.sum(["a", "b", "c"]), 0); 29 | assert.equal(d3.sum(["a", 1, "2"]), 3); 30 | }, 31 | "ignores null, undefined and NaN": function(sum) { 32 | assert.equal(d3.sum([NaN, 1, 2, 3, 4, 5]), 15); 33 | assert.equal(d3.sum([1, 2, 3, 4, 5, NaN]), 15); 34 | assert.equal(d3.sum([10, null, 3, undefined, 5, NaN]), 18); 35 | }, 36 | "applies the optional acccessor function": function(sum) { 37 | assert.equal(d3.sum([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]], function(d) { return d3.sum(d); }), 45); 38 | assert.equal(d3.sum([1, 2, 3, 4, 5], function(d, i) { return i; }), 10); 39 | }, 40 | "returns zero for the empty array": function(sum) { 41 | assert.equal(d3.sum([]), 0); 42 | } 43 | } 44 | }); 45 | 46 | suite.export(module); 47 | --------------------------------------------------------------------------------