├── .gitignore ├── .gitattributes ├── js ├── build │ └── .gitignore ├── src │ ├── .htaccess │ ├── module │ │ └── GradientCreatorApp.coffee │ ├── directive │ │ ├── killContextMenuArea.coffee │ │ ├── onDomReady.coffee │ │ ├── tooltip.coffee │ │ ├── prettify.coffee │ │ ├── newColorHandleClickArea.coffee │ │ ├── colorPicker.coffee │ │ ├── resizableCanvas.coffee │ │ ├── colorHandle.coffee │ │ ├── slider.coffee │ │ └── previewCanvas.coffee │ ├── model │ │ ├── ColorHandle.coffee │ │ └── GradientPreset.coffee │ └── controller │ │ └── MainCtrl.coffee ├── .htaccess ├── prettify │ ├── lang-go.js │ ├── lang-ml.js │ ├── lang-vb.js │ ├── lang-lua.js │ ├── lang-scala.js │ ├── lang-sql.js │ ├── lang-tex.js │ ├── lang-vhdl.js │ ├── lang-wiki.js │ ├── lang-apollo.js │ ├── lang-proto.js │ ├── lang-yaml.js │ ├── lang-hs.js │ ├── prettify.css │ ├── lang-lisp.js │ ├── lang-css.js │ ├── lang-n.js │ ├── lang-clj.js │ ├── sunburst.css │ ├── prettify.js │ └── lang-xq.js ├── jpicker │ ├── images │ │ ├── Bars.png │ │ ├── Maps.png │ │ ├── AlphaBar.png │ │ ├── NoColor.png │ │ ├── mappoint.gif │ │ ├── picker.gif │ │ ├── bar-opacity.png │ │ ├── map-opacity.png │ │ ├── rangearrows.gif │ │ └── preview-opacity.png │ ├── jPicker.css │ ├── ReadMe.txt │ ├── css │ │ ├── jPicker-1.1.6.min.css │ │ └── jPicker-1.1.6.css │ └── ChangeLog.txt ├── build.sh ├── local-storage │ ├── localStorageModule.min.js │ └── localStorageModule.js └── qtip │ └── jquery.qtip.min.css ├── img ├── disk.png ├── delete.png ├── canvas-bg.png ├── resizable.png ├── blog-thumb.jpg └── disk_multiple.png ├── css ├── iconic_fill.eot ├── iconic_fill.otf ├── iconic_fill.ttf ├── iconic_fill.woff ├── iconic_fill.css ├── iconic_fill.afm ├── style.css └── iconic_fill_demo.html ├── VERSION ├── LICENSE ├── test-gradient.html ├── README.md └── index.php /.gitignore: -------------------------------------------------------------------------------- 1 | Thumbs.db -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf -------------------------------------------------------------------------------- /js/build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /js/src/.htaccess: -------------------------------------------------------------------------------- 1 | Order allow,deny 2 | Deny from all -------------------------------------------------------------------------------- /js/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order allow,deny 3 | Deny from all 4 | -------------------------------------------------------------------------------- /img/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/disk.png -------------------------------------------------------------------------------- /img/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/delete.png -------------------------------------------------------------------------------- /img/canvas-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/canvas-bg.png -------------------------------------------------------------------------------- /img/resizable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/resizable.png -------------------------------------------------------------------------------- /css/iconic_fill.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/css/iconic_fill.eot -------------------------------------------------------------------------------- /css/iconic_fill.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/css/iconic_fill.otf -------------------------------------------------------------------------------- /css/iconic_fill.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/css/iconic_fill.ttf -------------------------------------------------------------------------------- /css/iconic_fill.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/css/iconic_fill.woff -------------------------------------------------------------------------------- /img/blog-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/blog-thumb.jpg -------------------------------------------------------------------------------- /img/disk_multiple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/img/disk_multiple.png -------------------------------------------------------------------------------- /js/prettify/lang-go.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-go.js -------------------------------------------------------------------------------- /js/prettify/lang-ml.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-ml.js -------------------------------------------------------------------------------- /js/prettify/lang-vb.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-vb.js -------------------------------------------------------------------------------- /js/prettify/lang-lua.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-lua.js -------------------------------------------------------------------------------- /js/prettify/lang-scala.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-scala.js -------------------------------------------------------------------------------- /js/prettify/lang-sql.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-sql.js -------------------------------------------------------------------------------- /js/prettify/lang-tex.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-tex.js -------------------------------------------------------------------------------- /js/prettify/lang-vhdl.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-vhdl.js -------------------------------------------------------------------------------- /js/prettify/lang-wiki.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-wiki.js -------------------------------------------------------------------------------- /js/jpicker/images/Bars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/Bars.png -------------------------------------------------------------------------------- /js/jpicker/images/Maps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/Maps.png -------------------------------------------------------------------------------- /js/prettify/lang-apollo.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/prettify/lang-apollo.js -------------------------------------------------------------------------------- /js/jpicker/images/AlphaBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/AlphaBar.png -------------------------------------------------------------------------------- /js/jpicker/images/NoColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/NoColor.png -------------------------------------------------------------------------------- /js/jpicker/images/mappoint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/mappoint.gif -------------------------------------------------------------------------------- /js/jpicker/images/picker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/picker.gif -------------------------------------------------------------------------------- /js/src/module/GradientCreatorApp.coffee: -------------------------------------------------------------------------------- 1 | window.GradientCreatorApp = angular.module('GradientCreatorApp', ['LocalStorageModule'], ->); -------------------------------------------------------------------------------- /js/jpicker/images/bar-opacity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/bar-opacity.png -------------------------------------------------------------------------------- /js/jpicker/images/map-opacity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/map-opacity.png -------------------------------------------------------------------------------- /js/jpicker/images/rangearrows.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/rangearrows.gif -------------------------------------------------------------------------------- /js/jpicker/images/preview-opacity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evictor/html5-canvas-gradient-creator/HEAD/js/jpicker/images/preview-opacity.png -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.0.1 2 | ===== 3 | - Fixed CoffeeScript build script line endings. 4 | - Note in readme about CS build script. 5 | 6 | 1.0 7 | === 8 | - Initial release. -------------------------------------------------------------------------------- /js/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | SCRIPT_PATH=$0 3 | SCRIPT_DIR=$(dirname $SCRIPT_PATH) 4 | BUILD_DIR=$SCRIPT_DIR"/build/" 5 | SRC_DIR=$SCRIPT_DIR"/src/" 6 | coffee -o $BUILD_DIR -cw $SRC_DIR 7 | -------------------------------------------------------------------------------- /js/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 | -------------------------------------------------------------------------------- /js/src/directive/killContextMenuArea.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Apply this to an element to prevent the right-click context menu within that element. 3 | 4 | Usage: 5 | 6 | ... 7 | ### 8 | GradientCreatorApp.directive 'killContextMenuArea', -> 9 | return (scope, elem) -> 10 | elem.bind 'contextmenu', false -------------------------------------------------------------------------------- /js/src/directive/onDomReady.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Eval's a scope expression on DOM ready. 3 | 4 | Usage: 5 | ... 6 | 7 | onDomReady - {expression} - Eval'd on scope. 8 | ### 9 | GradientCreatorApp.directive 'onDomReady', -> 10 | (scope, elem, attrs) -> 11 | jQuery -> scope.$apply attrs.onDomReady -------------------------------------------------------------------------------- /js/src/model/ColorHandle.coffee: -------------------------------------------------------------------------------- 1 | GradientCreatorApp.factory 'ColorHandle', -> 2 | class ColorHandle 3 | ### 4 | @param {String} color Color string in CSS rgba(0-255, 0-255, 0-255, 0-1) format. 5 | @param {Number} stop Value 0-1, the gradient color stop. 0 means the color appears at 0%, 0.5 means 50%, etc. 6 | ### 7 | constructor: (@color, @stop) -> -------------------------------------------------------------------------------- /js/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 | -------------------------------------------------------------------------------- /js/src/directive/tooltip.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Uses qTip and title attribute to make a tooltip. 3 | 4 | Usage: 5 | ... 6 | 7 | title - {String} - Tooltip text. 8 | tooltip - {expression} - qTip options. 9 | ### 10 | GradientCreatorApp.directive 'tooltip', -> 11 | (scope, elem, attrs) -> 12 | throw 'qTip not loaded.' if !jQuery.fn.qtip? 13 | 14 | elem.qtip scope.$eval(attrs.tooltip || '{}'); -------------------------------------------------------------------------------- /js/prettify/lang-hs.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n \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 | -------------------------------------------------------------------------------- /js/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} -------------------------------------------------------------------------------- /js/src/directive/prettify.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Basic wrapper for Mike Samuel's Prettify plugin (code syntax highlighter). Code language is inferred by Prettify. 3 | 4 | Usage: 5 |
6 | 7 | prettify - {expression} - Code to prettify (probably given as a variable or function on your scope). 8 | 9 | @link http://code.google.com/p/google-code-prettify/ 10 | ### 11 | GradientCreatorApp.directive 'prettify', ($timeout) -> 12 | scope: prettify: '=' 13 | template: '
'
14 |   link: (scope, elem, attrs) ->
15 |     $pre = elem.find 'pre'
16 | 
17 |     # Redraw on content change
18 |     scope.$watch 'prettify', (content) ->
19 |       $pre.text content
20 |       prettyPrint()


--------------------------------------------------------------------------------
/js/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 \xa0"],["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","scm"]);
4 | 


--------------------------------------------------------------------------------
/js/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["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",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/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 | 


--------------------------------------------------------------------------------
/js/jpicker/jPicker.css:
--------------------------------------------------------------------------------
 1 | @media all 
 2 | {
 3 | 	#jPicker { margin: 0px 8px; text-align: left; }
 4 | 	#jPicker ul { font-size: 15px; margin: 0px 0px 0px 15px; padding: 0px; }
 5 | 	#jPicker ul li { list-style: disc; padding: 2px 0px; }
 6 | 	#jPicker ul li ul { margin-bottom: 10px; }
 7 | 	#jPicker ul li ul li { list-style: circle; }
 8 | 	#jPicker p { font-size: 13px; padding: 0px 10px; }
 9 | 	#jPicker hr { clear: both; }
10 | 	#jPicker h2.jPicker { font-size: 16px; padding: 20px 10px; }
11 | 	#jPicker code { color: #8bd; font-size: 14px; font-weight: bold; }
12 | 	#jPicker pre { background: #eee; border: 1px solid #000; color: #000; display: block; font-size: 11px; margin: 10px 5px; padding: 5px; }
13 | 	#jPicker span { font-size: 13px; text-align: center; }
14 | 	#jPicker a { color: #ff8050; }
15 | 	#jPicker input { font-size: 13px; padding: 2px 5px; }
16 | 	#jPicker h2 { font-size: 16px; margin: 10px 0px; }
17 | }


--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
 1 | Copyright 2013 Ezekiel Victor
 2 | http://ezekielvictor.com/
 3 | 
 4 | Permission is hereby granted, free of charge, to any person obtaining
 5 | a copy of this software and associated documentation files (the
 6 | "Software"), to deal in the Software without restriction, including
 7 | without limitation the rights to use, copy, modify, merge, publish,
 8 | distribute, sublicense, and/or sell copies of the Software, and to
 9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 | 
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 | 
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | 


--------------------------------------------------------------------------------
/js/src/directive/newColorHandleClickArea.coffee:
--------------------------------------------------------------------------------
 1 | ###
 2 |   Area beneath the working canvas where you can click to add additional color handles.
 3 | 
 4 |   Usage:
 5 |     
 6 | ###
 7 | GradientCreatorApp.directive 'newColorHandleClickArea', ($document) ->
 8 |   template: ''
 9 |   link: (scope, elem) ->
10 |     # Get and hide icon
11 |     addHandleIcon = elem.find('.addHandleIcon').hide()
12 | 
13 |     # Track global mousedown/up status
14 |     mouseIsDown = false
15 |     $document.mousedown -> mouseIsDown = true
16 |     $document.mouseup -> mouseIsDown = false
17 | 
18 |     # Show icon if hovering over click area while mouse is up
19 |     elem.mouseover -> addHandleIcon.show() unless mouseIsDown
20 |     elem.mouseout -> addHandleIcon.hide()
21 |     elem.mousemove (event) -> addHandleIcon.css left: event.offsetX, top: event.offsetY - 5
22 | 
23 |     # Add color handle on left-mousedown
24 |     elem.mousedown (event) ->
25 |       leftClicked = event.which == 1
26 |       if leftClicked
27 |         scope.$apply -> scope.addColorHandle (event.pageX - elem.offset().left) / elem.width()
28 |         addHandleIcon.hide()


--------------------------------------------------------------------------------
/test-gradient.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |   
 4 |     
 5 |     Breakfast (modified)
 6 |     
11 |   
12 |   
13 |     
14 |     
38 |   
39 | 


--------------------------------------------------------------------------------
/js/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\xa0"]],[["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 | 


--------------------------------------------------------------------------------
/js/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 \xa0"],["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 | 


--------------------------------------------------------------------------------
/js/src/directive/colorPicker.coffee:
--------------------------------------------------------------------------------
 1 | ###
 2 |   Wrapper of jPicker color picker.
 3 | 
 4 |   Usage:
 5 |     
 6 | 
 7 |     colorPicker - {expression} - Options object for jPicker.
 8 |     ngModel - {expression} - Committed color will be bound to or read from this model.
 9 |     cancel - {expression} - Optional expression to eval on color picker cancel.
10 | 
11 |   Color model will always be set to rgba color or null; will only accept rgba and null input.
12 | ###
13 | GradientCreatorApp.directive 'colorPicker', ($timeout) ->
14 |   require: 'ngModel'
15 |   link: (scope, elem, attrs, ngModelCtrl) ->
16 |     domElem = elem[0]
17 | 
18 |     # Init jPicker
19 |     opts = angular.extend {images: clientPath: 'js/jpicker/images/'}, scope.$eval attrs.colorPicker
20 |     commitColor = (color) -> scope.$apply ->
21 |       rgba = color.val 'rgba'
22 |       ngModelCtrl.$setViewValue if rgba then "rgba(#{rgba.r}, #{rgba.g}, #{rgba.b}, #{rgba.a / 255})" else null
23 |     elem.jPicker opts, commitColor, null, -> if attrs.cancel? then scope.$apply -> scope.$eval attrs.cancel
24 | 
25 |     # Color model change
26 |     ngModelCtrl.$formatters.push (color) ->
27 |       if color
28 |         colorParts = color.replace(/[^\d.,]/g, '').split(',')
29 | 
30 |         rgba =
31 |           r: parseInt colorParts[0]
32 |           g: parseInt colorParts[1]
33 |           b: parseInt colorParts[2]
34 |           a: 255 * parseFloat colorParts[3]
35 |         domElem.color.active.val 'rgba', rgba
36 |         domElem.color.current.val 'rgba', rgba
37 | 
38 |     # Honor ngShow
39 |     scope.$watch attrs.ngShow, (show) -> $timeout -> elem.toggle show


--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
 1 | # Live app
 2 | 
 3 | https://zeke.blog/html5-canvas-gradient-creator-app/
 4 | 
 5 | # HTML5 Canvas Gradient Creator
 6 | 
 7 | There are plenty of CSS3 gradient creators out there, but much to my surprise there was not a single gradient creator for HTML5 `` to be found. Thus I present to you the only one of its kind, the HTML5 Canvas Gradient Creator.
 8 | 
 9 | ## Features
10 | 
11 | * Visual point-and-click, drag-and-slide creation of gradients for HTML5/JS canvas
12 | * 1-n color stops; as many as you need
13 | * 0-255 bit alpha support
14 | * Linear and radial gradients
15 | * Linear gradient rotation
16 | * Radial gradient inner and outer circle position
17 | * Elliptical radial gradients
18 | * Saving of custom presets (browser local storage)
19 | * Valid, commented HTML5 and JS code output
20 | * Responsive design
21 | 
22 | ## Minimum compatibility
23 | 
24 | This is minimum compatibility for usage of this tool, as well as for gradient code generated by this tool. Earlier versions of Chrome, Safari, or Opera might be supported.
25 | 
26 | * Chrome: WinXP/OS X SL Chrome 14
27 | * Firefox: WinXP FF4 (FF3 for gradient code generated by tool), OS X SL FF5
28 | * IE: Win7-8 IE9*
29 | * Safari: WinXP/OS X SL Saf 4
30 | * Opera: WinXP Opera 10, OS X SL Opera 11.1
31 | 
32 | \* Inclusion of FlashCanvas or excanvas might enable support for gradients in earlier versions of IE.
33 | 
34 | ## Languages and libraries
35 | 
36 | * AngularJS
37 | * CoffeeScript
38 | * jPicker color picker
39 | * prettify syntax highlighter
40 | * angular-local-storage
41 | * qTip tooltips
42 | * Iconic icons
43 | 
44 | ## Building the CoffeeScript
45 | 
46 | See js/build.sh.
47 | 


--------------------------------------------------------------------------------
/js/jpicker/ReadMe.txt:
--------------------------------------------------------------------------------
 1 | jPicker 1.1.6
 2 | 
 3 | jQuery Plugin for Photoshop style color picker
 4 | 
 5 | Copyright (c) 2010 Christopher T. Tillman
 6 | Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/)
 7 | MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE
 8 | 
 9 | Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework.
10 | 
11 | John Dyers' website: (http://johndyer.name)
12 | Color Picker page:   (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx)
13 | 
14 | 
15 |     jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects.
16 | It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.
17 | 
18 |     jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari,
19 | and Opera.
20 | 
21 |     If you are updating a current version, you MUST always use the CSS and image files from the download as
22 | there may have been changes.
23 | 
24 |     If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the
25 | Color object returned by the callback functions.
26 | 
27 | 
28 | Known Issues
29 | ______________
30 | Attaching multiple jPicker objects on a single page will slow performance.
31 |   jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.
32 | 
33 | 
34 | Coming Soon
35 | ______________
36 | 
37 |     Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.
38 | 
39 | Planned For Future Release
40 | ______________
41 | 
42 |   Move the jPicker object to a single instance that all selection instances point to.
43 |      - This will result in much faster operation and initialization for pages with multiple pickers.
44 | 
45 |   Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.
46 |   
47 |   Add multiple window modes for picker operation, include modal, popup, windowed, and exclusive.


