From 816639f51bd88c6640a5cce04a01ad2ee86c5349 Mon Sep 17 00:00:00 2001 From: juliandescottes Date: Sat, 6 May 2017 23:56:43 +0200 Subject: [PATCH] merge-import test --- ...piskel-style-packaged-2017-05-06-11-54.css | 4193 ++ index.html | 282 +- js/piskel-packaged-2017-05-06-11-54.js | 32601 ++++++++++++++++ js/piskel-packaged-min-2017-05-06-11-54.js | 18 + piskelapp-partials/main-partial.html | 282 +- 5 files changed, 37240 insertions(+), 136 deletions(-) create mode 100644 css/piskel-style-packaged-2017-05-06-11-54.css create mode 100644 js/piskel-packaged-2017-05-06-11-54.js create mode 100644 js/piskel-packaged-min-2017-05-06-11-54.js diff --git a/css/piskel-style-packaged-2017-05-06-11-54.css b/css/piskel-style-packaged-2017-05-06-11-54.css new file mode 100644 index 00000000..6e0406c0 --- /dev/null +++ b/css/piskel-style-packaged-2017-05-06-11-54.css @@ -0,0 +1,4193 @@ +html, body { + --highlight-color: gold; +} +html, body { + height : 100%; width: 100%; + margin : 0; + overflow: hidden; + cursor : default; + font-family: Arial; + font-size: 11px; + line-height: 1.1; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +ul, li { + margin : 0; + padding : 0; + list-style-type: none; +} + +/** Firefox overrides this with -moz-use-system-font */ +button, +input, +input[type="submit"] { + font-family: Arial; +} + +/* IE11 applies a big default margin for range inputs */ +input[type="range"] { + padding: 0; +} + +/* Force apparition of scrollbars on leopard */ +::-webkit-scrollbar { + -webkit-appearance: none; + width: 6px; +} + +::-webkit-scrollbar-thumb { + border-radius: 2px; + background-color: #666; +} + +::-webkit-scrollbar-track { + background-color: rgba(50, 50, 50, 0.4); +} + +a, a:visited { + color: gold; +} +body { + background: #1D1D1D; +} + +/* Browser fixes */ +::-ms-clear { + display: none; +} + +.allow-user-select { + -webkit-touch-callout: initial; + -webkit-user-select: initial; + -khtml-user-select: initial; + -moz-user-select: initial; + -ms-user-select: initial; + user-select: initial; +} + +.no-overflow { + overflow: hidden; +} + +.highlight { + color: gold; +} + +.pull-top, +.pull-right, +.pull-bottom, +.pull-left { + position:absolute; +} + +.pull-top { + top:0; +} + +.pull-right { + right:0; +} + +.pull-bottom { + bottom:0; +} + +.pull-left { + left:0; +} + +.uppercase { + text-transform: uppercase; +} + +.checkbox-fix { + margin-left: 0; +} + +/** + * TOOLTIPS + */ +.tooltip-shortcut { + color: gold; +} + +.tooltip-container { + text-align: left; +} + +.tooltip-descriptor { + color:#999; +} + +.tooltip-descriptor:last-child { + padding-bottom: 5px; +} + +.tooltip-descriptor-button { + padding: 2px; + border: 1px Solid #999; + font-size: 0.8em; + margin-right: 5px; + width: 35px; + text-align: center; + border-radius: 3px; + display: inline-block; + line-height: 10px; +} +@keyframes fade { + 50% { opacity: 0.5; } +} + +@keyframes glow { + 0% { opacity: 0.66; } + 50% { opacity: 1; } + 100% { opacity: 0.66; } +} + +/** + * Application layout + */ + +.main-wrapper { + position: fixed; + top: 5px; + right: 0; + bottom: 5px; + left: 0; +} + +.column-wrapper { + text-align: center; + font-size: 0; + display: flex; + + position: absolute; + left: 100px; /* Reserve room for tools on the left edge of the screen. */ + top: 0; + right: 50px; /* Reserve room for actions on the right edge of the screen. */ + bottom: 0; +} + +.left-column { + vertical-align: top; + height: 100%; + margin-right: 7px; + flex-shrink: 0; +} + +.main-column { + height: 100%; + position: relative; +} + +.right-column { + box-sizing: border-box; + vertical-align: top; + height: 100%; + flex-shrink: 0; + + display: flex; + flex-direction: column; + position: relative; + + margin-left: 10px; + /* Add some padding for the absolutely positioned .cursor-coordinates */ + padding-bottom: 20px; +} + +.drawing-canvas-container { + font-size: 0; +} + +.sticky-section { + position: fixed; + top: 0; + bottom: 0; + z-index: 1000; +} + +.sticky-section .sticky-section-wrap { + display: table; + height: 100%; +} + +.sticky-section .vertical-centerer { + display: table-cell; + vertical-align: middle; +} + +.left-sticky-section.sticky-section { + left: 0; + max-width: 100px; +} + +.left-sticky-section .tool-icon { + float: left; +} + +.cursor-coordinates { + color:#888; + font-size:12px; + font-weight:bold; + font-family:monospace; +} + +/** + * Canvases layout + */ + +.canvas { + position: relative; + z-index: 1; +} + +.canvas-container { + position: relative; + display: block; +} + +.canvas-container .canvas-background { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.light-picker-background, +.light-canvas-background .canvas-background { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABlBMVEXf39////8zI3BgAAAAHklEQVR4AWNghAIGCMDgjwgFCDDSw2M0PSCD0fQAACRcAgF4ciGUAAAAAElFTkSuQmCC') repeat; +} + +.medium-picker-background, +.medium-canvas-background .canvas-background { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABlBMVEW6urr///82MBGFAAAAHUlEQVR4AWOAAUYoQOePEAUj3v9oYDQ9gMBoegAAJFwCAbLaTIMAAAAASUVORK5CYII=') repeat; +} + +.lowcont-medium-picker-background, +.lowcont-medium-canvas-background .canvas-background { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABlBMVEXV1dXb29tFGkCIAAAAHklEQVR4AWNghAIGCMDgjwgFCDDSw2M0PSCD0fQAACRcAgF4ciGUAAAAAElFTkSuQmCC') repeat; +} + +.lowcont-dark-picker-background, +.lowcont-dark-canvas-background .canvas-background { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABlBMVEVMTExVVVUnhsEkAAAAHUlEQVR4AWOAAUYoQOePEAUj3v9oYDQ9gMBoegAAJFwCAbLaTIMAAAAASUVORK5CYII=') repeat; +} + +.canvas.onion-skin-canvas { + opacity: 0.2; +} + +.canvas.canvas-overlay, +.canvas.layers-canvas, +.canvas.onion-skin-canvas { + position: absolute; + top: 0; + left: 0; +} + +.tools-wrapper, +.options-wrapper, +.palette-wrapper { + float : left; +} + +/** + * Z-indexes should match the drawing area canvas superposition order : + * - 1 : draw layers below current layer + * - 2 : draw current layer + * - 3 : draw layers above current layer + * - 4 : draw the tools overlay + */ +.canvas.layers-below-canvas {z-index: 7;} +.canvas.drawing-canvas {z-index: 8;} +.canvas.canvas-overlay {z-index: 9;} +.canvas.onion-skin-canvas {z-index: 10;} +.canvas.layers-above-canvas {z-index: 11;} +@font-face { + font-family: 'piskel'; + src:url('fonts/icomoon.eot?-3olv93'); + src:url('fonts/icomoon.eot?#iefix-3olv93') format('embedded-opentype'), + url('fonts/icomoon.woff?-3olv93') format('woff'), + url('fonts/icomoon.ttf?-3olv93') format('truetype'), + url('fonts/icomoon.svg?-3olv93#icomoon') format('svg'); + font-weight: normal; + font-style: normal; +} + +[class^="piskel-icon-"], [class*=" piskel-icon-"] { + font-family: 'piskel'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.piskel-icon-eye:before { + content: "\e602"; +} + +.piskel-icon-onion:before { + content: "\e601"; +} + +.piskel-icon-download:before { + content: "\e600"; +} + +.piskel-icon-rotateleft:before { + content: "\e603"; +} + +.piskel-icon-rotateright:before { + content: "\e604"; +} + +.piskel-icon-fliph:before { + content: "\e605"; +} + +.piskel-icon-flipv:before { + content: "\e606"; +} + +.piskel-icon-trashplain:before { + content: "\e607"; +} + +.piskel-icon-trash:before { + content: "\e608"; +} + +.piskel-icon-merge:before { + content: "\e609"; +} + +.piskel-icon-pencil:before { + content: "\e610"; +} + +.piskel-icon-close:before { + content: "\e611"; +} + +.piskel-icon-minus:before { + content: "\e60a"; +} + +.piskel-icon-plus:before { + content: "\e60b"; +} + +.piskel-icon-arrow-up-fat:before { + content: "\e60c"; +} + +.piskel-icon-arrow-down-fat:before { + content: "\e60d"; +} + +.piskel-icon-arrow-up-thin:before { + content: "\e60e"; +} + +.piskel-icon-arrow-down-thin:before { + content: "\e60f"; +} + +.row { + display: block; +} + +.textfield { + box-sizing:border-box; + + background : black; + border : 1px solid #888; + border-radius : 2px; + padding : 3px 10px; + color : white; + + height: 23px; +} + +.textfield[readonly="true"] { + background: transparent; +} + +.textfield[disabled=disabled] { + background : #3a3a3a; +} + +.textfield:focus { + border-color: gold; + outline: none; +} + +.textfield-small { + width : 50px; +} + +.button { + box-sizing: border-box; + height: 24px; + background-color: #666; + border-style: none; + border-radius: 2px; + cursor: pointer; + text-decoration: none; + + color: white; + font-weight: bold; + font-size: 1rem; + text-align: center; + + transition: background-color 0.2s linear; +} + +.button:hover { + color: gold; +} + +.button-primary { + background-color: gold; + color: black; +} + +.button-primary:hover { + background-color: white; + color: black; +} + +.button[disabled], +.button[disabled]:hover { + cursor:default; + background-color: #aaa; + color: #777; +} + +.import-size-field, +.resize-size-field, +.export-size-field { + width: 50px; + margin-right: 8px; + text-align: right; +} + +/** Righty sticky drawer expanded state. */ + +.right-sticky-section.sticky-section { + right: 0; + width: 47px; + + -webkit-transition: all 200ms ease-out; + -moz-transition: all 200ms ease-out; + -ms-transition: all 200ms ease-out; + -o-transition: all 200ms ease-out; + transition: all 200ms ease-out; +} + +.right-sticky-section.expanded { + right: 280px; +} + +.right-sticky-section .tool-icon { + float: right; + margin-right: 0; +} + +.tool-icon .label { + position: absolute; + left: 0; + bottom: 4px; + right: 0; + font-size: 11px; + text-transform: uppercase; + color: #fff; + text-align: center; +} + +.drawer-content { + overflow: hidden; + background-color: #444; + height: 550px; + max-height: 100%; + width: 280px; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + box-shadow: 0 0 5px 0 black; +} + +.right-sticky-section.expanded .tool-icon { + padding-right: 1px; +} + +.right-sticky-section .tool-icon.has-expanded-drawer { + position: relative; + background-color: #444; + margin-right: 0; + padding-right: 2px; + border-left : 3px solid gold; +} + +/************************************************************************************************/ +/* Common settings classes */ +/************************************************************************************************/ + +.settings-section { + margin: 10px 20px; + font-size: 12px; + font-weight: bold; + color: #ccc; +} + +.settings-section .button { + margin: 0; +} + +.settings-title { + margin-top: 20px; + margin-bottom: 10px; + text-transform: uppercase; + border-bottom: 1px #aaa solid; + padding-bottom: 5px; + color: gold; +} + +.settings-description { + margin : 0 0 10px 0; +} + +.settings-form-section { + margin-bottom: 10px; +} + +.settings-item { + margin : 10px 0; +} + +[name*=checkbox] { + vertical-align: middle; +} + +/*******************************/ +/* Application Setting panel */ +/*******************************/ + +.background-picker-wrapper { + display: inline-block; + width: 130px; + overflow: hidden; + vertical-align: middle; + margin-left: 5px; +} + +.background-picker { + cursor: pointer; + float: left; + height: 14px; + width: 14px; + background-color: transparent; + margin-right: 5px; + padding: 1px; + position: relative; + border: #888 2px solid; +} + +.background-picker:hover { + border-color: #eee; +} + +.background-picker.selected { + border-color: gold; +} + +.settings-opacity-input { + margin: 5px; + vertical-align: middle; +} + +.layer-opacity-input { + width: 100px; +} + +.seamless-opacity-input { + width: 75px; +} + +.settings-opacity-text { + height: 31px; + display: inline-block; + line-height: 30px; + width: 40px; + border: 1px solid grey; + box-sizing: border-box; + border-radius: 3px; + text-align: center; +} + +.grid-width-select, +.color-format-select { + margin: 5px 5px 0 5px; +} + +.settings-section-application > .settings-title { + /* Override the default 10px margin bottom for this panel */ + margin-bottom: 15px; +} + +.settings-section-application .button-primary { + margin-top: 10px; +} + +/*******************************/ +/* Gif/Png Export Setting panel*/ +/*******************************/ +.gif-download-button, +.gif-render-button { + margin-top : 10px; + margin-right : 10px; +} + +.gif-export-preview, +.png-export-preview { + position:relative; + margin-top:10px; + max-height:32px; +} + +.gif-export-preview { + max-width:32px; +} + +.png-export-preview img { + max-height:32px; + float: left; +} + +.png-export-preview .light-picker-background { + max-width:240px; +} + +.gif-upload-status { + width: 180px; + margin-left: 5px; + margin-top: 10px; +} + +.gif-upload, +.png-export-preview { + overflow: hidden; +} + +.gif-upload-status, +.gif-export-preview { + float : left; +} + +.preview-upload-ongoing:before{ + content: "Upload ongoing ..."; + position: absolute; + display: block; + height: 100%; + width: 100%; + text-align: center; + padding-top: 45%; + box-sizing:border-box; + -moz-box-sizing:border-box; + background: rgba(0,0,0,0.5); + color: white; +} + +.export-scale { + margin-bottom: 10px; +} + +.export-scale .scale-input { + margin: 5px; + vertical-align: middle; + width: 150px; +} + +.export-scale .scale-text { + height: 31px; + display: inline-block; + line-height: 30px; + width: 40px; + border: 1px solid grey; + box-sizing: border-box; + border-radius: 3px; + text-align: center; +} + +.export-resize { + margin: 10px 0; + overflow: hidden; +} + +.export-resize > * { + float: left; +} + +.export-resize > *:not(:last-child) { + margin-right: 10px; +} + +.export-resize > .resize-field { + width: 70px; +} + +.export-resize > .resize-label { + height: 23px; + line-height: 23px; +} + +.export-tabs { + overflow: hidden; + position: relative; +} + +.export-tabs:after { + content: ""; + display: block; + position: absolute; + bottom: 0; + width: 100%; + height: 1px; + z-index: 0; + background-color: gold; +} + +.export-tab { + float: left; + cursor: pointer; + padding: 5px; + border: 1px solid transparent; + border-radius: 2px 2px 0 0; + /* Make sure the tab and its border are positioned above the :after element; */ + position: relative; + z-index: 1; +} + +.export-tab.selected, +.export-tab:hover { + color: gold; +} + +.export-tab.selected { + border-color: gold; + border-bottom-color: #444; + border-style: solid; + border-width: 1px; +} + +.export-panel-header { + padding: 10px 5px 0px; +} + +.export-info { + font-style: italic; + text-shadow: none; + font-weight: normal; +} + +.export-panel-section { + padding: 5px; + margin-top: 10px; + border: 1px solid #5d5d5d; + border-radius: 2px; +} + +.export-panel-row { + display: flex; + align-items: center; + overflow: hidden; +} + +.export-panel-gif .button { + margin-right: 5px; + width: 75px; + flex-shrink: 0; +} + +.export-panel-png .textfield { + width: 50px; +} + +.png-export-dimension-info, +.png-export-datauri-info { + margin-left: 5px; +} + +#png-export-columns, +#png-export-rows { + /* Override default textfield padding-right to keep the number spinners + aligned to the right. */ + padding-right: 0; +} + +/************************************************************************************************/ +/* Import panel */ +/************************************************************************************************/ + +.import-section, +.resize-section { + margin: 10px 0; +} + +.file-input-button { + margin-right: 8px; + border-radius: 2px; +} + +.import-highlight { + font-weight: bold; + color: white; +} +.resize-section-title { + vertical-align: top; + display: inline-block; + padding-top: 5px; + width: 25%; +} + +.resize-anchor-container { + position: relative; + margin-top: 5px; + display: inline-block; +} + +.save-field { + width: 100%; +} + +.save-status { + margin-top: 10px; + margin-bottom: -10px; + vertical-align: middle; + font-weight: normal; + text-shadow: none; + font-style: italic; +} + +.save-file-name { + white-space: nowrap; + font-weight: bold; + color: white; + font-style: normal; +} + +.save-desktop-file-name { + word-wrap: break-word; + font-weight: bold; + color: white; + font-style: normal; +} + +.save-status-warning-icon { + float: left; + margin-top: 5px; +} + +.save-status-warning-icon { + overflow: hidden; + padding-left: 10px; +} + +.tool-icon { + position : relative; + cursor : pointer; + width: 46px; + height: 46px; + margin: 1px; + background-color: #3a3a3a; +} + +.tool-icon.selected { + cursor: default; + background-color: #444; +} + +.tool-icon.selected:before { + content:""; + position : absolute; + height : 100%; + width : 100%; + border: 3px solid gold; + box-sizing: border-box; +} + +.tool-icon:hover { + background-color: #444; +} + +/* + * Tool cursors: + */ + +.tool-paint-bucket .drawing-canvas-container:hover, +.tool-colorswap .drawing-canvas-container:hover { + cursor: url(../img/cursors/paint-bucket.png) 14 14, pointer; +} + +.tool-vertical-mirror-pen .drawing-canvas-container:hover { + cursor: url(../img/cursors/vertical-mirror-pen.png) 5 15, pointer; +} + +.tool-pen .drawing-canvas-container:hover { + cursor: url(../img/cursors/pen.png) 1 14, pointer; +} + +.tool-dithering .drawing-canvas-container:hover { + cursor: url(../img/cursors/dither.png) 1 14, pointer; +} + +.tool-lighten .drawing-canvas-container:hover { + cursor: url(../img/cursors/lighten.png) 1 15, pointer; +} + +.tool-eraser .drawing-canvas-container:hover { + cursor: url(../img/cursors/eraser.png) 3 14, pointer; +} + +.tool-stroke .drawing-canvas-container:hover { + cursor: url(../img/cursors/stroke.png) 1 14, pointer; +} + +.tool-rectangle .drawing-canvas-container:hover { + cursor: url(../img/cursors/rectangle.png) 5 15, pointer; +} + +.tool-circle .drawing-canvas-container:hover { + cursor: url(../img/cursors/circle.png) 5 15, pointer; +} + +.tool-move .drawing-canvas-container:hover { + cursor: url(../img/cursors/hand.png) 7 7, pointer; +} + +.tool-rectangle-select .drawing-canvas-container:hover, +.tool-lasso-select .drawing-canvas-container:hover { + cursor: crosshair; +} + +.tool-shape-select .drawing-canvas-container:hover { + cursor: url(../img/cursors/wand.png) 10 5, pointer; +} + +.tool-colorpicker .drawing-canvas-container:hover { + cursor: url(../img/cursors/dropper.png) 2 15, pointer; +} + +.swap-colors-button { + position: relative; + top: 50px; + left: 6px; + height: 18px; + width: 18px; + + opacity : 0.3; + + cursor : pointer; +} + +.swap-colors-button:hover { + opacity : 1; +} + +.tool-color-picker { + position:relative; +} + +.tool-color-picker:nth-child(1) { + z-index : 100; +} + +.tool-color-picker:nth-child(2) { + z-index : 90; + margin-top: 25px; + margin-left:-20px; +} + +.tool-color-picker input { + width: 16px; + height: 16px; + text-indent: -10000px; + border: 1px solid black; + background: white; + cursor: pointer; + position : relative; + top: 10px; + margin-left: 2px; +} + +.tool-color-picker .secondary-color-picker { + top : 18px; + margin-left: 0; +} + +.palette-wrapper { + margin-top: 10px; + margin-left: 10px; +} + +.palette-color[data-color=TRANSPARENT] { + position: relative; + top: 10px; + left: 10px; + background-color: white; + height : 16px; + width : 16px; + border: 2px solid #000; + background-size: 16px 16px; + background-position: 0 0; + background-image: -webkit-gradient( + linear, + left top, + right bottom, + color-stop(0, #fff), + color-stop(0.45, #fff), + color-stop(0.5, #ff0000), + color-stop(0.55, #fff), + color-stop(1, #fff) + ); + background-image: -moz-linear-gradient( + left top, + #fff 0%, + #fff 45%, + #f00 50%, + #fff 55%, + #fff 100% + ); +} + + +.pen-size-container { + overflow: hidden; + padding: 5px 5px; +} + +.pen-size-option { + float: left; + box-sizing: border-box; + width: 20px; + height: 20px; + margin-right: 2px; + border-style: solid; + border-width: 2px; + border-color: #444; + cursor: pointer; +} + +.pen-size-option[data-size='1'] { + padding: 5px; +} +.pen-size-option[data-size='2'] { + padding: 4px; +} +.pen-size-option[data-size='3'] { + padding: 3px; +} +.pen-size-option[data-size='4'] { + padding: 2px; +} + +.pen-size-option:before { + content: ''; + width: 100%; + height: 100%; + background-color: white; + display: block; + text-align: center; + line-height: 12px; + font-size: 90%; +} + +.pen-size-option:hover { + border-color: #888; +} + +.pen-size-option.selected:before { + background-color: gold; +} + +.pen-size-option.selected { + border-color: gold; +} + +.pen-size-option.labeled:before { + content: attr(real-pen-size); + color: black; +} + +/* +Icon classes can be used entirely standalone. They are named after their original file names. + +Example usage in HTML: + +`display: block` sprite: +
+ +To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class: + +// CSS +.icon { + display: inline-block; +} + +// HTML + +*/ +.icon-common-keyboard-gold { + background-image: url(../img/icons.png); + background-position: 0px -230px; + width: 36px; + height: 21px; +} +.icon-common-swapcolors-arrow-grey { + background-image: url(../img/icons.png); + background-position: -230px -107px; + width: 18px; + height: 18px; +} +.icon-common-warning-red { + background-image: url(../img/icons.png); + background-position: -230px -86px; + width: 21px; + height: 21px; +} +.icon-frame-dragndrop-white { + background-image: url(../img/icons.png); + background-position: -230px -30px; + width: 30px; + height: 30px; +} +.icon-frame-duplicate-white { + background-image: url(../img/icons.png); + background-position: -230px 0px; + width: 30px; + height: 30px; +} +.icon-frame-plus-white { + background-image: url(../img/icons.png); + background-position: -230px -60px; + width: 26px; + height: 26px; +} +.icon-frame-recyclebin-white { + background-image: url(../img/icons.png); + background-position: -184px -184px; + width: 30px; + height: 30px; +} +.icon-minimap-popup-preview-arrow-gold { + background-image: url(../img/icons.png); + background-position: -230px -143px; + width: 18px; + height: 18px; +} +.icon-minimap-popup-preview-arrow-white { + background-image: url(../img/icons.png); + background-position: -230px -125px; + width: 18px; + height: 18px; +} +.icon-settings-export-white { + background-image: url(../img/icons.png); + background-position: -138px 0px; + width: 46px; + height: 46px; +} +.icon-settings-gear-white { + background-image: url(../img/icons.png); + background-position: -138px -46px; + width: 46px; + height: 46px; +} +.icon-settings-open-folder-white { + background-image: url(../img/icons.png); + background-position: -138px -92px; + width: 46px; + height: 46px; +} +.icon-settings-resize-white { + background-image: url(../img/icons.png); + background-position: 0px -138px; + width: 46px; + height: 46px; +} +.icon-settings-save-white { + background-image: url(../img/icons.png); + background-position: -46px -138px; + width: 46px; + height: 46px; +} +.icon-tool-circle { + background-image: url(../img/icons.png); + background-position: -92px -138px; + width: 46px; + height: 46px; +} +.icon-tool-colorpicker { + background-image: url(../img/icons.png); + background-position: -138px -138px; + width: 46px; + height: 46px; +} +.icon-tool-colorswap { + background-image: url(../img/icons.png); + background-position: 0px 0px; + width: 46px; + height: 46px; +} +.icon-tool-dithering { + background-image: url(../img/icons.png); + background-position: -184px -46px; + width: 46px; + height: 46px; +} +.icon-tool-eraser { + background-image: url(../img/icons.png); + background-position: -184px -92px; + width: 46px; + height: 46px; +} +.icon-tool-lasso-select { + background-image: url(../img/icons.png); + background-position: -184px -138px; + width: 46px; + height: 46px; +} +.icon-tool-lighten { + background-image: url(../img/icons.png); + background-position: 0px -184px; + width: 46px; + height: 46px; +} +.icon-tool-move { + background-image: url(../img/icons.png); + background-position: -46px -184px; + width: 46px; + height: 46px; +} +.icon-tool-paint-bucket { + background-image: url(../img/icons.png); + background-position: -92px -184px; + width: 46px; + height: 46px; +} +.icon-tool-pen { + background-image: url(../img/icons.png); + background-position: -138px -184px; + width: 46px; + height: 46px; +} +.icon-tool-rectangle-select { + background-image: url(../img/icons.png); + background-position: -184px 0px; + width: 46px; + height: 46px; +} +.icon-tool-rectangle { + background-image: url(../img/icons.png); + background-position: -92px -92px; + width: 46px; + height: 46px; +} +.icon-tool-shape-select { + background-image: url(../img/icons.png); + background-position: -46px -92px; + width: 46px; + height: 46px; +} +.icon-tool-stroke { + background-image: url(../img/icons.png); + background-position: 0px -92px; + width: 46px; + height: 46px; +} +.icon-tool-vertical-mirror-pen { + background-image: url(../img/icons.png); + background-position: -92px -46px; + width: 46px; + height: 46px; +} +.icon-tool-center { + background-image: url(../img/icons.png); + background-position: -92px 0px; + width: 46px; + height: 46px; +} +.icon-tool-clone { + background-image: url(../img/icons.png); + background-position: -46px -46px; + width: 46px; + height: 46px; +} +.icon-tool-flip { + background-image: url(../img/icons.png); + background-position: 0px -46px; + width: 46px; + height: 46px; +} +.icon-tool-rotate { + background-image: url(../img/icons.png); + background-position: -46px 0px; + width: 46px; + height: 46px; +} + +@media (-webkit-min-device-pixel-ratio: 2), + (min-resolution: 192dpi) { + .icon-common-keyboard-gold { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-common-swapcolors-arrow-grey { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-common-warning-red { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-frame-dragndrop-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-frame-duplicate-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-frame-plus-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-frame-recyclebin-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-minimap-popup-preview-arrow-gold { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-minimap-popup-preview-arrow-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-settings-export-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-settings-gear-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-settings-open-folder-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-settings-resize-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-settings-save-white { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-circle { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-colorpicker { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-colorswap { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-dithering { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-eraser { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-lasso-select { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-lighten { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-move { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-paint-bucket { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-pen { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-rectangle-select { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-rectangle { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-shape-select { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-stroke { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-vertical-mirror-pen { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-center { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-clone { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-flip { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } + .icon-tool-rotate { + background-image: url(../img/icons@2x.png); + background-size: 260px 251px; + } +} + +.color-picker-slider * { + box-sizing: border-box; +} + +.color-picker-slider input[type="range"] { + -webkit-appearance: none; + -webkit-tap-highlight-color: rgba(255, 255, 255, 0); + width: 100%; + border: none; + padding: 1px 2px; + border-radius: 3px; + background-image: linear-gradient(to right, hsl(0, 30%, 70%) 0, hsl(359, 30%, 70%) 100%); + box-shadow: inset 0 1px 0 0 #0d0e0f, inset 0 -1px 0 0 #3a3d42; + outline: none; /* no focus outline */ +} + +/* thumb */ + +.color-picker-slider input[type="range"]::-webkit-slider-thumb { + -webkit-appearance: none; + cursor:pointer; + width: 7px; + height: 18px; + border: none; + border-radius: 2px; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #529de1), color-stop(100%, #245e8f)); /* android <= 2.2 */ + background-image: -webkit-linear-gradient(top , #529de1 0, #245e8f 100%); /* older mobile safari and android > 2.2 */; + background-image: linear-gradient(to bottom, #529de1 0, #245e8f 100%); /* W3C */ +} +.color-picker-slider input[type="range"]::-moz-range-thumb { + width: 7px; + height: 18px; + border: none; + border-radius: 2px; + background-image: linear-gradient(to bottom, #529de1 0, #245e8f 100%); /* W3C */ +} + +.color-picker-slider input[type="range"]::-ms-thumb { + width: 7px; + height: 18px; + border-radius: 2px; + border: 0; + background-image: linear-gradient(to bottom, #529de1 0, #245e8f 100%); /* W3C */ +} + +/*CROSS BROWSER RESET*/ + + +.color-picker-slider input[type="range"]::-moz-range-track { + border: inherit; + background: transparent; +} + +.color-picker-slider input[type="range"]::-ms-track { + border: inherit; + color: transparent; /* don't drawn vertical reference line */ + background: transparent; +} + +.color-picker-slider input[type="range"]::-ms-fill-lower, +.color-picker-slider input[type="range"]::-ms-fill-upper { + background: transparent; +} + +.color-picker-slider input[type="range"]::-ms-tooltip { + display: none; +} + +.color-picker-slider, +.color-picker-input { + padding: 0 10px; + height : 25px; + overflow: hidden; +} + +.color-picker-slider span{ + line-height : 25px; + width : 10px; + float:left; +} + +.color-picker-slider input[type="range"]{ + float:left; + height : 10px; + width : 100px; + margin: 7px 1px 7px 8px; +} + +.color-picker-slider input[type="text"]{ + float:left; + width : 47px; + margin-left: 5px; +} + +.color-picker-input { + margin-bottom: 10px; +} + +.color-picker-input .textfield{ + width:100%; +} + +.color-picker-slider input[type="range"][data-dimension="h"] { + background-image:linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); +} +#dialog-container-wrapper { + position: absolute; + z-index: 20000; + + top: 0; + right: 0; + bottom: 0; + left: 0; + + padding: 50px 150px; + overflow: hidden; + + box-sizing: border-box; + -moz-box-sizing : border-box; + + background-color: rgba(0,0,0,0.8); + opacity: 0; + pointer-events: none; + + color: white; +} + +#dialog-container-wrapper.animated { + transition: opacity 0.2s; +} + +#dialog-container-wrapper.show { + opacity: 1; + pointer-events: auto; +} + +#dialog-container { + width: 100%; + height: 100%; + + margin-top: -1500px; + + box-sizing: border-box; + -moz-box-sizing : border-box; + + border-radius: 3px; + border : 3px solid gold; + background: #444; + overflow: auto; +} + +.show #dialog-container { + margin-top: 0; +} + +.dialog-wrapper { + height: 100%; + position : relative; +} + +.dialog-content { + position: absolute; + top: 45px; + bottom: 0; + width: 100%; + box-sizing: border-box; +} + +.dialog-head { + width: 100%; + background: gold; + margin: 0; + padding: 10px; + color: black; + font-size: 1.8em; + height: 45px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +.dialog-close { + position: absolute; + top: 0; + right: 0; + line-height: 45px; + margin-right: 10px; + font-size: 1.3em; + cursor: pointer; +} + +/************************************************************************************************/ +/* Browse local piskels panel */ +/************************************************************************************************/ + +#dialog-container.browse-local { + width: 700px; + height: 500px; + top : 50%; + left : 50%; + position : absolute; + margin-left: -350px; +} + +.show #dialog-container.browse-local { + margin-top: -250px; +} + +.local-piskel-list { + width: 100%; +} + +.local-piskel-item { + height: 3em; +} + +.local-piskel-name { + width: 40%; +} + +.local-piskel-save-date { + font-weight : normal; +} + +.local-piskel-list a { + text-decoration: none; +} + +.local-piskel-list a:hover { + text-decoration: underline; +} + +.local-piskel-list-head { + font-weight: bold; + color: gold; +} + +.local-piskel-load-button, +.local-piskel-delete-button { + width : 75px; +} +.cheatsheet-link { + position: fixed; + bottom: 10px; + left: 10px; + + color : gold; + font-weight: bold; + font-size : 1.25em; + line-height: 20px; + + cursor: pointer; + + opacity: 0.5; + z-index: 11000; + transition : opacity 0.3s; +} + +.cheatsheet-link:hover { + opacity: 1; +} + +.cheatsheet-container { + box-sizing: border-box; + display: block; + + bottom: 46px; + padding: 20px 3%; + border-radius: 3px; + background-color: rgba(0,0,0,0.9); + overflow: auto; +} + +.cheatsheet-container .cheatsheet-title { + font-size:24px; + margin-top: 30px; +} + +.cheatsheet-container .cheatsheet-title:nth-of-type(1) { + margin-top: 0; +} + +.cheatsheet-section { + box-sizing: border-box; + float: left; + + vertical-align: top; + padding : 0 20px 20px 20px; + min-width: 300px; +} + +.cheatsheet-boxes { + display: flex; + flex-direction: row; + flex-wrap: wrap; + + float: left; +} + +@media (min-width: 1300px) { + .cheatsheet-container > div { + width: 33%; + } + .cheatsheet-boxes { + flex-direction: column; + } +} + +.cheatsheet-shortcut { + overflow: hidden; + margin: 10px 0; +} + +.cheatsheet-icon.tool-icon { + float: left; + + height: 30px; + width: 30px; + margin: 0 10px 0 0; + background-size: 30px 30px; +} + +.cheatsheet-description { + color: white; + font-size : 14px; + margin-left: 10px; + line-height : 30px; +} + +.cheatsheet-key { + box-sizing: border-box; + display : inline-block; + height: 30px; + line-height: 26px; + padding: 0 10px; + + border : 2px solid white; + border-radius: 2px; + + text-align: center; + font-family: monospace; + font-weight: bold; + font-size : 18px; + color: white; +} + +.cheatsheet-shorcut-conflict .cheatsheet-key { + border-color: red; + color: red; +} + +.cheatsheet-shortcut-editable { + cursor : pointer; +} + +.cheatsheet-shortcut-editable .cheatsheet-key { + border-color: gold; + color: gold; +} + +.cheatsheet-shortcut-editing .cheatsheet-key { + animation: fade .5s infinite; +} + +.cheatsheet-shortcut-undefined .cheatsheet-key { + border-color: red; + color: red; +} + +/*Cheatsheet actions*/ + +.cheatsheet-actions { + position: absolute; + box-sizing: border-box; + + bottom : 0; + left : 0; + right : 0; + height : 46px; + + padding : 10px; + overflow: hidden; + + background-color : gold; +} + +.cheatsheet-helptext { + font-size: 14px; + height : 26px; + line-height : 26px; + color: black; +} + +.cheatsheet-helptext-tooltip { + text-align: left; +} + +.cheatsheet-helptext-tooltip-item { + line-height: 0.9em; + margin: 10px 0; +} + +.cheatsheet-button { + position: absolute; + bottom: 10px; + right: 10px; +} + + +.cheatsheet-icon-tool-circle { + background-image: url(../img/icons/tools/tool-circle.png); +} + +.cheatsheet-icon-tool-colorpicker { + background-image: url(../img/icons/tools/tool-colorpicker.png); +} + +.cheatsheet-icon-tool-colorswap { + background-image: url(../img/icons/tools/tool-colorswap.png); +} + +.cheatsheet-icon-tool-dithering { + background-image: url(../img/icons/tools/tool-dithering.png); +} + +.cheatsheet-icon-tool-eraser { + background-image: url(../img/icons/tools/tool-eraser.png); +} + +.cheatsheet-icon-tool-lasso-select { + background-image: url(../img/icons/tools/tool-lasso-select.png); +} + +.cheatsheet-icon-tool-lighten { + background-image: url(../img/icons/tools/tool-lighten.png); +} + +.cheatsheet-icon-tool-move { + background-image: url(../img/icons/tools/tool-move.png); +} + +.cheatsheet-icon-tool-paint-bucket { + background-image: url(../img/icons/tools/tool-paint-bucket.png); +} + +.cheatsheet-icon-tool-pen { + background-image: url(../img/icons/tools/tool-pen.png); +} + +.cheatsheet-icon-tool-rectangle-select { + background-image: url(../img/icons/tools/tool-rectangle-select.png); +} + +.cheatsheet-icon-tool-rectangle { + background-image: url(../img/icons/tools/tool-rectangle.png); +} + +.cheatsheet-icon-tool-shape-select { + background-image: url(../img/icons/tools/tool-shape-select.png); +} + +.cheatsheet-icon-tool-stroke { + background-image: url(../img/icons/tools/tool-stroke.png); +} + +.cheatsheet-icon-tool-vertical-mirror-pen { + background-image: url(../img/icons/tools/tool-vertical-mirror-pen.png); +} + +#dialog-container.create-palette { + width: 500px; + height: 600px; + top : 50%; + left : 50%; + position : absolute; + margin-left: -250px; +} + +.show #dialog-container.create-palette { + margin-top: -300px; +} + +.create-palette-section { + position: absolute; + left: 10px; + top: 50px; +} + +.create-palette-import-section { + display : inline-block; +} + +.colors-container { + position: absolute; + + left: 10px; + right: 10px; + top: 85px; + + height: 460px; + + border: 1px solid black; + background: #333; +} + +.color-picker-container { + position:absolute; + left : 280px; + top:0; + bottom:0; + right:0; + background: #222; +} + +.create-palette-actions { + position: absolute; + box-sizing: border-box; + + width:100%; + height: 45px; + + left: 0; + right: 0; + bottom: 0; + + padding:10px; + text-align:right; +} + +.color-preview { + width: 170px; + height: 70px; + margin: 11px; +} + +.colors-list { + overflow: auto; + width: 280px; + box-sizing: border-box; + height: 100%; + padding-bottom: 10px; +} + +.create-palette-color, .create-palette-new-color, .colors-list-drop-proxy{ + position:relative; + float : left; + + width : 44px; + height : 44px; + margin : 10px 0 0 10px; + + box-sizing : border-box; + + cursor : pointer; +} + +@-moz-document url-prefix() { + .create-palette-color, .create-palette-new-color, .colors-list-drop-proxy{ + margin : 7px 0 0 7px; + } +} + +@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .create-palette-color, .create-palette-new-color, .colors-list-drop-proxy{ + margin : 7px 0 0 7px; + } +} + + +.create-palette-color { + border:1px solid #2c2c2c; + transition : border-color 0.2s; +} +.create-palette-color:hover { + border:1px solid gold; +} + +.colors-list-drop-proxy { + border:2px dotted #eee; +} + +.create-palette-new-color { + border:2px dotted gold; + + border-radius: 2px; + line-height: 40px; + text-align: center; + font-size: 20px; + color: gold; +} + +.create-palette-color.selected { + border:2px solid gold; +} + +.create-palette-remove-color { + position: absolute; + top: 0; + right: 0; + padding: 2px 4px 0 0; + opacity : 0.2; + + font-weight: bold; + color: rgb(255,255,255); + text-shadow : 0 0 1px rgb(0,0,0); + + transition : opacity 0.3s, color 0.1s; +} + +.light-color .create-palette-remove-color { + color: rgb(0,0,0); + text-shadow : 0 0 1px rgb(255,255,255); +} + +.selected .create-palette-remove-color { + top: -1px; + right: -1px; +} + +.create-palette-color:hover .create-palette-remove-color { + opacity: 0.6; +} + +.create-palette-color .create-palette-remove-color:hover { + opacity: 1; + color: rgb(240,80,80); + text-shadow : 0 0 1px rgb(0,0,0); +} + +/*SPECTRUM OVERRIDES*/ + +.create-palette .sp-container{ + background-color: transparent; + border: none; + box-shadow : none; + border-radius:0; + padding:5px; +} +#dialog-container.import { + width: 500px; + height: 350px; + top : 50%; + left : 50%; + position : absolute; + margin-left: -250px; + margin-top: -175px; +} + +.import .dialog-content { + font-size: 1.3em; +} + +.import-step-container { + display: flex; + width: 100%; + height: 100%; + box-sizing: border-box; + box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.5); + background: #444; +} + +.import-step-content { + padding: 10px; +} + +.import-step-buttons { + position: absolute; + bottom: 10px; + right: 10px; + text-align: right; +} + +.import-first-step .import-back-button { + display: none; +} + +/** + * IMAGE IMPORT STEP + */ + +.import-image-container { + padding: 10px; +} + +.import-image-loading { + opacity: 0.3; + pointer-events: none; +} + +.import-image-loading::after { + content: 'loading image'; + + position: absolute; + width: 100%; + top: 0; + left: 0; + margin-top: 110px; + + text-align: center; + font-size: 3em; + color: white; + text-shadow: 0 0 60px black; +} + +.import-subsection { + margin-left: 25px; +} + +.import-section:not(.import-subsection) > .dialog-section-title { + width: 50px; +} + +.import-section-preview-title { + position: absolute; + margin-left: 50%; + margin-top: -28px; +} + +.import-section-preview { + position: absolute; + display: inline-block; + border: 1px dashed #999; + border-radius: 3px; + margin-left: 50%; + top: 10px; + + width: 220px; + height: 220px; + display: flex; + align-items: center; + justify-content: center; +} + +.import-section-preview img { + max-width: 100%; + max-height: 100%; + display: block; +} + +.import-section-preview canvas { + position: absolute; +} + +.dialog-section-title { + display : inline-block; + width: 80px; +} + +.dialog-section-radio { + margin-top: 15px; + vertical-align: sub; +} + +.import-size-field:nth-of-type(2) { + margin-left: 5px; +} + +.import-image-file-name { + display: inline-block; + overflow: hidden; + + width: 200px; + vertical-align: middle; + + word-break : break-all; + white-space: nowrap; + text-overflow: ellipsis; + + font-style: italic; + font-weight: normal; + text-shadow: none; + color: gold; +} + +[name=smooth-resize-checkbox] { + margin : 0 8px; +} + +.dialog-import-body { + padding: 10px 20px; + font-size:1.3em +} + +.import-button { + font-size: 1em; + height: 28px; + padding: 0px 10px; + margin-top: 15px; +} + +/** + * SELECT MODE + */ + +.import-info { + display: flex; + flex-direction: column; + + height: 100%; + max-width: 178px; + box-sizing: border-box; + + padding: 10px; + border-right: 3px solid gold; +} + +.import-preview canvas { + max-width: 100%; + max-height: 100%; +} + +.import-meta { + margin-top: 10px; + box-sizing: border-box; + + /*center meta information horizontally*/ + display: flex; + flex-direction: column; + justify-content: center; +} + +.import-meta > div { + height: 22px; + display: flex; + margin-bottom: 5px; +} + +.import-meta-value, +.import-meta-label { + padding: 2px 4px; + border: 1px solid gold; +} + +.import-meta-label { + border-radius: 2px 0 0 2px; + color: gold; + border-right-width: 0; +} + +.import-meta-title .import-meta-label { + border-right-width: 1px; + border-radius: 2px; +} + +.import-meta-value { + border-radius: 0 2px 2px 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.import-missing { + text-align: center; + line-height: 70px; + font-style: italic; + color: #aaa; +} + +.import-mode-title { + margin-bottom: 10px +} + +.import-mode-option, +.import-resize-option, +.insert-mode-option { + display: flex; + align-items: center; + margin-bottom: 5px; +} + +.import-mode-option :checked + span, +.import-resize-option :checked + span, +.insert-mode-option :checked + span { + color: gold; +} + +/** + * ADJUST SIZE + */ +.import-resize-anchor-info, +.import-resize-option-label, +.insert-mode-option-label { + margin-bottom: 10px; +} + +.import-resize-section { + margin-bottom: 10px; +} + +.import-resize-anchor { + margin-top: 20px; +} + +.import-resize-option :checked + span { + color: gold; +} + +.import-resize-warning { + color: gold; +} + +/** + * INSERT LOCATION + */ + +.insert-mode-container { + margin-top: 20px; + margin-bottom: 10px; +} + +.insert-frame-preview { + margin: 10px 0; +} + +.insert-frame-preview .frame-picker-wrapper { + height: 120px; +} +.performance-link { + display: none; + position: fixed; + bottom: 10px; + right: 10px; + z-index: 11000; + cursor: pointer; + opacity: 0; + transition : opacity 0.3s; +} + +.performance-link.visible { + display: block; + opacity: 0.66; + animation: glow 2s infinite; +} + +.performance-link.visible:hover { + opacity: 1; + animation: none; +} + +#dialog-container.performance-info { + width: 500px; + height: 525px; + top : 50%; + left : 50%; + position : absolute; + margin-left: -250px; + margin-top: -260px; + +} + +.dialog-performance-info-body { + font-size: 13px; + letter-spacing: 1px; + padding: 10px 20px; +} + +.dialog-performance-info-body ul { + border: 1px solid #666; + padding: 5px; + border-radius: 3px; +} + +.dialog-performance-info-body li { + list-style-type: initial; + margin: 0 20px; +} + +.dialog-performance-info-body sup { + color: gold; + cursor: pointer; +} + +.show #dialog-container.performance-info { + margin-top: -300px; +} + +.dialog-performance-info-body .warning-icon { + float: left; + margin-top: 10px; +} + +.dialog-performance-info-body .warning-icon-info { + overflow: hidden; + margin-left: 30px; +} + +/************************************************************************************************/ +/* Unsupported browser dialog */ +/************************************************************************************************/ + +#dialog-container.unsupported-browser { + width: 600px; + height: 260px; + top : 50%; + left : 50%; + position : absolute; + margin-top: -130px; + margin-left: -300px; +} + +.unsupported-browser .dialog-content { + font-size:1.2em; + letter-spacing: 1px; + padding:10px 20px; + overflow: auto; +} + +.unsupported-browser .supported-browser-list { + padding: 5px 20px; +} + +.unsupported-browser .supported-browser-list li { + list-style-type: square; +} + +#current-user-agent { + color: gold; +} + +.user-message { + position: absolute; + right: 0; + bottom: 0; + padding: 10px 47px; + max-width: 300px; + + border-top-left-radius: 7px; + border: #e1a325 2px solid; + border-right: 0; + border-bottom: 0; + + color: #222; + background-color: gold; + + font-weight: bold; + font-size: 13px; + + z-index: 30000; +} + +.user-message .close { + position: absolute; + top: 6px; + right: 17px; + + font-size: 18px; + font-weight: bold; + + cursor: pointer; +} + +.user-message .close:hover { + color: black; +} + +.progress-bar-container { + position: absolute; + left: 0; + bottom: 0; + padding: 10px; + width: 360px; + border-top-right-radius: 2px; + border: gold 2px solid; + border-left: 0; + border-bottom: 0; + background-color: #444; + font-size: 14px; + z-index: 30000; + color: #eee; +} + +.progress-bar-item { + float: left; + height:20px; +} + +.progress-bar-status { + line-height: 20px; + width : 40px; + overflow : hidden; + margin: 0 0 0 10px; +} + +.progress-bar { + border : 1px solid grey; + margin-top: 8px; + height : 4px; + width : 300px; + background : linear-gradient(to left, gold, gold) no-repeat -300px 0; + background-color : black; +} +.toolbox-container { + border: 2px solid #888; + font-size: medium; + color: white; + text-align: left; + border-radius: 2px; + margin-top: 5px; + overflow: hidden; +} + +.toolbox-title { + padding: 8px; + margin: 0; + font-size: 15px; + /* reset for firefox */ + height: 16px; + background: #222; +} + +.toolbox-buttons { + flex-shrink: 0; + overflow: hidden; + border-top: 1px solid #666; + border-bottom: 1px solid #222; +} + +.toolbox-buttons .button { + /* Override border propery on .button elements from form.css */ + border-style: solid; + border-color: #333; + border-width: 0 1px 0 0; + border-radius: 0; + + background-color: #3f3f3f; +} + +.toolbox-buttons .button[disabled], +.toolbox-buttons .button[disabled]:hover { + background-color: #aaa; +} + +.toolbox-buttons button:last-child { + border-right-width: 0; +} + + +/** + * Layers container + */ +.layers-list-container { + min-height: 85px; + display: flex; + flex-direction: column; +} + +/** + * Layers title and toggle preview + */ + +.layers-title { + position: relative; + flex-shrink: 0; +} + +.layers-toggle-preview { + position: absolute; + top: 0.3em; + right: 0.5em; + + color: #999; + font-size: 1.3em; + cursor: pointer; + + transition: 0.2s linear; +} + +.layers-toggle-preview:hover { + color: white; +} + +.layers-toggle-preview-enabled, +.layers-toggle-preview-enabled:hover { + color : gold; +} + +/** + * Layers buttons + */ + +.layers-button { + margin: 0; + width: 16.66667%; + float : left; +} + +/** + * Layers list + */ + +.layers-list { + font-size : 12px; + overflow: auto; +} + +.layer-item { + position: relative; + display: flex; + height:24px; + line-height: 24px; + border-top: 1px solid #444; + cursor: pointer; +} + +.layer-item .layer-name { + padding: 0 0 0 10px; + flex: 1 auto; + white-space: nowrap; +} + +.layer-item .layer-name.overflowing-name { + overflow: hidden; + text-overflow: ellipsis; +} + +.layer-item:hover { + background : #222; +} + +.layer-item-opacity { + padding-right: 8px; +} + +.current-layer-item, +.current-layer-item:hover { + background : #333; + color: gold; +} +.palettes-list-container { + min-height: 100px; + display: flex; + flex-direction: column; +} + +.palettes-title { + flex-shrink: 0; + background-size: 22px; + background-repeat: no-repeat; + background-position: 97%; +} + +/** + * Palettes action buttons + */ + +.palettes-list-container .toolbox-buttons { + background-color: #3f3f3f; + height: 24px; + padding: 0; +} + +.palettes-list-button, +.palettes-list-select { + margin: 0; + float: left; +} + +.palettes-list-button { + width: 16.66667%; +} + +.palettes-list-select { + width: 66.66667%; + height: 100%; + padding: 0 5px 0 5px; + + color: #aaa; + font-size : 0.75em; + + text-align:left; + font-weight: normal; + + transition : background-color 0.3s, color 0.3s; + cursor:pointer; +} + +.palettes-list-select:hover, +.palettes-list-select:focus { + background-color: #484848; + color: white; +} + +.palettes-list-select:focus { + outline: none; +} + +/* + * Palette colors list + */ + +.palettes-list-colors { + height: 100%; + max-height: 160px; + overflow: auto; + padding-top: 5px; +} + +.palettes-list-color { + cursor: pointer; + float: left; + margin: 0 0 5px 5px; + width: calc((100% - 30px) / 5); + height: 32px; + position: relative; +} + +.palettes-list-color div { + height: 100%; +} + +/* + * Placeholder when no color is available in the current palette + */ + +.palettes-list-no-colors { + height: 35px; + line-height: 35px; + width: 100%; + color: gray; + font-size: 0.7em; + font-style: italic; + text-align: center +} + +/* + * Primary and secondary color markers + */ + +.palettes-list-primary-color:before, .palettes-list-secondary-color:before { + content: ""; + position: absolute; + bottom: 1px; + display: inline-block; + background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2215%22%20width%3D%2215%22%3E%3Cpath%20stroke%3D%22gold%22%20stroke-width%3D%222%22%20d%3D%22M1%203v10h10z%22/%3E%3C/svg%3E'); + width: 14px; + height: 14px; +} + +.palettes-list-primary-color:before { + left: 1px; +} + +.palettes-list-secondary-color:before { + right: 1px; + background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2215%22%20width%3D%2215%22%3E%3Cpath%20stroke%3D%22gold%22%20stroke-width%3D%222%22%20d%3D%22M3%2013h10V3z%22/%3E%3C/svg%3E'); +} + +/* + * Color index for the 9 first colors + */ + +.palettes-list-color:nth-child(-n+10):after { + position: absolute; + top: 0; + right: 0; + + background-color: black; + color: gold; + + font-family: Tahoma; + font-size: 0.5em; + font-weight: bold; + + padding: 2px 3px 2px 3px; + border-radius: 0 0 0 2px; +} + +.palettes-list-color:nth-child(1):after { + content: "1"; +} + +.palettes-list-color:nth-child(2):after { + content: "2"; +} + +.palettes-list-color:nth-child(3):after { + content: "3"; +} + +.palettes-list-color:nth-child(4):after { + content: "4"; +} + +.palettes-list-color:nth-child(5):after { + content: "5"; +} + +.palettes-list-color:nth-child(6):after { + content: "6"; +} + +.palettes-list-color:nth-child(7):after { + content: "7"; +} + +.palettes-list-color:nth-child(8):after { + content: "8"; +} + +.palettes-list-color:nth-child(9):after { + content: "9"; +} + +/** + * Animated preview styles. + */ + +.preview-container { + flex-shrink: 0; + + border : 0 Solid black; + border-radius:5px 0 0 5px; + box-shadow : 0 0 2px rgba(0,0,0,0.2); + font-size: 0; +} + +.preview-container .canvas-container { + overflow : hidden; +} + +.preview-container canvas { + border : 0 Solid transparent; +} + +.canvas-container .animated-preview-canvas-background { + position : relative; + height: 100%; +} + +#animated-preview-container { + background: #333; + border-radius : 0 0 2px 2px; + overflow : hidden; +} + +.canvas-container-wrapper { + height :200px; + width : 200px; + overflow:hidden; +} + +.preview-container .background-image-frame-container { + height: 100%; + width: 100%; + position: relative; + background-position: center; +} + +.display-fps { + float: left; + color: #aaa; + font-size: 12px; + min-width: 55px; + vertical-align: bottom; + line-height: 26px; +} + +.range-fps { + overflow: hidden; + width: 100px; + height : 26px; + margin : 0; + box-sizing: border-box; +} + +.preview-toggle-onion-skin { + font-size: 2rem; + color: #aaa; + float: left; + line-height: 26px; + height: 100%; + padding-left: 5px; + padding-right: 5px; + border-right: 1px solid #222; + transition: 0.2s linear; + cursor:pointer; +} + +.preview-toggle-onion-skin:hover { + color : white; +} + +.preview-toggle-onion-skin-enabled, +.preview-toggle-onion-skin-enabled:hover { + color : gold; +} + +.preview-contextual-actions { + position : absolute; + z-index: 500; + right : 10px; + top : 10px; + + cursor : pointer; + + opacity: 0; + transition: 0.3s opacity, 0.3s border-color; +} + +.minimap-container:hover .preview-contextual-actions { + opacity: 1; +} + +.preview-contextual-action { + float: left; + + width : 18px; + height: 18px; + line-height: 18px; + margin: 0 5px; + + border: 2px solid white; + background-color: rgba(0, 0, 0, 0.3); + color: white; + + font-size: 10px; + font-weight: bold; + font-family: Tahoma; +} + +.preview-contextual-action-hidden { + display: none; +} + +.preview-contextual-action:hover { + color: gold; + border-color: gold; +} + +/** + * Drop-down in preview size selection + */ +.preview-drop-down { + float: left; + position: relative; + width : 22px; + min-height: 22px; + margin: 0 5px; +} + +.preview-drop-down.preview-drop-down-disabled { + opacity: 0.5; +} + +.preview-disable-overlay{ + position: absolute; + width: 100%; + height: 100%; + display: none; +} + +.preview-drop-down.preview-drop-down-disabled .preview-disable-overlay { + display: block; + z-index: 10; +} + +.preview-drop-down .preview-contextual-action { + position: relative; + margin: 0 0 -100% 0; + opacity: 0; + transition: opacity linear .2s, + margin linear .2s; + transition-delay: 0s, .2s; + z-index: 1; +} + +.preview-drop-down:hover .preview-contextual-action { + margin: 0 0 5px 0; + opacity: 1; + transition-delay: 0s, 0s; +} + +.preview-drop-down .size-button-selected { + opacity: 1; + color: gold; + border-color: gold; + z-index: 5; +} + + +.open-popup-preview-button { + border : 2px solid white; + background-color : rgba(0,0,0,0.3); +} + +.open-popup-preview-button:hover { + border-color: gold; +} + +/** + * The regular image is provided by the sprite icons.png+icons.css + */ +.icon-minimap-popup-preview-arrow-white:hover { + background-image: url(../img/icons/minimap/minimap-popup-preview-arrow-gold.png); + background-position: 0 0; + background-size: 18px 18px; +} + +@media (-webkit-min-device-pixel-ratio: 2), + (min-resolution: 192dpi) { + background-image: url(../img/icons/minimap/minimap-popup-preview-arrow-gold@2x.png); + +} + +.transformations-container { + flex-shrink: 0; +} + +.transformations-container .tool-icon { + float:left; +} + +/*** +Spectrum Colorpicker v1.1.2 +https://github.com/bgrins/spectrum +Author: Brian Grinstead +License: MIT +***/ + +.sp-container { + position:absolute; + top:0; + left:0; + display:inline-block; + *display: inline; + *zoom: 1; + /* https://github.com/bgrins/spectrum/issues/40 */ + z-index: 9999994; + overflow: hidden; +} +.sp-container.sp-flat { + position: relative; +} + +/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */ +.sp-top { + position:relative; + width: 100%; + display:inline-block; +} +.sp-top-inner { + position:absolute; + top:0; + left:0; + bottom:0; + right:0; +} +.sp-color { + position: absolute; + top:0; + left:0; + bottom:0; + right:20%; +} +.sp-hue { + position: absolute; + top:0; + right:0; + bottom:0; + left:84%; + height: 100%; +} +.sp-fill { + padding-top: 80%; +} +.sp-sat, .sp-val { + position: absolute; + top:0; + left:0; + right:0; + bottom:0; +} + +.sp-alpha-enabled .sp-top { + margin-bottom: 18px; +} +.sp-alpha-enabled .sp-alpha { + display: block; +} +.sp-alpha-handle { + position:absolute; + top:-4px; + bottom: -4px; + width: 6px; + left: 50%; + cursor: pointer; + border: 1px solid black; + background: white; + opacity: .8; +} +.sp-alpha { + display: none; + position: absolute; + bottom: -14px; + right: 0; + left: 0; + height: 8px; +} +.sp-alpha-inner { + border: solid 1px #333; +} + +/* Don't allow text selection */ +.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button { + -webkit-user-select:none; + -moz-user-select: -moz-none; + -o-user-select:none; + user-select: none; +} + +.sp-container.sp-input-disabled .sp-input-container { + display: none; +} +.sp-container.sp-buttons-disabled .sp-button-container { + display: none; +} +.sp-palette-only .sp-picker-container { + display: none; +} +.sp-palette-disabled .sp-palette-container { + display: none; +} + +.sp-initial-disabled .sp-initial { + display: none; +} + + +/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */ +.sp-sat { + background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0))); + background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0)); + background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); + background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0)); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)"; + filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81'); +} +.sp-val { + background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0))); + background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0)); + background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); + background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0)); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)"; + filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000'); +} + +.sp-hue { + background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); + background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000)); + background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); +} + +/* IE filters do not support multiple color stops. + Generate 6 divs, line them up, and do two color gradients for each. + Yes, really. + */ +.sp-1 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00'); +} +.sp-2 { + height:16%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00'); +} +.sp-3 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff'); +} +.sp-4 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff'); +} +.sp-5 { + height:16%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff'); +} +.sp-6 { + height:17%; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000'); +} + +.sp-hidden { + display: none !important; +} + +/* Clearfix hack */ +.sp-cf:before, .sp-cf:after { content: ""; display: table; } +.sp-cf:after { clear: both; } +.sp-cf { *zoom: 1; } + +/* Mobile devices, make hue slider bigger so it is easier to slide */ +@media (max-device-width: 480px) { + .sp-color { right: 40%; } + .sp-hue { left: 63%; } + .sp-fill { padding-top: 60%; } +} +.sp-dragger { + border-radius: 5px; + height: 5px; + width: 5px; + border: 1px solid #fff; + background: #000; + cursor: pointer; + position:absolute; + top:0; + left: 0; +} +.sp-slider { + position: absolute; + top:0; + cursor:pointer; + height: 3px; + left: -1px; + right: -1px; + border: 1px solid #000; + background: white; + opacity: .8; +} + +/* +Theme authors: +Here are the basic themeable display options (colors, fonts, global widths). +See http://bgrins.github.io/spectrum/themes/ for instructions. +*/ + +.sp-container { + border-radius: 0; + background-color: #ECECEC; + border: solid 1px #f0c49B; + padding: 0; +} +.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue +{ + font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.sp-top +{ + margin-bottom: 3px; +} +.sp-color, .sp-hue +{ + border: solid 1px #666; +} + +/* Input */ +.sp-input-container { + float:right; + width: 100px; + margin-bottom: 4px; +} +.sp-initial-disabled .sp-input-container { + width: 100%; +} +.sp-input { + font-size: 12px !important; + border: 1px inset; + padding: 4px 5px; + margin: 0; + width: 100%; + background:transparent; + border-radius: 3px; + color: #222; +} +.sp-input:focus { + border: 1px solid orange; +} +.sp-input.sp-validation-error +{ + border: 1px solid red; + background: #fdd; +} +.sp-picker-container , .sp-palette-container +{ + float:left; + position: relative; + padding: 10px; + padding-bottom: 300px; + margin-bottom: -290px; +} +.sp-picker-container +{ + width: 172px; + border-left: solid 1px #fff; +} + +/* Palettes */ +.sp-palette-container +{ + border-right: solid 1px #ccc; +} + +.sp-palette .sp-thumb-el { + display: block; + position:relative; + float:left; + width: 24px; + height: 15px; + margin: 3px; + cursor: pointer; + border:solid 2px transparent; +} +.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active { + border-color: orange; +} +.sp-thumb-el +{ + position:relative; +} + +/* Initial */ +.sp-initial +{ + float: left; + border: solid 1px #333; +} +.sp-initial span { + width: 30px; + height: 25px; + border:none; + display:block; + float:left; + margin:0; +} + +/* Buttons */ +.sp-button-container { + float: right; +} + +/* Replacer (the little preview div that shows up instead of the ) */ +.sp-replacer { + margin:0; + overflow:hidden; + cursor:pointer; + padding: 4px; + display:inline-block; + *zoom: 1; + *display: inline; + border: solid 1px #91765d; + background: #eee; + color: #333; + vertical-align: middle; +} +.sp-replacer:hover, .sp-replacer.sp-active { + border-color: #F0C49B; + color: #111; +} +.sp-replacer.sp-disabled { + cursor:default; + border-color: silver; + color: silver; +} +.sp-dd { + padding: 2px 0; + height: 16px; + line-height: 16px; + float:left; + font-size:10px; +} +.sp-preview +{ + position:relative; + width:25px; + height: 20px; + border: solid 1px #222; + margin-right: 5px; + float:left; + z-index: 0; +} + +.sp-palette +{ + *width: 220px; + max-width: 220px; +} +.sp-palette .sp-thumb-el +{ + width:16px; + height: 16px; + margin:2px 1px; + border: solid 1px #d0d0d0; +} + +.sp-container +{ + padding-bottom:0; +} + + +/* Buttons: http://hellohappy.org/css3-buttons/ */ +.sp-container button { + background-color: #eeeeee; + background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); + background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); + background-image: -ms-linear-gradient(top, #eeeeee, #cccccc); + background-image: -o-linear-gradient(top, #eeeeee, #cccccc); + background-image: linear-gradient(to bottom, #eeeeee, #cccccc); + border: 1px solid #ccc; + border-bottom: 1px solid #bbb; + border-radius: 3px; + color: #333; + font-size: 14px; + line-height: 1; + padding: 5px 4px; + text-align: center; + text-shadow: 0 1px 0 #eee; + vertical-align: middle; +} +.sp-container button:hover { + background-color: #dddddd; + background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb); + background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb); + background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb); + background-image: -o-linear-gradient(top, #dddddd, #bbbbbb); + background-image: linear-gradient(to bottom, #dddddd, #bbbbbb); + border: 1px solid #bbb; + border-bottom: 1px solid #999; + cursor: pointer; + text-shadow: 0 1px 0 #ddd; +} +.sp-container button:active { + border: 1px solid #aaa; + border-bottom: 1px solid #888; + -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; + -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; + -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; + -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; + box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; +} +.sp-cancel +{ + font-size: 11px; + color: #d93f3f !important; + margin:0; + padding:2px; + margin-right: 5px; + vertical-align: middle; + text-decoration:none; + +} +.sp-cancel:hover +{ + color: #d93f3f !important; + text-decoration: underline; +} + + +.sp-palette span:hover, .sp-palette span.sp-thumb-active +{ + border-color: #000; +} + +.sp-preview, .sp-alpha, .sp-thumb-el +{ + position:relative; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==); +} +.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner +{ + display:block; + position:absolute; + top:0;left:0;bottom:0;right:0; +} + +.sp-palette .sp-thumb-inner +{ + background-position: 50% 50%; + background-repeat: no-repeat; +} + +.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner +{ + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=); +} + +.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner +{ + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=); +} + +/** + * Piskel specific CSS for spectrum widgets + */ + +/* Widget's main container */ +.sp-container { + border-radius: 4px; + background-color: #2B2B2B; + border: solid 4px #888; + padding: 5px 5px 0 5px; + box-shadow : 0 0 5px 0 black; +} + +.sp-container[data-y-position=bottom] { + border-top-left-radius: 0; +} + +.sp-container[data-y-position=top] { + border-bottom-left-radius: 0; +} + +/* Color square container */ +.sp-color, .sp-hue { + border : 1px solid #222; +} + +/* Remove the padding on the input container */ +.sp-replacer { + padding: 4px; + height: 100%; + border-width: 0; + box-sizing: border-box; + -moz-box-sizing:border-box; + background-color: #444; +} + +.sp-replacer:hover { + background-color: #888; +} + +/* Hide the triangle */ +.sp-dd { + display: none; +} + +/* */ +.sp-preview { + margin-right: 0; + height: 100%; + width: 39px; + border-width: 0; +} + +.sp-palette-row-selection { + max-width: 62px; +} + +.sp-palette .sp-thumb-el { + margin : 0 5px 5px 0; + width: 24px; + height: 24px; + border-color: #444; + +} + +.sp-picker-container, .sp-palette-container { + padding-top: 5px; + padding-right: 5px; + padding-left: 5px; + border-left-width: 0; + border-right-width: 0; +} + +.sp-picker-container { + padding: 5px; + padding-bottom: 300px; + margin-bottom: -295px; +} + +.sp-slider { + height: 5px; + left: -2px; + right: -2px; + border: 2px solid white; + background: rgba(255,255,255,0); + opacity: 1; + border-radius: 2px; + box-shadow: 0 0 1px 1px rgba(0,0,0,0.5), inset 0 0 1px 1px rgba(0,0,0,0.5); +} + +.sp-dragger { + border-radius: 8px; + height: 12px; + width: 12px; + border: 2px solid white; + background: none; + box-sizing:border-box; + -moz-box-sizing:border-box; + box-shadow: 0 0 1px 1px rgba(0,0,0,0.5), inset 0 0 1px 1px rgba(0,0,0,0.5); +} + +.sp-palette .sp-thumb-el.sp-thumb-active { + border-color: gold; + box-shadow: 0 0 0px 1px gold; +} + +.sp-input { + border: 1px solid #666; + margin: 0; + background: #111; + border-radius: 2px; + color: #D3D3D3; + font-family: monospace!important; +} + +.sp-input.sp-validation-error { + background: #330000; +} +/*! + * Bootstrap v2.1.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix { + *zoom: 1; +} +.clearfix:before, +.clearfix:after { + display: table; + content: ""; + line-height: 0; +} +.clearfix:after { + clear: both; +} +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.input-block-level { + display: block; + width: 100%; + min-height: 30px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.tooltip { + position: absolute; + z-index: 30000; + display: block; + visibility: visible; + padding: 5px; + font-size: 11px; + opacity: 0; + filter: alpha(opacity=0); +} +.tooltip.in { + opacity: 0.8; + filter: alpha(opacity=80); +} +.tooltip.top { + margin-top: -3px; +} +.tooltip.right { + margin-left: 3px; +} +.tooltip.bottom { + margin-top: 3px; +} +.tooltip.left { + margin-left: -3px; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #ffffff; + text-align: center; + text-decoration: none; + background-color: #000000; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-width: 5px 5px 0; + border-top-color: #000000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-width: 5px 5px 5px 0; + border-right-color: #000000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-width: 5px 0 5px 5px; + border-left-color: #000000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000000; +} + +.tooltip { + line-height: 20px; +} + +.tooltip.in { + opacity: 0.95; + filter: alpha(opacity=95); +} + +.tooltip { + line-height: 20px; +} +.preview-list-wrapper { + position: relative; + height: 100%; + overflow: hidden; +} + +.preview-list-scroller { + overflow-y: scroll; + overflow-x: hidden; + height: 100%; +} + +.top-overflow, +.bottom-overflow { + height: 20px; + position: absolute; + left: 0; + right: 12px; + + -webkit-transition: all 500ms ease-out; + -moz-transition: all 500ms ease-out; + -ms-transition: all 500ms ease-out; + -o-transition: all 500ms ease-out; + transition: all 500ms ease-out; + + background-image: linear-gradient(45deg, #1D1D1D 20%, transparent 25%, transparent 75%, #1D1D1D 80%, #1D1D1D), + linear-gradient(-45deg, #1D1D1D 20%, transparent 25%, transparent 75%, #1D1D1D 80%, #1D1D1D); + background-size: 30px 40px; + background-repeat: repeat-x; + background-position: 3px 0; + z-index: 10; +} + +.top-overflow { + top: -20px; +} + +.bottom-overflow { + bottom: -20px; + background-position: 3px -20px; +} + +.top-overflow-visible .top-overflow { + top: 0; +} + +.bottom-overflow-visible .bottom-overflow { + bottom: 0; +} + +.preview-list { + list-style-type: none; + padding-right: 9px; +} + +.add-frame-action { + display: flex; + align-items: center; + + margin-top: 8px; + padding: 6px 0; + overflow: hidden; + width: 96px; + + border: #888 solid 3px; + border-radius: 4px; + + color: #888; + background-color: #222; + font-size: 13px; + cursor: pointer; +} + +.add-frame-action-icon { + margin: 3px; + float: left; + flex-shrink: 0; +} + +.add-frame-action .label { + overflow: hidden; + text-align: left; +} + +.add-frame-action:hover { + border-color: gold; +} + +.preview-tile { + position: relative; + border: #444 3px solid; + border-radius: 3px; + margin: 5px 0; + width: 96px; + height: 96px; +} + +.preview-tile:first-child { + margin-top: 0; +} + +.preview-tile:hover { + border: #999 3px solid; +} + +.tile-view { + position : relative; +} + +.preview-tile .tile-overlay { + z-index: 10; + position: absolute; + background-color: rgba(100, 100, 100, 0.6); + opacity: 0; + height: 30px; + width: 30px; + border: none; +} + +.preview-tile:hover .tile-overlay { + opacity: 1.0; +} + +.preview-tile .tile-overlay.tile-count { + display: block; + opacity: 1.0; + border-bottom-right-radius: 3px; + top: 0; + left: 0; + font-size: 14px; + line-height: 30px; + color: white; + font-weight: bold; + text-align: center; + cursor: default; +} + +.preview-tile .tile-overlay.delete-frame-action { + top: 0; + right: 0; + border-bottom-left-radius: 3px; + cursor: pointer; +} + +.preview-tile .tile-overlay.duplicate-frame-action { + bottom: 0; + right: 0; + border-bottom-left-radius: 3px; + cursor: pointer; +} + +.preview-tile .tile-overlay.dnd-action { + bottom: 0; + left: 0; + border-top-right-radius: 3px; + cursor: move; +} + +.preview-tile.selected { + border-color: gold; +} + +.preview-tile.selected:after { + content: ""; + position: absolute; + top: 38px; + right: -9px; + border: transparent 4px solid; + border-left-color: gold; + border-width: 6px 0 6px 6px; + border-style: solid; +} + + +/** + * Drag n drop styles. + */ + +.preview-tile-drop-proxy { + border: 3px dashed gold; + background-color: rgba(255, 215,0, 0.2); +} + +.minimap-crop-frame { + position: absolute; + border: 2px solid gold; + z-index: 100; + box-sizing: border-box; + -moz-box-sizing: border-box; + cursor: pointer; +} +/*****************/ +/* ANCHOR WIDGET */ +/*****************/ + +.anchor-wrapper { + overflow: hidden; + width: 70px; +} + +/* When transitioning between enabled and disabled states */ +.transition .anchor-option, +.transition .anchor-option:before { + transition: background-color 0.2s, border-color 0.2s; +} + +.anchor-option { + float: left; + position: relative; + + box-sizing: border-box; + margin: 0 1px 1px 0; + width: 20px; + height: 20px; + + background : #888; + + font-size: 8px; + text-align: center; + cursor: pointer; +} + +.disabled .anchor-option { + cursor: default; + background : #555; + border-color: #555 !important; +} + +.anchor-option:hover { + border : 3px solid white; +} + +.anchor-option.selected { + border : 3px solid gold; +} + +.anchor-option:before { + content: ''; + position: absolute; + display: block; + top: 50%; + left: 50%; + margin: -2px; +} + +.anchor-option.selected:before { + content: ''; + width: 4px; + height: 4px; + background: gold; +} + +.disabled .anchor-option.selected:before { + background: #555; +} + +.disabled .anchor-option[data-neighbor]:before { + border-color: #555 !important; +} + +.anchor-option[data-neighbor]:before { + width: 0; + height: 0; + border-width: 4px; + border-style: solid; + border-color: transparent; +} + +.anchor-option[data-neighbor="bottom"]:before { + border-top-color: gold; + margin-left: -4px; +} + +.anchor-option[data-neighbor="left"]:before { + border-right-color: gold; + margin-top: -4px; + margin-left: -6px; +} + +.anchor-option[data-neighbor="top"]:before { + border-bottom-color: gold; + margin-top: -6px; + margin-left: -4px; +} + +.anchor-option[data-neighbor="right"]:before { + border-left-color: gold; + margin-top: -4px; +} + +/***********************/ +/* FRAME PICKER WIDGET */ +/***********************/ + +.frame-picker-wrapper { + width: 150px; + height: 150px; + border: 3px solid #666; + border-radius: 3px; +} + +.frame-viewer { + width: 100%; + height: calc(100% - 25px); + display: flex; + align-items: center; + justify-content: center; + +} + +.frame-viewer > canvas, +.frame-viewer > img { + max-width: 100%; + max-height: 100%; +} + +.frame-nav { + display: flex; + width: 100%; + height: 24px; + border-top: 1px solid #666; +} + +.frame-nav .button { + flex-shrink: 0; + border-radius: 0; + height: 24px; + background-color: #3f3f3f; +} + +.frame-nav .button[disabled], +.frame-nav .button[disabled]:hover { + background-color: #aaa; +} + +.frame-nav .button + .button { + border-left: 1px solid #333; +} + +.frame-nav-input { + min-width: 1px; + border-style: none; + height: 24px; + text-align: center; +} + +.wizard-wrapper { + z-index: 1; + position: relative; + width: 100%; + height: 100%; + overflow: hidden; +} + +.wizard-step { + z-index: -1; + margin-left: calc(100% + 5px); + position: absolute; +} + +.current-step { + z-index: 1; + margin-left: 0; +} + +.current-step-in, +.current-step-out { + z-index: 10; + transition: margin-left 200ms; +} + +.current-step-in { + margin-left: 0; +} + +.current-step-out { + margin-left: 100%; +} diff --git a/index.html b/index.html index 7f796c78..879bca92 100644 --- a/index.html +++ b/index.html @@ -117,7 +117,12 @@
-
1x
+
+
+
1x
+
+
Full
+
@@ -284,7 +289,7 @@ @@ -457,57 +462,6 @@ data-palette-color="{{color}}">
X
- - + + + + + + + + + + + + + + + + + + + + Image tag attributes: + + data-animated-src - If this url is specified, it's loaded into the player instead of src. + This allows a preview frame to be shown until animated gif data is streamed into the canvas + + Constructor options args + + gif Required. The DOM element of an img tag. + + Instance methods + + // loading + load( callback ) Loads the gif into a canvas element and then calls callback if one is passed + + For additional customization (viewport inside iframe) these params may be passed: + c_w, c_h - width and height of canvas + vp_t, vp_l, vp_ w, vp_h - top, left, width and height of the viewport + + A bonus: few articles to understand what is going on + http://enthusiasms.org/post/16976438906 + http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp + http://humpy77.deviantart.com/journal/Frame-Delay-Times-for-Animated-GIFs-214150546 + +*/ + +( function( window ) { 'use strict'; + +// Generic functions +var bitsToNum = function (ba) { + return ba.reduce(function (s, n) { + return s * 2 + n; + }, 0); +}; + +var byteToBitArr = function (bite) { + var a = []; + for (var i = 7; i >= 0; i--) { + a.push( !! (bite & (1 << i))); + } + return a; +}; + +// Stream +/** + * @constructor + */ +// Make compiler happy. +var Stream = function (data) { + this.data = data; + this.len = this.data.length; + this.pos = 0; + + this.readByte = function () { + if (this.pos >= this.data.length) { + throw new Error('Attempted to read past end of stream.'); + } + return data.charCodeAt(this.pos++) & 0xFF; + }; + + this.readBytes = function (n) { + var bytes = []; + for (var i = 0; i < n; i++) { + bytes.push(this.readByte()); + } + return bytes; + }; + + this.read = function (n) { + var s = ''; + for (var i = 0; i < n; i++) { + s += String.fromCharCode(this.readByte()); + } + return s; + }; + + this.readUnsigned = function () { // Little-endian. + var a = this.readBytes(2); + return (a[1] << 8) + a[0]; + }; +}; + +var lzwDecode = function (minCodeSize, data) { + // TODO: Now that the GIF parser is a bit different, maybe this should get an array of bytes instead of a String? + var pos = 0; // Maybe this streaming thing should be merged with the Stream? + var readCode = function (size) { + var code = 0; + for (var i = 0; i < size; i++) { + if (data.charCodeAt(pos >> 3) & (1 << (pos & 7))) { + code |= 1 << i; + } + pos++; + } + return code; + }; + + var output = []; + + var clearCode = 1 << minCodeSize; + var eoiCode = clearCode + 1; + + var codeSize = minCodeSize + 1; + + var dict = []; + + var clear = function () { + dict = []; + codeSize = minCodeSize + 1; + for (var i = 0; i < clearCode; i++) { + dict[i] = [i]; + } + dict[clearCode] = []; + dict[eoiCode] = null; + + }; + + var code; + var last; + + while (true) { + last = code; + code = readCode(codeSize); + + if (code === clearCode) { + clear(); + continue; + } + if (code === eoiCode) break; + + if (code < dict.length) { + if (last !== clearCode) { + dict.push(dict[last].concat(dict[code][0])); + } + } + else { + if (code !== dict.length) throw new Error('Invalid LZW code.'); + dict.push(dict[last].concat(dict[last][0])); + } + output.push.apply(output, dict[code]); + + if (dict.length === (1 << codeSize) && codeSize < 12) { + // If we're at the last code and codeSize is 12, the next code will be a clearCode, and it'll be 12 bits long. + codeSize++; + } + } + + // I don't know if this is technically an error, but some GIFs do it. + //if (Math.ceil(pos / 8) !== data.length) throw new Error('Extraneous LZW bytes.'); + return output; +}; + + +// The actual parsing; returns an object with properties. +var parseGIF = function (st, handler) { + handler || (handler = {}); + + // LZW (GIF-specific) + var parseCT = function (entries) { // Each entry is 3 bytes, for RGB. + var ct = []; + for (var i = 0; i < entries; i++) { + ct.push(st.readBytes(3)); + } + return ct; + }; + + var readSubBlocks = function () { + var size, data; + data = ''; + do { + size = st.readByte(); + data += st.read(size); + } while (size !== 0); + return data; + }; + + var parseHeader = function () { + var hdr = {}; + hdr.sig = st.read(3); + hdr.ver = st.read(3); + if (hdr.sig !== 'GIF') { + handler.onError(); // XXX: This should probably be handled more nicely. + throw new Error('Not a GIF file.'); + } + hdr.width = st.readUnsigned(); + hdr.height = st.readUnsigned(); + + var bits = byteToBitArr(st.readByte()); + hdr.gctFlag = bits.shift(); + hdr.colorRes = bitsToNum(bits.splice(0, 3)); + hdr.sorted = bits.shift(); + hdr.gctSize = bitsToNum(bits.splice(0, 3)); + + hdr.bgColor = st.readByte(); + hdr.pixelAspectRatio = st.readByte(); // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64 + if (hdr.gctFlag) { + hdr.gct = parseCT(1 << (hdr.gctSize + 1)); + } + handler.hdr && handler.hdr(hdr); + }; + + var parseExt = function (block) { + var parseGCExt = function (block) { + var blockSize = st.readByte(); // Always 4 + var bits = byteToBitArr(st.readByte()); + block.reserved = bits.splice(0, 3); // Reserved; should be 000. + block.disposalMethod = bitsToNum(bits.splice(0, 3)); + block.userInput = bits.shift(); + block.transparencyGiven = bits.shift(); + + block.delayTime = st.readUnsigned(); + + block.transparencyIndex = st.readByte(); + + block.terminator = st.readByte(); + + handler.gce && handler.gce(block); + }; + + var parseComExt = function (block) { + block.comment = readSubBlocks(); + handler.com && handler.com(block); + }; + + var parsePTExt = function (block) { + // No one *ever* uses this. If you use it, deal with parsing it yourself. + var blockSize = st.readByte(); // Always 12 + block.ptHeader = st.readBytes(12); + block.ptData = readSubBlocks(); + handler.pte && handler.pte(block); + }; + + var parseAppExt = function (block) { + var parseNetscapeExt = function (block) { + var blockSize = st.readByte(); // Always 3 + block.unknown = st.readByte(); // ??? Always 1? What is this? + block.iterations = st.readUnsigned(); + block.terminator = st.readByte(); + handler.app && handler.app.NETSCAPE && handler.app.NETSCAPE(block); + }; + + var parseUnknownAppExt = function (block) { + block.appData = readSubBlocks(); + // FIXME: This won't work if a handler wants to match on any identifier. + handler.app && handler.app[block.identifier] && handler.app[block.identifier](block); + }; + + var blockSize = st.readByte(); // Always 11 + block.identifier = st.read(8); + block.authCode = st.read(3); + switch (block.identifier) { + case 'NETSCAPE': + parseNetscapeExt(block); + break; + default: + parseUnknownAppExt(block); + break; + } + }; + + var parseUnknownExt = function (block) { + block.data = readSubBlocks(); + handler.unknown && handler.unknown(block); + }; + + block.label = st.readByte(); + switch (block.label) { + case 0xF9: + block.extType = 'gce'; + parseGCExt(block); + break; + case 0xFE: + block.extType = 'com'; + parseComExt(block); + break; + case 0x01: + block.extType = 'pte'; + parsePTExt(block); + break; + case 0xFF: + block.extType = 'app'; + parseAppExt(block); + break; + default: + block.extType = 'unknown'; + parseUnknownExt(block); + break; + } + }; + + var parseImg = function (img) { + var deinterlace = function (pixels, width) { + // Of course this defeats the purpose of interlacing. And it's *probably* + // the least efficient way it's ever been implemented. But nevertheless... + var newPixels = new Array(pixels.length); + var rows = pixels.length / width; + var cpRow = function (toRow, fromRow) { + var fromPixels = pixels.slice(fromRow * width, (fromRow + 1) * width); + newPixels.splice.apply(newPixels, [toRow * width, width].concat(fromPixels)); + }; + + // See appendix E. + var offsets = [0, 4, 2, 1]; + var steps = [8, 8, 4, 2]; + + var fromRow = 0; + for (var pass = 0; pass < 4; pass++) { + for (var toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) { + cpRow(toRow, fromRow) + fromRow++; + } + } + + return newPixels; + }; + + img.leftPos = st.readUnsigned(); + img.topPos = st.readUnsigned(); + img.width = st.readUnsigned(); + img.height = st.readUnsigned(); + + var bits = byteToBitArr(st.readByte()); + img.lctFlag = bits.shift(); + img.interlaced = bits.shift(); + img.sorted = bits.shift(); + img.reserved = bits.splice(0, 2); + img.lctSize = bitsToNum(bits.splice(0, 3)); + + if (img.lctFlag) { + img.lct = parseCT(1 << (img.lctSize + 1)); + } + + img.lzwMinCodeSize = st.readByte(); + + var lzwData = readSubBlocks(); + + img.pixels = lzwDecode(img.lzwMinCodeSize, lzwData); + + if (img.interlaced) { // Move + img.pixels = deinterlace(img.pixels, img.width); + } + + handler.img && handler.img(img); + }; + + var parseBlock = function () { + var block = {}; + block.sentinel = st.readByte(); + + switch (String.fromCharCode(block.sentinel)) { // For ease of matching + case '!': + block.type = 'ext'; + parseExt(block); + break; + case ',': + block.type = 'img'; + parseImg(block); + break; + case ';': + block.type = 'eof'; + handler.eof && handler.eof(block); + break; + default: + return handler.onError(new Error('Unknown block: 0x' + block.sentinel.toString(16))); // TODO: Pad this with a 0. + } + + if (block.type !== 'eof') { + setTimeout(parseBlock, 0); + } + }; + + var parse = function () { + parseHeader(); + setTimeout(parseBlock, 0); + }; + + parse(); +}; + + +var SuperGif = function ( opts ) { + var options = { + //viewport position + vp_l: 0, + vp_t: 0, + vp_w: null, + vp_h: null, + //canvas sizes + c_w: null, + c_h: null + }; + for (var i in opts ) { options[i] = opts[i] } + if (options.vp_w && options.vp_h) options.is_vp = true; + + var stream; + var hdr; + + var loadError = null; + var loading = false; + + var transparency = null; + var delay = null; + var disposalMethod = null; + var disposalRestoreFromIdx = 0; + var lastDisposalMethod = null; + var frame = null; + var lastImg = null; + + var frames = []; + + var gif = options.gif; + + var clear = function () { + transparency = null; + delay = null; + lastDisposalMethod = disposalMethod; + disposalMethod = null; + frame = null; + }; + + // XXX: There's probably a better way to handle catching exceptions when + // callbacks are involved. + var doParse = function () { + try { + parseGIF(stream, handler); + } + catch (err) { + doLoadError('parse'); + } + }; + + var setSizes = function(w, h) { + tmpCanvas.width = w; + tmpCanvas.height = h; + tmpCanvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0); + } + + var doLoadError = function (originOfError) { + + + loadError = originOfError; + hdr = { + width: gif.width, + height: gif.height + }; // Fake header. + frames = []; + }; + + var doHdr = function (_hdr) { + hdr = _hdr; + setSizes(hdr.width, hdr.height) + }; + + var doGCE = function (gce) { + pushFrame(); + clear(); + transparency = gce.transparencyGiven ? gce.transparencyIndex : null; + delay = gce.delayTime; + disposalMethod = gce.disposalMethod; + // We don't have much to do with the rest of GCE. + }; + + var pushFrame = function () { + if (!frame) return; + frames.push({ + data: frame.getImageData(0, 0, hdr.width, hdr.height), + delay: delay + }); + }; + + // flag for drawing initial frame + var isInitFrameDrawn = false; + + var doImg = function (img) { + if (!frame) frame = tmpCanvas.getContext('2d'); + + var currIdx = frames.length; + + //ct = color table, gct = global color table + var ct = img.lctFlag ? img.lct : hdr.gct; // TODO: What if neither exists? + + /* + Disposal method indicates the way in which the graphic is to + be treated after being displayed. + + Values : 0 - No disposal specified. The decoder is + not required to take any action. + 1 - Do not dispose. The graphic is to be left + in place. + 2 - Restore to background color. The area used by the + graphic must be restored to the background color. + 3 - Restore to previous. The decoder is required to + restore the area overwritten by the graphic with + what was there prior to rendering the graphic. + + Importantly, "previous" means the frame state + after the last disposal of method 0, 1, or 2. + */ + if (currIdx > 0) { + if (lastDisposalMethod === 3) { + // Restore to previous + frame.putImageData(frames[disposalRestoreFromIdx].data, 0, 0); + } else { + disposalRestoreFromIdx = currIdx - 1; + } + + if (lastDisposalMethod === 2) { + // Restore to background color + // Browser implementations historically restore to transparent; we do the same. + // http://www.wizards-toolkit.org/discourse-server/viewtopic.php?f=1&t=21172#p86079 + frame.clearRect(lastImg.leftPos, lastImg.topPos, lastImg.width, lastImg.height); + } + } + // else, Undefined/Do not dispose. + // frame contains final pixel data from the last frame; do nothing + + //Get existing pixels for img region after applying disposal method + var imgData = frame.getImageData(img.leftPos, img.topPos, img.width, img.height); + //apply color table colors + var cdd = imgData.data; + img.pixels.forEach(function (pixel, i) { + // imgData.data === [R,G,B,A,R,G,B,A,...] + if (pixel !== transparency) { + cdd[i * 4 + 0] = ct[pixel][0]; + cdd[i * 4 + 1] = ct[pixel][1]; + cdd[i * 4 + 2] = ct[pixel][2]; + cdd[i * 4 + 3] = 255; // Opaque. + } + }); + + frame.putImageData(imgData, img.leftPos, img.topPos); + + lastImg = img; + }; + + var doNothing = function () {}; + /** + * @param{boolean=} draw Whether to draw progress bar or not; this is not idempotent because of translucency. + * Note that this means that the text will be unsynchronized with the progress bar on non-frames; + * but those are typically so small (GCE etc.) that it doesn't really matter. TODO: Do this properly. + */ + var handler = { + hdr: doHdr, + gce: doGCE, + // I guess that's all for now. + // app: { + // // TODO: Is there much point in actually supporting iterations? + // NETSCAPE: withProgress(doNothing) + // }, + img: doImg, + eof: function (block) { + pushFrame(); + loading = false; + if (load_callback) { + load_callback(); + } + }, + + onError : function (error) { + if (error_callback) { + error_callback(); + } + } + }; + + var load_callback = false; + var step_callback = false; + var error_callback = false; + var tmpCanvas = document.createElement('canvas'); + + return { + + load: function (callback) { + + load_callback = callback.success; + step_callback = callback.step; + error_callback = callback.error; + + loading = true; + + if (gif.src.indexOf('data:') !== -1) { + var data = gif.src.substring(gif.src.indexOf(',')+1); + stream = new Stream(window.atob(data)); + doParse(); + } else { + var h = new XMLHttpRequest(); + h.overrideMimeType('text/plain; charset=x-user-defined'); + h.onload = function(e) { + stream = new Stream(h.responseText); + setTimeout(doParse, 0); + }; + h.onerror = function() { doLoadError('xhr'); }; + h.open('GET', gif.getAttribute('data-animated-src') || gif.src, true); + h.send(); + } + }, + + getFrames : function () { + return frames; + } + }; +}; + + +window.SuperGif = SuperGif; + +})( window );;/*! + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2014 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library zlib.js released under the following license : +zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License +*/ +!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZip=a():"undefined"!=typeof global?global.JSZip=a():"undefined"!=typeof self&&(self.JSZip=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>2,g=(3&b)<<4|c>>4,h=(15&c)<<2|e>>6,i=63&e,isNaN(c)?h=i=64:isNaN(e)&&(i=64),j=j+d.charAt(f)+d.charAt(g)+d.charAt(h)+d.charAt(i);return j},c.decode=function(a){var b,c,e,f,g,h,i,j="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k>4,c=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(b),64!=h&&(j+=String.fromCharCode(c)),64!=i&&(j+=String.fromCharCode(e));return j}},{}],2:[function(a,b){"use strict";function c(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}c.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=c},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\x00\x00",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":6}],4:[function(a,b){"use strict";function c(){this.data=null,this.length=0,this.index=0}var d=a("./utils");c.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.lengtha)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return d.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=c},{"./utils":14}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.date=null,c.compression=null},{}],6:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("zlibjs/bin/rawdeflate.min").Zlib,f=a("zlibjs/bin/rawinflate.min").Zlib;c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\x00",c.compress=function(a){var b=new e.RawDeflate(a);return b.compress()},c.uncompress=function(a){var b=new f.RawInflate(a);return b.decompress()}},{"zlibjs/bin/rawdeflate.min":19,"zlibjs/bin/rawinflate.min":20}],7:[function(a,b){"use strict";function c(a,b){return this instanceof c?(this.files={},this.root="",a&&this.load(a,b),void(this.clone=function(){var a=new c;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a})):new c(a,b)}c.prototype=a("./object"),c.prototype.load=a("./load"),c.support=a("./support"),c.defaults=a("./defaults"),c.utils=a("./utils"),c.base64=a("./base64"),c.compressions=a("./compressions"),b.exports=c},{"./base64":1,"./compressions":3,"./defaults":5,"./load":8,"./object":9,"./support":12,"./utils":14}],8:[function(a,b){"use strict";var c=a("./base64"),d=a("./zipEntries");b.exports=function(a,b){var e,f,g,h;for(b=b||{},b.base64&&(a=c.decode(a)),f=new d(a,b),e=f.files,g=0;gc;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},r=function(){var a,b,c={};for(a=0;a0?a.substring(0,b):""},v=function(a){return"/"!=a.slice(-1)&&(a+="/"),this.files[a]||t.call(this,a,null,{dir:!0}),this.files[a]},w=function(a,b){var c,d=new k;return a._data instanceof k?(d.uncompressedSize=a._data.uncompressedSize,d.crc32=a._data.crc32,0===d.uncompressedSize||a.options.dir?(b=j.STORE,d.compressedContent="",d.crc32=0):a._data.compressionMethod===b.magic?d.compressedContent=a._data.getCompressedContent():(c=a._data.getContent(),d.compressedContent=b.compress(f.transformTo(b.compressInputType,c)))):(c=n(a),(!c||0===c.length||a.options.dir)&&(b=j.STORE,c=""),d.uncompressedSize=c.length,d.crc32=this.crc32(c),d.compressedContent=b.compress(f.transformTo(b.compressInputType,c))),d.compressedSize=d.compressedContent.length,d.compressionMethod=b.magic,d},x=function(a,b,c,d){var e,f,h=(c.compressedContent,this.utf8encode(b.name)),i=h!==b.name,j=b.options,k="",l="";e=j.date.getHours(),e<<=6,e|=j.date.getMinutes(),e<<=5,e|=j.date.getSeconds()/2,f=j.date.getFullYear()-1980,f<<=4,f|=j.date.getMonth()+1,f<<=5,f|=j.date.getDate(),i&&(l=q(1,1)+q(this.crc32(h),4)+h,k+="up"+q(l.length,2)+l);var m="";m+="\n\x00",m+=i?"\x00\b":"\x00\x00",m+=c.compressionMethod,m+=q(e,2),m+=q(f,2),m+=q(c.crc32,4),m+=q(c.compressedSize,4),m+=q(c.uncompressedSize,4),m+=q(h.length,2),m+=q(k.length,2);var n=g.LOCAL_FILE_HEADER+m+h+k,o=g.CENTRAL_FILE_HEADER+"\x00"+m+"\x00\x00\x00\x00\x00\x00"+(b.options.dir===!0?"\x00\x00\x00":"\x00\x00\x00\x00")+q(d,4)+h+k;return{fileRecord:n,dirRecord:o,compressedObject:c}},y=function(){this.data=[]};y.prototype={append:function(a){a=f.transformTo("string",a),this.data.push(a)},finalize:function(){return this.data.join("")}};var z=function(a){this.data=new Uint8Array(a),this.index=0};z.prototype={append:function(a){0!==a.length&&(a=f.transformTo("uint8array",a),this.data.set(a,this.index),this.index+=a.length)},finalize:function(){return this.data}};var A={load:function(){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(a){var b,c,d,e,f=[];for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],e=new p(d.name,d._data,r(d.options)),c=b.slice(this.root.length,b.length),b.slice(0,this.root.length)===this.root&&a(c,e)&&f.push(e));return f},file:function(a,b,c){if(1===arguments.length){if(f.isRegExp(a)){var d=a;return this.filter(function(a,b){return!b.options.dir&&d.test(a)})}return this.filter(function(b,c){return!c.options.dir&&b===a})[0]||null}return a=this.root+a,t.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(f.isRegExp(a))return this.filter(function(b,c){return c.options.dir&&a.test(b)});var b=this.root+a,c=v.call(this,b),d=this.clone();return d.root=c.name,d},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!=a.slice(-1)&&(a+="/"),b=this.files[a]),b)if(b.options.dir)for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;di;i++)h=c?a[i]:a.charCodeAt(i),g=255&(b^h),e=d[g],b=b>>>8^e;return-1^b},utf8encode:function(a){if(c){var b=c.encode(a);return f.transformTo("string",b)}if(e.nodebuffer)return f.transformTo("string",l(a,"utf-8"));for(var d=[],g=0,h=0;hi?d[g++]=String.fromCharCode(i):i>127&&2048>i?(d[g++]=String.fromCharCode(i>>6|192),d[g++]=String.fromCharCode(63&i|128)):(d[g++]=String.fromCharCode(i>>12|224),d[g++]=String.fromCharCode(i>>6&63|128),d[g++]=String.fromCharCode(63&i|128))}return d.join("")},utf8decode:function(a){var b=[],c=0,g=f.getTypeOf(a),h="string"!==g,i=0,j=0,k=0,l=0;if(d)return d.decode(f.transformTo("uint8array",a));if(e.nodebuffer)return f.transformTo("nodebuffer",a).toString("utf-8");for(;ij?(b[c++]=String.fromCharCode(j),i++):j>191&&224>j?(k=h?a[i+1]:a.charCodeAt(i+1),b[c++]=String.fromCharCode((31&j)<<6|63&k),i+=2):(k=h?a[i+1]:a.charCodeAt(i+1),l=h?a[i+2]:a.charCodeAt(i+2),b[c++]=String.fromCharCode((15&j)<<12|(63&k)<<6|63&l),i+=3);return b.join("")}};b.exports=A},{"./base64":1,"./compressedObject":2,"./compressions":3,"./defaults":5,"./nodeBuffer":17,"./signature":10,"./support":12,"./utils":14}],10:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\b"},{}],11:[function(a,b){"use strict";function c(a,b){this.data=a,b||(this.data=e.string2binary(this.data)),this.length=this.data.length,this.index=0}var d=a("./dataReader"),e=a("./utils");c.prototype=new d,c.prototype.byteAt=function(a){return this.data.charCodeAt(a)},c.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)},c.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./dataReader":4,"./utils":14}],12:[function(a,b,c){var d=a("__browserify_process");if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer=!d.browser,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var e=new ArrayBuffer(0);try{c.blob=0===new Blob([e],{type:"application/zip"}).size}catch(f){try{var g=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,h=new g;h.append(e),c.blob=0===h.getBlob("application/zip").size}catch(f){c.blob=!1}}}},{__browserify_process:18}],13:[function(a,b){"use strict";function c(a){a&&(this.data=a,this.length=this.data.length,this.index=0)}var d=a("./dataReader");c.prototype=new d,c.prototype.byteAt=function(a){return this.data[a]},c.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f;return-1},c.prototype.readData=function(a){this.checkOffset(a);var b=this.data.subarray(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./dataReader":4}],14:[function(a,b,c){"use strict";function d(a){return a}function e(a,b){for(var c=0;cg&&b>1;)try{d.push("array"===f||"nodebuffer"===f?String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e))):String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(i){b=Math.floor(b/2)}return d.join("")}function g(a,b){for(var c=0;cb?"0":"")+b.toString(16).toUpperCase();return d},c.findCompression=function(a){for(var b in i)if(i.hasOwnProperty(b)&&i[b].magic===a)return i[b];return null},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)}},{"./compressions":3,"./nodeBuffer":17,"./support":12}],15:[function(a,b){"use strict";function c(a,b){this.files=[],this.loadOptions=b,a&&this.load(a)}var d=a("./stringReader"),e=a("./nodeBufferReader"),f=a("./uint8ArrayReader"),g=a("./utils"),h=a("./signature"),i=a("./zipEntry"),j=a("./support");c.prototype={checkSignature:function(a){var b=this.reader.readString(4);if(b!==a)throw new Error("Corrupted zip or bug : unexpected signature ("+g.pretty(b)+", expected "+g.pretty(a)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;d>e;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readString(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],19:[function(){/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */ +(function(){"use strict";function a(a,b){var c=a.split("."),d=n;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||b===l?d=d[e]?d[e]:d[e]={}:d[e]=b}function b(a,b){if(this.index="number"==typeof b?b:0,this.d=0,this.buffer=a instanceof(o?Uint8Array:Array)?a:new(o?Uint8Array:Array)(32768),2*this.buffer.length<=this.index)throw Error("invalid index");this.buffer.length<=this.index&&c(this)}function c(a){var b,c=a.buffer,d=c.length,e=new(o?Uint8Array:Array)(d<<1);if(o)e.set(c);else for(b=0;d>b;++b)e[b]=c[b];return a.buffer=e}function d(a){this.buffer=new(o?Uint16Array:Array)(2*a),this.length=0}function e(a,b){this.e=w,this.f=0,this.input=o&&a instanceof Array?new Uint8Array(a):a,this.c=0,b&&(b.lazy&&(this.f=b.lazy),"number"==typeof b.compressionType&&(this.e=b.compressionType),b.outputBuffer&&(this.b=o&&b.outputBuffer instanceof Array?new Uint8Array(b.outputBuffer):b.outputBuffer),"number"==typeof b.outputIndex&&(this.c=b.outputIndex)),this.b||(this.b=new(o?Uint8Array:Array)(32768))}function f(a,b){this.length=a,this.g=b}function g(a,b){function c(a,b){var c,d=a.g,e=[],f=0;c=z[a.length],e[f++]=65535&c,e[f++]=c>>16&255,e[f++]=c>>24;var g;switch(m){case 1===d:g=[0,d-1,0];break;case 2===d:g=[1,d-2,0];break;case 3===d:g=[2,d-3,0];break;case 4===d:g=[3,d-4,0];break;case 6>=d:g=[4,d-5,1];break;case 8>=d:g=[5,d-7,1];break;case 12>=d:g=[6,d-9,2];break;case 16>=d:g=[7,d-13,2];break;case 24>=d:g=[8,d-17,3];break;case 32>=d:g=[9,d-25,3];break;case 48>=d:g=[10,d-33,4];break;case 64>=d:g=[11,d-49,4];break;case 96>=d:g=[12,d-65,5];break;case 128>=d:g=[13,d-97,5];break;case 192>=d:g=[14,d-129,6];break;case 256>=d:g=[15,d-193,6];break;case 384>=d:g=[16,d-257,7];break;case 512>=d:g=[17,d-385,7];break;case 768>=d:g=[18,d-513,8];break;case 1024>=d:g=[19,d-769,8];break;case 1536>=d:g=[20,d-1025,9];break;case 2048>=d:g=[21,d-1537,9];break;case 3072>=d:g=[22,d-2049,10];break;case 4096>=d:g=[23,d-3073,10];break;case 6144>=d:g=[24,d-4097,11];break;case 8192>=d:g=[25,d-6145,11];break;case 12288>=d:g=[26,d-8193,12];break;case 16384>=d:g=[27,d-12289,12];break;case 24576>=d:g=[28,d-16385,13];break;case 32768>=d:g=[29,d-24577,13];break;default:throw"invalid distance"}c=g,e[f++]=c[0],e[f++]=c[1],e[f++]=c[2];var h,i;for(h=0,i=e.length;i>h;++h)r[s++]=e[h];u[e[0]]++,v[e[3]]++,t=a.length+b-1,n=null}var d,e,f,g,i,j,k,n,p,q={},r=o?new Uint16Array(2*b.length):[],s=0,t=0,u=new(o?Uint32Array:Array)(286),v=new(o?Uint32Array:Array)(30),w=a.f;if(!o){for(f=0;285>=f;)u[f++]=0;for(f=0;29>=f;)v[f++]=0}for(u[256]=1,d=0,e=b.length;e>d;++d){for(f=i=0,g=3;g>f&&d+f!==e;++f)i=i<<8|b[d+f];if(q[i]===l&&(q[i]=[]),j=q[i],!(0=e){for(n&&c(n,-1),f=0,g=e-d;g>f;++f)p=b[d+f],r[s++]=p,++u[p];break}0h;h++){if(d=c[j-h-1],g=3,k>3){for(i=k;i>3;i--)if(a[d+i-1]!==a[b+i-1])continue a;g=k}for(;258>g&&l>b+g&&a[d+g]===a[b+g];)++g;if(g>k&&(e=d,k=g),258===g)break}return new f(k,b-e)}function i(a,b){var c,e,f,g,h,i=a.length,k=new d(572),l=new(o?Uint8Array:Array)(i);if(!o)for(g=0;i>g;g++)l[g]=0;for(g=0;i>g;++g)0g;++g)c[g]=k.pop(),e[g]=c[g].value;for(f=j(e,e.length,b),g=0,h=c.length;h>g;++g)l[c[g].index]=f[g];return l}function j(a,b,c){function d(a){var c=n[a][p[a]];c===b?(d(a+1),d(a+1)):--l[c],++p[a]}var e,f,g,h,i,j=new(o?Uint16Array:Array)(c),k=new(o?Uint8Array:Array)(c),l=new(o?Uint8Array:Array)(b),m=Array(c),n=Array(c),p=Array(c),q=(1<f;++f)r>q?k[f]=0:(k[f]=1,q-=r),q<<=1,j[c-2-f]=(j[c-1-f]/2|0)+b;for(j[0]=k[0],m[0]=Array(j[0]),n[0]=Array(j[0]),f=1;c>f;++f)j[f]>2*j[f-1]+k[f]&&(j[f]=2*j[f-1]+k[f]),m[f]=Array(j[f]),n[f]=Array(j[f]);for(e=0;b>e;++e)l[e]=c;for(g=0;ge;++e)p[e]=0;for(1===k[c-1]&&(--l[0],++p[c-1]),f=c-2;f>=0;--f){for(h=e=0,i=p[f+1],g=0;ga[e]?(m[f][g]=h,n[f][g]=b,i+=2):(m[f][g]=a[e],n[f][g]=e,++e);p[f]=0,1===k[f]&&d(f)}return l}function k(a){var b,c,d,e,f=new(o?Uint16Array:Array)(a.length),g=[],h=[],i=0;for(b=0,c=a.length;c>b;b++)g[a[b]]=(0|g[a[b]])+1;for(b=1,c=16;c>=b;b++)h[b]=i,i+=0|g[b],i<<=1;for(b=0,c=a.length;c>b;b++)for(i=h[a[b]],h[a[b]]+=1,d=f[b]=0,e=a[b];e>d;d++)f[b]=f[b]<<1|1&i,i>>>=1;return f}var l=void 0,m=!0,n=this,o="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;b.prototype.a=function(a,b,d){var e,f=this.buffer,g=this.index,h=this.d,i=f[g];if(d&&b>1&&(a=b>8?(u[255&a]<<24|u[a>>>8&255]<<16|u[a>>>16&255]<<8|u[a>>>24&255])>>32-b:u[a]>>8-b),8>b+h)i=i<e;++e)i=i<<1|a>>b-e-1&1,8===++h&&(h=0,f[g++]=u[i],i=0,g===f.length&&(f=c(this)));f[g]=i,this.buffer=f,this.d=h,this.index=g},b.prototype.finish=function(){var a,b=this.buffer,c=this.index;return 0p;++p){for(var r=p,s=r,t=7,r=r>>>1;r;r>>>=1)s<<=1,s|=1&r,--t;q[p]=(s<>>0}var u=q;d.prototype.getParent=function(a){return 2*((a-2)/4|0)},d.prototype.push=function(a,b){var c,d,e,f=this.buffer;for(c=this.length,f[this.length++]=b,f[this.length++]=a;c>0&&(d=this.getParent(c),f[c]>f[d]);)e=f[c],f[c]=f[d],f[d]=e,e=f[c+1],f[c+1]=f[d+1],f[d+1]=e,c=d;return this.length},d.prototype.pop=function(){var a,b,c,d,e,f=this.buffer;for(b=f[0],a=f[1],this.length-=2,f[0]=f[this.length],f[1]=f[this.length+1],e=0;(d=2*e+2,!(d>=this.length))&&(d+2f[d]&&(d+=2),f[d]>f[e]);)c=f[e],f[e]=f[d],f[d]=c,c=f[e+1],f[e+1]=f[d+1],f[d+1]=c,e=d;return{index:a,value:b,length:this.length}};var v,w=2,x=[];for(v=0;288>v;v++)switch(m){case 143>=v:x.push([v+48,8]);break;case 255>=v:x.push([v-144+400,9]);break;case 279>=v:x.push([v-256+0,7]);break;case 287>=v:x.push([v-280+192,8]);break;default:throw"invalid literal: "+v}e.prototype.h=function(){var a,c,d,e,f=this.input;switch(this.e){case 0:for(d=0,e=f.length;e>d;){c=o?f.subarray(d,d+65535):f.slice(d,d+65535),d+=c.length;var h=c,j=d===e,n=l,p=l,q=l,r=l,s=l,t=this.b,u=this.c;if(o){for(t=new Uint8Array(this.b.buffer);t.length<=u+h.length+5;)t=new Uint8Array(t.length<<1);t.set(this.b)}if(n=j?1:0,t[u++]=0|n,p=h.length,q=~p+65536&65535,t[u++]=255&p,t[u++]=p>>>8&255,t[u++]=255&q,t[u++]=q>>>8&255,o)t.set(h,u),u+=h.length,t=t.subarray(0,u);else{for(r=0,s=h.length;s>r;++r)t[u++]=h[r];t.length=u}this.c=u,this.b=t}break;case 1:var v=new b(o?new Uint8Array(this.b.buffer):this.b,this.c);v.a(1,1,m),v.a(1,2,m);var y,z,A,B=g(this,f);for(y=0,z=B.length;z>y;y++)if(A=B[y],b.prototype.a.apply(v,x[A]),A>256)v.a(B[++y],B[++y],m),v.a(B[++y],5),v.a(B[++y],B[++y],m);else if(256===A)break;this.b=v.finish(),this.c=this.b.length;break;case w:var C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R=new b(o?new Uint8Array(this.b.buffer):this.b,this.c),S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T=Array(19);for(C=w,R.a(1,1,m),R.a(C,2,m),D=g(this,f),H=i(this.j,15),I=k(H),J=i(this.i,7),K=k(J),E=286;E>257&&0===H[E-1];E--);for(F=30;F>1&&0===J[F-1];F--);var U,V,W,X,Y,Z,$=E,_=F,ab=new(o?Uint32Array:Array)($+_),bb=new(o?Uint32Array:Array)(316),cb=new(o?Uint8Array:Array)(19);for(U=V=0;$>U;U++)ab[V++]=H[U];for(U=0;_>U;U++)ab[V++]=J[U];if(!o)for(U=0,X=cb.length;X>U;++U)cb[U]=0;for(U=Y=0,X=ab.length;X>U;U+=V){for(V=1;X>U+V&&ab[U+V]===ab[U];++V);if(W=V,0===ab[U])if(3>W)for(;00;)Z=138>W?W:138,Z>W-3&&W>Z&&(Z=W-3),10>=Z?(bb[Y++]=17,bb[Y++]=Z-3,cb[17]++):(bb[Y++]=18,bb[Y++]=Z-11,cb[18]++),W-=Z;else if(bb[Y++]=ab[U],cb[ab[U]]++,W--,3>W)for(;00;)Z=6>W?W:6,Z>W-3&&W>Z&&(Z=W-3),bb[Y++]=16,bb[Y++]=Z-3,cb[16]++,W-=Z}for(a=o?bb.subarray(0,Y):bb.slice(0,Y),L=i(cb,7),P=0;19>P;P++)T[P]=L[S[P]];for(G=19;G>4&&0===T[G-1];G--);for(M=k(L),R.a(E-257,5,m),R.a(F-1,5,m),R.a(G-4,4,m),P=0;G>P;P++)R.a(T[P],3,m);for(P=0,Q=a.length;Q>P;P++)if(N=a[P],R.a(M[N],L[N],m),N>=16){switch(P++,N){case 16:O=2;break;case 17:O=3;break;case 18:O=7;break;default:throw"invalid code: "+N}R.a(a[P],O,m)}var db,eb,fb,gb,hb,ib,jb,kb,lb=[I,H],mb=[K,J];for(hb=lb[0],ib=lb[1],jb=mb[0],kb=mb[1],db=0,eb=D.length;eb>db;++db)if(fb=D[db],R.a(hb[fb],ib[fb],m),fb>256)R.a(D[++db],D[++db],m),gb=D[++db],R.a(jb[gb],kb[gb],m),R.a(D[++db],D[++db],m);else if(256===fb)break;this.b=R.finish(),this.c=this.b.length;break;default:throw"invalid compression type"}return this.b};var y=function(){function a(a){switch(m){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:throw"invalid length: "+a}}var b,c,d=[];for(b=3;258>=b;b++)c=a(b),d[b]=c[2]<<24|c[1]<<16|c[0];return d}(),z=o?new Uint32Array(y):y;a("Zlib.RawDeflate",e),a("Zlib.RawDeflate.prototype.compress",e.prototype.h);var A,B,C,D,E={NONE:0,FIXED:1,DYNAMIC:w};if(Object.keys)A=Object.keys(E);else for(B in A=[],C=0,E)A[C++]=B;for(C=0,D=A.length;D>C;++C)B=A[C],a("Zlib.RawDeflate.CompressionType."+B,E[B])}).call(this)},{}],20:[function(){/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */ +(function(){"use strict";function a(a,b){var c=a.split("."),d=g;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function b(a){var b,c,d,e,f,g,i,j,k,l,m=a.length,n=0,o=Number.POSITIVE_INFINITY;for(j=0;m>j;++j)a[j]>n&&(n=a[j]),a[j]=d;){for(j=0;m>j;++j)if(a[j]===d){for(g=0,i=e,k=0;d>k;++k)g=g<<1|1&i,i>>=1;for(l=d<<16|j,k=g;b>k;k+=f)c[k]=l;++e}++d,e<<=1,f<<=1}return[c,n,o]}function c(a,b){switch(this.g=[],this.h=32768,this.c=this.f=this.d=this.k=0,this.input=h?new Uint8Array(a):a,this.l=!1,this.i=j,this.q=!1,(b||!(b={}))&&(b.index&&(this.d=b.index),b.bufferSize&&(this.h=b.bufferSize),b.bufferType&&(this.i=b.bufferType),b.resize&&(this.q=b.resize)),this.i){case i:this.a=32768,this.b=new(h?Uint8Array:Array)(32768+this.h+258);break;case j:this.a=0,this.b=new(h?Uint8Array:Array)(this.h),this.e=this.v,this.m=this.s,this.j=this.t;break;default:throw Error("invalid inflate mode")}}function d(a,b){for(var c,d=a.f,e=a.c,f=a.input,g=a.d,h=f.length;b>e;){if(g>=h)throw Error("input buffer is broken");d|=f[g++]<>>b,a.c=e-b,a.d=g,c}function e(a,b){for(var c,d,e=a.f,f=a.c,g=a.input,h=a.d,i=g.length,j=b[0],k=b[1];k>f&&!(h>=i);)e|=g[h++]<>>16,a.f=e>>d,a.c=f-d,a.d=h,65535&c}function f(a){function c(a,b,c){var f,g,h,i=this.p;for(h=0;a>h;)switch(f=e(this,b)){case 16:for(g=3+d(this,2);g--;)c[h++]=i;break;case 17:for(g=3+d(this,3);g--;)c[h++]=0;i=0;break;case 18:for(g=11+d(this,7);g--;)c[h++]=0;i=0;break;default:i=c[h++]=f}return this.p=i,c}var f,g,i,j,k=d(a,5)+257,l=d(a,5)+1,m=d(a,4)+4,o=new(h?Uint8Array:Array)(n.length);for(j=0;m>j;++j)o[n[j]]=d(a,3);if(!h)for(j=m,m=o.length;m>j;++j)o[n[j]]=0;f=b(o),g=new(h?Uint8Array:Array)(k),i=new(h?Uint8Array:Array)(l),a.p=0,a.j(b(c.call(a,k,f,g)),b(c.call(a,l,f,i)))}var g=this,h="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView,i=0,j=1;c.prototype.u=function(){for(;!this.l;){var a=d(this,3);switch(1&a&&(this.l=!0),a>>>=1){case 0:var b=this.input,c=this.d,e=this.b,g=this.a,k=b.length,l=void 0,m=void 0,n=e.length,o=void 0;if(this.c=this.f=0,c+1>=k)throw Error("invalid uncompressed block header: LEN");if(l=b[c++]|b[c++]<<8,c+1>=k)throw Error("invalid uncompressed block header: NLEN");if(m=b[c++]|b[c++]<<8,l===~m)throw Error("invalid uncompressed block header: length verify");if(c+l>b.length)throw Error("input buffer is broken");switch(this.i){case i:for(;g+l>e.length;){if(o=n-g,l-=o,h)e.set(b.subarray(c,c+o),g),g+=o,c+=o;else for(;o--;)e[g++]=b[c++];this.a=g,e=this.e(),g=this.a}break;case j:for(;g+l>e.length;)e=this.e({o:2});break;default:throw Error("invalid inflate mode")}if(h)e.set(b.subarray(c,c+l),g),g+=l,c+=l;else for(;l--;)e[g++]=b[c++];this.d=c,this.a=g,this.b=e;break;case 1:this.j(z,B);break;case 2:f(this);break;default:throw Error("unknown BTYPE: "+a)}}return this.m()};var k,l,m=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],n=h?new Uint16Array(m):m,o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],p=h?new Uint16Array(o):o,q=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],r=h?new Uint8Array(q):q,s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],t=h?new Uint16Array(s):s,u=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],v=h?new Uint8Array(u):u,w=new(h?Uint8Array:Array)(288);for(k=0,l=w.length;l>k;++k)w[k]=143>=k?8:255>=k?9:279>=k?7:8;var x,y,z=b(w),A=new(h?Uint8Array:Array)(30);for(x=0,y=A.length;y>x;++x)A[x]=5;var B=b(A);c.prototype.j=function(a,b){var c=this.b,f=this.a;this.n=a;for(var g,h,i,j,k=c.length-258;256!==(g=e(this,a));)if(256>g)f>=k&&(this.a=f,c=this.e(),f=this.a),c[f++]=g;else for(h=g-257,j=p[h],0=k&&(this.a=f,c=this.e(),f=this.a);j--;)c[f]=c[f++-i];for(;8<=this.c;)this.c-=8,this.d--;this.a=f},c.prototype.t=function(a,b){var c=this.b,f=this.a;this.n=a;for(var g,h,i,j,k=c.length;256!==(g=e(this,a));)if(256>g)f>=k&&(c=this.e(),k=c.length),c[f++]=g;else for(h=g-257,j=p[h],0k&&(c=this.e(),k=c.length);j--;)c[f]=c[f++-i];for(;8<=this.c;)this.c-=8,this.d--;this.a=f},c.prototype.e=function(){var a,b,c=new(h?Uint8Array:Array)(this.a-32768),d=this.a-32768,e=this.b;if(h)c.set(e.subarray(32768,c.length));else for(a=0,b=c.length;b>a;++a)c[a]=e[a+32768];if(this.g.push(c),this.k+=c.length,h)e.set(e.subarray(d,d+32768));else for(a=0;32768>a;++a)e[a]=e[d+a];return this.a=32768,e},c.prototype.v=function(a){var b,c,d,e,f=this.input.length/this.d+1|0,g=this.input,i=this.b;return a&&("number"==typeof a.o&&(f=a.o),"number"==typeof a.r&&(f+=a.r)),2>f?(c=(g.length-this.d)/this.n[2],e=258*(c/2)|0,d=eb;++b)for(a=i[b],d=0,e=a.length;e>d;++d)j[f++]=a[d];for(b=32768,c=this.a;c>b;++b)j[f++]=g[b];return this.g=[],this.buffer=j},c.prototype.s=function(){var a,b=this.a;return h?this.q?(a=new Uint8Array(b),a.set(this.b.subarray(0,b))):a=this.b.subarray(0,b):(this.b.length>b&&(this.b.length=b),a=this.b),this.buffer=a},a("Zlib.RawInflate",c),a("Zlib.RawInflate.prototype.decompress",c.prototype.u);var C,D,E,F,G={ADAPTIVE:j,BLOCK:i};if(Object.keys)C=Object.keys(G);else for(D in C=[],E=0,G)C[E++]=D;for(E=0,F=C.length;F>E;++E)D=C[E],a("Zlib.RawInflate.BufferType."+D,G[D])}).call(this)},{}]},{},[7])(7)});;if (!Element.prototype.scrollIntoViewIfNeeded) { + Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) { + centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded; + + var parent = this.parentNode, + parentComputedStyle = window.getComputedStyle(parent, null), + parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width')), + parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width')), + overTop = this.offsetTop - parent.offsetTop < parent.scrollTop, + overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight), + overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft, + overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth), + alignWithTop = overTop && !overBottom; + + if ((overTop || overBottom) && centerIfNeeded) { + parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2; + } + + if ((overLeft || overRight) && centerIfNeeded) { + parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2; + } + + if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) { + this.scrollIntoView(alignWithTop); + } + }; +};/* + * smoothscroll polyfill - v0.3.3 + * https://iamdustan.github.io/smoothscroll + * 2016 (c) Dustan Kasten, Jeremias Menichelli - MIT License + */ + +(function(w, d, undefined) { + 'use strict'; + + /* + * aliases + * w: window global object + * d: document + * undefined: undefined + */ + + // polyfill + function polyfill() { + // return when scrollBehavior interface is supported + if ('scrollBehavior' in d.documentElement.style) { + return; + } + + /* + * globals + */ + var Element = w.HTMLElement || w.Element; + var SCROLL_TIME = 468; + + /* + * object gathering original scroll methods + */ + var original = { + scroll: w.scroll || w.scrollTo, + scrollBy: w.scrollBy, + scrollIntoView: Element.prototype.scrollIntoView + }; + + /* + * define timing method + */ + var now = w.performance && w.performance.now + ? w.performance.now.bind(w.performance) : Date.now; + + /** + * changes scroll position inside an element + * @method scrollElement + * @param {Number} x + * @param {Number} y + */ + function scrollElement(x, y) { + this.scrollLeft = x; + this.scrollTop = y; + } + + /** + * returns result of applying ease math function to a number + * @method ease + * @param {Number} k + * @returns {Number} + */ + function ease(k) { + return 0.5 * (1 - Math.cos(Math.PI * k)); + } + + /** + * indicates if a smooth behavior should be applied + * @method shouldBailOut + * @param {Number|Object} x + * @returns {Boolean} + */ + function shouldBailOut(x) { + if (typeof x !== 'object' + || x.behavior === undefined + || x.behavior === 'auto' + || x.behavior === 'instant') { + // first arg not an object, or behavior is auto, instant or undefined + return true; + } + + if (typeof x === 'object' + && x.behavior === 'smooth') { + // first argument is an object and behavior is smooth + return false; + } + + // throw error when behavior is not supported + throw new TypeError('behavior not valid'); + } + + /** + * finds scrollable parent of an element + * @method findScrollableParent + * @param {Node} el + * @returns {Node} el + */ + function findScrollableParent(el) { + do { + el = el.parentNode; + } while (el !== d.body + && !(el.clientHeight < el.scrollHeight + || el.clientWidth < el.scrollWidth)); + + return el; + } + + /** + * self invoked function that, given a context, steps through scrolling + * @method step + * @param {Object} context + */ + function step(context) { + // call method again on next available frame + context.frame = w.requestAnimationFrame(step.bind(w, context)); + + var time = now(); + var value; + var currentX; + var currentY; + var elapsed = (time - context.startTime) / SCROLL_TIME; + + // avoid elapsed times higher than one + elapsed = elapsed > 1 ? 1 : elapsed; + + // apply easing to elapsed time + value = ease(elapsed); + + currentX = context.startX + (context.x - context.startX) * value; + currentY = context.startY + (context.y - context.startY) * value; + + context.method.call(context.scrollable, currentX, currentY); + + // return when end points have been reached + if (currentX === context.x && currentY === context.y) { + w.cancelAnimationFrame(context.frame); + return; + } + } + + /** + * scrolls window with a smooth behavior + * @method smoothScroll + * @param {Object|Node} el + * @param {Number} x + * @param {Number} y + */ + function smoothScroll(el, x, y) { + var scrollable; + var startX; + var startY; + var method; + var startTime = now(); + var frame; + + // define scroll context + if (el === d.body) { + scrollable = w; + startX = w.scrollX || w.pageXOffset; + startY = w.scrollY || w.pageYOffset; + method = original.scroll; + } else { + scrollable = el; + startX = el.scrollLeft; + startY = el.scrollTop; + method = scrollElement; + } + + // cancel frame when a scroll event's happening + if (frame) { + w.cancelAnimationFrame(frame); + } + + // scroll looping over a frame + step({ + scrollable: scrollable, + method: method, + startTime: startTime, + startX: startX, + startY: startY, + x: x, + y: y, + frame: frame + }); + } + + /* + * ORIGINAL METHODS OVERRIDES + */ + + // w.scroll and w.scrollTo + w.scroll = w.scrollTo = function() { + // avoid smooth behavior if not required + if (shouldBailOut(arguments[0])) { + original.scroll.call( + w, + arguments[0].left || arguments[0], + arguments[0].top || arguments[1] + ); + return; + } + + // LET THE SMOOTHNESS BEGIN! + smoothScroll.call( + w, + d.body, + ~~arguments[0].left, + ~~arguments[0].top + ); + }; + + // w.scrollBy + w.scrollBy = function() { + // avoid smooth behavior if not required + if (shouldBailOut(arguments[0])) { + original.scrollBy.call( + w, + arguments[0].left || arguments[0], + arguments[0].top || arguments[1] + ); + return; + } + + // LET THE SMOOTHNESS BEGIN! + smoothScroll.call( + w, + d.body, + ~~arguments[0].left + (w.scrollX || w.pageXOffset), + ~~arguments[0].top + (w.scrollY || w.pageYOffset) + ); + }; + + // Element.prototype.scrollIntoView + Element.prototype.scrollIntoView = function() { + // avoid smooth behavior if not required + if (shouldBailOut(arguments[0])) { + original.scrollIntoView.call(this, arguments[0] || true); + return; + } + + // LET THE SMOOTHNESS BEGIN! + var scrollableParent = findScrollableParent(this); + var parentRects = scrollableParent.getBoundingClientRect(); + var clientRects = this.getBoundingClientRect(); + + if (scrollableParent !== d.body) { + // reveal element inside parent + smoothScroll.call( + this, + scrollableParent, + scrollableParent.scrollLeft + clientRects.left - parentRects.left, + scrollableParent.scrollTop + clientRects.top - parentRects.top + ); + // reveal parent in viewport + w.scrollBy({ + left: parentRects.left, + top: parentRects.top, + behavior: 'smooth' + }); + } else { + // reveal element in viewport + w.scrollBy({ + left: clientRects.left, + top: clientRects.top, + behavior: 'smooth' + }); + } + }; + } + + if (typeof exports === 'object') { + // commonjs + module.exports = { polyfill: polyfill }; + } else { + // global + polyfill(); + } +})(window, document); +;// Spectrum Colorpicker v1.1.2 +// https://github.com/bgrins/spectrum +// Author: Brian Grinstead +// License: MIT + +(function (window, $, undefined) { + var defaultOpts = { + + // Callbacks + beforeShow: noop, + move: noop, + change: noop, + show: noop, + hide: noop, + + // Options + color: false, + flat: false, + showInput: false, + showButtons: true, + clickoutFiresChange: false, + showInitial: false, + showPalette: false, + showPaletteOnly: false, + showSelectionPalette: true, + localStorageKey: false, + appendTo: "body", + maxSelectionSize: 7, + cancelText: "cancel", + chooseText: "choose", + preferredFormat: false, + className: "", + showAlpha: false, + theme: "sp-light", + palette: ['fff', '000'], + selectionPalette: [], + disabled: false + }, + spectrums = [], + IE = !!/msie/i.exec( window.navigator.userAgent ), + rgbaSupport = (function() { + function contains( str, substr ) { + return !!~('' + str).indexOf(substr); + } + + var elem = document.createElement('div'); + var style = elem.style; + style.cssText = 'background-color:rgba(0,0,0,.5)'; + return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla'); + })(), + replaceInput = [ + "
", + "
", + "
", + "
" + ].join(''), + markup = (function () { + + // IE does not support gradients with multiple stops, so we need to simulate + // that for the rainbow slider with 8 divs that each have a single gradient + var gradientFix = ""; + if (IE) { + for (var i = 1; i <= 6; i++) { + gradientFix += "
"; + } + } + + return [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + gradientFix, + "
", + "
", + "
", + "
", + "
", + "", + "
", + "
", + "
", + "", + "", + "
", + "
", + "
" + ].join(""); + })(); + + function paletteTemplate (p, color, className) { + var html = []; + for (var i = 0; i < p.length; i++) { + var tiny = tinycolor(p[i]); + var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light"; + c += (tinycolor.equals(color, p[i])) ? " sp-thumb-active" : ""; + + var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter(); + html.push(''); + } + return "
" + html.join('') + "
"; + } + + function hideAll() { + for (var i = 0; i < spectrums.length; i++) { + if (spectrums[i]) { + spectrums[i].hide(); + } + } + } + + function instanceOptions(o, callbackContext) { + var opts = $.extend({}, defaultOpts, o); + opts.callbacks = { + 'move': bind(opts.move, callbackContext), + 'change': bind(opts.change, callbackContext), + 'show': bind(opts.show, callbackContext), + 'hide': bind(opts.hide, callbackContext), + 'beforeShow': bind(opts.beforeShow, callbackContext) + }; + + return opts; + } + + function spectrum(element, o) { + + var opts = instanceOptions(o, element), + flat = opts.flat, + showSelectionPalette = opts.showSelectionPalette, + localStorageKey = opts.localStorageKey, + theme = opts.theme, + callbacks = opts.callbacks, + resize = throttle(reflow, 10), + visible = false, + dragWidth = 0, + dragHeight = 0, + dragHelperHeight = 0, + slideHeight = 0, + slideWidth = 0, + alphaWidth = 0, + alphaSlideHelperWidth = 0, + slideHelperHeight = 0, + currentHue = 0, + currentSaturation = 0, + currentValue = 0, + currentAlpha = 1, + palette = opts.palette.slice(0), + paletteArray = $.isArray(palette[0]) ? palette : [palette], + selectionPalette = opts.selectionPalette.slice(0), + maxSelectionSize = opts.maxSelectionSize, + draggingClass = "sp-dragging", + shiftMovementDirection = null; + + var doc = element.ownerDocument, + body = doc.body, + boundElement = $(element), + disabled = false, + container = $(markup, doc).addClass(theme), + dragger = container.find(".sp-color"), + dragHelper = container.find(".sp-dragger"), + slider = container.find(".sp-hue"), + slideHelper = container.find(".sp-slider"), + alphaSliderInner = container.find(".sp-alpha-inner"), + alphaSlider = container.find(".sp-alpha"), + alphaSlideHelper = container.find(".sp-alpha-handle"), + textInput = container.find(".sp-input"), + paletteContainer = container.find(".sp-palette"), + initialColorContainer = container.find(".sp-initial"), + cancelButton = container.find(".sp-cancel"), + chooseButton = container.find(".sp-choose"), + isInput = boundElement.is("input"), + shouldReplace = isInput && !flat, + replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className) : $([]), + offsetElement = (shouldReplace) ? replacer : boundElement, + previewElement = replacer.find(".sp-preview-inner"), + initialColor = opts.color || (isInput && boundElement.val()), + colorOnShow = false, + preferredFormat = opts.preferredFormat, + currentPreferredFormat = preferredFormat, + clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange; + + + function applyOptions() { + + if (opts.showPaletteOnly) { + opts.showPalette = true; + } + + container.toggleClass("sp-flat", flat); + container.toggleClass("sp-input-disabled", !opts.showInput); + container.toggleClass("sp-alpha-enabled", opts.showAlpha); + container.toggleClass("sp-buttons-disabled", !opts.showButtons); + container.toggleClass("sp-palette-disabled", !opts.showPalette); + container.toggleClass("sp-palette-only", opts.showPaletteOnly); + container.toggleClass("sp-initial-disabled", !opts.showInitial); + container.addClass(opts.className); + + reflow(); + } + + function initialize() { + + if (IE) { + container.find("*:not(input)").attr("unselectable", "on"); + } + + applyOptions(); + + if (shouldReplace) { + boundElement.after(replacer).hide(); + } + + if (flat) { + boundElement.after(container).hide(); + } + else { + + var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo); + if (appendTo.length !== 1) { + appendTo = $("body"); + } + + appendTo.append(container); + } + + if (localStorageKey && window.localStorage) { + + // Migrate old palettes over to new format. May want to remove this eventually. + try { + var oldPalette = window.localStorage[localStorageKey].split(",#"); + if (oldPalette.length > 1) { + delete window.localStorage[localStorageKey]; + $.each(oldPalette, function(i, c) { + addColorToSelectionPalette(c); + }); + } + } + catch(e) { } + + try { + selectionPalette = window.localStorage[localStorageKey].split(";"); + } + catch (e) { } + } + + offsetElement.bind("click.spectrum touchstart.spectrum", function (e) { + if (!disabled) { + toggle(); + } + + e.stopPropagation(); + + if (!$(e.target).is("input")) { + e.preventDefault(); + } + }); + + if(boundElement.is(":disabled") || (opts.disabled === true)) { + disable(); + } + + // Prevent clicks from bubbling up to document. This would cause it to be hidden. + container.click(stopPropagation); + + // Handle user typed input + textInput.change(setFromTextInput); + textInput.bind("paste", function () { + setTimeout(setFromTextInput, 1); + }); + textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } }); + + cancelButton.text(opts.cancelText); + cancelButton.bind("click.spectrum", function (e) { + e.stopPropagation(); + e.preventDefault(); + hide("cancel"); + }); + + chooseButton.text(opts.chooseText); + chooseButton.bind("click.spectrum", function (e) { + e.stopPropagation(); + e.preventDefault(); + + if (isValid()) { + updateOriginalInput(true); + hide(); + } + }); + + draggable(alphaSlider, function (dragX, dragY, e) { + currentAlpha = (dragX / alphaWidth); + if (e.shiftKey) { + currentAlpha = Math.round(currentAlpha * 10) / 10; + } + + move(); + }); + + draggable(slider, function (dragX, dragY) { + currentHue = parseFloat(dragY / slideHeight); + move(); + }, dragStart, dragStop); + + draggable(dragger, function (dragX, dragY, e) { + + // shift+drag should snap the movement to either the x or y axis. + if (!e.shiftKey) { + shiftMovementDirection = null; + } + else if (!shiftMovementDirection) { + var oldDragX = currentSaturation * dragWidth; + var oldDragY = dragHeight - (currentValue * dragHeight); + var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY); + + shiftMovementDirection = furtherFromX ? "x" : "y"; + } + + var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x"; + var setValue = !shiftMovementDirection || shiftMovementDirection === "y"; + + if (setSaturation) { + currentSaturation = parseFloat(dragX / dragWidth); + } + if (setValue) { + currentValue = parseFloat((dragHeight - dragY) / dragHeight); + } + + move(); + + }, dragStart, dragStop); + + if (!!initialColor) { + set(initialColor); + + // In case color was black - update the preview UI and set the format + // since the set function will not run (default color is black). + updateUI(); + currentPreferredFormat = preferredFormat || tinycolor(initialColor).format; + + addColorToSelectionPalette(initialColor); + } + else { + updateUI(); + } + + if (flat) { + show(); + } + + function palletElementClick(e) { + if (e.data && e.data.ignore) { + set($(this).data("color")); + move(); + } + else { + set($(this).data("color")); + updateOriginalInput(true); + move(); + hide(); + } + + return false; + } + + var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum"; + paletteContainer.delegate(".sp-thumb-el", paletteEvent, palletElementClick); + initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, palletElementClick); + } + + function addColorToSelectionPalette(color) { + if (showSelectionPalette) { + var colorRgb = tinycolor(color).toRgbString(); + if ($.inArray(colorRgb, selectionPalette) === -1) { + selectionPalette.push(colorRgb); + while(selectionPalette.length > maxSelectionSize) { + selectionPalette.shift(); + } + } + + if (localStorageKey && window.localStorage) { + try { + window.localStorage[localStorageKey] = selectionPalette.join(";"); + } + catch(e) { } + } + } + } + + function getUniqueSelectionPalette() { + var unique = []; + var p = selectionPalette; + var paletteLookup = {}; + var rgb; + + if (opts.showPalette) { + + for (var i = 0; i < paletteArray.length; i++) { + for (var j = 0; j < paletteArray[i].length; j++) { + rgb = tinycolor(paletteArray[i][j]).toRgbString(); + paletteLookup[rgb] = true; + } + } + + for (i = 0; i < p.length; i++) { + rgb = tinycolor(p[i]).toRgbString(); + + if (!paletteLookup.hasOwnProperty(rgb)) { + unique.push(p[i]); + paletteLookup[rgb] = true; + } + } + } + + return unique.reverse().slice(0, opts.maxSelectionSize); + } + + function drawPalette() { + + var currentColor = get(); + + var html = $.map(paletteArray, function (palette, i) { + return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i); + }); + + if (selectionPalette) { + html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection")); + } + + paletteContainer.html(html.join("")); + } + + function drawInitial() { + if (opts.showInitial) { + var initial = colorOnShow; + var current = get(); + initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial")); + } + } + + function dragStart() { + if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) { + reflow(); + } + container.addClass(draggingClass); + shiftMovementDirection = null; + } + + function dragStop() { + container.removeClass(draggingClass); + } + + function setFromTextInput() { + var tiny = tinycolor(textInput.val()); + if (tiny.ok) { + set(tiny); + } + else { + textInput.addClass("sp-validation-error"); + } + } + + function toggle() { + if (visible) { + hide(); + } + else { + show(); + } + } + + function show() { + var event = $.Event('beforeShow.spectrum'); + + if (visible) { + reflow(); + return; + } + + colorOnShow = get(); + boundElement.trigger(event, [ colorOnShow ]); + + if (callbacks.beforeShow(colorOnShow) === false || event.isDefaultPrevented()) { + return; + } + + // if color has changed + set(colorOnShow); + + hideAll(); + visible = true; + + $(doc).bind("mousedown.spectrum", onMousedown); + + if (!flat) { + // Piskel-specific : change the color as soon as the user does a mouseup + $(doc).bind("mouseup.spectrum", updateColor); + } + + $(window).bind("resize.spectrum", resize); + replacer.addClass("sp-active"); + container.removeClass("sp-hidden"); + + if (opts.showPalette) { + drawPalette(); + } + reflow(); + updateUI(); + + drawInitial(); + callbacks.show(colorOnShow); + boundElement.trigger('show.spectrum', [ colorOnShow ]); + } + + function onMousedown (e) { + var target = $(e.target); + var parents = target.parents(); + var isClickOutsideWidget = !parents.is(container) && !target.is(container); + + if (isClickOutsideWidget) { + hide(e); + } + } + + // Piskel-specific (code extracted to method) + function updateColor(e) { + var colorHasChanged = !tinycolor.equals(get(), colorOnShow); + + if (colorHasChanged) { + if (clickoutFiresChange && e !== "cancel") { + updateOriginalInput(true); + } + else { + revert(); + } + } + } + + function hide(e) { + + // Return on right click + if (e && e.type == "click" && e.button == 2) { return; } + + // Return if hiding is unnecessary + if (!visible || flat) { return; } + visible = false; + + $(doc).unbind("mousedown.spectrum", onMousedown); + + // Piskel-specific + $(doc).unbind("mouseup.spectrum", updateColor); + + $(window).unbind("resize.spectrum", resize); + + replacer.removeClass("sp-active"); + container.addClass("sp-hidden"); + + updateColor(e); + + // Piskel-specific + addColorToSelectionPalette(get()); + + callbacks.hide(get()); + boundElement.trigger('hide.spectrum', [ get() ]); + } + + function revert() { + set(colorOnShow, true); + } + + function set(color, ignoreFormatChange) { + if (tinycolor.equals(color, get())) { + return; + } + + var newColor = tinycolor(color); + var newHsv = newColor.toHsv(); + + currentHue = (newHsv.h % 360) / 360; + currentSaturation = newHsv.s; + currentValue = newHsv.v; + currentAlpha = newHsv.a; + + updateUI(); + + if (newColor.ok && !ignoreFormatChange) { + currentPreferredFormat = preferredFormat || newColor.format; + } + } + + function get(opts) { + opts = opts || { }; + return tinycolor.fromRatio({ + h: currentHue, + s: currentSaturation, + v: currentValue, + a: Math.round(currentAlpha * 100) / 100 + }, { format: opts.format || currentPreferredFormat }); + } + + function isValid() { + return !textInput.hasClass("sp-validation-error"); + } + + function move() { + updateUI(); + + callbacks.move(get()); + boundElement.trigger('move.spectrum', [ get() ]); + } + + function updateUI() { + + textInput.removeClass("sp-validation-error"); + + updateHelperLocations(); + + // Update dragger background color (gradients take care of saturation and value). + var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 }); + dragger.css("background-color", flatColor.toHexString()); + + // Get a format that alpha will be included in (hex and names ignore alpha) + var format = currentPreferredFormat; + if (currentAlpha < 1) { + if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") { + format = "rgb"; + } + } + + var realColor = get({ format: format }), + realHex = realColor.toHexString(), + realRgb = realColor.toRgbString(); + + // Update the replaced elements background color (with actual selected color) + if (rgbaSupport || realColor.alpha === 1) { + previewElement.css("background-color", realRgb); + } + else { + previewElement.css("background-color", "transparent"); + previewElement.css("filter", realColor.toFilter()); + } + + if (opts.showAlpha) { + var rgb = realColor.toRgb(); + rgb.a = 0; + var realAlpha = tinycolor(rgb).toRgbString(); + var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")"; + + if (IE) { + alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex)); + } + else { + alphaSliderInner.css("background", "-webkit-" + gradient); + alphaSliderInner.css("background", "-moz-" + gradient); + alphaSliderInner.css("background", "-ms-" + gradient); + alphaSliderInner.css("background", gradient); + } + } + + // Update the text entry input as it changes happen + if (opts.showInput) { + var displayFormat = pskl.UserSettings.get(pskl.UserSettings.COLOR_FORMAT); + textInput.val(realColor.toString(displayFormat)); + } + + if (opts.showPalette) { + drawPalette(); + } + + drawInitial(); + } + + function updateHelperLocations() { + var s = currentSaturation; + var v = currentValue; + + // Where to show the little circle in that displays your current selected color + var dragX = s * dragWidth; + var dragY = (dragHeight) - (v * dragHeight); + dragX = Math.max( + -dragHelperHeight/2, + Math.min(dragWidth - dragHelperHeight/2, dragX - dragHelperHeight/2) + ); + dragY = Math.max( + -dragHelperHeight/2, + Math.min(dragHeight - dragHelperHeight/2, dragY - dragHelperHeight/2) + ); + dragHelper.css({ + "top": dragY, + "left": dragX + }); + + var alphaX = currentAlpha * alphaWidth; + alphaSlideHelper.css({ + "left": alphaX - (alphaSlideHelperWidth / 2) + }); + + // Where to show the bar that displays your current selected hue + var slideY = (currentHue) * slideHeight; + slideHelper.css({ + "top": slideY - (slideHelperHeight/2) + }); + } + + function updateOriginalInput(fireCallback) { + var color = get(); + + if (isInput) { + boundElement.val(color.toString(currentPreferredFormat)); + } + + var hasChanged = !tinycolor.equals(color, colorOnShow); + colorOnShow = color; + + // Update the selection palette with the current color + + // Piskel-specific : commented-out, palette update is done on hide + // addColorToSelectionPalette(color); + + if (fireCallback && hasChanged) { + callbacks.change(color); + boundElement.trigger('change', [ color ]); + } + } + + function reflow() { + dragWidth = dragger.width(); + dragHeight = dragger.height(); + dragHelperHeight = dragHelper.height() + 4; + slideWidth = slider.width(); + slideHeight = slider.height(); + slideHelperHeight = slideHelper.height() + 4; + alphaWidth = alphaSlider.width(); + alphaSlideHelperWidth = alphaSlideHelper.width(); + + if (!flat) { + container.css("position", "absolute"); + container.offset(getOffset(container, offsetElement)); + } + + updateHelperLocations(); + } + + function destroy() { + boundElement.show(); + offsetElement.unbind("click.spectrum touchstart.spectrum"); + container.remove(); + replacer.remove(); + spectrums[spect.id] = null; + } + + function option(optionName, optionValue) { + if (optionName === undefined) { + return $.extend({}, opts); + } + if (optionValue === undefined) { + return opts[optionName]; + } + + opts[optionName] = optionValue; + applyOptions(); + } + + function enable() { + disabled = false; + boundElement.attr("disabled", false); + offsetElement.removeClass("sp-disabled"); + } + + function disable() { + hide(); + disabled = true; + boundElement.attr("disabled", true); + offsetElement.addClass("sp-disabled"); + } + + initialize(); + + var spect = { + show: show, + hide: hide, + toggle: toggle, + reflow: reflow, + option: option, + enable: enable, + disable: disable, + set: function (c) { + set(c); + updateOriginalInput(); + }, + get: get, + destroy: destroy, + container: container + }; + + spect.id = spectrums.push(spect) - 1; + + return spect; + } + + /** + * checkOffset - get the offset below/above and left/right element depending on screen position + * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js + */ + function getOffset(picker, input) { + var extraY = 0; + var dpWidth = picker.outerWidth(); + var dpHeight = picker.outerHeight(); + var inputHeight = input.outerHeight(); + var doc = picker[0].ownerDocument; + var docElem = doc.documentElement; + var viewWidth = docElem.clientWidth + $(doc).scrollLeft(); + var viewHeight = docElem.clientHeight + $(doc).scrollTop(); + var offset = input.offset(); + offset.top += inputHeight; + + if (Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth))) { + offset.left -= Math.abs(offset.left + dpWidth - viewWidth); + picker.attr('data-x-position','right'); + } else { + offset.left -= 0; + picker.attr('data-x-position','left'); + } + + if (Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight))) { + offset.top -= Math.abs(dpHeight + inputHeight - extraY); + picker.attr('data-y-position','top'); + } else { + offset.top -= extraY; + picker.attr('data-y-position','bottom'); + } + + return offset; + } + + /** + * noop - do nothing + */ + function noop() { + + } + + /** + * stopPropagation - makes the code only doing this a little easier to read in line + */ + function stopPropagation(e) { + e.stopPropagation(); + } + + /** + * Create a function bound to a given object + * Thanks to underscore.js + */ + function bind(func, obj) { + var slice = Array.prototype.slice; + var args = slice.call(arguments, 2); + return function () { + return func.apply(obj, args.concat(slice.call(arguments))); + }; + } + + /** + * Lightweight drag helper. Handles containment within the element, so that + * when dragging, the x is within [0,element.width] and y is within [0,element.height] + */ + function draggable(element, onmove, onstart, onstop) { + onmove = onmove || function () { }; + onstart = onstart || function () { }; + onstop = onstop || function () { }; + var doc = element.ownerDocument || document; + var dragging = false; + var offset = {}; + var maxHeight = 0; + var maxWidth = 0; + var hasTouch = ('ontouchstart' in window); + + var duringDragEvents = {}; + duringDragEvents["selectstart"] = prevent; + duringDragEvents["dragstart"] = prevent; + duringDragEvents["touchmove mousemove"] = move; + duringDragEvents["touchend mouseup"] = stop; + + function prevent(e) { + if (e.stopPropagation) { + e.stopPropagation(); + } + if (e.preventDefault) { + e.preventDefault(); + } + e.returnValue = false; + } + + function move(e) { + if (dragging) { + // Mouseup happened outside of window + if (IE && document.documentMode < 9 && !e.button) { + return stop(); + } + + var touches = e.originalEvent.touches; + var pageX = touches ? touches[0].pageX : e.pageX; + var pageY = touches ? touches[0].pageY : e.pageY; + + var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth)); + var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight)); + + if (hasTouch) { + // Stop scrolling in iOS + prevent(e); + } + + onmove.apply(element, [dragX, dragY, e]); + } + } + function start(e) { + var rightclick = (e.which) ? (e.which == 3) : (e.button == 2); + var touches = e.originalEvent.touches; + + if (!rightclick && !dragging) { + if (onstart.apply(element, arguments) !== false) { + dragging = true; + maxHeight = $(element).height(); + maxWidth = $(element).width(); + offset = $(element).offset(); + + $(doc).bind(duringDragEvents); + $(doc.body).addClass("sp-dragging"); + + if (!hasTouch) { + move(e); + } + + prevent(e); + } + } + } + function stop() { + if (dragging) { + $(doc).unbind(duringDragEvents); + $(doc.body).removeClass("sp-dragging"); + onstop.apply(element, arguments); + } + dragging = false; + } + + $(element).bind("touchstart mousedown", start); + } + + function throttle(func, wait, debounce) { + var timeout; + return function () { + var context = this, args = arguments; + var throttler = function () { + timeout = null; + func.apply(context, args); + }; + if (debounce) clearTimeout(timeout); + if (debounce || !timeout) timeout = setTimeout(throttler, wait); + }; + } + + + function log(){/* jshint -W021 */if(window.console){if(Function.prototype.bind)log=Function.prototype.bind.call(console.log,console);else log=function(){Function.prototype.apply.call(console.log,console,arguments);};log.apply(this,arguments);}} + + /** + * Define a jQuery plugin + */ + var dataID = "spectrum.id"; + $.fn.spectrum = function (opts, extra) { + + if (typeof opts == "string") { + + var returnValue = this; + var args = Array.prototype.slice.call( arguments, 1 ); + + this.each(function () { + var spect = spectrums[$(this).data(dataID)]; + if (spect) { + + var method = spect[opts]; + if (!method) { + throw new Error( "Spectrum: no such method: '" + opts + "'" ); + } + + if (opts == "get") { + returnValue = spect.get(); + } + else if (opts == "container") { + returnValue = spect.container; + } + else if (opts == "option") { + returnValue = spect.option.apply(spect, args); + } + else if (opts == "destroy") { + spect.destroy(); + $(this).removeData(dataID); + } + else { + method.apply(spect, args); + } + } + }); + + return returnValue; + } + + // Initializing a new instance of spectrum + return this.spectrum("destroy").each(function () { + var spect = spectrum(this, opts); + $(this).data(dataID, spect.id); + }); + }; + + $.fn.spectrum.load = true; + $.fn.spectrum.loadOpts = {}; + $.fn.spectrum.draggable = draggable; + $.fn.spectrum.defaults = defaultOpts; + + $.spectrum = { }; + $.spectrum.localization = { }; + $.spectrum.palettes = { }; + + $.fn.spectrum.processNativeColorInputs = function () { + var colorInput = $("")[0]; + var supportsColor = colorInput.type === "color" && colorInput.value != "!"; + + if (!supportsColor) { + $("input[type=color]").spectrum({ + preferredFormat: "hex6" + }); + } + }; + + // TinyColor v0.9.16 + // https://github.com/bgrins/TinyColor + // 2013-08-10, Brian Grinstead, MIT License + + (function() { + + var trimLeft = /^[\s,#]+/, + trimRight = /\s+$/, + tinyCounter = 0, + math = Math, + mathRound = math.round, + mathMin = math.min, + mathMax = math.max, + mathRandom = math.random; + + function tinycolor (color, opts) { + + color = (color) ? color : ''; + opts = opts || { }; + + // If input is already a tinycolor, return itself + if (typeof color == "object" && color.hasOwnProperty("_tc_id")) { + return color; + } + + var rgb = inputToRGB(color); + var r = rgb.r, + g = rgb.g, + b = rgb.b, + a = rgb.a, + roundA = mathRound(100*a) / 100, + format = opts.format || rgb.format; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (r < 1) { r = mathRound(r); } + if (g < 1) { g = mathRound(g); } + if (b < 1) { b = mathRound(b); } + + return { + ok: rgb.ok, + format: format, + _tc_id: tinyCounter++, + alpha: a, + getAlpha: function() { + return a; + }, + setAlpha: function(value) { + a = boundAlpha(value); + roundA = mathRound(100*a) / 100; + }, + toHsv: function() { + var hsv = rgbToHsv(r, g, b); + return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: a }; + }, + toHsvString: function() { + var hsv = rgbToHsv(r, g, b); + var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); + return (a == 1) ? + "hsv(" + h + ", " + s + "%, " + v + "%)" : + "hsva(" + h + ", " + s + "%, " + v + "%, "+ roundA + ")"; + }, + toHsl: function() { + var hsl = rgbToHsl(r, g, b); + return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: a }; + }, + toHslString: function() { + var hsl = rgbToHsl(r, g, b); + var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); + return (a == 1) ? + "hsl(" + h + ", " + s + "%, " + l + "%)" : + "hsla(" + h + ", " + s + "%, " + l + "%, "+ roundA + ")"; + }, + toHex: function(allow3Char) { + return rgbToHex(r, g, b, allow3Char); + }, + toHexString: function(allow3Char) { + return '#' + rgbToHex(r, g, b, allow3Char); + }, + toRgb: function() { + return { r: mathRound(r), g: mathRound(g), b: mathRound(b), a: a }; + }, + toRgbString: function() { + return (a == 1) ? + "rgb(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ")" : + "rgba(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ", " + roundA + ")"; + }, + toPercentageRgb: function() { + return { r: mathRound(bound01(r, 255) * 100) + "%", g: mathRound(bound01(g, 255) * 100) + "%", b: mathRound(bound01(b, 255) * 100) + "%", a: a }; + }, + toPercentageRgbString: function() { + return (a == 1) ? + "rgb(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%)" : + "rgba(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%, " + roundA + ")"; + }, + toName: function() { + if (a === 0) { + return "transparent"; + } + + return hexNames[rgbToHex(r, g, b, true)] || false; + }, + toFilter: function(secondColor) { + var hex = rgbToHex(r, g, b); + var secondHex = hex; + var alphaHex = Math.round(parseFloat(a) * 255).toString(16); + var secondAlphaHex = alphaHex; + var gradientType = opts && opts.gradientType ? "GradientType = 1, " : ""; + + if (secondColor) { + var s = tinycolor(secondColor); + secondHex = s.toHex(); + secondAlphaHex = Math.round(parseFloat(s.alpha) * 255).toString(16); + } + + return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr=#" + pad2(alphaHex) + hex + ",endColorstr=#" + pad2(secondAlphaHex) + secondHex + ")"; + }, + toString: function(format) { + var formatSet = !!format; + format = format || this.format; + + var formattedString = false; + var hasAlphaAndFormatNotSet = !formatSet && a < 1 && a > 0; + var formatWithAlpha = hasAlphaAndFormatNotSet && (format === "hex" || format === "hex6" || format === "hex3" || format === "name"); + + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + + if (formatWithAlpha) { + return this.toRgbString(); + } + + return formattedString || this.toHexString(); + } + }; + } + + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function(color, opts) { + if (typeof color == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } + else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + + return tinycolor(color, opts); + }; + + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + + var rgb = { r: 0, g: 0, b: 0 }; + var a = 1; + var ok = false; + var format = false; + + if (typeof color == "string") { + color = stringInputToObject(color); + } + + if (typeof color == "object") { + if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } + else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) { + color.s = convertToPercentage(color.s); + color.v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, color.s, color.v); + ok = true; + format = "hsv"; + } + else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) { + color.s = convertToPercentage(color.s); + color.l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, color.s, color.l); + ok = true; + format = "hsl"; + } + + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + + a = boundAlpha(a); + + return { + ok: ok, + format: color.format || format, + r: mathMin(255, mathMax(rgb.r, 0)), + g: mathMin(255, mathMax(rgb.g, 0)), + b: mathMin(255, mathMax(rgb.b, 0)), + a: a + }; + } + + + // Conversion Functions + // -------------------- + + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // + + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b){ + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; + } + + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { + + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, l = (max + min) / 2; + + if(max == min) { + h = s = 0; // achromatic + } + else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch(max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + + h /= 6; + } + + return { h: h, s: s, l: l }; + } + + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { + var r, g, b; + + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + + function hue2rgb(p, q, t) { + if(t < 0) t += 1; + if(t > 1) t -= 1; + if(t < 1/6) return p + (q - p) * 6 * t; + if(t < 1/2) return q; + if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; + return p; + } + + if(s === 0) { + r = g = b = l; // achromatic + } + else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1/3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1/3); + } + + return { r: r * 255, g: g * 255, b: b * 255 }; + } + + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { + + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, v = max; + + var d = max - min; + s = max === 0 ? 0 : d / max; + + if(max == min) { + h = 0; // achromatic + } + else { + switch(max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + return { h: h, s: s, v: v }; + } + + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + + var i = math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + + return { r: r * 255, g: g * 255, b: b * 255 }; + } + + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + + var hex = [ + pad2(mathRound(r).toString(16)), + pad2(mathRound(g).toString(16)), + pad2(mathRound(b).toString(16)) + ]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + + return hex.join(""); + } + + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) { return false; } + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + }; + tinycolor.random = function() { + return tinycolor.fromRatio({ + r: mathRandom(), + g: mathRandom(), + b: mathRandom() + }); + }; + + + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // + + tinycolor.desaturate = function (color, amount) { + amount = (amount === 0) ? 0 : (amount || 10); + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + }; + tinycolor.saturate = function (color, amount) { + amount = (amount === 0) ? 0 : (amount || 10); + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + }; + tinycolor.greyscale = function(color) { + return tinycolor.desaturate(color, 100); + }; + tinycolor.lighten = function(color, amount) { + amount = (amount === 0) ? 0 : (amount || 10); + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + }; + tinycolor.darken = function (color, amount) { + amount = (amount === 0) ? 0 : (amount || 10); + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + }; + tinycolor.complement = function(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); + }; + + + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // + + tinycolor.triad = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) + ]; + }; + tinycolor.tetrad = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) + ]; + }; + tinycolor.splitcomplement = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), + tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) + ]; + }; + tinycolor.analogous = function(color, results, slices) { + results = results || 6; + slices = slices || 30; + + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + + for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; + }; + tinycolor.monochromatic = function(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, s = hsv.s, v = hsv.v; + var ret = []; + var modification = 1 / results; + + while (results--) { + ret.push(tinycolor({ h: h, s: s, v: v})); + v = (v + modification) % 1; + } + + return ret; + }; + + + // Readability Functions + // --------------------- + // + + // `readability` + // Analyze the 2 colors and returns an object with the following properties: + // `brightness`: difference in brightness between the two colors + // `color`: difference in color/hue between the two colors + tinycolor.readability = function(color1, color2) { + var a = tinycolor(color1).toRgb(); + var b = tinycolor(color2).toRgb(); + var brightnessA = (a.r * 299 + a.g * 587 + a.b * 114) / 1000; + var brightnessB = (b.r * 299 + b.g * 587 + b.b * 114) / 1000; + var colorDiff = ( + Math.max(a.r, b.r) - Math.min(a.r, b.r) + + Math.max(a.g, b.g) - Math.min(a.g, b.g) + + Math.max(a.b, b.b) - Math.min(a.b, b.b) + ); + + return { + brightness: Math.abs(brightnessA - brightnessB), + color: colorDiff + }; + }; + + // `readable` + // http://www.w3.org/TR/AERT#color-contrast + // Ensure that foreground and background color combinations provide sufficient contrast. + // *Example* + // tinycolor.readable("#000", "#111") => false + tinycolor.readable = function(color1, color2) { + var readability = tinycolor.readability(color1, color2); + return readability.brightness > 125 && readability.color > 500; + }; + + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // *Example* + // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000" + tinycolor.mostReadable = function(baseColor, colorList) { + var bestColor = null; + var bestScore = 0; + var bestIsReadable = false; + for (var i=0; i < colorList.length; i++) { + + // We normalize both around the "acceptable" breaking point, + // but rank brightness constrast higher than hue. + + var readability = tinycolor.readability(baseColor, colorList[i]); + var readable = readability.brightness > 125 && readability.color > 500; + var score = 3 * (readability.brightness / 125) + (readability.color / 500); + + if ((readable && ! bestIsReadable) || + (readable && bestIsReadable && score > bestScore) || + ((! readable) && (! bestIsReadable) && score > bestScore)) { + bestIsReadable = readable; + bestScore = score; + bestColor = tinycolor(colorList[i]); + } + } + return bestColor; + }; + + + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" + }; + + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); + + + // Utilities + // --------- + + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = { }; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; + } + + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { + a = parseFloat(a); + + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + + return a; + } + + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) { n = "100%"; } + + var processPercent = isPercentage(n); + n = mathMin(max, mathMax(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if ((math.abs(n - max) < 0.000001)) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return (n % max) / parseFloat(max); + } + + // Force a number between 0 and 1 + function clamp01(val) { + return mathMin(1, mathMax(0, val)); + } + + // Parse an integer into hex + function parseHex(val) { + return parseInt(val, 16); + } + + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; + } + + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf('%') != -1; + } + + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? '0' + c : '' + c; + } + + // Replace a decimal with it's percentage value + function convertToPercentage(n) { + if (n <= 1) { + n = (n * 100) + "%"; + } + + return n; + } + + var matchers = (function() { + + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + + return { + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; + })(); + + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + + color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } + else if (color == 'transparent') { + return { r: 0, g: 0, b: 0, a: 0, format: "name" }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if ((match = matchers.rgb.exec(color))) { + return { r: match[1], g: match[2], b: match[3] }; + } + if ((match = matchers.rgba.exec(color))) { + return { r: match[1], g: match[2], b: match[3], a: match[4] }; + } + if ((match = matchers.hsl.exec(color))) { + return { h: match[1], s: match[2], l: match[3] }; + } + if ((match = matchers.hsla.exec(color))) { + return { h: match[1], s: match[2], l: match[3], a: match[4] }; + } + if ((match = matchers.hsv.exec(color))) { + return { h: match[1], s: match[2], v: match[3] }; + } + if ((match = matchers.hex6.exec(color))) { + return { + r: parseHex(match[1]), + g: parseHex(match[2]), + b: parseHex(match[3]), + format: named ? "name" : "hex" + }; + } + if ((match = matchers.hex3.exec(color))) { + return { + r: parseHex(match[1] + '' + match[1]), + g: parseHex(match[2] + '' + match[2]), + b: parseHex(match[3] + '' + match[3]), + format: named ? "name" : "hex" + }; + } + + return false; + } + + // Expose tinycolor to window, does not need to run in non-browser context. + window.tinycolor = tinycolor; + + })(); + var tinycolor = window.tinycolor; + + $(function () { + if ($.fn.spectrum.load) { + $.fn.spectrum.processNativeColorInputs(); + } + }); + +})(window, jQuery); +;// vim:ts=4:sts=4:sw=4: +/*! + * + * Copyright 2009-2012 Kris Kowal under the terms of the MIT + * license found at http://github.com/kriskowal/q/raw/master/LICENSE + * + * With parts by Tyler Close + * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found + * at http://www.opensource.org/licenses/mit-license.html + * Forked at ref_send.js version: 2009-05-11 + * + * With parts by Mark Miller + * Copyright (C) 2011 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (definition) { + "use strict"; + + // This file will function properly as a @@ -410,57 +415,6 @@
X
- + + + + + + + + + + + + + + + + + +