├── demos ├── _sources │ ├── body.html │ ├── demo.json │ ├── animation │ │ ├── map-panning │ │ │ ├── demo.json │ │ │ └── demo.js │ │ └── map-markers │ │ │ └── demo.js │ ├── basic │ │ ├── marker-hit-test │ │ │ └── demo.json │ │ ├── simple-map │ │ │ └── demo.js │ │ └── simple-marker │ │ │ └── demo.js │ ├── visualization │ │ └── walmart │ │ │ └── demo.json │ ├── _style.css │ ├── init.js │ ├── plugins │ │ └── heatmap │ │ │ └── demo.js │ ├── _layout.html │ ├── geojson │ │ └── dnd-geojson.js │ └── drawing │ │ └── creator │ │ └── demo.js ├── img │ ├── plane.png │ ├── tile5.png │ ├── zoom.png │ ├── map-bg.png │ ├── square-marker.png │ └── square-marker-highlight.png └── _demogen │ ├── codemirror │ ├── mode │ │ ├── diff │ │ │ ├── diff.css │ │ │ └── diff.js │ │ ├── markdown │ │ │ └── markdown.css │ │ ├── pascal │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── python │ │ │ └── LICENSE.txt │ │ ├── ntriples │ │ │ └── index.html │ │ ├── coffeescript │ │ │ └── LICENSE │ │ ├── jinja2 │ │ │ ├── index.html │ │ │ └── jinja2.js │ │ ├── css │ │ │ └── index.html │ │ ├── sparql │ │ │ └── index.html │ │ ├── rst │ │ │ └── rst.css │ │ ├── r │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── ruby │ │ │ └── LICENSE │ │ ├── php │ │ │ └── index.html │ │ ├── smalltalk │ │ │ └── index.html │ │ ├── xml │ │ │ └── index.html │ │ ├── htmlmixed │ │ │ ├── index.html │ │ │ └── htmlmixed.js │ │ ├── plsql │ │ │ └── index.html │ │ ├── lua │ │ │ └── index.html │ │ ├── haskell │ │ │ └── index.html │ │ ├── yaml │ │ │ ├── index.html │ │ │ └── yaml.js │ │ ├── scheme │ │ │ └── index.html │ │ ├── xmlpure │ │ │ └── index.html │ │ ├── javascript │ │ │ └── index.html │ │ ├── clojure │ │ │ └── index.html │ │ └── velocity │ │ │ └── index.html │ ├── theme │ │ ├── neat.css │ │ ├── elegant.css │ │ ├── default.css │ │ ├── cobalt.css │ │ ├── eclipse.css │ │ └── night.css │ ├── runmode.js │ ├── codemirror.css │ └── overlay.js │ └── js │ ├── ace │ ├── mode-latex.js │ ├── theme-eclipse.js │ ├── mode-textile.js │ ├── theme-pastel_on_dark.js │ ├── theme-clouds.js │ ├── theme-textmate.js │ ├── theme-monokai.js │ ├── theme-dawn.js │ ├── theme-merbivore.js │ ├── theme-cobalt.js │ ├── keybinding-vim.js │ ├── theme-kr_theme.js │ ├── theme-twilight.js │ ├── theme-vibrant_ink.js │ ├── theme-crimson_editor.js │ ├── theme-idle_fingers.js │ ├── theme-merbivore_soft.js │ ├── theme-solarized_dark.js │ ├── theme-clouds_midnight.js │ ├── theme-solarized_light.js │ ├── keybinding-emacs.js │ └── theme-mono_industrial.js │ ├── keymaster.min.js │ └── runner.js ├── test ├── img │ ├── zoom.png │ └── square-marker.png ├── js │ └── testenv.js ├── css │ └── tests.css ├── specs │ ├── drawables │ │ ├── line.js │ │ └── markers.js │ ├── map │ │ ├── basic.js │ │ └── movement.js │ └── types │ │ └── xy.js ├── lib │ └── jasmine-1.0.2 │ │ ├── MIT.LICENSE │ │ └── jasmine.css ├── visual │ └── xy-rotation.html └── index.html ├── .gitignore ├── src ├── core │ ├── graphics │ │ ├── drawables │ │ │ ├── line.js │ │ │ ├── arc.js │ │ │ └── marker.js │ │ ├── layers │ │ │ ├── tilelayer.js │ │ │ └── viewlayer.js │ │ └── style.js │ ├── messages.js │ ├── parser.js │ ├── types │ │ ├── rect.js │ │ ├── geoxy.js │ │ └── line.js │ ├── geo │ │ └── projections │ │ │ └── default.js │ ├── functions.js │ ├── constants.js │ ├── images │ │ └── tile.js │ ├── shorts.js │ ├── registry.js │ ├── renderers │ │ └── base.js │ └── hits.js ├── style │ └── map-overlays.js ├── engines │ ├── cloudmade.js │ ├── wms.js │ ├── osm.compat.js │ └── static.js ├── T5.js └── plugins │ └── parser.geojson.js ├── Makefile ├── package.json ├── dist ├── engines │ ├── cloudmade.js │ ├── wms.js │ ├── osm.compat.js │ └── static.js └── plugins │ └── parser.geojson.js ├── LICENSE.mdown ├── README.mdown └── lib └── colorparser.js /demos/_sources/body.html: -------------------------------------------------------------------------------- 1 |
-------------------------------------------------------------------------------- /demos/_sources/demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Damon Oehlman" 3 | } -------------------------------------------------------------------------------- /demos/_sources/animation/map-panning/demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "drawOnTween": true 3 | } -------------------------------------------------------------------------------- /test/img/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/test/img/zoom.png -------------------------------------------------------------------------------- /demos/_sources/basic/marker-hit-test/demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "includes": ["_data/cities.js"] 3 | } -------------------------------------------------------------------------------- /demos/img/plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/plane.png -------------------------------------------------------------------------------- /demos/img/tile5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/tile5.png -------------------------------------------------------------------------------- /demos/img/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/zoom.png -------------------------------------------------------------------------------- /demos/img/map-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/map-bg.png -------------------------------------------------------------------------------- /demos/img/square-marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/square-marker.png -------------------------------------------------------------------------------- /test/img/square-marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/test/img/square-marker.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | apidoc 2 | .settings 3 | *~ 4 | *.diff 5 | *.patch 6 | test/qunit 7 | .DS_Store 8 | closed-* 9 | node_modules -------------------------------------------------------------------------------- /demos/img/square-marker-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/square-marker-highlight.png -------------------------------------------------------------------------------- /test/js/testenv.js: -------------------------------------------------------------------------------- 1 | var TESTENV = (function() { 2 | /* internals */ 3 | 4 | /* exports */ 5 | 6 | return { 7 | }; 8 | })(); -------------------------------------------------------------------------------- /demos/_sources/visualization/walmart/demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "drawOnMove": true, 3 | "mapstyle": 999, 4 | "renderer": "canvas/dom", 5 | "includes": ["_data/walmarts.js"] 6 | } -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/diff/diff.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-rangeinfo {color: #a0b;} 2 | .cm-s-default span.cm-minus {color: #a22;} 3 | .cm-s-default span.cm-plus {color: #2b2;} 4 | -------------------------------------------------------------------------------- /src/core/graphics/drawables/line.js: -------------------------------------------------------------------------------- 1 | /** 2 | # DRAWABLE: line 3 | */ 4 | reg(typeDrawable, 'line', function(view, layer, params, callback) { 5 | params.fill = false; 6 | params.allowCull = true; 7 | 8 | return regCreate(typeDrawable, 'poly', view, layer, params); 9 | }); -------------------------------------------------------------------------------- /demos/_sources/_style.css: -------------------------------------------------------------------------------- 1 | html, body, #mapContainer { 2 | margin: 0; 3 | height: 100%; 4 | width: 100%; 5 | } 6 | 7 | body { 8 | font: 1em Helvetica, Arial; 9 | } 10 | 11 | .t5-copyright { 12 | background: #e8e8e8; 13 | opacity: 0.4; 14 | font-size: 0.8em; 15 | padding: 5px; 16 | } -------------------------------------------------------------------------------- /src/core/graphics/drawables/arc.js: -------------------------------------------------------------------------------- 1 | /** 2 | # DRAWABLE: arc 3 | */ 4 | reg(typeDrawable, 'arc', function(view, layer, params) { 5 | params = cog.extend({ 6 | startAngle: 0, 7 | endAngle: Math.PI * 2, 8 | typeName: 'Arc' 9 | }, params); 10 | 11 | return new Drawable(view, layer, params); 12 | }); -------------------------------------------------------------------------------- /demos/_sources/basic/simple-map/demo.js: -------------------------------------------------------------------------------- 1 | map = new T5.Map('mapContainer', { 2 | padding: 'auto' 3 | }); 4 | 5 | map.layer('tiles', 'tile', { 6 | generator: 'osm.cloudmade', 7 | // demo api key, register for an API key at http://dev.cloudmade.com/ 8 | apikey: '7960daaf55f84bfdb166014d0b9f8d41' 9 | }); 10 | 11 | map.zoom(8).center('-27.4695 153.0201'); -------------------------------------------------------------------------------- /src/core/messages.js: -------------------------------------------------------------------------------- 1 | // define messages that are used in tile5 2 | // any messages that can be formatted should use the formatter for simple reuse 3 | 4 | var WARN_REGOVERRIDE = formatter('Registration of {{0}}: {{1}} will override existing definition'), 5 | NO_TYPE = formatter('Could not create {{0}} of type: {{1}}'), 6 | NO_DRAWABLE = formatter('Could not create drawable of type: {{0}}'); 7 | -------------------------------------------------------------------------------- /test/css/tests.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | overflow: hidden; 4 | margin: 0; 5 | } 6 | 7 | #mapContainer { 8 | height: 60%; 9 | overflow: hidden; 10 | } 11 | 12 | #testControls { 13 | position: absolute; 14 | width: 100%; 15 | height: 60%; 16 | z-index: 200; 17 | } 18 | 19 | .jasmine_reporter { 20 | overflow-y: scroll; 21 | height: 40%; 22 | } -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | return { 3 | token: function(stream) { 4 | var ch = stream.next(); 5 | stream.skipToEnd(); 6 | if (ch == "+") return "plus"; 7 | if (ch == "-") return "minus"; 8 | if (ch == "@") return "rangeinfo"; 9 | } 10 | }; 11 | }); 12 | 13 | CodeMirror.defineMIME("text/x-diff", "diff"); 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | 3 | build: 4 | @interleave --wrap oldschool src/T5.js --output dist/tile5.js 5 | @interleave src/engines --path dist/engines 6 | @interleave src/plugins --path dist/plugins 7 | @interleave src/plugins/layers --path dist/plugins/layers 8 | @../bake-js/bin/bake dist/tile5.js --refresh --output demos/_demogen/js 9 | @../bake-js/bin/bake dist/tile5.js --output test 10 | 11 | test: 12 | @mocha --reporter spec 13 | 14 | .PHONY: test -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | -------------------------------------------------------------------------------- /demos/_sources/init.js: -------------------------------------------------------------------------------- 1 | // create the map 2 | var map = new T5.Map('mapContainer', { 3 | renderer: settings.renderer || 'canvas', 4 | drawOnMove: settings.drawOnMove, 5 | drawOnTween: settings.drawOnTween 6 | }); 7 | 8 | map.layer('tiles', 'tile', { 9 | generator: 'osm.cloudmade', 10 | // demo api key, register for an API key at http://dev.cloudmade.com/ 11 | apikey: '7960daaf55f84bfdb166014d0b9f8d41', 12 | styleid: settings.mapstyle 13 | }); 14 | 15 | map.zoom(8).center('-27.469 153.020'); -------------------------------------------------------------------------------- /test/specs/drawables/line.js: -------------------------------------------------------------------------------- 1 | describe('drawables.line', function() { 2 | var POS_COUNT = 10; 3 | 4 | it('should be able to create a line on the map', function() { 5 | var positions = []; 6 | 7 | for (var ii = POS_COUNT; ii--; ) { 8 | positions[ii] = new GeoJS.Pos(startLat + Math.random() - 0.5, startLon + Math.random() - 0.5); 9 | } // for 10 | 11 | // create a line with the positions 12 | map.layer('markers').create('line', { 13 | points: positions 14 | }); 15 | }); 16 | }); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262;font-style: italic;} 3 | .cm-s-elegant span.cm-meta {color: #555;font-style: italic;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/markdown/markdown.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-header {color: #2f2f4f; font-weight:bold;} 2 | .cm-s-default span.cm-code {color: #666;} 3 | .cm-s-default span.cm-quote {color: #090;} 4 | .cm-s-default span.cm-list {color: #a50;} 5 | .cm-s-default span.cm-hr {color: #999;} 6 | .cm-s-default span.cm-linktext {color: #00c; text-decoration: underline;} 7 | .cm-s-default span.cm-linkhref {color: #00c;} 8 | .cm-s-default span.cm-em {font-style: italic;} 9 | .cm-s-default span.cm-strong {font-weight: bold;} 10 | .cm-s-default span.cm-emstrong {font-style: italic; font-weight: bold;} 11 | -------------------------------------------------------------------------------- /test/specs/drawables/markers.js: -------------------------------------------------------------------------------- 1 | describe('map.markers', function() { 2 | it('should be able to clear a draw layer', function() { 3 | map.layer('markers').clear(); 4 | expect(map.layer('markers').find().length).toEqual(0); 5 | }); 6 | 7 | it('should be able to drop a marker at the center of the map', function() { 8 | map.layer('markers').create('marker', { 9 | xy: map.center(), 10 | markerStyle: 'image', 11 | imageUrl: 'img/square-marker.png' 12 | }); 13 | 14 | var marker = map.layer('markers').find()[0]; 15 | expect(marker.xy.equals(map.center())).toBeTruthy(); 16 | }); 17 | }); -------------------------------------------------------------------------------- /src/style/map-overlays.js: -------------------------------------------------------------------------------- 1 | T5.Style.define({ 2 | 'path.bike': { 3 | lineWidth: 3, 4 | stroke: '#007ee8' 5 | }, 6 | 7 | 'area.simple': { 8 | lineWidth: 1, 9 | stroke: '#000000', 10 | fill: '#ffffff' 11 | }, 12 | 13 | 'area.highlight': { 14 | lineWidth: 1, 15 | stroke: '#000000', 16 | fill: '#f8d461', 17 | opacity: 0.8 18 | }, 19 | 20 | 'area.parkland': { 21 | lineWidth: 1, 22 | stroke: '#1e1e1e', 23 | fill: '#a7d732', 24 | opacity: 0.7 25 | }, 26 | 27 | 'area.general': { 28 | lineWidth: 0, 29 | fill: '#1e1e1e' 30 | } 31 | }); -------------------------------------------------------------------------------- /demos/_sources/basic/simple-marker/demo.js: -------------------------------------------------------------------------------- 1 | var map = new T5.Map('mapContainer'); 2 | 3 | map.layer('tiles', 'tile', { 4 | generator: 'osm.cloudmade', 5 | // demo api key, register for an API key at http://dev.cloudmade.com/ 6 | apikey: '7960daaf55f84bfdb166014d0b9f8d41' 7 | }); 8 | 9 | map.zoom(8).center('-27.4695 153.0201'); 10 | 11 | // add a marker at the center of the map 12 | var marker = map.layer('markers').create('marker', { 13 | xy: '-27.4695 153.0201', 14 | imageUrl: 'img/square-marker.png', 15 | markerType: 'image' 16 | }); 17 | 18 | marker 19 | .translate(0, -500) 20 | .translate(0, 500, { 21 | easing: 'bounce.out', 22 | duration: 1500 23 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tile5", 3 | "description": "Canvas (and others) mapping library", 4 | "main": "./index", 5 | "author": "Damon Oehlman", 6 | "version": "1.0.0", 7 | 8 | "repository": { 9 | "type": "git", 10 | "url": "http://github.com/DamonOehlman/tile5.git" 11 | }, 12 | 13 | "bugs": { 14 | "web": "https://github.com/DamonOehlman/tile5/issues" 15 | }, 16 | 17 | "dependencies": { 18 | }, 19 | 20 | "devDependencies": { 21 | "interleave": "0.4.x" 22 | }, 23 | 24 | "licenses": [{ 25 | "type": "MIT", 26 | "url": "http://github.com/DamonOehlman/tile5/raw/LICENCE" 27 | }] 28 | } -------------------------------------------------------------------------------- /src/core/parser.js: -------------------------------------------------------------------------------- 1 | var Parser = (function() { 2 | 3 | /* internals */ 4 | var REGEX_XYRAW = /^xy\((.*)\).*$/i; 5 | 6 | /* exports */ 7 | 8 | function parseXY(xyStr) { 9 | // if the xystr is a raw xy string, then process as such 10 | if (REGEX_XYRAW.test(xyStr)) { 11 | 12 | } 13 | else { 14 | // split the string and parse as a position 15 | var xyVals = xyStr.split(reDelimitedSplit); 16 | 17 | return _project(xyVals[1], xyVals[0]); 18 | } // if..else 19 | 20 | return undefined; 21 | } // parseXY 22 | 23 | return { 24 | parseXY: parseXY 25 | }; 26 | })(); -------------------------------------------------------------------------------- /test/specs/map/basic.js: -------------------------------------------------------------------------------- 1 | describe('map.basic', function() { 2 | var testPrecision = Math.pow(10, 3); 3 | 4 | it('should be able to move to a particular position', function() { 5 | var centerPos; 6 | 7 | // move the map to the specified start position 8 | map.zoom(8).center(startLat + ', ' + startLon); 9 | 10 | // get the center position for the map 11 | centerPos = map.center().pos(); 12 | 13 | expect(centerPos.lat * testPrecision | 0).toEqual(startLat * testPrecision | 0); 14 | expect(centerPos.lon * testPrecision | 0).toEqual(startLon * testPrecision | 0); 15 | }); 16 | 17 | it('should not have a center value and offset value equal', function() { 18 | expect(map.center().equals(map.offset())).toBeFalsy(); 19 | }); 20 | }); -------------------------------------------------------------------------------- /src/core/types/rect.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.Rect 3 | */ 4 | function Rect(x, y, width, height) { 5 | // initialise members 6 | this.x = x || 0; 7 | this.y = y || 0; 8 | this.w = width || 0; 9 | this.h = height || 0; 10 | 11 | // update the x2 and y2 coordinates 12 | this.x2 = this.x + this.w; 13 | this.y2 = this.y + this.h; 14 | } // Rect 15 | 16 | Rect.prototype = { 17 | constructor: Rect, 18 | 19 | /** 20 | ### buffer(amountX, amountY) 21 | */ 22 | buffer: function(amountX, amountY) { 23 | return new Rect( 24 | this.x - amountX, 25 | this.y - (amountY || amountX), 26 | this.w + amountX * 2, 27 | this.h + (amountY || amountX) * 2 28 | ); 29 | }, 30 | 31 | /** 32 | ### center() 33 | */ 34 | center: function() { 35 | return new XY(this.x + (this.w >> 1), this.y + (this.h >> 1)); 36 | } 37 | }; -------------------------------------------------------------------------------- /dist/engines/cloudmade.js: -------------------------------------------------------------------------------- 1 | T5.Registry.register('generator', 'osm.cloudmade', function(view, params) { 2 | var urlFormatter; 3 | 4 | // ensure we have parameters 5 | params = params || {}; 6 | 7 | // initialise the apikey and style 8 | params.apikey = params.apikey || null; 9 | params.styleid = params.styleid || 1; 10 | 11 | urlFormatter = formatter('http://{{3}}.tile.cloudmade.com/{{0}}/{{1}}/{{2}}/'); 12 | view.addCopy('This product uses the CloudMade APIs, but is not endorsed or certified by CloudMade.'); 13 | 14 | return cog.extend(T5.Registry.create('generator', 'osm', view, params), { 15 | getServerDetails: function() { 16 | return { 17 | baseUrl: urlFormatter(params.apikey, params.styleid, 256, '{{0}}'), 18 | subDomains: ['a', 'b', 'c'] 19 | }; 20 | } 21 | }); 22 | }); -------------------------------------------------------------------------------- /src/engines/cloudmade.js: -------------------------------------------------------------------------------- 1 | T5.Registry.register('generator', 'osm.cloudmade', function(view, params) { 2 | var urlFormatter; 3 | 4 | // ensure we have parameters 5 | params = params || {}; 6 | 7 | // initialise the apikey and style 8 | params.apikey = params.apikey || null; 9 | params.styleid = params.styleid || 1; 10 | 11 | urlFormatter = formatter('http://{{3}}.tile.cloudmade.com/{{0}}/{{1}}/{{2}}/'); 12 | view.addCopy('This product uses the CloudMade APIs, but is not endorsed or certified by CloudMade.'); 13 | 14 | return cog.extend(T5.Registry.create('generator', 'osm', view, params), { 15 | getServerDetails: function() { 16 | return { 17 | baseUrl: urlFormatter(params.apikey, params.styleid, 256, '{{0}}'), 18 | subDomains: ['a', 'b', 'c'] 19 | }; 20 | } 21 | }); 22 | }); -------------------------------------------------------------------------------- /src/core/geo/projections/default.js: -------------------------------------------------------------------------------- 1 | var _project = _project || function(lon, lat) { 2 | var radLat = parseFloat(lat) * DEGREES_TO_RADIANS, 3 | sinPhi = sin(radLat), 4 | eSinPhi = ECC * sinPhi, 5 | retVal = log(((1.0 + sinPhi) / (1.0 - sinPhi)) * pow((1.0 - eSinPhi) / (1.0 + eSinPhi), ECC)) / 2.0; 6 | 7 | return new GeoXY(0, 0, parseFloat(lon) * DEGREES_TO_RADIANS, retVal); 8 | }; // _project 9 | 10 | var _unproject = _unproject || function(x, y) { 11 | var t = pow(Math.E, -y), 12 | prevPhi = mercatorUnproject(t), 13 | newPhi = findRadPhi(prevPhi, t), 14 | iterCount = 0; 15 | 16 | while (iterCount < PHI_MAXITER && abs(prevPhi - newPhi) > PHI_EPSILON) { 17 | prevPhi = newPhi; 18 | newPhi = findRadPhi(prevPhi, t); 19 | iterCount++; 20 | } // while 21 | 22 | return new GeoJS.Pos(newPhi * RADIANS_TO_DEGREES, (x % 360) * RADIANS_TO_DEGREES); 23 | }; // _unproject -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/default.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-keyword {color: #708;} 2 | .cm-s-default span.cm-atom {color: #219;} 3 | .cm-s-default span.cm-number {color: #164;} 4 | .cm-s-default span.cm-def {color: #00f;} 5 | .cm-s-default span.cm-variable {color: black;} 6 | .cm-s-default span.cm-variable-2 {color: #05a;} 7 | .cm-s-default span.cm-variable-3 {color: #0a5;} 8 | .cm-s-default span.cm-property {color: black;} 9 | .cm-s-default span.cm-operator {color: black;} 10 | .cm-s-default span.cm-comment {color: #a50;} 11 | .cm-s-default span.cm-string {color: #a11;} 12 | .cm-s-default span.cm-string-2 {color: #f50;} 13 | .cm-s-default span.cm-meta {color: #555;} 14 | .cm-s-default span.cm-error {color: #f00;} 15 | .cm-s-default span.cm-qualifier {color: #555;} 16 | .cm-s-default span.cm-builtin {color: #30a;} 17 | .cm-s-default span.cm-bracket {color: #cc7;} 18 | .cm-s-default span.cm-tag {color: #170;} 19 | .cm-s-default span.cm-attribute {color: #00c;} 20 | -------------------------------------------------------------------------------- /src/core/functions.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5 3 | The T5 core module contains classes and functionality that support basic drawing 4 | operations and math that are used in managing and drawing the graphical and tiling interfaces 5 | that are provided in the Tile5 library. 6 | 7 | ## Module Functions 8 | */ 9 | 10 | /* exports */ 11 | 12 | function ticks() { 13 | return new Date().getTime(); 14 | } // getTicks 15 | 16 | /* exports */ 17 | 18 | /** 19 | ### radsPerPixel(zoomLevel) 20 | */ 21 | function radsPerPixel(zoomLevel) { 22 | return TWO_PI / (256 << zoomLevel); 23 | } // radsPerPixel 24 | 25 | 26 | /* internal functions */ 27 | 28 | function findRadPhi(phi, t) { 29 | var eSinPhi = ECC * sin(phi); 30 | 31 | return HALF_PI - (2 * atan (t * pow((1 - eSinPhi) / (1 + eSinPhi), ECC / 2))); 32 | } // findRadPhi 33 | 34 | function mercatorUnproject(t) { 35 | return HALF_PI - 2 * atan(t); 36 | } // mercatorUnproject 37 | 38 | function toRad(value) { 39 | return value * DEGREES_TO_RADIANS; 40 | } // toRad -------------------------------------------------------------------------------- /src/core/constants.js: -------------------------------------------------------------------------------- 1 | var LAT_VARIABILITIES = [ 2 | 1.406245461070741, 3 | 1.321415085624082, 4 | 1.077179995861952, 5 | 0.703119412486786, 6 | 0.488332580888611 7 | ]; 8 | 9 | // define some constants 10 | var TWO_PI = Math.PI * 2, 11 | HALF_PI = Math.PI / 2, 12 | PROP_WK_TRANSFORM = '-webkit-transform', 13 | VECTOR_SIMPLIFICATION = 3, 14 | DEGREES_TO_RADIANS = Math.PI / 180, 15 | RADIANS_TO_DEGREES = 180 / Math.PI, 16 | MAX_LAT = 90, // 85.0511 * DEGREES_TO_RADIANS, // TODO: validate this instead of using HALF_PI 17 | MIN_LAT = -MAX_LAT, 18 | MAX_LON = 180, 19 | MIN_LON = -MAX_LON, 20 | MAX_LAT_RAD = MAX_LAT * DEGREES_TO_RADIANS, 21 | MIN_LAT_RAD = -MAX_LAT_RAD, 22 | MAX_LON_RAD = MAX_LON * DEGREES_TO_RADIANS, 23 | MIN_LON_RAD = -MAX_LON_RAD, 24 | M_PER_KM = 1000, 25 | KM_PER_RAD = 6371, 26 | M_PER_RAD = KM_PER_RAD * M_PER_KM, 27 | ECC = 0.08181919084262157, 28 | PHI_EPSILON = 1E-7, 29 | PHI_MAXITER = 12, 30 | 31 | // some style constants 32 | STYLE_RESET = 'reset'; -------------------------------------------------------------------------------- /demos/_demogen/codemirror/runmode.js: -------------------------------------------------------------------------------- 1 | CodeMirror.runMode = function(string, modespec, callback) { 2 | var mode = CodeMirror.getMode({indentUnit: 2}, modespec); 3 | var isNode = callback.nodeType == 1; 4 | if (isNode) { 5 | var node = callback, accum = []; 6 | callback = function(string, style) { 7 | if (string == "\n") 8 | accum.push("
"); 9 | else if (style) 10 | accum.push("" + CodeMirror.htmlEscape(string) + ""); 11 | else 12 | accum.push(CodeMirror.htmlEscape(string)); 13 | } 14 | } 15 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); 16 | for (var i = 0, e = lines.length; i < e; ++i) { 17 | if (i) callback("\n"); 18 | var stream = new CodeMirror.StringStream(lines[i]); 19 | while (!stream.eol()) { 20 | var style = mode.token(stream, state); 21 | callback(stream.current(), style); 22 | stream.start = stream.pos; 23 | } 24 | } 25 | if (isNode) 26 | node.innerHTML = accum.join(""); 27 | }; 28 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt { background: #002240; color: white; } 2 | .cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | 21 | .CodeMirror-matchingbracket{ 22 | border:1px solid grey; 23 | color:black !important;; 24 | } -------------------------------------------------------------------------------- /src/core/images/tile.js: -------------------------------------------------------------------------------- 1 | function Tile(x, y, url, width, height, id) { 2 | this.x = x; 3 | this.y = y; 4 | this.w = width || 256; 5 | this.h = width || 256; 6 | 7 | // calculate the max x and y 8 | this.x2 = this.x + this.w; 9 | this.y2 = this.y + this.h; 10 | 11 | // initialise the url 12 | this.url = url; 13 | 14 | // initialise the tile id 15 | this.id = id || (x + '_' + y); 16 | 17 | // derived properties 18 | this.loaded = false; 19 | this.image = null; 20 | }; 21 | 22 | Tile.prototype = { 23 | constructor: Tile, 24 | 25 | load: function(callback) { 26 | // take a reference to the tile 27 | var tile = this; 28 | 29 | // get the image 30 | getImage(this.url, function(image, loaded) { 31 | // flag the tile as loaded and save the image to a member var 32 | tile.loaded = true; 33 | tile.image = image; 34 | 35 | if (callback) { 36 | callback(tile); 37 | } // if 38 | }); 39 | } 40 | }; -------------------------------------------------------------------------------- /src/core/shorts.js: -------------------------------------------------------------------------------- 1 | // some math functions 2 | var abs = Math.abs, 3 | ceil = Math.ceil, 4 | floor = Math.floor, 5 | round = Math.round, 6 | min = Math.min, 7 | max = Math.max, 8 | pow = Math.pow, 9 | sqrt = Math.sqrt, 10 | log = Math.log, 11 | sin = Math.sin, 12 | asin = Math.asin, 13 | cos = Math.cos, 14 | acos = Math.acos, 15 | tan = Math.tan, 16 | atan = Math.atan, 17 | atan2 = Math.atan2, 18 | 19 | // detected commonjs implementation 20 | isCommonJS = typeof module !== 'undefined' && module.exports, 21 | 22 | // some type references 23 | typeUndefined = 'undefined', 24 | typeString = 'string', 25 | typeNumber = 'number', 26 | 27 | // type references for internal types 28 | typeDrawable = 'drawable', 29 | typeLayer = 'layer', 30 | 31 | // shortcuts to the registry functions 32 | reg = Registry.register, 33 | regCreate = Registry.create, 34 | regGet = Registry.get, 35 | 36 | drawableCounter = 0, 37 | layerCounter = 0, 38 | 39 | reDelimitedSplit = /[\,\s]+/; -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 souceLair 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /src/core/registry.js: -------------------------------------------------------------------------------- 1 | var Registry = (function() { 2 | /* internals */ 3 | 4 | var types = {}; 5 | 6 | /* exports */ 7 | 8 | function create(type, name) { 9 | if (types[type][name]) { 10 | return types[type][name].apply(null, Array.prototype.slice.call(arguments, 2)); 11 | } // if 12 | 13 | throw NO_TYPE(type, name); 14 | } // create 15 | 16 | function get(type, name) { 17 | return types[type] ? types[type][name] : null; 18 | } // get 19 | 20 | function register(type, name, initFn) { 21 | // initialise the type of not defined 22 | if (! types[type]) { 23 | types[type] = {}; 24 | } // if 25 | 26 | // log a warning if the type already exists 27 | if (types[type][name]) { 28 | cog.log(WARN_REGOVERRIDE(type, name), 'warn'); 29 | } // if 30 | 31 | // add to the registry 32 | types[type][name] = initFn; 33 | } // register 34 | 35 | return { 36 | create: create, 37 | get: get, 38 | register: register 39 | }; 40 | })(); -------------------------------------------------------------------------------- /dist/engines/wms.js: -------------------------------------------------------------------------------- 1 | T5.Generator.register('osm.wms', function(params) { 2 | params = cog.extend({ 3 | extent: [-90, -180, 90, 180], 4 | mapurl: "" 5 | }, params); 6 | 7 | /* internals */ 8 | 9 | var minLat = params.extent[0] || -90, 10 | minLon = params.extent[1] || -180, 11 | maxLat = params.extent[2] || 90, 12 | maxLon = params.extent[3] || 180, 13 | dlat = maxLat - minLat, 14 | dlon = maxLon - minLon; 15 | 16 | function tileToExtent(x, y, zoomLevel, numTiles) { 17 | var ddlat = dlat / numTiles, 18 | ddlon = dlon / numTiles, 19 | llat = ddlon * x + minLat, 20 | tlon = maxLon - y * ddlon, 21 | tlat = llat + ddlon, 22 | llon = tlon - ddlon; 23 | 24 | return llat + "," + llon + "," + tlat + "," + tlon; 25 | } // tileToExtend 26 | 27 | return cog.extend(new T5.Geo.OSM.Generator(params), { 28 | buildTileUrl: function(tileX, tileY, zoomLevel, numTiles) { 29 | return params.mapurl + "&BBOX=" + tileToExtent(tileX, tileY, zoomLevel, numTiles); 30 | } 31 | }); 32 | }); -------------------------------------------------------------------------------- /src/engines/wms.js: -------------------------------------------------------------------------------- 1 | T5.Generator.register('osm.wms', function(params) { 2 | params = cog.extend({ 3 | extent: [-90, -180, 90, 180], 4 | mapurl: "" 5 | }, params); 6 | 7 | /* internals */ 8 | 9 | var minLat = params.extent[0] || -90, 10 | minLon = params.extent[1] || -180, 11 | maxLat = params.extent[2] || 90, 12 | maxLon = params.extent[3] || 180, 13 | dlat = maxLat - minLat, 14 | dlon = maxLon - minLon; 15 | 16 | function tileToExtent(x, y, zoomLevel, numTiles) { 17 | var ddlat = dlat / numTiles, 18 | ddlon = dlon / numTiles, 19 | llat = ddlon * x + minLat, 20 | tlon = maxLon - y * ddlon, 21 | tlat = llat + ddlon, 22 | llon = tlon - ddlon; 23 | 24 | return llat + "," + llon + "," + tlat + "," + tlon; 25 | } // tileToExtend 26 | 27 | return cog.extend(new T5.Geo.OSM.Generator(params), { 28 | buildTileUrl: function(tileX, tileY, zoomLevel, numTiles) { 29 | return params.mapurl + "&BBOX=" + tileToExtent(tileX, tileY, zoomLevel, numTiles); 30 | } 31 | }); 32 | }); -------------------------------------------------------------------------------- /test/lib/jasmine-1.0.2/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2010 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night span.CodeMirror-selected { background: #a8f !important; } 5 | .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Timothy Farrell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE.mdown: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Damon Oehlman (damon.oehlman -at- sidelab.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: NTriples mode 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 |

CodeMirror 2: NTriples mode

18 |
19 | 26 |
27 | 28 | 31 |

MIME types defined: text/n-triples.

32 | 33 | 34 | -------------------------------------------------------------------------------- /src/core/graphics/drawables/marker.js: -------------------------------------------------------------------------------- 1 | /** 2 | # DRAWABLE: marker 3 | The T5.Marker class represents a generic marker for annotating an underlying view. 4 | Originally the marker class did very little, and in most instances a T5.ImageMarker 5 | was used instead to generate a marker that looked more visually appealing, however, 6 | with the introduction of different rendering backends the standard marker class is 7 | the recommended option for annotating maps and views as it allows the renderer to 8 | implement suitable rendering behaviour which looks good regardless of the context. 9 | 10 | ## Initialization Parameters 11 | In addition to the standard T5.Drawable initialization parameters, a Marker can 12 | accept the following: 13 | 14 | 15 | - `markerType` - (default = simple) 16 | 17 | The style of marker that will be displayed for the marker. This is interpreted 18 | by each renderer individually. 19 | 20 | */ 21 | reg(typeDrawable, 'marker', function(view, layer, params) { 22 | params = cog.extend({ 23 | fill: true, 24 | stroke: false, 25 | markerType: 'simple', 26 | hoverStyle: 'highlight', 27 | typeName: 'Marker' 28 | }, params); 29 | 30 | return new Drawable(view, layer, params); 31 | }); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/coffeescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Jeff Pickhardt 4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /demos/_sources/plugins/heatmap/demo.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function createMarkers() { 3 | var markers = map.layer('markers'); 4 | 5 | // clear any existing markers 6 | markers.clear(); 7 | 8 | // create the markers 9 | for (ii = 0 ; ii < data.length; ii++) { 10 | markers.create('marker', { 11 | xy: new T5.GeoXY(new GeoJS.Pos(data[ii][0], data[ii][1])), 12 | markerType: 'image', 13 | imageUrl: 'img/square-marker.png', 14 | size: 15, 15 | value: data[ii][2] 16 | }); 17 | } // for 18 | } // loadData 19 | 20 | map = new T5.Map('mapContainer', { 21 | renderer: DEMO.getRenderer(), 22 | padding: 'auto' 23 | }); 24 | 25 | map.layer('tiles', 'tile', { 26 | generator: 'osm.cloudmade', 27 | renderer: 'canvas', 28 | // demo api key, register for an API key at http://dev.cloudmade.com/ 29 | apikey: '7960daaf55f84bfdb166014d0b9f8d41' 30 | }); 31 | 32 | // set the map center 33 | map.center('25 -110').zoom(3); 34 | 35 | // add the heatmap layer 36 | map.layer('heatmap', 'heatcanvas'); 37 | 38 | // create some markers 39 | createMarkers(); 40 | })(); 41 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/mode-latex.js: -------------------------------------------------------------------------------- 1 | define("ace/mode/latex",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/latex_highlight_rules","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/latex_highlight_rules").LatexHighlightRules,h=a("ace/range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\%/;for(var i=c;i<=d;i++)if(!g.test(b.getLine(i))){e=!1;break}if(e){var j=new h(0,0,0,0);for(var i=c;i<=d;i++){var k=b.getLine(i),l=k.match(g);j.start.row=i,j.end.row=i,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"%")},this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(i.prototype),b.Mode=i}),define("ace/mode/latex_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"keyword",regex:"\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"string",regex:"\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"},{token:"comment",regex:"%.*$"}]}};d.inherits(f,e),b.LatexHighlightRules=f}) -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Jinja2 mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Jinja2 mode

14 |
32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: CSS mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: CSS mode

14 |
49 | 52 | 53 |

MIME types defined: text/css.

54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/core/types/geoxy.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.GeoXY 3 | 4 | ## Methods 5 | */ 6 | function GeoXY(p1, p2, mercX, mercY) { 7 | // initialise the mercator x and y 8 | this.mercX = mercX; 9 | this.mercY = mercY; 10 | 11 | // if the first parameter is a string, then parse 12 | if (sniff(p1) == 'string') { 13 | cog.extend(this, Parser.parseXY(p1)); 14 | } // if 15 | // otherwise, if the first parameter is a position, then convert to pixels 16 | else if (p1 && p1.toBounds) { 17 | cog.extend(this, _project(p1.lon, p1.lat)); 18 | } 19 | else { 20 | XY.call(this, p1, p2); 21 | } 22 | } // GeoXY 23 | 24 | GeoXY.prototype = cog.extend(new XY(), { 25 | constructor: GeoXY, 26 | 27 | /** 28 | ### pos() 29 | */ 30 | pos: function() { 31 | return _unproject(this.mercX, this.mercY); 32 | }, 33 | 34 | /** 35 | ### sync(view, reverse) 36 | */ 37 | sync: function(view, reverse) { 38 | var rpp = view.rpp || radsPerPixel(view.zoom()); 39 | 40 | if (reverse) { 41 | this.mercX = this.x * rpp - Math.PI; 42 | this.mercY = Math.PI - this.y * rpp; 43 | } 44 | else { 45 | this.x = round(((this.mercX || 0) + Math.PI) / rpp); 46 | this.y = round((Math.PI - (this.mercY || 0)) / rpp); 47 | } // if 48 | 49 | return this; 50 | } 51 | }); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Pascal mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Pascal mode

14 | 15 |
38 | 39 | 46 | 47 |

MIME types defined: text/x-pascal.

48 | 49 | 50 | -------------------------------------------------------------------------------- /dist/engines/osm.compat.js: -------------------------------------------------------------------------------- 1 | /** 2 | # GENERATOR: osm.mapbox 3 | __plugin:__ `engines/osm.compat.js` 4 | */ 5 | T5.Registry.register('generator', 'osm.mapbox', function(view, params) { 6 | params = T5.ex({ 7 | style: 'world-light', 8 | version: '1.0.0', 9 | flipY: true 10 | }, params); 11 | 12 | var urlFormatter = T5.formatter('http://{2}.tile.mapbox.com/{0}/{1}/'); 13 | view.addCopy('Tiles Courtesy of MapBox'); 14 | 15 | return T5.ex(T5.Registry.create('generator', 'osm', view, params), { 16 | getServerDetails: function() { 17 | return { 18 | baseUrl: urlFormatter(params.version, params.style, "{0}"), 19 | subDomains: ['a', 'b', 'c', 'd'] 20 | }; 21 | } 22 | }); 23 | }); 24 | 25 | /** 26 | # GENERATOR: osm.mapquest 27 | __plugin:__ `engines/osm.mapquest.js` 28 | */ 29 | T5.Generator.register('osm.mapquest', function(view, params) { 30 | view.addCopy('Tiles Courtesy of MapQuest'); 31 | 32 | return T5.ex(T5.Registry.create('generator', 'osm', view, params), { 33 | getServerDetails: function() { 34 | return { 35 | baseUrl: 'http://otile{0}.mqcdn.com/tiles/1.0.0/osm/', 36 | subDomains: ['1', '2', '3', '4'] 37 | }; 38 | } 39 | }); 40 | }); -------------------------------------------------------------------------------- /src/engines/osm.compat.js: -------------------------------------------------------------------------------- 1 | /** 2 | # GENERATOR: osm.mapbox 3 | __plugin:__ `engines/osm.compat.js` 4 | */ 5 | T5.Registry.register('generator', 'osm.mapbox', function(view, params) { 6 | params = T5.ex({ 7 | style: 'world-light', 8 | version: '1.0.0', 9 | flipY: true 10 | }, params); 11 | 12 | var urlFormatter = T5.formatter('http://{2}.tile.mapbox.com/{0}/{1}/'); 13 | view.addCopy('Tiles Courtesy of MapBox'); 14 | 15 | return T5.ex(T5.Registry.create('generator', 'osm', view, params), { 16 | getServerDetails: function() { 17 | return { 18 | baseUrl: urlFormatter(params.version, params.style, "{0}"), 19 | subDomains: ['a', 'b', 'c', 'd'] 20 | }; 21 | } 22 | }); 23 | }); 24 | 25 | /** 26 | # GENERATOR: osm.mapquest 27 | __plugin:__ `engines/osm.mapquest.js` 28 | */ 29 | T5.Generator.register('osm.mapquest', function(view, params) { 30 | view.addCopy('Tiles Courtesy of MapQuest'); 31 | 32 | return T5.ex(T5.Registry.create('generator', 'osm', view, params), { 33 | getServerDetails: function() { 34 | return { 35 | baseUrl: 'http://otile{0}.mqcdn.com/tiles/1.0.0/osm/', 36 | subDomains: ['1', '2', '3', '4'] 37 | }; 38 | } 39 | }); 40 | }); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: SPARQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: SPARQL mode

14 |
30 | 37 | 38 |

MIME types defined: application/x-sparql-query.

39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/rst/rst.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-emphasis { 2 | font-style: italic; 3 | } 4 | 5 | .cm-s-default span.cm-strong { 6 | font-weight: bold; 7 | } 8 | 9 | .cm-s-default span.cm-interpreted { 10 | color: #33cc66; 11 | } 12 | 13 | .cm-s-default span.cm-inline { 14 | color: #3399cc; 15 | } 16 | 17 | .cm-s-default span.cm-role { 18 | color: #666699; 19 | } 20 | 21 | .cm-s-default span.cm-list { 22 | color: #cc0099; 23 | font-weight: bold; 24 | } 25 | 26 | .cm-s-default span.cm-body { 27 | color: #6699cc; 28 | } 29 | 30 | .cm-s-default span.cm-verbatim { 31 | color: #3366ff; 32 | } 33 | 34 | .cm-s-default span.cm-comment { 35 | color: #aa7700; 36 | } 37 | 38 | .cm-s-default span.cm-directive { 39 | font-weight: bold; 40 | color: #3399ff; 41 | } 42 | 43 | .cm-s-default span.cm-hyperlink { 44 | font-weight: bold; 45 | color: #3366ff; 46 | } 47 | 48 | .cm-s-default span.cm-footnote { 49 | font-weight: bold; 50 | color: #3333ff; 51 | } 52 | 53 | .cm-s-default span.cm-citation { 54 | font-weight: bold; 55 | color: #3300ff; 56 | } 57 | 58 | .cm-s-default span.cm-replacement { 59 | color: #9933cc; 60 | } 61 | 62 | .cm-s-default span.cm-section { 63 | font-weight: bold; 64 | color: #cc0099; 65 | } 66 | 67 | .cm-s-default span.cm-directive-marker { 68 | font-weight: bold; 69 | color: #3399ff; 70 | } 71 | 72 | .cm-s-default span.cm-verbatim-marker { 73 | font-weight: bold; 74 | color: #9900ff; 75 | } 76 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function(config, parserConf) { 2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", 3 | "loop", "none", "self", "super", "if", "as", "not", "and", 4 | "else", "import", "with", "without", "context"]; 5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 6 | 7 | function tokenBase (stream, state) { 8 | var ch = stream.next(); 9 | if (ch == "{") { 10 | if (ch = stream.eat(/\{|%|#/)) { 11 | stream.eat("-"); 12 | state.tokenize = inTag(ch); 13 | return "tag"; 14 | } 15 | } 16 | } 17 | function inTag (close) { 18 | if (close == "{") { 19 | close = "}"; 20 | } 21 | return function (stream, state) { 22 | var ch = stream.next(); 23 | if ((ch == close || (ch == "-" && stream.eat(close))) 24 | && stream.eat("}")) { 25 | state.tokenize = tokenBase; 26 | return "tag"; 27 | } 28 | if (stream.match(keywords)) { 29 | return "keyword"; 30 | } 31 | return close == "#" ? "comment" : "string"; 32 | }; 33 | } 34 | return { 35 | startState: function () { 36 | return {tokenize: tokenBase}; 37 | }, 38 | token: function (stream, state) { 39 | return state.tokenize(stream, state); 40 | } 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/r/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 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 Ubalo, Inc nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY 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 UBALO, INC 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 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/ruby/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 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 Ubalo, Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY 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 UBALO, INC 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 | -------------------------------------------------------------------------------- /test/specs/map/movement.js: -------------------------------------------------------------------------------- 1 | describe('map.movement', function() { 2 | // get the current map offset 3 | var offsetXY; 4 | 5 | beforeEach(function() { 6 | offsetXY = map.offset(); 7 | }); 8 | 9 | it('should be able to pan a map', function() { 10 | map.pan(500, 500); 11 | 12 | expect(map.offset().x).toEqual(offsetXY.x + 500); 13 | expect(map.offset().y).toEqual(offsetXY.y + 500); 14 | }); 15 | 16 | it('should be able to pan a map with easing', function() { 17 | runs(function() { 18 | map.pan(-500, -500, { 19 | callback: function() { 20 | expect(map.offset().x).toEqual(offsetXY.x - 500); 21 | expect(map.offset().y).toEqual(offsetXY.y - 500); 22 | } 23 | }); 24 | }); 25 | 26 | waits(1200); 27 | }); 28 | 29 | it('should be able to scale a map', function() { 30 | runs(function() { 31 | map.scale(0.75, { 32 | callback: function() { 33 | expect(map.scale()).toEqual(0.75); 34 | } 35 | }); 36 | }); 37 | 38 | waits(1200); 39 | map.scale(1, false, true); 40 | }); 41 | 42 | it('should be able to rotate a map', function() { 43 | runs(function() { 44 | map.rotate(360, { 45 | callback: function() { 46 | expect(map.rotate()).toEqual(0); 47 | } 48 | }); 49 | }); 50 | 51 | waits(1200); 52 | }); 53 | }); -------------------------------------------------------------------------------- /demos/_sources/_layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {{#css}} 20 | 21 | {{/css}} 22 | {{{ body }}} 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | {{#includes}}{{/includes}} 38 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demos/_sources/geojson/dnd-geojson.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var parser = T5.Registry.create('parser', 'geojson'), 3 | container = $('#mapContainer')[0]; 4 | 5 | map = new T5.Map('mapContainer', { 6 | renderer: 'canvas', 7 | padding: 'auto' 8 | }); 9 | 10 | map.layer('tiles', 'tile', { 11 | generator: 'osm.cloudmade', 12 | // demo api key, register for an API key at http://dev.cloudmade.com/ 13 | apikey: '7960daaf55f84bfdb166014d0b9f8d41' 14 | }); 15 | 16 | map.center(DEMO.getHomePosition()).zoom(4); 17 | 18 | container.addEventListener("dragover", function (evt) { 19 | evt.preventDefault(); 20 | }, false); 21 | 22 | // Handle dropped image file - only Firefox and Google Chrome 23 | container.addEventListener("drop", function (evt) { 24 | var files = evt.dataTransfer.files; 25 | if (files.length > 0) { 26 | var file = files[0]; 27 | if (typeof FileReader !== "undefined") { 28 | var reader = new FileReader(); 29 | // Note: addEventListener doesn't work in Google Chrome for this event 30 | reader.onload = function (evt) { 31 | parser(map, JSON.parse(evt.target.result), function(layers) { 32 | for (var key in layers) { 33 | layers[key].visible = true; 34 | } // for 35 | 36 | map.invalidate(); 37 | }); 38 | }; 39 | reader.readAsText(file); 40 | } 41 | } 42 | evt.preventDefault(); 43 | }, false); 44 | })(); -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # Tile5 - Alternative HTML5 Mapping 2 | 3 | 4 | 5 | 6 | ## Tile5 Refresh 7 | 8 | I'm currently doing a refresh on Tile5 to make it have some points of difference from other Mapping libraries. If you are looking for a great, stable mapping library, then I would recommend checking out [LeafletJS](http://leaflet.cloudmade.com/). It is far and away the best choice. 9 | 10 | Additionally, if you want to work with older version of Tile5 (unsupported) then the best place for you to start is probably the [pre-refresh tag](https://github.com/DamonOehlman/tile5/tree/pre-refresh/). 11 | 12 | The new version will essentially abandon previous work using CSS3D transforms and focus purely on manipulating a `` element to draw a tile layer with annotations. In summary it will: 13 | 14 | - have Canvas and WebGL renderers only 15 | - provide support for drawing non-mapping interfaces as well as maps 16 | 17 | ## About Tile5 18 | 19 | Tile5 is a progressive HTML5 mapping library that uses the stuff that "all the cool kids" are playing with and makes a mapping library with it. 20 | 21 | - Is it the most stable *new* mapping library on the planet. No. It isn't. 22 | - Is it the most activately maintained mapping library. Definitely not. 23 | - Is it the fastest mapping library around. It's pretty good, but probably not. 24 | 25 | If you are up for a bit of experimentation with your mapping, and you are keen to see what is actually possible, then I'd certainly say have a play with Tile5. There are lots of other good libraries out there though, and I'll get a comparison up of them on the Sidelab blog as soon as I can. 26 | 27 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/codemirror.css: -------------------------------------------------------------------------------- 1 | .CodeMirror { 2 | line-height: 1em; 3 | font-family: monospace; 4 | } 5 | 6 | .CodeMirror-scroll { 7 | overflow: auto; 8 | height: 300px; 9 | /* This is needed to prevent an IE[67] bug where the scrolled content 10 | is visible outside of the scrolling box. */ 11 | position: relative; 12 | } 13 | 14 | .CodeMirror-gutter { 15 | position: absolute; left: 0; top: 0; 16 | z-index: 10; 17 | background-color: #f7f7f7; 18 | border-right: 1px solid #eee; 19 | min-width: 2em; 20 | height: 100%; 21 | } 22 | .CodeMirror-gutter-text { 23 | color: #aaa; 24 | text-align: right; 25 | padding: .4em .2em .4em .4em; 26 | } 27 | .CodeMirror-lines { 28 | padding: .4em; 29 | } 30 | 31 | .CodeMirror pre { 32 | -moz-border-radius: 0; 33 | -webkit-border-radius: 0; 34 | -o-border-radius: 0; 35 | border-radius: 0; 36 | border-width: 0; margin: 0; padding: 0; background: transparent; 37 | font-family: inherit; 38 | font-size: inherit; 39 | padding: 0; margin: 0; 40 | white-space: pre; 41 | word-wrap: normal; 42 | } 43 | 44 | .CodeMirror textarea { 45 | font-family: inherit !important; 46 | font-size: inherit !important; 47 | } 48 | 49 | .CodeMirror-cursor { 50 | z-index: 10; 51 | position: absolute; 52 | visibility: hidden; 53 | border-left: 1px solid black !important; 54 | } 55 | .CodeMirror-focused .CodeMirror-cursor { 56 | visibility: visible; 57 | } 58 | 59 | span.CodeMirror-selected { 60 | background: #ccc !important; 61 | color: HighlightText !important; 62 | } 63 | .CodeMirror-focused span.CodeMirror-selected { 64 | background: Highlight !important; 65 | } 66 | 67 | .CodeMirror-matchingbracket {color: #0f0 !important;} 68 | .CodeMirror-nonmatchingbracket {color: #f22 !important;} 69 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: PHP mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

CodeMirror 2: PHP mode

18 | 19 |
30 | 31 | 42 | 43 |

Simple HTML/PHP mode based on 44 | the C-like mode. Depends on XML, 45 | JavaScript, CSS, and C-like modes.

46 | 47 |

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

48 | 49 | 50 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Smalltalk mode 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 |

CodeMirror 2: Smalltalk mode

18 | 19 |
42 | 43 | 51 | 52 |

Simple Smalltalk mode.

53 | 54 |

MIME types defined: text/x-stsrc.

55 | 56 | 57 | -------------------------------------------------------------------------------- /dist/engines/static.js: -------------------------------------------------------------------------------- 1 | /** 2 | # GENERATOR: static 3 | */ 4 | T5.Registry.register('generator', 'static', function(params) { 5 | params = T5.ex({ 6 | tiles: [], 7 | loadTimeout: 10000 8 | }, params); 9 | 10 | /* internals */ 11 | 12 | function loadTileImage(tileData, callback) { 13 | T5.getImage(tileData.url, function(image) { 14 | // create the tile 15 | callback(new T5.Tile( 16 | tileData.x, 17 | tileData.y, 18 | tileData.url, 19 | image.width, 20 | image.height 21 | )); 22 | }); 23 | } // loadTileImage 24 | 25 | /* exports */ 26 | 27 | function run(view, viewport, storage, callback) { 28 | var loaded = 0, 29 | callbackTriggered = false, 30 | loaderTimeout; 31 | 32 | // iterate through the tile definitions and create as actuall tiles 33 | for (var ii = params.tiles.length; ii--; ) { 34 | loadTileImage(params.tiles[ii], function(tile) { 35 | storage.insert(tile, tile); 36 | 37 | loaded++; 38 | if (loaded >= params.tiles.length && callback && (! callbackTriggered)) { 39 | clearTimeout(loaderTimeout); 40 | callback(); 41 | } // if 42 | }); 43 | } // for 44 | 45 | // auto fire the callback after a period of time 46 | loaderTimeout = setTimeout(function() { 47 | callback(); 48 | }, params.loadTimeout); 49 | } // run 50 | 51 | /* define the generator */ 52 | 53 | // initialise the generator 54 | var _self = { 55 | run: run 56 | }; 57 | 58 | return _self; 59 | }); -------------------------------------------------------------------------------- /src/engines/static.js: -------------------------------------------------------------------------------- 1 | /** 2 | # GENERATOR: static 3 | */ 4 | T5.Registry.register('generator', 'static', function(params) { 5 | params = T5.ex({ 6 | tiles: [], 7 | loadTimeout: 10000 8 | }, params); 9 | 10 | /* internals */ 11 | 12 | function loadTileImage(tileData, callback) { 13 | T5.getImage(tileData.url, function(image) { 14 | // create the tile 15 | callback(new T5.Tile( 16 | tileData.x, 17 | tileData.y, 18 | tileData.url, 19 | image.width, 20 | image.height 21 | )); 22 | }); 23 | } // loadTileImage 24 | 25 | /* exports */ 26 | 27 | function run(view, viewport, storage, callback) { 28 | var loaded = 0, 29 | callbackTriggered = false, 30 | loaderTimeout; 31 | 32 | // iterate through the tile definitions and create as actuall tiles 33 | for (var ii = params.tiles.length; ii--; ) { 34 | loadTileImage(params.tiles[ii], function(tile) { 35 | storage.insert(tile, tile); 36 | 37 | loaded++; 38 | if (loaded >= params.tiles.length && callback && (! callbackTriggered)) { 39 | clearTimeout(loaderTimeout); 40 | callback(); 41 | } // if 42 | }); 43 | } // for 44 | 45 | // auto fire the callback after a period of time 46 | loaderTimeout = setTimeout(function() { 47 | callback(); 48 | }, params.loadTimeout); 49 | } // run 50 | 51 | /* define the generator */ 52 | 53 | // initialise the generator 54 | var _self = { 55 | run: run 56 | }; 57 | 58 | return _self; 59 | }); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: XML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: XML mode

14 |
26 | 29 |

The XML mode supports two configuration parameters:

30 |
31 |
htmlMode (boolean)
32 |
This switches the mode to parse HTML instead of XML. This 33 | means attributes do not have to be quoted, and some elements 34 | (such as br) do not require a closing tag.
35 |
alignCDATA (boolean)
36 |
Setting this to true will force the opening tag of CDATA 37 | blocks to not be indented.
38 |
39 | 40 |

MIME types defined: application/xml, text/html.

41 | 42 | 43 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/htmlmixed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: HTML mixed mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror 2: HTML mixed mode

17 |
41 | 44 | 45 |

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

46 | 47 |

MIME types defined: text/html 48 | (redefined, only takes effect if you load this parser after the 49 | XML parser).

50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /test/visual/xy-rotation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tile5 Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 49 | 50 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/plsql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Oracle PL/SQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Oracle PL/SQL mode

14 | 15 |
47 | 48 | 56 | 57 |

58 | Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). 59 |

60 | 61 |

MIME type defined: text/x-plsql 62 | (PLSQL code) 63 | 64 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-eclipse.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/eclipse",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-eclipse .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-eclipse .ace_gutter { width: 50px; background: rgb(227, 227, 227); border-right: 1px solid rgb(159, 159, 159);\t color: rgb(136, 136, 136);}.ace-eclipse .ace_gutter-layer { width: 100%; text-align: right;}.ace-eclipse .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-eclipse .ace_print_margin { width: 1px; background: #b1b4ba;}.ace-eclipse .ace_text-layer { cursor: text;}.ace-eclipse .ace_cursor { border-left: 1px solid black;}.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable { color: rgb(127, 0, 85);}.ace-eclipse .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-eclipse .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-eclipse .ace_line .ace_function { color: rgb(60, 76, 114);}.ace-eclipse .ace_line .ace_string { color: rgb(42, 0, 255);}.ace-eclipse .ace_line .ace_comment { color: rgb(63, 127, 95);}.ace-eclipse .ace_line .ace_comment.ace_doc { color: rgb(63, 95, 191);}.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(127, 159, 191);}.ace-eclipse .ace_line .ace_constant.ace_numeric {}.ace-eclipse .ace_line .ace_tag { color: rgb(63, 127, 127);}.ace-eclipse .ace_line .ace_type { color: rgb(127, 0, 127);}.ace-eclipse .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_line .ace_meta.ace_tag { color:rgb(63, 127, 127);}.ace-eclipse .ace_entity.ace_other.ace_attribute-name { color:rgb(127, 0, 127);}.ace-eclipse .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}";d.importCssString(e),b.cssClass="ace-eclipse"}) -------------------------------------------------------------------------------- /demos/_demogen/js/keymaster.min.js: -------------------------------------------------------------------------------- 1 | // keymaster.js 2 | // (c) 2011 Thomas Fuchs 3 | // keymaster.js may be freely distributed under the MIT license. 4 | (function(a){function m(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,function(){c(window.event)})}function l(a){e=a||"all"}function k(a,b,d){var e,h,i,j;d===undefined&&(d=b,b="all"),a=a.replace(/\s/g,""),e=a.split(","),e[e.length-1]==""&&(e[e.length-2]+=",");for(i=0;i1){h=a.slice(0,a.length-1);for(j=0;j0;for(j in d)if(!d[j]&&h(i.mods,+j)>-1||d[j]&&h(i.mods,+j)==-1)m=!1;(i.mods.length==0&&!d[16]&&!d[18]&&!d[17]&&!d[91]||m)&&i.method(a,i)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}}}function h(a,b){var c=a.length;while(c--)if(a[c]===b)return c;return-1}var b,c={},d={16:!1,18:!1,17:!1,91:!1},e="all",f={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},g={backspace:8,tab:9,clear:12,enter:13,"return":13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220};for(b=1;b<20;b++)f["f"+b]=111+b;for(b in f)k[b]=!1;m(document,"keydown",i),m(document,"keyup",j),a.key=k,a.key.setScope=l,typeof module!="undefined"&&(module.exports=key)})(this) -------------------------------------------------------------------------------- /src/core/graphics/layers/tilelayer.js: -------------------------------------------------------------------------------- 1 | /** 2 | # LAYER: tile 3 | */ 4 | reg('layer', 'tile', function(view, panFrame, container, params) { 5 | params = cog.extend({ 6 | generator: 'osm', 7 | imageLoadArgs: {} 8 | }, params); 9 | 10 | // initialise variables 11 | var TILELOAD_MAX_PANSPEED = 2, 12 | genFn = regCreate('generator', params.generator, view, params).run, 13 | generating = false, 14 | storage = null, 15 | zoomTrees = [], 16 | loadArgs = params.imageLoadArgs; 17 | 18 | /* event handlers */ 19 | 20 | function handleRefresh(evt) { 21 | if (storage) { 22 | // fire the generator 23 | genFn(storage, view.invalidate); 24 | } // if 25 | } // handleViewIdle 26 | 27 | function handleReset(evt) { 28 | storage.clear(); 29 | } // reset 30 | 31 | function handleResync(evt) { 32 | // get the zoom level for the view 33 | var zoomLevel = view && view.zoom ? view.zoom() : 0; 34 | 35 | if (! zoomTrees[zoomLevel]) { 36 | zoomTrees[zoomLevel] = createStoreForZoomLevel(zoomLevel); 37 | } // if 38 | 39 | storage = zoomTrees[zoomLevel]; 40 | } // handleParentChange 41 | 42 | /* exports */ 43 | 44 | /** 45 | ### draw(renderer) 46 | */ 47 | function draw(renderer, viewport, view) { 48 | if (renderer.drawTiles) { 49 | renderer.drawTiles( 50 | viewport, 51 | storage.search(viewport.buffer(128)), 52 | view.panSpeed < TILELOAD_MAX_PANSPEED); 53 | } // if 54 | } // draw 55 | 56 | /* definition */ 57 | 58 | var _self = cog.extend(new ViewLayer(view, panFrame, container, params), { 59 | draw: draw 60 | }); 61 | 62 | view.bind('resync', handleResync); 63 | view.bind('refresh', handleRefresh); 64 | view.bind('reset', handleReset); 65 | 66 | return _self; 67 | }); 68 | -------------------------------------------------------------------------------- /demos/_sources/animation/map-markers/demo.js: -------------------------------------------------------------------------------- 1 | var arcRadius = 500, // distance in km 2 | angle = 0, 3 | sample = { 4 | speed: 2 5 | }, 6 | startPosition = map.center(), 7 | planeStart = map.center().offset(0, -arcRadius), 8 | lastTickCount = 0, 9 | TWO_PI = Math.PI * 2, 10 | plane; 11 | 12 | function getPlaneScale() { 13 | return (map.zoom() / 16) * 0.7; 14 | } // getPlaneScale 15 | 16 | function movePlane(evt, viewport, tickCount) { 17 | // if we have a last tick count we can perform some animation 18 | if (lastTickCount) { 19 | var deltaChange = (tickCount - lastTickCount) / (10000 / sample.speed), 20 | newPosition; 21 | 22 | // calculate the angle 23 | angle = (angle + (TWO_PI * deltaChange)) % TWO_PI; 24 | newPosition = startPosition.offset( 25 | arcRadius * Math.sin(angle), 26 | arcRadius * Math.cos(angle) 27 | ); 28 | 29 | // update the plane's position 30 | plane.xy = new T5.GeoXY(newPosition).sync(map); 31 | 32 | // rotate the plane 33 | plane.rotate(deltaChange * -360); 34 | map.invalidate(); 35 | } 36 | 37 | lastTickCount = tickCount; 38 | // map.invalidate(); 39 | } // movePlane 40 | 41 | plane = map.layer('markers').create('marker', { 42 | xy: new T5.GeoXY(planeStart), 43 | markerType: 'image', 44 | size: 100, 45 | imageUrl: 'img/plane.png' 46 | }); 47 | 48 | // make the plane transformable 49 | plane.scale(getPlaneScale()); 50 | 51 | // handle the draw complete 52 | map.bind('drawComplete', movePlane); 53 | 54 | // handle zoom level changes 55 | map.bind('zoomLevelChange', function(evt, zoomLevel) { 56 | plane.scale = getPlaneScale(); 57 | }); 58 | 59 | // handle tapping markers 60 | map.bind('tapHit', function(evt, elements, absXY, relXY, offsetXY) { 61 | // DEMORUNNER.status('tapped the plane', 1200); 62 | }); 63 | 64 | /* 65 | var ui = DEMO.makeSampleUI(); 66 | ui.gui.add(sample, 'speed', 1, 10); 67 | ui.done(); 68 | */ -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Lua mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Lua mode

14 |
55 | 62 | 63 |

Loosely based on Franciszek 64 | Wawrzak's CodeMirror 65 | 1 mode. One configuration parameter is 66 | supported, specials, to which you can provide an 67 | array of strings to have those identifiers highlighted with 68 | the lua-special style.

69 |

MIME types defined: text/x-lua.

70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Haskell mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Haskell mode

14 | 15 |
49 | 50 | 57 | 58 |

MIME types defined: text/x-haskell.

59 | 60 | 61 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/mode-textile.js: -------------------------------------------------------------------------------- 1 | define("ace/mode/textile",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/textile_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/textile_highlight_rules").TextileHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.getNextLineIndent=function(a,b,c){return a=="intag"?c:""},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/textile_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"keyword",token:function(a){return a.match(/^h\d$/)?"markup.heading."+a.charAt(1):"markup.heading"},regex:"h1|h2|h3|h4|h5|h6|bq|p|bc|pre",next:"blocktag"},{token:"keyword",regex:"[\\*]+|[#]+"},{token:"text",regex:".+"}],blocktag:[{token:"keyword",regex:"\\. ",next:"start"},{token:"keyword",regex:"\\(",next:"blocktagproperties"}],blocktagproperties:[{token:"keyword",regex:"\\)",next:"blocktag"},{token:"string",regex:"[a-zA-Z0-9\\-_]+"},{token:"keyword",regex:"#"}]}};d.inherits(f,e),b.TextileHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}) -------------------------------------------------------------------------------- /demos/_demogen/codemirror/overlay.js: -------------------------------------------------------------------------------- 1 | // Utility function that allows modes to be combined. The mode given 2 | // as the base argument takes care of most of the normal mode 3 | // functionality, but a second (typically simple) mode is used, which 4 | // can override the style of text. Both modes get to parse all of the 5 | // text, but when both assign a non-null style to a piece of code, the 6 | // overlay wins, unless the combine argument was true, in which case 7 | // the styles are combined. 8 | 9 | CodeMirror.overlayParser = function(base, overlay, combine) { 10 | return { 11 | startState: function() { 12 | return { 13 | base: CodeMirror.startState(base), 14 | overlay: CodeMirror.startState(overlay), 15 | basePos: 0, baseCur: null, 16 | overlayPos: 0, overlayCur: null 17 | }; 18 | }, 19 | copyState: function(state) { 20 | return { 21 | base: CodeMirror.copyState(base, state.base), 22 | overlay: CodeMirror.copyState(overlay, state.overlay), 23 | basePos: state.basePos, baseCur: null, 24 | overlayPos: state.overlayPos, overlayCur: null 25 | }; 26 | }, 27 | 28 | token: function(stream, state) { 29 | if (stream.start == state.basePos) { 30 | state.baseCur = base.token(stream, state.base); 31 | state.basePos = stream.pos; 32 | } 33 | if (stream.start == state.overlayPos) { 34 | stream.pos = stream.start; 35 | state.overlayCur = overlay.token(stream, state.overlay); 36 | state.overlayPos = stream.pos; 37 | } 38 | stream.pos = Math.min(state.basePos, state.overlayPos); 39 | if (stream.eol()) state.basePos = state.overlayPos = 0; 40 | 41 | if (state.overlayCur == null) return state.baseCur; 42 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; 43 | else return state.overlayCur; 44 | }, 45 | 46 | indent: function(state, textAfter) { 47 | return base.indent(state.base, textAfter); 48 | }, 49 | electricChars: base.electricChars 50 | }; 51 | }; 52 | -------------------------------------------------------------------------------- /demos/_sources/animation/map-panning/demo.js: -------------------------------------------------------------------------------- 1 | // initialise geonames url 2 | var cities = [{ 3 | name: 'Moscow', 4 | pos: '55.7522222 37.6155556', 5 | population: 10381222 6 | }, { 7 | name: 'London', 8 | pos: '51.508528775862885 -0.12574195861816406', 9 | population: 7556900 10 | 11 | }, { 12 | name: 'Baghdad', 13 | pos: '33.340582 44.400876', 14 | population: 5672513 15 | }, { 16 | name: 'Ankara', 17 | pos: '39.9198743755027 32.8542709350586', 18 | population: 3517182 19 | 20 | }, { 21 | name: 'Berlin', 22 | pos: '52.524368165134284 13.410530090332031', 23 | population: 3426354 24 | }, { 25 | name: 'Madrid', 26 | pos: '40.4165020941502 -3.70256423950195', 27 | population: 3255944 28 | }, { 29 | name: 'Roma', 30 | pos: '41.8947384616695 12.4839019775391', 31 | population: 2563241 32 | }, { 33 | name: 'Paris', 34 | pos: '48.85341 2.3488', 35 | population: 2138551 36 | }]; 37 | 38 | // initialise variables 39 | var sample = { 40 | easing: 'sine.out' 41 | }, 42 | cityIndex = 0; 43 | 44 | /* define some internal functions */ 45 | 46 | function nextCity() { 47 | var cityData = cities[cityIndex++]; 48 | 49 | // clear the map markers and add one for the new city 50 | // pan to the next city position 51 | map.center(cityData.pos, null, { 52 | easing: sample.easing, 53 | duration: 2500, 54 | complete: nextCity 55 | }); 56 | 57 | if (cityIndex >= cities.length) { 58 | cityIndex = 0; 59 | } // if 60 | } 61 | 62 | // add the map markers 63 | for (var ii = cities.length; ii--; ) { 64 | map.layer('markers').create('marker', { 65 | xy: cities[ii].pos 66 | }); 67 | } // for 68 | 69 | setTimeout(nextCity, 1000); 70 | 71 | /* 72 | var sampleUI = DEMO.makeSampleUI(); 73 | sampleUI.gui.add(sample, 'easing').options('sine.out', 'back.out', 'bounce.out', 'elastic.out'); 74 | sampleUI.done(); 75 | */ -------------------------------------------------------------------------------- /demos/_sources/drawing/creator/demo.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // internals 3 | var ui, 4 | drawLayer, 5 | sample = { 6 | type: 'marker', 7 | rotation: 0, 8 | scale: 1, 9 | selection: null, 10 | 11 | selectAll: selectAll 12 | }; 13 | 14 | function handleTap(evt, absXY, relXY, projectedXY, hits) { 15 | var drawable = drawLayer.create(sample.type, { 16 | draggable: true, 17 | xy: projectedXY 18 | }); 19 | 20 | // set scale and rotation 21 | drawable.scale(sample.scale, false, true); 22 | drawable.rotate(sample.rotation, false, true); 23 | 24 | // update the selection 25 | sample.selection = [drawable]; 26 | 27 | // invalidate the map 28 | map.invalidate(); 29 | } // handleTap 30 | 31 | function rotateSelection(value) { 32 | for (var ii = sample.selection.length; ii--; ) { 33 | sample.selection[ii].rotate(value, false, true); 34 | } // for 35 | 36 | map.invalidate(); 37 | } // rotateSelection 38 | 39 | function scaleSelection(value) { 40 | for (var ii = sample.selection.length; ii--; ) { 41 | sample.selection[ii].scale(value, false, true); 42 | } // for 43 | 44 | map.invalidate(); 45 | } // scaleSelection 46 | 47 | function selectAll() { 48 | sample.selection = drawLayer.find(); 49 | } // selectAll 50 | 51 | // make a simple map 52 | DEMO.makeMap(); 53 | 54 | // create the draw layer 55 | drawLayer = map.layer('shapes', 'draw'); 56 | 57 | // bind the tap event to create objects 58 | map.bind('tap', handleTap); 59 | 60 | ui = DEMO.makeSampleUI(); 61 | ui.gui.add(sample, 'type').options('marker'); 62 | ui.gui.add(sample, 'rotation', 0, 360, 1).onChange(rotateSelection); 63 | ui.gui.add(sample, 'scale', 0.25, 4).onChange(scaleSelection); 64 | ui.gui.add(sample, 'selectAll').name('Select All'); 65 | ui.done(); 66 | })(); -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tile5 Tests 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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 51 | 55 | 56 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: YAML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: YAML mode

14 |
61 | 64 | 65 |

MIME types defined: text/x-yaml.

66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/T5.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | // req: shim[js#Array.indexOf] 4 | // req: cog[fn#extend, fn#easing, fn#log, fn#observable, fn#configurable, fn#jsonp] 5 | // req: eve, sniff, formatter, interact, geojs 6 | 7 | /** 8 | # T5(target, settings, viewId) 9 | */ 10 | function T5(target, settings) { 11 | settings = cog.extend({ 12 | container: target, 13 | type: 'map', 14 | renderer: 'canvas', 15 | starpos: null, 16 | zoom: 1, 17 | fastpan: false, 18 | drawOnScale: true 19 | }, settings); 20 | 21 | // create the view 22 | return regCreate('view', settings.type, settings); 23 | } // Tile5 24 | 25 | // define T5 26 | cog.observable(T5); 27 | 28 | //= core/registry 29 | //= core/messages 30 | //= core/functions 31 | //= core/constants 32 | //= core/shorts 33 | //= core/animator 34 | //= core/parser 35 | //= core/dom 36 | //= core/runner 37 | 38 | //= core/geo/projections/default 39 | //= core/types/xy 40 | //= core/types/line 41 | //= core/types/geoxy 42 | //= core/types/rect 43 | 44 | //= core/hits 45 | //= core/spatialstore 46 | 47 | //= core/images/loader 48 | //= core/images/tile 49 | 50 | //= core/renderers/base 51 | //= core/renderers/canvas 52 | //= core/renderers/dom 53 | 54 | //= core/graphics/style 55 | //= core/graphics/view 56 | //= core/graphics/map 57 | //= core/graphics/tweener 58 | 59 | //= core/graphics/drawables/core 60 | //= core/graphics/drawables/marker 61 | //= core/graphics/drawables/poly 62 | //= core/graphics/drawables/line 63 | //= core/graphics/drawables/image 64 | //= core/graphics/drawables/arc 65 | 66 | //= core/graphics/layers/viewlayer 67 | //= core/graphics/layers/tilelayer 68 | //= core/graphics/layers/drawlayer 69 | 70 | //= engines/osm 71 | 72 | /** 73 | # T5 74 | 75 | ## Methods 76 | */ 77 | cog.extend(T5, cog, { 78 | /** 79 | ### fn(name) 80 | */ 81 | fn: function(name) { 82 | return regGet('fn', name); 83 | }, 84 | 85 | project: _project, 86 | unproject: _unproject, 87 | 88 | getImage: getImage, 89 | 90 | Registry: Registry, 91 | Style: Style, 92 | DOM: DOM, 93 | Rect: Rect, 94 | XY: XY, 95 | GeoXY: GeoXY, 96 | Line: Line, 97 | 98 | Tile: Tile, 99 | Tweener: Tweener, 100 | 101 | ViewLayer: ViewLayer, 102 | View: View, 103 | Map: Map 104 | }); -------------------------------------------------------------------------------- /src/core/graphics/style.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.Style 3 | 4 | ## Methods 5 | */ 6 | var Style = (function() { 7 | 8 | /* internals */ 9 | 10 | var styles = {}; 11 | 12 | /** 13 | ### define() 14 | 15 | The define method can be used in two ways. Firstly, you can use the 16 | method to define a single new style: 17 | 18 | ```js 19 | var styleId = T5.Style.define('new-style', { 20 | fill: '#FF0000', 21 | opacity: 0.8 22 | }); 23 | ``` 24 | 25 | Additionally, instead of passing through a single style definition you 26 | can pass through multiple definitions in a single hit: 27 | 28 | ```js 29 | T5.Style.define({ 30 | blueStyle: { 31 | fill: '#0000FF' 32 | }, 33 | greenStyle: { 34 | fill: '#00FF00' 35 | } 36 | }); 37 | */ 38 | function define(p1, p2) { 39 | if (sniff(p1) == 'string') { 40 | T5.trigger('styleDefined', p1, styles[p1] = p2); 41 | 42 | return p1; 43 | } 44 | else { 45 | var ids = []; 46 | 47 | for (var styleId in p1) { 48 | ids[ids.length] = define(styleId, p1[styleId]); 49 | } // for 50 | 51 | return ids; 52 | } // if..else 53 | } // define 54 | 55 | /** 56 | ### each(callback) 57 | */ 58 | function each(callback) { 59 | for (var id in styles) { 60 | callback(id, styles[id]); 61 | } // for 62 | } // each 63 | 64 | /** 65 | ### get(id) 66 | */ 67 | function get(id) { 68 | return styles[id]; 69 | } // get 70 | 71 | // define the core styles 72 | define({ 73 | reset: { 74 | fill: '#ffffff', 75 | opacity: 1.0 76 | }, 77 | 78 | highlight: { 79 | fill: '#ff0000' 80 | }, 81 | 82 | waypoints: { 83 | lineWidth: 4, 84 | stroke: '#003377', 85 | fill: '#ffffff' 86 | }, 87 | 88 | waypointsHover: { 89 | lineWidth: 4, 90 | stroke: '#ff0000', 91 | fill: '#ffffff' 92 | } 93 | }); 94 | 95 | return { 96 | resetStyle: STYLE_RESET, 97 | 98 | each: each, 99 | get: get, 100 | define: define 101 | }; 102 | })(); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/scheme/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Scheme mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Scheme mode

14 |
58 | 61 | 62 |

MIME types defined: text/x-scheme.

63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/core/renderers/base.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.Renderer 3 | 4 | ## Events 5 | Renderers fire the following events: 6 | 7 | ### detach 8 | 9 | ### predraw 10 | 11 | ### render 12 | 13 | ### reset 14 | 15 | */ 16 | var Renderer = function(view, container, outer, params) { 17 | 18 | /* internals */ 19 | 20 | /* exports */ 21 | 22 | var _this = { 23 | fastpan: true, 24 | 25 | /** 26 | ### applyStyle(style: T5.Style): string 27 | */ 28 | applyStyle: function(style) { 29 | }, 30 | 31 | /** 32 | ### applyTransform(drawable: T5.Drawable, offsetX: int, offsetY: int) 33 | */ 34 | applyTransform: function(drawable, offsetX, offsetY) { 35 | return { 36 | restore: null, 37 | x: offsetX, 38 | y: offsetY 39 | }; 40 | }, 41 | 42 | /** 43 | ### getDimensions() 44 | */ 45 | getDimensions: function() { 46 | return { 47 | width: 0, 48 | height: 0 49 | }; 50 | }, 51 | 52 | /** 53 | ### getViewport() 54 | */ 55 | getViewport: function() { 56 | }, 57 | 58 | /** 59 | ### hitTest(drawData, hitX, hitY): boolean 60 | */ 61 | hitTest: function(drawData, hitX, hitY) { 62 | return false; 63 | }, 64 | 65 | /** 66 | ### projectXY(srcX, srcY) 67 | This function is optionally implemented by a renderer to manually take 68 | care of projecting an x and y coordinate to the target drawing area. 69 | */ 70 | projectXY: null, 71 | 72 | /** 73 | ### reset() 74 | */ 75 | reset: function() { 76 | } 77 | }; 78 | 79 | return cog.observable(_this); 80 | }; 81 | 82 | /** 83 | # attachRenderer(id, view, container, params) 84 | */ 85 | function attachRenderer(id, view, container, outer, params) { 86 | // split the id on slashes as multiple renderers may have been requested 87 | var ids = id.split('/'), 88 | renderer = new Renderer(view, container, outer, params); 89 | 90 | // iterate through the renderers and create the resulting renderer 91 | for (var ii = 0; ii < ids.length; ii++) { 92 | renderer = regCreate('renderer', ids[ii], view, container, outer, params, renderer); 93 | } // for 94 | 95 | // return the result of combining each of the renderers in order 96 | return renderer; 97 | }; -------------------------------------------------------------------------------- /src/core/types/line.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.Line 3 | 4 | ## Methods 5 | */ 6 | function Line(allowCull) { 7 | this.allowCull = allowCull; 8 | this.points = []; 9 | }; 10 | 11 | Line.prototype = cog.extend(new Array(), { 12 | /** 13 | ### cull(viewport) 14 | */ 15 | cull: function(viewport) { 16 | // if culling is allowed, then points to those within the viewport 17 | if (this.allowCull) { 18 | var minX = viewport.x, 19 | minY = viewport.y, 20 | maxX = viewport.x + viewport.w, 21 | maxY = viewport.y + viewport.h, 22 | firstIdx = Infinity, 23 | lastIdx = 0, 24 | points = this.points, 25 | inVP; 26 | 27 | // iterate through the points in the array 28 | for (var ii = points.length; ii--; ) { 29 | // determine whether the current point is within the viewport 30 | inVP = points[ii].x >= minX && points[ii].x <= maxX && 31 | points[ii].y >= minY && points[ii].y <= maxY; 32 | 33 | // if so, update teh first and last indexes 34 | if (inVP) { 35 | firstIdx = ii < firstIdx ? ii : firstIdx; 36 | lastIdx = ii > lastIdx ? ii : lastIdx; 37 | } // if 38 | } // for 39 | 40 | // create a slice of the points for the visible points 41 | // including one point either side 42 | return points.slice(max(firstIdx - 2, 0), min(lastIdx + 2, points.length)); 43 | } // if 44 | 45 | // otherwise just return the array 46 | return this.points; 47 | }, 48 | 49 | /** 50 | ### simplify(generalization) 51 | */ 52 | simplify: function(generalization) { 53 | // set the the default generalization 54 | generalization = generalization || VECTOR_SIMPLIFICATION; 55 | 56 | var tidied = new Line(this.allowCull), 57 | points = this.points, 58 | last = null; 59 | 60 | for (var ii = points.length; ii--; ) { 61 | var current = points[ii]; 62 | 63 | // determine whether the current point should be included 64 | include = !last || ii === 0 || 65 | (abs(current.x - last.x) + 66 | abs(current.y - last.y) > 67 | generalization); 68 | 69 | if (include) { 70 | tidied.points.unshift(current); 71 | last = current; 72 | } 73 | } // for 74 | 75 | return tidied; 76 | } 77 | }); -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-pastel_on_dark.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/pastel_on_dark",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-pastel-on-dark .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-pastel-on-dark .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-pastel-on-dark .ace_gutter-layer { width: 100%; text-align: right;}.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-pastel-on-dark .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-pastel-on-dark .ace_scroller { background-color: #2c2828;}.ace-pastel-on-dark .ace_text-layer { cursor: text; color: #8f938f;}.ace-pastel-on-dark .ace_cursor { border-left: 2px solid #A7A7A7;}.ace-pastel-on-dark .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #A7A7A7;} .ace-pastel-on-dark .ace_marker-layer .ace_selection { background: rgba(221, 240, 255, 0.20);}.ace-pastel-on-dark .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-pastel-on-dark .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.25);}.ace-pastel-on-dark .ace_marker-layer .ace_active_line { background: rgba(255, 255, 255, 0.031);} .ace-pastel-on-dark .ace_invisible { color: rgba(255, 255, 255, 0.25);}.ace-pastel-on-dark .ace_keyword { color:#757ad8;}.ace-pastel-on-dark .ace_keyword.ace_operator { color:#797878;}.ace-pastel-on-dark .ace_constant { color:#4fb7c5;}.ace-pastel-on-dark .ace_constant.ace_language { }.ace-pastel-on-dark .ace_constant.ace_library { }.ace-pastel-on-dark .ace_constant.ace_numeric { }.ace-pastel-on-dark .ace_invalid { }.ace-pastel-on-dark .ace_invalid.ace_illegal { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-pastel-on-dark .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#D2A8A1;}.ace-pastel-on-dark .ace_support { color:#9a9a9a;}.ace-pastel-on-dark .ace_support.ace_function { color:#aeb2f8;}.ace-pastel-on-dark .ace_function.ace_buildin { }.ace-pastel-on-dark .ace_string { color:#66a968;}.ace-pastel-on-dark .ace_string.ace_regexp { color:#E9C062;}.ace-pastel-on-dark .ace_comment { color:#656865;}.ace-pastel-on-dark .ace_comment.ace_doc { color:A6C6FF;}.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag { color:A6C6FF;}.ace-pastel-on-dark .ace_variable { color:#bebf55;}.ace-pastel-on-dark .ace_variable.ace_language { color:#bebf55;}.ace-pastel-on-dark .ace_markup.ace_underline { text-decoration:underline;}.ace-pastel-on-dark .ace_xml_pe { color:#494949;}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"}) -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/r/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: R mode 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 |

CodeMirror 2: R mode

20 |
63 | 66 | 67 |

MIME types defined: text/x-rsrc.

68 | 69 |

Development of the CodeMirror R mode was kindly sponsored 70 | by Ubalo, who hold 71 | the license.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-clouds.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/clouds",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-clouds .ace_gutter-layer { width: 100%; text-align: right;}.ace-clouds .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-clouds .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-clouds .ace_scroller { background-color: #FFFFFF;}.ace-clouds .ace_text-layer { cursor: text; color: #000000;}.ace-clouds .ace_cursor { border-left: 2px solid #000000;}.ace-clouds .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-clouds .ace_marker-layer .ace_selection { background: #BDD5FC;}.ace-clouds .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds .ace_marker-layer .ace_active_line { background: #FFFBD1;} .ace-clouds .ace_invisible { color: #BFBFBF;}.ace-clouds .ace_keyword { color:#AF956F;}.ace-clouds .ace_keyword.ace_operator { color:#484848;}.ace-clouds .ace_constant { }.ace-clouds .ace_constant.ace_language { color:#39946A;}.ace-clouds .ace_constant.ace_library { }.ace-clouds .ace_constant.ace_numeric { color:#46A609;}.ace-clouds .ace_invalid { background-color:#FF002A;}.ace-clouds .ace_invalid.ace_illegal { }.ace-clouds .ace_invalid.ace_deprecated { }.ace-clouds .ace_support { }.ace-clouds .ace_support.ace_function { color:#C52727;}.ace-clouds .ace_function.ace_buildin { }.ace-clouds .ace_string { color:#5D90CD;}.ace-clouds .ace_string.ace_regexp { }.ace-clouds .ace_comment { color:#BCC8BA;}.ace-clouds .ace_comment.ace_doc { }.ace-clouds .ace_comment.ace_doc.ace_tag { }.ace-clouds .ace_variable { }.ace-clouds .ace_variable.ace_language { }.ace-clouds .ace_xml_pe { }.ace-clouds .ace_meta { }.ace-clouds .ace_meta.ace_tag { }.ace-clouds .ace_meta.ace_tag.ace_input { }.ace-clouds .ace_entity.ace_other.ace_attribute-name { color:#606060;}.ace-clouds .ace_entity.ace_name { }.ace-clouds .ace_entity.ace_name.ace_function { }.ace-clouds .ace_markup.ace_underline { text-decoration:underline;}.ace-clouds .ace_markup.ace_heading { }.ace-clouds .ace_markup.ace_heading.ace_1 { }.ace-clouds .ace_markup.ace_heading.ace_2 { }.ace-clouds .ace_markup.ace_heading.ace_3 { }.ace-clouds .ace_markup.ace_heading.ace_4 { }.ace-clouds .ace_markup.ace_heading.ace_5 { }.ace-clouds .ace_markup.ace_heading.ace_6 { }.ace-clouds .ace_markup.ace_list { }.ace-clouds .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-clouds"}) -------------------------------------------------------------------------------- /src/core/hits.js: -------------------------------------------------------------------------------- 1 | /** 2 | # T5.Hits 3 | 4 | Utility module for creating and managing hit tests and the hits that are 5 | associated with that hit test. 6 | */ 7 | var Hits = T5.Hits = (function() { 8 | 9 | /* interials */ 10 | 11 | /* exports */ 12 | 13 | /** 14 | ### diffHits(oldHitData, newHitData) 15 | */ 16 | function diffHits(oldHits, newHits) { 17 | var diff = [], 18 | objIds = {}, 19 | ii; 20 | 21 | // iterate through the new hit data and find the objects within 22 | for (ii = newHits.length; ii--; ) { 23 | objIds[newHits[ii].target.id] = true; 24 | } // for 25 | 26 | for (ii = oldHits.length; ii--; ) { 27 | if (! objIds[oldHits[ii].target.id]) { 28 | diff[diff.length] = oldHits[ii]; 29 | } // for 30 | } // for 31 | 32 | return diff; 33 | } // diff 34 | 35 | /** 36 | ### init 37 | */ 38 | function init(hitType, absXY, relXY, scaledXY, transformedXY) { 39 | return { 40 | // store the required hit data 41 | type: hitType, 42 | x: transformedXY.x, 43 | y: transformedXY.y, 44 | gridX: scaledXY.x | 0, 45 | gridY: scaledXY.y | 0, 46 | elements: [], 47 | 48 | // also store the original event data 49 | absXY: absXY, 50 | relXY: relXY 51 | }; 52 | } // init 53 | 54 | /** 55 | ### initHit(type, target, opts) 56 | */ 57 | function initHit(type, target, drag) { 58 | return { 59 | type: type, 60 | target: target, 61 | drag: drag 62 | }; 63 | } // initHit 64 | 65 | function match(hit, testType, testXY) { 66 | return testType === hit.type && testXY.x === hit.absXY.x && testXY.y === hit.absXY.y; 67 | } // match 68 | 69 | /** 70 | ### triggerEvent(hitData, target, evtSuffix, elements) 71 | */ 72 | function triggerEvent(hitData, target, evtSuffix, elements) { 73 | target.triggerCustom( 74 | hitData.type + (evtSuffix || 'Hit'), { 75 | hitType: hitData.type 76 | }, 77 | elements ? elements : hitData.elements, 78 | hitData.absXY, 79 | hitData.relXY, 80 | new GeoXY(hitData.gridX, hitData.gridY) 81 | ); 82 | } // triggerEvent 83 | 84 | /* define the module */ 85 | 86 | return { 87 | diffHits: diffHits, 88 | init: init, 89 | initHit: initHit, 90 | match: match, 91 | triggerEvent: triggerEvent 92 | }; 93 | })(); -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/xmlpure/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Pure XML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: XML mode

14 |
31 | 34 | 35 |

This is my XML parser, based on the original:

36 |
    37 |
  • No html mode - this is pure xml
  • 38 |
  • Illegal attributes and element names are errors
  • 39 |
  • Attributes must have a value
  • 40 |
  • XML declaration supported (e.g.: <?xml version="1.0" encoding="utf-8" standalone="no" ?>)
  • 41 |
  • CDATA and comment blocks are not indented (except for their start-tag)
  • 42 |
  • Better handling of errors per line with the state object - provides good infrastructure for extending it
  • 43 |
44 | 45 |

What's missing:

46 |
    47 |
  • Make sure only a single root element exists at the document level
  • 48 |
  • Multi-line attributes should NOT indent
  • 49 |
  • Start tags are not painted red when they have no matching end tags (is this really wrong?)
  • 50 |
51 | 52 |

MIME types defined: application/xml, text/xml.

53 | 54 |

@author: Dror BG (deebug dot dev at gmail dot com)
55 |

@date: August, 2011
56 |

@github: https://github.com/deebugger/CodeMirror2

57 | 58 |

MIME types defined: application/xml, text/xml.

59 | 60 | 61 | -------------------------------------------------------------------------------- /test/specs/types/xy.js: -------------------------------------------------------------------------------- 1 | describe('types.xy', function() { 2 | it('should be able to initialize an x and y value with two integer values', function() { 3 | var test = new T5.XY(20, 10); 4 | 5 | expect(test.x).toEqual(20); 6 | expect(test.y).toEqual(10); 7 | }); 8 | 9 | it('should be able to parse a delimited string', function() { 10 | var test = new T5.XY('20, 10'); 11 | 12 | expect(test.x).toEqual(20); 13 | expect(test.y).toEqual(10); 14 | }); 15 | 16 | it('should be able to accept floating point values', function() { 17 | var test = new T5.XY(20.5, 10.5); 18 | 19 | expect(test.x).toEqual(20.5); 20 | expect(test.y).toEqual(10.5); 21 | }); 22 | 23 | it('should be able to parse floating point values', function() { 24 | var test = new T5.XY('20.5, 10.5'); 25 | 26 | expect(test.x).toEqual(20.5); 27 | expect(test.y).toEqual(10.5); 28 | }); 29 | 30 | it('should be able to copy an XY value', function() { 31 | var test = new T5.XY(20, 10); 32 | testCopy = test.copy(); 33 | 34 | expect(testCopy.x).toEqual(20); 35 | expect(testCopy.y).toEqual(10); 36 | expect(testCopy).not.toBe(test); 37 | }); 38 | 39 | it('should be able to override values created in a copy', function() { 40 | var testCopy = new T5.XY(20, 10).copy(30, 20); 41 | 42 | expect(testCopy.x).toEqual(30); 43 | expect(testCopy.y).toEqual(20); 44 | }); 45 | 46 | it('should be able to add xy values together', function() { 47 | var test = new T5.XY(20, 10), 48 | testAdded = test.add(new T5.XY(20, 10), new T5.XY(20, 10)); 49 | 50 | expect(testAdded.x).toEqual(60); 51 | expect(testAdded.y).toEqual(30); 52 | expect(testAdded).not.toBe(test); 53 | }); 54 | 55 | it('should be able to offset an xy value', function() { 56 | var test = new T5.XY(20, 10), 57 | testOffset = test.offset(20, 10); 58 | 59 | expect(testOffset.x).toEqual(40); 60 | expect(testOffset.y).toEqual(20); 61 | expect(testOffset).not.toBe(test); 62 | }); 63 | 64 | it('should be able to rotate around a specified position', function() { 65 | var a = new T5.XY(10, 5), 66 | b = new T5.XY(5, 5), 67 | c; 68 | 69 | // rotate by 90 degrees 70 | c = a.rotate(Math.PI / 2, b); 71 | expect(c.x | 0).toEqual(5); 72 | expect(c.y | 0).toEqual(10); 73 | 74 | // rotate by 180 degrees 75 | c = a.rotate(Math.PI, b); 76 | expect(c.x | 0).toEqual(0); 77 | expect(c.y | 0).toEqual(5); 78 | }); 79 | }); -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-textmate.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/textmate",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-tm .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tm .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tm .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-tm .ace_gutter-layer { width: 100%; text-align: right;}.ace-tm .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-tm .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tm .ace_text-layer { cursor: text;}.ace-tm .ace_cursor { border-left: 2px solid black;}.ace-tm .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;} .ace-tm .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-tm .ace_line .ace_keyword { color: blue;}.ace-tm .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-tm .ace_line .ace_constant.ace_language { color: rgb(88, 92, 246);}.ace-tm .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_invalid { background-color: rgb(153, 0, 0); color: white;}.ace-tm .ace_line .ace_fold { background-color: #E4E4E4; border-radius: 3px;}.ace-tm .ace_line .ace_support.ace_function { color: rgb(60, 76, 114);}.ace-tm .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_support.ace_type,.ace-tm .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-tm .ace_line .ace_keyword.ace_operator { color: rgb(104, 118, 135);}.ace-tm .ace_line .ace_string { color: rgb(3, 106, 7);}.ace-tm .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-tm .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-tm .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-tm .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 205);}.ace-tm .ace_line .ace_variable { color: rgb(49, 132, 149);}.ace-tm .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function { color: #0000A2;}.ace-tm .ace_markup.ace_markupine { text-decoration:underline;}.ace-tm .ace_markup.ace_heading { color: rgb(12, 7, 255);}.ace-tm .ace_markup.ace_list { color:rgb(185, 6, 144);}.ace-tm .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_meta.ace_tag { color:rgb(28, 2, 255);}.ace-tm .ace_string.ace_regex { color: rgb(255, 0, 0)}";d.importCssString(e),b.cssClass="ace-tm"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-monokai.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/monokai",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-monokai .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-monokai .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-monokai .ace_gutter-layer { width: 100%; text-align: right;}.ace-monokai .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-monokai .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-monokai .ace_scroller { background-color: #272822;}.ace-monokai .ace_text-layer { cursor: text; color: #F8F8F2;}.ace-monokai .ace_cursor { border-left: 2px solid #F8F8F0;}.ace-monokai .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #F8F8F0;} .ace-monokai .ace_marker-layer .ace_selection { background: #49483E;}.ace-monokai .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-monokai .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #49483E;}.ace-monokai .ace_marker-layer .ace_active_line { background: #49483E;} .ace-monokai .ace_invisible { color: #49483E;}.ace-monokai .ace_keyword { color:#F92672;}.ace-monokai .ace_keyword.ace_operator { }.ace-monokai .ace_constant { }.ace-monokai .ace_constant.ace_language { color:#AE81FF;}.ace-monokai .ace_constant.ace_library { }.ace-monokai .ace_constant.ace_numeric { color:#AE81FF;}.ace-monokai .ace_invalid { color:#F8F8F0;background-color:#F92672;}.ace-monokai .ace_invalid.ace_illegal { }.ace-monokai .ace_invalid.ace_deprecated { color:#F8F8F0;background-color:#AE81FF;}.ace-monokai .ace_support { }.ace-monokai .ace_support.ace_function { color:#66D9EF;}.ace-monokai .ace_function.ace_buildin { }.ace-monokai .ace_string { color:#E6DB74;}.ace-monokai .ace_string.ace_regexp { }.ace-monokai .ace_comment { color:#75715E;}.ace-monokai .ace_comment.ace_doc { }.ace-monokai .ace_comment.ace_doc.ace_tag { }.ace-monokai .ace_variable { }.ace-monokai .ace_variable.ace_language { }.ace-monokai .ace_xml_pe { }.ace-monokai .ace_meta { }.ace-monokai .ace_meta.ace_tag { }.ace-monokai .ace_meta.ace_tag.ace_input { }.ace-monokai .ace_entity.ace_other.ace_attribute-name { color:#A6E22E;}.ace-monokai .ace_entity.ace_name { }.ace-monokai .ace_entity.ace_name.ace_function { color:#A6E22E;}.ace-monokai .ace_markup.ace_underline { text-decoration:underline;}.ace-monokai .ace_markup.ace_heading { }.ace-monokai .ace_markup.ace_heading.ace_1 { }.ace-monokai .ace_markup.ace_heading.ace_2 { }.ace-monokai .ace_markup.ace_heading.ace_3 { }.ace-monokai .ace_markup.ace_heading.ace_4 { }.ace-monokai .ace_markup.ace_heading.ace_5 { }.ace-monokai .ace_markup.ace_heading.ace_6 { }.ace-monokai .ace_markup.ace_list { }.ace-monokai .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-monokai"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-dawn.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/dawn",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-dawn .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-dawn .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-dawn .ace_gutter-layer { width: 100%; text-align: right;}.ace-dawn .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-dawn .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-dawn .ace_scroller { background-color: #F9F9F9;}.ace-dawn .ace_text-layer { cursor: text; color: #080808;}.ace-dawn .ace_cursor { border-left: 2px solid #000000;}.ace-dawn .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-dawn .ace_marker-layer .ace_selection { background: rgba(39, 95, 255, 0.30);}.ace-dawn .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-dawn .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(75, 75, 126, 0.50);}.ace-dawn .ace_marker-layer .ace_active_line { background: rgba(36, 99, 180, 0.12);} .ace-dawn .ace_invisible { color: rgba(75, 75, 126, 0.50);}.ace-dawn .ace_keyword { color:#794938;}.ace-dawn .ace_keyword.ace_operator { }.ace-dawn .ace_constant { color:#811F24;}.ace-dawn .ace_constant.ace_language { }.ace-dawn .ace_constant.ace_library { }.ace-dawn .ace_constant.ace_numeric { }.ace-dawn .ace_invalid { }.ace-dawn .ace_invalid.ace_illegal { text-decoration:underline;font-style:italic;color:#F8F8F8;background-color:#B52A1D;}.ace-dawn .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#B52A1D;}.ace-dawn .ace_support { color:#691C97;}.ace-dawn .ace_support.ace_function { color:#693A17;}.ace-dawn .ace_function.ace_buildin { }.ace-dawn .ace_string { color:#0B6125;}.ace-dawn .ace_string.ace_regexp { color:#CF5628;}.ace-dawn .ace_comment { font-style:italic;color:#5A525F;}.ace-dawn .ace_comment.ace_doc { }.ace-dawn .ace_comment.ace_doc.ace_tag { }.ace-dawn .ace_variable { color:#234A97;}.ace-dawn .ace_variable.ace_language { }.ace-dawn .ace_xml_pe { }.ace-dawn .ace_meta { }.ace-dawn .ace_meta.ace_tag { }.ace-dawn .ace_meta.ace_tag.ace_input { }.ace-dawn .ace_entity.ace_other.ace_attribute-name { }.ace-dawn .ace_entity.ace_name { }.ace-dawn .ace_entity.ace_name.ace_function { }.ace-dawn .ace_markup.ace_underline { text-decoration:underline;}.ace-dawn .ace_markup.ace_heading { color:#19356D;}.ace-dawn .ace_markup.ace_heading.ace_1 { }.ace-dawn .ace_markup.ace_heading.ace_2 { }.ace-dawn .ace_markup.ace_heading.ace_3 { }.ace-dawn .ace_markup.ace_heading.ace_4 { }.ace-dawn .ace_markup.ace_heading.ace_5 { }.ace-dawn .ace_markup.ace_heading.ace_6 { }.ace-dawn .ace_markup.ace_list { color:#693A17;}.ace-dawn .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-dawn"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-merbivore.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/merbivore",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-merbivore .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-merbivore .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-merbivore .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-merbivore .ace_gutter-layer { width: 100%; text-align: right;}.ace-merbivore .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-merbivore .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-merbivore .ace_scroller { background-color: #161616;}.ace-merbivore .ace_text-layer { cursor: text; color: #E6E1DC;}.ace-merbivore .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-merbivore .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-merbivore .ace_marker-layer .ace_selection { background: #454545;}.ace-merbivore .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-merbivore .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #FCE94F;}.ace-merbivore .ace_marker-layer .ace_active_line { background: #333435;} .ace-merbivore .ace_invisible { color: #404040;}.ace-merbivore .ace_keyword { color:#FC6F09;}.ace-merbivore .ace_keyword.ace_operator { }.ace-merbivore .ace_constant { color:#1EDAFB;}.ace-merbivore .ace_constant.ace_language { color:#FDC251;}.ace-merbivore .ace_constant.ace_library { color:#8DFF0A;}.ace-merbivore .ace_constant.ace_numeric { color:#58C554;}.ace-merbivore .ace_invalid { color:#FFFFFF;background-color:#990000;}.ace-merbivore .ace_invalid.ace_illegal { }.ace-merbivore .ace_invalid.ace_deprecated { color:#FFFFFF; background-color:#990000;}.ace-merbivore .ace_support { }.ace-merbivore .ace_support.ace_function { color:#FC6F09;}.ace-merbivore .ace_function.ace_buildin { }.ace-merbivore .ace_string { color:#8DFF0A;}.ace-merbivore .ace_string.ace_regexp { }.ace-merbivore .ace_comment { color:#AD2EA4;}.ace-merbivore .ace_comment.ace_doc { }.ace-merbivore .ace_comment.ace_doc.ace_tag { }.ace-merbivore .ace_variable { }.ace-merbivore .ace_variable.ace_language { }.ace-merbivore .ace_xml_pe { }.ace-merbivore .ace_meta { }.ace-merbivore .ace_meta.ace_tag { color:#FC6F09;}.ace-merbivore .ace_meta.ace_tag.ace_input { }.ace-merbivore .ace_entity.ace_other.ace_attribute-name { color:#FFFF89;}.ace-merbivore .ace_markup.ace_underline { text-decoration:underline;}.ace-merbivore .ace_markup.ace_heading { }.ace-merbivore .ace_markup.ace_heading.ace_1 { }.ace-merbivore .ace_markup.ace_heading.ace_2 { }.ace-merbivore .ace_markup.ace_heading.ace_3 { }.ace-merbivore .ace_markup.ace_heading.ace_4 { }.ace-merbivore .ace_markup.ace_heading.ace_5 { }.ace-merbivore .ace_markup.ace_heading.ace_6 { }.ace-merbivore .ace_markup.ace_list { }.ace-merbivore .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-merbivore"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-cobalt.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/cobalt",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-cobalt .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-cobalt .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-cobalt .ace_gutter-layer { width: 100%; text-align: right;}.ace-cobalt .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-cobalt .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-cobalt .ace_scroller { background-color: #002240;}.ace-cobalt .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-cobalt .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-cobalt .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-cobalt .ace_marker-layer .ace_selection { background: rgba(179, 101, 57, 0.75);}.ace-cobalt .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-cobalt .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.35);} .ace-cobalt .ace_invisible { color: rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_keyword { color:#FF9D00;}.ace-cobalt .ace_keyword.ace_operator { }.ace-cobalt .ace_constant { color:#FF628C;}.ace-cobalt .ace_constant.ace_language { }.ace-cobalt .ace_constant.ace_library { }.ace-cobalt .ace_constant.ace_numeric { }.ace-cobalt .ace_invalid { color:#F8F8F8;background-color:#800F00;}.ace-cobalt .ace_invalid.ace_illegal { }.ace-cobalt .ace_invalid.ace_deprecated { }.ace-cobalt .ace_support { color:#80FFBB;}.ace-cobalt .ace_support.ace_function { color:#FFB054;}.ace-cobalt .ace_function.ace_buildin { }.ace-cobalt .ace_string { }.ace-cobalt .ace_string.ace_regexp { color:#80FFC2;}.ace-cobalt .ace_comment { font-style:italic;color:#0088FF;}.ace-cobalt .ace_comment.ace_doc { }.ace-cobalt .ace_comment.ace_doc.ace_tag { }.ace-cobalt .ace_variable { color:#CCCCCC;}.ace-cobalt .ace_variable.ace_language { color:#FF80E1;}.ace-cobalt .ace_xml_pe { }.ace-cobalt .ace_meta { }.ace-cobalt .ace_meta.ace_tag { color:#9EFFFF;}.ace-cobalt .ace_meta.ace_tag.ace_input { }.ace-cobalt .ace_entity.ace_other.ace_attribute-name { }.ace-cobalt .ace_entity.ace_name { }.ace-cobalt .ace_entity.ace_name.ace_function { }.ace-cobalt .ace_markup.ace_underline { text-decoration:underline;}.ace-cobalt .ace_markup.ace_heading { color:#C8E4FD;background-color:#001221;}.ace-cobalt .ace_markup.ace_heading.ace_1 { }.ace-cobalt .ace_markup.ace_heading.ace_2 { }.ace-cobalt .ace_markup.ace_heading.ace_3 { }.ace-cobalt .ace_markup.ace_heading.ace_4 { }.ace-cobalt .ace_markup.ace_heading.ace_5 { }.ace-cobalt .ace_markup.ace_heading.ace_6 { }.ace-cobalt .ace_markup.ace_list { background-color:#130D26;}.ace-cobalt .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-cobalt"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/keybinding-vim.js: -------------------------------------------------------------------------------- 1 | define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","golineright"),f("(h|left)","golineleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;return b!=2&&(a.buffer=f),{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};return this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j 2 | 3 | 4 | CodeMirror 2: JavaScript mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: JavaScript mode

14 | 15 |
64 | 65 | 71 | 72 |

JavaScript mode supports a single configuration 73 | option, json, which will set the mode to expect JSON 74 | data rather than a JavaScript program.

75 | 76 |

MIME types defined: text/javascript, application/json.

77 | 78 | 79 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-kr_theme.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/kr_theme",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-kr-theme .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-kr-theme .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-kr-theme .ace_gutter-layer { width: 100%; text-align: right;}.ace-kr-theme .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-kr-theme .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-kr-theme .ace_scroller { background-color: #0B0A09;}.ace-kr-theme .ace_text-layer { cursor: text; color: #FCFFE0;}.ace-kr-theme .ace_cursor { border-left: 2px solid #FF9900;}.ace-kr-theme .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FF9900;} .ace-kr-theme .ace_marker-layer .ace_selection { background: rgba(170, 0, 255, 0.45);}.ace-kr-theme .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-kr-theme .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_marker-layer .ace_active_line { background: #38403D;} .ace-kr-theme .ace_invisible { color: rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_keyword { color:#949C8B;}.ace-kr-theme .ace_keyword.ace_operator { }.ace-kr-theme .ace_constant { color:rgba(210, 117, 24, 0.76);}.ace-kr-theme .ace_constant.ace_language { }.ace-kr-theme .ace_constant.ace_library { }.ace-kr-theme .ace_constant.ace_numeric { }.ace-kr-theme .ace_invalid { color:#F8F8F8;background-color:#A41300;}.ace-kr-theme .ace_invalid.ace_illegal { }.ace-kr-theme .ace_invalid.ace_deprecated { }.ace-kr-theme .ace_support { color:#9FC28A;}.ace-kr-theme .ace_support.ace_function { color:#85873A;}.ace-kr-theme .ace_function.ace_buildin { }.ace-kr-theme .ace_string { }.ace-kr-theme .ace_string.ace_regexp { color:rgba(125, 255, 192, 0.65);}.ace-kr-theme .ace_comment { font-style:italic;color:#706D5B;}.ace-kr-theme .ace_comment.ace_doc { }.ace-kr-theme .ace_comment.ace_doc.ace_tag { }.ace-kr-theme .ace_variable { color:#D1A796;}.ace-kr-theme .ace_variable.ace_language { color:#FF80E1;}.ace-kr-theme .ace_xml_pe { }.ace-kr-theme .ace_meta { }.ace-kr-theme .ace_meta.ace_tag { color:#BABD9C;}.ace-kr-theme .ace_meta.ace_tag.ace_input { }.ace-kr-theme .ace_entity.ace_other.ace_attribute-name { }.ace-kr-theme .ace_entity.ace_name { }.ace-kr-theme .ace_entity.ace_name.ace_function { }.ace-kr-theme .ace_markup.ace_underline { text-decoration:underline;}.ace-kr-theme .ace_markup.ace_heading { }.ace-kr-theme .ace_markup.ace_heading.ace_1 { }.ace-kr-theme .ace_markup.ace_heading.ace_2 { }.ace-kr-theme .ace_markup.ace_heading.ace_3 { }.ace-kr-theme .ace_markup.ace_heading.ace_4 { }.ace-kr-theme .ace_markup.ace_heading.ace_5 { }.ace-kr-theme .ace_markup.ace_heading.ace_6 { }.ace-kr-theme .ace_markup.ace_list { background-color:#0F0040;}.ace-kr-theme .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-kr-theme"}) -------------------------------------------------------------------------------- /src/plugins/parser.geojson.js: -------------------------------------------------------------------------------- 1 | T5.GeoJSONParser = function(params) { 2 | params = T5.ex({ 3 | generalizer: null 4 | }, params); 5 | 6 | // internals 7 | 8 | var generalizer = params.generalizer, 9 | reMulti = /^multi(.*)$/i, 10 | handlers = { 11 | linestring: line, 12 | point: point, 13 | polygon: poly 14 | }; 15 | 16 | function asPositions(coords) { 17 | var positions = []; 18 | 19 | for (var ii = coords.length; ii--; ) { 20 | positions[ii] = new GeoJS.Pos(coords[ii][1], coords[ii][0]); 21 | } // for 22 | 23 | return generalizer ? generalizer(positions) : positions; 24 | } // asPoints 25 | 26 | function line(coordinates, properties) { 27 | _this.trigger('line', T5.ex({ 28 | points: asPositions(coordinates) 29 | }, properties)); 30 | } // line 31 | 32 | function point(coordinates, properties) { 33 | _this.trigger('marker', T5.ex({ 34 | xy: new T5.GeoXY(new GeoJS.Pos(coordinates[1], coordinates[0])) 35 | }, properties)); 36 | } // point 37 | 38 | // TODO: properly handle multiple linearrings 39 | function poly(coordinates, properties) { 40 | _this.trigger('poly', T5.ex({ 41 | points: asPositions(coordinates[0]) 42 | }, properties)); 43 | } // poly 44 | 45 | // exports 46 | 47 | function run(data) { 48 | var ii; 49 | 50 | if (!data || !data.type) { 51 | return; 52 | } // if 53 | 54 | switch (data.type.toLowerCase()) { 55 | case 'featurecollection': { 56 | var features = data.features || []; 57 | for (ii = features.length; ii--; ) { 58 | run(features[ii]); 59 | } // for 60 | } // featurecollection 61 | 62 | default: { 63 | if (! data.geometry) { 64 | return; 65 | } // if 66 | 67 | var geomType = (data.geometry.type || '').toLowerCase(), 68 | multiMatch = reMulti.exec(geomType), 69 | coordinates = data.geometry.coordinates || [], 70 | handler = handlers[geomType]; 71 | 72 | if (multiMatch) { 73 | handler = handlers[multiMatch[1]]; 74 | 75 | for (ii = coordinates.length; handler && ii--; ) { 76 | handler(coordinates[ii], data.properties); 77 | } // for 78 | } 79 | else if (handler) { 80 | handler(coordinates, data.properties); 81 | } // if..else 82 | } 83 | } // switch 84 | } // run 85 | 86 | var _this = { 87 | run: run 88 | }; 89 | 90 | return T5.observable(_this); 91 | }; -------------------------------------------------------------------------------- /dist/plugins/parser.geojson.js: -------------------------------------------------------------------------------- 1 | T5.GeoJSONParser = function(params) { 2 | params = T5.ex({ 3 | generalizer: null 4 | }, params); 5 | 6 | // internals 7 | 8 | var generalizer = params.generalizer, 9 | reMulti = /^multi(.*)$/i, 10 | handlers = { 11 | linestring: line, 12 | point: point, 13 | polygon: poly 14 | }; 15 | 16 | function asPositions(coords) { 17 | var positions = []; 18 | 19 | for (var ii = coords.length; ii--; ) { 20 | positions[ii] = new GeoJS.Pos(coords[ii][1], coords[ii][0]); 21 | } // for 22 | 23 | return generalizer ? generalizer(positions) : positions; 24 | } // asPoints 25 | 26 | function line(coordinates, properties) { 27 | _this.trigger('line', T5.ex({ 28 | points: asPositions(coordinates) 29 | }, properties)); 30 | } // line 31 | 32 | function point(coordinates, properties) { 33 | _this.trigger('marker', T5.ex({ 34 | xy: new T5.GeoXY(new GeoJS.Pos(coordinates[1], coordinates[0])) 35 | }, properties)); 36 | } // point 37 | 38 | // TODO: properly handle multiple linearrings 39 | function poly(coordinates, properties) { 40 | _this.trigger('poly', T5.ex({ 41 | points: asPositions(coordinates[0]) 42 | }, properties)); 43 | } // poly 44 | 45 | // exports 46 | 47 | function run(data) { 48 | var ii; 49 | 50 | if (!data || !data.type) { 51 | return; 52 | } // if 53 | 54 | switch (data.type.toLowerCase()) { 55 | case 'featurecollection': { 56 | var features = data.features || []; 57 | for (ii = features.length; ii--; ) { 58 | run(features[ii]); 59 | } // for 60 | } // featurecollection 61 | 62 | default: { 63 | if (! data.geometry) { 64 | return; 65 | } // if 66 | 67 | var geomType = (data.geometry.type || '').toLowerCase(), 68 | multiMatch = reMulti.exec(geomType), 69 | coordinates = data.geometry.coordinates || [], 70 | handler = handlers[geomType]; 71 | 72 | if (multiMatch) { 73 | handler = handlers[multiMatch[1]]; 74 | 75 | for (ii = coordinates.length; handler && ii--; ) { 76 | handler(coordinates[ii], data.properties); 77 | } // for 78 | } 79 | else if (handler) { 80 | handler(coordinates, data.properties); 81 | } // if..else 82 | } 83 | } // switch 84 | } // run 85 | 86 | var _this = { 87 | run: run 88 | }; 89 | 90 | return T5.observable(_this); 91 | }; -------------------------------------------------------------------------------- /test/lib/jasmine-1.0.2/jasmine.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; 3 | } 4 | 5 | 6 | .jasmine_reporter a:visited, .jasmine_reporter a { 7 | color: #303; 8 | } 9 | 10 | .jasmine_reporter a:hover, .jasmine_reporter a:active { 11 | color: blue; 12 | } 13 | 14 | .run_spec { 15 | float:right; 16 | padding-right: 5px; 17 | font-size: .8em; 18 | text-decoration: none; 19 | } 20 | 21 | .jasmine_reporter { 22 | margin: 0 5px; 23 | } 24 | 25 | .banner { 26 | color: #303; 27 | background-color: #fef; 28 | padding: 5px; 29 | } 30 | 31 | .logo { 32 | float: left; 33 | font-size: 1.1em; 34 | padding-left: 5px; 35 | } 36 | 37 | .logo .version { 38 | font-size: .6em; 39 | padding-left: 1em; 40 | } 41 | 42 | .runner.running { 43 | background-color: yellow; 44 | } 45 | 46 | 47 | .options { 48 | text-align: right; 49 | font-size: .8em; 50 | } 51 | 52 | 53 | 54 | 55 | .suite { 56 | border: 1px outset gray; 57 | margin: 5px 0; 58 | padding-left: 1em; 59 | } 60 | 61 | .suite .suite { 62 | margin: 5px; 63 | } 64 | 65 | .suite.passed { 66 | background-color: #dfd; 67 | } 68 | 69 | .suite.failed { 70 | background-color: #fdd; 71 | } 72 | 73 | .spec { 74 | margin: 5px; 75 | padding-left: 1em; 76 | clear: both; 77 | } 78 | 79 | .spec.failed, .spec.passed, .spec.skipped { 80 | padding-bottom: 5px; 81 | border: 1px solid gray; 82 | } 83 | 84 | .spec.failed { 85 | background-color: #fbb; 86 | border-color: red; 87 | } 88 | 89 | .spec.passed { 90 | background-color: #bfb; 91 | border-color: green; 92 | } 93 | 94 | .spec.skipped { 95 | background-color: #bbb; 96 | } 97 | 98 | .messages { 99 | border-left: 1px dashed gray; 100 | padding-left: 1em; 101 | padding-right: 1em; 102 | } 103 | 104 | .passed { 105 | background-color: #cfc; 106 | display: none; 107 | } 108 | 109 | .failed { 110 | background-color: #fbb; 111 | } 112 | 113 | .skipped { 114 | color: #777; 115 | background-color: #eee; 116 | display: none; 117 | } 118 | 119 | 120 | /*.resultMessage {*/ 121 | /*white-space: pre;*/ 122 | /*}*/ 123 | 124 | .resultMessage span.result { 125 | display: block; 126 | line-height: 2em; 127 | color: black; 128 | } 129 | 130 | .resultMessage .mismatch { 131 | color: black; 132 | } 133 | 134 | .stackTrace { 135 | white-space: pre; 136 | font-size: .8em; 137 | margin-left: 10px; 138 | max-height: 5em; 139 | overflow: auto; 140 | border: 1px inset red; 141 | padding: 1em; 142 | background: #eef; 143 | } 144 | 145 | .finished-at { 146 | padding-left: 1em; 147 | font-size: .6em; 148 | } 149 | 150 | .show-passed .passed, 151 | .show-skipped .skipped { 152 | display: block; 153 | } 154 | 155 | 156 | #jasmine_content { 157 | position:fixed; 158 | right: 100%; 159 | } 160 | 161 | .runner { 162 | border: 1px solid gray; 163 | display: block; 164 | margin: 5px 0; 165 | padding: 2px 0 2px 10px; 166 | } 167 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/clojure/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: Clojure mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror 2: Clojure mode

14 |
78 | 81 | 82 |

MIME types defined: text/x-clojure.

83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/htmlmixed/htmlmixed.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { 2 | var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); 3 | var jsMode = CodeMirror.getMode(config, "javascript"); 4 | var cssMode = CodeMirror.getMode(config, "css"); 5 | 6 | function html(stream, state) { 7 | var style = htmlMode.token(stream, state.htmlState); 8 | if (style == "tag" && stream.current() == ">" && state.htmlState.context) { 9 | if (/^script$/i.test(state.htmlState.context.tagName)) { 10 | state.token = javascript; 11 | state.localState = jsMode.startState(htmlMode.indent(state.htmlState, "")); 12 | state.mode = "javascript"; 13 | } 14 | else if (/^style$/i.test(state.htmlState.context.tagName)) { 15 | state.token = css; 16 | state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); 17 | state.mode = "css"; 18 | } 19 | } 20 | return style; 21 | } 22 | function maybeBackup(stream, pat, style) { 23 | var cur = stream.current(); 24 | var close = cur.search(pat); 25 | if (close > -1) stream.backUp(cur.length - close); 26 | return style; 27 | } 28 | function javascript(stream, state) { 29 | if (stream.match(/^<\/\s*script\s*>/i, false)) { 30 | state.token = html; 31 | state.curState = null; 32 | state.mode = "html"; 33 | return html(stream, state); 34 | } 35 | return maybeBackup(stream, /<\/\s*script\s*>/, 36 | jsMode.token(stream, state.localState)); 37 | } 38 | function css(stream, state) { 39 | if (stream.match(/^<\/\s*style\s*>/i, false)) { 40 | state.token = html; 41 | state.localState = null; 42 | state.mode = "html"; 43 | return html(stream, state); 44 | } 45 | return maybeBackup(stream, /<\/\s*style\s*>/, 46 | cssMode.token(stream, state.localState)); 47 | } 48 | 49 | return { 50 | startState: function() { 51 | var state = htmlMode.startState(); 52 | return {token: html, localState: null, mode: "html", htmlState: state}; 53 | }, 54 | 55 | copyState: function(state) { 56 | if (state.localState) 57 | var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState); 58 | return {token: state.token, localState: local, mode: state.mode, 59 | htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; 60 | }, 61 | 62 | token: function(stream, state) { 63 | return state.token(stream, state); 64 | }, 65 | 66 | indent: function(state, textAfter) { 67 | if (state.token == html || /^\s*<\//.test(textAfter)) 68 | return htmlMode.indent(state.htmlState, textAfter); 69 | else if (state.token == javascript) 70 | return jsMode.indent(state.localState, textAfter); 71 | else 72 | return cssMode.indent(state.localState, textAfter); 73 | }, 74 | 75 | electricChars: "/{}:" 76 | } 77 | }); 78 | 79 | CodeMirror.defineMIME("text/html", "htmlmixed"); 80 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-twilight.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/twilight",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-twilight .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-twilight .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-twilight .ace_gutter-layer { width: 100%; text-align: right;}.ace-twilight .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-twilight .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-twilight .ace_scroller { background-color: #141414;}.ace-twilight .ace_text-layer { cursor: text; color: #F8F8F8;}.ace-twilight .ace_cursor { border-left: 2px solid #A7A7A7;}.ace-twilight .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #A7A7A7;} .ace-twilight .ace_marker-layer .ace_selection { background: rgba(221, 240, 255, 0.20);}.ace-twilight .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-twilight .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.25);}.ace-twilight .ace_marker-layer .ace_active_line { background: rgba(255, 255, 255, 0.031);} .ace-twilight .ace_invisible { color: rgba(255, 255, 255, 0.25);}.ace-twilight .ace_keyword { color:#CDA869;}.ace-twilight .ace_keyword.ace_operator { }.ace-twilight .ace_constant { color:#CF6A4C;}.ace-twilight .ace_constant.ace_language { }.ace-twilight .ace_constant.ace_library { }.ace-twilight .ace_constant.ace_numeric { }.ace-twilight .ace_invalid { }.ace-twilight .ace_invalid.ace_illegal { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-twilight .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#D2A8A1;}.ace-twilight .ace_support { color:#9B859D;}.ace-twilight .ace_support.ace_function { color:#DAD085;}.ace-twilight .ace_function.ace_buildin { }.ace-twilight .ace_string { color:#8F9D6A;}.ace-twilight .ace_string.ace_regexp { color:#E9C062;}.ace-twilight .ace_comment { font-style:italic;color:#5F5A60;}.ace-twilight .ace_comment.ace_doc { }.ace-twilight .ace_comment.ace_doc.ace_tag { }.ace-twilight .ace_variable { color:#7587A6;}.ace-twilight .ace_variable.ace_language { }.ace-twilight .ace_xml_pe { color:#494949;}.ace-twilight .ace_meta { }.ace-twilight .ace_meta.ace_tag { color:#AC885B;}.ace-twilight .ace_meta.ace_tag.ace_input { }.ace-twilight .ace_entity.ace_other.ace_attribute-name { }.ace-twilight .ace_entity.ace_name { }.ace-twilight .ace_entity.ace_name.ace_function { color:#AC885B;}.ace-twilight .ace_markup.ace_underline { text-decoration:underline;}.ace-twilight .ace_markup.ace_heading { color:#CF6A4C;}.ace-twilight .ace_markup.ace_heading.ace_1 { }.ace-twilight .ace_markup.ace_heading.ace_2 { }.ace-twilight .ace_markup.ace_heading.ace_3 { }.ace-twilight .ace_markup.ace_heading.ace_4 { }.ace-twilight .ace_markup.ace_heading.ace_5 { }.ace-twilight .ace_markup.ace_heading.ace_6 { }.ace-twilight .ace_markup.ace_list { color:#F9EE98;}.ace-twilight .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-twilight"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-vibrant_ink.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/vibrant_ink",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-vibrant-ink .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-vibrant-ink .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-vibrant-ink .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-vibrant-ink .ace_gutter-layer { width: 100%; text-align: right;}.ace-vibrant-ink .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-vibrant-ink .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-vibrant-ink .ace_scroller { background-color: #0F0F0F;}.ace-vibrant-ink .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-vibrant-ink .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-vibrant-ink .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-vibrant-ink .ace_marker-layer .ace_selection { background: #6699CC;}.ace-vibrant-ink .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-vibrant-ink .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #99CC99;}.ace-vibrant-ink .ace_marker-layer .ace_active_line { background: #333333;} .ace-vibrant-ink .ace_invisible { color: #404040;}.ace-vibrant-ink .ace_keyword { color:#FF6600;}.ace-vibrant-ink .ace_keyword.ace_operator { }.ace-vibrant-ink .ace_constant { }.ace-vibrant-ink .ace_constant.ace_language { color:#339999;}.ace-vibrant-ink .ace_constant.ace_library { }.ace-vibrant-ink .ace_constant.ace_numeric { color:#99CC99;}.ace-vibrant-ink .ace_invalid { color:#CCFF33; background-color:#000000;}.ace-vibrant-ink .ace_invalid.ace_illegal { }.ace-vibrant-ink .ace_invalid.ace_deprecated { color:#CCFF33; background-color:#000000;}.ace-vibrant-ink .ace_support { }.ace-vibrant-ink .ace_support.ace_function { color:#FFCC00;}.ace-vibrant-ink .ace_function.ace_buildin { }.ace-vibrant-ink .ace_string { color:#66FF00;}.ace-vibrant-ink .ace_string.ace_regexp { color:#44B4CC;}.ace-vibrant-ink .ace_comment { color:#9933CC;}.ace-vibrant-ink .ace_comment.ace_doc { }.ace-vibrant-ink .ace_comment.ace_doc.ace_tag { }.ace-vibrant-ink .ace_variable { }.ace-vibrant-ink .ace_variable.ace_language { }.ace-vibrant-ink .ace_xml_pe { }.ace-vibrant-ink .ace_meta { }.ace-vibrant-ink .ace_meta.ace_tag { }.ace-vibrant-ink .ace_meta.ace_tag.ace_input { }.ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name { font-style:italic;color:#99CC99;}.ace-vibrant-ink .ace_entity.ace_name { }.ace-vibrant-ink .ace_entity.ace_name.ace_function { color:#FFCC00;}.ace-vibrant-ink .ace_markup.ace_underline { text-decoration:underline;}.ace-vibrant-ink .ace_markup.ace_heading { }.ace-vibrant-ink .ace_markup.ace_heading.ace_1 { }.ace-vibrant-ink .ace_markup.ace_heading.ace_2 { }.ace-vibrant-ink .ace_markup.ace_heading.ace_3 { }.ace-vibrant-ink .ace_markup.ace_heading.ace_4 { }.ace-vibrant-ink .ace_markup.ace_heading.ace_5 { }.ace-vibrant-ink .ace_markup.ace_heading.ace_6 { }.ace-vibrant-ink .ace_markup.ace_list { }.ace-vibrant-ink .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-vibrant-ink"}) -------------------------------------------------------------------------------- /demos/_demogen/codemirror/mode/yaml/yaml.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("yaml", function() { 2 | 3 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; 4 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); 5 | 6 | return { 7 | token: function(stream, state) { 8 | var ch = stream.peek(); 9 | var esc = state.escaped; 10 | state.escaped = false; 11 | /* comments */ 12 | if (ch == "#") { stream.skipToEnd(); return "comment"; } 13 | if (state.literal && stream.indentation() > state.keyCol) { 14 | stream.skipToEnd(); return "string"; 15 | } else if (state.literal) { state.literal = false; } 16 | if (stream.sol()) { 17 | state.keyCol = 0; 18 | state.pair = false; 19 | state.pairStart = false; 20 | /* document start */ 21 | if(stream.match(/---/)) { return "def"; } 22 | /* document end */ 23 | if (stream.match(/\.\.\./)) { return "def"; } 24 | /* array list item */ 25 | if (stream.match(/\s*-\s+/)) { return 'meta'; } 26 | } 27 | /* pairs (associative arrays) -> key */ 28 | if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) { 29 | state.pair = true; 30 | state.keyCol = stream.indentation(); 31 | return "atom"; 32 | } 33 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } 34 | 35 | /* inline pairs/lists */ 36 | if (stream.match(/^(\{|\}|\[|\])/)) { 37 | if (ch == '{') 38 | state.inlinePairs++; 39 | else if (ch == '}') 40 | state.inlinePairs--; 41 | else if (ch == '[') 42 | state.inlineList++; 43 | else 44 | state.inlineList--; 45 | return 'meta'; 46 | } 47 | 48 | /* list seperator */ 49 | if (state.inlineList > 0 && !esc && ch == ',') { 50 | stream.next(); 51 | return 'meta'; 52 | } 53 | /* pairs seperator */ 54 | if (state.inlinePairs > 0 && !esc && ch == ',') { 55 | state.keyCol = 0; 56 | state.pair = false; 57 | state.pairStart = false; 58 | stream.next(); 59 | return 'meta'; 60 | } 61 | 62 | /* start of value of a pair */ 63 | if (state.pairStart) { 64 | /* block literals */ 65 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; 66 | /* references */ 67 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } 68 | /* numbers */ 69 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } 70 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } 71 | /* keywords */ 72 | if (stream.match(keywordRegex)) { return 'keyword'; } 73 | } 74 | 75 | /* nothing found, continue */ 76 | state.pairStart = false; 77 | state.escaped = (ch == '\\'); 78 | stream.next(); 79 | return null; 80 | }, 81 | startState: function() { 82 | return { 83 | pair: false, 84 | pairStart: false, 85 | keyCol: 0, 86 | inlinePairs: 0, 87 | inlineList: 0, 88 | literal: false, 89 | escaped: false 90 | }; 91 | } 92 | }; 93 | }); 94 | 95 | CodeMirror.defineMIME("text/x-yaml", "yaml"); 96 | -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-crimson_editor.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/crimson_editor",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-crimson-editor .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-crimson-editor .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-crimson-editor .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-crimson-editor .ace_gutter-layer { width: 100%; text-align: right;}.ace-crimson-editor .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-crimson-editor .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-crimson-editor .ace_text-layer { cursor: text; color: rgb(64, 64, 64);}.ace-crimson-editor .ace_cursor { border-left: 2px solid black;}.ace-crimson-editor .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;}.ace-crimson-editor .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-crimson-editor .ace_line .ace_identifier { color: black;}.ace-crimson-editor .ace_line .ace_keyword { color: blue;}.ace-crimson-editor .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-crimson-editor .ace_line .ace_constant.ace_language { color: rgb(255, 156, 0);}.ace-crimson-editor .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-crimson-editor .ace_line .ace_invalid { text-decoration: line-through; color: rgb(224, 0, 0);}.ace-crimson-editor .ace_line .ace_fold { background-color: #E4E4E4; border-radius: 3px;}.ace-crimson-editor .ace_line .ace_support.ace_function { color: rgb(192, 0, 0);}.ace-crimson-editor .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-crimson-editor .ace_line .ace_support.ace_type,.ace-crimson-editor .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-crimson-editor .ace_line .ace_keyword.ace_operator { color: rgb(49, 132, 149);}.ace-crimson-editor .ace_line .ace_string { color: rgb(128, 0, 128);}.ace-crimson-editor .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-crimson-editor .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-crimson-editor .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-crimson-editor .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 64);}.ace-crimson-editor .ace_line .ace_variable { color: rgb(0, 64, 128);}.ace-crimson-editor .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-crimson-editor .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-crimson-editor .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-crimson-editor .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-crimson-editor .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-crimson-editor .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}.ace-crimson-editor .ace_meta.ace_tag { color:rgb(28, 2, 255);}.ace-crimson-editor .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-crimson-editor .ace_string.ace_regex { color: rgb(192, 0, 192);}";d.importCssString(e),b.cssClass="ace-crimson-editor"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-idle_fingers.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/idle_fingers",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-idle-fingers .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-idle-fingers .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-idle-fingers .ace_gutter-layer { width: 100%; text-align: right;}.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-idle-fingers .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-idle-fingers .ace_scroller { background-color: #323232;}.ace-idle-fingers .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-idle-fingers .ace_cursor { border-left: 2px solid #91FF00;}.ace-idle-fingers .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #91FF00;} .ace-idle-fingers .ace_marker-layer .ace_selection { background: rgba(90, 100, 126, 0.88);}.ace-idle-fingers .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-idle-fingers .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-idle-fingers .ace_marker-layer .ace_active_line { background: #353637;} .ace-idle-fingers .ace_invisible { color: #404040;}.ace-idle-fingers .ace_keyword { color:#CC7833;}.ace-idle-fingers .ace_keyword.ace_operator { }.ace-idle-fingers .ace_constant { color:#6C99BB;}.ace-idle-fingers .ace_constant.ace_language { }.ace-idle-fingers .ace_constant.ace_library { }.ace-idle-fingers .ace_constant.ace_numeric { }.ace-idle-fingers .ace_invalid { color:#FFFFFF;background-color:#FF0000;}.ace-idle-fingers .ace_invalid.ace_illegal { }.ace-idle-fingers .ace_invalid.ace_deprecated { }.ace-idle-fingers .ace_support { }.ace-idle-fingers .ace_support.ace_function { color:#B83426;}.ace-idle-fingers .ace_function.ace_buildin { }.ace-idle-fingers .ace_string { color:#A5C261;}.ace-idle-fingers .ace_string.ace_regexp { color:#CCCC33;}.ace-idle-fingers .ace_comment { font-style:italic;color:#BC9458;}.ace-idle-fingers .ace_comment.ace_doc { }.ace-idle-fingers .ace_comment.ace_doc.ace_tag { }.ace-idle-fingers .ace_variable { }.ace-idle-fingers .ace_variable.ace_language { }.ace-idle-fingers .ace_xml_pe { }.ace-idle-fingers .ace_meta { }.ace-idle-fingers .ace_meta.ace_tag { color:#FFE5BB;}.ace-idle-fingers .ace_meta.ace_tag.ace_input { }.ace-idle-fingers .ace_entity.ace_other.ace_attribute-name { }.ace-idle-fingers .ace_entity.ace_name { color:#FFC66D;}.ace-idle-fingers .ace_entity.ace_name.ace_function { }.ace-idle-fingers .ace_markup.ace_underline { text-decoration:underline;}.ace-idle-fingers .ace_markup.ace_heading { }.ace-idle-fingers .ace_markup.ace_heading.ace_1 { }.ace-idle-fingers .ace_markup.ace_heading.ace_2 { }.ace-idle-fingers .ace_markup.ace_heading.ace_3 { }.ace-idle-fingers .ace_markup.ace_heading.ace_4 { }.ace-idle-fingers .ace_markup.ace_heading.ace_5 { }.ace-idle-fingers .ace_markup.ace_heading.ace_6 { }.ace-idle-fingers .ace_markup.ace_list { }.ace-idle-fingers .ace_collab.ace_user1 { color:#323232;background-color:#FFF980; }";d.importCssString(e),b.cssClass="ace-idle-fingers"}) -------------------------------------------------------------------------------- /demos/_demogen/js/ace/theme-merbivore_soft.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/merbivore_soft",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-merbivore-soft .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-merbivore-soft .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-merbivore-soft .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-merbivore-soft .ace_gutter-layer { width: 100%; text-align: right;}.ace-merbivore-soft .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-merbivore-soft .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-merbivore-soft .ace_scroller { background-color: #1C1C1C;}.ace-merbivore-soft .ace_text-layer { cursor: text; color: #E6E1DC;}.ace-merbivore-soft .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-merbivore-soft .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-merbivore-soft .ace_marker-layer .ace_selection { background: #494949;}.ace-merbivore-soft .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-merbivore-soft .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #FCE94F;}.ace-merbivore-soft .ace_marker-layer .ace_active_line { background: #333435;} .ace-merbivore-soft .ace_invisible { color: #404040;}.ace-merbivore-soft .ace_keyword { color:#FC803A;}.ace-merbivore-soft .ace_keyword.ace_operator { }.ace-merbivore-soft .ace_constant { color:#68C1D8;}.ace-merbivore-soft .ace_constant.ace_language { color:#E1C582;}.ace-merbivore-soft .ace_constant.ace_library { color:#8EC65F;}.ace-merbivore-soft .ace_constant.ace_numeric { color:#7FC578;}.ace-merbivore-soft .ace_invalid { color:#FFFFFF;background-color:#FE3838;}.ace-merbivore-soft .ace_invalid.ace_illegal { }.ace-merbivore-soft .ace_invalid.ace_deprecated { color:#FFFFFF; background-color:#FE3838;}.ace-merbivore-soft .ace_support { }.ace-merbivore-soft .ace_support.ace_function { color:#FC803A;}.ace-merbivore-soft .ace_function.ace_buildin { }.ace-merbivore-soft .ace_string { color:#8EC65F;}.ace-merbivore-soft .ace_string.ace_regexp { }.ace-merbivore-soft .ace_comment { color:#AC4BB8;}.ace-merbivore-soft .ace_comment.ace_doc { }.ace-merbivore-soft .ace_comment.ace_doc.ace_tag { }.ace-merbivore-soft .ace_variable { }.ace-merbivore-soft .ace_variable.ace_language { }.ace-merbivore-soft .ace_xml_pe { }.ace-merbivore-soft .ace_meta { }.ace-merbivore-soft .ace_meta.ace_tag { color:#FC803A;}.ace-merbivore-soft .ace_meta.ace_tag.ace_input { }.ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name { color:#EAF1A3;}.ace-merbivore-soft .ace_markup.ace_underline { text-decoration:underline;}.ace-merbivore-soft .ace_markup.ace_heading { }.ace-merbivore-soft .ace_markup.ace_heading.ace_1 { }.ace-merbivore-soft .ace_markup.ace_heading.ace_2 { }.ace-merbivore-soft .ace_markup.ace_heading.ace_3 { }.ace-merbivore-soft .ace_markup.ace_heading.ace_4 { }.ace-merbivore-soft .ace_markup.ace_heading.ace_5 { }.ace-merbivore-soft .ace_markup.ace_heading.ace_6 { }.ace-merbivore-soft .ace_markup.ace_list { }.ace-merbivore-soft .ace_collab.ace_user1 { }";d.importCssString(e),b.cssClass="ace-merbivore-soft"}) -------------------------------------------------------------------------------- /demos/_demogen/js/runner.js: -------------------------------------------------------------------------------- 1 | var DEMORUNNER = (function() { 2 | 3 | var codeRunners = {}, 4 | targetWindow = window.parent || window; 5 | 6 | codeRunners.javascript = function(code) { 7 | // remove any demo code scripts 8 | $('#demoCode').remove(); 9 | 10 | // add a new demo code script 11 | var demoCode = document.createElement('script'); 12 | demoCode.id = 'demoCode'; 13 | demoCode.innerHTML = code; 14 | $('body').append(demoCode); 15 | }; 16 | 17 | codeRunners.htmlmixed = function(code) { 18 | var header = $('header'), 19 | shadowClasses = settings.emulatorShadows ? 'drop-shadow lifted ' : '', 20 | frameHtml = '
' + 21 | '
' + 22 | '