--------------------------------------------------------------------------------
/js/prettify/sunburst.css:
--------------------------------------------------------------------------------
 1 | /* Pretty printing styles. Used with prettify.js. */
 2 | /* Vim sunburst theme by David Leibovic */
 3 | 
 4 | pre .str, code .str { color: #65B042; } /* string  - green */
 5 | pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
 6 | pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
 7 | pre .typ, code .typ { color: #89bdff; } /* type - light blue */
 8 | pre .lit, code .lit { color: #3387CC; } /* literal - blue */
 9 | pre .pun, code .pun { color: #fff; } /* punctuation - white */
10 | pre .pln, code .pln { color: #fff; } /* plaintext - white */
11 | pre .tag, code .tag { color: #89bdff; } /* html/xml tag    - light blue */
12 | pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name  - khaki */
13 | pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */
14 | pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
15 | 
16 | pre.prettyprint, code.prettyprint {
17 |         background-color: #000;
18 |         -moz-border-radius: 8px;
19 |         -webkit-border-radius: 8px;
20 |         -o-border-radius: 8px;
21 |         -ms-border-radius: 8px;
22 |         -khtml-border-radius: 8px;
23 |         border-radius: 8px;
24 | }
25 | 
26 | pre.prettyprint {
27 |         width: 95%;
28 |         margin: 1em auto;
29 |         padding: 1em;
30 |         white-space: pre-wrap;
31 | }
32 | 
33 | 
34 | /* Specify class=linenums on a pre to get line numbering */
35 | ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
36 | li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
37 | /* Alternate shading for lines */
38 | li.L1,li.L3,li.L5,li.L7,li.L9 { }
39 | 
40 | @media print {
41 |   pre .str, code .str { color: #060; }
42 |   pre .kwd, code .kwd { color: #006; font-weight: bold; }
43 |   pre .com, code .com { color: #600; font-style: italic; }
44 |   pre .typ, code .typ { color: #404; font-weight: bold; }
45 |   pre .lit, code .lit { color: #044; }
46 |   pre .pun, code .pun { color: #440; }
47 |   pre .pln, code .pln { color: #000; }
48 |   pre .tag, code .tag { color: #006; font-weight: bold; }
49 |   pre .atn, code .atn { color: #404; }
50 |   pre .atv, code .atv { color: #060; }
51 | }


--------------------------------------------------------------------------------
/js/local-storage/localStorageModule.min.js:
--------------------------------------------------------------------------------
1 | var angularLocalStorage=angular.module("LocalStorageModule",[]);angularLocalStorage.constant("prefix","ls");angularLocalStorage.constant("cookie",{expiry:30,path:"/"});
2 | angularLocalStorage.service("localStorageService",["$rootScope","prefix","cookie",function(f,d,h){"."!==d.substr(-1)&&(d=d?d+".":"");var g=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return f.$broadcast("LocalStorageModule.notification.error",a.Description),!1}},j=function(a){if(!g())return f.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),!1;try{localStorage.removeItem(d+a)}catch(b){return f.$broadcast("LocalStorageModule.notification.error",
3 | b.Description),!1}return!0},k=function(){try{return navigator.cookieEnabled||"cookie"in document&&(0 resizable by dragging in lower-right corner. It's necessary to target  specifically
 3 |   because browsers depend on width/height DOM attributes for that node type rather than CSS.
 4 | 
 5 |   Usage:
 6 |     
 9 | 
10 |     width - {model name} - Model name that will have width read from and written to.
11 |     height - {model name} - Model name that will have height read from and written to.
12 | 
13 |   A controller is provided with method drawResizeIcon() that can be called to draw a resize icon in the lower-right
14 |   corner of the canvas.
15 | ###
16 | GradientCreatorApp.directive 'resizableCanvas', ($document) ->
17 |   controller: ($element) ->
18 |     ctx = $element[0].getContext('2d')
19 | 
20 |     ###
21 |       Call this after canvas is finished rendering; a resize icon in the lower icon will be overlayed on top.
22 |     ###
23 |     @drawResizeIcon = ->
24 |       iconImage = new Image()
25 |       iconImage.src = 'img/resizable.png'
26 |       iconImage.onload = ->
27 |         ctx.setTransform 1, 0, 0, 1, 0, 0
28 |         ctx.drawImage(iconImage, $element.width() - 11, $element.height() - 11)
29 | 
30 |   link: (scope, elem, attrs) ->
31 |     # Pixel square hit area to click and drag resize in bottom-right
32 |     cornerHitAreaDim = 15
33 | 
34 |     # Min width or height of the canvas
35 |     minDim = 15
36 | 
37 |     # Keep DOM width/height up to date with model
38 |     scope.$watch attrs.width, (newWidth) -> elem.prop 'width', newWidth
39 |     scope.$watch attrs.height, (newHeight) -> elem.prop 'height', newHeight
40 | 
41 |     ###
42 |       @param {Number} offsetX Mouse offset X.
43 |       @param {Number} offsetY Mouse offset Y.
44 | 
45 |       @return {Boolean} TRUE if mouse is within resize hit area.
46 |     ###
47 |     mouseInHitArea = (offsetX, offsetY) ->
48 |       offsetX >= elem.prop('width') - cornerHitAreaDim and offsetY >= elem.prop('height') - cornerHitAreaDim
49 | 
50 |     # Track mouse down status
51 |     dragging = false
52 |     mouseDownPos = null
53 |     elem.mousedown (event) ->
54 |       if mouseInHitArea event.offsetX, event.offsetY
55 |         dragging = true
56 |         mouseDownPos = right: elem.prop('width') - event.offsetX, bottom: elem.prop('height') - event.offsetY
57 |     elem.mouseup -> dragging = false
58 | 
59 |     $document.mousemove (event) ->
60 |       if dragging or mouseInHitArea event.offsetX, event.offsetY
61 |         elem.css 'cursor', 'nw-resize'
62 |         if dragging
63 |           newWidth = (event.pageX - elem.position().left) + mouseDownPos.right
64 |           newHeight = (event.pageY - elem.position().top) + mouseDownPos.bottom
65 |           if newWidth < minDim then newWidth = minDim
66 |           if newHeight < minDim then newHeight = minDim
67 | 
68 |           # Dims actually changed
69 |           if newWidth != elem.prop('width') or newHeight != elem.prop('height')
70 |             scope.$apply ->
71 |               scope[attrs.width] = newWidth
72 |               scope[attrs.height] = newHeight
73 |       # Not dragging or mouse not in hit area
74 |       else
75 |         elem.css 'cursor', 'auto'


--------------------------------------------------------------------------------
/js/src/model/GradientPreset.coffee:
--------------------------------------------------------------------------------
 1 | ###
 2 |   Gradient preset with ID, name, color handles, persistence, etc.
 3 | 
 4 |   @param {Object} localStorageService From "LocalStorageModule".
 5 | ###
 6 | GradientCreatorApp.factory 'GradientPreset', (localStorageService) ->
 7 |   localStorageKey = 'SavedPresets'
 8 | 
 9 |   class GradientPreset
10 |     ###
11 |       @param {String}  [id=]
12 |       @param {String}  [name=]
13 |       @param {String}  gradientType       "linear" or "radial"
14 |       @param {Number}  width              Pixel width.
15 |       @param {Number}  height             Pixel height.
16 |       @param {Number}  rotate             Rotation in degrees 0-360 ("linear" gradientType only).
17 |       @param {Number}  innerCircleX       Percent from 0-100 ("radial" gradientType only).
18 |       @param {Number}  innerCircleY       Percent from 0-100 ("radial" gradientType only).
19 |       @param {Number}  outerCircleX       Percent from 0-100 ("radial" gradientType only).
20 |       @param {Number}  outerCircleY       Percent from 0-100 ("radial" gradientType only).
21 |       @param {Array}   ColorHandles       Array of ColorHandle.
22 |       @param {Boolean} [saveable=false]
23 |       @param {Boolean} [deleteable=false]
24 |       @param {Boolean} [dirty=false]
25 |     ###
26 |     constructor: (
27 |       @id
28 |       @name
29 |       @gradientType
30 |       @width
31 |       @height
32 |       @rotate
33 |       @innerCircleX
34 |       @innerCircleY
35 |       @outerCircleX
36 |       @outerCircleY
37 |       @ColorHandles
38 |       @saveable = false
39 |       @deleteable = false
40 |       @dirty = false
41 |     ) ->
42 | 
43 |     ###
44 |       @return {GradientPreset} Deep clone of this preset.
45 |     ###
46 |     clone: ->
47 |       angular.extend {}, @,
48 |         ColorHandles: (angular.extend({}, CH) for CH in @ColorHandles)
49 | 
50 |     ###
51 |       @return {Array} Array of gradient presets saved to storage.
52 |     ###
53 |     @query: ->
54 |       # Fetch from storage and convert each to this class
55 |       for presetConfig in angular.fromJson localStorageService.get(localStorageKey) ? '[]'
56 |         angular.extend(new @, presetConfig)
57 | 
58 |     ###
59 |       Saves this preset to storage.
60 |     ###
61 |     save: ->
62 |       throw "This preset isn't saveable." if not @saveable
63 | 
64 |       # Get from storage
65 |       SavedPresets = GradientPreset.query()
66 | 
67 |       # Save it over the top of preset with same ID if possible
68 |       wasSaved = false
69 |       for Preset, i in SavedPresets when Preset.id == @id
70 |         SavedPresets[i] = @
71 |         wasSaved = true
72 | 
73 |       # Didn't find one with same ID (new preset)
74 |       if !wasSaved then SavedPresets.push @
75 | 
76 |       # Save all to storage
77 |       localStorageService.add localStorageKey, angular.toJson SavedPresets
78 | 
79 |     ###
80 |       Deletes this preset from storage.
81 |     ###
82 |     delete: ->
83 |       throw "This preset isn't deleteable." if not @deleteable
84 | 
85 |       # Get from storage
86 |       SavedPresets = GradientPreset.query()
87 | 
88 |       # Remove
89 |       for Preset, i in SavedPresets when Preset.id == @id
90 |         SavedPresets.splice i, 1
91 |         break
92 | 
93 |       # Save all to storage
94 |       localStorageService.add localStorageKey, angular.toJson SavedPresets


--------------------------------------------------------------------------------
/js/src/directive/colorHandle.coffee:
--------------------------------------------------------------------------------
 1 | ###
 2 |   The little arrow color handles that you drag around to adjust the gradient.
 3 | 
 4 |   Usage:
 5 |     
 6 | ###
 7 | GradientCreatorApp.directive 'colorHandle', ($document, $timeout) ->
 8 |   return (scope, elem, attrs) ->
 9 |     container = elem.parent()
10 |     elem.addClass 'iconic'
11 | 
12 |     # Gets this color handle's color handle model
13 |     getColorHandle = -> scope.$eval attrs.colorHandle
14 | 
15 |     # Color handle model change
16 |     scope.$watch attrs.colorHandle, (ColorHandle, OldColorHandle) ->
17 |       # Update position from stop
18 |       leftExtremePercent = -3.4
19 |       rightExtremePercent = 96.7
20 |       elem.css 'left', leftExtremePercent + (ColorHandle.stop * (rightExtremePercent + Math.abs(leftExtremePercent))) + '%'
21 | 
22 |       # Valid color
23 |       if ColorHandle.color != null
24 |         elem.css 'color', ColorHandle.color
25 |       # Null color
26 |       else
27 |         # Try to delete this handle
28 |         deleted = scope.deleteColorHandle ColorHandle
29 | 
30 |         # Couldn't delete (last handle)
31 |         if !deleted
32 |           # Revert color
33 |           ColorHandle.color = OldColorHandle.color
34 |     , true
35 | 
36 |     scope.$watch 'ActiveColorHandle', (ActiveColorHandle) ->
37 |       ThisColorHandle = getColorHandle()
38 | 
39 |       # Active color handle is this one
40 |       elem.toggleClass 'arrow_up_alt1', ActiveColorHandle == ThisColorHandle
41 | 
42 |       # Active color handle is not this one
43 |       elem.toggleClass 'arrow_up', ActiveColorHandle != ThisColorHandle
44 | 
45 |     # Element draggability
46 |     mousemoveListener = null
47 |     elem.mousedown (event) ->
48 |       leftClicked = event.which == 1
49 |       if leftClicked then beginDragging()
50 | 
51 |     # Triggers dragging... should only be triggered if mouse is actually down
52 |     beginDragging = ->
53 |       ThisColorHandle = getColorHandle()
54 |       scope.$apply -> scope.setActiveColorHandle ThisColorHandle
55 |       elem.addClass 'dragging'
56 |       if not mousemoveListener then $document.mousemove mousemoveListener = (event) ->
57 |         scope.$apply ->
58 |           ThisColorHandle.stop = (event.pageX - container.position().left) / container.width()
59 |           if ThisColorHandle.stop < 0 then ThisColorHandle.stop = 0
60 |           else if ThisColorHandle.stop > 1 then ThisColorHandle.stop = 1
61 | 
62 |     # Stop dragging as appropriate
63 |     $document.mouseup ->
64 |       if elem.hasClass 'dragging'
65 |         elem.removeClass 'dragging'
66 |       if mousemoveListener != null
67 |         $document.unbind 'mousemove', mousemoveListener
68 |         mousemoveListener = null
69 | 
70 |     # Right-click to delete
71 |     elem.mouseup ->
72 |       rightClicked = event.which == 3
73 |       if rightClicked then scope.$apply -> scope.deleteColorHandle getColorHandle()
74 | 
75 |     # Instructed to force a drag immediately (such as when adding a color handle) and mouse is down.
76 |     # Timed out to ensure mouseIsDown status is up to date.
77 |     $timeout ->
78 |       ThisColorHandle = getColorHandle()
79 |       if ThisColorHandle.forceDrag and scope.getMouseIsDown()
80 |         ThisColorHandle.forceDrag = false
81 |         scope.setActiveColorHandle ThisColorHandle
82 |         beginDragging()


--------------------------------------------------------------------------------
/js/jpicker/css/jPicker-1.1.6.min.css:
--------------------------------------------------------------------------------
1 | .jPicker .Icon{display:inline-block;height:24px;position:relative;text-align:left;width:25px}.jPicker .Icon span.Color,.jPicker .Icon span.Alpha{background-position:2px 2px;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker .Icon span.Image{background-repeat:no-repeat;cursor:pointer;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker.Container{color:#000;z-index:10}table.jPicker{background-color:#efefef;border:1px outset #666;font-family:Arial,Helvetica,Sans-Serif;font-size:12px!important;margin:0;padding:5px;width:545px;z-index:20}.jPicker .Move{background-color:#ddd;border-color:#fff #666 #666 #fff;border-style:solid;border-width:1px;cursor:move;height:12px;padding:0}.jPicker .Title{font-size:11px!important;font-weight:bold;margin:-2px 0 0 0;padding:10px 0 0 0;text-align:center;width:100%}.jPicker div.Map{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:crosshair;height:260px;margin:0 10px 10px 10px;overflow:hidden;padding:0;position:relative;width:260px}.jPicker div[class="Map"]{height:256px;width:256px}.jPicker div.Bar{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:n-resize;height:260px;margin:12px 10px 0 5px;overflow:hidden;padding:0;position:relative;width:24px}.jPicker div[class="Bar"]{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3,.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4,.jPicker .Bar .Map5,.jPicker .Bar .Map6{background-color:transparent;background-image:none;display:block;left:0;position:absolute;top:0}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3{height:2596px;width:256px}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{height:3896px;width:20px}.jPicker .Bar .Map5,.jPicker .Bar .Map6{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Bar .Map6{background-repeat:no-repeat}.jPicker .Map .Map3,.jPicker .Bar .Map5{background-repeat:repeat}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{background-repeat:repeat-x}.jPicker .Map .Arrow{display:block;position:absolute}.jPicker .Bar .Arrow{display:block;left:0;position:absolute}.jPicker .Preview{font-size:9px;padding:5px 0 0 0;text-align:center}.jPicker .Preview div{border:2px inset #eee;height:62px;margin:0 auto;padding:0;width:62px}.jPicker .Preview div span{border:1px solid #000;display:block;height:30px;margin:0 auto;padding:0;width:60px}.jPicker .Preview .Active{border-bottom-width:0}.jPicker .Preview .Current{border-top-width:0;cursor:pointer}.jPicker input{font-size:13px}.jPicker .Button{text-align:center;padding:0 4px;width:115px}.jPicker .Button input{padding:2px 0;width:100px}.jPicker .Button .Ok{margin:12px 0 5px 0}.jPicker td{margin:0;padding:0}.jPicker td.Radio{margin:0;padding:0;width:31px}.jPicker td.Radio input{margin:0 5px 0 0;padding:0}.jPicker td.Text{font-size:12px!important;height:22px;margin:0;padding:0;text-align:left;width:70px}.jPicker tr.Hex td.Text{width:100px}.jPicker td.Text input{background-color:#fff;border:1px inset #aaa;height:19px;margin:0 0 0 5px;text-align:left;width:30px}.jPicker td[class="Text"] input{height:15px}.jPicker tr.Hex td.Text input.Hex{width:50px}.jPicker tr.Hex td.Text input.AHex{width:20px}.jPicker .Grid{text-align:center;width:114px}.jPicker .Grid span.QuickColor{border:1px inset #aaa;cursor:pointer;display:inline-block;height:15px;line-height:15px;margin:0;padding:0;width:19px}.jPicker .Grid span[class="QuickColor"]{width:17px}


--------------------------------------------------------------------------------
/js/src/directive/slider.coffee:
--------------------------------------------------------------------------------
  1 | ###
  2 |   Horizontal slider.
  3 | 
  4 |   Usage:
  5 |     
6 | 7 | value - {expression} - Model to bind slider value to. 8 | min - {Number} - Slider value at leftmost position. 9 | max - {Number} - Slider value at rightmost position. 10 | precision - {int} - Number of places after decimal to keep in value, 0-20 per limits of Number.toFixed(). 11 | ### 12 | GradientCreatorApp.directive 'slider', ($timeout, $document) -> 13 | scope: 14 | value: '=' 15 | handleLeft: '@' 16 | template: '
' 17 | replace: false 18 | link: (scope, elem, attrs) -> 19 | min = max = precision = handleLeft = rawValue = null 20 | $handle = elem.find '.handle' 21 | 22 | # Keep min/max/round up to date 23 | scope.$watch attrs.min, (watched) -> min = parseFloat watched; if scope.value < min then scope.value = min 24 | scope.$watch attrs.max, (watched) -> max = parseFloat watched; if scope.value > max then scope.value = max 25 | scope.$watch attrs.precision, (watched) -> 26 | precision = watched 27 | if rawValue? 28 | scope.value = parseFloat(rawValue).toFixed precision 29 | 30 | ### 31 | Update slider value directly. 32 | ### 33 | updateSliderValue = (newValue) -> 34 | # Fix precision and bounds 35 | newValue = parseFloat newValue 36 | scope.value = switch 37 | when newValue < min then min 38 | when newValue > max then max 39 | else newValue 40 | scope.value = parseFloat scope.value.toFixed precision 41 | 42 | # Keep slider up to date with value 43 | minLeft = 0 44 | maxLeft = 100 45 | init = true 46 | scope.$watch 'value', (rawValue, oldValue) -> 47 | if rawValue? and (rawValue != oldValue or init) 48 | updateSliderValue rawValue 49 | scope.handleLeft = minLeft + (maxLeft - minLeft) * (rawValue - min) / (max - min) + '%' 50 | init = false 51 | 52 | # Init value if needed 53 | if !scope.value? 54 | $timeout -> scope.value = min 55 | 56 | ### 57 | Updates handle left pos to correspond with mouse pageX. 58 | ### 59 | updateHandleLeftFromMouse = (mousePageX) -> 60 | scope.handleLeft = minLeft + (maxLeft - minLeft) * (mousePageX - elem.position().left) / elem.width() 61 | if scope.handleLeft < minLeft then scope.handleLeft = minLeft 62 | else if scope.handleLeft > maxLeft then scope.handleLeft = maxLeft 63 | scope.handleLeft += '%' 64 | 65 | ### 66 | Update slider value to correspond with mouse pageX. 67 | ### 68 | updateValueFromMouse = (mousePageX) -> 69 | scope.value = min + (max - min) * (mousePageX - elem.position().left) / elem.width() 70 | if scope.value < min then scope.value = min 71 | else if scope.value > max then scope.value = max 72 | scope.value = parseFloat scope.value.toFixed precision 73 | 74 | # Handle draggability 75 | mousemoveListener = null 76 | $handle.mousedown (e) -> 77 | $timeout -> $handle.focus() 78 | $document.mousemove mousemoveListener = (event) -> 79 | scope.$apply -> 80 | updateHandleLeftFromMouse event.pageX 81 | updateValueFromMouse event.pageX 82 | if e.immediateUpdate then mousemoveListener(e) 83 | false 84 | $document.mouseup -> 85 | if mousemoveListener != null 86 | $document.unbind 'mousemove', mousemoveListener 87 | mousemoveListener = null 88 | 89 | # Slider bar mousedown 90 | elem.mousedown (e) -> 91 | # Simulate handle mousedown for dragging + immediate update 92 | $handle.trigger jQuery.Event 'mousedown', 93 | pageX: e.pageX 94 | immediateUpdate: true 95 | 96 | ### 97 | Update value by a percent-of-range delta. 98 | @param {Number} percentDelta Floating point percent from 0-1. 99 | ### 100 | updateValueByPercentDelta = (percentDelta) -> 101 | updateSliderValue parseFloat(scope.value) + percentDelta * (max - min) 102 | 103 | # Handle keypress 104 | $handle.keydown (e) -> 105 | switch e.which 106 | # UP or RIGHT 107 | when 38, 39 then scope.$apply -> updateValueByPercentDelta 0.01 108 | # DOWN or LEFT 109 | when 40, 37 then scope.$apply -> updateValueByPercentDelta -0.01 110 | # HOME 111 | when 36 then scope.$apply -> updateSliderValue min 112 | # END 113 | when 35 then scope.$apply -> updateSliderValue max 114 | # PAGE UP 115 | when 33 then scope.$apply -> updateValueByPercentDelta -0.1 116 | # PAGE DOWN 117 | when 34 then scope.$apply -> updateValueByPercentDelta 0.1 118 | else didntHandleKey = true 119 | 120 | e.preventDefault() unless didntHandleKey? and didntHandleKey -------------------------------------------------------------------------------- /css/iconic_fill.css: -------------------------------------------------------------------------------- 1 | @font-face { font-family: 'IconicFill'; src: url('iconic_fill.eot'); src: url('iconic_fill.eot?#iefix') format('embedded-opentype'), url('iconic_fill.ttf') format('truetype'), url('iconic_fill.svg#iconic') format('svg'); font-weight: normal; font-style: normal; }.iconic { display:inline-block; font-family: 'IconicFill'; }.lightbulb:before {content:'\e063';}.equalizer:before {content:'\e052';}.brush_alt:before {content:'\e01c';}.move:before {content:'\e03e';}.tag_fill:before {content:'\e02b';}.book_alt2:before {content:'\e06a';}.layers:before {content:'\e01f';}.chat_alt_fill:before {content:'\e007';}.layers_alt:before {content:'\e020';}.cloud_upload:before {content:'\e045';}.chart_alt:before {content:'\e029';}.fullscreen_exit_alt:before {content:'\e051';}.cloud_download:before {content:'\e044';}.paperclip:before {content:'\e08a';}.heart_fill:before {content:'\2764';}.mail:before {content:'\2709';}.pen_alt_fill:before {content:'\e005';}.check_alt:before {content:'\2718';}.battery_charging:before {content:'\e05d';}.lock_fill:before {content:'\e075';}.stop:before {content:'\e04a';}.arrow_up:before {content:'\2191';}.move_horizontal:before {content:'\e038';}.compass:before {content:'\e021';}.minus_alt:before {content:'\e009';}.battery_empty:before {content:'\e05c';}.comment_fill:before {content:'\e06d';}.map_pin_alt:before {content:'\e002';}.question_mark:before {content:'\003f';}.list:before {content:'\e055';}.upload:before {content:'\e043';}.reload:before {content:'\e030';}.loop_alt4:before {content:'\e035';}.loop_alt3:before {content:'\e034';}.loop_alt2:before {content:'\e033';}.loop_alt1:before {content:'\e032';}.left_quote:before {content:'\275d';}.x:before {content:'\2713';}.last:before {content:'\e04d';}.bars:before {content:'\e06f';}.arrow_left:before {content:'\2190';}.arrow_down:before {content:'\2193';}.download:before {content:'\e042';}.home:before {content:'\2302';}.calendar:before {content:'\e001';}.right_quote_alt:before {content:'\e012';}.unlock_fill:before {content:'\e076';}.fullscreen:before {content:'\e04e';}.dial:before {content:'\e058';}.plus_alt:before {content:'\e008';}.clock:before {content:'\e079';}.movie:before {content:'\e060';}.steering_wheel:before {content:'\e024';}.pen:before {content:'\270e';}.pin:before {content:'\e067';}.denied:before {content:'\26d4';}.left_quote_alt:before {content:'\e011';}.volume_mute:before {content:'\e071';}.umbrella:before {content:'\2602';}.list_nested:before {content:'\e056';}.arrow_up_alt1:before {content:'\e014';}.undo:before {content:'\e02f';}.pause:before {content:'\e049';}.bolt:before {content:'\26a1';}.article:before {content:'\e053';}.read_more:before {content:'\e054';}.beaker:before {content:'\e023';}.beaker_alt:before {content:'\e010';}.battery_full:before {content:'\e073';}.arrow_right:before {content:'\2192';}.iphone:before {content:'\e06e';}.arrow_up_alt2:before {content:'\e018';}.cog:before {content:'\2699';}.award_fill:before {content:'\e022';}.first:before {content:'\e04c';}.trash_fill:before {content:'\e05a';}.image:before {content:'\e027';}.comment_alt1_fill:before {content:'\e003';}.cd:before {content:'\e064';}.right_quote:before {content:'\275e';}.brush:before {content:'\e01b';}.cloud:before {content:'\2601';}.eye:before {content:'\e025';}.play_alt:before {content:'\e048';}.transfer:before {content:'\e041';}.pen_alt2:before {content:'\e006';}.camera:before {content:'\e070';}.move_horizontal_alt2:before {content:'\e03a';}.curved_arrow:before {content:'\2935';}.move_horizontal_alt1:before {content:'\e039';}.aperture:before {content:'\e026';}.reload_alt:before {content:'\e031';}.magnifying_glass:before {content:'\e074';}.calendar_alt_fill:before {content:'\e06c';}.fork:before {content:'\e046';}.box:before {content:'\e06b';}.map_pin_fill:before {content:'\e068';}.bars_alt:before {content:'\e00a';}.volume:before {content:'\e072';}.x_alt:before {content:'\2714';}.link:before {content:'\e077';}.move_vertical:before {content:'\e03b';}.eyedropper:before {content:'\e01e';}.spin:before {content:'\e036';}.rss:before {content:'\e02c';}.info:before {content:'\2139';}.target:before {content:'\e02a';}.cursor:before {content:'\e057';}.key_fill:before {content:'\26bf';}.minus:before {content:'\2796';}.book_alt:before {content:'\e00b';}.headphones:before {content:'\e061';}.hash:before {content:'\0023';}.arrow_left_alt1:before {content:'\e013';}.arrow_left_alt2:before {content:'\e017';}.fullscreen_exit:before {content:'\e050';}.share:before {content:'\e02e';}.fullscreen_alt:before {content:'\e04f';}.comment_alt2_fill:before {content:'\e004';}.moon_fill:before {content:'\263e';}.at:before {content:'\0040';}.chat:before {content:'\e05e';}.move_vertical_alt2:before {content:'\e03d';}.move_vertical_alt1:before {content:'\e03c';}.check:before {content:'\2717';}.mic:before {content:'\e05f';}.book:before {content:'\e069';}.move_alt1:before {content:'\e03f';}.move_alt2:before {content:'\e040';}.document_fill:before {content:'\e066';}.plus:before {content:'\2795';}.wrench:before {content:'\e078';}.play:before {content:'\e047';}.star:before {content:'\2605';}.document_alt_fill:before {content:'\e000';}.chart:before {content:'\e028';}.rain:before {content:'\26c6';}.folder_fill:before {content:'\e065';}.new_window:before {content:'\e059';}.user:before {content:'\e062';}.battery_half:before {content:'\e05b';}.aperture_alt:before {content:'\e00c';}.eject:before {content:'\e04b';}.arrow_down_alt1:before {content:'\e016';}.pilcrow:before {content:'\00b6';}.arrow_down_alt2:before {content:'\e01a';}.arrow_right_alt1:before {content:'\e015';}.arrow_right_alt2:before {content:'\e019';}.rss_alt:before {content:'\e02d';}.spin_alt:before {content:'\e037';}.sun_fill:before {content:'\2600';} -------------------------------------------------------------------------------- /js/jpicker/css/jPicker-1.1.6.css: -------------------------------------------------------------------------------- 1 | .jPicker .Icon { 2 | display: inline-block; 3 | height: 24px; /* change this value if using a different sized color picker icon */ 4 | position: relative; /* make this element an absolute positioning container */ 5 | text-align: left; /* make the zero width children position to the left of container */ 6 | width: 25px; /* change this value if using a different sized color picker icon */ 7 | } 8 | .jPicker .Icon span.Color, .jPicker .Icon span.Alpha { 9 | background-position: 2px 2px; 10 | display: block; 11 | height: 100%; 12 | left: 0px; 13 | position: absolute; 14 | top: 0px; 15 | width: 100%; 16 | } 17 | .jPicker .Icon span.Image { 18 | background-repeat: no-repeat; 19 | cursor: pointer; 20 | display: block; 21 | height: 100%; 22 | left: 0px; 23 | position: absolute; 24 | top: 0px; 25 | width: 100%; 26 | } 27 | .jPicker.Container { 28 | color: #000; 29 | z-index: 10; 30 | } 31 | table.jPicker { 32 | background-color: #efefef; 33 | border: 1px outset #666; 34 | font-family: Arial, Helvetica, Sans-Serif; 35 | font-size: 12px !important; 36 | margin: 0px; 37 | padding: 5px; 38 | width: 545px; 39 | z-index: 20; 40 | } 41 | .jPicker .Move { 42 | background-color: #dddddd; 43 | border-color: #fff #666 #666 #fff; 44 | border-style: solid; 45 | border-width: 1px; 46 | cursor: move; 47 | height: 12px; 48 | padding: 0px; 49 | } 50 | .jPicker .Title { 51 | font-size: 11px !important; 52 | font-weight: bold; 53 | margin: -2px 0px 0px 0px; 54 | padding: 10px 0px 0px 0px; 55 | text-align: center; 56 | width: 100%; 57 | } 58 | .jPicker div.Map { 59 | border-bottom: 2px solid #fff; 60 | border-left: 2px solid #9a9a9a; 61 | border-right: 2px solid #fff; 62 | border-top: 2px solid #9a9a9a; 63 | cursor: crosshair; 64 | height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ 65 | margin: 0px 10px 10px 10px; 66 | overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */ 67 | padding: 0px; 68 | position: relative; /* make this element an absolute positioning container */ 69 | width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ 70 | } 71 | .jPicker div[class="Map"] { 72 | height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ 73 | width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ 74 | } 75 | .jPicker div.Bar { 76 | border-bottom: 2px solid #fff; 77 | border-left: 2px solid #9a9a9a; 78 | border-right: 2px solid #fff; 79 | border-top: 2px solid #9a9a9a; 80 | cursor: n-resize; 81 | height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ 82 | margin: 12px 10px 0px 5px; 83 | overflow: hidden; 84 | padding: 0px; 85 | position: relative; 86 | width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ 87 | } 88 | .jPicker div[class="Bar"] { 89 | height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ 90 | width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ 91 | } 92 | .jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Map .Map3, .jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4, .jPicker .Bar .Map5, .jPicker .Bar .Map6 { 93 | background-color: transparent; 94 | background-image: none; 95 | display: block; 96 | left: 0px; 97 | position: absolute; 98 | top: 0px; 99 | } 100 | .jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Map .Map3 { 101 | height: 2596px; 102 | width: 256px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar 103 | would not be drawn if its overflow is set to hidden. */ 104 | } 105 | .jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 { 106 | height: 3896px; 107 | width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar 108 | would not be drawn if its overflow is set to hidden. */ 109 | } 110 | .jPicker .Bar .Map5, .jPicker .Bar .Map6 { 111 | height: 256px; 112 | width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar 113 | would not be drawn if its overflow is set to hidden. */ 114 | } 115 | .jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Bar .Map6 { 116 | background-repeat: no-repeat; 117 | } 118 | .jPicker .Map .Map3, .jPicker .Bar .Map5 { 119 | background-repeat: repeat; 120 | } 121 | .jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 { 122 | background-repeat: repeat-x; 123 | } 124 | .jPicker .Map .Arrow { 125 | display: block; 126 | position: absolute; 127 | } 128 | .jPicker .Bar .Arrow { 129 | display: block; 130 | left: 0px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */ 131 | position: absolute; 132 | } 133 | .jPicker .Preview { 134 | font-size: 9px; 135 | padding: 5px 0px 0px 0px; 136 | text-align: center; 137 | } 138 | .jPicker .Preview div { 139 | border: 2px inset #eee; 140 | height: 62px; 141 | margin: 0px auto; 142 | padding: 0px; 143 | width: 62px; 144 | } 145 | .jPicker .Preview div span { 146 | border: 1px solid #000; 147 | display: block; 148 | height: 30px; 149 | margin: 0px auto; 150 | padding: 0px; 151 | width: 60px; 152 | } 153 | .jPicker .Preview .Active { 154 | border-bottom-width: 0px; 155 | } 156 | .jPicker .Preview .Current { 157 | border-top-width: 0px; 158 | cursor: pointer; 159 | } 160 | .jPicker input { 161 | font-size: 13px; 162 | } 163 | .jPicker .Button { 164 | text-align: center; 165 | padding: 0px 4px; 166 | width: 115px; 167 | } 168 | .jPicker .Button input { 169 | padding: 2px 0px; 170 | width: 100px; 171 | } 172 | .jPicker .Button .Ok { 173 | margin: 12px 0px 5px 0px; 174 | } 175 | .jPicker td { 176 | margin: 0px; 177 | padding: 0px; 178 | } 179 | .jPicker td.Radio { 180 | margin: 0px; 181 | padding: 0px; 182 | width: 31px; 183 | } 184 | .jPicker td.Radio input { 185 | margin: 0px 5px 0px 0px; 186 | padding: 0px; 187 | } 188 | .jPicker td.Text { 189 | font-size: 12px !important; 190 | height: 22px; 191 | margin: 0px; 192 | padding: 0px; 193 | text-align: left; 194 | width: 70px; 195 | } 196 | .jPicker tr.Hex td.Text { 197 | width: 100px; 198 | } 199 | .jPicker td.Text input { 200 | background-color: #fff; 201 | border: 1px inset #aaa; 202 | height: 19px; 203 | margin: 0px 0px 0px 5px; 204 | text-align: left; 205 | width: 30px; 206 | } 207 | .jPicker td[class="Text"] input { 208 | height: 15px; 209 | } 210 | .jPicker tr.Hex td.Text input.Hex { 211 | width: 50px; 212 | } 213 | .jPicker tr.Hex td.Text input.AHex { 214 | width: 20px; 215 | } 216 | .jPicker .Grid { 217 | text-align: center; 218 | width: 114px; 219 | } 220 | .jPicker .Grid span.QuickColor { 221 | border: 1px inset #aaa; 222 | cursor: pointer; 223 | display: inline-block; 224 | height: 15px; 225 | line-height: 15px; 226 | margin: 0px; 227 | padding: 0px; 228 | width: 19px; 229 | } 230 | .jPicker .Grid span[class="QuickColor"] { 231 | width: 17px; 232 | } -------------------------------------------------------------------------------- /js/local-storage/localStorageModule.js: -------------------------------------------------------------------------------- 1 | /* Start angularLocalStorage */ 2 | 3 | var angularLocalStorage = angular.module('LocalStorageModule', []); 4 | 5 | // You should set a prefix to avoid overwriting any local storage variables from the rest of your app 6 | // e.g. angularLocalStorage.constant('prefix', 'youAppName'); 7 | angularLocalStorage.constant('prefix', 'ls'); 8 | // Cookie options (usually in case of fallback) 9 | // expiry = Number of days before cookies expire // 0 = Does not expire 10 | // path = The web path the cookie represents 11 | angularLocalStorage.constant('cookie', { expiry:30, path: '/'}); 12 | 13 | angularLocalStorage.service('localStorageService', [ 14 | '$rootScope', 15 | 'prefix', 16 | 'cookie', 17 | function($rootScope, prefix, cookie) { 18 | 19 | // If there is a prefix set in the config lets use that with an appended period for readability 20 | //var prefix = angularLocalStorage.constant; 21 | if (prefix.substr(-1)!=='.') { 22 | prefix = !!prefix ? prefix + '.' : ''; 23 | } 24 | 25 | // Checks the browser to see if local storage is supported 26 | var browserSupportsLocalStorage = function () { 27 | try { 28 | return ('localStorage' in window && window['localStorage'] !== null); 29 | } catch (e) { 30 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 31 | return false; 32 | } 33 | }; 34 | 35 | // Directly adds a value to local storage 36 | // If local storage is not available in the browser use cookies 37 | // Example use: localStorageService.add('library','angular'); 38 | var addToLocalStorage = function (key, value) { 39 | 40 | // If this browser does not support local storage use cookies 41 | if (!browserSupportsLocalStorage()) { 42 | $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); 43 | return false; 44 | } 45 | 46 | // 0 and "" is allowed as a value but let's limit other falsey values like "undefined" 47 | if (!value && value!==0 && value!=="") return false; 48 | 49 | try { 50 | localStorage.setItem(prefix+key, value); 51 | } catch (e) { 52 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 53 | return false; 54 | } 55 | return true; 56 | }; 57 | 58 | // Directly get a value from local storage 59 | // Example use: localStorageService.get('library'); // returns 'angular' 60 | var getFromLocalStorage = function (key) { 61 | if (!browserSupportsLocalStorage()) { 62 | $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); 63 | return false; 64 | } 65 | 66 | var item = localStorage.getItem(prefix+key); 67 | if (!item) return null; 68 | return item; 69 | }; 70 | 71 | // Remove an item from local storage 72 | // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' 73 | var removeFromLocalStorage = function (key) { 74 | if (!browserSupportsLocalStorage()) { 75 | $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); 76 | return false; 77 | } 78 | 79 | try { 80 | localStorage.removeItem(prefix+key); 81 | } catch (e) { 82 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 83 | return false; 84 | } 85 | return true; 86 | }; 87 | 88 | // Remove all data for this app from local storage 89 | // Example use: localStorageService.clearAll(); 90 | // Should be used mostly for development purposes 91 | var clearAllFromLocalStorage = function () { 92 | 93 | if (!browserSupportsLocalStorage()) { 94 | $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); 95 | return false; 96 | } 97 | 98 | var prefixLength = prefix.length; 99 | 100 | for (var key in localStorage) { 101 | // Only remove items that are for this app 102 | if (key.substr(0,prefixLength) === prefix) { 103 | try { 104 | removeFromLocalStorage(key.substr(prefixLength)); 105 | } catch (e) { 106 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 107 | return false; 108 | } 109 | } 110 | } 111 | return true; 112 | }; 113 | 114 | // Checks the browser to see if cookies are supported 115 | var browserSupportsCookies = function() { 116 | try { 117 | return navigator.cookieEnabled || 118 | ("cookie" in document && (document.cookie.length > 0 || 119 | (document.cookie = "test").indexOf.call(document.cookie, "test") > -1)); 120 | } catch (e) { 121 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 122 | return false; 123 | } 124 | } 125 | 126 | // Directly adds a value to cookies 127 | // Typically used as a fallback is local storage is not available in the browser 128 | // Example use: localStorageService.cookie.add('library','angular'); 129 | var addToCookies = function (key, value) { 130 | 131 | if (typeof value == "undefined") return false; 132 | 133 | if (!browserSupportsCookies()) { 134 | $rootScope.$broadcast('LocalStorageModule.notification.error','COOKIES_NOT_SUPPORTED'); 135 | return false; 136 | } 137 | 138 | try { 139 | var expiry = '', expiryDate = new Date(); 140 | if (value === null) { 141 | cookie.expiry = -1; 142 | value = ''; 143 | } 144 | if (cookie.expiry !== 0) { 145 | expiryDate.setTime(expiryDate.getTime() + (cookie.expiry*24*60*60*1000)); 146 | expiry = "; expires="+expiryDate.toGMTString(); 147 | } 148 | document.cookie = prefix + key + "=" + encodeURIComponent(value) + expiry + "; path="+cookie.path; 149 | } catch (e) { 150 | $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); 151 | return false; 152 | } 153 | return true; 154 | }; 155 | 156 | // Directly get a value from a cookie 157 | // Example use: localStorageService.cookie.get('library'); // returns 'angular' 158 | var getFromCookies = function (key) { 159 | if (!browserSupportsCookies()) { 160 | $rootScope.$broadcast('LocalStorageModule.notification.error','COOKIES_NOT_SUPPORTED'); 161 | return false; 162 | } 163 | 164 | var cookies = document.cookie.split(';'); 165 | for(var i=0;i < cookies.length;i++) { 166 | var thisCookie = cookies[i]; 167 | while (thisCookie.charAt(0)==' ') { 168 | thisCookie = thisCookie.substring(1,thisCookie.length); 169 | } 170 | if (thisCookie.indexOf(prefix+key+'=') == 0) { 171 | return decodeURIComponent(thisCookie.substring(prefix.length+key.length+1,thisCookie.length)); 172 | } 173 | } 174 | return null; 175 | }; 176 | 177 | var removeFromCookies = function (key) { 178 | addToCookies(key,null); 179 | } 180 | 181 | var clearAllFromCookies = function () { 182 | var thisCookie = null, thisKey = null; 183 | var prefixLength = prefix.length; 184 | var cookies = document.cookie.split(';'); 185 | for(var i=0;i < cookies.length;i++) { 186 | thisCookie = cookies[i]; 187 | while (thisCookie.charAt(0)==' ') { 188 | thisCookie = thisCookie.substring(1,thisCookie.length); 189 | } 190 | key = thisCookie.substring(prefixLength,thisCookie.indexOf('=')); 191 | removeFromCookies(key); 192 | } 193 | } 194 | 195 | 196 | return { 197 | isSupported: browserSupportsLocalStorage, 198 | add: addToLocalStorage, 199 | get: getFromLocalStorage, 200 | remove: removeFromLocalStorage, 201 | clearAll: clearAllFromLocalStorage, 202 | cookie: { 203 | add: addToCookies, 204 | get: getFromCookies, 205 | remove: removeFromCookies, 206 | clearAll: clearAllFromCookies 207 | } 208 | }; 209 | 210 | }]); 211 | -------------------------------------------------------------------------------- /css/iconic_fill.afm: -------------------------------------------------------------------------------- 1 | StartFontMetrics 2.0 2 | Comment Generated by FontForge 20110222 3 | Comment Creation Date: Sun Apr 1 19:42:26 2012 4 | FontName IconicFill 5 | FullName Iconic Fill 6 | FamilyName Iconic 7 | Weight Medium 8 | Notice (Icons by PJ Onori, font creation script by Yann) 9 | ItalicAngle 0 10 | IsFixedPitch false 11 | UnderlinePosition -100 12 | UnderlineThickness 50 13 | Version 001.000 14 | EncodingScheme ISOLatin1Encoding 15 | FontBBox 14 -14 760 731 16 | Descender -2147483648 17 | StartCharMetrics 151 18 | C 35 ; WX 681 ; N numbersign ; B 15 -14 667 731 ; 19 | C 63 ; WX 402 ; N question ; B 15 -14 388 731 ; 20 | C 64 ; WX 774 ; N at ; B 15 -14 760 731 ; 21 | C 182 ; WX 588 ; N paragraph ; B 15 -14 574 731 ; 22 | C -1 ; WX 495 ; N glyph0 ; B 15 -14 481 731 ; 23 | C -1 ; WX 774 ; N glyph1 ; B 15 -14 760 731 ; 24 | C -1 ; WX 774 ; N glyph2 ; B 15 -14 760 731 ; 25 | C -1 ; WX 774 ; N glyph3 ; B 15 -14 760 731 ; 26 | C -1 ; WX 774 ; N glyph4 ; B 15 -14 760 731 ; 27 | C -1 ; WX 774 ; N glyph5 ; B 15 32 760 684 ; 28 | C -1 ; WX 774 ; N glyph6 ; B 15 32 760 684 ; 29 | C -1 ; WX 774 ; N glyph7 ; B 15 -14 760 731 ; 30 | C -1 ; WX 774 ; N glyph8 ; B 15 -14 760 731 ; 31 | C -1 ; WX 774 ; N glyph9 ; B 15 -14 760 731 ; 32 | C -1 ; WX 728 ; N glyph10 ; B 14 -14 713 731 ; 33 | C -1 ; WX 774 ; N glyph11 ; B 15 -14 760 731 ; 34 | C -1 ; WX 774 ; N glyph12 ; B 15 -14 760 731 ; 35 | C -1 ; WX 681 ; N glyph13 ; B 15 -14 667 730 ; 36 | C -1 ; WX 774 ; N glyph14 ; B 15 32 760 684 ; 37 | C -1 ; WX 774 ; N glyph15 ; B 15 79 760 638 ; 38 | C -1 ; WX 774 ; N glyph16 ; B 15 -14 760 731 ; 39 | C -1 ; WX 774 ; N glyph17 ; B 15 -14 760 731 ; 40 | C -1 ; WX 774 ; N glyph18 ; B 15 172 760 545 ; 41 | C -1 ; WX 588 ; N glyph19 ; B 15 -14 574 731 ; 42 | C -1 ; WX 774 ; N glyph20 ; B 15 -14 760 731 ; 43 | C -1 ; WX 774 ; N glyph21 ; B 15 -14 760 731 ; 44 | C -1 ; WX 774 ; N glyph22 ; B 15 218 760 498 ; 45 | C -1 ; WX 774 ; N glyph23 ; B 15 -14 760 731 ; 46 | C -1 ; WX 774 ; N glyph24 ; B 15 -14 760 731 ; 47 | C -1 ; WX 774 ; N glyph25 ; B 15 172 760 545 ; 48 | C -1 ; WX 774 ; N glyph26 ; B 15 32 760 684 ; 49 | C -1 ; WX 402 ; N glyph27 ; B 15 -14 388 731 ; 50 | C -1 ; WX 774 ; N glyph29 ; B 15 32 760 684 ; 51 | C -1 ; WX 588 ; N glyph30 ; B 15 -14 574 731 ; 52 | C -1 ; WX 588 ; N glyph31 ; B 15 32 574 684 ; 53 | C -1 ; WX 774 ; N glyph32 ; B 15 79 760 638 ; 54 | C -1 ; WX 774 ; N glyph33 ; B 15 79 760 638 ; 55 | C -1 ; WX 774 ; N glyph34 ; B 15 32 760 684 ; 56 | C -1 ; WX 774 ; N glyph35 ; B 15 79 760 638 ; 57 | C -1 ; WX 774 ; N glyph36 ; B 15 79 760 638 ; 58 | C -1 ; WX 681 ; N glyph37 ; B 15 32 667 684 ; 59 | C -1 ; WX 774 ; N glyph38 ; B 15 -14 760 731 ; 60 | C -1 ; WX 774 ; N glyph39 ; B 15 -14 760 731 ; 61 | C -1 ; WX 774 ; N glyph40 ; B 15 -14 760 731 ; 62 | C -1 ; WX 774 ; N glyph41 ; B 15 -14 760 731 ; 63 | C -1 ; WX 588 ; N glyph42 ; B 15 -14 574 731 ; 64 | C -1 ; WX 774 ; N glyph43 ; B 15 -14 760 731 ; 65 | C -1 ; WX 774 ; N glyph44 ; B 15 -14 760 731 ; 66 | C -1 ; WX 774 ; N glyph45 ; B 15 79 760 638 ; 67 | C -1 ; WX 588 ; N glyph46 ; B 15 -14 574 731 ; 68 | C -1 ; WX 774 ; N glyph47 ; B 15 -14 760 731 ; 69 | C -1 ; WX 774 ; N glyph48 ; B 15 -12 760 729 ; 70 | C -1 ; WX 774 ; N glyph49 ; B 15 -14 760 731 ; 71 | C -1 ; WX 774 ; N glyph50 ; B 15 -14 760 731 ; 72 | C -1 ; WX 774 ; N glyph51 ; B 15 -14 760 731 ; 73 | C -1 ; WX 774 ; N glyph52 ; B 15 -14 760 731 ; 74 | C -1 ; WX 774 ; N glyph53 ; B 15 -14 760 731 ; 75 | C -1 ; WX 774 ; N glyph54 ; B 15 -14 760 731 ; 76 | C -1 ; WX 774 ; N glyph55 ; B 15 -14 760 731 ; 77 | C -1 ; WX 774 ; N glyph56 ; B 15 79 760 638 ; 78 | C -1 ; WX 774 ; N glyph57 ; B 15 79 760 638 ; 79 | C -1 ; WX 774 ; N glyph58 ; B 15 -14 760 731 ; 80 | C -1 ; WX 774 ; N glyph59 ; B 15 32 760 684 ; 81 | C -1 ; WX 774 ; N glyph60 ; B 15 -14 760 731 ; 82 | C -1 ; WX 774 ; N glyph61 ; B 15 -14 760 731 ; 83 | C -1 ; WX 588 ; N glyph62 ; B 15 -14 574 731 ; 84 | C -1 ; WX 774 ; N glyph63 ; B 15 -14 760 731 ; 85 | C -1 ; WX 774 ; N glyph64 ; B 15 -14 760 731 ; 86 | C -1 ; WX 774 ; N glyph65 ; B 15 -14 760 731 ; 87 | C -1 ; WX 402 ; N glyph66 ; B 15 -14 388 731 ; 88 | C -1 ; WX 402 ; N glyph67 ; B 15 -14 388 731 ; 89 | C -1 ; WX 774 ; N glyph68 ; B 15 172 760 545 ; 90 | C -1 ; WX 774 ; N glyph69 ; B 15 -14 760 731 ; 91 | C -1 ; WX 588 ; N glyph70 ; B 15 -14 574 731 ; 92 | C -1 ; WX 774 ; N glyph71 ; B 15 -14 760 731 ; 93 | C -1 ; WX 774 ; N glyph72 ; B 15 -14 760 731 ; 94 | C -1 ; WX 402 ; N glyph73 ; B 15 -14 388 731 ; 95 | C -1 ; WX 774 ; N glyph74 ; B 15 -14 760 731 ; 96 | C -1 ; WX 774 ; N glyph75 ; B 15 -14 760 731 ; 97 | C -1 ; WX 774 ; N glyph76 ; B 15 -14 760 731 ; 98 | C -1 ; WX 774 ; N glyph77 ; B 14 79 760 638 ; 99 | C -1 ; WX 774 ; N glyph78 ; B 15 -14 760 731 ; 100 | C -1 ; WX 774 ; N glyph79 ; B 15 79 760 638 ; 101 | C -1 ; WX 774 ; N glyph80 ; B 15 -14 760 731 ; 102 | C -1 ; WX 774 ; N glyph81 ; B 15 125 760 591 ; 103 | C -1 ; WX 774 ; N glyph82 ; B 15 79 760 638 ; 104 | C -1 ; WX 774 ; N glyph83 ; B 15 -14 760 731 ; 105 | C -1 ; WX 774 ; N glyph84 ; B 15 79 760 638 ; 106 | C -1 ; WX 774 ; N glyph85 ; B 15 -14 760 731 ; 107 | C -1 ; WX 774 ; N glyph86 ; B 15 -14 760 731 ; 108 | C -1 ; WX 774 ; N glyph87 ; B 15 -14 760 731 ; 109 | C -1 ; WX 774 ; N glyph88 ; B 15 79 760 638 ; 110 | C -1 ; WX 774 ; N glyph89 ; B 15 218 760 498 ; 111 | C -1 ; WX 774 ; N glyph90 ; B 15 -14 760 731 ; 112 | C -1 ; WX 588 ; N glyph91 ; B 15 32 574 684 ; 113 | C -1 ; WX 774 ; N glyph92 ; B 15 -14 760 731 ; 114 | C -1 ; WX 774 ; N glyph93 ; B 15 -14 760 731 ; 115 | C -1 ; WX 681 ; N glyph94 ; B 15 -14 667 731 ; 116 | C -1 ; WX 774 ; N glyph95 ; B 15 -14 760 731 ; 117 | C -1 ; WX 495 ; N glyph96 ; B 15 -14 481 731 ; 118 | C -1 ; WX 681 ; N glyph97 ; B 15 -14 667 731 ; 119 | C -1 ; WX 774 ; N glyph98 ; B 15 79 760 638 ; 120 | C -1 ; WX 774 ; N glyph99 ; B 15 -14 760 731 ; 121 | C -1 ; WX 774 ; N glyph100 ; B 14 -14 760 731 ; 122 | C -1 ; WX 309 ; N glyph101 ; B 15 -14 295 731 ; 123 | C -1 ; WX 774 ; N glyph102 ; B 15 -14 759 731 ; 124 | C -1 ; WX 681 ; N glyph103 ; B 15 -14 667 731 ; 125 | C -1 ; WX 774 ; N glyph104 ; B 15 -14 760 731 ; 126 | C -1 ; WX 402 ; N glyph105 ; B 15 -14 388 731 ; 127 | C -1 ; WX 774 ; N glyph106 ; B 15 -14 760 731 ; 128 | C -1 ; WX 774 ; N glyph107 ; B 15 -14 760 731 ; 129 | C -1 ; WX 774 ; N glyph108 ; B 15 -14 760 731 ; 130 | C -1 ; WX 774 ; N glyph109 ; B 15 265 760 452 ; 131 | C -1 ; WX 774 ; N glyph110 ; B 15 -14 760 731 ; 132 | C -1 ; WX 774 ; N glyph111 ; B 15 32 760 684 ; 133 | C -1 ; WX 774 ; N glyph113 ; B 15 -14 760 731 ; 134 | C -1 ; WX 774 ; N glyph114 ; B 15 -14 760 731 ; 135 | C -1 ; WX 774 ; N glyph115 ; B 15 -14 760 731 ; 136 | C -1 ; WX 774 ; N glyph116 ; B 15 -14 760 731 ; 137 | C -1 ; WX 774 ; N glyph117 ; B 15 -14 760 731 ; 138 | C -1 ; WX 681 ; N glyph118 ; B 15 -14 667 731 ; 139 | C -1 ; WX 774 ; N glyph119 ; B 15 -14 760 731 ; 140 | C -1 ; WX 774 ; N glyph121 ; B 15 -14 760 731 ; 141 | C -1 ; WX 774 ; N glyph122 ; B 15 -14 760 731 ; 142 | C -1 ; WX 309 ; N glyph123 ; B 15 -14 295 731 ; 143 | C -1 ; WX 774 ; N glyph124 ; B 15 58 760 658 ; 144 | C -1 ; WX 588 ; N glyph125 ; B 15 -14 574 731 ; 145 | C -1 ; WX 681 ; N glyph126 ; B 15 -14 667 731 ; 146 | C -1 ; WX 774 ; N glyph127 ; B 15 -14 760 731 ; 147 | C -1 ; WX 774 ; N glyph128 ; B 15 -14 760 731 ; 148 | C -1 ; WX 774 ; N glyph129 ; B 15 -14 760 731 ; 149 | C -1 ; WX 774 ; N glyph130 ; B 15 -14 760 731 ; 150 | C -1 ; WX 774 ; N glyph131 ; B 15 -14 760 731 ; 151 | C -1 ; WX 588 ; N glyph132 ; B 15 -14 574 731 ; 152 | C -1 ; WX 774 ; N glyph133 ; B 15 -14 760 731 ; 153 | C -1 ; WX 588 ; N glyph134 ; B 15 -14 574 731 ; 154 | C -1 ; WX 774 ; N glyph135 ; B 15 -14 760 731 ; 155 | C -1 ; WX 774 ; N glyph136 ; B 15 32 760 684 ; 156 | C -1 ; WX 774 ; N glyph137 ; B 15 -14 760 731 ; 157 | C -1 ; WX 774 ; N glyph138 ; B 15 -14 760 731 ; 158 | C -1 ; WX 588 ; N glyph139 ; B 15 -14 574 731 ; 159 | C -1 ; WX 774 ; N glyph140 ; B 15 172 760 545 ; 160 | C -1 ; WX 774 ; N glyph141 ; B 15 -14 760 731 ; 161 | C -1 ; WX 774 ; N glyph142 ; B 15 -14 760 731 ; 162 | C -1 ; WX 774 ; N glyph143 ; B 15 -14 760 731 ; 163 | C -1 ; WX 774 ; N glyph145 ; B 15 -14 760 731 ; 164 | C -1 ; WX 774 ; N glyph146 ; B 15 -14 760 731 ; 165 | C -1 ; WX 774 ; N glyph147 ; B 15 -14 760 731 ; 166 | C -1 ; WX 774 ; N glyph148 ; B 15 -14 760 731 ; 167 | C -1 ; WX 774 ; N glyph149 ; B 15 -14 760 731 ; 168 | C -1 ; WX 774 ; N glyph150 ; B 15 -14 760 731 ; 169 | EndCharMetrics 170 | EndFontMetrics 171 | -------------------------------------------------------------------------------- /js/src/directive/previewCanvas.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | The canvas used to draw the gradient live. 3 | 4 | Usage: 5 | 17 | 18 | gradientType - {expression} - "linear" or "radial". 19 | colorHandles - {expression} - Array of color handle objects used to draw gradient. 20 | width - {expression} - Width of canvas. 21 | height - {expression} - Height of canvas. 22 | rotate - {expression} - Linear gradient type only; the number of degrees to rotate gradient, range is [0, 360). 23 | innerCircleX - {expression} - Radial gradient type only; inner circle x coord in percentage from 0-100. 24 | innerCircleY - {expression} - Radial gradient type only; inner circle y coord in percentage from 0-100. 25 | outerCircleX - {expression} - Radial gradient type only; outer circle x coord in percentage from 0-100. 26 | outerCircleY - {expression} - Radial gradient type only; outer circle y coord in percentage from 0-100. 27 | htmlCode - {model} - Model name that will be stuffed with generated HTML code. This is *not* an expression. 28 | jsCode - {model} - Model name that will be stuffed with generated JS code. This is *not* an expression. 29 | ### 30 | GradientCreatorApp.directive 'previewCanvas', -> 31 | require: '?resizableCanvas' 32 | link: (scope, elem, attrs, resizableCanvasCtrl) -> 33 | canvasDom = elem[0] 34 | ctx = canvasDom.getContext '2d' 35 | jsCodePrecision = 3 36 | 37 | ### 38 | @return {Object} Data on which the canvas rendering depends. 39 | ### 40 | getDependentData = -> 41 | ColorHandles: scope.$eval attrs.colorHandles 42 | gradientType: scope.$eval attrs.gradientType 43 | width: elem.prop 'width' 44 | height: elem.prop 'height' 45 | rotateDegrees: scope.$eval attrs.rotate 46 | innerCircleX: scope.$eval attrs.innerCircleX 47 | innerCircleY: scope.$eval attrs.innerCircleY 48 | outerCircleX: scope.$eval attrs.outerCircleX 49 | outerCircleY: scope.$eval attrs.outerCircleY 50 | 51 | ### 52 | @param {Object} dependentData Result of {@link getDependentData()}. 53 | ### 54 | dependentDataChange = (dependentData) -> 55 | ColorHandles = dependentData.ColorHandles 56 | gradientType = dependentData.gradientType 57 | width = dependentData.width 58 | height = dependentData.height 59 | rotateDegrees = dependentData.rotateDegrees ? 0 60 | innerCircleX = dependentData.innerCircleX ? 50 61 | innerCircleY = dependentData.innerCircleY ? 50 62 | outerCircleX = dependentData.outerCircleX ? 50 63 | outerCircleY = dependentData.outerCircleY ? 50 64 | 65 | # HTML code 66 | if attrs.htmlCode 67 | scope[attrs.htmlCode] = """ 68 | 69 | """ 70 | 71 | # Init JS code 72 | if attrs.jsCode 73 | scope[attrs.jsCode] = """ 74 | var canvasId = 'myPrettyCanvas', 75 | canvas = document.getElementById(canvasId), 76 | ctx = canvas.getContext('2d'), 77 | grd; 78 | 79 | 80 | """ 81 | 82 | # Create gradient 83 | scaleX = 1 84 | scaleY = 1 85 | switch gradientType 86 | when 'linear' 87 | if 0 <= rotateDegrees < 45 88 | x1 = 0 89 | y1 = height / 2 * (45 - rotateDegrees) / 45 90 | x2 = width 91 | y2 = height - y1 92 | else if 45 <= rotateDegrees < 135 93 | x1 = width * (rotateDegrees - 45) / (135 - 45) 94 | y1 = 0 95 | x2 = width - x1 96 | y2 = height 97 | else if 135 <= rotateDegrees < 225 98 | x1 = width 99 | y1 = height * (rotateDegrees - 135) / (225 - 135) 100 | x2 = 0 101 | y2 = height - y1 102 | else if 225 <= rotateDegrees < 315 103 | x1 = width * (1 - (rotateDegrees - 225) / (315 - 225)) 104 | y1 = height 105 | x2 = width - x1 106 | y2 = 0 107 | else if 315 <= rotateDegrees 108 | x1 = 0 109 | y1 = height - height / 2 * (rotateDegrees - 315) / (360 - 315) 110 | x2 = width 111 | y2 = height - y1 112 | grd = ctx.createLinearGradient x1, y1, x2, y2 113 | if attrs.jsCode 114 | x1Fixed = x1.toFixed jsCodePrecision 115 | y1Fixed = y1.toFixed jsCodePrecision 116 | x2Fixed = x2.toFixed jsCodePrecision 117 | y2Fixed = y2.toFixed jsCodePrecision 118 | scope[attrs.jsCode] += """ 119 | // Create gradient 120 | grd = ctx.createLinearGradient(#{x1Fixed}, #{y1Fixed}, #{x2Fixed}, #{y2Fixed}); 121 | 122 | 123 | """ 124 | when 'radial' 125 | if width > height then scaleY = height / width 126 | if height > width then scaleX = width / height 127 | ctx.setTransform scaleX, 0, 0, scaleY, 0, 0 128 | grd = ctx.createRadialGradient( 129 | x1 = (width * innerCircleX / 100) / scaleX, 130 | y1 = (height * innerCircleY / 100) / scaleY, 131 | r1 = 0, 132 | x2 = (width * outerCircleX / 100) / scaleX, 133 | y2 = (height * outerCircleY / 100) / scaleY, 134 | r2 = (width / 2) / scaleX 135 | ) 136 | if attrs.jsCode 137 | if scaleX != 1 or scaleY != 1 138 | scope[attrs.jsCode] += """ 139 | // Transform to facilitate ellipse 140 | ctx.setTransform(#{scaleX}, 0, 0, #{scaleY}, 0, 0); 141 | 142 | 143 | """ 144 | x1Fixed = x1.toFixed jsCodePrecision 145 | y1Fixed = y1.toFixed jsCodePrecision 146 | r1Fixed = r1.toFixed jsCodePrecision 147 | x2Fixed = x2.toFixed jsCodePrecision 148 | y2Fixed = y2.toFixed jsCodePrecision 149 | r2Fixed = r2.toFixed jsCodePrecision 150 | scope[attrs.jsCode] += """ 151 | // Create gradient 152 | grd = ctx.createRadialGradient(#{x1Fixed}, #{y1Fixed}, #{r1Fixed}, #{x2Fixed}, #{y2Fixed}, #{r2Fixed}); 153 | 154 | 155 | """ 156 | else 157 | throw 'Unknown gradient type.' 158 | 159 | # Add colors 160 | if attrs.jsCode then scope[attrs.jsCode] += '// Add colors\n' 161 | for ColorHandle in ColorHandles when ColorHandle.color 162 | grd.addColorStop ColorHandle.stop, ColorHandle.color 163 | if attrs.jsCode 164 | regEx = /([\d.]+),\s*([\d.]+),\s*([\d.]+),\s*([\d.]+)/ 165 | matches = regEx.exec ColorHandle.color 166 | r = matches[1] 167 | g = matches[2] 168 | b = matches[3] 169 | a = parseFloat(matches[4]).toFixed jsCodePrecision 170 | scope[attrs.jsCode] += """ 171 | grd.addColorStop(#{ColorHandle.stop.toFixed jsCodePrecision}, 'rgba(#{r}, #{g}, #{b}, #{a})'); 172 | 173 | """ 174 | if attrs.jsCode then scope[attrs.jsCode] += '\n' 175 | 176 | # Fill 177 | ctx.clearRect 0, 0, width / scaleX, height / scaleY 178 | ctx.fillStyle = grd 179 | ctx.fillRect 0, 0, width / scaleX, height / scaleY 180 | if attrs.jsCode 181 | scope[attrs.jsCode] += """ 182 | // Fill with gradient 183 | ctx.fillStyle = grd; 184 | ctx.fillRect(0, 0, #{(width / scaleX).toFixed jsCodePrecision}, #{(height / scaleY).toFixed jsCodePrecision}); 185 | """ 186 | 187 | if resizableCanvasCtrl? then resizableCanvasCtrl.drawResizeIcon() 188 | 189 | # Update canvas on dependent data change 190 | scope.$watch getDependentData, dependentDataChange, true -------------------------------------------------------------------------------- /js/qtip/jquery.qtip.min.css: -------------------------------------------------------------------------------- 1 | /*! qTip2 v2.0.1-26- (includes: svg ajax tips modal viewport imagemap ie6 / basic css3) | qtip2.com | Licensed MIT, GPL | Sat Feb 23 2013 21:32:11 */.qtip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;direction:ltr}.qtip-content{position:relative;padding:5px 9px;overflow:hidden;text-align:left;word-wrap:break-word}.qtip-titlebar{position:relative;padding:5px 35px 5px 10px;overflow:hidden;border-width:0 0 1px;font-weight:700}.qtip-titlebar+.qtip-content{border-top-width:0!important}.qtip-close{position:absolute;right:-9px;top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;border-color:transparent}.qtip-titlebar .qtip-close{right:4px;top:50%;margin-top:-9px}* html .qtip-titlebar .qtip-close{top:16px}.qtip-titlebar .ui-icon,.qtip-icon .ui-icon{display:block;text-indent:-1000em;direction:ltr;vertical-align:middle}.qtip-icon,.qtip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none}.qtip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em}.qtip-focus{}.qtip-hover{}.qtip-default{border-width:1px;border-style:solid;border-color:#F1D031;background-color:#FFFFA3;color:#555}.qtip-default .qtip-titlebar{background-color:#FFEF93}.qtip-default .qtip-icon{border-color:#CCC;background:#F1F1F1;color:#777}.qtip-default .qtip-titlebar .qtip-close{border-color:#AAA;color:#111}/*! Light tooltip style */.qtip-light{background-color:#fff;border-color:#E2E2E2;color:#454545}.qtip-light .qtip-titlebar{background-color:#f1f1f1}/*! Dark tooltip style */.qtip-dark{background-color:#505050;border-color:#303030;color:#f3f3f3}.qtip-dark .qtip-titlebar{background-color:#404040}.qtip-dark .qtip-icon{border-color:#444}.qtip-dark .qtip-titlebar .ui-state-hover{border-color:#303030}/*! Cream tooltip style */.qtip-cream{background-color:#FBF7AA;border-color:#F9E98E;color:#A27D35}.qtip-cream .qtip-titlebar{background-color:#F0DE7D}.qtip-cream .qtip-close .qtip-icon{background-position:-82px 0}/*! Red tooltip style */.qtip-red{background-color:#F78B83;border-color:#D95252;color:#912323}.qtip-red .qtip-titlebar{background-color:#F06D65}.qtip-red .qtip-close .qtip-icon{background-position:-102px 0}.qtip-red .qtip-icon{border-color:#D95252}.qtip-red .qtip-titlebar .ui-state-hover{border-color:#D95252}/*! Green tooltip style */.qtip-green{background-color:#CAED9E;border-color:#90D93F;color:#3F6219}.qtip-green .qtip-titlebar{background-color:#B0DE78}.qtip-green .qtip-close .qtip-icon{background-position:-42px 0}/*! Blue tooltip style */.qtip-blue{background-color:#E5F6FE;border-color:#ADD9ED;color:#5E99BD}.qtip-blue .qtip-titlebar{background-color:#D0E9F5}.qtip-blue .qtip-close .qtip-icon{background-position:-2px 0}.qtip-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,.15)}.qtip-rounded,.qtip-tipsy,.qtip-bootstrap{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.qtip-rounded .qtip-titlebar{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.qtip-youtube{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;color:#fff;border-width:0;background:#4A4A4A;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black));background-image:-webkit-linear-gradient(top,#4A4A4A 0,black 100%);background-image:-moz-linear-gradient(top,#4A4A4A 0,black 100%);background-image:-ms-linear-gradient(top,#4A4A4A 0,black 100%);background-image:-o-linear-gradient(top,#4A4A4A 0,black 100%)}.qtip-youtube .qtip-titlebar{background-color:#4A4A4A;background-color:rgba(0,0,0,0)}.qtip-youtube .qtip-content{padding:.75em;font:12px arial,sans-serif;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#4a4a4a, EndColorStr=#000000);-ms-filter:"progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#4a4a4a, EndColorStr=#000000);"}.qtip-youtube .qtip-icon{border-color:#222}.qtip-youtube .qtip-titlebar .ui-state-hover{border-color:#303030}.qtip-jtools{background:#232323;background:rgba(0,0,0,.7);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-linear-gradient(top,#717171,#232323);background-image:-ms-linear-gradient(top,#717171,#232323);background-image:-o-linear-gradient(top,#717171,#232323);border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333}.qtip-jtools .qtip-titlebar{background-color:transparent;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171, endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171, endColorstr=#4A4A4A)"}.qtip-jtools .qtip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A, endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A, endColorstr=#232323)"}.qtip-jtools .qtip-titlebar,.qtip-jtools .qtip-content{background:transparent;color:#fff;border:0 dashed transparent}.qtip-jtools .qtip-icon{border-color:#555}.qtip-jtools .qtip-titlebar .ui-state-hover{border-color:#333}.qtip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,.4);box-shadow:4px 4px 5px rgba(0,0,0,.4);background-color:#D9D9C2;color:#111;border:0 dashed transparent}.qtip-cluetip .qtip-titlebar{background-color:#87876A;color:#fff;border:0 dashed transparent}.qtip-cluetip .qtip-icon{border-color:#808064}.qtip-cluetip .qtip-titlebar .ui-state-hover{border-color:#696952;color:#696952}.qtip-tipsy{background:#000;background:rgba(0,0,0,.87);color:#fff;border:0 solid transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:700;line-height:16px;text-shadow:0 1px black}.qtip-tipsy .qtip-titlebar{padding:6px 35px 0 10;background-color:transparent}.qtip-tipsy .qtip-content{padding:6px 10}.qtip-tipsy .qtip-icon{border-color:#222;text-shadow:none}.qtip-tipsy .qtip-titlebar .ui-state-hover{border-color:#303030}.qtip-tipped{border:3px solid #959FA9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-color:#F9F9F9;color:#454545;font-weight:400;font-family:serif}.qtip-tipped .qtip-titlebar{border-bottom-width:0;color:#fff;background:#3A79B8;background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));background-image:-webkit-linear-gradient(top,#3A79B8,#2E629D);background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-ms-linear-gradient(top,#3A79B8,#2E629D);background-image:-o-linear-gradient(top,#3A79B8,#2E629D);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8, endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8, endColorstr=#2E629D)"}.qtip-tipped .qtip-icon{border:2px solid #285589;background:#285589}.qtip-tipped .qtip-icon .ui-icon{background-color:#FBFBFB;color:#555}.qtip-bootstrap{font-size:14px;line-height:20px;color:#333;padding:1px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.qtip-bootstrap .qtip-titlebar{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.qtip-bootstrap .qtip-titlebar .qtip-close{right:11px;top:45%;border-style:none}.qtip-bootstrap .qtip-content{padding:9px 14px}.qtip-bootstrap .qtip-icon{background:transparent}.qtip-bootstrap .qtip-icon .ui-icon{width:auto;height:auto;float:right;font-size:20px;font-weight:700;line-height:18px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.qtip-bootstrap .qtip-icon .ui-icon:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}.qtip:not(.ie9haxors) div.qtip-content,.qtip:not(.ie9haxors) div.qtip-titlebar{filter:none;-ms-filter:none}.qtip .qtip-tip{margin:0 auto;overflow:hidden;z-index:10}x:-o-prefocus,.qtip .qtip-tip{visibility:hidden}.qtip .qtip-tip,.qtip .qtip-tip .qtip-vml,.qtip .qtip-tip canvas{position:absolute;color:#123456;background:transparent;border:0 dashed transparent}.qtip .qtip-tip canvas{top:0;left:0}.qtip .qtip-tip .qtip-vml{behavior:url(#default#VML);display:inline-block;visibility:visible}#qtip-overlay{position:fixed;left:-10000em;top:-10000em}#qtip-overlay.blurs{cursor:pointer}#qtip-overlay div{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#000;opacity:.7;filter:alpha(opacity=70);-ms-filter:"alpha(Opacity=70)"}.qtipmodal-ie6fix{position:absolute!important} -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | /* CSS reset by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ 2 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0} 3 | 4 | [ng\:cloak], [ng-cloak], .ng-cloak { 5 | display: none; 6 | } 7 | 8 | a { 9 | color: #4169e1; 10 | text-decoration: none; 11 | } 12 | 13 | a:hover, 14 | a:focus, 15 | a:active { 16 | outline: 0; 17 | text-decoration: underline; 18 | } 19 | 20 | a:active { 21 | color: navy; 22 | } 23 | 24 | a:visited { 25 | color: #2e8b57; 26 | } 27 | 28 | /* Fixes for Prettify Sunburst theme broken by CSS reset... */ 29 | pre.prettyprint { 30 | font-family: "Courier New", monospace; 31 | font-size: 0.8em; 32 | width: auto; 33 | } 34 | /* End Prettify fixes */ 35 | 36 | .clear { 37 | clear: both; 38 | font-size: 0; 39 | height: 0; 40 | } 41 | 42 | body { 43 | font-family: Calibri, Helvetica, Arial, sans-serif !important; 44 | padding: 25px; 45 | } 46 | 47 | input[type=number].ng-invalid { 48 | background: #fee; 49 | } 50 | 51 | h1, 52 | h2, 53 | h3 { 54 | font-family: Georgia, serif; 55 | } 56 | 57 | h1 { 58 | font-size: 3em; 59 | float: left; 60 | } 61 | 62 | h3 { 63 | font-style: italic; 64 | } 65 | 66 | .loading { 67 | color: #222; 68 | font-size: 1.7em; 69 | font-style: italic; 70 | font-family: cursive; 71 | position: relative; 72 | padding-right: 1.15em; 73 | float: left; 74 | } 75 | 76 | .loading .ballWrapper { 77 | position: absolute; 78 | right: 0; 79 | bottom: 0.3em; 80 | width: 12px; 81 | height: 12px; 82 | 83 | -webkit-animation: loadingBallAnim 1s infinite linear; 84 | } 85 | 86 | .loading .ball { 87 | position: absolute; 88 | top: -0.3em; 89 | 90 | display: block; 91 | width: 100%; 92 | height: 100%; 93 | background: #fff; 94 | 95 | border-radius: 6px; 96 | -moz-border-radius: 6px; 97 | -webkit-border-radius: 6px; 98 | 99 | box-shadow: inset 0 0 7px 0 #000; 100 | } 101 | 102 | @-webkit-keyframes loadingBallAnim { 103 | from { 104 | -webkit-transform: rotate(0); 105 | } 106 | to { 107 | -webkit-transform: rotate(360deg); 108 | } 109 | } 110 | 111 | .gradientCodeWrapper h2, 112 | .presetsWrapper h2 { 113 | -webkit-user-select: none; 114 | -moz-user-select: none; 115 | -ms-user-select: none; 116 | user-select: none; 117 | } 118 | 119 | .titleCredit { 120 | margin-bottom: 50px; 121 | font-size: 0.3em; 122 | display: block; 123 | text-align: right; 124 | } 125 | 126 | .jPicker .Title { 127 | visibility: hidden; 128 | padding-top: 4px; 129 | } 130 | 131 | .jPicker .Grid { 132 | margin-bottom: 5px; 133 | } 134 | 135 | .gradientEditorWrapper, 136 | .bigPreviewCanvasWrapper, 137 | .gradientCodeWrapper { 138 | margin: 0 50px 50px 0; 139 | float: left; 140 | } 141 | 142 | .gradientEditorWrapper, 143 | .bigPreviewCanvasWrapper { 144 | -webkit-user-select: none; 145 | -moz-user-select: none; 146 | -ms-user-select: none; 147 | user-select: none; 148 | } 149 | 150 | .gradientEditorWrapper.hasActiveColorHandle { 151 | margin-right: 48px; 152 | } 153 | 154 | [preview-canvas] { 155 | background: url(../img/canvas-bg.png); 156 | } 157 | 158 | .bigPreviewCanvas { 159 | border: 1px solid #000; 160 | margin: 10px 0 15px; 161 | } 162 | 163 | .colorHandlesWorkAreaWrapper { 164 | padding: 0 25px; 165 | margin: 0 -25px; 166 | } 167 | 168 | .gradientEditorWrapper, 169 | .colorHandlesWorkArea { 170 | width: 543px; 171 | } 172 | 173 | .colorHandlesWorkArea { 174 | height: 66px; 175 | position: relative; 176 | } 177 | 178 | .smallPreviewCanvas { 179 | border: 1px solid #000; 180 | position: absolute; 181 | top: 0; 182 | left: 0; 183 | z-index: 10; 184 | } 185 | 186 | [color-handle] { 187 | padding: 0 5px; 188 | font-size: 2em; 189 | 190 | position: absolute; 191 | bottom: 0; 192 | cursor: pointer; 193 | 194 | transition: 0.1s bottom linear; 195 | -webkit-transition: 0.1s bottom linear; 196 | -moz-transition: 0.1s bottom linear; 197 | -o-transition: 0.1s bottom linear; 198 | 199 | text-shadow: 0 1px 3px #000; 200 | filter: DropShadow(Color=#000000, OffX=0, OffY=1); 201 | } 202 | 203 | [color-handle]:hover:not(.dragging) { 204 | bottom: -2px; 205 | } 206 | 207 | [new-color-handle-click-area] { 208 | cursor: none; 209 | width: 100%; 210 | height: 42%; 211 | position: absolute; 212 | bottom: 2%; 213 | } 214 | 215 | [new-color-handle-click-area] .addHandleIcon { 216 | position: absolute; 217 | top: 0; 218 | left: 0; 219 | font-size: 1.7em; 220 | z-index: -1; 221 | 222 | transform: rotate(90deg); 223 | -webkit-transform: rotate(90deg); 224 | -moz-transform: rotate(90deg); 225 | -o-transform: rotate(90deg); 226 | -ms-transform: rotate(90deg); 227 | } 228 | 229 | .colorHandleStopInputWrapper { 230 | margin-top: 10px; 231 | } 232 | 233 | .colorHandleStopInputWrapper label { 234 | margin-right: 5px; 235 | } 236 | 237 | .colorHandleStopInputWrapper input[type=number] { 238 | width: 50px; 239 | } 240 | 241 | .error { 242 | margin-left: 5px; 243 | font-weight: bold; 244 | color: #f00; 245 | } 246 | 247 | .instructions { 248 | margin: 25px 0 0; 249 | } 250 | 251 | .instructions .showLink, 252 | .instructions .hideLink { 253 | font-size: 0.8em; 254 | margin-bottom: 15px; 255 | display: block; 256 | } 257 | 258 | h2 { 259 | font-size: 2em; 260 | text-decoration: underline; 261 | } 262 | 263 | .instructions ul + h2, 264 | .gradientCodeWrapper pre + h2 { 265 | margin-top: 20px; 266 | } 267 | 268 | .instructions ul { 269 | list-style-type: disc; 270 | margin: 15px 0 0 25px; 271 | } 272 | 273 | .instructions li + li { 274 | margin: 5px 0 0; 275 | } 276 | 277 | .jPicker td { 278 | vertical-align: top; 279 | } 280 | 281 | [color-picker] { 282 | margin: 15px 0 0; 283 | } 284 | 285 | .gradientTypesAndPersistence { 286 | text-align: left; 287 | } 288 | 289 | .gradientType { 290 | display: inline-block; 291 | margin: 0 5px; 292 | line-height: 1em; 293 | } 294 | 295 | .gradientType label { 296 | margin-left: 5px; 297 | } 298 | 299 | .persistBtns { 300 | text-align: right; 301 | float: right; 302 | } 303 | 304 | .persistBtns .btn { 305 | position: relative; 306 | 307 | width: 16px; 308 | height: 16px; 309 | display: inline-block; 310 | margin-left: 5px; 311 | 312 | transition: 0.1s top linear; 313 | -webkit-transition: 0.1s top linear; 314 | -moz-transition: 0.1s top linear; 315 | -o-transition: 0.1s top linear; 316 | } 317 | 318 | .persistBtns .btn:hover, 319 | .persistBtns .btn:active { 320 | top: -2px; 321 | } 322 | 323 | .save { 324 | background: url(../img/disk.png); 325 | } 326 | 327 | .saveAs { 328 | background: url(../img/disk_multiple.png); 329 | } 330 | 331 | .delete { 332 | background: url(../img/delete.png); 333 | } 334 | 335 | [slider] { 336 | border: 1px solid #777; 337 | background: #eee; 338 | height: 6px; 339 | margin: 12px 0; 340 | 341 | border-radius: 3px; 342 | -moz-border-radius: 3px; 343 | -webkit-border-radius: 3px; 344 | } 345 | 346 | [slider] .inner { 347 | position: relative; 348 | margin: 0 13px 0 2px; 349 | } 350 | 351 | [slider] .handle { 352 | cursor: pointer; 353 | border: 1px solid #444; 354 | background: #aaa; 355 | height: 26px; 356 | position: absolute; 357 | top: -11px; 358 | left: 1%; 359 | width: 9px; 360 | 361 | border-radius: 3px; 362 | -moz-border-radius: 3px; 363 | -webkit-border-radius: 3px; 364 | } 365 | 366 | [slider] .handle:focus, 367 | [slider] .handle:active { 368 | background: #eee; 369 | } 370 | 371 | .sliderValueDisp { 372 | float: right; 373 | } 374 | 375 | .sliderValueDisp input { 376 | width: 50px; 377 | } 378 | 379 | .sliderValueDisp + label { 380 | display: block; 381 | clear: both; 382 | margin-top: 20px; 383 | } 384 | 385 | .error.sliderValueDispError { 386 | float: left; 387 | line-height: 1.6em; 388 | } 389 | 390 | .presetsWrapper { 391 | margin-top: 25px; 392 | } 393 | 394 | .preset { 395 | display: inline-block; 396 | border: 1px solid #ddd; 397 | padding: 1px; 398 | width: 50px; 399 | height: 50px; 400 | cursor: pointer; 401 | margin: 15px 15px 0 0; 402 | } 403 | 404 | .preset:hover { 405 | border-color: #888; 406 | } 407 | 408 | .preset.loaded { 409 | border-color: #87ceeb; 410 | } 411 | 412 | .preset.loaded:hover { 413 | border-color: navy; 414 | } 415 | 416 | .preset.dirty { 417 | border-color: orange; 418 | } 419 | 420 | .preset.dirty:hover { 421 | border-color: #ff4500; 422 | } 423 | 424 | .presetsWrapper h3 { 425 | margin-top: 25px; 426 | } 427 | 428 | /* qTip overrides */ 429 | .qtip { 430 | font-size: 0.8em; 431 | } -------------------------------------------------------------------------------- /js/jpicker/ChangeLog.txt: -------------------------------------------------------------------------------- 1 | Change Log 2 | ______________ 3 | 1.1.6 4 | Corrected bug preventing selections inside input values in some browsers - the onselectstart function no longer captures on input boxes. 5 | Added support for up/down arrow adjustments of the currently focused input box making the picker more keyboard friendly. 6 | Added ticks around the backgroundImage assignments to correct for paths with whitespace. 7 | 8 | 1.1.5 9 | Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work. 10 | Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled. 11 | Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled. 12 | Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0. 13 | 14 | 1.1.4 15 | Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value. 16 | "alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value. 17 | Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value. 18 | Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons. 19 | Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color. 20 | Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color. 21 | Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker. 22 | 23 | 1.1.3 24 | Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope. 25 | No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now). 26 | Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another. 27 | Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called. 28 | Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color. 29 | 30 | 1.1.2 31 | Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times. 32 | Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress. 33 | Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was. 34 | Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization. 35 | The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code. 36 | All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window". 37 | Added "effects" section of window settings to allow different show/hide effects and durations. 38 | Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt). 39 | 40 | 1.1.1 41 | Correct IE exception caused by attempting to set "#transparent" to CSS background-color. 42 | 43 | 1.1.0 44 | Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation. 45 | The Color object now supports a changed event that you can bind to (or just bind to the picker events still included). 46 | Event order has been reversed, instead of a change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display. 47 | alphaSupport re-implemented by request - default behavior is off. 48 | Hex code now only 6 characters again. 49 | Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display. 50 | Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods. 51 | Better rendering for all IE versions in Quirks mode. 52 | 53 | 1.0.13 54 | Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm. 55 | Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw. 56 | IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display. 57 | New colorBar picker image that does not draw outside of the element since the elements now hide overdraw. 58 | Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations. 59 | Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this. 60 | 61 | 1.0.12 62 | Added minified CSS file. 63 | Added IE7/8 Quirks Mode support. 64 | Added configurable string constants for all text and tooltips. You can now change the default values for different languages. 65 | Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES. 66 | Better NULL color handling and an additional "No Color Selected" quick pick color. 67 | More consistent behavior across multiple versions of browsers. 68 | Added alpha response to the binded color picker icon. 69 | Removed "alphaSupport" variable. It is now always supported. 70 | 71 | 1.0.11b 72 | Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL. 73 | Can now create new Color object WITH OR WITHOUT the '#' prefix. 74 | 75 | 1.0.11 76 | Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well. 77 | cancelCallback now returns the original color for use in programming responses. 78 | 79 | 1.0.10 80 | Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier. 81 | 82 | 1.0.9 83 | Added optional title variable for each jPicker window. 84 | 85 | 1.0.8 86 | Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run. 87 | 88 | 1.0.7 89 | RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on. 90 | Added opacity feedback to color preview boxes. 91 | Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code. 92 | Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required. 93 | 94 | 1.0.6 95 | Corrected picker bugs introduced with 1.0.5. 96 | Removed alpha slider bar until activated - default behavior for alpha is now OFF. 97 | Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol). 98 | Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip). 99 | THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! 100 | 101 | 1.0.5 102 | Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol) 103 | Added title attributes to input elements - gives short tooltip directions on what button or field does. 104 | Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization. 105 | THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! 106 | 107 | 1.0.4 108 | Added ability for smaller picker icon with expandable window on any DOM element (not just input). 109 | "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker. 110 | 111 | 1.0.3 112 | Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol) 113 | 114 | 1.0.2 115 | Random bug fixes - speed concerns. 116 | 117 | 1.0.1 118 | Corrected closure based memeory leak - there may be others? 119 | 120 | 1.0.0 121 | First Release. -------------------------------------------------------------------------------- /js/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; 2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= 3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), 9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, 10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, 11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, 12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), 13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} 14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], 18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ 21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), 22 | ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", 23 | /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), 24 | ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 25 | hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= 26 | !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | HTML5 Canvas Gradient Creator 16 | 17 | 18 |

19 | HTML5 Canvas Gradient Creator 20 | 21 | by Ezekiel Victor 22 | – learn more 23 | 24 |

25 |
26 | 27 |
28 | Loading... 29 |
30 |
31 | 32 |
33 |
34 |
35 |
36 | 38 |
39 |
40 |
41 |
42 |
43 | 44 | 46 | 47 | 48 | ← Must be between 0 and 100. 49 | 50 |
51 |
52 |
53 | 54 |
65 | 66 |
67 | + Show instructions 68 | – Hide instructions 69 |
70 |

Pro Tips

71 |
    72 |
  • Right-click a color handle to remove it.
  • 73 |
  • Click and drag bottom-right corner of big gradient box to resize.
  • 74 |
75 | 76 |

Basic Instructions

77 |
    78 |
  • Click a color handle to bring up the color picker.
  • 79 |
  • Drag color handles left and right.
  • 80 |
  • Click in the empty space between color handles to add a new handle.
  • 81 |
82 |
83 |
84 | 85 | 86 |
87 |

My presets

88 |
93 | 101 |
102 | 103 |

Presets

104 |

Built-in presets

105 |
110 | 114 |
115 | 116 |

Just for fun

117 |
122 | 129 |
130 |
131 | 132 |
133 | 134 |
135 |
136 |
137 | 140 | 141 | 144 | 145 | 147 |
148 |
149 | 151 |
152 |
153 | 155 |
156 |
157 | 164 |
165 | 166 |
167 | 169 | Must be between 0 and 360. → 170 | 171 |
172 | ° 174 |
175 |
176 |
177 | 178 |
179 | 181 | Must be between 0 and 100. → 182 | 183 |
184 | % 185 |
186 | 187 | 188 |
189 | 191 | Must be between 0 and 100. → 192 | 193 |
194 | % 195 |
196 | 197 | 198 |
199 | 201 | Must be between 0 and 100. → 202 | 203 |
204 | % 205 |
206 | 207 | 208 |
209 | 211 | Must be between 0 and 100. → 212 | 213 |
214 | % 215 |
216 |
217 |
218 | 219 |
220 |

HTML and JS for Your Gradient

221 |
222 |
223 |
224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /css/iconic_fill_demo.html: -------------------------------------------------------------------------------- 1 | Iconic Font-embedding demo
NameIconic IconUnicode IconHexidecimal Code
lightbulbe063
equalizere052
brush_alte01c
movee03e
tag_fille02b
book_alt2e06a
layerse01f
chat_alt_fille007
layers_alte020
cloud_uploade045
chart_alte029
fullscreen_exit_alte051
cloud_downloade044
paperclipe08a
heart_fill2764
mail2709
pen_alt_fille005
check_alt2718
battery_charginge05d
lock_fille075
stope04a
arrow_up2191
move_horizontale038
compasse021
minus_alte009
battery_emptye05c
comment_fille06d
map_pin_alte002
question_mark003f
liste055
uploade043
reloade030
loop_alt4e035
loop_alt3e034
loop_alt2e033
loop_alt1e032
left_quote275d
x2713
laste04d
barse06f
arrow_left2190
arrow_down2193
downloade042
home2302
calendare001
right_quote_alte012
unlock_fille076
fullscreene04e
diale058
plus_alte008
clocke079
moviee060
steering_wheele024
pen270e
pine067
denied26d4
left_quote_alte011
volume_mutee071
umbrella2602
list_nestede056
arrow_up_alt1e014
undoe02f
pausee049
bolt26a1
articlee053
read_moree054
beakere023
beaker_alte010
battery_fulle073
arrow_right2192
iphonee06e
arrow_up_alt2e018
cog2699
award_fille022
firste04c
trash_fille05a
imagee027
comment_alt1_fille003
cde064
right_quote275e
brushe01b
cloud2601
eyee025
play_alte048
transfere041
pen_alt2e006
camerae070
move_horizontal_alt2e03a
curved_arrow2935
move_horizontal_alt1e039
aperturee026
reload_alte031
magnifying_glasse074
calendar_alt_fille06c
forke046
boxe06b
map_pin_fille068
bars_alte00a
volumee072
x_alt2714
linke077
move_verticale03b
eyedroppere01e
spine036
rsse02c
info2139
targete02a
cursore057
key_fill26bf
minus2796
book_alte00b
headphonese061
hash0023
arrow_left_alt1e013
arrow_left_alt2e017
fullscreen_exite050
sharee02e
fullscreen_alte04f
comment_alt2_fille004
moon_fill263e
at0040
chate05e
move_vertical_alt2e03d
move_vertical_alt1e03c
check2717
mice05f
booke069
move_alt1e03f
move_alt2e040
document_fille066
plus2795
wrenche078
playe047
star2605
document_alt_fille000
charte028
rain26c6
folder_fille065
new_windowe059
usere062
battery_halfe05b
aperture_alte00c
ejecte04b
arrow_down_alt1e016
pilcrow00b6
arrow_down_alt2e01a
arrow_right_alt1e015
arrow_right_alt2e019
rss_alte02d
spin_alte037
sun_fill2600
-------------------------------------------------------------------------------- /js/prettify/lang-xq.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["var pln",/^\$[\w-]+/,null,"$"]],[["pln",/^[\s=][<>][\s=]/],["lit",/^@[\w-]+/],["tag",/^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["com",/^\(:[\S\s]*?:\)/],["pln",/^[(),/;[\]{}]$/],["str",/^(?:"(?:[^"\\{]|\\[\S\s])*(?:"|$)|'(?:[^'\\{]|\\[\S\s])*(?:'|$))/,null,"\"'"],["kwd",/^(?:xquery|where|version|variable|union|typeswitch|treat|to|then|text|stable|sortby|some|self|schema|satisfies|returns|return|ref|processing-instruction|preceding-sibling|preceding|precedes|parent|only|of|node|namespace|module|let|item|intersect|instance|in|import|if|function|for|follows|following-sibling|following|external|except|every|else|element|descending|descendant-or-self|descendant|define|default|declare|comment|child|cast|case|before|attribute|assert|ascending|as|ancestor-or-self|ancestor|after|eq|order|by|or|and|schema-element|document-node|node|at)\b/], 2 | ["typ",/^(?:xs:yearMonthDuration|xs:unsignedLong|xs:time|xs:string|xs:short|xs:QName|xs:Name|xs:long|xs:integer|xs:int|xs:gYearMonth|xs:gYear|xs:gMonthDay|xs:gDay|xs:float|xs:duration|xs:double|xs:decimal|xs:dayTimeDuration|xs:dateTime|xs:date|xs:byte|xs:boolean|xs:anyURI|xf:yearMonthDuration)\b/,null],["fun pln",/^(?:xp:dereference|xinc:node-expand|xinc:link-references|xinc:link-expand|xhtml:restructure|xhtml:clean|xhtml:add-lists|xdmp:zip-manifest|xdmp:zip-get|xdmp:zip-create|xdmp:xquery-version|xdmp:word-convert|xdmp:with-namespaces|xdmp:version|xdmp:value|xdmp:user-roles|xdmp:user-last-login|xdmp:user|xdmp:url-encode|xdmp:url-decode|xdmp:uri-is-file|xdmp:uri-format|xdmp:uri-content-type|xdmp:unquote|xdmp:unpath|xdmp:triggers-database|xdmp:trace|xdmp:to-json|xdmp:tidy|xdmp:subbinary|xdmp:strftime|xdmp:spawn-in|xdmp:spawn|xdmp:sleep|xdmp:shutdown|xdmp:set-session-field|xdmp:set-response-encoding|xdmp:set-response-content-type|xdmp:set-response-code|xdmp:set-request-time-limit|xdmp:set|xdmp:servers|xdmp:server-status|xdmp:server-name|xdmp:server|xdmp:security-database|xdmp:security-assert|xdmp:schema-database|xdmp:save|xdmp:role-roles|xdmp:role|xdmp:rethrow|xdmp:restart|xdmp:request-timestamp|xdmp:request-status|xdmp:request-cancel|xdmp:request|xdmp:redirect-response|xdmp:random|xdmp:quote|xdmp:query-trace|xdmp:query-meters|xdmp:product-edition|xdmp:privilege-roles|xdmp:privilege|xdmp:pretty-print|xdmp:powerpoint-convert|xdmp:platform|xdmp:permission|xdmp:pdf-convert|xdmp:path|xdmp:octal-to-integer|xdmp:node-uri|xdmp:node-replace|xdmp:node-kind|xdmp:node-insert-child|xdmp:node-insert-before|xdmp:node-insert-after|xdmp:node-delete|xdmp:node-database|xdmp:mul64|xdmp:modules-root|xdmp:modules-database|xdmp:merging|xdmp:merge-cancel|xdmp:merge|xdmp:md5|xdmp:logout|xdmp:login|xdmp:log-level|xdmp:log|xdmp:lock-release|xdmp:lock-acquire|xdmp:load|xdmp:invoke-in|xdmp:invoke|xdmp:integer-to-octal|xdmp:integer-to-hex|xdmp:http-put|xdmp:http-post|xdmp:http-options|xdmp:http-head|xdmp:http-get|xdmp:http-delete|xdmp:hosts|xdmp:host-status|xdmp:host-name|xdmp:host|xdmp:hex-to-integer|xdmp:hash64|xdmp:hash32|xdmp:has-privilege|xdmp:groups|xdmp:group-serves|xdmp:group-servers|xdmp:group-name|xdmp:group-hosts|xdmp:group|xdmp:get-session-field-names|xdmp:get-session-field|xdmp:get-response-encoding|xdmp:get-response-code|xdmp:get-request-username|xdmp:get-request-user|xdmp:get-request-url|xdmp:get-request-protocol|xdmp:get-request-path|xdmp:get-request-method|xdmp:get-request-header-names|xdmp:get-request-header|xdmp:get-request-field-names|xdmp:get-request-field-filename|xdmp:get-request-field-content-type|xdmp:get-request-field|xdmp:get-request-client-certificate|xdmp:get-request-client-address|xdmp:get-request-body|xdmp:get-current-user|xdmp:get-current-roles|xdmp:get|xdmp:function-name|xdmp:function-module|xdmp:function|xdmp:from-json|xdmp:forests|xdmp:forest-status|xdmp:forest-restore|xdmp:forest-restart|xdmp:forest-name|xdmp:forest-delete|xdmp:forest-databases|xdmp:forest-counts|xdmp:forest-clear|xdmp:forest-backup|xdmp:forest|xdmp:filesystem-file|xdmp:filesystem-directory|xdmp:exists|xdmp:excel-convert|xdmp:eval-in|xdmp:eval|xdmp:estimate|xdmp:email|xdmp:element-content-type|xdmp:elapsed-time|xdmp:document-set-quality|xdmp:document-set-property|xdmp:document-set-properties|xdmp:document-set-permissions|xdmp:document-set-collections|xdmp:document-remove-properties|xdmp:document-remove-permissions|xdmp:document-remove-collections|xdmp:document-properties|xdmp:document-locks|xdmp:document-load|xdmp:document-insert|xdmp:document-get-quality|xdmp:document-get-properties|xdmp:document-get-permissions|xdmp:document-get-collections|xdmp:document-get|xdmp:document-forest|xdmp:document-delete|xdmp:document-add-properties|xdmp:document-add-permissions|xdmp:document-add-collections|xdmp:directory-properties|xdmp:directory-locks|xdmp:directory-delete|xdmp:directory-create|xdmp:directory|xdmp:diacritic-less|xdmp:describe|xdmp:default-permissions|xdmp:default-collections|xdmp:databases|xdmp:database-restore-validate|xdmp:database-restore-status|xdmp:database-restore-cancel|xdmp:database-restore|xdmp:database-name|xdmp:database-forests|xdmp:database-backup-validate|xdmp:database-backup-status|xdmp:database-backup-purge|xdmp:database-backup-cancel|xdmp:database-backup|xdmp:database|xdmp:collection-properties|xdmp:collection-locks|xdmp:collection-delete|xdmp:collation-canonical-uri|xdmp:castable-as|xdmp:can-grant-roles|xdmp:base64-encode|xdmp:base64-decode|xdmp:architecture|xdmp:apply|xdmp:amp-roles|xdmp:amp|xdmp:add64|xdmp:add-response-header|xdmp:access|trgr:trigger-set-recursive|trgr:trigger-set-permissions|trgr:trigger-set-name|trgr:trigger-set-module|trgr:trigger-set-event|trgr:trigger-set-description|trgr:trigger-remove-permissions|trgr:trigger-module|trgr:trigger-get-permissions|trgr:trigger-enable|trgr:trigger-disable|trgr:trigger-database-online-event|trgr:trigger-data-event|trgr:trigger-add-permissions|trgr:remove-trigger|trgr:property-content|trgr:pre-commit|trgr:post-commit|trgr:get-trigger-by-id|trgr:get-trigger|trgr:document-scope|trgr:document-content|trgr:directory-scope|trgr:create-trigger|trgr:collection-scope|trgr:any-property-content|thsr:set-entry|thsr:remove-term|thsr:remove-synonym|thsr:remove-entry|thsr:query-lookup|thsr:lookup|thsr:load|thsr:insert|thsr:expand|thsr:add-synonym|spell:suggest-detailed|spell:suggest|spell:remove-word|spell:make-dictionary|spell:load|spell:levenshtein-distance|spell:is-correct|spell:insert|spell:double-metaphone|spell:add-word|sec:users-collection|sec:user-set-roles|sec:user-set-password|sec:user-set-name|sec:user-set-description|sec:user-set-default-permissions|sec:user-set-default-collections|sec:user-remove-roles|sec:user-privileges|sec:user-get-roles|sec:user-get-description|sec:user-get-default-permissions|sec:user-get-default-collections|sec:user-doc-permissions|sec:user-doc-collections|sec:user-add-roles|sec:unprotect-collection|sec:uid-for-name|sec:set-realm|sec:security-version|sec:security-namespace|sec:security-installed|sec:security-collection|sec:roles-collection|sec:role-set-roles|sec:role-set-name|sec:role-set-description|sec:role-set-default-permissions|sec:role-set-default-collections|sec:role-remove-roles|sec:role-privileges|sec:role-get-roles|sec:role-get-description|sec:role-get-default-permissions|sec:role-get-default-collections|sec:role-doc-permissions|sec:role-doc-collections|sec:role-add-roles|sec:remove-user|sec:remove-role-from-users|sec:remove-role-from-role|sec:remove-role-from-privileges|sec:remove-role-from-amps|sec:remove-role|sec:remove-privilege|sec:remove-amp|sec:protect-collection|sec:privileges-collection|sec:privilege-set-roles|sec:privilege-set-name|sec:privilege-remove-roles|sec:privilege-get-roles|sec:privilege-add-roles|sec:priv-doc-permissions|sec:priv-doc-collections|sec:get-user-names|sec:get-unique-elem-id|sec:get-role-names|sec:get-role-ids|sec:get-privilege|sec:get-distinct-permissions|sec:get-collection|sec:get-amp|sec:create-user-with-role|sec:create-user|sec:create-role|sec:create-privilege|sec:create-amp|sec:collections-collection|sec:collection-set-permissions|sec:collection-remove-permissions|sec:collection-get-permissions|sec:collection-add-permissions|sec:check-admin|sec:amps-collection|sec:amp-set-roles|sec:amp-remove-roles|sec:amp-get-roles|sec:amp-doc-permissions|sec:amp-doc-collections|sec:amp-add-roles|search:unparse|search:suggest|search:snippet|search:search|search:resolve-nodes|search:resolve|search:remove-constraint|search:parse|search:get-default-options|search:estimate|search:check-options|prof:value|prof:reset|prof:report|prof:invoke|prof:eval|prof:enable|prof:disable|prof:allowed|ppt:clean|pki:template-set-request|pki:template-set-name|pki:template-set-key-type|pki:template-set-key-options|pki:template-set-description|pki:template-in-use|pki:template-get-version|pki:template-get-request|pki:template-get-name|pki:template-get-key-type|pki:template-get-key-options|pki:template-get-id|pki:template-get-description|pki:need-certificate|pki:is-temporary|pki:insert-trusted-certificates|pki:insert-template|pki:insert-signed-certificates|pki:insert-certificate-revocation-list|pki:get-trusted-certificate-ids|pki:get-template-ids|pki:get-template-certificate-authority|pki:get-template-by-name|pki:get-template|pki:get-pending-certificate-requests-xml|pki:get-pending-certificate-requests-pem|pki:get-pending-certificate-request|pki:get-certificates-for-template-xml|pki:get-certificates-for-template|pki:get-certificates|pki:get-certificate-xml|pki:get-certificate-pem|pki:get-certificate|pki:generate-temporary-certificate-if-necessary|pki:generate-temporary-certificate|pki:generate-template-certificate-authority|pki:generate-certificate-request|pki:delete-template|pki:delete-certificate|pki:create-template|pdf:make-toc|pdf:insert-toc-headers|pdf:get-toc|pdf:clean|p:status-transition|p:state-transition|p:remove|p:pipelines|p:insert|p:get-by-id|p:get|p:execute|p:create|p:condition|p:collection|p:action|ooxml:runs-merge|ooxml:package-uris|ooxml:package-parts-insert|ooxml:package-parts|msword:clean|mcgm:polygon|mcgm:point|mcgm:geospatial-query-from-elements|mcgm:geospatial-query|mcgm:circle|math:tanh|math:tan|math:sqrt|math:sinh|math:sin|math:pow|math:modf|math:log10|math:log|math:ldexp|math:frexp|math:fmod|math:floor|math:fabs|math:exp|math:cosh|math:cos|math:ceil|math:atan2|math:atan|math:asin|math:acos|map:put|map:map|map:keys|map:get|map:delete|map:count|map:clear|lnk:to|lnk:remove|lnk:insert|lnk:get|lnk:from|lnk:create|kml:polygon|kml:point|kml:interior-polygon|kml:geospatial-query-from-elements|kml:geospatial-query|kml:circle|kml:box|gml:polygon|gml:point|gml:interior-polygon|gml:geospatial-query-from-elements|gml:geospatial-query|gml:circle|gml:box|georss:point|georss:geospatial-query|georss:circle|geo:polygon|geo:point|geo:interior-polygon|geo:geospatial-query-from-elements|geo:geospatial-query|geo:circle|geo:box|fn:zero-or-one|fn:years-from-duration|fn:year-from-dateTime|fn:year-from-date|fn:upper-case|fn:unordered|fn:true|fn:translate|fn:trace|fn:tokenize|fn:timezone-from-time|fn:timezone-from-dateTime|fn:timezone-from-date|fn:sum|fn:subtract-dateTimes-yielding-yearMonthDuration|fn:subtract-dateTimes-yielding-dayTimeDuration|fn:substring-before|fn:substring-after|fn:substring|fn:subsequence|fn:string-to-codepoints|fn:string-pad|fn:string-length|fn:string-join|fn:string|fn:static-base-uri|fn:starts-with|fn:seconds-from-time|fn:seconds-from-duration|fn:seconds-from-dateTime|fn:round-half-to-even|fn:round|fn:root|fn:reverse|fn:resolve-uri|fn:resolve-QName|fn:replace|fn:remove|fn:QName|fn:prefix-from-QName|fn:position|fn:one-or-more|fn:number|fn:not|fn:normalize-unicode|fn:normalize-space|fn:node-name|fn:node-kind|fn:nilled|fn:namespace-uri-from-QName|fn:namespace-uri-for-prefix|fn:namespace-uri|fn:name|fn:months-from-duration|fn:month-from-dateTime|fn:month-from-date|fn:minutes-from-time|fn:minutes-from-duration|fn:minutes-from-dateTime|fn:min|fn:max|fn:matches|fn:lower-case|fn:local-name-from-QName|fn:local-name|fn:last|fn:lang|fn:iri-to-uri|fn:insert-before|fn:index-of|fn:in-scope-prefixes|fn:implicit-timezone|fn:idref|fn:id|fn:hours-from-time|fn:hours-from-duration|fn:hours-from-dateTime|fn:floor|fn:false|fn:expanded-QName|fn:exists|fn:exactly-one|fn:escape-uri|fn:escape-html-uri|fn:error|fn:ends-with|fn:encode-for-uri|fn:empty|fn:document-uri|fn:doc-available|fn:doc|fn:distinct-values|fn:distinct-nodes|fn:default-collation|fn:deep-equal|fn:days-from-duration|fn:day-from-dateTime|fn:day-from-date|fn:data|fn:current-time|fn:current-dateTime|fn:current-date|fn:count|fn:contains|fn:concat|fn:compare|fn:collection|fn:codepoints-to-string|fn:codepoint-equal|fn:ceiling|fn:boolean|fn:base-uri|fn:avg|fn:adjust-time-to-timezone|fn:adjust-dateTime-to-timezone|fn:adjust-date-to-timezone|fn:abs|feed:unsubscribe|feed:subscription|feed:subscribe|feed:request|feed:item|feed:description|excel:clean|entity:enrich|dom:set-pipelines|dom:set-permissions|dom:set-name|dom:set-evaluation-context|dom:set-domain-scope|dom:set-description|dom:remove-pipeline|dom:remove-permissions|dom:remove|dom:get|dom:evaluation-context|dom:domains|dom:domain-scope|dom:create|dom:configuration-set-restart-user|dom:configuration-set-permissions|dom:configuration-set-evaluation-context|dom:configuration-set-default-domain|dom:configuration-get|dom:configuration-create|dom:collection|dom:add-pipeline|dom:add-permissions|dls:retention-rules|dls:retention-rule-remove|dls:retention-rule-insert|dls:retention-rule|dls:purge|dls:node-expand|dls:link-references|dls:link-expand|dls:documents-query|dls:document-versions-query|dls:document-version-uri|dls:document-version-query|dls:document-version-delete|dls:document-version-as-of|dls:document-version|dls:document-update|dls:document-unmanage|dls:document-set-quality|dls:document-set-property|dls:document-set-properties|dls:document-set-permissions|dls:document-set-collections|dls:document-retention-rules|dls:document-remove-properties|dls:document-remove-permissions|dls:document-remove-collections|dls:document-purge|dls:document-manage|dls:document-is-managed|dls:document-insert-and-manage|dls:document-include-query|dls:document-history|dls:document-get-permissions|dls:document-extract-part|dls:document-delete|dls:document-checkout-status|dls:document-checkout|dls:document-checkin|dls:document-add-properties|dls:document-add-permissions|dls:document-add-collections|dls:break-checkout|dls:author-query|dls:as-of-query|dbk:convert|dbg:wait|dbg:value|dbg:stopped|dbg:stop|dbg:step|dbg:status|dbg:stack|dbg:out|dbg:next|dbg:line|dbg:invoke|dbg:function|dbg:finish|dbg:expr|dbg:eval|dbg:disconnect|dbg:detach|dbg:continue|dbg:connect|dbg:clear|dbg:breakpoints|dbg:break|dbg:attached|dbg:attach|cvt:save-converted-documents|cvt:part-uri|cvt:destination-uri|cvt:basepath|cvt:basename|cts:words|cts:word-query-weight|cts:word-query-text|cts:word-query-options|cts:word-query|cts:word-match|cts:walk|cts:uris|cts:uri-match|cts:train|cts:tokenize|cts:thresholds|cts:stem|cts:similar-query-weight|cts:similar-query-nodes|cts:similar-query|cts:shortest-distance|cts:search|cts:score|cts:reverse-query-weight|cts:reverse-query-nodes|cts:reverse-query|cts:remainder|cts:registered-query-weight|cts:registered-query-options|cts:registered-query-ids|cts:registered-query|cts:register|cts:query|cts:quality|cts:properties-query-query|cts:properties-query|cts:polygon-vertices|cts:polygon|cts:point-longitude|cts:point-latitude|cts:point|cts:or-query-queries|cts:or-query|cts:not-query-weight|cts:not-query-query|cts:not-query|cts:near-query-weight|cts:near-query-queries|cts:near-query-options|cts:near-query-distance|cts:near-query|cts:highlight|cts:geospatial-co-occurrences|cts:frequency|cts:fitness|cts:field-words|cts:field-word-query-weight|cts:field-word-query-text|cts:field-word-query-options|cts:field-word-query-field-name|cts:field-word-query|cts:field-word-match|cts:entity-highlight|cts:element-words|cts:element-word-query-weight|cts:element-word-query-text|cts:element-word-query-options|cts:element-word-query-element-name|cts:element-word-query|cts:element-word-match|cts:element-values|cts:element-value-ranges|cts:element-value-query-weight|cts:element-value-query-text|cts:element-value-query-options|cts:element-value-query-element-name|cts:element-value-query|cts:element-value-match|cts:element-value-geospatial-co-occurrences|cts:element-value-co-occurrences|cts:element-range-query-weight|cts:element-range-query-value|cts:element-range-query-options|cts:element-range-query-operator|cts:element-range-query-element-name|cts:element-range-query|cts:element-query-query|cts:element-query-element-name|cts:element-query|cts:element-pair-geospatial-values|cts:element-pair-geospatial-value-match|cts:element-pair-geospatial-query-weight|cts:element-pair-geospatial-query-region|cts:element-pair-geospatial-query-options|cts:element-pair-geospatial-query-longitude-name|cts:element-pair-geospatial-query-latitude-name|cts:element-pair-geospatial-query-element-name|cts:element-pair-geospatial-query|cts:element-pair-geospatial-boxes|cts:element-geospatial-values|cts:element-geospatial-value-match|cts:element-geospatial-query-weight|cts:element-geospatial-query-region|cts:element-geospatial-query-options|cts:element-geospatial-query-element-name|cts:element-geospatial-query|cts:element-geospatial-boxes|cts:element-child-geospatial-values|cts:element-child-geospatial-value-match|cts:element-child-geospatial-query-weight|cts:element-child-geospatial-query-region|cts:element-child-geospatial-query-options|cts:element-child-geospatial-query-element-name|cts:element-child-geospatial-query-child-name|cts:element-child-geospatial-query|cts:element-child-geospatial-boxes|cts:element-attribute-words|cts:element-attribute-word-query-weight|cts:element-attribute-word-query-text|cts:element-attribute-word-query-options|cts:element-attribute-word-query-element-name|cts:element-attribute-word-query-attribute-name|cts:element-attribute-word-query|cts:element-attribute-word-match|cts:element-attribute-values|cts:element-attribute-value-ranges|cts:element-attribute-value-query-weight|cts:element-attribute-value-query-text|cts:element-attribute-value-query-options|cts:element-attribute-value-query-element-name|cts:element-attribute-value-query-attribute-name|cts:element-attribute-value-query|cts:element-attribute-value-match|cts:element-attribute-value-geospatial-co-occurrences|cts:element-attribute-value-co-occurrences|cts:element-attribute-range-query-weight|cts:element-attribute-range-query-value|cts:element-attribute-range-query-options|cts:element-attribute-range-query-operator|cts:element-attribute-range-query-element-name|cts:element-attribute-range-query-attribute-name|cts:element-attribute-range-query|cts:element-attribute-pair-geospatial-values|cts:element-attribute-pair-geospatial-value-match|cts:element-attribute-pair-geospatial-query-weight|cts:element-attribute-pair-geospatial-query-region|cts:element-attribute-pair-geospatial-query-options|cts:element-attribute-pair-geospatial-query-longitude-name|cts:element-attribute-pair-geospatial-query-latitude-name|cts:element-attribute-pair-geospatial-query-element-name|cts:element-attribute-pair-geospatial-query|cts:element-attribute-pair-geospatial-boxes|cts:document-query-uris|cts:document-query|cts:distance|cts:directory-query-uris|cts:directory-query-depth|cts:directory-query|cts:destination|cts:deregister|cts:contains|cts:confidence|cts:collections|cts:collection-query-uris|cts:collection-query|cts:collection-match|cts:classify|cts:circle-radius|cts:circle-center|cts:circle|cts:box-west|cts:box-south|cts:box-north|cts:box-east|cts:box|cts:bearing|cts:arc-intersection|cts:and-query-queries|cts:and-query-options|cts:and-query|cts:and-not-query-positive-query|cts:and-not-query-negative-query|cts:and-not-query|css:get|css:convert|cpf:success|cpf:failure|cpf:document-set-state|cpf:document-set-processing-status|cpf:document-set-last-updated|cpf:document-set-error|cpf:document-get-state|cpf:document-get-processing-status|cpf:document-get-last-updated|cpf:document-get-error|cpf:check-transition|alert:spawn-matching-actions|alert:rule-user-id-query|alert:rule-set-user-id|alert:rule-set-query|alert:rule-set-options|alert:rule-set-name|alert:rule-set-description|alert:rule-set-action|alert:rule-remove|alert:rule-name-query|alert:rule-insert|alert:rule-id-query|alert:rule-get-user-id|alert:rule-get-query|alert:rule-get-options|alert:rule-get-name|alert:rule-get-id|alert:rule-get-description|alert:rule-get-action|alert:rule-action-query|alert:remove-triggers|alert:make-rule|alert:make-log-action|alert:make-config|alert:make-action|alert:invoke-matching-actions|alert:get-my-rules|alert:get-all-rules|alert:get-actions|alert:find-matching-rules|alert:create-triggers|alert:config-set-uri|alert:config-set-trigger-ids|alert:config-set-options|alert:config-set-name|alert:config-set-description|alert:config-set-cpf-domain-names|alert:config-set-cpf-domain-ids|alert:config-insert|alert:config-get-uri|alert:config-get-trigger-ids|alert:config-get-options|alert:config-get-name|alert:config-get-id|alert:config-get-description|alert:config-get-cpf-domain-names|alert:config-get-cpf-domain-ids|alert:config-get|alert:config-delete|alert:action-set-options|alert:action-set-name|alert:action-set-module-root|alert:action-set-module-db|alert:action-set-module|alert:action-set-description|alert:action-remove|alert:action-insert|alert:action-get-options|alert:action-get-name|alert:action-get-module-root|alert:action-get-module-db|alert:action-get-module|alert:action-get-description|zero-or-one|years-from-duration|year-from-dateTime|year-from-date|upper-case|unordered|true|translate|trace|tokenize|timezone-from-time|timezone-from-dateTime|timezone-from-date|sum|subtract-dateTimes-yielding-yearMonthDuration|subtract-dateTimes-yielding-dayTimeDuration|substring-before|substring-after|substring|subsequence|string-to-codepoints|string-pad|string-length|string-join|string|static-base-uri|starts-with|seconds-from-time|seconds-from-duration|seconds-from-dateTime|round-half-to-even|round|root|reverse|resolve-uri|resolve-QName|replace|remove|QName|prefix-from-QName|position|one-or-more|number|not|normalize-unicode|normalize-space|node-name|node-kind|nilled|namespace-uri-from-QName|namespace-uri-for-prefix|namespace-uri|name|months-from-duration|month-from-dateTime|month-from-date|minutes-from-time|minutes-from-duration|minutes-from-dateTime|min|max|matches|lower-case|local-name-from-QName|local-name|last|lang|iri-to-uri|insert-before|index-of|in-scope-prefixes|implicit-timezone|idref|id|hours-from-time|hours-from-duration|hours-from-dateTime|floor|false|expanded-QName|exists|exactly-one|escape-uri|escape-html-uri|error|ends-with|encode-for-uri|empty|document-uri|doc-available|doc|distinct-values|distinct-nodes|default-collation|deep-equal|days-from-duration|day-from-dateTime|day-from-date|data|current-time|current-dateTime|current-date|count|contains|concat|compare|collection|codepoints-to-string|codepoint-equal|ceiling|boolean|base-uri|avg|adjust-time-to-timezone|adjust-dateTime-to-timezone|adjust-date-to-timezone|abs)\b/], 3 | ["pln",/^[\w:-]+/],["pln",/^[\t\n\r \xa0]+/]]),["xq","xquery"]); 4 | -------------------------------------------------------------------------------- /js/src/controller/MainCtrl.coffee: -------------------------------------------------------------------------------- 1 | class window.MainCtrl 2 | addHandleDefaultColor: 'rgba(0, 0, 0, 1)' 3 | 4 | presetDefaults: 5 | gradientType: 'linear' 6 | width: 300 7 | height: 300 8 | rotate: 0 9 | innerCircleX: 50 10 | innerCircleY: 50 11 | outerCircleX: 50 12 | outerCircleY: 50 13 | 14 | constructor: (@$scope, @$document, @ColorHandle, @$filter, @localStorageService, @GradientPreset) -> 15 | @$scope.localStorageSupported = @localStorageService.isSupported() 16 | @$scope.gradientType = @presetDefaults.gradientType 17 | @$scope.bigCanvasWidth = @presetDefaults.width 18 | @$scope.bigCanvasHeight = @presetDefaults.height 19 | @$scope.rotateDegrees = @presetDefaults.rotate 20 | @$scope.innerCircleX = @presetDefaults.innerCircleX 21 | @$scope.innerCircleY = @presetDefaults.innerCircleY 22 | @$scope.outerCircleX = @presetDefaults.outerCircleX 23 | @$scope.outerCircleY = @presetDefaults.outerCircleY 24 | @$scope.LoadedPreset = {} 25 | @$scope.loading = true 26 | $.fn.qtip.defaults.position.my = 'bottom left' 27 | $.fn.qtip.defaults.position.at = 'top center' 28 | $.fn.qtip.defaults.position.viewport = true 29 | $.fn.qtip.defaults.position.adjust.method = 'shift none' 30 | $.fn.qtip.defaults.position.adjust.y = -3 31 | $.fn.qtip.defaults.style.classes = 'qtip-jtools' 32 | @$scope.presetTooltipOpts = 33 | position: 34 | my: 'bottom center' 35 | 36 | # Get saved presets from local storage 37 | @$scope.SavedPresets = @GradientPreset.query() 38 | 39 | # Scope proxy methods 40 | @$scope.addColorHandle = => @addColorHandle.apply @, arguments 41 | @$scope.deleteColorHandle = => @deleteColorHandle.apply @, arguments 42 | @$scope.setActiveColorHandle = => @setActiveColorHandle.apply @, arguments 43 | @$scope.getMouseIsDown = => @getMouseIsDown.apply @, arguments 44 | @$scope.applyPreset = => @applyPreset.apply @, arguments 45 | @$scope.saveLoadedPreset = => @saveLoadedPreset.apply @, arguments 46 | @$scope.deleteLoadedPreset = => @deleteLoadedPreset.apply @, arguments 47 | 48 | @initColorHandles() 49 | @trackMouseIsDown() 50 | @setUpActiveColorHandleStopManualInput() 51 | @compileGradientHtmlPageCode() 52 | @initPresets() 53 | @manageLoadedPresetDirty() 54 | 55 | # Auto-show/hide instructions based on color active handle 56 | @$scope.$watch 'ActiveColorHandle', (ActiveColorHandle) => @$scope.showInstructions = !ActiveColorHandle? 57 | 58 | initColorHandles: -> 59 | @$scope.ColorHandles = [ 60 | new @ColorHandle('rgba(0, 0, 0, 1)', 0) 61 | new @ColorHandle('rgba(255, 255, 255, 1)', 1) 62 | ] 63 | @setActiveColorHandle null 64 | 65 | # ColorHandles stop change 66 | @$scope.$watch (=> (CH.stop for CH in @$scope.ColorHandles)), => 67 | # Resort by stop 68 | @sortColorHandlesByStop() 69 | , true 70 | 71 | ### 72 | Adds a new color handle. 73 | 74 | @param {Number} stop New color handle's desired stop. 75 | ### 76 | addColorHandle: (stop) -> 77 | NewHandle = new @ColorHandle @addHandleDefaultColor, stop 78 | NewHandle.forceDrag = true 79 | @$scope.ColorHandles.push NewHandle 80 | 81 | # Sort by stop 82 | @sortColorHandlesByStop() 83 | 84 | ### 85 | @param {Object} DeleteColorHandle Handle to delete. 86 | 87 | @return {Boolean} TRUE if the handle was deleted (last handle is never deleted; will return FALSE). 88 | ### 89 | deleteColorHandle: (DeleteColorHandle) -> 90 | # OK to delete (not last handle) 91 | deleted = @$scope.ColorHandles.length > 1 92 | if deleted 93 | # Sort handles by stop 94 | @sortColorHandlesByStop() 95 | 96 | # Handle to delete is active handle 97 | if DeleteColorHandle == @$scope.ActiveColorHandle 98 | # Set active handle to next handle, or previous handle if next handle was last handle 99 | for ColorHandle, i in @$scope.ColorHandles 100 | if ColorHandle == DeleteColorHandle 101 | @$scope.setActiveColorHandle @$scope.ColorHandles[i + 1] ? @$scope.ColorHandles[i - 1] 102 | break 103 | 104 | # Delete handle 105 | @$scope.ColorHandles = (ColorHandle for ColorHandle in @$scope.ColorHandles when ColorHandle isnt DeleteColorHandle) 106 | 107 | deleted 108 | 109 | ### 110 | The "active" color handle is the one whose color is loaded into the color picker. 111 | 112 | @param {Object} ColorHandle Handle to set as active. 113 | ### 114 | setActiveColorHandle: (ColorHandle) -> @$scope.ActiveColorHandle = ColorHandle 115 | 116 | ### 117 | Keeps @$scope.mouseIsDown up to date. 118 | 119 | @see getMouseIsDown() 120 | ### 121 | trackMouseIsDown: -> 122 | @$scope.mouseIsDown = false 123 | @$document.mousedown => @$scope.mouseIsDown = true 124 | @$document.mouseup => @$scope.mouseIsDown = false 125 | 126 | ### 127 | @return {Boolean} TRUE if mouse is currently down, FALSE if it is up. 128 | ### 129 | getMouseIsDown: -> @$scope.mouseIsDown 130 | 131 | ### 132 | Keeps active color handle stop and manual input in sync. 133 | ### 134 | setUpActiveColorHandleStopManualInput: -> 135 | numberFilter = @$filter 'number' 136 | 137 | # Keep input up to date with handle 138 | @$scope.$watch 'ActiveColorHandle.stop', (stop) => 139 | if stop? then @$scope.activeColorHandleStopPercent = parseFloat(numberFilter(stop * 100, 1).replace(/,/g, '')) 140 | 141 | # Keep handle up to date with input 142 | @$scope.$watch 'activeColorHandleStopPercent', (percent) => 143 | if percent? then @$scope.ActiveColorHandle.stop = percent / 100 144 | 145 | ### 146 | Watches HTML and JS code bits from previewCanvas directive and compiles final full page code. 147 | ### 148 | compileGradientHtmlPageCode: -> 149 | # Watch gradient code parts 150 | @$scope.$watch => 151 | html: @$scope.gradientHtmlCode ? '' 152 | js: @$scope.gradientJsCode ? '' 153 | dirty: @$scope.LoadedPreset?.dirty 154 | , (codeParts) => 155 | 156 | # Get HTML escaped gradient preset name (or default name) 157 | gradientNameHtml = if @$scope.LoadedPreset.name? 158 | jQuery('

').text(@$scope.LoadedPreset.name).html() + 159 | if @$scope.LoadedPreset.dirty then ' (modified)' else '' 160 | else 161 | 'Ermahgerd, a gradient' 162 | 163 | @$scope.gradientHtmlPageCode = """ 164 | 165 | 166 | 167 | 168 | #{gradientNameHtml} 169 | 170 | 171 | #{codeParts.html} 172 | 175 | 176 | 177 | """ 178 | , true 179 | 180 | ### 181 | Init gradient presets. 182 | ### 183 | initPresets: -> 184 | @$scope.Presets = [ 185 | angular.extend new @GradientPreset, @presetDefaults, 186 | id: 'Black → transparent' 187 | name: 'Black → transparent' 188 | ColorHandles: [ 189 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.00 190 | new @ColorHandle 'rgba(0, 0, 0, 0.00)', 1.00 191 | ] 192 | 193 | angular.extend new @GradientPreset, @presetDefaults, 194 | id: 'White → transparent' 195 | name: 'White → transparent' 196 | ColorHandles: [ 197 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.00 198 | new @ColorHandle 'rgba(255, 255, 255, 0.00)', 1.00 199 | ] 200 | 201 | angular.extend new @GradientPreset, @presetDefaults, 202 | id: 'Red → green' 203 | name: 'Red → green' 204 | ColorHandles: [ 205 | new @ColorHandle 'rgba(225, 0, 25, 1.00)', 0.00 206 | new @ColorHandle 'rgba(0, 96, 27, 1.00)', 1.00 207 | ] 208 | 209 | angular.extend new @GradientPreset, @presetDefaults, 210 | id: 'Violet → orange' 211 | name: 'Violet → orange' 212 | ColorHandles: [ 213 | new @ColorHandle 'rgba(41, 10, 89, 1.00)', 0.00 214 | new @ColorHandle 'rgba(255, 124, 0, 1.00)', 1.00 215 | ] 216 | 217 | angular.extend new @GradientPreset, @presetDefaults, 218 | id: 'Blue → red → yellow' 219 | name: 'Blue → red → yellow' 220 | ColorHandles: [ 221 | new @ColorHandle 'rgba(10, 0, 178, 1.00)', 0.00 222 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.50 223 | new @ColorHandle 'rgba(255, 252, 0, 1.00)', 1.00 224 | ] 225 | 226 | angular.extend new @GradientPreset, @presetDefaults, 227 | id: 'Blue → yellow → blue' 228 | name: 'Blue → yellow → blue' 229 | ColorHandles: [ 230 | new @ColorHandle 'rgba(11, 1, 184, 1.00)', 0.10 231 | new @ColorHandle 'rgba(253, 250, 3, 1.00)', 0.50 232 | new @ColorHandle 'rgba(11, 2, 170, 1.00)', 0.90 233 | ] 234 | 235 | angular.extend new @GradientPreset, @presetDefaults, 236 | id: 'Orange → yellow → orange' 237 | name: 'Orange → yellow → orange' 238 | ColorHandles: [ 239 | new @ColorHandle 'rgba(255, 110, 2, 1.00)', 0.00 240 | new @ColorHandle 'rgba(255, 255, 0, 1.00)', 0.50 241 | new @ColorHandle 'rgba(255, 109, 0, 1.00)', 1.00 242 | ] 243 | 244 | angular.extend new @GradientPreset, @presetDefaults, 245 | id: 'Violet → green → orange' 246 | name: 'Violet → green → orange' 247 | ColorHandles: [ 248 | new @ColorHandle 'rgba(111, 21, 108, 1.00)', 0.00 249 | new @ColorHandle 'rgba(0, 96, 27, 1.00)', 0.50 250 | new @ColorHandle 'rgba(253, 124, 0, 1.00)', 1.00 251 | ] 252 | 253 | angular.extend new @GradientPreset, @presetDefaults, 254 | id: 'Yellow → violet → orange → blue' 255 | name: 'Yellow → violet → orange → blue' 256 | ColorHandles: [ 257 | new @ColorHandle 'rgba(249, 230, 0, 1.00)', 0.05 258 | new @ColorHandle 'rgba(111, 21, 108, 1.00)', 0.35 259 | new @ColorHandle 'rgba(253, 124, 0, 1.00)', 0.65 260 | new @ColorHandle 'rgba(0, 40, 116, 1.00)', 0.95 261 | ] 262 | 263 | angular.extend new @GradientPreset, @presetDefaults, 264 | id: 'Copper' 265 | name: 'Copper' 266 | ColorHandles: [ 267 | new @ColorHandle 'rgba(151, 70, 26, 1.00)', 0.00 268 | new @ColorHandle 'rgba(251, 216, 197, 1.00)', 0.30 269 | new @ColorHandle 'rgba(108, 46, 22, 1.00)', 0.83 270 | new @ColorHandle 'rgba(239, 219, 205, 1.00)', 1.00 271 | ] 272 | 273 | angular.extend new @GradientPreset, @presetDefaults, 274 | id: 'Chrome' 275 | name: 'Chrome' 276 | ColorHandles: [ 277 | new @ColorHandle 'rgba(41, 137, 204, 1.00)', 0.00 278 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.50 279 | new @ColorHandle 'rgba(144, 106, 0, 1.00)', 0.52 280 | new @ColorHandle 'rgba(217, 159, 0, 1.00)', 0.64 281 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 1.00 282 | ] 283 | 284 | angular.extend new @GradientPreset, @presetDefaults, 285 | id: 'Spectrum' 286 | name: 'Spectrum' 287 | ColorHandles: [ 288 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.00 289 | new @ColorHandle 'rgba(255, 0, 255, 1.00)', 0.15 290 | new @ColorHandle 'rgba(0, 0, 255, 1.00)', 0.33 291 | new @ColorHandle 'rgba(0, 255, 255, 1.00)', 0.49 292 | new @ColorHandle 'rgba(0, 255, 0, 1.00)', 0.67 293 | new @ColorHandle 'rgba(255, 255, 0, 1.00)', 0.84 294 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 1.00 295 | ] 296 | 297 | angular.extend new @GradientPreset, @presetDefaults, 298 | id: 'Rainbow' 299 | name: 'Rainbow' 300 | ColorHandles: [ 301 | new @ColorHandle 'rgba(255, 0, 0, 0.00)', 0.15 302 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.20 303 | new @ColorHandle 'rgba(255, 252, 0, 1.00)', 0.32 304 | new @ColorHandle 'rgba(1, 180, 57, 1.00)', 0.44 305 | new @ColorHandle 'rgba(0, 234, 255, 1.00)', 0.56 306 | new @ColorHandle 'rgba(0, 3, 144, 1.00)', 0.68 307 | new @ColorHandle 'rgba(255, 0, 198, 1.00)', 0.80 308 | new @ColorHandle 'rgba(255, 0, 198, 0.00)', 0.85 309 | ] 310 | ] 311 | 312 | @$scope.FunPresets = [ 313 | angular.extend new @GradientPreset, @presetDefaults, 314 | id: 'Solar eclipse' 315 | name: 'Solar eclipse' 316 | gradientType: 'radial' 317 | innerCircleX: 45 318 | innerCircleY: 45 319 | outerCircleX: 45 320 | outerCircleY: 45 321 | ColorHandles: [ 322 | new @ColorHandle 'rgba(34, 10, 10, 1.00)', 0.00 323 | new @ColorHandle 'rgba(34, 10, 10, 1.00)', 0.33 324 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.34 325 | new @ColorHandle 'rgba(234, 189, 12, 1.00)', 0.60 326 | new @ColorHandle 'rgba(35, 1, 4, 1.00)', 1.00 327 | ] 328 | 329 | angular.extend new @GradientPreset, @presetDefaults, 330 | id: 'Eyeball' 331 | name: 'Eyeball' 332 | gradientType: 'radial' 333 | innerCircleX: 51 334 | innerCircleY: 63.3 335 | outerCircleY: 49 336 | ColorHandles: [ 337 | new @ColorHandle 'rgba(14, 14, 16, 1.00)', 0.00 338 | new @ColorHandle 'rgba(14, 14, 16, 1.00)', 0.17 339 | new @ColorHandle 'rgba(75, 93, 103, 1.00)', 0.61 340 | new @ColorHandle 'rgba(96, 109, 91, 1.00)', 0.27 341 | new @ColorHandle 'rgba(75, 93, 103, 1.00)', 0.62 342 | new @ColorHandle 'rgba(255, 250, 250, 1.00)', 0.69 343 | new @ColorHandle 'rgba(255, 250, 250, 1.00)', 0.92 344 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.93 345 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.94 346 | ] 347 | 348 | angular.extend new @GradientPreset, @presetDefaults, 349 | id: 'Bullseye' 350 | name: 'Bullseye' 351 | gradientType: 'radial' 352 | ColorHandles: [ 353 | new @ColorHandle 'rgba(255, 238, 40, 1.00)', 0.00 354 | new @ColorHandle 'rgba(255, 238, 40, 1.00)', 0.20 355 | new @ColorHandle 'rgba(194, 66, 57, 1.00)', 0.21 356 | new @ColorHandle 'rgba(194, 66, 57, 1.00)', 0.40 357 | new @ColorHandle 'rgba(130, 194, 238, 1.00)', 0.41 358 | new @ColorHandle 'rgba(130, 194, 238, 1.00)', 0.60 359 | new @ColorHandle 'rgba(254, 254, 254, 1.00)', 0.61 360 | new @ColorHandle 'rgba(254, 254, 254, 1.00)', 0.78 361 | new @ColorHandle 'rgba(52, 50, 51, 1.00)', 0.79 362 | new @ColorHandle 'rgba(52, 50, 51, 1.00)', 0.99 363 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 1.00 364 | ] 365 | 366 | angular.extend new @GradientPreset, @presetDefaults, 367 | id: 'Breakfast' 368 | name: 'Breakfast' 369 | gradientType: 'radial' 370 | width: 320 371 | height: 404 372 | innerCircleY: 89.1 373 | outerCircleY: 47.5 374 | ColorHandles: [ 375 | new @ColorHandle 'rgba(255, 153, 0, 1.00)', 0.00 376 | new @ColorHandle 'rgba(255, 191, 0, 1.00)', 0.46 377 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.49 378 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.86 379 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.85 380 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.84 381 | ] 382 | 383 | angular.extend new @GradientPreset, @presetDefaults, 384 | id: 'Sunset' 385 | name: 'Sunset' 386 | gradientType: 'radial' 387 | innerCircleX: 60 388 | innerCircleY: 100 389 | outerCircleX: 60 390 | outerCircleY: 100 391 | ColorHandles: [ 392 | new @ColorHandle 'rgba(255, 242, 0, 1.00)', 0.00 393 | new @ColorHandle 'rgba(255, 157, 0, 1.00)', 0.37 394 | new @ColorHandle 'rgba(47, 32, 163, 1.00)', 1.00 395 | ] 396 | 397 | angular.extend new @GradientPreset, @presetDefaults, 398 | id: 'Oui oui' 399 | name: 'Oui oui' 400 | gradientType: 'linear' 401 | width: 300 402 | height: 200 403 | ColorHandles: [ 404 | new @ColorHandle 'rgba(0, 85, 164, 1.00)', 0.00 405 | new @ColorHandle 'rgba(0, 85, 164, 1.00)', 0.33 406 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.331 407 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.66 408 | new @ColorHandle 'rgba(250, 60, 50, 1.00)', 0.661 409 | new @ColorHandle 'rgba(250, 60, 50, 1.00)', 1.00 410 | ] 411 | 412 | angular.extend new @GradientPreset, @presetDefaults, 413 | id: 'Mamma mia' 414 | name: 'Mamma mia' 415 | gradientType: 'linear' 416 | width: 300 417 | height: 200 418 | ColorHandles: [ 419 | new @ColorHandle 'rgba(0, 146, 70, 1.00)', 0.00 420 | new @ColorHandle 'rgba(0, 146, 70, 1.00)', 0.33 421 | new @ColorHandle 'rgba(241, 242, 241, 1.00)', 0.331 422 | new @ColorHandle 'rgba(241, 242, 241, 1.00)', 0.66 423 | new @ColorHandle 'rgba(206, 43, 55, 1.00)', 0.661 424 | new @ColorHandle 'rgba(206, 43, 55, 1.00)', 1.00 425 | ] 426 | 427 | angular.extend new @GradientPreset, @presetDefaults, 428 | id: 'Con gusto' 429 | name: 'Con gusto' 430 | gradientType: 'linear' 431 | rotate: 90 432 | width: 300 433 | height: 200 434 | ColorHandles: [ 435 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.00 436 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.5 437 | new @ColorHandle 'rgba(0, 56, 147, 1.00)', 0.501 438 | new @ColorHandle 'rgba(0, 56, 147, 1.00)', 0.75 439 | new @ColorHandle 'rgba(206, 17, 38, 1.00)', 0.751 440 | new @ColorHandle 'rgba(206, 17, 38, 1.00)', 1.00 441 | ] 442 | 443 | angular.extend new @GradientPreset, @presetDefaults, 444 | id: 'Genau' 445 | name: 'Genau' 446 | gradientType: 'linear' 447 | rotate: 90 448 | width: 300 449 | height: 180 450 | ColorHandles: [ 451 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.00 452 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.33 453 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.331 454 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.69 455 | new @ColorHandle 'rgba(255, 204, 0, 1.00)', 0.691 456 | new @ColorHandle 'rgba(255, 204, 0, 1.00)', 1.00 457 | ] 458 | 459 | angular.extend new @GradientPreset, @presetDefaults, 460 | id: 'Привет' 461 | name: 'Привет' 462 | gradientType: 'linear' 463 | rotate: 90 464 | width: 300 465 | height: 200 466 | ColorHandles: [ 467 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.00 468 | new @ColorHandle 'rgba(255, 255, 255, 1.00)', 0.33 469 | new @ColorHandle 'rgba(0, 0, 255, 1.00)', 0.331 470 | new @ColorHandle 'rgba(0, 0, 255, 1.00)', 0.69 471 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 0.691 472 | new @ColorHandle 'rgba(255, 0, 0, 1.00)', 1.00 473 | ] 474 | 475 | angular.extend new @GradientPreset, @presetDefaults, 476 | id: 'Maisha mazuri' 477 | name: 'Maisha mazuri' 478 | gradientType: 'linear' 479 | rotate: 71 480 | width: 300 481 | height: 200 482 | ColorHandles: [ 483 | new @ColorHandle 'rgba(30, 181, 58, 1.00)', 0.00 484 | new @ColorHandle 'rgba(30, 181, 58, 1.00)', 0.35 485 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.351 486 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.4 487 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.401 488 | new @ColorHandle 'rgba(0, 0, 0, 1.00)', 0.6 489 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.601 490 | new @ColorHandle 'rgba(252, 209, 22, 1.00)', 0.65 491 | new @ColorHandle 'rgba(0, 163, 221, 1.00)', 0.651 492 | new @ColorHandle 'rgba(0, 163, 221, 1.00)', 1.00 493 | ] 494 | ] 495 | 496 | ### 497 | Apply preset gradient to working area. 498 | 499 | @param {GradientPreset} Preset 500 | ### 501 | applyPreset: (Preset) -> 502 | # Deep clone so updates in the working area don't immediately affect the preset 503 | Preset = Preset.clone() 504 | 505 | @$scope.gradientType = Preset.gradientType 506 | @$scope.bigCanvasWidth = Preset.width 507 | @$scope.bigCanvasHeight = Preset.height 508 | @$scope.rotateDegrees = Preset.rotate 509 | @$scope.innerCircleX = Preset.innerCircleX 510 | @$scope.innerCircleY = Preset.innerCircleY 511 | @$scope.outerCircleX = Preset.outerCircleX 512 | @$scope.outerCircleY = Preset.outerCircleY 513 | @$scope.ColorHandles = Preset.ColorHandles 514 | @$scope.ActiveColorHandle = null 515 | @$scope.LoadedPreset = Preset 516 | @$scope.LoadedPreset.initialChange = true 517 | 518 | ### 519 | Marks loaded preset as dirty as appropriate. 520 | ### 521 | manageLoadedPresetDirty: -> 522 | # Marks loaded preset dirty under certain conditions... 523 | manageLoadedPresetDirty = => 524 | # 1. There actually is a loaded preset 525 | # 2. The data watch fired wasn't the "initial change" 526 | if @$scope.LoadedPreset? and !@$scope.LoadedPreset.initialChange 527 | @$scope.LoadedPreset.dirty = true 528 | else 529 | @$scope.LoadedPreset.initialChange = false 530 | 531 | # Watch data that should dirtify 532 | @$scope.$watch => 533 | gradientType: @$scope.gradientType 534 | width: @$scope.bigCanvasWidth 535 | height: @$scope.bigCanvasHeight 536 | rotate: @$scope.rotateDegrees 537 | innerCircleX: @$scope.innerCircleX 538 | innerCircleY: @$scope.innerCircleY 539 | outerCircleX: @$scope.outerCircleX 540 | outerCircleY: @$scope.outerCircleY 541 | ColorHandles: @$scope.ColorHandles 542 | , (newData, oldData) -> 543 | # Some data actually changed 544 | if typeof newData != typeof oldData or 545 | newData.gradientType != oldData.gradientType or 546 | newData.width != oldData.width or 547 | newData.height != oldData.height or 548 | newData.rotate != oldData.rotate or 549 | newData.innerCircleX != oldData.innerCircleX or 550 | newData.innerCircleY != oldData.innerCircleY or 551 | newData.outerCircleX != oldData.outerCircleX or 552 | newData.outerCircleY != oldData.outerCircleY or 553 | angular.toJson(newData.ColorHandles) != angular.toJson(oldData.ColorHandles) 554 | manageLoadedPresetDirty() 555 | , true 556 | 557 | ### 558 | Saves currently loaded preset to local storage. 559 | 560 | @param {Boolean} [saveAs=false] TRUE to force "save as" with a new preset name. 561 | ### 562 | saveLoadedPreset: (saveAs = false) -> 563 | SavedPresets = @$scope.SavedPresets 564 | LoadedPreset = angular.extend new @GradientPreset, @$scope.LoadedPreset 565 | 566 | # Copy data from scope to loaded preset 567 | angular.extend LoadedPreset, 568 | gradientType: @$scope.gradientType 569 | width: @$scope.bigCanvasWidth 570 | height: @$scope.bigCanvasHeight 571 | rotate: @$scope.rotateDegrees 572 | innerCircleX: @$scope.innerCircleX 573 | innerCircleY: @$scope.innerCircleY 574 | outerCircleX: @$scope.outerCircleX 575 | outerCircleY: @$scope.outerCircleY 576 | ColorHandles: (angular.extend({}, ColorHandle) for ColorHandle in @$scope.ColorHandles) 577 | 578 | # Gradient is new or force "save as" 579 | if !LoadedPreset.id? or saveAs 580 | name = prompt 'Unique name for your preset:', '' 581 | name = prompt 'Name already in use. Try another (or cancel to abort):', '' while name isnt null and ( 582 | Preset for Preset in SavedPresets when Preset.name == name 583 | ).length 584 | 585 | # Canceled 586 | if name is null then return 587 | 588 | LoadedPreset.id = LoadedPreset.name = name 589 | LoadedPreset.saveable = true 590 | LoadedPreset.deleteable = true 591 | SavedPresets.push LoadedPreset 592 | # Non-new 593 | else 594 | SavedPresets[i] = LoadedPreset for Preset, i in SavedPresets when Preset.id == LoadedPreset.id 595 | 596 | LoadedPreset.dirty = false 597 | 598 | # Save 599 | LoadedPreset.save() 600 | 601 | # "Load" back what was just saved 602 | @$scope.LoadedPreset = angular.extend new @GradientPreset, LoadedPreset 603 | 604 | ### 605 | Deletes currently loaded preset from local storage. 606 | ### 607 | deleteLoadedPreset: -> 608 | SavedPresets = @$scope.SavedPresets 609 | LoadedPreset = angular.extend new @GradientPreset, @$scope.LoadedPreset 610 | 611 | # Remove our copy 612 | for Preset, i in SavedPresets when Preset.id == LoadedPreset?.id 613 | SavedPresets.splice i, 1 614 | break 615 | 616 | # Remove from storage 617 | LoadedPreset.delete() 618 | 619 | # Mark as dirty, saveable, undeleteable, and unsaved 620 | angular.extend LoadedPreset, 621 | dirty: true 622 | saveable: true 623 | deleteable: false 624 | id: null 625 | name: null 626 | 627 | # Load back into scope 628 | @$scope.LoadedPreset = LoadedPreset 629 | 630 | sortColorHandlesByStop: -> 631 | @$scope.ColorHandles.sort (LeftHandle, RightHandle) -> LeftHandle.stop - RightHandle.stop --------------------------------------------------------------------------------