├── .gitignore ├── .gitmodules ├── Gruntfile.js ├── README.md ├── anigif ├── anigif.js ├── bar.html ├── bar.js └── img │ ├── config.png │ ├── play.png │ ├── record.png │ └── stop.png ├── bower.json ├── bower_components └── fabric │ ├── .bower.json │ ├── .gitignore │ ├── .jshintrc │ ├── .npmignore │ ├── .sublime-project │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── HEADER.js │ ├── LICENSE │ ├── README.md │ ├── build.js │ ├── build.sh │ ├── build_all │ ├── component.json │ ├── create_build_script.js │ ├── dist │ ├── all.js │ ├── all.min.js │ ├── all.min.js.gz │ └── all.require.js │ ├── lib │ ├── aligning_guidelines.js │ ├── centering_guidelines.js │ ├── cufon.js │ ├── event.js │ ├── excanvas-diff.patch │ ├── excanvas.js │ ├── excanvas.js.orig │ ├── google_closure_compiler.jar │ ├── json2.js │ ├── screenshot.png │ └── yuicompressor-2.4.6.jar │ ├── package.json │ ├── src │ ├── amd │ │ └── requirejs.js │ ├── brushes │ │ ├── base_brush.class.js │ │ ├── circle_brush.class.js │ │ ├── pattern_brush.class.js │ │ ├── pencil_brush.class.js │ │ └── spray_brush.class.js │ ├── canvas.class.js │ ├── color.class.js │ ├── filters │ │ ├── base_filter.class.js │ │ ├── brightness_filter.class.js │ │ ├── convolute_filter.class.js │ │ ├── gradienttransparency_filter.class.js │ │ ├── grayscale_filter.class.js │ │ ├── invert_filter.class.js │ │ ├── mask_filter.class.js │ │ ├── noise_filter.class.js │ │ ├── pixelate_filter.class.js │ │ ├── removewhite_filter.class.js │ │ ├── sepia2_filter.class.js │ │ ├── sepia_filter.class.js │ │ └── tint_filter.class.js │ ├── gradient.class.js │ ├── intersection.class.js │ ├── log.js │ ├── mixins │ │ ├── animation.mixin.js │ │ ├── canvas_dataurl_exporter.mixin.js │ │ ├── canvas_events.mixin.js │ │ ├── canvas_gestures.mixin.js │ │ ├── canvas_serialization.mixin.js │ │ ├── collection.mixin.js │ │ ├── object_geometry.mixin.js │ │ ├── object_interactivity.mixin.js │ │ ├── object_origin.mixin.js │ │ ├── object_straightening.mixin.js │ │ ├── observable.mixin.js │ │ └── stateful.mixin.js │ ├── node.js │ ├── parser.js │ ├── pattern.class.js │ ├── point.class.js │ ├── shadow.class.js │ ├── shapes │ │ ├── circle.class.js │ │ ├── ellipse.class.js │ │ ├── group.class.js │ │ ├── image.class.js │ │ ├── line.class.js │ │ ├── object.class.js │ │ ├── path.class.js │ │ ├── path_group.class.js │ │ ├── polygon.class.js │ │ ├── polyline.class.js │ │ ├── rect.class.js │ │ ├── text.class.js │ │ ├── text.cufon.js │ │ └── triangle.class.js │ ├── static_canvas.class.js │ └── util │ │ ├── anim_ease.js │ │ ├── animate.js │ │ ├── dom_event.js │ │ ├── dom_misc.js │ │ ├── dom_request.js │ │ ├── dom_style.js │ │ ├── lang_array.js │ │ ├── lang_class.js │ │ ├── lang_function.js │ │ ├── lang_object.js │ │ ├── lang_string.js │ │ └── misc.js │ ├── test.js │ └── test │ ├── fixtures │ ├── car.svg │ ├── greyfloral.png │ ├── path.svg │ ├── svg_with_rect.svg │ ├── test_image.gif │ ├── test_script.js │ └── very_large_image.jpg │ ├── lib │ ├── canvas_assertions.js │ ├── event.simulate.js │ ├── qunit.css │ └── qunit.js │ └── unit │ ├── canvas.js │ ├── canvas_static.js │ ├── circle.js │ ├── color.js │ ├── ellipse.js │ ├── gradient.js │ ├── group.js │ ├── image.js │ ├── image_filters.js │ ├── line.js │ ├── object.js │ ├── observable.js │ ├── parser.js │ ├── path.js │ ├── path_group.js │ ├── pattern.js │ ├── polygon.js │ ├── polyline.js │ ├── rect.js │ ├── shadow.js │ ├── text.js │ └── util.js ├── examples ├── editor │ ├── bootstrap-combined.no-icons.min.css │ ├── bootstrap-wysiwyg.js │ ├── bootstrap.min.js │ ├── bower_components │ │ └── jquery │ │ │ ├── .bower.json │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── component.json │ │ │ ├── composer.json │ │ │ ├── jquery.js │ │ │ ├── jquery.min.js │ │ │ └── package.json │ ├── editor.html │ ├── external │ │ ├── google-code-prettify │ │ │ ├── lang-apollo.js │ │ │ ├── lang-basic.js │ │ │ ├── lang-clj.js │ │ │ ├── lang-css.js │ │ │ ├── lang-dart.js │ │ │ ├── lang-erlang.js │ │ │ ├── lang-go.js │ │ │ ├── lang-hs.js │ │ │ ├── lang-lisp.js │ │ │ ├── lang-llvm.js │ │ │ ├── lang-lua.js │ │ │ ├── lang-matlab.js │ │ │ ├── lang-ml.js │ │ │ ├── lang-mumps.js │ │ │ ├── lang-n.js │ │ │ ├── lang-pascal.js │ │ │ ├── lang-proto.js │ │ │ ├── lang-r.js │ │ │ ├── lang-rd.js │ │ │ ├── lang-scala.js │ │ │ ├── lang-sql.js │ │ │ ├── lang-tcl.js │ │ │ ├── lang-tex.js │ │ │ ├── lang-vb.js │ │ │ ├── lang-vhdl.js │ │ │ ├── lang-wiki.js │ │ │ ├── lang-xq.js │ │ │ ├── lang-yaml.js │ │ │ ├── prettify.css │ │ │ ├── prettify.js │ │ │ └── run_prettify.js │ │ └── jquery.hotkeys.js │ ├── font-awesome.css │ └── index.css ├── helicopter │ ├── .#index.html │ ├── crash.mp3 │ ├── crash.ogg │ ├── heli.mp3 │ ├── heli.ogg │ ├── heli.png │ ├── heli2.png │ ├── helicopter.js │ ├── index.html │ ├── modernizr-1.5.min.js │ ├── motor.mp3 │ ├── motor.ogg │ ├── silkscreen.css │ ├── silkscreenbold.css │ ├── slkscr.ttf │ ├── slkscrb.ttf │ ├── slkscre.ttf │ ├── slkscreb.ttf │ └── webfont.js ├── img │ ├── blogger.png │ ├── github-white.png │ ├── github.png │ └── twitter.png └── paint │ ├── bower_components │ ├── drawingboard.js │ │ ├── .bower.json │ │ ├── .gitignore │ │ ├── Gruntfile.js │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bower.json │ │ ├── config.rb │ │ ├── css │ │ │ ├── drawingboard.css │ │ │ └── drawingboard.nocontrol.css │ │ ├── dist │ │ │ ├── drawingboard.css │ │ │ ├── drawingboard.js │ │ │ ├── drawingboard.min.css │ │ │ ├── drawingboard.min.js │ │ │ ├── drawingboard.nocontrol.css │ │ │ ├── drawingboard.nocontrol.js │ │ │ ├── drawingboard.nocontrol.min.css │ │ │ └── drawingboard.nocontrol.min.js │ │ ├── example │ │ │ ├── drawingboardjs.png │ │ │ ├── fd-slider.min.css │ │ │ ├── fd-slider.min.js │ │ │ ├── index.html │ │ │ ├── prism.css │ │ │ ├── prism.js │ │ │ ├── script.js │ │ │ ├── website.css │ │ │ └── yepnope.js │ │ ├── img │ │ │ ├── download.png │ │ │ ├── eraser.png │ │ │ ├── paint-can.png │ │ │ └── pencil.png │ │ ├── js │ │ │ ├── board.js │ │ │ ├── controls │ │ │ │ ├── color.js │ │ │ │ ├── control.js │ │ │ │ ├── download.js │ │ │ │ ├── drawingmode.js │ │ │ │ ├── navigation.js │ │ │ │ └── size.js │ │ │ ├── drawingboard.js │ │ │ └── utils.js │ │ ├── package.json │ │ └── scss │ │ │ ├── _controls.scss │ │ │ ├── _main.scss │ │ │ ├── _mixins.scss │ │ │ ├── controls │ │ │ ├── _colors.scss │ │ │ ├── _download.scss │ │ │ ├── _drawingmode.scss │ │ │ ├── _navigation.scss │ │ │ └── _size.scss │ │ │ ├── drawingboard.nocontrol.scss │ │ │ └── drawingboard.scss │ └── jquery │ │ ├── .bower.json │ │ ├── .gitignore │ │ ├── README.md │ │ ├── component.json │ │ ├── composer.json │ │ ├── jquery-migrate.js │ │ ├── jquery-migrate.min.js │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ ├── jquery.min.map │ │ └── package.json │ └── paint.html ├── package.json ├── sampleResources ├── pink-flower.png ├── video.mp4 └── yellow-flower.png ├── simple.html ├── simpleTemplate.html ├── test ├── actual_chrome.txt ├── actual_firefox.txt ├── expected_chrome.txt ├── expected_firefox.txt └── main-test.js └── utils ├── bookmarklet.js ├── s3publish.js └── treedir.js /.gitignore: -------------------------------------------------------------------------------- 1 | .c9revisions 2 | node_modules/* 3 | build-gzip/* 4 | pacman-gzip/* 5 | examples-gzip/* 6 | build/* 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "html2canvas"] 2 | path = html2canvas 3 | url = https://github.com/yaronn/html2canvas.git 4 | [submodule "jsgif"] 5 | path = jsgif 6 | url = https://github.com/antimatter15/jsgif.git 7 | [submodule "anigif/jsgif"] 8 | path = anigif/jsgif 9 | url = https://github.com/yaronn/jsgif.git 10 | [submodule "pacman"] 11 | path = pacman 12 | url = https://github.com/yaronn/pacman.git -------------------------------------------------------------------------------- /anigif/img/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/anigif/img/config.png -------------------------------------------------------------------------------- /anigif/img/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/anigif/img/play.png -------------------------------------------------------------------------------- /anigif/img/record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/anigif/img/record.png -------------------------------------------------------------------------------- /anigif/img/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/anigif/img/stop.png -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anigif", 3 | "dependencies": { 4 | "fabric": ">=1.2.0" 5 | } 6 | } -------------------------------------------------------------------------------- /bower_components/fabric/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fabric", 3 | "homepage": "https://github.com/kangax/fabric.js", 4 | "version": "1.3.0", 5 | "_release": "1.3.0", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v1.3.0", 9 | "commit": "4befebb19de46a140ec6ec91300c55c2e4e84f3c" 10 | }, 11 | "_source": "git://github.com/kangax/fabric.js.git", 12 | "_target": ">=1.2.0", 13 | "_originalSource": "fabric" 14 | } -------------------------------------------------------------------------------- /bower_components/fabric/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | before_commit 4 | -------------------------------------------------------------------------------- /bower_components/fabric/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "globals": { 3 | "define": true, 4 | "exports": true, 5 | "fabric": true, 6 | "Cufon": true, 7 | "Event": true, 8 | "G_vmlCanvasManager": true, 9 | "ActiveXObject": true 10 | }, 11 | 12 | "node": true, 13 | "es5": false, 14 | "browser": true, 15 | 16 | "boss": false, 17 | "curly": false, 18 | "debug": false, 19 | "devel": false, 20 | "eqeqeq": true, 21 | "eqnull": true, 22 | "evil": true, 23 | "expr": true, 24 | "forin": false, 25 | "immed": true, 26 | "laxbreak": true, 27 | "loopfunc": true, 28 | "multistr": true, 29 | "newcap": true, 30 | "noarg": true, 31 | "noempty": false, 32 | "nonew": false, 33 | "nomen": false, 34 | "onevar": false, 35 | "plusplus": false, 36 | "regexp": false, 37 | "undef": true, 38 | "sub": true, 39 | "strict": false, 40 | "white": false, 41 | "unused": true, 42 | "lastsemic": true 43 | } -------------------------------------------------------------------------------- /bower_components/fabric/.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | lib/ 3 | dist/all.min.js 4 | dist/all.min.js.gz 5 | .DS_Store 6 | HEADER.js 7 | build.js -------------------------------------------------------------------------------- /bower_components/fabric/.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": ".", 6 | "folder_exclude_patterns": ["tmp", "log", "node_modules", "docs", "jsdoc-toolkit"], 7 | "file_exclude_patterns": ["*.min.js", "*.require.js", "*.gz", "*.sublime-workspace"] 8 | } 9 | ], 10 | "settings": { 11 | "tab_size": 2 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bower_components/fabric/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 5 | - 0.10 6 | script: 'npm run-script build && npm test' 7 | before_install: 8 | - sudo apt-get update -qq 9 | - sudo apt-get install -qq libgif-dev libpng-dev libjpeg8-dev libpango1.0-dev libcairo2-dev 10 | -------------------------------------------------------------------------------- /bower_components/fabric/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | **Edge** 2 | 3 | - [BACK_INCOMPAT] Remove selectable, hasControls, hasBorders, hasRotatingPoint, transparentCorners, perPixelTargetFind from default object/json representation of objects. 4 | 5 | - [BACK_INCOMPAT] Object rotation now happens around originX/originY point UNLESS `centerTransform=true`. 6 | 7 | - [BACK_INCOMPAT] fabric.Text#textShadow has been removed - new fabric.Text.shadow property (type of fabric.Shadow). 8 | 9 | - [BACK_INCOMPAT] fabric.BaseBrush shadow properties are combined into one property => fabric.BaseBrush.shadow (shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist). 10 | 11 | - [BACK_INCOMPAT] `fabric.Path.fromObject` is now async. `fabric.Canvas#loadFromDatalessJSON` is deprecated. 12 | 13 | **Version 1.2.0** 14 | 15 | - [BACK_INCOMPAT] Make `fabric.Object#toDataURL` synchronous. 16 | 17 | - [BACK_INCOMPAT] `fabric.Text#strokeStyle` -> `fabric.Text#stroke`, for consistency with other objects. 18 | 19 | - [BACK_INCOMPAT] `fabric.Object.setActive(…)` -> `fabric.Object.set('active', …)`. 20 | `fabric.Object.isActive` is gone (use `fabric.Object.active` instead) 21 | 22 | - [BACK_INCOMPAT] `fabric.Group#objects` -> `fabric.Group._objects`. 23 | 24 | **Version 1.1.0** 25 | 26 | - [BACK_INCOMPAT] `fabric.Text#setFontsize` becomes `fabric.Object#setFontSize`. 27 | 28 | - [BACK_INCOMPAT] `fabric.Canvas.toDataURL` now accepts options object instead linear arguments. 29 | `fabric.Canvas.toDataURLWithMultiplier` is deprecated; 30 | use `fabric.Canvas.toDataURL({ multiplier: … })` instead 31 | 32 | **Version 1.0.0** 33 | -------------------------------------------------------------------------------- /bower_components/fabric/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Fabric 2 | 3 | 1. [Questions?!?](#questions) 4 | 2. [Issue tracker](#issue-tracker) 5 | 3. [Issue tracker guidelines](#issue-tracker-guidelines) 6 | 4. [Pull requests](#pull-request) 7 | 5. [Pull request guidelines](#pull-request-guidelines) 8 | 9 | ## Questions?!? 10 | 11 | To get your questions answered, please ask/search on [Fabric's google group], [StackOverflow] or on Fabric's IRC channel (irc://irc.freenode.net/#fabric.js). 12 | Please do not open an issue if you're not sure it's a bug or if it's not a feature/suggestion. 13 | 14 | For news about Fabric you can follow [@fabric.js], [@kangax], or [@kienzle_s] on Twitter. 15 | Demos and examples can be found on [jsfiddle], [codepen.io] and [fabricjs.com]. 16 | 17 | ## Issue tracker 18 | 19 | If you are sure that it's a bug in Fabric.js or a suggestion, open a new [issue] and try to answer the following questions: 20 | 21 | - What did you do? 22 | - What did you expect to happen? 23 | - What happened instead? 24 | 25 | ### Issue tracker guidelines 26 | 27 | - **Search:** Before opening a new issue please [search](https://github.com/kangax/fabric.js/search?q=&ref=cmdform&type=Issues) Fabric's existing issues. 28 | 29 | - **Title:** Choose an informative title. 30 | 31 | - **Description:** Use the questions above to describe the issue. Add logs, screenshots or videos if that makes sense. 32 | 33 | - **Test case:** Please post code to replicate the bug - best on [jsfiddle](http://jsfiddle.net). Ideally a failing test would be 34 | perfect, but even a simple script demonstrating the error would suffice. You could use [this jsfiddle template](http://jsfiddle.net/fabricjs/Da7SP/) as a 35 | starting point. 36 | 37 | - **Fabric.js version:** Make sure to specify which version of Fabric.js you are using. The version can be found in [all.js file](https://github.com/kangax/fabric.js/blob/master/dist/all.js#L5) or just by executing `fabric.version` in the browser console. 38 | 39 | ## Pull requests 40 | 41 | We are very grateful for your pull requests! This is your chance to improve Fabric for everyone else. 42 | 43 | ### Pull request guidelines 44 | 45 | Here are a few notes you should take into account: 46 | 47 | - **Code style, notes:** Make sure you have complied with the [guidelines](https://github.com/kangax/fabric.js/wiki/How-to-contribute-to-Fabric#code-style-notes) 48 | 49 | - **Distribution files:** Do your changes only in the [source files](https://github.com/kangax/fabric.js/tree/master/src). Don't include the [distribution files](https://github.com/kangax/fabric.js/tree/master/dist) in your commit. 50 | 51 | - **Add tests**: Tests are always a great addition - invest a little time and expand the [unit tests suite](https://github.com/kangax/fabric.js/tree/master/test/unit). More informations about [QUnit](http://qunitjs.com/) tests can be found in the [wiki](https://github.com/kangax/fabric.js/wiki/How-to-contribute-to-Fabric#testing-fabric). 52 | 53 | - **Add documentation:** Fabric uses [JSDoc 3] for documentation. The generated documentation can be found at [fabricjs.com](http://fabricjs.com/docs). 54 | 55 | - **Create topic branches.** Don't use your master branch for pull request. It's better to create a new branch for every pull request. 56 | 57 | - **One pull request per feature/bug**. If you want to do more than one thing, send multiple pull requests. 58 | 59 | - **And there you go!** If you still have questions we're always happy to help. Also feel free to consult [wiki](https://github.com/kangax/fabric.js/wiki/How-to-contribute-to-Fabric). 60 | 61 | [Fabric's google group]: https://groups.google.com/forum/#!forum/fabricjs 62 | [stackoverflow]: http://stackoverflow.com/questions/tagged/fabricjs 63 | [@fabric.js]: https://twitter.com/fabricjs 64 | [@kangax]: https://twitter.com/kangax 65 | [@kienzle_s]: https://twitter.com/kienzle_s 66 | [jsfiddle]: http://jsfiddle.net/user/fabricjs/fiddles 67 | [codepen.io]: http://codepen.io/tag/fabricjs 68 | [fabricjs.com]: http://fabricjs.com/demos 69 | [JSDoc 3]: http://usejsdoc.org/ 70 | [issue]: https://github.com/kangax/fabric.js/issues 71 | -------------------------------------------------------------------------------- /bower_components/fabric/HEADER.js: -------------------------------------------------------------------------------- 1 | /*! Fabric.js Copyright 2008-2013, Printio (Juriy Zaytsev, Maxim Chernyak) */ 2 | 3 | var exports = exports || {}; 4 | var fabric = fabric || { version: "1.3.0" }; 5 | 6 | // make sure exports.fabric is always defined when used as 'global' later scopes 7 | exports.fabric = fabric; 8 | 9 | if (typeof document !== 'undefined' && typeof window !== 'undefined') { 10 | fabric.document = document; 11 | fabric.window = window; 12 | } 13 | else { 14 | // assume we're running under node.js when document/window are not present 15 | fabric.document = require("jsdom").jsdom(""); 16 | fabric.window = fabric.document.createWindow(); 17 | } 18 | 19 | /** 20 | * True when in environment that supports touch events 21 | * @type boolean 22 | */ 23 | fabric.isTouchSupported = "ontouchstart" in fabric.document.documentElement; 24 | 25 | /** 26 | * True when in environment that's probably Node.js 27 | * @type boolean 28 | */ 29 | fabric.isLikelyNode = typeof Buffer !== 'undefined' && typeof window === 'undefined'; 30 | -------------------------------------------------------------------------------- /bower_components/fabric/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2013 Printio (Juriy Zaytsev, Maxim Chernyak) 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16 | SOFTWARE. -------------------------------------------------------------------------------- /bower_components/fabric/build.sh: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bower_components/fabric/build_all: -------------------------------------------------------------------------------- 1 | echo 'building minified src files'; 2 | node build.js build-minified; 3 | 4 | echo 'creating build.sh with all module combinations (minified and not)'; 5 | node create_build_script.js; 6 | 7 | echo 'removing all previous module files'; 8 | rm -rf ../fabricjs.com/build/files; 9 | mkdir ../fabricjs.com/build/files; 10 | 11 | echo 'building actual distribution files with all module combinations (minified and not)'; 12 | ./build.sh; 13 | 14 | echo 'removing tmp files'; 15 | rm -rf tmp; 16 | mkdir tmp; 17 | 18 | echo 'erasing build.sh'; 19 | echo "" > build.sh; 20 | -------------------------------------------------------------------------------- /bower_components/fabric/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fabric.js", 3 | "repo": "kangax/fabric.js", 4 | "description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.", 5 | "version": "1.3.0", 6 | "keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"], 7 | "dependencies": {}, 8 | "development": {}, 9 | "license": "MIT", 10 | "scripts": [ 11 | "./dist/all.js" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /bower_components/fabric/create_build_script.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), 2 | execSync = require('execSync').exec; 3 | 4 | var modules = [ 5 | 'text', 6 | 'cufon', 7 | 'gestures', 8 | 'easing', 9 | 'parser', 10 | 'freedrawing', 11 | 'interaction', 12 | 'serialization', 13 | 'image_filters', 14 | 'gradient', 15 | 'pattern', 16 | 'shadow', 17 | 'node' 18 | ]; 19 | 20 | // http://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array 21 | var combine = function(a, min) { 22 | var fn = function(n, src, got, all) { 23 | if (n == 0) { 24 | if (got.length > 0) { 25 | all[all.length] = got; 26 | } 27 | return; 28 | } 29 | for (var j = 0, len = src.length; j < len; j++) { 30 | fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all); 31 | } 32 | return; 33 | } 34 | var all = []; 35 | for (var i = min, _len = a.length; i < _len; i++) { 36 | fn(i, a, [], all); 37 | } 38 | all.push(a); 39 | return all; 40 | } 41 | 42 | var combinations = combine(modules, 1); 43 | var startTime = new Date; 44 | 45 | fs.writeFile('build.sh', '#!/usr/bin/env sh\n\n', function() { 46 | 47 | for (var i = 0, len = combinations.length; i < len; i++) { 48 | 49 | var modulesStr = combinations[i].join(','); 50 | var command = 'node build.js build-sh modules=' + modulesStr; 51 | 52 | execSync(command); 53 | 54 | if (i % 100 === 0) { 55 | console.log(i + '/' + len); 56 | } 57 | } 58 | 59 | // create basic (minimal) build 60 | execSync('node build.js build-sh modules='); 61 | }); 62 | -------------------------------------------------------------------------------- /bower_components/fabric/dist/all.min.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/dist/all.min.js.gz -------------------------------------------------------------------------------- /bower_components/fabric/lib/centering_guidelines.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Augments canvas by assigning to `onObjectMove` and `onAfterRender`. 3 | * This kind of sucks because other code using those methods will stop functioning. 4 | * Need to fix it by replacing callbacks with pub/sub kind of subscription model. 5 | * (or maybe use existing fabric.util.fire/observe (if it won't be too slow)) 6 | */ 7 | function initCenteringGuidelines(canvas) { 8 | 9 | var canvasWidth = canvas.getWidth(), 10 | canvasHeight = canvas.getHeight(), 11 | canvasWidthCenter = canvasWidth / 2, 12 | canvasHeightCenter = canvasHeight / 2, 13 | canvasWidthCenterMap = { }, 14 | canvasHeightCenterMap = { }, 15 | centerLineMargin = 4, 16 | centerLineColor = 'rgba(255,0,241,0.5)', 17 | centerLineWidth = 1, 18 | ctx = canvas.getSelectionContext(); 19 | 20 | for (var i = canvasWidthCenter - centerLineMargin, len = canvasWidthCenter + centerLineMargin; i <= len; i++) { 21 | canvasWidthCenterMap[i] = true; 22 | } 23 | for (var i = canvasHeightCenter - centerLineMargin, len = canvasHeightCenter + centerLineMargin; i <= len; i++) { 24 | canvasHeightCenterMap[i] = true; 25 | } 26 | 27 | function showVerticalCenterLine() { 28 | showCenterLine(canvasWidthCenter + 0.5, 0, canvasWidthCenter + 0.5, canvasHeight); 29 | } 30 | 31 | function showHorizontalCenterLine() { 32 | showCenterLine(0, canvasHeightCenter + 0.5, canvasWidth, canvasHeightCenter + 0.5); 33 | } 34 | 35 | function showCenterLine(x1, y1, x2, y2) { 36 | ctx.save(); 37 | ctx.strokeStyle = centerLineColor; 38 | ctx.lineWidth = centerLineWidth; 39 | ctx.beginPath(); 40 | ctx.moveTo(x1, y1); 41 | ctx.lineTo(x2, y2); 42 | ctx.stroke(); 43 | ctx.restore(); 44 | } 45 | 46 | var afterRenderActions = [ ], 47 | isInVerticalCenter, 48 | isInHorizontalCenter; 49 | 50 | canvas.on('object:moving', function(e) { 51 | var object = e.target, 52 | objectCenter = object.getCenterPoint(), 53 | transform = canvas._currentTransform; 54 | 55 | if (!transform) return; 56 | 57 | isInVerticalCenter = objectCenter.x in canvasWidthCenterMap, 58 | isInHorizontalCenter = objectCenter.y in canvasHeightCenterMap; 59 | 60 | if (isInHorizontalCenter || isInVerticalCenter) { 61 | object.setPositionByOrigin(new fabric.Point((isInVerticalCenter ? canvasWidthCenter : objectCenter.x), (isInHorizontalCenter ? canvasHeightCenter : objectCenter.y)), transform.originX, transform.originY); 62 | } 63 | }); 64 | 65 | canvas.on('before:render', function() { 66 | canvas.clearContext(canvas.contextTop); 67 | }); 68 | 69 | canvas.on('after:render', function() { 70 | if (isInVerticalCenter) { 71 | showVerticalCenterLine(); 72 | } 73 | if (isInHorizontalCenter) { 74 | showHorizontalCenterLine(); 75 | } 76 | }); 77 | 78 | canvas.on('mouse:up', function() { 79 | // clear these values, to stop drawing guidelines once mouse is up 80 | isInVerticalCenter = isInHorizontalCenter = null; 81 | canvas.renderAll(); 82 | }); 83 | } -------------------------------------------------------------------------------- /bower_components/fabric/lib/google_closure_compiler.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/lib/google_closure_compiler.jar -------------------------------------------------------------------------------- /bower_components/fabric/lib/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/lib/screenshot.png -------------------------------------------------------------------------------- /bower_components/fabric/lib/yuicompressor-2.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/lib/yuicompressor-2.4.6.jar -------------------------------------------------------------------------------- /bower_components/fabric/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fabric", 3 | "description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.", 4 | "version": "1.3.0", 5 | "author": "Juriy Zaytsev ", 6 | "keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"], 7 | "repository": "git://github.com/kangax/fabric.js", 8 | "licenses": [{ 9 | "type": "MIT", 10 | "url": "http://github.com/kangax/fabric.js/raw/master/LICENSE" 11 | }], 12 | "scripts": { 13 | "build": "node build.js modules=ALL exclude=json,cufon,gestures", 14 | "test": "node test.js && jshint src" 15 | }, 16 | "dependencies": { 17 | "canvas": "1.0.x", 18 | "jsdom": "0.7.x", 19 | "xmldom": "0.1.x" 20 | }, 21 | "devDependencies": { 22 | "qunit": "0.5.x", 23 | "jshint": "2.1.x", 24 | "uglify-js": "2.3.x", 25 | "execSync": "0.0.x", 26 | "plato": "0.6.x" 27 | }, 28 | "engines": { "node": ">=0.4.0 && <1.0.0" }, 29 | "main": "./dist/all.js" 30 | } 31 | -------------------------------------------------------------------------------- /bower_components/fabric/src/amd/requirejs.js: -------------------------------------------------------------------------------- 1 | /* Footer for requirejs AMD support */ 2 | 3 | window.fabric = fabric; 4 | 5 | // make sure exports.fabric is always defined when used as 'global' later scopes 6 | var exports = exports || {}; 7 | exports.fabric = fabric; 8 | 9 | if (typeof define === "function" && define.amd) { 10 | define("fabric", [], function() { return fabric }); 11 | } 12 | -------------------------------------------------------------------------------- /bower_components/fabric/src/brushes/base_brush.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * BaseBrush class 3 | * @class fabric.BaseBrush 4 | */ 5 | fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype */ { 6 | 7 | /** 8 | * Color of a brush 9 | * @type String 10 | * @default 11 | */ 12 | color: 'rgb(0, 0, 0)', 13 | 14 | /** 15 | * Width of a brush 16 | * @type Number 17 | * @default 18 | */ 19 | width: 1, 20 | 21 | /** 22 | * Shadow object representing shadow of this shape. 23 | * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), 24 | * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 25 | * @type fabric.Shadow 26 | * @default 27 | */ 28 | shadow: null, 29 | 30 | /** 31 | * Line endings style of a brush (one of "butt", "round", "square") 32 | * @type String 33 | * @default 34 | */ 35 | strokeLineCap: 'round', 36 | 37 | /** 38 | * Corner style of a brush (one of "bevil", "round", "miter") 39 | * @type String 40 | * @default 41 | */ 42 | strokeLineJoin: 'round', 43 | 44 | /** 45 | * Sets shadow of an object 46 | * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") 47 | * @return {fabric.Object} thisArg 48 | * @chainable 49 | */ 50 | setShadow: function(options) { 51 | this.shadow = new fabric.Shadow(options); 52 | return this; 53 | }, 54 | 55 | /** 56 | * Sets brush styles 57 | * @private 58 | */ 59 | _setBrushStyles: function() { 60 | var ctx = this.canvas.contextTop; 61 | 62 | ctx.strokeStyle = this.color; 63 | ctx.lineWidth = this.width; 64 | ctx.lineCap = this.strokeLineCap; 65 | ctx.lineJoin = this.strokeLineJoin; 66 | }, 67 | 68 | /** 69 | * Sets brush shadow styles 70 | * @private 71 | */ 72 | _setShadow: function() { 73 | if (!this.shadow) return; 74 | 75 | var ctx = this.canvas.contextTop; 76 | 77 | ctx.shadowColor = this.shadow.color; 78 | ctx.shadowBlur = this.shadow.blur; 79 | ctx.shadowOffsetX = this.shadow.offsetX; 80 | ctx.shadowOffsetY = this.shadow.offsetY; 81 | }, 82 | 83 | /** 84 | * Removes brush shadow styles 85 | * @private 86 | */ 87 | _resetShadow: function() { 88 | var ctx = this.canvas.contextTop; 89 | 90 | ctx.shadowColor = ''; 91 | ctx.shadowBlur = ctx.shadowOffsetX = ctx.shadowOffsetY = 0; 92 | } 93 | }); 94 | -------------------------------------------------------------------------------- /bower_components/fabric/src/brushes/circle_brush.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * CircleBrush class 3 | * @class fabric.CircleBrush 4 | */ 5 | fabric.CircleBrush = fabric.util.createClass(fabric.BaseBrush, /** @lends fabric.CircleBrush.prototype */ { 6 | 7 | /** 8 | * Width of a brush 9 | * @type Number 10 | * @default 11 | */ 12 | width: 10, 13 | 14 | /** 15 | * Constructor 16 | * @param {fabric.Canvas} canvas 17 | * @return {fabric.CircleBrush} Instance of a circle brush 18 | */ 19 | initialize: function(canvas) { 20 | this.canvas = canvas; 21 | this.points = [ ]; 22 | }, 23 | /** 24 | * Invoked inside on mouse down and mouse move 25 | * @param {Object} pointer 26 | */ 27 | drawDot: function(pointer) { 28 | var point = this.addPoint(pointer); 29 | var ctx = this.canvas.contextTop; 30 | 31 | ctx.fillStyle = point.fill; 32 | ctx.beginPath(); 33 | ctx.arc(point.x, point.y, point.radius, 0, Math.PI * 2, false); 34 | ctx.closePath(); 35 | ctx.fill(); 36 | }, 37 | 38 | /** 39 | * Invoked on mouse down 40 | */ 41 | onMouseDown: function(pointer) { 42 | this.points.length = 0; 43 | this.canvas.clearContext(this.canvas.contextTop); 44 | this._setShadow(); 45 | this.drawDot(pointer); 46 | }, 47 | 48 | /** 49 | * Invoked on mouse move 50 | * @param {Object} pointer 51 | */ 52 | onMouseMove: function(pointer) { 53 | this.drawDot(pointer); 54 | }, 55 | 56 | /** 57 | * Invoked on mouse up 58 | */ 59 | onMouseUp: function() { 60 | var originalRenderOnAddRemove = this.canvas.renderOnAddRemove; 61 | this.canvas.renderOnAddRemove = false; 62 | 63 | var circles = [ ]; 64 | 65 | for (var i = 0, len = this.points.length; i < len; i++) { 66 | var point = this.points[i]; 67 | var circle = new fabric.Circle({ 68 | radius: point.radius, 69 | left: point.x, 70 | top: point.y, 71 | fill: point.fill 72 | }); 73 | 74 | this.shadow && circle.setShadow(this.shadow); 75 | 76 | circles.push(circle); 77 | } 78 | var group = new fabric.Group(circles); 79 | 80 | this.canvas.add(group); 81 | this.canvas.fire('path:created', { path: group }); 82 | 83 | this.canvas.clearContext(this.canvas.contextTop); 84 | this._resetShadow(); 85 | this.canvas.renderOnAddRemove = originalRenderOnAddRemove; 86 | this.canvas.renderAll(); 87 | }, 88 | 89 | /** 90 | * @param {Object} pointer 91 | * @return {fabric.Point} Just added pointer point 92 | */ 93 | addPoint: function(pointer) { 94 | var pointerPoint = new fabric.Point(pointer.x, pointer.y); 95 | 96 | var circleRadius = fabric.util.getRandomInt( 97 | Math.max(0, this.width - 20), this.width + 20) / 2; 98 | 99 | var circleColor = new fabric.Color(this.color) 100 | .setAlpha(fabric.util.getRandomInt(0, 100) / 100) 101 | .toRgba(); 102 | 103 | pointerPoint.radius = circleRadius; 104 | pointerPoint.fill = circleColor; 105 | 106 | this.points.push(pointerPoint); 107 | 108 | return pointerPoint; 109 | } 110 | }); 111 | -------------------------------------------------------------------------------- /bower_components/fabric/src/brushes/pattern_brush.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * PatternBrush class 3 | * @class fabric.PatternBrush 4 | * @extends fabric.BaseBrush 5 | */ 6 | fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fabric.PatternBrush.prototype */ { 7 | 8 | getPatternSrc: function() { 9 | 10 | var dotWidth = 20, 11 | dotDistance = 5, 12 | patternCanvas = fabric.document.createElement('canvas'), 13 | patternCtx = patternCanvas.getContext('2d'); 14 | 15 | patternCanvas.width = patternCanvas.height = dotWidth + dotDistance; 16 | 17 | patternCtx.fillStyle = this.color; 18 | patternCtx.beginPath(); 19 | patternCtx.arc(dotWidth / 2, dotWidth / 2, dotWidth / 2, 0, Math.PI * 2, false); 20 | patternCtx.closePath(); 21 | patternCtx.fill(); 22 | 23 | return patternCanvas; 24 | }, 25 | 26 | getPatternSrcFunction: function() { 27 | return String(this.getPatternSrc).replace('this.color', '"' + this.color + '"'); 28 | }, 29 | 30 | /** 31 | * Creates "pattern" instance property 32 | */ 33 | getPattern: function() { 34 | return this.canvas.contextTop.createPattern(this.source || this.getPatternSrc(), 'repeat'); 35 | }, 36 | 37 | /** 38 | * Sets brush styles 39 | */ 40 | _setBrushStyles: function() { 41 | this.callSuper('_setBrushStyles'); 42 | this.canvas.contextTop.strokeStyle = this.getPattern(); 43 | }, 44 | 45 | /** 46 | * Creates path 47 | */ 48 | createPath: function(pathData) { 49 | var path = this.callSuper('createPath', pathData); 50 | path.stroke = new fabric.Pattern({ 51 | source: this.source || this.getPatternSrcFunction() 52 | }); 53 | return path; 54 | } 55 | }); 56 | -------------------------------------------------------------------------------- /bower_components/fabric/src/brushes/spray_brush.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SprayBrush class 3 | * @class fabric.SprayBrush 4 | */ 5 | fabric.SprayBrush = fabric.util.createClass( fabric.BaseBrush, /** @lends fabric.SprayBrush.prototype */ { 6 | 7 | /** 8 | * Width of a spray 9 | * @type Number 10 | * @default 11 | */ 12 | width: 10, 13 | 14 | /** 15 | * Density of a spray (number of dots per chunk) 16 | * @type Number 17 | * @default 18 | */ 19 | density: 20, 20 | 21 | /** 22 | * Width of spray dots 23 | * @type Number 24 | * @default 25 | */ 26 | dotWidth: 1, 27 | 28 | /** 29 | * Width variance of spray dots 30 | * @type Number 31 | * @default 32 | */ 33 | dotWidthVariance: 1, 34 | 35 | /** 36 | * Whether opacity of a dot should be random 37 | * @type Boolean 38 | * @default 39 | */ 40 | randomOpacity: false, 41 | 42 | /** 43 | * Constructor 44 | * @param {fabric.Canvas} canvas 45 | * @return {fabric.SprayBrush} Instance of a spray brush 46 | */ 47 | initialize: function(canvas) { 48 | this.canvas = canvas; 49 | this.sprayChunks = [ ]; 50 | }, 51 | 52 | /** 53 | * Invoked on mouse down 54 | * @param {Object} pointer 55 | */ 56 | onMouseDown: function(pointer) { 57 | this.sprayChunks.length = 0; 58 | this.canvas.clearContext(this.canvas.contextTop); 59 | this._setShadow(); 60 | 61 | this.addSprayChunk(pointer); 62 | this.render(); 63 | }, 64 | 65 | /** 66 | * Invoked on mouse move 67 | * @param {Object} pointer 68 | */ 69 | onMouseMove: function(pointer) { 70 | this.addSprayChunk(pointer); 71 | this.render(); 72 | }, 73 | 74 | /** 75 | * Invoked on mouse up 76 | */ 77 | onMouseUp: function() { 78 | var originalRenderOnAddRemove = this.canvas.renderOnAddRemove; 79 | this.canvas.renderOnAddRemove = false; 80 | 81 | var rects = [ ]; 82 | 83 | for (var i = 0, ilen = this.sprayChunks.length; i < ilen; i++) { 84 | var sprayChunk = this.sprayChunks[i]; 85 | 86 | for (var j = 0, jlen = sprayChunk.length; j < jlen; j++) { 87 | 88 | var rect = new fabric.Rect({ 89 | width: sprayChunk[j].width, 90 | height: sprayChunk[j].width, 91 | left: sprayChunk[j].x + 1, 92 | top: sprayChunk[j].y + 1, 93 | fill: this.color 94 | }); 95 | 96 | this.shadow && rect.setShadow(this.shadow); 97 | rects.push(rect); 98 | } 99 | } 100 | var group = new fabric.Group(rects); 101 | this.canvas.add(group); 102 | this.canvas.fire('path:created', { path: group }); 103 | 104 | this.canvas.clearContext(this.canvas.contextTop); 105 | this._resetShadow(); 106 | this.canvas.renderOnAddRemove = originalRenderOnAddRemove; 107 | this.canvas.renderAll(); 108 | }, 109 | 110 | /** 111 | * Renders brush 112 | */ 113 | render: function() { 114 | var ctx = this.canvas.contextTop; 115 | ctx.fillStyle = this.color; 116 | ctx.save(); 117 | 118 | for (var i = 0, len = this.sprayChunkPoints.length; i < len; i++) { 119 | var point = this.sprayChunkPoints[i]; 120 | if (typeof point.opacity !== 'undefined') { 121 | ctx.globalAlpha = point.opacity; 122 | } 123 | ctx.fillRect(point.x, point.y, point.width, point.width); 124 | } 125 | ctx.restore(); 126 | }, 127 | 128 | /** 129 | * @param {Object} pointer 130 | */ 131 | addSprayChunk: function(pointer) { 132 | this.sprayChunkPoints = [ ]; 133 | 134 | var x, y, width, radius = this.width / 2; 135 | 136 | for (var i = 0; i < this.density; i++) { 137 | 138 | x = fabric.util.getRandomInt(pointer.x - radius, pointer.x + radius); 139 | y = fabric.util.getRandomInt(pointer.y - radius, pointer.y + radius); 140 | 141 | if (this.dotWidthVariance) { 142 | width = fabric.util.getRandomInt( 143 | // bottom clamp width to 1 144 | Math.max(1, this.dotWidth - this.dotWidthVariance), 145 | this.dotWidth + this.dotWidthVariance); 146 | } 147 | else { 148 | width = this.dotWidth; 149 | } 150 | 151 | var point = { x: x, y: y, width: width }; 152 | 153 | if (this.randomOpacity) { 154 | point.opacity = fabric.util.getRandomInt(0, 100) / 100; 155 | } 156 | 157 | this.sprayChunkPoints.push(point); 158 | } 159 | 160 | this.sprayChunks.push(this.sprayChunkPoints); 161 | } 162 | }); 163 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/base_filter.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @namespace fabric.Image.filters 3 | * @memberOf fabric.Image 4 | */ 5 | fabric.Image.filters = fabric.Image.filters || { }; 6 | 7 | 8 | /** 9 | * Root filter class from which all filter classes inherit from 10 | * @class fabric.Image.filters.BaseFilter 11 | * @memberOf fabric.Image.filters 12 | */ 13 | fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Image.filters.BaseFilter.prototype */ { 14 | 15 | /** 16 | * Filter type 17 | * @param {String} type 18 | * @default 19 | */ 20 | type: 'BaseFilter', 21 | 22 | /** 23 | * Returns object representation of an instance 24 | * @return {Object} Object representation of an instance 25 | */ 26 | toObject: function() { 27 | return { type: this.type }; 28 | }, 29 | 30 | /** 31 | * Returns a JSON representation of an instance 32 | * @return {Object} JSON 33 | */ 34 | toJSON: function() { 35 | // delegate, not alias 36 | return this.toObject(); 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/brightness_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Brightness filter class 10 | * @class fabric.Image.filters.Brightness 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Brightness = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Brightness.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Brightness', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Brightness.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.brightness = options.brightness || 100; 31 | }, 32 | 33 | /** 34 | * Applies filter to canvas element 35 | * @param {Object} canvasEl Canvas element to apply filter to 36 | */ 37 | applyTo: function(canvasEl) { 38 | var context = canvasEl.getContext('2d'), 39 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 40 | data = imageData.data, 41 | brightness = this.brightness; 42 | 43 | for (var i = 0, len = data.length; i < len; i += 4) { 44 | data[i] += brightness; 45 | data[i + 1] += brightness; 46 | data[i + 2] += brightness; 47 | } 48 | 49 | context.putImageData(imageData, 0, 0); 50 | }, 51 | 52 | /** 53 | * Returns object representation of an instance 54 | * @return {Object} Object representation of an instance 55 | */ 56 | toObject: function() { 57 | return extend(this.callSuper('toObject'), { 58 | brightness: this.brightness 59 | }); 60 | } 61 | }); 62 | 63 | /** 64 | * Returns filter instance from an object representation 65 | * @static 66 | * @param {Object} object Object to create an instance from 67 | * @return {fabric.Image.filters.Brightness} Instance of fabric.Image.filters.Brightness 68 | */ 69 | fabric.Image.filters.Brightness.fromObject = function(object) { 70 | return new fabric.Image.filters.Brightness(object); 71 | }; 72 | 73 | })(typeof exports !== 'undefined' ? exports : this); 74 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/convolute_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Adapted from html5rocks article 10 | * @class fabric.Image.filters.Convolute 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Convolute = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Convolute.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Convolute', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Convolute.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | 31 | this.opaque = options.opaque; 32 | this.matrix = options.matrix || [ 0, 0, 0, 33 | 0, 1, 0, 34 | 0, 0, 0 ]; 35 | 36 | var canvasEl = fabric.util.createCanvasElement(); 37 | this.tmpCtx = canvasEl.getContext('2d'); 38 | }, 39 | 40 | /** 41 | * @private 42 | */ 43 | _createImageData: function(w, h) { 44 | return this.tmpCtx.createImageData(w, h); 45 | }, 46 | 47 | /** 48 | * Applies filter to canvas element 49 | * @param {Object} canvasEl Canvas element to apply filter to 50 | */ 51 | applyTo: function(canvasEl) { 52 | var weights = this.matrix; 53 | var context = canvasEl.getContext('2d'); 54 | var pixels = context.getImageData(0, 0, canvasEl.width, canvasEl.height); 55 | 56 | var side = Math.round(Math.sqrt(weights.length)); 57 | var halfSide = Math.floor(side/2); 58 | var src = pixels.data; 59 | var sw = pixels.width; 60 | var sh = pixels.height; 61 | 62 | // pad output by the convolution matrix 63 | var w = sw; 64 | var h = sh; 65 | var output = this._createImageData(w, h); 66 | 67 | var dst = output.data; 68 | 69 | // go through the destination image pixels 70 | var alphaFac = this.opaque ? 1 : 0; 71 | for (var y=0; y= 0 && scy < sh && scx >= 0 && scx < sw) { 84 | var srcOff = (scy*sw+scx)*4; 85 | var wt = weights[cy*side+cx]; 86 | r += src[srcOff] * wt; 87 | g += src[srcOff+1] * wt; 88 | b += src[srcOff+2] * wt; 89 | a += src[srcOff+3] * wt; 90 | } 91 | } 92 | } 93 | dst[dstOff] = r; 94 | dst[dstOff+1] = g; 95 | dst[dstOff+2] = b; 96 | dst[dstOff+3] = a + alphaFac*(255-a); 97 | } 98 | } 99 | 100 | context.putImageData(output, 0, 0); 101 | }, 102 | 103 | /** 104 | * Returns object representation of an instance 105 | * @return {Object} Object representation of an instance 106 | */ 107 | toObject: function() { 108 | return extend(this.callSuper('toObject'), { 109 | opaque: this.opaque, 110 | matrix: this.matrix 111 | }); 112 | } 113 | }); 114 | 115 | /** 116 | * Returns filter instance from an object representation 117 | * @static 118 | * @param {Object} object Object to create an instance from 119 | * @return {fabric.Image.filters.Convolute} Instance of fabric.Image.filters.Convolute 120 | */ 121 | fabric.Image.filters.Convolute.fromObject = function(object) { 122 | return new fabric.Image.filters.Convolute(object); 123 | }; 124 | 125 | })(typeof exports !== 'undefined' ? exports : this); 126 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/gradienttransparency_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * GradientTransparency filter class 10 | * @class fabric.Image.filters.GradientTransparency 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.GradientTransparency = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.GradientTransparency.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'GradientTransparency', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.GradientTransparency 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.threshold = options.threshold || 100; 31 | }, 32 | 33 | /** 34 | * Applies filter to canvas element 35 | * @param {Object} canvasEl Canvas element to apply filter to 36 | */ 37 | applyTo: function(canvasEl) { 38 | var context = canvasEl.getContext('2d'), 39 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 40 | data = imageData.data, 41 | threshold = this.threshold, 42 | total = data.length; 43 | 44 | for (var i = 0, len = data.length; i < len; i += 4) { 45 | data[i + 3] = threshold + 255 * (total - i) / total; 46 | } 47 | 48 | context.putImageData(imageData, 0, 0); 49 | }, 50 | 51 | /** 52 | * Returns object representation of an instance 53 | * @return {Object} Object representation of an instance 54 | */ 55 | toObject: function() { 56 | return extend(this.callSuper('toObject'), { 57 | threshold: this.threshold 58 | }); 59 | } 60 | }); 61 | 62 | /** 63 | * Returns filter instance from an object representation 64 | * @static 65 | * @param {Object} object Object to create an instance from 66 | * @return {fabric.Image.filters.GradientTransparency} Instance of fabric.Image.filters.GradientTransparency 67 | */ 68 | fabric.Image.filters.GradientTransparency.fromObject = function(object) { 69 | return new fabric.Image.filters.GradientTransparency(object); 70 | }; 71 | 72 | })(typeof exports !== 'undefined' ? exports : this); 73 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/grayscale_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | /** 8 | * Grayscale image filter class 9 | * @class fabric.Image.filters.Grayscale 10 | * @memberOf fabric.Image.filters 11 | * @extends fabric.Image.filters.BaseFilter 12 | */ 13 | fabric.Image.filters.Grayscale = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Grayscale.prototype */ { 14 | 15 | /** 16 | * Filter type 17 | * @param {String} type 18 | * @default 19 | */ 20 | type: 'Grayscale', 21 | 22 | /** 23 | * Applies filter to canvas element 24 | * @memberOf fabric.Image.filters.Grayscale.prototype 25 | * @param {Object} canvasEl Canvas element to apply filter to 26 | */ 27 | applyTo: function(canvasEl) { 28 | var context = canvasEl.getContext('2d'), 29 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 30 | data = imageData.data, 31 | len = imageData.width * imageData.height * 4, 32 | index = 0, 33 | average; 34 | 35 | while (index < len) { 36 | average = (data[index] + data[index + 1] + data[index + 2]) / 3; 37 | data[index] = average; 38 | data[index + 1] = average; 39 | data[index + 2] = average; 40 | index += 4; 41 | } 42 | 43 | context.putImageData(imageData, 0, 0); 44 | } 45 | }); 46 | 47 | /** 48 | * Returns filter instance from an object representation 49 | * @static 50 | * @return {fabric.Image.filters.Grayscale} Instance of fabric.Image.filters.Grayscale 51 | */ 52 | fabric.Image.filters.Grayscale.fromObject = function() { 53 | return new fabric.Image.filters.Grayscale(); 54 | }; 55 | 56 | })(typeof exports !== 'undefined' ? exports : this); 57 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/invert_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | /** 8 | * Invert filter class 9 | * @class fabric.Image.filters.Invert 10 | * @memberOf fabric.Image.filters 11 | * @extends fabric.Image.filters.BaseFilter 12 | */ 13 | fabric.Image.filters.Invert = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Invert.prototype */ { 14 | 15 | /** 16 | * Filter type 17 | * @param {String} type 18 | * @default 19 | */ 20 | type: 'Invert', 21 | 22 | /** 23 | * Applies filter to canvas element 24 | * @memberOf fabric.Image.filters.Invert.prototype 25 | * @param {Object} canvasEl Canvas element to apply filter to 26 | */ 27 | applyTo: function(canvasEl) { 28 | var context = canvasEl.getContext('2d'), 29 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 30 | data = imageData.data, 31 | iLen = data.length, i; 32 | 33 | for (i = 0; i < iLen; i+=4) { 34 | data[i] = 255 - data[i]; 35 | data[i + 1] = 255 - data[i + 1]; 36 | data[i + 2] = 255 - data[i + 2]; 37 | } 38 | 39 | context.putImageData(imageData, 0, 0); 40 | } 41 | }); 42 | 43 | /** 44 | * Returns filter instance from an object representation 45 | * @static 46 | * @return {fabric.Image.filters.Invert} Instance of fabric.Image.filters.Invert 47 | */ 48 | fabric.Image.filters.Invert.fromObject = function() { 49 | return new fabric.Image.filters.Invert(); 50 | }; 51 | 52 | })(typeof exports !== 'undefined' ? exports : this); 53 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/mask_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Mask filter class 10 | * @class fabric.Image.filters.Mask 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Mask = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Mask.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Mask', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Mask.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | 31 | this.mask = options.mask; 32 | this.channel = [ 0, 1, 2, 3 ].indexOf(options.channel) > -1 ? options.channel : 0; 33 | }, 34 | 35 | /** 36 | * Applies filter to canvas element 37 | * @param {Object} canvasEl Canvas element to apply filter to 38 | */ 39 | applyTo: function(canvasEl) { 40 | if (!this.mask) return; 41 | 42 | var context = canvasEl.getContext('2d'), 43 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 44 | data = imageData.data, 45 | maskEl = this.mask.getElement(), 46 | maskCanvasEl = fabric.util.createCanvasElement(), 47 | channel = this.channel, 48 | i, 49 | iLen = imageData.width * imageData.height * 4; 50 | 51 | maskCanvasEl.width = maskEl.width; 52 | maskCanvasEl.height = maskEl.height; 53 | 54 | maskCanvasEl.getContext('2d').drawImage(maskEl, 0, 0, maskEl.width, maskEl.height); 55 | 56 | var maskImageData = maskCanvasEl.getContext('2d').getImageData(0, 0, maskEl.width, maskEl.height), 57 | maskData = maskImageData.data; 58 | 59 | for (i = 0; i < iLen; i += 4) { 60 | data[i + 3] = maskData[i + channel]; 61 | } 62 | 63 | context.putImageData(imageData, 0, 0); 64 | }, 65 | 66 | /** 67 | * Returns object representation of an instance 68 | * @return {Object} Object representation of an instance 69 | */ 70 | toObject: function() { 71 | return extend(this.callSuper('toObject'), { 72 | mask: this.mask.toObject(), 73 | channel: this.channel 74 | }); 75 | } 76 | }); 77 | 78 | /** 79 | * Returns filter instance from an object representation 80 | * @static 81 | * @param {Object} object Object to create an instance from 82 | * @param {Function} [callback] Callback to invoke when a mask filter instance is created 83 | */ 84 | fabric.Image.filters.Mask.fromObject = function(object, callback) { 85 | var img = fabric.document.createElement('img'), 86 | src = object.mask.src; 87 | 88 | /** @ignore */ 89 | img.onload = function() { 90 | object.mask = new fabric.Image(img, object.mask); 91 | 92 | callback && callback(new fabric.Image.filters.Mask(object)); 93 | img = img.onload = img.onerror = null; 94 | }; 95 | 96 | /** @ignore */ 97 | img.onerror = function() { 98 | fabric.log('Error loading ' + img.src); 99 | callback && callback(null, true); 100 | img = img.onload = img.onerror = null; 101 | }; 102 | 103 | img.src = src; 104 | }; 105 | 106 | /** 107 | * Indicates that instances of this type are async 108 | * @static 109 | * @type Boolean 110 | * @default 111 | */ 112 | fabric.Image.filters.Mask.async = true; 113 | 114 | })(typeof exports !== 'undefined' ? exports : this); 115 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/noise_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Noise filter class 10 | * @class fabric.Image.filters.Noise 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Noise = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Noise.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Noise', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Noise.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.noise = options.noise || 100; 31 | }, 32 | 33 | /** 34 | * Applies filter to canvas element 35 | * @param {Object} canvasEl Canvas element to apply filter to 36 | */ 37 | applyTo: function(canvasEl) { 38 | var context = canvasEl.getContext('2d'), 39 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 40 | data = imageData.data, 41 | noise = this.noise, rand; 42 | 43 | for (var i = 0, len = data.length; i < len; i += 4) { 44 | 45 | rand = (0.5 - Math.random()) * noise; 46 | 47 | data[i] += rand; 48 | data[i + 1] += rand; 49 | data[i + 2] += rand; 50 | } 51 | 52 | context.putImageData(imageData, 0, 0); 53 | }, 54 | 55 | /** 56 | * Returns object representation of an instance 57 | * @return {Object} Object representation of an instance 58 | */ 59 | toObject: function() { 60 | return extend(this.callSuper('toObject'), { 61 | noise: this.noise 62 | }); 63 | } 64 | }); 65 | 66 | /** 67 | * Returns filter instance from an object representation 68 | * @static 69 | * @param {Object} object Object to create an instance from 70 | * @return {fabric.Image.filters.Noise} Instance of fabric.Image.filters.Noise 71 | */ 72 | fabric.Image.filters.Noise.fromObject = function(object) { 73 | return new fabric.Image.filters.Noise(object); 74 | }; 75 | 76 | })(typeof exports !== 'undefined' ? exports : this); 77 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/pixelate_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Pixelate filter class 10 | * @class fabric.Image.filters.Pixelate 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Pixelate = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Pixelate.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Pixelate', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Pixelate.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.blocksize = options.blocksize || 4; 31 | }, 32 | 33 | /** 34 | * Applies filter to canvas element 35 | * @param {Object} canvasEl Canvas element to apply filter to 36 | */ 37 | applyTo: function(canvasEl) { 38 | var context = canvasEl.getContext('2d'), 39 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 40 | data = imageData.data, 41 | iLen = imageData.height, 42 | jLen = imageData.width, 43 | index, i, j, r, g, b, a; 44 | 45 | for (i = 0; i < iLen; i += this.blocksize) { 46 | for (j = 0; j < jLen; j += this.blocksize) { 47 | 48 | index = (i * 4) * jLen + (j * 4); 49 | 50 | r = data[index]; 51 | g = data[index+1]; 52 | b = data[index+2]; 53 | a = data[index+3]; 54 | 55 | /* 56 | blocksize: 4 57 | 58 | [1,x,x,x,1] 59 | [x,x,x,x,1] 60 | [x,x,x,x,1] 61 | [x,x,x,x,1] 62 | [1,1,1,1,1] 63 | */ 64 | 65 | for (var _i = i, _ilen = i + this.blocksize; _i < _ilen; _i++) { 66 | for (var _j = j, _jlen = j + this.blocksize; _j < _jlen; _j++) { 67 | index = (_i * 4) * jLen + (_j * 4); 68 | data[index] = r; 69 | data[index + 1] = g; 70 | data[index + 2] = b; 71 | data[index + 3] = a; 72 | } 73 | } 74 | } 75 | } 76 | 77 | context.putImageData(imageData, 0, 0); 78 | }, 79 | 80 | /** 81 | * Returns object representation of an instance 82 | * @return {Object} Object representation of an instance 83 | */ 84 | toObject: function() { 85 | return extend(this.callSuper('toObject'), { 86 | blocksize: this.blocksize 87 | }); 88 | } 89 | }); 90 | 91 | /** 92 | * Returns filter instance from an object representation 93 | * @static 94 | * @param {Object} object Object to create an instance from 95 | * @return {fabric.Image.filters.Pixelate} Instance of fabric.Image.filters.Pixelate 96 | */ 97 | fabric.Image.filters.Pixelate.fromObject = function(object) { 98 | return new fabric.Image.filters.Pixelate(object); 99 | }; 100 | 101 | })(typeof exports !== 'undefined' ? exports : this); 102 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/removewhite_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Remove white filter class 10 | * @class fabric.Image.filters.RemoveWhite 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.RemoveWhite = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.RemoveWhite.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'RemoveWhite', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.RemoveWhite.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.threshold = options.threshold || 30; 31 | this.distance = options.distance || 20; 32 | }, 33 | 34 | /** 35 | * Applies filter to canvas element 36 | * @param {Object} canvasEl Canvas element to apply filter to 37 | */ 38 | applyTo: function(canvasEl) { 39 | var context = canvasEl.getContext('2d'), 40 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 41 | data = imageData.data, 42 | threshold = this.threshold, 43 | distance = this.distance, 44 | limit = 255 - threshold, 45 | abs = Math.abs, 46 | r, g, b; 47 | 48 | for (var i = 0, len = data.length; i < len; i += 4) { 49 | r = data[i]; 50 | g = data[i+1]; 51 | b = data[i+2]; 52 | 53 | if (r > limit && 54 | g > limit && 55 | b > limit && 56 | abs(r-g) < distance && 57 | abs(r-b) < distance && 58 | abs(g-b) < distance 59 | ) { 60 | data[i+3] = 1; 61 | } 62 | } 63 | 64 | context.putImageData(imageData, 0, 0); 65 | }, 66 | 67 | /** 68 | * Returns object representation of an instance 69 | * @return {Object} Object representation of an instance 70 | */ 71 | toObject: function() { 72 | return extend(this.callSuper('toObject'), { 73 | threshold: this.threshold, 74 | distance: this.distance 75 | }); 76 | } 77 | }); 78 | 79 | /** 80 | * Returns filter instance from an object representation 81 | * @static 82 | * @param {Object} object Object to create an instance from 83 | * @return {fabric.Image.filters.RemoveWhite} Instance of fabric.Image.filters.RemoveWhite 84 | */ 85 | fabric.Image.filters.RemoveWhite.fromObject = function(object) { 86 | return new fabric.Image.filters.RemoveWhite(object); 87 | }; 88 | 89 | })(typeof exports !== 'undefined' ? exports : this); 90 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/sepia2_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | /** 8 | * Sepia2 filter class 9 | * @class fabric.Image.filters.Sepia2 10 | * @memberOf fabric.Image.filters 11 | * @extends fabric.Image.filters.BaseFilter 12 | */ 13 | fabric.Image.filters.Sepia2 = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Sepia2.prototype */ { 14 | 15 | /** 16 | * Filter type 17 | * @param {String} type 18 | * @default 19 | */ 20 | type: 'Sepia2', 21 | 22 | /** 23 | * Applies filter to canvas element 24 | * @memberOf fabric.Image.filters.Sepia.prototype 25 | * @param {Object} canvasEl Canvas element to apply filter to 26 | */ 27 | applyTo: function(canvasEl) { 28 | var context = canvasEl.getContext('2d'), 29 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 30 | data = imageData.data, 31 | iLen = data.length, i, r, g, b; 32 | 33 | for (i = 0; i < iLen; i+=4) { 34 | r = data[i]; 35 | g = data[i + 1]; 36 | b = data[i + 2]; 37 | 38 | data[i] = (r * 0.393 + g * 0.769 + b * 0.189 ) / 1.351; 39 | data[i + 1] = (r * 0.349 + g * 0.686 + b * 0.168 ) / 1.203; 40 | data[i + 2] = (r * 0.272 + g * 0.534 + b * 0.131 ) / 2.140; 41 | } 42 | 43 | context.putImageData(imageData, 0, 0); 44 | } 45 | }); 46 | 47 | /** 48 | * Returns filter instance from an object representation 49 | * @static 50 | * @return {fabric.Image.filters.Sepia2} Instance of fabric.Image.filters.Sepia2 51 | */ 52 | fabric.Image.filters.Sepia2.fromObject = function() { 53 | return new fabric.Image.filters.Sepia2(); 54 | }; 55 | 56 | })(typeof exports !== 'undefined' ? exports : this); 57 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/sepia_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | /** 8 | * Sepia filter class 9 | * @class fabric.Image.filters.Sepia 10 | * @memberOf fabric.Image.filters 11 | * @extends fabric.Image.filters.BaseFilter 12 | */ 13 | fabric.Image.filters.Sepia = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Sepia.prototype */ { 14 | 15 | /** 16 | * Filter type 17 | * @param {String} type 18 | * @default 19 | */ 20 | type: 'Sepia', 21 | 22 | /** 23 | * Applies filter to canvas element 24 | * @memberOf fabric.Image.filters.Sepia.prototype 25 | * @param {Object} canvasEl Canvas element to apply filter to 26 | */ 27 | applyTo: function(canvasEl) { 28 | var context = canvasEl.getContext('2d'), 29 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 30 | data = imageData.data, 31 | iLen = data.length, i, avg; 32 | 33 | for (i = 0; i < iLen; i+=4) { 34 | avg = 0.3 * data[i] + 0.59 * data[i + 1] + 0.11 * data[i + 2]; 35 | data[i] = avg + 100; 36 | data[i + 1] = avg + 50; 37 | data[i + 2] = avg + 255; 38 | } 39 | 40 | context.putImageData(imageData, 0, 0); 41 | } 42 | }); 43 | 44 | /** 45 | * Returns filter instance from an object representation 46 | * @static 47 | * @return {fabric.Image.filters.Sepia} Instance of fabric.Image.filters.Sepia 48 | */ 49 | fabric.Image.filters.Sepia.fromObject = function() { 50 | return new fabric.Image.filters.Sepia(); 51 | }; 52 | 53 | })(typeof exports !== 'undefined' ? exports : this); 54 | -------------------------------------------------------------------------------- /bower_components/fabric/src/filters/tint_filter.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }), 6 | extend = fabric.util.object.extend; 7 | 8 | /** 9 | * Tint filter class 10 | * @class fabric.Image.filters.Tint 11 | * @memberOf fabric.Image.filters 12 | * @extends fabric.Image.filters.BaseFilter 13 | */ 14 | fabric.Image.filters.Tint = fabric.util.createClass(fabric.Image.filters.BaseFilter, /** @lends fabric.Image.filters.Tint.prototype */ { 15 | 16 | /** 17 | * Filter type 18 | * @param {String} type 19 | * @default 20 | */ 21 | type: 'Tint', 22 | 23 | /** 24 | * Constructor 25 | * @memberOf fabric.Image.filters.Tint.prototype 26 | * @param {Object} [options] Options object 27 | */ 28 | initialize: function(options) { 29 | options = options || { }; 30 | this.color = options.color || 0; 31 | }, 32 | 33 | /** 34 | * Applies filter to canvas element 35 | * @param {Object} canvasEl Canvas element to apply filter to 36 | */ 37 | applyTo: function(canvasEl) { 38 | var context = canvasEl.getContext('2d'), 39 | imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height), 40 | data = imageData.data, 41 | iLen = data.length, i, a; 42 | 43 | var rgb = parseInt(this.color, 10).toString(16); 44 | 45 | // Pad with leading zeros that may have been stripped off in conversion. 46 | while (rgb.length < 6) rgb = '0' + rgb; 47 | 48 | var cr = parseInt('0x' + rgb.substr(0, 2), 16); 49 | var cg = parseInt('0x' + rgb.substr(2, 2), 16); 50 | var cb = parseInt('0x' + rgb.substr(4, 2), 16); 51 | 52 | for (i = 0; i < iLen; i+=4) { 53 | a = data[i+3]; 54 | 55 | if (a > 0){ 56 | data[i] = cr; 57 | data[i+1] = cg; 58 | data[i+2] = cb; 59 | } 60 | } 61 | 62 | context.putImageData(imageData, 0, 0); 63 | }, 64 | 65 | /** 66 | * Returns object representation of an instance 67 | * @return {Object} Object representation of an instance 68 | */ 69 | toObject: function() { 70 | return extend(this.callSuper('toObject'), { 71 | color: this.color 72 | }); 73 | } 74 | }); 75 | 76 | /** 77 | * Returns filter instance from an object representation 78 | * @static 79 | * @param {Object} object Object to create an instance from 80 | * @return {fabric.Image.filters.Tint} Instance of fabric.Image.filters.Tint 81 | */ 82 | fabric.Image.filters.Tint.fromObject = function(object) { 83 | return new fabric.Image.filters.Tint(object); 84 | }; 85 | 86 | })(typeof exports !== 'undefined' ? exports : this); 87 | -------------------------------------------------------------------------------- /bower_components/fabric/src/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Wrapper around `console.log` (when available) 3 | * @param {Any} values Values to log 4 | */ 5 | fabric.log = function() { }; 6 | 7 | /** 8 | * Wrapper around `console.warn` (when available) 9 | * @param {Any} Values to log as a warning 10 | */ 11 | fabric.warn = function() { }; 12 | 13 | if (typeof console !== 'undefined') { 14 | if (typeof console.log !== 'undefined' && console.log.apply) { 15 | fabric.log = function() { 16 | return console.log.apply(console, arguments); 17 | }; 18 | } 19 | if (typeof console.warn !== 'undefined' && console.warn.apply) { 20 | fabric.warn = function() { 21 | return console.warn.apply(console, arguments); 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bower_components/fabric/src/mixins/canvas_gestures.mixin.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var degreesToRadians = fabric.util.degreesToRadians, 4 | radiansToDegrees = fabric.util.radiansToDegrees; 5 | 6 | fabric.util.object.extend(fabric.Canvas.prototype, /** @lends fabric.Canvas.prototype */ { 7 | 8 | /** 9 | * Method that defines actions when an Event.js gesture is detected on an object. Currently only supports 10 | * 2 finger gestures. 11 | * 12 | * @param e Event object by Event.js 13 | * @param self Event proxy object by Event.js 14 | */ 15 | __onTransformGesture: function(e, self) { 16 | 17 | if (this.isDrawingMode || e.touches.length !== 2 || 'gesture' !== self.gesture) { 18 | return; 19 | } 20 | 21 | var target = this.findTarget(e); 22 | if ('undefined' !== typeof target) { 23 | this.onBeforeScaleRotate(target); 24 | this._rotateObjectByAngle(self.rotation); 25 | this._scaleObjectBy(self.scale); 26 | } 27 | 28 | this.fire('touch:gesture', {target: target, e: e, self: self}); 29 | }, 30 | 31 | /** 32 | * Scales an object by a factor 33 | * @param s {Number} The scale factor to apply to the current scale level 34 | * @param by {String} Either 'x' or 'y' - specifies dimension constraint by which to scale an object. 35 | * When not provided, an object is scaled by both dimensions equally 36 | */ 37 | _scaleObjectBy: function(s, by) { 38 | var t = this._currentTransform, 39 | target = t.target; 40 | 41 | var lockScalingX = target.get('lockScalingX'), 42 | lockScalingY = target.get('lockScalingY'); 43 | 44 | if (lockScalingX && lockScalingY) return; 45 | 46 | target._scaling = true; 47 | 48 | if (!by) { 49 | if (!lockScalingX) { 50 | target.set('scaleX', t.scaleX * s); 51 | } 52 | if (!lockScalingY) { 53 | target.set('scaleY', t.scaleY * s); 54 | } 55 | } 56 | else if (by === 'x' && !target.get('lockUniScaling')) { 57 | lockScalingX || target.set('scaleX', t.scaleX * s); 58 | } 59 | else if (by === 'y' && !target.get('lockUniScaling')) { 60 | lockScalingY || target.set('scaleY', t.scaleY * s); 61 | } 62 | }, 63 | 64 | /** 65 | * Rotates object by an angle 66 | * @param curAngle {Number} the angle of rotation in degrees 67 | */ 68 | _rotateObjectByAngle: function(curAngle) { 69 | var t = this._currentTransform; 70 | 71 | if (t.target.get('lockRotation')) return; 72 | t.target.angle = radiansToDegrees(degreesToRadians(curAngle) + t.theta); 73 | } 74 | }); 75 | })(); 76 | -------------------------------------------------------------------------------- /bower_components/fabric/src/mixins/object_straightening.mixin.js: -------------------------------------------------------------------------------- 1 | fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ { 2 | 3 | /** 4 | * @private 5 | * @return {Number} angle value 6 | */ 7 | _getAngleValueForStraighten: function() { 8 | var angle = this.getAngle() % 360; 9 | if (angle > 0) { 10 | return Math.round((angle-1)/90) * 90; 11 | } 12 | return Math.round(angle/90) * 90; 13 | }, 14 | 15 | /** 16 | * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) 17 | * @return {fabric.Object} thisArg 18 | * @chainable 19 | */ 20 | straighten: function() { 21 | this.setAngle(this._getAngleValueForStraighten()); 22 | return this; 23 | }, 24 | 25 | /** 26 | * Same as {@link fabric.Object.prototype.straighten} but with animation 27 | * @param {Object} callbacks Object with callback functions 28 | * @param {Function} [callbacks.onComplete] Invoked on completion 29 | * @param {Function} [callbacks.onChange] Invoked on every step of animation 30 | * @return {fabric.Object} thisArg 31 | * @chainable 32 | */ 33 | fxStraighten: function(callbacks) { 34 | callbacks = callbacks || { }; 35 | 36 | var empty = function() { }, 37 | onComplete = callbacks.onComplete || empty, 38 | onChange = callbacks.onChange || empty, 39 | _this = this; 40 | 41 | fabric.util.animate({ 42 | startValue: this.get('angle'), 43 | endValue: this._getAngleValueForStraighten(), 44 | duration: this.FX_DURATION, 45 | onChange: function(value) { 46 | _this.setAngle(value); 47 | onChange(); 48 | }, 49 | onComplete: function() { 50 | _this.setCoords(); 51 | onComplete(); 52 | }, 53 | onStart: function() { 54 | _this.set('active', false); 55 | } 56 | }); 57 | 58 | return this; 59 | } 60 | }); 61 | 62 | fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.StaticCanvas.prototype */ { 63 | 64 | /** 65 | * Straightens object, then rerenders canvas 66 | * @param {fabric.Object} object Object to straighten 67 | * @return {fabric.Canvas} thisArg 68 | * @chainable 69 | */ 70 | straightenObject: function (object) { 71 | object.straighten(); 72 | this.renderAll(); 73 | return this; 74 | }, 75 | 76 | /** 77 | * Same as {@link fabric.Canvas.prototype.straightenObject}, but animated 78 | * @param {fabric.Object} object Object to straighten 79 | * @return {fabric.Canvas} thisArg 80 | * @chainable 81 | */ 82 | fxStraightenObject: function (object) { 83 | object.fxStraighten({ 84 | onChange: this.renderAll.bind(this) 85 | }); 86 | return this; 87 | } 88 | }); 89 | -------------------------------------------------------------------------------- /bower_components/fabric/src/mixins/observable.mixin.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | /** 4 | * @private 5 | * @param {String} eventName 6 | * @param {Function} handler 7 | */ 8 | function _removeEventListener(eventName, handler) { 9 | if (!this.__eventListeners[eventName]) return; 10 | 11 | if (handler) { 12 | fabric.util.removeFromArray(this.__eventListeners[eventName], handler); 13 | } 14 | else { 15 | this.__eventListeners[eventName].length = 0; 16 | } 17 | } 18 | 19 | /** 20 | * Observes specified event 21 | * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) 22 | * @memberOf fabric.Observable 23 | * @alias on 24 | * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) 25 | * @param {Function} handler Function that receives a notification when an event of the specified type occurs 26 | * @return {Self} thisArg 27 | * @chainable 28 | */ 29 | function observe(eventName, handler) { 30 | if (!this.__eventListeners) { 31 | this.__eventListeners = { }; 32 | } 33 | // one object with key/value pairs was passed 34 | if (arguments.length === 1) { 35 | for (var prop in eventName) { 36 | this.on(prop, eventName[prop]); 37 | } 38 | } 39 | else { 40 | if (!this.__eventListeners[eventName]) { 41 | this.__eventListeners[eventName] = [ ]; 42 | } 43 | this.__eventListeners[eventName].push(handler); 44 | } 45 | return this; 46 | } 47 | 48 | /** 49 | * Stops event observing for a particular event handler 50 | * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) 51 | * @memberOf fabric.Observable 52 | * @alias off 53 | * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) 54 | * @param {Function} handler Function to be deleted from EventListeners 55 | * @return {Self} thisArg 56 | * @chainable 57 | */ 58 | function stopObserving(eventName, handler) { 59 | if (!this.__eventListeners) return; 60 | 61 | // one object with key/value pairs was passed 62 | if (arguments.length === 1 && typeof arguments[0] === 'object') { 63 | for (var prop in eventName) { 64 | _removeEventListener.call(this, prop, eventName[prop]); 65 | } 66 | } 67 | else { 68 | _removeEventListener.call(this, eventName, handler); 69 | } 70 | return this; 71 | } 72 | 73 | /** 74 | * Fires event with an optional options object 75 | * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) 76 | * @memberOf fabric.Observable 77 | * @alias trigger 78 | * @param {String} eventName Event name to fire 79 | * @param {Object} [options] Options object 80 | * @return {Self} thisArg 81 | * @chainable 82 | */ 83 | function fire(eventName, options) { 84 | if (!this.__eventListeners) return; 85 | 86 | var listenersForEvent = this.__eventListeners[eventName]; 87 | if (!listenersForEvent) return; 88 | for (var i = 0, len = listenersForEvent.length; i < len; i++) { 89 | // avoiding try/catch for perf. reasons 90 | listenersForEvent[i].call(this, options || { }); 91 | } 92 | return this; 93 | } 94 | 95 | /** 96 | * @namespace fabric.Observable 97 | */ 98 | fabric.Observable = { 99 | observe: observe, 100 | stopObserving: stopObserving, 101 | fire: fire, 102 | 103 | on: observe, 104 | off: stopObserving, 105 | trigger: fire 106 | }; 107 | })(); 108 | -------------------------------------------------------------------------------- /bower_components/fabric/src/mixins/stateful.mixin.js: -------------------------------------------------------------------------------- 1 | /* 2 | Depends on `stateProperties` 3 | */ 4 | fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ { 5 | 6 | /** 7 | * Returns true if object state (one of its state properties) was changed 8 | * @return {Boolean} true if instance' state has changed since `{@link fabric.Object#saveState}` was called 9 | */ 10 | hasStateChanged: function() { 11 | return this.stateProperties.some(function(prop) { 12 | return this.get(prop) !== this.originalState[prop]; 13 | }, this); 14 | }, 15 | 16 | /** 17 | * Saves state of an object 18 | * @param {Object} [options] Object with additional `stateProperties` array to include when saving state 19 | * @return {fabric.Object} thisArg 20 | */ 21 | saveState: function(options) { 22 | this.stateProperties.forEach(function(prop) { 23 | this.originalState[prop] = this.get(prop); 24 | }, this); 25 | 26 | if (options && options.stateProperties) { 27 | options.stateProperties.forEach(function(prop) { 28 | this.originalState[prop] = this.get(prop); 29 | }, this); 30 | } 31 | 32 | return this; 33 | }, 34 | 35 | /** 36 | * Setups state of an object 37 | * @return {fabric.Object} thisArg 38 | */ 39 | setupState: function() { 40 | this.originalState = { }; 41 | this.saveState(); 42 | 43 | return this; 44 | } 45 | }); 46 | -------------------------------------------------------------------------------- /bower_components/fabric/src/pattern.class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Pattern class 3 | * @class fabric.Pattern 4 | */ 5 | fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */ { 6 | 7 | /** 8 | * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) 9 | * @type String 10 | * @default 11 | */ 12 | repeat: 'repeat', 13 | 14 | /** 15 | * Pattern horizontal offset from object's left/top corner 16 | * @type Number 17 | * @default 18 | */ 19 | offsetX: 0, 20 | 21 | /** 22 | * Pattern vertical offset from object's left/top corner 23 | * @type Number 24 | * @default 25 | */ 26 | offsetY: 0, 27 | 28 | /** 29 | * Constructor 30 | * @param {Object} [options] Options object 31 | * @return {fabric.Pattern} thisArg 32 | */ 33 | initialize: function(options) { 34 | options || (options = { }); 35 | 36 | this.id = fabric.Object.__uid++; 37 | 38 | if (options.source) { 39 | if (typeof options.source === 'string') { 40 | // function string 41 | if (typeof fabric.util.getFunctionBody(options.source) !== 'undefined') { 42 | this.source = new Function(fabric.util.getFunctionBody(options.source)); 43 | } 44 | else { 45 | // img src string 46 | var _this = this; 47 | this.source = fabric.util.createImage(); 48 | fabric.util.loadImage(options.source, function(img) { 49 | _this.source = img; 50 | }); 51 | } 52 | } 53 | else { 54 | // img element 55 | this.source = options.source; 56 | } 57 | } 58 | if (options.repeat) { 59 | this.repeat = options.repeat; 60 | } 61 | if (options.offsetX) { 62 | this.offsetX = options.offsetX; 63 | } 64 | if (options.offsetY) { 65 | this.offsetY = options.offsetY; 66 | } 67 | }, 68 | 69 | /** 70 | * Returns object representation of a pattern 71 | * @return {Object} Object representation of a pattern instance 72 | */ 73 | toObject: function() { 74 | 75 | var source; 76 | 77 | // callback 78 | if (typeof this.source === 'function') { 79 | source = String(this.source); 80 | } 81 | // element 82 | else if (typeof this.source.src === 'string') { 83 | source = this.source.src; 84 | } 85 | 86 | return { 87 | source: source, 88 | repeat: this.repeat, 89 | offsetX: this.offsetX, 90 | offsetY: this.offsetY 91 | }; 92 | }, 93 | 94 | /* _TO_SVG_START_ */ 95 | /** 96 | * Returns SVG representation of a pattern 97 | * @param {fabric.Object} object 98 | * @return {String} SVG representation of a pattern 99 | */ 100 | toSVG: function(object) { 101 | var patternSource = typeof this.source === 'function' ? this.source() : this.source; 102 | var patternWidth = patternSource.width / object.getWidth(); 103 | var patternHeight = patternSource.height / object.getHeight(); 104 | var patternImgSrc = ''; 105 | 106 | if (patternSource.src) { 107 | patternImgSrc = patternSource.src; 108 | } 109 | else if (patternSource.toDataURL) { 110 | patternImgSrc = patternSource.toDataURL(); 111 | } 112 | 113 | return '' + 118 | '' + 123 | ''; 124 | }, 125 | /* _TO_SVG_END_ */ 126 | 127 | /** 128 | * Returns an instance of CanvasPattern 129 | * @param {CanvasRenderingContext2D} ctx Context to create pattern 130 | * @return {CanvasPattern} 131 | */ 132 | toLive: function(ctx) { 133 | var source = typeof this.source === 'function' ? this.source() : this.source; 134 | return ctx.createPattern(source, this.repeat); 135 | } 136 | }); 137 | -------------------------------------------------------------------------------- /bower_components/fabric/src/shadow.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | if (fabric.Shadow) { 8 | fabric.warn('fabric.Shadow is already defined.'); 9 | return; 10 | } 11 | 12 | /** 13 | * Shadow class 14 | * @class fabric.Shadow 15 | */ 16 | fabric.Shadow = fabric.util.createClass(/** @lends fabric.Shadow.prototype */ { 17 | 18 | /** 19 | * Shadow color 20 | * @type String 21 | * @default 22 | */ 23 | color: 'rgb(0,0,0)', 24 | 25 | /** 26 | * Shadow blur 27 | * @type Number 28 | */ 29 | blur: 0, 30 | 31 | /** 32 | * Shadow horizontal offset 33 | * @type Number 34 | * @default 35 | */ 36 | offsetX: 0, 37 | 38 | /** 39 | * Shadow vertical offset 40 | * @type Number 41 | * @default 42 | */ 43 | offsetY: 0, 44 | 45 | /** 46 | * Whether the shadow should affect stroke operations 47 | * @type Boolean 48 | * @default 49 | */ 50 | affectStroke: false, 51 | 52 | /** 53 | * Constructor 54 | * @param {Object|String} [options] Options object with any of color, blur, offsetX, offsetX properties or string (e.g. "rgba(0,0,0,0.2) 2px 2px 10px, "2px 2px 10px rgba(0,0,0,0.2)") 55 | * @return {fabric.Shadow} thisArg 56 | */ 57 | initialize: function(options) { 58 | if (typeof options === 'string') { 59 | options = this._parseShadow(options); 60 | } 61 | 62 | for (var prop in options) { 63 | this[prop] = options[prop]; 64 | } 65 | 66 | this.id = fabric.Object.__uid++; 67 | }, 68 | 69 | /** 70 | * @private 71 | * @param {String} shadow Shadow value to parse 72 | * @return {Object} Shadow object with color, offsetX, offsetY and blur 73 | */ 74 | _parseShadow: function(shadow) { 75 | var shadowStr = shadow.trim(); 76 | 77 | var offsetsAndBlur = fabric.Shadow.reOffsetsAndBlur.exec(shadowStr) || [ ], 78 | color = shadowStr.replace(fabric.Shadow.reOffsetsAndBlur, '') || 'rgb(0,0,0)'; 79 | 80 | return { 81 | color: color.trim(), 82 | offsetX: parseInt(offsetsAndBlur[1], 10) || 0, 83 | offsetY: parseInt(offsetsAndBlur[2], 10) || 0, 84 | blur: parseInt(offsetsAndBlur[3], 10) || 0 85 | }; 86 | }, 87 | 88 | /** 89 | * Returns a string representation of an instance 90 | * @see http://www.w3.org/TR/css-text-decor-3/#text-shadow 91 | * @return {String} Returns CSS3 text-shadow declaration 92 | */ 93 | toString: function() { 94 | return [this.offsetX, this.offsetY, this.blur, this.color].join('px '); 95 | }, 96 | 97 | /* _TO_SVG_START_ */ 98 | /** 99 | * Returns SVG representation of a shadow 100 | * @param {fabric.Object} object 101 | * @return {String} SVG representation of a shadow 102 | */ 103 | toSVG: function(object) { 104 | var mode = 'SourceAlpha'; 105 | 106 | if (object && (object.fill === this.color || object.stroke === this.color)) { 107 | mode = 'SourceGraphic'; 108 | } 109 | 110 | return ( 111 | '' + 112 | '' + 115 | '' + 116 | '' + 117 | '' + 118 | '' + 119 | '' + 120 | ''); 121 | }, 122 | /* _TO_SVG_END_ */ 123 | 124 | /** 125 | * Returns object representation of a shadow 126 | * @return {Object} Object representation of a shadow instance 127 | */ 128 | toObject: function() { 129 | return { 130 | color: this.color, 131 | blur: this.blur, 132 | offsetX: this.offsetX, 133 | offsetY: this.offsetY 134 | }; 135 | } 136 | }); 137 | 138 | /** 139 | * Regex matching shadow offsetX, offsetY and blur (ex: "2px 2px 10px rgba(0,0,0,0.2)", "rgb(0,255,0) 2px 2px") 140 | * @static 141 | * @field 142 | * @memberOf fabric.Shadow 143 | */ 144 | fabric.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/; 145 | 146 | })(typeof exports !== 'undefined' ? exports : this); 147 | -------------------------------------------------------------------------------- /bower_components/fabric/src/shapes/text.cufon.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @private 3 | * @param {CanvasRenderingContext2D} ctx Context to render on 4 | */ 5 | fabric.util.object.extend(fabric.Text.prototype, { 6 | _renderViaCufon: function(ctx) { 7 | 8 | var o = Cufon.textOptions || (Cufon.textOptions = { }); 9 | 10 | // export options to be used by cufon.js 11 | o.left = this.left; 12 | o.top = this.top; 13 | o.context = ctx; 14 | o.color = this.fill; 15 | 16 | var el = this._initDummyElementForCufon(); 17 | 18 | // set "cursor" to top/left corner 19 | this.transform(ctx); 20 | 21 | // draw text 22 | Cufon.replaceElement(el, { 23 | engine: 'canvas', 24 | separate: 'none', 25 | fontFamily: this.fontFamily, 26 | fontWeight: this.fontWeight, 27 | textDecoration: this.textDecoration, 28 | textShadow: this.shadow && this.shadow.toString(), 29 | textAlign: this.textAlign, 30 | fontStyle: this.fontStyle, 31 | lineHeight: this.lineHeight, 32 | stroke: this.stroke, 33 | strokeWidth: this.strokeWidth, 34 | backgroundColor: this.backgroundColor, 35 | textBackgroundColor: this.textBackgroundColor 36 | }); 37 | 38 | // update width, height 39 | this.width = o.width; 40 | this.height = o.height; 41 | 42 | this._totalLineHeight = o.totalLineHeight; 43 | this._fontAscent = o.fontAscent; 44 | this._boundaries = o.boundaries; 45 | 46 | el = null; 47 | 48 | // need to set coords _after_ the width/height was retreived from Cufon 49 | this.setCoords(); 50 | }, 51 | 52 | /** 53 | * @private 54 | */ 55 | _initDummyElementForCufon: function() { 56 | var el = fabric.document.createElement('pre'), 57 | container = fabric.document.createElement('div'); 58 | 59 | // Cufon doesn't play nice with textDecoration=underline if element doesn't have a parent 60 | container.appendChild(el); 61 | 62 | if (typeof G_vmlCanvasManager === 'undefined') { 63 | el.innerHTML = this.text; 64 | } 65 | else { 66 | // IE 7 & 8 drop newlines and white space on text nodes 67 | // see: http://web.student.tuwien.ac.at/~e0226430/innerHtmlQuirk.html 68 | // see: http://www.w3schools.com/dom/dom_mozilla_vs_ie.asp 69 | el.innerText = this.text.replace(/\r?\n/gi, '\r'); 70 | } 71 | 72 | el.style.fontSize = this.fontSize + 'px'; 73 | el.style.letterSpacing = 'normal'; 74 | 75 | return el; 76 | } 77 | }); 78 | -------------------------------------------------------------------------------- /bower_components/fabric/src/shapes/triangle.class.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | "use strict"; 4 | 5 | var fabric = global.fabric || (global.fabric = { }); 6 | 7 | if (fabric.Triangle) { 8 | fabric.warn('fabric.Triangle is already defined'); 9 | return; 10 | } 11 | 12 | /** 13 | * Triangle class 14 | * @class fabric.Triangle 15 | * @extends fabric.Object 16 | * @return {fabric.Triangle} thisArg 17 | */ 18 | fabric.Triangle = fabric.util.createClass(fabric.Object, /** @lends fabric.Triangle.prototype */ { 19 | 20 | /** 21 | * Type of an object 22 | * @type String 23 | * @default 24 | */ 25 | type: 'triangle', 26 | 27 | /** 28 | * Constructor 29 | * @param {Object} [options] Options object 30 | * @return {Object} thisArg 31 | */ 32 | initialize: function(options) { 33 | options = options || { }; 34 | 35 | this.callSuper('initialize', options); 36 | 37 | this.set('width', options.width || 100) 38 | .set('height', options.height || 100); 39 | }, 40 | 41 | /** 42 | * @private 43 | * @param ctx {CanvasRenderingContext2D} Context to render on 44 | */ 45 | _render: function(ctx) { 46 | var widthBy2 = this.width / 2, 47 | heightBy2 = this.height / 2; 48 | 49 | ctx.beginPath(); 50 | ctx.moveTo(-widthBy2, heightBy2); 51 | ctx.lineTo(0, -heightBy2); 52 | ctx.lineTo(widthBy2, heightBy2); 53 | ctx.closePath(); 54 | 55 | this._renderFill(ctx); 56 | this._renderStroke(ctx); 57 | }, 58 | 59 | /** 60 | * @private 61 | * @param ctx {CanvasRenderingContext2D} Context to render on 62 | */ 63 | _renderDashedStroke: function(ctx) { 64 | var widthBy2 = this.width / 2, 65 | heightBy2 = this.height / 2; 66 | 67 | ctx.beginPath(); 68 | fabric.util.drawDashedLine(ctx, -widthBy2, heightBy2, 0, -heightBy2, this.strokeDashArray); 69 | fabric.util.drawDashedLine(ctx, 0, -heightBy2, widthBy2, heightBy2, this.strokeDashArray); 70 | fabric.util.drawDashedLine(ctx, widthBy2, heightBy2, -widthBy2, heightBy2, this.strokeDashArray); 71 | ctx.closePath(); 72 | }, 73 | 74 | /* _TO_SVG_START_ */ 75 | /** 76 | * Returns SVG representation of an instance 77 | * @return {String} svg representation of an instance 78 | */ 79 | toSVG: function() { 80 | var markup = this._createBaseSVGMarkup(), 81 | widthBy2 = this.width / 2, 82 | heightBy2 = this.height / 2; 83 | 84 | var points = [ 85 | -widthBy2 + " " + heightBy2, 86 | "0 " + -heightBy2, 87 | widthBy2 + " " + heightBy2 88 | ].join(","); 89 | 90 | markup.push( 91 | '' 96 | ); 97 | 98 | return markup.join(''); 99 | }, 100 | /* _TO_SVG_END_ */ 101 | 102 | /** 103 | * Returns complexity of an instance 104 | * @return {Number} complexity of this instance 105 | */ 106 | complexity: function() { 107 | return 1; 108 | } 109 | }); 110 | 111 | /** 112 | * Returns fabric.Triangle instance from an object representation 113 | * @static 114 | * @memberOf fabric.Triangle 115 | * @param object {Object} object to create an instance from 116 | * @return {Object} instance of Canvas.Triangle 117 | */ 118 | fabric.Triangle.fromObject = function(object) { 119 | return new fabric.Triangle(object); 120 | }; 121 | 122 | })(typeof exports !== 'undefined' ? exports : this); 123 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/animate.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | /** 4 | * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. 5 | * @memberOf fabric.util 6 | * @param {Object} [options] Animation options 7 | * @param {Function} [options.onChange] Callback; invoked on every value change 8 | * @param {Function} [options.onComplete] Callback; invoked when value change is completed 9 | * @param {Number} [options.startValue=0] Starting value 10 | * @param {Number} [options.endValue=100] Ending value 11 | * @param {Number} [options.byValue=100] Value to modify the property by 12 | * @param {Function} [options.easing] Easing function 13 | * @param {Number} [options.duration=500] Duration of change 14 | */ 15 | function animate(options) { 16 | 17 | options || (options = { }); 18 | 19 | var start = +new Date(), 20 | duration = options.duration || 500, 21 | finish = start + duration, time, 22 | onChange = options.onChange || function() { }, 23 | abort = options.abort || function() { return false; }, 24 | easing = options.easing || function(t, b, c, d) {return -c * Math.cos(t/d * (Math.PI/2)) + c + b;}, 25 | startValue = 'startValue' in options ? options.startValue : 0, 26 | endValue = 'endValue' in options ? options.endValue : 100, 27 | byValue = options.byValue || endValue - startValue; 28 | 29 | options.onStart && options.onStart(); 30 | 31 | (function tick() { 32 | time = +new Date(); 33 | var currentTime = time > finish ? duration : (time - start); 34 | if (abort()) { 35 | options.onComplete && options.onComplete(); 36 | return; 37 | } 38 | onChange(easing(currentTime, startValue, byValue, duration)); 39 | if (time > finish) { 40 | options.onComplete && options.onComplete(); 41 | return; 42 | } 43 | requestAnimFrame(tick); 44 | })(); 45 | } 46 | 47 | var _requestAnimFrame = fabric.window.requestAnimationFrame || 48 | fabric.window.webkitRequestAnimationFrame || 49 | fabric.window.mozRequestAnimationFrame || 50 | fabric.window.oRequestAnimationFrame || 51 | fabric.window.msRequestAnimationFrame || 52 | function(callback) { 53 | fabric.window.setTimeout(callback, 1000 / 60); 54 | }; 55 | /** 56 | * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 57 | * @memberOf fabric.util 58 | * @param {Function} callback Callback to invoke 59 | * @param {DOMElement} element optional Element to associate with animation 60 | */ 61 | var requestAnimFrame = function() { 62 | return _requestAnimFrame.apply(fabric.window, arguments); 63 | }; 64 | 65 | fabric.util.animate = animate; 66 | fabric.util.requestAnimFrame = requestAnimFrame; 67 | 68 | })(); 69 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/dom_request.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | function addParamToUrl(url, param) { 4 | return url + (/\?/.test(url) ? '&' : '?') + param; 5 | } 6 | 7 | var makeXHR = (function() { 8 | var factories = [ 9 | function() { return new ActiveXObject("Microsoft.XMLHTTP"); }, 10 | function() { return new ActiveXObject("Msxml2.XMLHTTP"); }, 11 | function() { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }, 12 | function() { return new XMLHttpRequest(); } 13 | ]; 14 | for (var i = factories.length; i--; ) { 15 | try { 16 | var req = factories[i](); 17 | if (req) { 18 | return factories[i]; 19 | } 20 | } 21 | catch (err) { } 22 | } 23 | })(); 24 | 25 | function emptyFn() { } 26 | 27 | /** 28 | * Cross-browser abstraction for sending XMLHttpRequest 29 | * @memberOf fabric.util 30 | * @param {String} url URL to send XMLHttpRequest to 31 | * @param {Object} [options] Options object 32 | * @param {String} [options.method="GET"] 33 | * @param {Function} options.onComplete Callback to invoke when request is completed 34 | * @return {XMLHttpRequest} request 35 | */ 36 | function request(url, options) { 37 | 38 | options || (options = { }); 39 | 40 | var method = options.method ? options.method.toUpperCase() : 'GET', 41 | onComplete = options.onComplete || function() { }, 42 | xhr = makeXHR(), 43 | body; 44 | 45 | /** @ignore */ 46 | xhr.onreadystatechange = function() { 47 | if (xhr.readyState === 4) { 48 | onComplete(xhr); 49 | xhr.onreadystatechange = emptyFn; 50 | } 51 | }; 52 | 53 | if (method === 'GET') { 54 | body = null; 55 | if (typeof options.parameters === 'string') { 56 | url = addParamToUrl(url, options.parameters); 57 | } 58 | } 59 | 60 | xhr.open(method, url, true); 61 | 62 | if (method === 'POST' || method === 'PUT') { 63 | xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 64 | } 65 | 66 | xhr.send(body); 67 | return xhr; 68 | } 69 | 70 | fabric.util.request = request; 71 | })(); 72 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/dom_style.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | /** 4 | * Cross-browser wrapper for setting element's style 5 | * @memberOf fabric.util 6 | * @param {HTMLElement} element 7 | * @param {Object} styles 8 | * @return {HTMLElement} Element that was passed as a first argument 9 | */ 10 | function setStyle(element, styles) { 11 | var elementStyle = element.style; 12 | if (!elementStyle) { 13 | return element; 14 | } 15 | if (typeof styles === 'string') { 16 | element.style.cssText += ';' + styles; 17 | return styles.indexOf('opacity') > -1 18 | ? setOpacity(element, styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) 19 | : element; 20 | } 21 | for (var property in styles) { 22 | if (property === 'opacity') { 23 | setOpacity(element, styles[property]); 24 | } 25 | else { 26 | var normalizedProperty = (property === 'float' || property === 'cssFloat') 27 | ? (typeof elementStyle.styleFloat === 'undefined' ? 'cssFloat' : 'styleFloat') 28 | : property; 29 | elementStyle[normalizedProperty] = styles[property]; 30 | } 31 | } 32 | return element; 33 | } 34 | 35 | var parseEl = fabric.document.createElement('div'), 36 | supportsOpacity = typeof parseEl.style.opacity === 'string', 37 | supportsFilters = typeof parseEl.style.filter === 'string', 38 | reOpacity = /alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/, 39 | 40 | /** @ignore */ 41 | setOpacity = function (element) { return element; }; 42 | 43 | if (supportsOpacity) { 44 | /** @ignore */ 45 | setOpacity = function(element, value) { 46 | element.style.opacity = value; 47 | return element; 48 | }; 49 | } 50 | else if (supportsFilters) { 51 | /** @ignore */ 52 | setOpacity = function(element, value) { 53 | var es = element.style; 54 | if (element.currentStyle && !element.currentStyle.hasLayout) { 55 | es.zoom = 1; 56 | } 57 | if (reOpacity.test(es.filter)) { 58 | value = value >= 0.9999 ? '' : ('alpha(opacity=' + (value * 100) + ')'); 59 | es.filter = es.filter.replace(reOpacity, value); 60 | } 61 | else { 62 | es.filter += ' alpha(opacity=' + (value * 100) + ')'; 63 | } 64 | return element; 65 | }; 66 | } 67 | 68 | fabric.util.setStyle = setStyle; 69 | 70 | })(); 71 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/lang_class.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var slice = Array.prototype.slice, emptyFunction = function() { }; 4 | 5 | var IS_DONTENUM_BUGGY = (function(){ 6 | for (var p in { toString: 1 }) { 7 | if (p === 'toString') return false; 8 | } 9 | return true; 10 | })(); 11 | 12 | /** @ignore */ 13 | var addMethods = function(klass, source, parent) { 14 | for (var property in source) { 15 | 16 | if (property in klass.prototype && 17 | typeof klass.prototype[property] === 'function' && 18 | (source[property] + '').indexOf('callSuper') > -1) { 19 | 20 | klass.prototype[property] = (function(property) { 21 | return function() { 22 | 23 | var superclass = this.constructor.superclass; 24 | this.constructor.superclass = parent; 25 | var returnValue = source[property].apply(this, arguments); 26 | this.constructor.superclass = superclass; 27 | 28 | if (property !== 'initialize') { 29 | return returnValue; 30 | } 31 | }; 32 | })(property); 33 | } 34 | else { 35 | klass.prototype[property] = source[property]; 36 | } 37 | 38 | if (IS_DONTENUM_BUGGY) { 39 | if (source.toString !== Object.prototype.toString) { 40 | klass.prototype.toString = source.toString; 41 | } 42 | if (source.valueOf !== Object.prototype.valueOf) { 43 | klass.prototype.valueOf = source.valueOf; 44 | } 45 | } 46 | } 47 | }; 48 | 49 | function Subclass() { } 50 | 51 | function callSuper(methodName) { 52 | var fn = this.constructor.superclass.prototype[methodName]; 53 | return (arguments.length > 1) 54 | ? fn.apply(this, slice.call(arguments, 1)) 55 | : fn.call(this); 56 | } 57 | 58 | /** 59 | * Helper for creation of "classes". 60 | * @memberOf fabric.util 61 | * @param parent optional "Class" to inherit from 62 | * @param properties Properties shared by all instances of this class 63 | * (be careful modifying objects defined here as this would affect all instances) 64 | */ 65 | function createClass() { 66 | var parent = null, 67 | properties = slice.call(arguments, 0); 68 | 69 | if (typeof properties[0] === 'function') { 70 | parent = properties.shift(); 71 | } 72 | function klass() { 73 | this.initialize.apply(this, arguments); 74 | } 75 | 76 | klass.superclass = parent; 77 | klass.subclasses = [ ]; 78 | 79 | if (parent) { 80 | Subclass.prototype = parent.prototype; 81 | klass.prototype = new Subclass(); 82 | parent.subclasses.push(klass); 83 | } 84 | for (var i = 0, length = properties.length; i < length; i++) { 85 | addMethods(klass, properties[i], parent); 86 | } 87 | if (!klass.prototype.initialize) { 88 | klass.prototype.initialize = emptyFunction; 89 | } 90 | klass.prototype.constructor = klass; 91 | klass.prototype.callSuper = callSuper; 92 | return klass; 93 | } 94 | 95 | fabric.util.createClass = createClass; 96 | })(); 97 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/lang_function.js: -------------------------------------------------------------------------------- 1 | /* _ES5_COMPAT_START_ */ 2 | (function() { 3 | 4 | var slice = Array.prototype.slice, 5 | apply = Function.prototype.apply, 6 | Dummy = function() { }; 7 | 8 | if (!Function.prototype.bind) { 9 | /** 10 | * Cross-browser approximation of ES5 Function.prototype.bind (not fully spec conforming) 11 | * @see Function#bind on MDN 12 | * @param {Object} thisArg Object to bind function to 13 | * @param {Any[]} [...] Values to pass to a bound function 14 | * @return {Function} 15 | */ 16 | Function.prototype.bind = function(thisArg) { 17 | var fn = this, args = slice.call(arguments, 1), bound; 18 | if (args.length) { 19 | bound = function() { 20 | return apply.call(fn, this instanceof Dummy ? this : thisArg, args.concat(slice.call(arguments))); 21 | }; 22 | } 23 | else { 24 | /** @ignore */ 25 | bound = function() { 26 | return apply.call(fn, this instanceof Dummy ? this : thisArg, arguments); 27 | }; 28 | } 29 | Dummy.prototype = this.prototype; 30 | bound.prototype = new Dummy(); 31 | 32 | return bound; 33 | }; 34 | } 35 | 36 | })(); 37 | /* _ES5_COMPAT_END_ */ 38 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/lang_object.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | /** 4 | * Copies all enumerable properties of one object to another 5 | * @memberOf fabric.util.object 6 | * @param {Object} destination Where to copy to 7 | * @param {Object} source Where to copy from 8 | * @return {Object} 9 | */ 10 | function extend(destination, source) { 11 | // JScript DontEnum bug is not taken care of 12 | for (var property in source) { 13 | destination[property] = source[property]; 14 | } 15 | return destination; 16 | } 17 | 18 | /** 19 | * Creates an empty object and copies all enumerable properties of another object to it 20 | * @memberOf fabric.util.object 21 | * @param {Object} object Object to clone 22 | * @return {Object} 23 | */ 24 | function clone(object) { 25 | return extend({ }, object); 26 | } 27 | 28 | /** @namespace fabric.util.object */ 29 | fabric.util.object = { 30 | extend: extend, 31 | clone: clone 32 | }; 33 | 34 | })(); 35 | -------------------------------------------------------------------------------- /bower_components/fabric/src/util/lang_string.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | /* _ES5_COMPAT_START_ */ 4 | if (!String.prototype.trim) { 5 | /** 6 | * Trims a string (removing whitespace from the beginning and the end) 7 | * @function external:String#trim 8 | * @see String#trim on MDN 9 | */ 10 | String.prototype.trim = function () { 11 | // this trim is not fully ES3 or ES5 compliant, but it should cover most cases for now 12 | return this.replace(/^[\s\xA0]+/, '').replace(/[\s\xA0]+$/, ''); 13 | }; 14 | } 15 | /* _ES5_COMPAT_END_ */ 16 | 17 | /** 18 | * Camelizes a string 19 | * @memberOf fabric.util.string 20 | * @param {String} string String to camelize 21 | * @return {String} Camelized version of a string 22 | */ 23 | function camelize(string) { 24 | return string.replace(/-+(.)?/g, function(match, character) { 25 | return character ? character.toUpperCase() : ''; 26 | }); 27 | } 28 | 29 | /** 30 | * Capitalizes a string 31 | * @memberOf fabric.util.string 32 | * @param {String} string String to capitalize 33 | * @return {String} Capitalized version of a string 34 | */ 35 | function capitalize(string) { 36 | return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); 37 | } 38 | 39 | /** 40 | * Escapes XML in a string 41 | * @memberOf fabric.util.string 42 | * @param {String} string String to escape 43 | * @return {String} Escaped version of a string 44 | */ 45 | function escapeXml(string) { 46 | return string.replace(/&/g, '&') 47 | .replace(/"/g, '"') 48 | .replace(/'/g, ''') 49 | .replace(//g, '>'); 51 | } 52 | 53 | /** 54 | * String utilities 55 | * @namespace fabric.util.string 56 | */ 57 | fabric.util.string = { 58 | camelize: camelize, 59 | capitalize: capitalize, 60 | escapeXml: escapeXml 61 | }; 62 | }()); 63 | -------------------------------------------------------------------------------- /bower_components/fabric/test.js: -------------------------------------------------------------------------------- 1 | var testrunner = require('qunit'); 2 | 3 | testrunner.options.log.summary = true; 4 | testrunner.options.log.tests = false; 5 | testrunner.options.log.assertions = false; 6 | 7 | testrunner.run({ 8 | deps: "./test/fixtures/test_script.js", 9 | code: "./dist/all.js", 10 | tests: [ 11 | './test/unit/rect.js', 12 | './test/unit/ellipse.js', 13 | './test/unit/color.js', 14 | './test/unit/circle.js', 15 | './test/unit/line.js', 16 | './test/unit/polyline.js', 17 | './test/unit/polygon.js', 18 | './test/unit/path.js', 19 | './test/unit/path_group.js', 20 | './test/unit/observable.js', 21 | './test/unit/object.js', 22 | './test/unit/text.js', 23 | './test/unit/util.js', 24 | './test/unit/image.js', 25 | './test/unit/image_filters.js', 26 | './test/unit/group.js', 27 | './test/unit/parser.js', 28 | './test/unit/canvas.js', 29 | './test/unit/canvas_static.js', 30 | './test/unit/gradient.js', 31 | './test/unit/pattern.js', 32 | './test/unit/shadow.js' 33 | ] 34 | }, function(err, report) { 35 | if (err) { 36 | console.log(err); 37 | process.exit(1); 38 | } 39 | if(report.failed > 0){ 40 | process.on('exit', function() { 41 | process.exit(1); 42 | }); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/greyfloral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/test/fixtures/greyfloral.png -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/path.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | ]> 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/svg_with_rect.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]> 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/test_image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/test/fixtures/test_image.gif -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/test_script.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | // set global variable 3 | this.foo = 'bar'; 4 | this.window = undefined; 5 | this.document = undefined; 6 | 7 | })(); -------------------------------------------------------------------------------- /bower_components/fabric/test/fixtures/very_large_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/bower_components/fabric/test/fixtures/very_large_image.jpg -------------------------------------------------------------------------------- /bower_components/fabric/test/lib/canvas_assertions.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | /** 3 | * @private 4 | * @param {CanvasRenderingContext2D} ctx context to test 5 | * @param {Function} fn Callback, invoked with `currentValue`, `previousValue` and `index`. 6 | * Breaks out of the loop if callback returns `false`. 7 | */ 8 | function iterateData(ctx, fn) { 9 | var data = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height).data; 10 | for (var i = data.length; i--; ) { 11 | if (i > 4) { 12 | if (fn(data[i], data[i - 4], i) === false) break; 13 | } 14 | } 15 | } 16 | 17 | /** 18 | * @param {CanvasRenderingContext2D} ctx context to test 19 | * @param {String} color color in a hex value 20 | * @return {Boolean | null} `true` if all canvas pixels are of a given color, `null` if wrong color is given 21 | * @example `assertColor(canvas._oContextContainer, 'ff5555');` 22 | */ 23 | function assertColor(ctx, color) { 24 | var match, r, g, b; 25 | if (match = String(color).match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i)) { 26 | r = parseInt(match[1], 16); 27 | g = parseInt(match[2], 16); 28 | b = parseInt(match[3], 16); 29 | } 30 | else return null; 31 | var result = true; 32 | iterateData(ctx, function(currentValue, prevValue, i) { 33 | if ((!(i % 4) && (currentValue !== r)) || 34 | (!((i-1) % 4) && (currentValue !== g)) || 35 | (!((i-2) % 4) && (currentValue !== b))) { 36 | return (result = false); 37 | } 38 | }); 39 | return result; 40 | } 41 | 42 | /** 43 | * @param {CanvasRenderingContext2D} ctx context to test 44 | * @return {Boolean} `true` if all canvas pixels are of the same color 45 | * @example `assertSameColor(canvas._oContextContainer);` 46 | */ 47 | function assertSameColor(ctx) { 48 | debugger; 49 | var result = true; 50 | iterateData(ctx, function(currentValue, prevValue, i) { 51 | if (currentValue !== prevValue) { 52 | return (result = false); 53 | } 54 | }); 55 | return result; 56 | } 57 | 58 | // export as global 59 | this.assertColor = assertColor; 60 | this.assertSameColor = assertSameColor; 61 | })(); 62 | -------------------------------------------------------------------------------- /bower_components/fabric/test/lib/event.simulate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * simulateEvent(@element, eventName[, options]) -> Element 3 | * 4 | * - @element: element to fire event on 5 | * - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported) 6 | * - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc. 7 | * 8 | **/ 9 | (function(global) { 10 | function extendObject(destination, source) { 11 | for (var prop in source) { 12 | destination[prop] = source[prop]; 13 | } 14 | return destination; 15 | } 16 | var eventMatchers = { 17 | 'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, 18 | 'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/, 19 | 'KeyboardEvent': /^(?:key(?:up|down|press))$/ 20 | }; 21 | var defaultOptions = { 22 | pointerX: 0, 23 | pointerY: 0, 24 | button: 0, 25 | ctrlKey: false, 26 | altKey: false, 27 | shiftKey: false, 28 | metaKey: false, 29 | bubbles: true, 30 | cancelable: true 31 | }; 32 | 33 | global.simulateEvent = function(element, eventName) { 34 | 35 | var options = extendObject(extendObject({ }, defaultOptions), arguments[2] || { }), 36 | oEvent, 37 | eventType; 38 | 39 | element = typeof element == 'string' ? document.getElementById(element) : element; 40 | 41 | for (var name in eventMatchers) { 42 | if (eventMatchers[name].test(eventName)) { 43 | eventType = name; 44 | break; 45 | } 46 | } 47 | 48 | if (!eventType) { 49 | throw new SyntaxError('This event is not supported'); 50 | } 51 | 52 | if (document.createEvent) { 53 | try { 54 | // Opera doesn't support event types like "KeyboardEvent", 55 | // but allows to create event of type "HTMLEvents", then fire key event on it 56 | oEvent = document.createEvent(eventType); 57 | } 58 | catch(err) { 59 | oEvent = document.createEvent('HTMLEvents'); 60 | } 61 | 62 | if (eventType == 'HTMLEvents') { 63 | oEvent.initEvent(eventName, options.bubbles, options.cancelable); 64 | } 65 | else if (eventType === 'KeyboardEvent') { 66 | // TODO (kangax): this needs to be tested 67 | if (oEvent.initKeyEvent) { 68 | oEvent.initKeyEvent(eventName, options.bubbles, options.cancelable, document.defaultView, 69 | options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, 70 | options.charCode); 71 | } 72 | else if (oEvent.initEvent) { 73 | oEvent.initEvent(eventName, options.bubbles, options.cancelable); 74 | } 75 | } 76 | else { 77 | oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView, 78 | options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY, 79 | options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element); 80 | } 81 | element.dispatchEvent(oEvent); 82 | } 83 | else { 84 | options.clientX = options.pointerX; 85 | options.clientY = options.pointerY; 86 | oEvent = extendObject(document.createEventObject(), options); 87 | element.fireEvent('on' + eventName, oEvent); 88 | } 89 | return element; 90 | } 91 | })(this); -------------------------------------------------------------------------------- /bower_components/fabric/test/unit/observable.js: -------------------------------------------------------------------------------- 1 | QUnit.module('fabric.Observable'); 2 | 3 | test('fabric.Observable exists', function() { 4 | ok(fabric.Observable); 5 | ok(fabric.Observable.fire); 6 | ok(fabric.Observable.observe); 7 | ok(fabric.Observable.stopObserving); 8 | }); 9 | 10 | test('fire + observe', function() { 11 | var foo = { }; 12 | fabric.util.object.extend(foo, fabric.Observable); 13 | 14 | var eventFired = false; 15 | foo.on('bar:baz', function() { 16 | eventFired = true; 17 | }); 18 | 19 | foo.fire('bar:baz'); 20 | equal(eventFired, true); 21 | }); 22 | 23 | test('stopObserving', function() { 24 | var foo = { }; 25 | fabric.util.object.extend(foo, fabric.Observable); 26 | 27 | var eventFired = false; 28 | var handler = function() { 29 | eventFired = true; 30 | }; 31 | foo.on('bar:baz', handler); 32 | foo.stopObserving('bar:baz', handler); 33 | 34 | foo.fire('bar:baz'); 35 | equal(eventFired, false); 36 | }); 37 | 38 | test('stopObserving without handler', function() { 39 | var foo = { }; 40 | fabric.util.object.extend(foo, fabric.Observable); 41 | 42 | var eventFired = false, event2Fired = false; 43 | 44 | var handler = function() { 45 | eventFired = true; 46 | }; 47 | var handler2 = function() { 48 | event2Fired = true; 49 | }; 50 | foo.on('bar:baz', handler); 51 | foo.on('bar:baz', handler2); 52 | 53 | foo.stopObserving('bar:baz'); 54 | 55 | foo.fire('bar:baz'); 56 | equal(eventFired, false); 57 | equal(event2Fired, false); 58 | 59 | foo.on('bar:baz', handler); 60 | foo.on('bar:baz', handler2); 61 | 62 | foo.stopObserving({'bar:baz': null}); 63 | 64 | foo.fire('bar:baz'); 65 | equal(eventFired, false); 66 | equal(event2Fired, false); 67 | }); 68 | 69 | test('stopObserving multiple handlers', function() { 70 | var foo = { }; 71 | fabric.util.object.extend(foo, fabric.Observable); 72 | 73 | var eventFired = false, event2Fired = false; 74 | 75 | var handler = function() { 76 | eventFired = true; 77 | }; 78 | var handler2 = function() { 79 | event2Fired = true; 80 | }; 81 | foo.on({'bar:baz': handler, 'blah:blah': handler2}); 82 | 83 | foo.stopObserving({'bar:baz': handler, 'blah:blah': handler2}); 84 | 85 | foo.fire('bar:baz'); 86 | equal(eventFired, false); 87 | foo.fire('blah:blah'); 88 | equal(event2Fired, false); 89 | }); 90 | 91 | test('observe multiple handlers', function() { 92 | var foo = { }; 93 | fabric.util.object.extend(foo, fabric.Observable); 94 | 95 | var barBazFired = false; 96 | var blahBlahFired = false; 97 | var mooFired = false; 98 | 99 | foo.on({ 100 | 'bar:baz': function() { 101 | barBazFired = true; 102 | }, 103 | 'blah:blah': function() { 104 | blahBlahFired = true; 105 | }, 106 | 'moo': function() { 107 | mooFired = true; 108 | } 109 | }); 110 | 111 | foo.fire('bar:baz'); 112 | foo.fire('blah:blah'); 113 | foo.fire('moo'); 114 | 115 | equal(barBazFired, true); 116 | equal(blahBlahFired, true); 117 | equal(mooFired, true); 118 | }); 119 | 120 | test('event options', function() { 121 | var foo = { }; 122 | fabric.util.object.extend(foo, fabric.Observable); 123 | 124 | var someValue; 125 | foo.on('foo:bar', function(e) { 126 | someValue = e.value; 127 | }); 128 | 129 | foo.fire('foo:bar', { value: 'sekret' }); 130 | 131 | equal(someValue, 'sekret'); 132 | }); 133 | 134 | test('trigger', function() { 135 | var foo = { }; 136 | fabric.util.object.extend(foo, fabric.Observable); 137 | 138 | var eventFired = false; 139 | var context; 140 | foo.on('bar:baz', function() { 141 | context = this; 142 | eventFired = true; 143 | }); 144 | 145 | foo.trigger('bar:baz'); 146 | equal(eventFired, true); 147 | equal(context, foo); 148 | }); 149 | 150 | test('chaining', function() { 151 | var foo = { }; 152 | fabric.util.object.extend(foo, fabric.Observable); 153 | 154 | var event1Fired = false, event2Fired = false; 155 | foo 156 | .on('event1', function() { 157 | event1Fired = true; 158 | }) 159 | .on('event2', function() { 160 | event2Fired = true; 161 | }); 162 | 163 | foo.trigger('event2').trigger('event1'); 164 | 165 | equal(event1Fired, true); 166 | equal(event2Fired, true); 167 | 168 | event1Fired = false; 169 | event2Fired = false; 170 | 171 | foo.off('event1').off('event2'); 172 | foo.trigger('event2').trigger('event1'); 173 | 174 | equal(event1Fired, false); 175 | equal(event2Fired, false); 176 | }); 177 | -------------------------------------------------------------------------------- /bower_components/fabric/test/unit/pattern.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var IMG_SRC = fabric.isLikelyNode ? (__dirname + '/../fixtures/greyfloral.png') : '../fixtures/greyfloral.png'; 3 | 4 | function createImageElement() { 5 | return fabric.isLikelyNode ? new (require('canvas').Image) : fabric.document.createElement('img'); 6 | } 7 | function setSrc(img, src, callback) { 8 | if (fabric.isLikelyNode) { 9 | require('fs').readFile(src, function(err, imgData) { 10 | if (err) throw err; 11 | img.src = imgData; 12 | img._src = src; 13 | callback && callback(); 14 | }); 15 | } 16 | else { 17 | img.src = src; 18 | callback && callback(); 19 | } 20 | } 21 | 22 | QUnit.module('fabric.Pattern'); 23 | 24 | var img = createImageElement(); 25 | setSrc(img, IMG_SRC); 26 | 27 | function createPattern() { 28 | return new fabric.Pattern({ 29 | source: img 30 | }); 31 | } 32 | 33 | test('constructor', function() { 34 | ok(fabric.Pattern); 35 | 36 | var pattern = createPattern(); 37 | ok(pattern instanceof fabric.Pattern, 'should inherit from fabric.Pattern'); 38 | }); 39 | 40 | test('properties', function() { 41 | var pattern = createPattern(); 42 | 43 | equal(pattern.source, img); 44 | equal(pattern.repeat, 'repeat'); 45 | equal(pattern.offsetX, 0); 46 | equal(pattern.offsetY, 0); 47 | }); 48 | 49 | test('toObject', function() { 50 | var pattern = createPattern(); 51 | 52 | ok(typeof pattern.toObject == 'function'); 53 | 54 | var object = pattern.toObject(); 55 | 56 | // node-canvas doesn't give "src" 57 | if (img.src) { 58 | equal(object.source, '../fixtures/greyfloral.png'); 59 | } 60 | equal(object.repeat, 'repeat'); 61 | equal(object.offsetX, 0); 62 | equal(object.offsetY, 0); 63 | 64 | var sourceExecuted; 65 | var patternWithGetSource = new fabric.Pattern({ 66 | source: function() {return fabric.document.createElement("canvas")} 67 | }); 68 | 69 | var object2 = patternWithGetSource.toObject(); 70 | equal(object2.source, 'function () {return fabric.document.createElement("canvas")}'); 71 | equal(object2.repeat, 'repeat'); 72 | }); 73 | 74 | test('toLive', function() { 75 | var pattern = createPattern(); 76 | 77 | ok(typeof pattern.toLive == 'function'); 78 | }); 79 | 80 | test('pattern serialization / deserialization (function)', function() { 81 | var pattern = new fabric.Pattern({ 82 | source: function() { 83 | patternSourceCanvas.setDimensions({ 84 | width: img.getWidth() + padding, 85 | height: img.getHeight() + padding 86 | }); 87 | return patternSourceCanvas.getElement(); 88 | }, 89 | repeat: 'repeat' 90 | }); 91 | 92 | var obj = pattern.toObject(); 93 | var patternDeserialized = new fabric.Pattern(obj); 94 | 95 | equal(typeof patternDeserialized.source, 'function'); 96 | equal(patternDeserialized.repeat, 'repeat'); 97 | }); 98 | 99 | test('pattern serialization / deserialization (image source)', function() { 100 | var pattern = createPattern(); 101 | var obj = pattern.toObject(); 102 | 103 | // node-canvas doesn't give "src" 104 | if (obj.src) { 105 | var patternDeserialized = new fabric.Pattern(obj); 106 | equal(typeof patternDeserialized.source, 'object'); 107 | equal(patternDeserialized.repeat, 'repeat'); 108 | } 109 | else { 110 | ok(true); 111 | } 112 | }); 113 | 114 | test('toSVG', function() { 115 | var pattern = createPattern(); 116 | 117 | ok(typeof pattern.toSVG == 'function'); 118 | 119 | // TODO: test toSVG 120 | }); 121 | 122 | })(); 123 | -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "1.8.3", 4 | "description": "jQuery component", 5 | "keywords": [ 6 | "jquery", 7 | "component" 8 | ], 9 | "scripts": [ 10 | "jquery.js" 11 | ], 12 | "license": "MIT", 13 | "homepage": "https://github.com/components/jquery", 14 | "_release": "1.8.3", 15 | "_resolution": { 16 | "type": "version", 17 | "tag": "1.8.3", 18 | "commit": "a94bf4baa9955613937d4f4c083c9d95ad0564fb" 19 | }, 20 | "_source": "git://github.com/components/jquery.git", 21 | "_target": "~1.8.0", 22 | "_originalSource": "jquery" 23 | } -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | vendor 3 | components 4 | -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/README.md: -------------------------------------------------------------------------------- 1 | jQuery Component 2 | ================ 3 | 4 | Shim repository for jQuery. 5 | -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "1.8.3", 4 | "description": "jQuery component", 5 | "keywords": [ 6 | "jquery", 7 | "component" 8 | ], 9 | "scripts": [ 10 | "jquery.js" 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "components/jquery", 3 | "description": "jQuery JavaScript Library", 4 | "type": "component", 5 | "homepage": "http://jquery.com", 6 | "license": "MIT", 7 | "support": { 8 | "irc": "irc://irc.freenode.org/jquery", 9 | "issues": "http://bugs.jquery.com", 10 | "forum": "http://forum.jquery.com", 11 | "wiki": "http://docs.jquery.com/", 12 | "source": "https://github.com/jquery/jquery" 13 | }, 14 | "authors": [ 15 | { 16 | "name": "John Resig", 17 | "email": "jeresig@gmail.com" 18 | } 19 | ], 20 | "require": { 21 | "robloach/component-installer": "*" 22 | }, 23 | "extra": { 24 | "component": { 25 | "scripts": [ 26 | "jquery.js" 27 | ] 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/editor/bower_components/jquery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "components-jquery", 3 | "version": "1.8.3", 4 | "description": "jQuery component", 5 | "keywords": ["jquery"], 6 | "main": "./jquery.js" 7 | } 8 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-apollo.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, 2 | null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-basic.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^"(?:[^\n\r"\\]|\\.)*(?:"|$)/,a,'"'],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^REM[^\n\r]*/,a],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,a],["pln",/^[a-z][^\W_]?(?:\$|%)?/i,a],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i,a,"0123456789"],["pun", 3 | /^.[^\s\w"$%.]*/,a]]),["basic","cbm"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-clj.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | var a=null; 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a], 18 | ["typ",/^:[\dA-Za-z-]+/]]),["clj"]); 19 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n\u000c"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]+)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//], 2 | ["com",/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-dart.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!.*/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/.*/],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i], 2 | ["typ",/^\b(?:bool|double|dynamic|int|num|object|string|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?'''[\S\s]*?[^\\]'''/],["str",/^r?"""[\S\s]*?[^\\]"""/],["str",/^r?'('|[^\n\f\r]*?[^\\]')/],["str",/^r?"("|[^\n\f\r]*?[^\\]")/],["pln",/^[$_a-z]\w*/i],["pun",/^[!%&*+/:<-?^|~-]/],["lit",/^\b0x[\da-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",/^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(),.;[\]{}]/]]), 3 | ["dart"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-erlang.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["lit",/^[a-z]\w*/],["lit",/^'(?:[^\n\f\r'\\]|\\[^&])+'?/,null,"'"],["lit",/^\?[^\t\n ({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/], 2 | ["kwd",/^-[_a-z]+/],["typ",/^[A-Z_]\w*/],["pun",/^[,.;]/]]),["erlang","erl"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-go.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]); 2 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-hs.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/, 2 | null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-lisp.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a], 3 | ["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","lsp","scm","ss","rkt"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-llvm.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^!?"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["com",/^;[^\n\r]*/,null,";"]],[["pln",/^[!%@](?:[$\-.A-Z_a-z][\w$\-.]*|\d+)/],["kwd",/^[^\W\d]\w*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[Xx][\dA-Fa-f]+)/],["pun",/^[(-*,:<->[\]{}]|\.\.\.$/]]),["llvm","ll"]); 2 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-lua.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i], 2 | ["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-ml.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/], 2 | ["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-mumps.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"]|\\.)*"/,null,'"']],[["com",/^;[^\n\r]*/,null,";"],["dec",/^\$(?:d|device|ec|ecode|es|estack|et|etrap|h|horolog|i|io|j|job|k|key|p|principal|q|quit|st|stack|s|storage|sy|system|t|test|tl|tlevel|tr|trestart|x|y|z[a-z]*|a|ascii|c|char|d|data|e|extract|f|find|fn|fnumber|g|get|j|justify|l|length|na|name|o|order|p|piece|ql|qlength|qs|qsubscript|q|query|r|random|re|reverse|s|select|st|stack|t|text|tr|translate|nan)\b/i, 2 | null],["kwd",/^(?:[^$]b|break|c|close|d|do|e|else|f|for|g|goto|h|halt|h|hang|i|if|j|job|k|kill|l|lock|m|merge|n|new|o|open|q|quit|r|read|s|set|tc|tcommit|tre|trestart|tro|trollback|ts|tstart|u|use|v|view|w|write|x|xecute)\b/i,null],["lit",/^[+-]?(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?/i],["pln",/^[a-z][^\W_]*/i],["pun",/^[^\w\t\n\r"$%;^\xa0]|_/]]),["mumps"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-n.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/, 3 | a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/, 4 | a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]); 5 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-pascal.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^'(?:[^\n\r'\\]|\\.)*(?:'|$)/,a,"'"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^\(\*[\S\s]*?(?:\*\)|$)|^{[\S\s]*?(?:}|$)/,a],["kwd",/^(?:absolute|and|array|asm|assembler|begin|case|const|constructor|destructor|div|do|downto|else|end|external|for|forward|function|goto|if|implementation|in|inline|interface|interrupt|label|mod|not|object|of|or|packed|procedure|program|record|repeat|set|shl|shr|then|to|type|unit|until|uses|var|virtual|while|with|xor)\b/i,a], 3 | ["lit",/^(?:true|false|self|nil)/i,a],["pln",/^[a-z][^\W_]*/i,a],["lit",/^(?:\$[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/i,a,"0123456789"],["pun",/^.[^\s\w$'./@]*/,a]]),["pascal"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-proto.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]); 2 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-r.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^'\\]|\\[\S\s])*(?:'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])/],["lit",/^0[Xx][\dA-Fa-f]+([Pp]\d+)?[Li]?/],["lit",/^[+-]?(\d+(\.\d+)?|\.\d+)([Ee][+-]?\d+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|\d+))(?![\w.])/], 2 | ["pun",/^(?:<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|[!*+/^]|%.*?%|[$=@~]|:{1,3}|[(),;?[\]{}])/],["pln",/^(?:[A-Za-z]+[\w.]*|\.[^\W\d][\w.]*)(?![\w.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-rd.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["lit",/^\\(?:cr|l?dots|R|tab)\b/],["kwd",/^\\[@-Za-z]+/],["kwd",/^#(?:ifn?def|endif)/],["pln",/^\\[{}]/],["pun",/^[()[\]{}]+/]]),["Rd","rd"]); 2 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-scala.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:""(?:""?(?!")|[^"\\]|\\.)*"{0,3}|(?:[^\n\r"\\]|\\.)*"?)/,null,'"'],["lit",/^`(?:[^\n\r\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&(--:-@[-^{-~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\n\r'\\]|\\(?:'|[^\n\r']+))'/],["lit",/^'[$A-Z_a-z][\w$]*(?![\w$'])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/], 2 | ["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:0(?:[0-7]+|x[\da-f]+)l?|(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:e[+-]?\d+)?f?|l?)|\\.\d+(?:e[+-]?\d+)?f?)/i],["typ",/^[$_]*[A-Z][\d$A-Z_]*[a-z][\w$]*/],["pln",/^[$A-Z_a-z][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-sql.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\n\r]*|\/\*[\S\s]*?(?:\*\/|$))/],["kwd",/^(?:add|all|alter|and|any|apply|as|asc|authorization|backup|begin|between|break|browse|bulk|by|cascade|case|check|checkpoint|close|clustered|coalesce|collate|column|commit|compute|connect|constraint|contains|containstable|continue|convert|create|cross|current|current_date|current_time|current_timestamp|current_user|cursor|database|dbcc|deallocate|declare|default|delete|deny|desc|disk|distinct|distributed|double|drop|dummy|dump|else|end|errlvl|escape|except|exec|execute|exists|exit|fetch|file|fillfactor|following|for|foreign|freetext|freetexttable|from|full|function|goto|grant|group|having|holdlock|identity|identitycol|identity_insert|if|in|index|inner|insert|intersect|into|is|join|key|kill|left|like|lineno|load|match|matched|merge|natural|national|nocheck|nonclustered|nocycle|not|null|nullif|of|off|offsets|on|open|opendatasource|openquery|openrowset|openxml|option|or|order|outer|over|partition|percent|pivot|plan|preceding|precision|primary|print|proc|procedure|public|raiserror|read|readtext|reconfigure|references|replication|restore|restrict|return|revoke|right|rollback|rowcount|rowguidcol|rows?|rule|save|schema|select|session_user|set|setuser|shutdown|some|start|statistics|system_user|table|textsize|then|to|top|tran|transaction|trigger|truncate|tsequal|unbounded|union|unique|unpivot|update|updatetext|use|user|using|values|varying|view|waitfor|when|where|while|with|within|writetext|xml)(?=[^\w-]|$)/i, 2 | null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^[_a-z][\w-]*/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'+\xa0-]*/]]),["sql"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-tcl.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^{+/,a,"{"],["clo",/^}+/,a,"}"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/,a],["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit", 3 | /^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["tcl"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-tex.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["kwd",/^\\[@-Za-z]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[()=[\]{}]+/]]),["latex","tex"]); 2 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-vb.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})(?:["\u201c\u201d]c|$)|["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})*(?:["\u201c\u201d]|$))/i,null,'"\u201c\u201d'],["com",/^['\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\n\r_\u2028\u2029])*/,null,"'\u2018\u2019"]],[["kwd",/^(?:addhandler|addressof|alias|and|andalso|ansi|as|assembly|auto|boolean|byref|byte|byval|call|case|catch|cbool|cbyte|cchar|cdate|cdbl|cdec|char|cint|class|clng|cobj|const|cshort|csng|cstr|ctype|date|decimal|declare|default|delegate|dim|directcast|do|double|each|else|elseif|end|endif|enum|erase|error|event|exit|finally|for|friend|function|get|gettype|gosub|goto|handles|if|implements|imports|in|inherits|integer|interface|is|let|lib|like|long|loop|me|mod|module|mustinherit|mustoverride|mybase|myclass|namespace|new|next|not|notinheritable|notoverridable|object|on|option|optional|or|orelse|overloads|overridable|overrides|paramarray|preserve|private|property|protected|public|raiseevent|readonly|redim|removehandler|resume|return|select|set|shadows|shared|short|single|static|step|stop|string|structure|sub|synclock|then|throw|to|try|typeof|unicode|until|variant|wend|when|while|with|withevents|writeonly|xor|endif|gosub|let|variant|wend)\b/i, 2 | null],["com",/^rem\b.*/i],["lit",/^(?:true\b|false\b|nothing\b|\d+(?:e[+-]?\d+[dfr]?|[dfilrs])?|(?:&h[\da-f]+|&o[0-7]+)[ils]?|\d*\.\d+(?:e[+-]?\d+)?[dfr]?|#\s+(?:\d+[/-]\d+[/-]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:am|pm))?)?|\d+:\d+(?::\d+)?(\s*(?:am|pm))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*(?:\[[!#%&@]+])?|\[(?:[a-z]|_\w)\w*])/i],["pun",/^[^\w\t\n\r "'[\]\xa0\u2018\u2019\u201c\u201d\u2028\u2029]+/],["pun",/^(?:\[|])/]]),["vb","vbs"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-vhdl.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[box]?"(?:[^"]|"")*"|'.')/i],["com",/^--[^\n\r]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, 2 | null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^'(?:active|ascending|base|delayed|driving|driving_value|event|high|image|instance_name|last_active|last_event|last_value|left|leftof|length|low|path_name|pos|pred|quiet|range|reverse_range|right|rightof|simple_name|stable|succ|transaction|val|value)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w.\\]+#(?:[+-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:e[+-]?\d+(?:_\d+)*)?)/i], 3 | ["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'\xa0-]*/]]),["vhdl","vhd"]); 4 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-wiki.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\d\t a-gi-z\xa0]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[*=[\]^~]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^[A-Z][a-z][\da-z]+[A-Z][a-z][^\W_]+\b/],["lang-",/^{{{([\S\s]+?)}}}/],["lang-",/^`([^\n\r`]+)`/],["str",/^https?:\/\/[^\s#/?]*(?:\/[^\s#?]*)?(?:\?[^\s#]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\S\s])[^\n\r#*=A-[^`h{~]*/]]),["wiki"]); 2 | PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/lang-yaml.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]); 3 | -------------------------------------------------------------------------------- /examples/editor/external/google-code-prettify/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} -------------------------------------------------------------------------------- /examples/editor/index.css: -------------------------------------------------------------------------------- 1 | 2 | /* this CSS is not part of the widget, it is here just as an example of the demo page styling.... Don't copy this one, roll your own. One 3 | * of the key things about the widget is that it allows you to do your own styling! 4 | */ 5 | 6 | #editor { 7 | max-height: 250px; 8 | height: 250px; 9 | background-color: white; 10 | border-collapse: separate; 11 | border: 1px solid rgb(204, 204, 204); 12 | padding: 4px; 13 | box-sizing: content-box; 14 | -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset; 15 | box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset; 16 | border-top-right-radius: 3px; border-bottom-right-radius: 3px; 17 | border-bottom-left-radius: 3px; border-top-left-radius: 3px; 18 | overflow: scroll; 19 | outline: none; 20 | } 21 | #voiceBtn { 22 | width: 20px; 23 | color: transparent; 24 | background-color: transparent; 25 | transform: scale(2.0, 2.0); 26 | -webkit-transform: scale(2.0, 2.0); 27 | -moz-transform: scale(2.0, 2.0); 28 | border: transparent; 29 | cursor: pointer; 30 | box-shadow: none; 31 | -webkit-box-shadow: none; 32 | } 33 | 34 | div[data-role="editor-toolbar"] { 35 | -webkit-user-select: none; 36 | -moz-user-select: none; 37 | -ms-user-select: none; 38 | user-select: none; 39 | } 40 | 41 | .dropdown-menu a { 42 | cursor: pointer; 43 | } 44 | -------------------------------------------------------------------------------- /examples/helicopter/.#index.html: -------------------------------------------------------------------------------- 1 | dale@localhost.com.8641:1281005053 -------------------------------------------------------------------------------- /examples/helicopter/crash.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/crash.mp3 -------------------------------------------------------------------------------- /examples/helicopter/crash.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/crash.ogg -------------------------------------------------------------------------------- /examples/helicopter/heli.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/heli.mp3 -------------------------------------------------------------------------------- /examples/helicopter/heli.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/heli.ogg -------------------------------------------------------------------------------- /examples/helicopter/heli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/heli.png -------------------------------------------------------------------------------- /examples/helicopter/heli2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/heli2.png -------------------------------------------------------------------------------- /examples/helicopter/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GifW00t! 6 | 7 | 16 | 17 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | 37 |

Gifw00t! Helicopter

38 |

39 | 40 | 41 | 42 |
43 |
44 | Thanks @daleharvey for the original HTML5 pacman and helicopter! 45 | 46 |



47 |
48 |
49 | 50 | 51 | 52 |
53 |
54 | Created by @YaronNaveh 55 |
56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /examples/helicopter/motor.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/motor.mp3 -------------------------------------------------------------------------------- /examples/helicopter/motor.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/motor.ogg -------------------------------------------------------------------------------- /examples/helicopter/silkscreen.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'SilkScreen'; 3 | src: url('slkscre.ttf') format('truetype'); 4 | font-weight: normal; 5 | font-style: normal; 6 | } 7 | -------------------------------------------------------------------------------- /examples/helicopter/silkscreenbold.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'SilkScreenBold'; 3 | src: url('slkscrb.ttf') format('truetype'); 4 | font-weight: bold; 5 | font-style: normal; 6 | } 7 | -------------------------------------------------------------------------------- /examples/helicopter/slkscr.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/slkscr.ttf -------------------------------------------------------------------------------- /examples/helicopter/slkscrb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/slkscrb.ttf -------------------------------------------------------------------------------- /examples/helicopter/slkscre.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/slkscre.ttf -------------------------------------------------------------------------------- /examples/helicopter/slkscreb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/helicopter/slkscreb.ttf -------------------------------------------------------------------------------- /examples/img/blogger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/img/blogger.png -------------------------------------------------------------------------------- /examples/img/github-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/img/github-white.png -------------------------------------------------------------------------------- /examples/img/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/img/github.png -------------------------------------------------------------------------------- /examples/img/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/img/twitter.png -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drawingboard.js", 3 | "version": "0.4.2", 4 | "main": [ 5 | "dist/drawingboard.js", 6 | "dist/drawingboard.css" 7 | ], 8 | "dependencies": { 9 | "jquery": "*" 10 | }, 11 | "homepage": "https://github.com/Leimi/drawingboard.js", 12 | "_release": "0.4.2", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "v0.4.2", 16 | "commit": "894de036a793bfa66e24fb553e2179c41888837c" 17 | }, 18 | "_source": "git://github.com/Leimi/drawingboard.js.git", 19 | "_target": "~0.4.2", 20 | "_originalSource": "drawingboard.js", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/.gitignore: -------------------------------------------------------------------------------- 1 | /img/drawingboard.js.png 2 | /img/moto.jpg 3 | .sass-cache 4 | .livereload 5 | *.sublime-project 6 | *.sublime-workspace 7 | *en conflit* 8 | node_modules 9 | sftp-config.json 10 | components -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | grunt.loadNpmTasks('grunt-contrib-concat'); 3 | grunt.loadNpmTasks('grunt-contrib-uglify'); 4 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 5 | 6 | grunt.initConfig({ 7 | bwr: grunt.file.readJSON('bower.json'), 8 | meta: { 9 | banner: "/* <%= bwr.name %> v<%= bwr.version %> - https://github.com/Leimi/drawingboard.js\n" + 10 | "* Copyright (c) <%= grunt.template.today('yyyy') %> Emmanuel Pelletier\n" + 11 | '* Licensed MIT */\n' 12 | }, 13 | 14 | concat: { 15 | options: { 16 | banner: "<%= meta.banner %>" 17 | }, 18 | light: { 19 | src: ['js/drawingboard.js', 'js/board.js', 'js/utils.js'], 20 | dest: 'dist/drawingboard.nocontrol.js' 21 | }, 22 | full: { 23 | src: ['js/drawingboard.js', 'js/board.js', 'js/controls/control.js', 'js/controls/color.js', 'js/controls/drawingmode.js', 'js/controls/navigation.js', 'js/controls/size.js', 'js/controls/download.js', 'js/utils.js'], 24 | dest: 'dist/drawingboard.js' 25 | }, 26 | cssLight: { //simple copy in order to have everything in dist/ 27 | src: ['css/drawingboard.nocontrol.css'], 28 | dest: 'dist/drawingboard.nocontrol.css' 29 | }, 30 | cssFull: { //simple copy in order to have everything in dist/ 31 | src: ['css/drawingboard.css'], 32 | dest: 'dist/drawingboard.css' 33 | } 34 | }, 35 | 36 | uglify: { 37 | options: { 38 | banner: "<%= meta.banner %>" 39 | }, 40 | light: { 41 | files: { 42 | 'dist/drawingboard.nocontrol.min.js': ['dist/drawingboard.nocontrol.js'] 43 | } 44 | }, 45 | full: { 46 | files: { 47 | 'dist/drawingboard.min.js': ['dist/drawingboard.js'] 48 | } 49 | } 50 | }, 51 | 52 | cssmin: { 53 | options: { 54 | banner: "<%= meta.banner %>" 55 | }, 56 | light: { 57 | files: { 58 | 'dist/drawingboard.nocontrol.min.css': ['css/drawingboard.nocontrol.css'] 59 | } 60 | }, 61 | full: { 62 | files: { 63 | 'dist/drawingboard.min.css': ['css/drawingboard.css'] 64 | } 65 | } 66 | } 67 | }); 68 | 69 | grunt.registerTask('default', ['concat', 'uglify', 'cssmin']); 70 | }; 71 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2012 Emmanuel Pelletier 3 | 4 | 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: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | 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. -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drawingboard.js", 3 | "version": "0.4.2", 4 | "main": ["dist/drawingboard.js", "dist/drawingboard.css"], 5 | "dependencies": { 6 | "jquery": "*" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/config.rb: -------------------------------------------------------------------------------- 1 | http_path = "/" 2 | css_dir = "css" 3 | sass_dir = "scss" 4 | images_dir = "img" 5 | javascripts_dir = "js" 6 | 7 | output_style = :compact # :expanded or :nested or :compact or :compressed 8 | 9 | relative_assets = true 10 | 11 | line_comments = false -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/css/drawingboard.nocontrol.css: -------------------------------------------------------------------------------- 1 | .drawing-board, .drawing-board * { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } 2 | 3 | .drawing-board-utils-hidden { display: none !important; } 4 | 5 | .drawing-board { position: relative; display: block; } 6 | 7 | .drawing-board-canvas-wrapper { position: relative; margin: 0; border: 1px solid #ddd; } 8 | 9 | .drawing-board-canvas { position: absolute; top: 0; left: 0; z-index: 10; width: auto; } 10 | 11 | .drawing-board-canvas { cursor: crosshair; z-index: 20; } 12 | 13 | .drawing-board-cursor { position: absolute; top: 0; left: 0; pointer-events: none; border-radius: 50%; background: #ccc; background: rgba(0, 0, 0, 0.2); z-index: 30; } 14 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/dist/drawingboard.nocontrol.css: -------------------------------------------------------------------------------- 1 | /* drawingboard.js v0.4.2 - https://github.com/Leimi/drawingboard.js 2 | * Copyright (c) 2013 Emmanuel Pelletier 3 | * Licensed MIT */ 4 | .drawing-board, .drawing-board * { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } 5 | 6 | .drawing-board-utils-hidden { display: none !important; } 7 | 8 | .drawing-board { position: relative; display: block; } 9 | 10 | .drawing-board-canvas-wrapper { position: relative; margin: 0; border: 1px solid #ddd; } 11 | 12 | .drawing-board-canvas { position: absolute; top: 0; left: 0; z-index: 10; width: auto; } 13 | 14 | .drawing-board-canvas { cursor: crosshair; z-index: 20; } 15 | 16 | .drawing-board-cursor { position: absolute; top: 0; left: 0; pointer-events: none; border-radius: 50%; background: #ccc; background: rgba(0, 0, 0, 0.2); z-index: 30; } 17 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/dist/drawingboard.nocontrol.min.css: -------------------------------------------------------------------------------- 1 | /* drawingboard.js v0.4.2 - https://github.com/Leimi/drawingboard.js 2 | * Copyright (c) 2013 Emmanuel Pelletier 3 | * Licensed MIT */ 4 | 5 | .drawing-board,.drawing-board *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.drawing-board-utils-hidden{display:none!important}.drawing-board{position:relative;display:block}.drawing-board-canvas-wrapper{position:relative;margin:0;border:1px solid #ddd}.drawing-board-canvas{position:absolute;top:0;left:0;z-index:10;width:auto}.drawing-board-canvas{cursor:crosshair;z-index:20}.drawing-board-cursor{position:absolute;top:0;left:0;pointer-events:none;border-radius:50%;background:#ccc;background:rgba(0,0,0,.2);z-index:30} -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/example/drawingboardjs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/examples/paint/bower_components/drawingboard.js/example/drawingboardjs.png -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/example/prism.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js default theme for JavaScript, CSS and HTML 3 | * Based on dabblet (http://dabblet.com) 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: black; 10 | text-shadow: 0 1px white; 11 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 12 | direction: ltr; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | 17 | -moz-tab-size: 4; 18 | -o-tab-size: 4; 19 | tab-size: 4; 20 | 21 | -webkit-hyphens: none; 22 | -moz-hyphens: none; 23 | -ms-hyphens: none; 24 | hyphens: none; 25 | } 26 | 27 | @media print { 28 | code[class*="language-"], 29 | pre[class*="language-"] { 30 | text-shadow: none; 31 | } 32 | } 33 | 34 | /* Code blocks */ 35 | pre[class*="language-"] { 36 | padding: 1em; 37 | margin: .5em 0; 38 | overflow: auto; 39 | } 40 | 41 | :not(pre) > code[class*="language-"], 42 | pre[class*="language-"] { 43 | background: #f5f2f0; 44 | } 45 | 46 | /* Inline code */ 47 | :not(pre) > code[class*="language-"] { 48 | padding: .1em; 49 | border-radius: .3em; 50 | } 51 | 52 | .token.comment, 53 | .token.prolog, 54 | .token.doctype, 55 | .token.cdata { 56 | color: slategray; 57 | } 58 | 59 | .token.punctuation { 60 | color: #999; 61 | } 62 | 63 | .namespace { 64 | opacity: .7; 65 | } 66 | 67 | .token.property, 68 | .token.tag, 69 | .token.boolean, 70 | .token.number { 71 | color: #905; 72 | } 73 | 74 | .token.selector, 75 | .token.attr-name, 76 | .token.string { 77 | color: #690; 78 | } 79 | 80 | .token.operator, 81 | .token.entity, 82 | .token.url, 83 | .language-css .token.string, 84 | .style .token.string { 85 | color: #a67f59; 86 | background: hsla(0,0%,100%,.5); 87 | } 88 | 89 | .token.atrule, 90 | .token.attr-value, 91 | .token.keyword { 92 | color: #07a; 93 | } 94 | 95 | 96 | .token.regex, 97 | .token.important { 98 | color: #e90; 99 | } 100 | 101 | .token.important { 102 | font-weight: bold; 103 | } 104 | 105 | .token.entity { 106 | cursor: help; 107 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/example/script.js: -------------------------------------------------------------------------------- 1 | var content; 2 | $('script[data-example]').each(function(n, item) { 3 | content = $(this).html(); 4 | $('div[data-example="' + $(this).attr('data-example') + '"]') 5 | .append( 6 | '
' +
 7 | 			$(this).html()
 8 | 				.replace(/[<>]/g, function(m) { return {'<':'<','>':'>'}[m];})
 9 | 				.replace(/\t\t\t/g, "")
10 | 				.replace(/^\n/g, "")
11 | 				.replace(/\t\t$/g, "")
12 | 				.replace(/\n$/g, "") +
13 | 			'
' 14 | ); 15 | }); 16 | 17 | var _gaq=[['_setAccount','UA-13184829-2'],['_trackPageview']]; 18 | (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; 19 | g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; 20 | s.parentNode.insertBefore(g,s)}(document,'script')); -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/example/website.css: -------------------------------------------------------------------------------- 1 | /** 2 | * website's styles 3 | */ 4 | body { 5 | font-family: sans-serif; 6 | background: #dedede; 7 | margin: 0; 8 | } 9 | 10 | h1 { 11 | font-family: Comic Sans MS; 12 | } 13 | 14 | h1, p { 15 | text-align: center; 16 | } 17 | 18 | a { 19 | color: #4786c3; 20 | text-decoration: none; 21 | } 22 | a:hover, a:focus { 23 | text-decoration: underline; 24 | } 25 | 26 | pre { 27 | display: block; 28 | padding: 10px; 29 | font-size: 13px; 30 | line-height: 20px; 31 | word-break: break-all; 32 | word-wrap: break-word; 33 | white-space: pre; 34 | white-space: pre-wrap; 35 | background-color: whiteSmoke; 36 | border: 1px solid #CCC; 37 | border: 1px solid rgba(0, 0, 0, 0.15); 38 | border-radius: 4px; 39 | tab-size: 2; 40 | } 41 | 42 | code { 43 | font-family: Monaco, "Monaco for Powerline", Menlo, Consolas, "Courier New", monospace 44 | } 45 | 46 | /*http://codepo8.github.com/css-fork-on-github-ribbon/*/ 47 | #forkongithub a{z-index: 10;background:#4786c3;color:#ffffff;text-decoration:none;text-align:center;font-weight:bold;padding:5px 40px;font-size:1rem;line-height:2rem;position:relative;transition:0.5s;}#forkongithub a:hover{background:#3182d2;color:#ffffff;}#forkongithub a::before,#forkongithub a::after{content:"";width:100%;display:block;position:absolute;top:1px;left:0;height:1px;background:#444444;}#forkongithub a::after{bottom:1px;top:auto;}@media screen and (min-width:800px){#forkongithub{position:absolute;display:block;top:0;right:0;width:200px;overflow:hidden;height:200px;}#forkongithub a{width:200px;position:absolute;top:60px;right:-60px;transform:rotate(45deg);-webkit-transform:rotate(45deg);box-shadow:4px 2px 14px rgba(0,0,0,0.3);}} 48 | 49 | .header { 50 | background-color:#8b84ac; 51 | background-image: 52 | -webkit-linear-gradient(#6b659d 1px, transparent 1px), 53 | -webkit-linear-gradient(0deg, #6b659d 1px, transparent 1px); 54 | background-image: 55 | -moz-linear-gradient(#6b659d 1px, transparent 1px), 56 | -moz-linear-gradient(0deg, #6b659d 1px, transparent 1px); 57 | background-image: 58 | linear-gradient(#6b659d 1px, transparent 1px), 59 | linear-gradient(90deg, #6b659d 1px, transparent 1px); 60 | -moz-background-size:33px 33px, 33px 33px; 61 | background-size:33px 33px, 33px 33px; 62 | background-position:-5px -5px, -16px -16px; 63 | box-shadow: 0 5px 10px #999; 64 | color: white; 65 | text-shadow: 0 0 2px #222; 66 | font-weight: bold; 67 | } 68 | 69 | #container { 70 | width: 750px; 71 | max-width: 100%; 72 | margin: 10px auto; 73 | } 74 | 75 | .example { 76 | margin: 60px 0; 77 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/example/yepnope.js: -------------------------------------------------------------------------------- 1 | /*yepnope1.5.x|WTFPL*/ 2 | (function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f' + 39 | '
{{rainbows}}
' + 40 | ''; 41 | var oneColorTpl = '
'; 42 | var rainbows = ''; 43 | $.each([0.75, 0.5, 0.25], $.proxy(function(key, val) { 44 | var i = 0; 45 | var additionalColor = null; 46 | rainbows += '
'; 47 | if (val == 0.25) additionalColor = this._rgba(0, 0, 0, 1); 48 | if (val == 0.5) additionalColor = this._rgba(150, 150, 150, 1); 49 | if (val == 0.75) additionalColor = this._rgba(255, 255, 255, 1); 50 | rainbows += DrawingBoard.Utils.tpl(oneColorTpl, {color: additionalColor.toString() }); 51 | while (i <= 330) { 52 | rainbows += DrawingBoard.Utils.tpl(oneColorTpl, {color: this._hsl2Rgba(this._hsl(i-60, 1, val)).toString() }); 53 | i+=30; 54 | } 55 | rainbows += '
'; 56 | }, this)); 57 | 58 | this.$el.append( $( DrawingBoard.Utils.tpl(tpl, {color: this.board.color, rainbows: rainbows }) ) ); 59 | this.$el.find('.drawing-board-control-colors-rainbows').addClass('drawing-board-utils-hidden'); 60 | }, 61 | 62 | onBoardReset: function(opts) { 63 | this.board.setColor(this.$el.find('.drawing-board-control-colors-current').attr('data-color')); 64 | }, 65 | 66 | _rgba: function(r, g, b, a) { 67 | return { r: r, g: g, b: b, a: a, toString: function() { return "rgba(" + r +", " + g + ", " + b + ", " + a + ")"; } }; 68 | }, 69 | 70 | _hsl: function(h, s, l) { 71 | return { h: h, s: s, l: l, toString: function() { return "hsl(" + h +", " + s*100 + "%, " + l*100 + "%)"; } }; 72 | }, 73 | 74 | _hex2Rgba: function(hex) { 75 | var num = parseInt(hex.substring(1), 16); 76 | return this._rgba(num >> 16, num >> 8 & 255, num & 255, 1); 77 | }, 78 | 79 | //conversion function (modified a bit) taken from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript 80 | _hsl2Rgba: function(hsl) { 81 | var h = hsl.h/360, s = hsl.s, l = hsl.l, r, g, b; 82 | function hue2rgb(p, q, t) { 83 | if(t < 0) t += 1; 84 | if(t > 1) t -= 1; 85 | if(t < 1/6) return p + (q - p) * 6 * t; 86 | if(t < 1/2) return q; 87 | if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 88 | return p; 89 | } 90 | if (s === 0) { 91 | r = g = b = l; // achromatic 92 | } else { 93 | var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 94 | var p = 2 * l - q; 95 | r = Math.floor( (hue2rgb(p, q, h + 1/3)) * 255); 96 | g = Math.floor( (hue2rgb(p, q, h)) * 255); 97 | b = Math.floor( (hue2rgb(p, q, h - 1/3)) * 255); 98 | } 99 | return this._rgba(r, g, b, 1); 100 | } 101 | }); -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/controls/control.js: -------------------------------------------------------------------------------- 1 | DrawingBoard.Control = function(drawingBoard, opts) { 2 | this.board = drawingBoard; 3 | this.opts = $.extend({}, this.defaults, opts); 4 | 5 | this.$el = $(document.createElement('div')).addClass('drawing-board-control'); 6 | if (this.name) 7 | this.$el.addClass('drawing-board-control-' + this.name); 8 | 9 | this.board.ev.bind('board:reset', $.proxy(this.onBoardReset, this)); 10 | 11 | this.initialize.apply(this, arguments); 12 | return this; 13 | }; 14 | 15 | DrawingBoard.Control.prototype = { 16 | 17 | name: '', 18 | 19 | defaults: {}, 20 | 21 | initialize: function() { 22 | 23 | }, 24 | 25 | addToBoard: function() { 26 | this.board.addControl(this); 27 | }, 28 | 29 | onBoardReset: function(opts) { 30 | 31 | } 32 | 33 | }; 34 | 35 | //extend directly taken from backbone.js 36 | DrawingBoard.Control.extend = function(protoProps, staticProps) { 37 | var parent = this; 38 | var child; 39 | if (protoProps && protoProps.hasOwnProperty('constructor')) { 40 | child = protoProps.constructor; 41 | } else { 42 | child = function(){ return parent.apply(this, arguments); }; 43 | } 44 | $.extend(child, parent, staticProps); 45 | var Surrogate = function(){ this.constructor = child; }; 46 | Surrogate.prototype = parent.prototype; 47 | child.prototype = new Surrogate(); 48 | if (protoProps) $.extend(child.prototype, protoProps); 49 | child.__super__ = parent.prototype; 50 | return child; 51 | }; -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/controls/download.js: -------------------------------------------------------------------------------- 1 | DrawingBoard.Control.Download = DrawingBoard.Control.extend({ 2 | 3 | name: 'download', 4 | 5 | initialize: function() { 6 | this.$el.append(''); 7 | this.$el.on('click', '.drawing-board-control-download-button', $.proxy(function(e) { 8 | this.board.downloadImg(); 9 | e.preventDefault(); 10 | }, this)); 11 | } 12 | 13 | }); -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/controls/drawingmode.js: -------------------------------------------------------------------------------- 1 | DrawingBoard.Control.DrawingMode = DrawingBoard.Control.extend({ 2 | 3 | name: 'drawingmode', 4 | 5 | defaults: { 6 | pencil: true, 7 | eraser: true, 8 | filler: true 9 | }, 10 | 11 | initialize: function() { 12 | 13 | this.prevMode = this.board.getMode(); 14 | 15 | $.each(["pencil", "eraser", "filler"], $.proxy(function(k, value) { 16 | if (this.opts[value]) { 17 | this.$el.append(''); 18 | } 19 | }, this)); 20 | 21 | this.$el.on('click', 'button[data-mode]', $.proxy(function(e) { 22 | var value = $(e.currentTarget).attr('data-mode'); 23 | var mode = this.board.getMode(); 24 | if (mode !== value) this.prevMode = mode; 25 | var newMode = mode === value ? this.prevMode : value; 26 | this.board.setMode( newMode ); 27 | e.preventDefault(); 28 | }, this)); 29 | 30 | this.board.ev.bind('board:mode', $.proxy(function(mode) { 31 | this.toggleButtons(mode); 32 | }, this)); 33 | 34 | this.toggleButtons( this.board.getMode() ); 35 | }, 36 | 37 | toggleButtons: function(mode) { 38 | this.$el.find('button[data-mode]').each(function(k, item) { 39 | var $item = $(item); 40 | $item.toggleClass('active', mode === $item.attr('data-mode')); 41 | }); 42 | } 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/controls/navigation.js: -------------------------------------------------------------------------------- 1 | DrawingBoard.Control.Navigation = DrawingBoard.Control.extend({ 2 | 3 | name: 'navigation', 4 | 5 | defaults: { 6 | back: true, 7 | forward: true, 8 | reset: true 9 | }, 10 | 11 | initialize: function() { 12 | var el = ''; 13 | if (this.opts.back) el += ''; 14 | if (this.opts.forward) el += ''; 15 | if (this.opts.reset) el += ''; 16 | this.$el.append(el); 17 | 18 | if (this.opts.back) { 19 | var $back = this.$el.find('.drawing-board-control-navigation-back'); 20 | this.board.ev.bind('historyNavigation', $.proxy(function(pos) { 21 | if (pos === 1) 22 | $back.attr('disabled', 'disabled'); 23 | else 24 | $back.removeAttr('disabled'); 25 | }, this)); 26 | this.$el.on('click', '.drawing-board-control-navigation-back', $.proxy(function(e) { 27 | this.board.goBackInHistory(); 28 | e.preventDefault(); 29 | }, this)); 30 | } 31 | 32 | if (this.opts.forward) { 33 | var $forward = this.$el.find('.drawing-board-control-navigation-forward'); 34 | this.board.ev.bind('historyNavigation', $.proxy(function(pos) { 35 | if (pos === this.board.history.values.length) 36 | $forward.attr('disabled', 'disabled'); 37 | else 38 | $forward.removeAttr('disabled'); 39 | }, this)); 40 | this.$el.on('click', '.drawing-board-control-navigation-forward', $.proxy(function(e) { 41 | this.board.goForthInHistory(); 42 | e.preventDefault(); 43 | }, this)); 44 | } 45 | 46 | if (this.opts.reset) { 47 | this.$el.on('click', '.drawing-board-control-navigation-reset', $.proxy(function(e) { 48 | this.board.reset({ background: true }); 49 | e.preventDefault(); 50 | }, this)); 51 | } 52 | } 53 | }); -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/controls/size.js: -------------------------------------------------------------------------------- 1 | DrawingBoard.Control.Size = DrawingBoard.Control.extend({ 2 | 3 | name: 'size', 4 | 5 | defaults: { 6 | type: "auto", 7 | dropdownValues: [1, 3, 6, 10, 20, 30, 40, 50] 8 | }, 9 | 10 | types: ['dropdown', 'range'], 11 | 12 | initialize: function() { 13 | if (this.opts.type == "auto") 14 | this.opts.type = this._iHasRangeInput() ? 'range' : 'dropdown'; 15 | var tpl = $.inArray(this.opts.type, this.types) > -1 ? this['_' + this.opts.type + 'Template']() : false; 16 | if (!tpl) return false; 17 | 18 | this.val = this.board.opts.size; 19 | 20 | this.$el.append( $( tpl ) ); 21 | this.$el.attr('data-drawing-board-type', this.opts.type); 22 | this.updateView(); 23 | 24 | var that = this; 25 | 26 | if (this.opts.type == "range") { 27 | this.$el.on('change', '.drawing-board-control-size-range-input', function(e) { 28 | that.val = $(this).val(); 29 | that.updateView(); 30 | 31 | that.board.ev.trigger('size:changed', that.val); 32 | 33 | e.preventDefault(); 34 | }); 35 | } 36 | 37 | if (this.opts.type == "dropdown") { 38 | this.$el.on('click', '.drawing-board-control-size-dropdown-current', $.proxy(function(e) { 39 | this.$el.find('.drawing-board-control-size-dropdown').toggleClass('drawing-board-utils-hidden'); 40 | }, this)); 41 | 42 | this.$el.on('click', '[data-size]', function(e) { 43 | that.val = parseInt($(this).attr('data-size'), 0); 44 | that.updateView(); 45 | 46 | that.board.ev.trigger('size:changed', that.val); 47 | 48 | e.preventDefault(); 49 | }); 50 | } 51 | }, 52 | 53 | _rangeTemplate: function() { 54 | var tpl = '
' + 55 | '' + 56 | '' + 57 | '
'; 58 | return DrawingBoard.Utils.tpl(tpl, { size: this.board.opts.size }); 59 | }, 60 | 61 | _dropdownTemplate: function() { 62 | var tpl = '
' + 63 | '
' + 64 | '
    '; 65 | $.each(this.opts.dropdownValues, function(i, size) { 66 | tpl += DrawingBoard.Utils.tpl( 67 | '
  • ', 68 | { size: size } 69 | ); 70 | }); 71 | tpl += '
'; 72 | return tpl; 73 | }, 74 | 75 | onBoardReset: function(opts) { 76 | this.updateView(); 77 | }, 78 | 79 | updateView: function() { 80 | var val = this.val; 81 | this.board.ctx.lineWidth = val; 82 | 83 | this.$el.find('.drawing-board-control-size-range-current, .drawing-board-control-size-dropdown-current span').css({ 84 | width: val + 'px', 85 | height: val + 'px', 86 | borderRadius: val + 'px', 87 | marginLeft: -1*val/2 + 'px', 88 | marginTop: -1*val/2 + 'px' 89 | }); 90 | 91 | this.$el.find('.drawing-board-control-inner').attr('title', val); 92 | 93 | if (this.opts.type == 'dropdown') { 94 | var closest = null; 95 | $.each(this.opts.dropdownValues, function(i, size) { 96 | if (closest === null || Math.abs(size - val) < Math.abs(closest - val)) 97 | closest = size; 98 | }); 99 | this.$el.find('.drawing-board-control-size-dropdown').addClass('drawing-board-utils-hidden'); 100 | } 101 | }, 102 | 103 | _iHasRangeInput: function() { 104 | var inputElem = document.createElement('input'), 105 | smile = ':)', 106 | docElement = document.documentElement, 107 | inputElemType = 'range', 108 | available; 109 | inputElem.setAttribute('type', inputElemType); 110 | available = inputElem.type !== 'text'; 111 | inputElem.value = smile; 112 | inputElem.style.cssText = 'position:absolute;visibility:hidden;'; 113 | if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { 114 | docElement.appendChild(inputElem); 115 | defaultView = document.defaultView; 116 | available = defaultView.getComputedStyle && 117 | defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && 118 | (inputElem.offsetHeight !== 0); 119 | docElement.removeChild(inputElem); 120 | } 121 | return !!available; 122 | } 123 | }); -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/js/drawingboard.js: -------------------------------------------------------------------------------- 1 | window.DrawingBoard = {}; -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drawingboard.js", 3 | "version": "1.3.3.7", 4 | "devDependencies": { 5 | "grunt": "~0.4.1", 6 | "grunt-contrib-concat": "~0.3.0", 7 | "grunt-contrib-uglify": "~0.2.2", 8 | "grunt-contrib-cssmin": "~0.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/_controls.scss: -------------------------------------------------------------------------------- 1 | $controls-height: 28px; 2 | $controls-margin: 5px; 3 | $controls-dropdown-top: $controls-height + $controls-margin; 4 | 5 | %box { 6 | @include box-sizing(border-box); 7 | overflow: hidden; 8 | border: none; 9 | background-color:#eee; 10 | padding: 2px 4px; 11 | border: 1px solid #ccc; 12 | box-shadow: 0 1px 3px -2px hsl(0, 0%, 7%), inset 0 2px 5px 0 hsla(0, 100%, 100%, 0.3); 13 | -webkit-box-shadow: 0 1px 3px -2px hsl(0, 0%, 7%), inset 0 2px 5px 0 hsla(0, 100%, 100%, 0.3); 14 | height: $controls-height; 15 | } 16 | 17 | %btn { 18 | @extend %box; 19 | cursor: pointer; 20 | &:hover, &:focus { 21 | background-color: #ddd; 22 | } 23 | &:active, &.active { 24 | box-shadow: inset 0 1px 2px 0 hsla(0, 0%, 0%, 0.2); 25 | -webkit-box-shadow: inset 0 1px 2px 0 hsla(0, 0%, 0%, 0.2); 26 | background-color: #ddd; 27 | } 28 | &[disabled] { 29 | color: gray; 30 | &:hover, &:focus, &:active, &.active { 31 | background-color:#eee; 32 | box-shadow: 0 1px 3px -2px hsl(0, 0%, 7%), inset 0 2px 5px 0 hsla(0, 100%, 100%, 0.3); 33 | -webkit-box-shadow: 0 1px 3px -2px hsl(0, 0%, 7%), inset 0 2px 5px 0 hsla(0, 100%, 100%, 0.3); 34 | cursor: default; 35 | } 36 | } 37 | min-width: $controls-height; 38 | line-height: $controls-height/2; 39 | } 40 | 41 | .drawing-board-controls { 42 | margin: 0 auto; 43 | text-align: center; 44 | font-size: 0; 45 | display: table; 46 | border-spacing: $controls-height/3 0; 47 | position: relative; 48 | &[data-align="left"] { 49 | margin: 0; 50 | left: -$controls-height/3; 51 | } 52 | &[data-align="right"] { 53 | margin: 0 0 0 auto; 54 | right: -$controls-height/3; 55 | } 56 | .drawing-board-canvas-wrapper + &, & + .drawing-board-canvas-wrapper { 57 | margin-top: $controls-margin; 58 | } 59 | min-height: $controls-height; 60 | } 61 | 62 | .drawing-board-controls-hidden { 63 | @extend .drawing-board-utils-hidden; 64 | height: 0; 65 | min-height: 0; 66 | padding: 0; 67 | margin: 0; 68 | border: 0; 69 | } 70 | 71 | .drawing-board-control { 72 | display: table-cell; 73 | border-collapse: separate; 74 | vertical-align: middle; 75 | font-size: 16px; 76 | height: 100%; 77 | } 78 | 79 | .drawing-board-control-inner { 80 | position: relative; 81 | height: 100%; 82 | @include box-sizing(border-box); 83 | } 84 | 85 | .drawing-board-control > button { 86 | @extend %btn; 87 | margin: 0; 88 | vertical-align: middle; 89 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/_main.scss: -------------------------------------------------------------------------------- 1 | @import 'compass'; 2 | .drawing-board, .drawing-board * { 3 | @include box-sizing(content-box); 4 | } 5 | 6 | .drawing-board-utils-hidden { 7 | display: none !important; 8 | } 9 | 10 | .drawing-board { 11 | position: relative; 12 | display: block; 13 | } 14 | 15 | .drawing-board-canvas-wrapper { 16 | position: relative; 17 | margin: 0; 18 | border: 1px solid #ddd; 19 | } 20 | 21 | .drawing-board-canvas { 22 | position: absolute; 23 | top: 0; 24 | left: 0; 25 | z-index: 10; 26 | width: auto; 27 | } 28 | 29 | .drawing-board-canvas { 30 | cursor: crosshair; 31 | z-index: 20; 32 | } 33 | 34 | .drawing-board-cursor { 35 | position: absolute; 36 | top: 0; 37 | left: 0; 38 | pointer-events: none; 39 | border-radius: 50%; 40 | background: #ccc; 41 | background: rgba(#000, 0.2); 42 | z-index: 30; 43 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin display-ib { 2 | display: inline-block; 3 | *display: inline; 4 | *zoom: 1; 5 | } 6 | 7 | @mixin image-replacement($img: none, $x: 50%, $y: 50%) { 8 | overflow: hidden; 9 | *text-indent: -9999px; 10 | &:before { 11 | content: ""; 12 | display: block; 13 | width: 0; 14 | height: 100%; 15 | } 16 | @if $img != none { 17 | background-image: inline-image($img); 18 | background-position: $x $y; 19 | background-repeat: no-repeat; 20 | } 21 | } 22 | 23 | @mixin sized-image-replacement($img, $x: 50%, $y: 50%) { 24 | @include image-replacement($img, $x, $y); 25 | width: image-width($img); 26 | height: image-height($img); 27 | } 28 | 29 | // Hide from both screenreaders and browsers: h5bp.com/u 30 | @mixin hidden { 31 | display: none !important; 32 | visibility: hidden; 33 | } 34 | 35 | // Hide only visually, but have it available for screenreaders: h5bp.com/v 36 | @mixin visually-hidden { 37 | border: 0; 38 | clip: rect(0 0 0 0); 39 | height: 1px; 40 | margin: -1px; 41 | overflow: hidden; 42 | padding: 0; 43 | position: absolute; 44 | width: 1px; 45 | &.focusable:active, &.focusable:focus { 46 | clip: auto; 47 | height: auto; 48 | margin: 0; 49 | overflow: visible; 50 | position: static; 51 | width: auto; 52 | } 53 | } 54 | 55 | // Hide visually and from screenreaders, but maintain layout 56 | @mixin invisible { 57 | visibility: hidden; 58 | } 59 | 60 | @mixin micro-clearfix { 61 | &:before, &:after { 62 | content: " "; // 1 63 | display: table; // 2 64 | } 65 | &:after { clear: both; } 66 | & { *zoom: 1; } 67 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/controls/_colors.scss: -------------------------------------------------------------------------------- 1 | .drawing-board-control-colors { 2 | font-size: 0; 3 | line-height: 0; 4 | } 5 | 6 | .drawing-board-control-colors-current { 7 | border: 1px solid #ccc; 8 | cursor: pointer; 9 | display: inline-block; 10 | width: $controls-height - 2px; 11 | height: $controls-height - 2px; 12 | } 13 | 14 | 15 | .drawing-board-control-colors-rainbows { 16 | display: inline-block; 17 | margin-left: 5px; 18 | position: absolute; 19 | left: 0; 20 | top: $controls-dropdown-top; 21 | @extend %box; 22 | margin-left: 0; 23 | z-index: 100; 24 | width: 250px; 25 | height: auto; 26 | padding: 4px; 27 | } 28 | 29 | .drawing-board-control-colors-rainbow { 30 | height: 18px; 31 | } 32 | 33 | .drawing-board-control-colors-picker:first-child { 34 | margin-right: 5px; 35 | } 36 | 37 | .drawing-board-control-colors-picker { 38 | display: inline-block; 39 | width: 18px; 40 | height: 18px; 41 | cursor: pointer; 42 | } 43 | 44 | .drawing-board-control-colors-picker[data-color="rgba(255, 255, 255, 1)"] { 45 | width: 16px; 46 | height: 17px; 47 | border: 1px solid #ccc; 48 | border-bottom: none; 49 | } 50 | 51 | .drawing-board-control-colors-picker:hover { 52 | width: 16px; 53 | height: 16px; 54 | border: 1px solid #555; 55 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/controls/_download.scss: -------------------------------------------------------------------------------- 1 | .drawing-board-control-download-button { 2 | @include image-replacement("download.png"); 3 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/controls/_drawingmode.scss: -------------------------------------------------------------------------------- 1 | .drawing-board-control-drawingmode { 2 | > button { 3 | margin-right: 2px; 4 | &:last-child { 5 | margin-right: 0; 6 | } 7 | } 8 | } 9 | 10 | .drawing-board-control-drawingmode-pencil-button { 11 | @include image-replacement("pencil.png"); 12 | } 13 | 14 | .drawing-board-control-drawingmode-eraser-button { 15 | @include image-replacement("eraser.png"); 16 | } 17 | 18 | .drawing-board-control-drawingmode-filler-button { 19 | @include image-replacement("paint-can.png"); 20 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/controls/_navigation.scss: -------------------------------------------------------------------------------- 1 | .drawing-board-control-navigation { 2 | 3 | } 4 | 5 | .drawing-board-control-navigation > button { 6 | font-family: Helvetica, Arial, sans-serif; 7 | font-size: 14px; 8 | font-weight: bold; 9 | margin-right: 2px; 10 | &:last-child { 11 | margin-right: 0; 12 | } 13 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/controls/_size.scss: -------------------------------------------------------------------------------- 1 | .drawing-board-control-size { 2 | .drawing-board-control-inner { 3 | @extend %box; 4 | } 5 | 6 | &[data-drawing-board-type="range"] .drawing-board-control-inner { 7 | width: 75px; 8 | } 9 | 10 | &[data-drawing-board-type="dropdown"] .drawing-board-control-inner { 11 | overflow: visible; 12 | } 13 | } 14 | 15 | .drawing-board-control-size-range-input { 16 | position: relative; 17 | width: 100%; 18 | z-index: 100; 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | } 23 | 24 | %dot { 25 | display: block; 26 | background: #333; 27 | opacity: .8; 28 | } 29 | 30 | .drawing-board-control-size-range-current { 31 | @extend %dot; 32 | display: inline-block; 33 | opacity: .15; 34 | position: absolute; 35 | pointer-events: none; 36 | left: 50%; 37 | top: 50%; 38 | z-index: 50; 39 | } 40 | 41 | .drawing-board-control-size-dropdown-current { 42 | display: block; 43 | height: 100%; 44 | width: 40px; 45 | overflow: hidden; 46 | position: relative; 47 | span { 48 | @extend %dot; 49 | position: absolute; 50 | left: 50%; 51 | top: 50%; 52 | } 53 | } 54 | 55 | .drawing-board-control-size-dropdown { 56 | position: absolute; 57 | left: -6px; 58 | top: $controls-dropdown-top; 59 | @extend %box; 60 | height: auto; 61 | list-style-type: none; 62 | margin: 0; 63 | padding: 0; 64 | z-index: 100; 65 | li { 66 | display: block; 67 | padding: 4px; 68 | margin: 3px 0; 69 | min-height: 16px; 70 | &:hover { 71 | background: #ccc; 72 | } 73 | } 74 | span { 75 | @extend %dot; 76 | margin: 0 auto; 77 | } 78 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/drawingboard.nocontrol.scss: -------------------------------------------------------------------------------- 1 | @import "mixins"; 2 | @import "main"; -------------------------------------------------------------------------------- /examples/paint/bower_components/drawingboard.js/scss/drawingboard.scss: -------------------------------------------------------------------------------- 1 | @import "mixins"; 2 | @import "main"; 3 | @import "controls"; 4 | @import "controls/colors"; 5 | @import "controls/drawingmode"; 6 | @import "controls/navigation"; 7 | @import "controls/size"; 8 | @import "controls/download"; -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "1.9.1", 4 | "description": "jQuery component", 5 | "keywords": [ 6 | "jquery", 7 | "component" 8 | ], 9 | "scripts": [ 10 | "jquery.js" 11 | ], 12 | "license": "MIT", 13 | "homepage": "https://github.com/components/jquery", 14 | "_release": "1.9.1", 15 | "_resolution": { 16 | "type": "version", 17 | "tag": "1.9.1", 18 | "commit": "0e94233e6a4ab678d8fc04312241b2f840717b0c" 19 | }, 20 | "_source": "git://github.com/components/jquery.git", 21 | "_target": "1.9.1", 22 | "_originalSource": "jquery", 23 | "_direct": true 24 | } -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/README.md: -------------------------------------------------------------------------------- 1 | jQuery Component 2 | ================ 3 | 4 | Shim repository for jQuery. 5 | -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "1.9.1", 4 | "description": "jQuery component", 5 | "keywords": [ 6 | "jquery", 7 | "component" 8 | ], 9 | "scripts": [ 10 | "jquery.js" 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "components/jquery", 3 | "description": "jQuery JavaScript Library", 4 | "type": "component", 5 | "homepage": "http://jquery.com", 6 | "license": "MIT", 7 | "support": { 8 | "irc": "irc://irc.freenode.org/jquery", 9 | "issues": "http://bugs.jquery.com", 10 | "forum": "http://forum.jquery.com", 11 | "wiki": "http://docs.jquery.com/", 12 | "source": "https://github.com/jquery/jquery" 13 | }, 14 | "authors": [ 15 | { 16 | "name": "John Resig", 17 | "email": "jeresig@gmail.com" 18 | } 19 | ], 20 | "require": { 21 | "robloach/component-installer": "*" 22 | }, 23 | "extra": { 24 | "component": { 25 | "scripts": [ 26 | "jquery.js" 27 | ], 28 | "files": [ 29 | "jquery.min.js", 30 | "jquery-migrate.js", 31 | "jquery-migrate.min.js" 32 | ] 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/paint/bower_components/jquery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "components-jquery", 3 | "version": "1.9.1", 4 | "description": "jQuery component", 5 | "keywords": ["jquery"], 6 | "main": "./jquery.js" 7 | } 8 | -------------------------------------------------------------------------------- /examples/paint/paint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GifW00t! A pure javascript web recorder 5 | 6 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | Fork me on GitHub 48 | 49 |

Gifw00t! Paint

50 |

51 |
52 | 53 |
54 |



55 |
56 | 57 | 58 | 59 | Created by @YaronNaveh 60 |
61 | 62 | 63 | 66 | 67 | 77 | 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "anigif", 3 | "name": "anigif", 4 | "description": "", 5 | "version": "0.0.1", 6 | "author": { 7 | "name": "Yaron Naveh (@YaronNaveh)" 8 | }, 9 | "engines": { 10 | "node": ">=0.8.0" 11 | }, 12 | "dependencies": { 13 | "async": "git+https://github.com/yaronn/async.git" 14 | }, 15 | "devDependencies": { 16 | "grunt": ">=0.4.0", 17 | "grunt-contrib-concat": "*", 18 | "grunt-contrib-uglify": "*", 19 | "grunt-contrib-jshint": "*", 20 | "grunt-contrib-copy": "~0.4.1", 21 | "grunt-contrib-clean": "~0.5.0", 22 | "grunt-contrib-watch": "~0.5.3", 23 | "grunt-shell": "~0.3.1", 24 | "grunt-simple-mocha": "~0.4.0", 25 | "wd": "~0.1.2", 26 | "aws-sdk": "~1.6.0", 27 | "grunt-targethtml": "~0.2.4", 28 | "http-server": "git+https://github.com/yaronn/http-server.git", 29 | "mime": "~1.2.11" 30 | }, 31 | "scripts": { 32 | "test": "grunt test", 33 | "server": "./node_modules/http-server/bin/http-server ./ -p $PORT -a $IP" 34 | }, 35 | "homepage": "", 36 | "licenses": [ 37 | { 38 | "type": "GPL V3" 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /sampleResources/pink-flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/sampleResources/pink-flower.png -------------------------------------------------------------------------------- /sampleResources/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/sampleResources/video.mp4 -------------------------------------------------------------------------------- /sampleResources/yellow-flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaronn/GifW00t/28649fc4dba97027917561c4604e21a1577f9738/sampleResources/yellow-flower.png -------------------------------------------------------------------------------- /utils/bookmarklet.js: -------------------------------------------------------------------------------- 1 | (function(anigif_base_url){ 2 | window["anigif_base_url"]=anigif_base_url; 3 | var scr=document.createElement("script"); 4 | scr.src=anigif_base_url+"anigif.min.js"; 5 | document.head.appendChild(scr); 6 | })("https://s3-us-west-2.amazonaws.com/anigif100/anigif/"); -------------------------------------------------------------------------------- /utils/s3publish.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var AWS = require('aws-sdk'); 3 | 4 | 5 | 6 | AWS.config.update({ 7 | 'httpOptions': { 8 | proxy: 'http://web-proxy.israel.hp.com:8080/' 9 | }, 10 | sslEnabled: false 11 | }); 12 | 13 | 14 | var s3 = new AWS.S3(); 15 | var dir = require('./treedir'); 16 | var mime = require('mime'); 17 | var exec = require('child_process').exec; 18 | 19 | var folder = process.argv[2] 20 | 21 | 22 | function uploadFile(file) { 23 | 24 | var child = exec('gzip -9 "' + file + '"', function (error, stdout, stderr) { 25 | if (error !== null) { 26 | throw('exec error: ' + error); 27 | } 28 | 29 | fs.readFile(file+".gz", function (err, data) { 30 | if (err) { throw err; } 31 | 32 | var obj = file.substring(folder.length+"/".length) 33 | console.log("before") 34 | s3.client.putObject({ 35 | Bucket: 'anigif100', 36 | Key: obj, 37 | Body: data, 38 | ACL:'public-read', 39 | ContentType: mime.lookup(file), 40 | ContentEncoding: "gzip" 41 | }, function (err) { 42 | console.log("after") 43 | if (err) {throw err; } 44 | console.log(file + " --> " + obj) 45 | }) 46 | 47 | }); 48 | }); 49 | } 50 | 51 | console.log("start") 52 | dir.walk(folder, function(err, results) { 53 | for (var i=0; i