Gallery – Flagallery Photo Portfolio - Version 5.2.6

Version Description

Download this release

Release Info

Developer pasyuk
Plugin Icon 128x128 Gallery – Flagallery Photo Portfolio
Version 5.2.6
Comparing to
See all releases

Code changes from version 5.2.1 to 5.2.6

admin/addgallery.php CHANGED
@@ -84,7 +84,13 @@ function flag_admin_add_gallery() {
84
  });
85
  /* ]]> */
86
  </script>
87
- <?php } ?>
 
 
 
 
 
 
88
  <div id="slider" class="flag-wrap">
89
 
90
  <ul id="tabs" class="tabs">
84
  });
85
  /* ]]> */
86
  </script>
87
+ <?php }
88
+ if ( ! is_plugin_active( 'woowbox/woowbox.php' ) ){
89
+ ?>
90
+ <div class="promote-woowbox" style="padding-top:10px"><a href="http://bit.ly/2J0eBeb" target="_blank"><img src="<?php echo plugins_url('/flash-album-gallery/admin/images/woowbox-promote.png') ?>" alt="Try WoowBox Gallery plugin" /></a></div>
91
+ <?php
92
+ }
93
+ ?>
94
  <div id="slider" class="flag-wrap">
95
 
96
  <ul id="tabs" class="tabs">
admin/admin.php CHANGED
@@ -258,9 +258,6 @@ class flagAdminPanel {
258
  break;
259
  case "flag-skins" :
260
  wp_enqueue_script( 'thickbox' );
261
- // Add the color picker assets
262
- wp_enqueue_style( 'wp-color-picker' );
263
- wp_enqueue_script( 'wp-color-picker' );
264
  print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
265
  break;
266
  }
@@ -276,7 +273,6 @@ class flagAdminPanel {
276
  wp_admin_css( 'css/dashboard' );
277
  break;
278
  case "flag-options" :
279
- wp_enqueue_style( 'farbtastic' );
280
  case "flag-manage-gallery" :
281
  wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
282
  case "flag-music-box" :
@@ -287,7 +283,6 @@ class flagAdminPanel {
287
  break;
288
  case "flag-skins" :
289
  wp_enqueue_style( 'thickbox' );
290
- wp_enqueue_style( 'farbtastic' );
291
  wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
292
  wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '5.0.0', 'screen' );
293
  wp_admin_css( 'css/dashboard' );
258
  break;
259
  case "flag-skins" :
260
  wp_enqueue_script( 'thickbox' );
 
 
 
261
  print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
262
  break;
263
  }
273
  wp_admin_css( 'css/dashboard' );
274
  break;
275
  case "flag-options" :
 
276
  case "flag-manage-gallery" :
277
  wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
278
  case "flag-music-box" :
283
  break;
284
  case "flag-skins" :
285
  wp_enqueue_style( 'thickbox' );
 
286
  wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
287
  wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '5.0.0', 'screen' );
288
  wp_admin_css( 'css/dashboard' );
admin/images/woowbox-promote.png ADDED
Binary file
admin/meta_box.php CHANGED
@@ -86,8 +86,8 @@ function send_to_editor(html){
86
  <table border="0" cellpadding="4" cellspacing="0" style="width: 90%;">
87
  <tr>
88
  <td nowrap="nowrap" valign="top" style="width: 10%;"><div><?php _e("Select galleries", 'flash-album-gallery'); ?>:<span style="color:red;"> *</span><br /><small><?php _e("(album categories)", 'flash-album-gallery'); ?></small></div></td>
89
- <td valign="top"><div id="galleries" style="width: 214px; height: 160px; overflow: auto;">
90
- <div class="row"><input type="checkbox" value="all" /> <strong>* - <?php _e("all galleries", 'flash-album-gallery'); ?></strong></div>
91
  <?php
92
  $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']);
93
  if(is_array($gallerylist)) {
@@ -95,7 +95,7 @@ function send_to_editor(html){
95
  $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
96
  if($flag->options['albSort'] == 'gid'){ $name = $gallery->gid.' - '.$name; }
97
  if($flag->options['albSort'] == 'title'){ $name = $name.' ('.$gallery->gid.')'; }
98
- echo '<div class="row"><input type="checkbox" value="' . $gallery->gid . '" /> <span>' . $name . '</span></div>' . "\n";
99
  }
100
  }
101
  ?>
86
  <table border="0" cellpadding="4" cellspacing="0" style="width: 90%;">
87
  <tr>
88
  <td nowrap="nowrap" valign="top" style="width: 10%;"><div><?php _e("Select galleries", 'flash-album-gallery'); ?>:<span style="color:red;"> *</span><br /><small><?php _e("(album categories)", 'flash-album-gallery'); ?></small></div></td>
89
+ <td valign="top"><div id="galleries" style="min-width: 214px; display:inline-block; height: 160px; overflow: auto;">
90
+ <div><input type="checkbox" value="all" /> <strong>* - <?php _e("all galleries", 'flash-album-gallery'); ?></strong></div>
91
  <?php
92
  $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']);
93
  if(is_array($gallerylist)) {
95
  $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
96
  if($flag->options['albSort'] == 'gid'){ $name = $gallery->gid.' - '.$name; }
97
  if($flag->options['albSort'] == 'title'){ $name = $name.' ('.$gallery->gid.')'; }
98
+ echo '<div><input type="checkbox" value="' . $gallery->gid . '" /> <span>' . $name . '</span></div>' . "\n";
99
  }
100
  }
101
  ?>
admin/overview.php CHANGED
@@ -8,6 +8,11 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
8
  * @return mixed content
9
  */
10
  function flag_admin_overview() {
 
 
 
 
 
11
  echo get_option('flag_plugin_error');
12
  ?>
13
  <div class="flag-wrap">
8
  * @return mixed content
9
  */
10
  function flag_admin_overview() {
11
+ if ( ! is_plugin_active( 'woowbox/woowbox.php' ) ){
12
+ ?>
13
+ <div class="promote-woowbox" style="padding-top:10px"><a href="http://bit.ly/2J0eBeb" target="_blank"><img src="<?php echo plugins_url('/flash-album-gallery/admin/images/woowbox-promote.png'); ?>" alt="Try WoowBox Gallery plugin" /></a></div>
14
+ <?php
15
+ }
16
  echo get_option('flag_plugin_error');
17
  ?>
18
  <div class="flag-wrap">
admin/skin_functions.php CHANGED
@@ -57,7 +57,18 @@ function flag_skin_options( $act_skin ) {
57
  </div>
58
  <script type="text/javascript">
59
  jQuery(document).ready(function () {
60
- jQuery('#skinOptions [data-type="color"]').wpColorPicker();
 
 
 
 
 
 
 
 
 
 
 
61
  });
62
  </script>
63
  </form>
57
  </div>
58
  <script type="text/javascript">
59
  jQuery(document).ready(function () {
60
+ jQuery('#skinOptions [data-type="color"]').spectrum({
61
+ showInput: true,
62
+ showAlpha: false,
63
+ allowEmpty: false,
64
+ preferredFormat: 'hex'
65
+ });
66
+ jQuery('#skinOptions [data-type="rgba"]').spectrum({
67
+ showInput: true,
68
+ showAlpha: true,
69
+ allowEmpty: false,
70
+ preferredFormat: 'rgb'
71
+ });
72
  });
73
  </script>
74
  </form>
admin/skin_options.php CHANGED
@@ -36,7 +36,7 @@ if(isset($_GET['show_options'])){
36
  <link rel='stylesheet' id='common-css' href='<?php echo get_admin_url(null, '/css/common.css'); ?>' type='text/css'/>
37
  <link rel='stylesheet' id='forms-css' href='<?php echo includes_url('/css/buttons.css'); ?>' type='text/css'/>
38
  <link rel="stylesheet" id="flagadmin-css" href="<?php echo plugins_url('/flash-album-gallery/admin/css/flagadmin.css'); ?>" type="text/css"/>
39
- <link rel='stylesheet' id='wp-color-picker-css' href='<?php echo get_admin_url(null, '/css/color-picker.css'); ?>' type='text/css' media='all'/>
40
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery.js'); ?>'></script>
41
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery-migrate.js'); ?>'></script>
42
  </head>
@@ -53,17 +53,7 @@ if(isset($_GET['show_options'])){
53
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery.ui.touch-punch.js'); ?>'></script>
54
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/ui/slider.min.js'); ?>'></script>
55
  <script type='text/javascript' src='<?php echo get_admin_url(null, '/js/iris.min.js'); ?>'></script>
56
- <script type='text/javascript'>
57
- /* <![CDATA[ */
58
- var wpColorPickerL10n = {
59
- "clear": "Clear",
60
- "defaultString": "Default",
61
- "pick": "Select Color",
62
- "current": "Current Color"
63
- };
64
- /* ]]> */
65
- </script>
66
- <script type='text/javascript' src='<?php echo get_admin_url(null, '/js/color-picker.js'); ?>'></script>
67
  </body>
68
  </html>
69
  <?php
36
  <link rel='stylesheet' id='common-css' href='<?php echo get_admin_url(null, '/css/common.css'); ?>' type='text/css'/>
37
  <link rel='stylesheet' id='forms-css' href='<?php echo includes_url('/css/buttons.css'); ?>' type='text/css'/>
38
  <link rel="stylesheet" id="flagadmin-css" href="<?php echo plugins_url('/flash-album-gallery/admin/css/flagadmin.css'); ?>" type="text/css"/>
39
+ <link rel='stylesheet' id='wp-color-picker-css' href='<?php echo plugins_url('/flash-album-gallery/assets/spectrum/spectrum.min.css'); ?>' type='text/css' media='all'/>
40
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery.js'); ?>'></script>
41
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery-migrate.js'); ?>'></script>
42
  </head>
53
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/jquery.ui.touch-punch.js'); ?>'></script>
54
  <script type='text/javascript' src='<?php echo includes_url('/js/jquery/ui/slider.min.js'); ?>'></script>
55
  <script type='text/javascript' src='<?php echo get_admin_url(null, '/js/iris.min.js'); ?>'></script>
56
+ <script type='text/javascript' src='<?php echo plugins_url('/flash-album-gallery/assets/spectrum/spectrum.min.js'); ?>'></script>
 
 
 
 
 
 
 
 
 
 
57
  </body>
58
  </html>
59
  <?php
admin/skins.php CHANGED
@@ -277,6 +277,11 @@ if(isset($_GET['skins_refresh'])){
277
  flagGallery::show_message(__('Skins refreshed successfully', 'flash-album-gallery'));
278
  }
279
  }
 
 
 
 
 
280
  ?>
281
  <div id="slider" class="flag-wrap">
282
  <?php if(current_user_can('FlAG Add skins')){ ?>
277
  flagGallery::show_message(__('Skins refreshed successfully', 'flash-album-gallery'));
278
  }
279
  }
280
+ if ( ! is_plugin_active( 'woowbox/woowbox.php' ) ){
281
+ ?>
282
+ <div class="promote-woowbox" style="padding-top:10px"><a href="http://bit.ly/2J0eBeb" target="_blank"><img src="<?php echo plugins_url('/flash-album-gallery/admin/images/woowbox-promote.png') ?>" alt="Try WoowBox Gallery plugin" /></a></div>
283
+ <?php
284
+ }
285
  ?>
286
  <div id="slider" class="flag-wrap">
287
  <?php if(current_user_can('FlAG Add skins')){ ?>
assets/flagallery.css CHANGED
@@ -2,3 +2,4 @@
2
  ** FlaGallery StyleSheet
3
  */
4
  .flashalbum { overflow:hidden; position:relative;}
 
2
  ** FlaGallery StyleSheet
3
  */
4
  .flashalbum { overflow:hidden; position:relative;}
5
+ .mfp-flagallery-open .mfp-arrow { top: auto !important; margin-top: auto !important; }
assets/spectrum/spectrum.css ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***
2
+ Spectrum Colorpicker v1.8.0
3
+ https://github.com/bgrins/spectrum
4
+ Author: Brian Grinstead
5
+ License: MIT
6
+ ***/
7
+
8
+ .sp-container {
9
+ position:absolute;
10
+ top:0;
11
+ left:0;
12
+ display:inline-block;
13
+ *display: inline;
14
+ *zoom: 1;
15
+ /* https://github.com/bgrins/spectrum/issues/40 */
16
+ z-index: 9999994;
17
+ overflow: hidden;
18
+ }
19
+ .sp-container.sp-flat {
20
+ position: relative;
21
+ }
22
+
23
+ /* Fix for * { box-sizing: border-box; } */
24
+ .sp-container,
25
+ .sp-container * {
26
+ -webkit-box-sizing: content-box;
27
+ -moz-box-sizing: content-box;
28
+ box-sizing: content-box;
29
+ }
30
+
31
+ /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
32
+ .sp-top {
33
+ position:relative;
34
+ width: 100%;
35
+ display:inline-block;
36
+ }
37
+ .sp-top-inner {
38
+ position:absolute;
39
+ top:0;
40
+ left:0;
41
+ bottom:0;
42
+ right:0;
43
+ }
44
+ .sp-color {
45
+ position: absolute;
46
+ top:0;
47
+ left:0;
48
+ bottom:0;
49
+ right:20%;
50
+ }
51
+ .sp-hue {
52
+ position: absolute;
53
+ top:0;
54
+ right:0;
55
+ bottom:0;
56
+ left:84%;
57
+ height: 100%;
58
+ }
59
+
60
+ .sp-clear-enabled .sp-hue {
61
+ top:33px;
62
+ height: 77.5%;
63
+ }
64
+
65
+ .sp-fill {
66
+ padding-top: 80%;
67
+ }
68
+ .sp-sat, .sp-val {
69
+ position: absolute;
70
+ top:0;
71
+ left:0;
72
+ right:0;
73
+ bottom:0;
74
+ }
75
+
76
+ .sp-alpha-enabled .sp-top {
77
+ margin-bottom: 18px;
78
+ }
79
+ .sp-alpha-enabled .sp-alpha {
80
+ display: block;
81
+ }
82
+ .sp-alpha-handle {
83
+ position:absolute;
84
+ top:-4px;
85
+ bottom: -4px;
86
+ width: 6px;
87
+ left: 50%;
88
+ cursor: pointer;
89
+ border: 1px solid black;
90
+ background: white;
91
+ opacity: .8;
92
+ }
93
+ .sp-alpha {
94
+ display: none;
95
+ position: absolute;
96
+ bottom: -14px;
97
+ right: 0;
98
+ left: 0;
99
+ height: 8px;
100
+ }
101
+ .sp-alpha-inner {
102
+ border: solid 1px #333;
103
+ }
104
+
105
+ .sp-clear {
106
+ display: none;
107
+ }
108
+
109
+ .sp-clear.sp-clear-display {
110
+ background-position: center;
111
+ }
112
+
113
+ .sp-clear-enabled .sp-clear {
114
+ display: block;
115
+ position:absolute;
116
+ top:0px;
117
+ right:0;
118
+ bottom:0;
119
+ left:84%;
120
+ height: 28px;
121
+ }
122
+
123
+ /* Don't allow text selection */
124
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
125
+ -webkit-user-select:none;
126
+ -moz-user-select: -moz-none;
127
+ -o-user-select:none;
128
+ user-select: none;
129
+ }
130
+
131
+ .sp-container.sp-input-disabled .sp-input-container {
132
+ display: none;
133
+ }
134
+ .sp-container.sp-buttons-disabled .sp-button-container {
135
+ display: none;
136
+ }
137
+ .sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
138
+ display: none;
139
+ }
140
+ .sp-palette-only .sp-picker-container {
141
+ display: none;
142
+ }
143
+ .sp-palette-disabled .sp-palette-container {
144
+ display: none;
145
+ }
146
+
147
+ .sp-initial-disabled .sp-initial {
148
+ display: none;
149
+ }
150
+
151
+
152
+ /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
153
+ .sp-sat {
154
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
155
+ background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
156
+ background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
157
+ background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
158
+ background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
159
+ background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
160
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
161
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
162
+ }
163
+ .sp-val {
164
+ background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
165
+ background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
166
+ background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
167
+ background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
168
+ background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
169
+ background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
170
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
171
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
172
+ }
173
+
174
+ .sp-hue {
175
+ background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
176
+ background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
177
+ background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
178
+ 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));
179
+ background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
180
+ background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
181
+ }
182
+
183
+ /* IE filters do not support multiple color stops.
184
+ Generate 6 divs, line them up, and do two color gradients for each.
185
+ Yes, really.
186
+ */
187
+ .sp-1 {
188
+ height:17%;
189
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
190
+ }
191
+ .sp-2 {
192
+ height:16%;
193
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
194
+ }
195
+ .sp-3 {
196
+ height:17%;
197
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
198
+ }
199
+ .sp-4 {
200
+ height:17%;
201
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
202
+ }
203
+ .sp-5 {
204
+ height:16%;
205
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
206
+ }
207
+ .sp-6 {
208
+ height:17%;
209
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
210
+ }
211
+
212
+ .sp-hidden {
213
+ display: none !important;
214
+ }
215
+
216
+ /* Clearfix hack */
217
+ .sp-cf:before, .sp-cf:after { content: ""; display: table; }
218
+ .sp-cf:after { clear: both; }
219
+ .sp-cf { *zoom: 1; }
220
+
221
+ /* Mobile devices, make hue slider bigger so it is easier to slide */
222
+ @media (max-device-width: 480px) {
223
+ .sp-color { right: 40%; }
224
+ .sp-hue { left: 63%; }
225
+ .sp-fill { padding-top: 60%; }
226
+ }
227
+ .sp-dragger {
228
+ border-radius: 5px;
229
+ height: 5px;
230
+ width: 5px;
231
+ border: 1px solid #fff;
232
+ background: #000;
233
+ cursor: pointer;
234
+ position:absolute;
235
+ top:0;
236
+ left: 0;
237
+ }
238
+ .sp-slider {
239
+ position: absolute;
240
+ top:0;
241
+ cursor:pointer;
242
+ height: 3px;
243
+ left: -1px;
244
+ right: -1px;
245
+ border: 1px solid #000;
246
+ background: white;
247
+ opacity: .8;
248
+ }
249
+
250
+ /*
251
+ Theme authors:
252
+ Here are the basic themeable display options (colors, fonts, global widths).
253
+ See http://bgrins.github.io/spectrum/themes/ for instructions.
254
+ */
255
+
256
+ .sp-container {
257
+ border-radius: 0;
258
+ background-color: #ECECEC;
259
+ border: solid 1px #f0c49B;
260
+ padding: 0;
261
+ }
262
+ .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
263
+ font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
264
+ -webkit-box-sizing: border-box;
265
+ -moz-box-sizing: border-box;
266
+ -ms-box-sizing: border-box;
267
+ box-sizing: border-box;
268
+ }
269
+ .sp-top {
270
+ margin-bottom: 3px;
271
+ }
272
+ .sp-color, .sp-hue, .sp-clear {
273
+ border: solid 1px #666;
274
+ }
275
+
276
+ /* Input */
277
+ .sp-input-container {
278
+ float:right;
279
+ width: 100px;
280
+ margin-bottom: 4px;
281
+ }
282
+ .sp-initial-disabled .sp-input-container {
283
+ width: 100%;
284
+ }
285
+ .sp-input {
286
+ font-size: 12px !important;
287
+ border: 1px inset;
288
+ padding: 4px 5px;
289
+ margin: 0;
290
+ width: 100%;
291
+ background:transparent;
292
+ border-radius: 3px;
293
+ color: #222;
294
+ }
295
+ .sp-input:focus {
296
+ border: 1px solid orange;
297
+ }
298
+ .sp-input.sp-validation-error {
299
+ border: 1px solid red;
300
+ background: #fdd;
301
+ }
302
+ .sp-picker-container , .sp-palette-container {
303
+ float:left;
304
+ position: relative;
305
+ padding: 10px;
306
+ padding-bottom: 300px;
307
+ margin-bottom: -290px;
308
+ }
309
+ .sp-picker-container {
310
+ width: 172px;
311
+ border-left: solid 1px #fff;
312
+ }
313
+
314
+ /* Palettes */
315
+ .sp-palette-container {
316
+ border-right: solid 1px #ccc;
317
+ }
318
+
319
+ .sp-palette-only .sp-palette-container {
320
+ border: 0;
321
+ }
322
+
323
+ .sp-palette .sp-thumb-el {
324
+ display: block;
325
+ position:relative;
326
+ float:left;
327
+ width: 24px;
328
+ height: 15px;
329
+ margin: 3px;
330
+ cursor: pointer;
331
+ border:solid 2px transparent;
332
+ }
333
+ .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
334
+ border-color: orange;
335
+ }
336
+ .sp-thumb-el {
337
+ position:relative;
338
+ }
339
+
340
+ /* Initial */
341
+ .sp-initial {
342
+ float: left;
343
+ border: solid 1px #333;
344
+ }
345
+ .sp-initial span {
346
+ width: 30px;
347
+ height: 25px;
348
+ border:none;
349
+ display:block;
350
+ float:left;
351
+ margin:0;
352
+ }
353
+
354
+ .sp-initial .sp-clear-display {
355
+ background-position: center;
356
+ }
357
+
358
+ /* Buttons */
359
+ .sp-palette-button-container,
360
+ .sp-button-container {
361
+ float: right;
362
+ }
363
+
364
+ /* Replacer (the little preview div that shows up instead of the <input>) */
365
+ .sp-replacer {
366
+ margin:0;
367
+ overflow:hidden;
368
+ cursor:pointer;
369
+ padding: 4px;
370
+ display:inline-block;
371
+ *zoom: 1;
372
+ *display: inline;
373
+ border: solid 1px #91765d;
374
+ background: #eee;
375
+ color: #333;
376
+ vertical-align: middle;
377
+ }
378
+ .sp-replacer:hover, .sp-replacer.sp-active {
379
+ border-color: #F0C49B;
380
+ color: #111;
381
+ }
382
+ .sp-replacer.sp-disabled {
383
+ cursor:default;
384
+ border-color: silver;
385
+ color: silver;
386
+ }
387
+ .sp-dd {
388
+ padding: 2px 0;
389
+ height: 16px;
390
+ line-height: 16px;
391
+ float:left;
392
+ font-size:10px;
393
+ }
394
+ .sp-preview {
395
+ position:relative;
396
+ width:25px;
397
+ height: 20px;
398
+ border: solid 1px #222;
399
+ margin-right: 5px;
400
+ float:left;
401
+ z-index: 0;
402
+ }
403
+
404
+ .sp-palette {
405
+ *width: 220px;
406
+ max-width: 220px;
407
+ }
408
+ .sp-palette .sp-thumb-el {
409
+ width:16px;
410
+ height: 16px;
411
+ margin:2px 1px;
412
+ border: solid 1px #d0d0d0;
413
+ }
414
+
415
+ .sp-container {
416
+ padding-bottom:0;
417
+ }
418
+
419
+
420
+ /* Buttons: http://hellohappy.org/css3-buttons/ */
421
+ .sp-container button {
422
+ background-color: #eeeeee;
423
+ background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
424
+ background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
425
+ background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
426
+ background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
427
+ background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
428
+ border: 1px solid #ccc;
429
+ border-bottom: 1px solid #bbb;
430
+ border-radius: 3px;
431
+ color: #333;
432
+ font-size: 14px;
433
+ line-height: 1;
434
+ padding: 5px 4px;
435
+ text-align: center;
436
+ text-shadow: 0 1px 0 #eee;
437
+ vertical-align: middle;
438
+ }
439
+ .sp-container button:hover {
440
+ background-color: #dddddd;
441
+ background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
442
+ background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
443
+ background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
444
+ background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
445
+ background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
446
+ border: 1px solid #bbb;
447
+ border-bottom: 1px solid #999;
448
+ cursor: pointer;
449
+ text-shadow: 0 1px 0 #ddd;
450
+ }
451
+ .sp-container button:active {
452
+ border: 1px solid #aaa;
453
+ border-bottom: 1px solid #888;
454
+ -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
455
+ -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
456
+ -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
457
+ -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
458
+ box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
459
+ }
460
+ .sp-cancel {
461
+ font-size: 11px;
462
+ color: #d93f3f !important;
463
+ margin:0;
464
+ padding:2px;
465
+ margin-right: 5px;
466
+ vertical-align: middle;
467
+ text-decoration:none;
468
+
469
+ }
470
+ .sp-cancel:hover {
471
+ color: #d93f3f !important;
472
+ text-decoration: underline;
473
+ }
474
+
475
+
476
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active {
477
+ border-color: #000;
478
+ }
479
+
480
+ .sp-preview, .sp-alpha, .sp-thumb-el {
481
+ position:relative;
482
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
483
+ }
484
+ .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
485
+ display:block;
486
+ position:absolute;
487
+ top:0;left:0;bottom:0;right:0;
488
+ }
489
+
490
+ .sp-palette .sp-thumb-inner {
491
+ background-position: 50% 50%;
492
+ background-repeat: no-repeat;
493
+ }
494
+
495
+ .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
496
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
497
+ }
498
+
499
+ .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
500
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
501
+ }
502
+
503
+ .sp-clear-display {
504
+ background-repeat:no-repeat;
505
+ background-position: center;
506
+ background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
507
+ }
assets/spectrum/spectrum.js ADDED
@@ -0,0 +1,2323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Spectrum Colorpicker v1.8.0
2
+ // https://github.com/bgrins/spectrum
3
+ // Author: Brian Grinstead
4
+ // License: MIT
5
+
6
+ (function (factory) {
7
+ "use strict";
8
+
9
+ if (typeof define === 'function' && define.amd) { // AMD
10
+ define(['jquery'], factory);
11
+ }
12
+ else if (typeof exports == "object" && typeof module == "object") { // CommonJS
13
+ module.exports = factory(require('jquery'));
14
+ }
15
+ else { // Browser
16
+ factory(jQuery);
17
+ }
18
+ })(function($, undefined) {
19
+ "use strict";
20
+
21
+ var defaultOpts = {
22
+
23
+ // Callbacks
24
+ beforeShow: noop,
25
+ move: noop,
26
+ change: noop,
27
+ show: noop,
28
+ hide: noop,
29
+
30
+ // Options
31
+ color: false,
32
+ flat: false,
33
+ showInput: false,
34
+ allowEmpty: false,
35
+ showButtons: true,
36
+ clickoutFiresChange: true,
37
+ showInitial: false,
38
+ showPalette: false,
39
+ showPaletteOnly: false,
40
+ hideAfterPaletteSelect: false,
41
+ togglePaletteOnly: false,
42
+ showSelectionPalette: true,
43
+ localStorageKey: false,
44
+ appendTo: "body",
45
+ maxSelectionSize: 7,
46
+ cancelText: "cancel",
47
+ chooseText: "choose",
48
+ togglePaletteMoreText: "more",
49
+ togglePaletteLessText: "less",
50
+ clearText: "Clear Color Selection",
51
+ noColorSelectedText: "No Color Selected",
52
+ preferredFormat: false,
53
+ className: "", // Deprecated - use containerClassName and replacerClassName instead.
54
+ containerClassName: "",
55
+ replacerClassName: "",
56
+ showAlpha: false,
57
+ theme: "sp-light",
58
+ palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
59
+ selectionPalette: [],
60
+ disabled: false,
61
+ offset: null
62
+ },
63
+ spectrums = [],
64
+ IE = !!/msie/i.exec( window.navigator.userAgent ),
65
+ rgbaSupport = (function() {
66
+ function contains( str, substr ) {
67
+ return !!~('' + str).indexOf(substr);
68
+ }
69
+
70
+ var elem = document.createElement('div');
71
+ var style = elem.style;
72
+ style.cssText = 'background-color:rgba(0,0,0,.5)';
73
+ return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
74
+ })(),
75
+ replaceInput = [
76
+ "<div class='sp-replacer'>",
77
+ "<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
78
+ "<div class='sp-dd'>&#9660;</div>",
79
+ "</div>"
80
+ ].join(''),
81
+ markup = (function () {
82
+
83
+ // IE does not support gradients with multiple stops, so we need to simulate
84
+ // that for the rainbow slider with 8 divs that each have a single gradient
85
+ var gradientFix = "";
86
+ if (IE) {
87
+ for (var i = 1; i <= 6; i++) {
88
+ gradientFix += "<div class='sp-" + i + "'></div>";
89
+ }
90
+ }
91
+
92
+ return [
93
+ "<div class='sp-container sp-hidden'>",
94
+ "<div class='sp-palette-container'>",
95
+ "<div class='sp-palette sp-thumb sp-cf'></div>",
96
+ "<div class='sp-palette-button-container sp-cf'>",
97
+ "<button type='button' class='sp-palette-toggle'></button>",
98
+ "</div>",
99
+ "</div>",
100
+ "<div class='sp-picker-container'>",
101
+ "<div class='sp-top sp-cf'>",
102
+ "<div class='sp-fill'></div>",
103
+ "<div class='sp-top-inner'>",
104
+ "<div class='sp-color'>",
105
+ "<div class='sp-sat'>",
106
+ "<div class='sp-val'>",
107
+ "<div class='sp-dragger'></div>",
108
+ "</div>",
109
+ "</div>",
110
+ "</div>",
111
+ "<div class='sp-clear sp-clear-display'>",
112
+ "</div>",
113
+ "<div class='sp-hue'>",
114
+ "<div class='sp-slider'></div>",
115
+ gradientFix,
116
+ "</div>",
117
+ "</div>",
118
+ "<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
119
+ "</div>",
120
+ "<div class='sp-input-container sp-cf'>",
121
+ "<input class='sp-input' type='text' spellcheck='false' />",
122
+ "</div>",
123
+ "<div class='sp-initial sp-thumb sp-cf'></div>",
124
+ "<div class='sp-button-container sp-cf'>",
125
+ "<a class='sp-cancel' href='#'></a>",
126
+ "<button type='button' class='sp-choose'></button>",
127
+ "</div>",
128
+ "</div>",
129
+ "</div>"
130
+ ].join("");
131
+ })();
132
+
133
+ function paletteTemplate (p, color, className, opts) {
134
+ var html = [];
135
+ for (var i = 0; i < p.length; i++) {
136
+ var current = p[i];
137
+ if(current) {
138
+ var tiny = tinycolor(current);
139
+ var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
140
+ c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
141
+ var formattedString = tiny.toString(opts.preferredFormat || "rgb");
142
+ var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
143
+ html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
144
+ } else {
145
+ var cls = 'sp-clear-display';
146
+ html.push($('<div />')
147
+ .append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
148
+ .attr('title', opts.noColorSelectedText)
149
+ )
150
+ .html()
151
+ );
152
+ }
153
+ }
154
+ return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
155
+ }
156
+
157
+ function hideAll() {
158
+ for (var i = 0; i < spectrums.length; i++) {
159
+ if (spectrums[i]) {
160
+ spectrums[i].hide();
161
+ }
162
+ }
163
+ }
164
+
165
+ function instanceOptions(o, callbackContext) {
166
+ var opts = $.extend({}, defaultOpts, o);
167
+ opts.callbacks = {
168
+ 'move': bind(opts.move, callbackContext),
169
+ 'change': bind(opts.change, callbackContext),
170
+ 'show': bind(opts.show, callbackContext),
171
+ 'hide': bind(opts.hide, callbackContext),
172
+ 'beforeShow': bind(opts.beforeShow, callbackContext)
173
+ };
174
+
175
+ return opts;
176
+ }
177
+
178
+ function spectrum(element, o) {
179
+
180
+ var opts = instanceOptions(o, element),
181
+ flat = opts.flat,
182
+ showSelectionPalette = opts.showSelectionPalette,
183
+ localStorageKey = opts.localStorageKey,
184
+ theme = opts.theme,
185
+ callbacks = opts.callbacks,
186
+ resize = throttle(reflow, 10),
187
+ visible = false,
188
+ isDragging = false,
189
+ dragWidth = 0,
190
+ dragHeight = 0,
191
+ dragHelperHeight = 0,
192
+ slideHeight = 0,
193
+ slideWidth = 0,
194
+ alphaWidth = 0,
195
+ alphaSlideHelperWidth = 0,
196
+ slideHelperHeight = 0,
197
+ currentHue = 0,
198
+ currentSaturation = 0,
199
+ currentValue = 0,
200
+ currentAlpha = 1,
201
+ palette = [],
202
+ paletteArray = [],
203
+ paletteLookup = {},
204
+ selectionPalette = opts.selectionPalette.slice(0),
205
+ maxSelectionSize = opts.maxSelectionSize,
206
+ draggingClass = "sp-dragging",
207
+ shiftMovementDirection = null;
208
+
209
+ var doc = element.ownerDocument,
210
+ body = doc.body,
211
+ boundElement = $(element),
212
+ disabled = false,
213
+ container = $(markup, doc).addClass(theme),
214
+ pickerContainer = container.find(".sp-picker-container"),
215
+ dragger = container.find(".sp-color"),
216
+ dragHelper = container.find(".sp-dragger"),
217
+ slider = container.find(".sp-hue"),
218
+ slideHelper = container.find(".sp-slider"),
219
+ alphaSliderInner = container.find(".sp-alpha-inner"),
220
+ alphaSlider = container.find(".sp-alpha"),
221
+ alphaSlideHelper = container.find(".sp-alpha-handle"),
222
+ textInput = container.find(".sp-input"),
223
+ paletteContainer = container.find(".sp-palette"),
224
+ initialColorContainer = container.find(".sp-initial"),
225
+ cancelButton = container.find(".sp-cancel"),
226
+ clearButton = container.find(".sp-clear"),
227
+ chooseButton = container.find(".sp-choose"),
228
+ toggleButton = container.find(".sp-palette-toggle"),
229
+ isInput = boundElement.is("input"),
230
+ isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(),
231
+ shouldReplace = isInput && !flat,
232
+ replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
233
+ offsetElement = (shouldReplace) ? replacer : boundElement,
234
+ previewElement = replacer.find(".sp-preview-inner"),
235
+ initialColor = opts.color || (isInput && boundElement.val()),
236
+ colorOnShow = false,
237
+ currentPreferredFormat = opts.preferredFormat,
238
+ clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
239
+ isEmpty = !initialColor,
240
+ allowEmpty = opts.allowEmpty && !isInputTypeColor;
241
+
242
+ function applyOptions() {
243
+
244
+ if (opts.showPaletteOnly) {
245
+ opts.showPalette = true;
246
+ }
247
+
248
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
249
+
250
+ if (opts.palette) {
251
+ palette = opts.palette.slice(0);
252
+ paletteArray = $.isArray(palette[0]) ? palette : [palette];
253
+ paletteLookup = {};
254
+ for (var i = 0; i < paletteArray.length; i++) {
255
+ for (var j = 0; j < paletteArray[i].length; j++) {
256
+ var rgb = tinycolor(paletteArray[i][j]).toRgbString();
257
+ paletteLookup[rgb] = true;
258
+ }
259
+ }
260
+ }
261
+
262
+ container.toggleClass("sp-flat", flat);
263
+ container.toggleClass("sp-input-disabled", !opts.showInput);
264
+ container.toggleClass("sp-alpha-enabled", opts.showAlpha);
265
+ container.toggleClass("sp-clear-enabled", allowEmpty);
266
+ container.toggleClass("sp-buttons-disabled", !opts.showButtons);
267
+ container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);
268
+ container.toggleClass("sp-palette-disabled", !opts.showPalette);
269
+ container.toggleClass("sp-palette-only", opts.showPaletteOnly);
270
+ container.toggleClass("sp-initial-disabled", !opts.showInitial);
271
+ container.addClass(opts.className).addClass(opts.containerClassName);
272
+
273
+ reflow();
274
+ }
275
+
276
+ function initialize() {
277
+
278
+ if (IE) {
279
+ container.find("*:not(input)").attr("unselectable", "on");
280
+ }
281
+
282
+ applyOptions();
283
+
284
+ if (shouldReplace) {
285
+ boundElement.after(replacer).hide();
286
+ }
287
+
288
+ if (!allowEmpty) {
289
+ clearButton.hide();
290
+ }
291
+
292
+ if (flat) {
293
+ boundElement.after(container).hide();
294
+ }
295
+ else {
296
+
297
+ var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
298
+ if (appendTo.length !== 1) {
299
+ appendTo = $("body");
300
+ }
301
+
302
+ appendTo.append(container);
303
+ }
304
+
305
+ updateSelectionPaletteFromStorage();
306
+
307
+ offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
308
+ if (!disabled) {
309
+ toggle();
310
+ }
311
+
312
+ e.stopPropagation();
313
+
314
+ if (!$(e.target).is("input")) {
315
+ e.preventDefault();
316
+ }
317
+ });
318
+
319
+ if(boundElement.is(":disabled") || (opts.disabled === true)) {
320
+ disable();
321
+ }
322
+
323
+ // Prevent clicks from bubbling up to document. This would cause it to be hidden.
324
+ container.click(stopPropagation);
325
+
326
+ // Handle user typed input
327
+ textInput.change(setFromTextInput);
328
+ textInput.bind("paste", function () {
329
+ setTimeout(setFromTextInput, 1);
330
+ });
331
+ textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
332
+
333
+ cancelButton.text(opts.cancelText);
334
+ cancelButton.bind("click.spectrum", function (e) {
335
+ e.stopPropagation();
336
+ e.preventDefault();
337
+ revert();
338
+ hide();
339
+ });
340
+
341
+ clearButton.attr("title", opts.clearText);
342
+ clearButton.bind("click.spectrum", function (e) {
343
+ e.stopPropagation();
344
+ e.preventDefault();
345
+ isEmpty = true;
346
+ move();
347
+
348
+ if(flat) {
349
+ //for the flat style, this is a change event
350
+ updateOriginalInput(true);
351
+ }
352
+ });
353
+
354
+ chooseButton.text(opts.chooseText);
355
+ chooseButton.bind("click.spectrum", function (e) {
356
+ e.stopPropagation();
357
+ e.preventDefault();
358
+
359
+ if (IE && textInput.is(":focus")) {
360
+ textInput.trigger('change');
361
+ }
362
+
363
+ if (isValid()) {
364
+ updateOriginalInput(true);
365
+ hide();
366
+ }
367
+ });
368
+
369
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
370
+ toggleButton.bind("click.spectrum", function (e) {
371
+ e.stopPropagation();
372
+ e.preventDefault();
373
+
374
+ opts.showPaletteOnly = !opts.showPaletteOnly;
375
+
376
+ // To make sure the Picker area is drawn on the right, next to the
377
+ // Palette area (and not below the palette), first move the Palette
378
+ // to the left to make space for the picker, plus 5px extra.
379
+ // The 'applyOptions' function puts the whole container back into place
380
+ // and takes care of the button-text and the sp-palette-only CSS class.
381
+ if (!opts.showPaletteOnly && !flat) {
382
+ container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));
383
+ }
384
+ applyOptions();
385
+ });
386
+
387
+ draggable(alphaSlider, function (dragX, dragY, e) {
388
+ currentAlpha = (dragX / alphaWidth);
389
+ isEmpty = false;
390
+ if (e.shiftKey) {
391
+ currentAlpha = Math.round(currentAlpha * 10) / 10;
392
+ }
393
+
394
+ move();
395
+ }, dragStart, dragStop);
396
+
397
+ draggable(slider, function (dragX, dragY) {
398
+ currentHue = parseFloat(dragY / slideHeight);
399
+ isEmpty = false;
400
+ if (!opts.showAlpha) {
401
+ currentAlpha = 1;
402
+ }
403
+ move();
404
+ }, dragStart, dragStop);
405
+
406
+ draggable(dragger, function (dragX, dragY, e) {
407
+
408
+ // shift+drag should snap the movement to either the x or y axis.
409
+ if (!e.shiftKey) {
410
+ shiftMovementDirection = null;
411
+ }
412
+ else if (!shiftMovementDirection) {
413
+ var oldDragX = currentSaturation * dragWidth;
414
+ var oldDragY = dragHeight - (currentValue * dragHeight);
415
+ var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
416
+
417
+ shiftMovementDirection = furtherFromX ? "x" : "y";
418
+ }
419
+
420
+ var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
421
+ var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
422
+
423
+ if (setSaturation) {
424
+ currentSaturation = parseFloat(dragX / dragWidth);
425
+ }
426
+ if (setValue) {
427
+ currentValue = parseFloat((dragHeight - dragY) / dragHeight);
428
+ }
429
+
430
+ isEmpty = false;
431
+ if (!opts.showAlpha) {
432
+ currentAlpha = 1;
433
+ }
434
+
435
+ move();
436
+
437
+ }, dragStart, dragStop);
438
+
439
+ if (!!initialColor) {
440
+ set(initialColor);
441
+
442
+ // In case color was black - update the preview UI and set the format
443
+ // since the set function will not run (default color is black).
444
+ updateUI();
445
+ currentPreferredFormat = opts.preferredFormat || tinycolor(initialColor).format;
446
+
447
+ addColorToSelectionPalette(initialColor);
448
+ }
449
+ else {
450
+ updateUI();
451
+ }
452
+
453
+ if (flat) {
454
+ show();
455
+ }
456
+
457
+ function paletteElementClick(e) {
458
+ if (e.data && e.data.ignore) {
459
+ set($(e.target).closest(".sp-thumb-el").data("color"));
460
+ move();
461
+ }
462
+ else {
463
+ set($(e.target).closest(".sp-thumb-el").data("color"));
464
+ move();
465
+ updateOriginalInput(true);
466
+ if (opts.hideAfterPaletteSelect) {
467
+ hide();
468
+ }
469
+ }
470
+
471
+ return false;
472
+ }
473
+
474
+ var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
475
+ paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
476
+ initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
477
+ }
478
+
479
+ function updateSelectionPaletteFromStorage() {
480
+
481
+ if (localStorageKey && window.localStorage) {
482
+
483
+ // Migrate old palettes over to new format. May want to remove this eventually.
484
+ try {
485
+ var oldPalette = window.localStorage[localStorageKey].split(",#");
486
+ if (oldPalette.length > 1) {
487
+ delete window.localStorage[localStorageKey];
488
+ $.each(oldPalette, function(i, c) {
489
+ addColorToSelectionPalette(c);
490
+ });
491
+ }
492
+ }
493
+ catch(e) { }
494
+
495
+ try {
496
+ selectionPalette = window.localStorage[localStorageKey].split(";");
497
+ }
498
+ catch (e) { }
499
+ }
500
+ }
501
+
502
+ function addColorToSelectionPalette(color) {
503
+ if (showSelectionPalette) {
504
+ var rgb = tinycolor(color).toRgbString();
505
+ if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
506
+ selectionPalette.push(rgb);
507
+ while(selectionPalette.length > maxSelectionSize) {
508
+ selectionPalette.shift();
509
+ }
510
+ }
511
+
512
+ if (localStorageKey && window.localStorage) {
513
+ try {
514
+ window.localStorage[localStorageKey] = selectionPalette.join(";");
515
+ }
516
+ catch(e) { }
517
+ }
518
+ }
519
+ }
520
+
521
+ function getUniqueSelectionPalette() {
522
+ var unique = [];
523
+ if (opts.showPalette) {
524
+ for (var i = 0; i < selectionPalette.length; i++) {
525
+ var rgb = tinycolor(selectionPalette[i]).toRgbString();
526
+
527
+ if (!paletteLookup[rgb]) {
528
+ unique.push(selectionPalette[i]);
529
+ }
530
+ }
531
+ }
532
+
533
+ return unique.reverse().slice(0, opts.maxSelectionSize);
534
+ }
535
+
536
+ function drawPalette() {
537
+
538
+ var currentColor = get();
539
+
540
+ var html = $.map(paletteArray, function (palette, i) {
541
+ return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
542
+ });
543
+
544
+ updateSelectionPaletteFromStorage();
545
+
546
+ if (selectionPalette) {
547
+ html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
548
+ }
549
+
550
+ paletteContainer.html(html.join(""));
551
+ }
552
+
553
+ function drawInitial() {
554
+ if (opts.showInitial) {
555
+ var initial = colorOnShow;
556
+ var current = get();
557
+ initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
558
+ }
559
+ }
560
+
561
+ function dragStart() {
562
+ if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
563
+ reflow();
564
+ }
565
+ isDragging = true;
566
+ container.addClass(draggingClass);
567
+ shiftMovementDirection = null;
568
+ boundElement.trigger('dragstart.spectrum', [ get() ]);
569
+ }
570
+
571
+ function dragStop() {
572
+ isDragging = false;
573
+ container.removeClass(draggingClass);
574
+ boundElement.trigger('dragstop.spectrum', [ get() ]);
575
+ }
576
+
577
+ function setFromTextInput() {
578
+
579
+ var value = textInput.val();
580
+
581
+ if ((value === null || value === "") && allowEmpty) {
582
+ set(null);
583
+ updateOriginalInput(true);
584
+ }
585
+ else {
586
+ var tiny = tinycolor(value);
587
+ if (tiny.isValid()) {
588
+ set(tiny);
589
+ updateOriginalInput(true);
590
+ }
591
+ else {
592
+ textInput.addClass("sp-validation-error");
593
+ }
594
+ }
595
+ }
596
+
597
+ function toggle() {
598
+ if (visible) {
599
+ hide();
600
+ }
601
+ else {
602
+ show();
603
+ }
604
+ }
605
+
606
+ function show() {
607
+ var event = $.Event('beforeShow.spectrum');
608
+
609
+ if (visible) {
610
+ reflow();
611
+ return;
612
+ }
613
+
614
+ boundElement.trigger(event, [ get() ]);
615
+
616
+ if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
617
+ return;
618
+ }
619
+
620
+ hideAll();
621
+ visible = true;
622
+
623
+ $(doc).bind("keydown.spectrum", onkeydown);
624
+ $(doc).bind("click.spectrum", clickout);
625
+ $(window).bind("resize.spectrum", resize);
626
+ replacer.addClass("sp-active");
627
+ container.removeClass("sp-hidden");
628
+
629
+ reflow();
630
+ updateUI();
631
+
632
+ colorOnShow = get();
633
+
634
+ drawInitial();
635
+ callbacks.show(colorOnShow);
636
+ boundElement.trigger('show.spectrum', [ colorOnShow ]);
637
+ }
638
+
639
+ function onkeydown(e) {
640
+ // Close on ESC
641
+ if (e.keyCode === 27) {
642
+ hide();
643
+ }
644
+ }
645
+
646
+ function clickout(e) {
647
+ // Return on right click.
648
+ if (e.button == 2) { return; }
649
+
650
+ // If a drag event was happening during the mouseup, don't hide
651
+ // on click.
652
+ if (isDragging) { return; }
653
+
654
+ if (clickoutFiresChange) {
655
+ updateOriginalInput(true);
656
+ }
657
+ else {
658
+ revert();
659
+ }
660
+ hide();
661
+ }
662
+
663
+ function hide() {
664
+ // Return if hiding is unnecessary
665
+ if (!visible || flat) { return; }
666
+ visible = false;
667
+
668
+ $(doc).unbind("keydown.spectrum", onkeydown);
669
+ $(doc).unbind("click.spectrum", clickout);
670
+ $(window).unbind("resize.spectrum", resize);
671
+
672
+ replacer.removeClass("sp-active");
673
+ container.addClass("sp-hidden");
674
+
675
+ callbacks.hide(get());
676
+ boundElement.trigger('hide.spectrum', [ get() ]);
677
+ }
678
+
679
+ function revert() {
680
+ set(colorOnShow, true);
681
+ }
682
+
683
+ function set(color, ignoreFormatChange) {
684
+ if (tinycolor.equals(color, get())) {
685
+ // Update UI just in case a validation error needs
686
+ // to be cleared.
687
+ updateUI();
688
+ return;
689
+ }
690
+
691
+ var newColor, newHsv;
692
+ if (!color && allowEmpty) {
693
+ isEmpty = true;
694
+ } else {
695
+ isEmpty = false;
696
+ newColor = tinycolor(color);
697
+ newHsv = newColor.toHsv();
698
+
699
+ currentHue = (newHsv.h % 360) / 360;
700
+ currentSaturation = newHsv.s;
701
+ currentValue = newHsv.v;
702
+ currentAlpha = newHsv.a;
703
+ }
704
+ updateUI();
705
+
706
+ if (newColor && newColor.isValid() && !ignoreFormatChange) {
707
+ currentPreferredFormat = opts.preferredFormat || newColor.getFormat();
708
+ }
709
+ }
710
+
711
+ function get(opts) {
712
+ opts = opts || { };
713
+
714
+ if (allowEmpty && isEmpty) {
715
+ return null;
716
+ }
717
+
718
+ return tinycolor.fromRatio({
719
+ h: currentHue,
720
+ s: currentSaturation,
721
+ v: currentValue,
722
+ a: Math.round(currentAlpha * 100) / 100
723
+ }, { format: opts.format || currentPreferredFormat });
724
+ }
725
+
726
+ function isValid() {
727
+ return !textInput.hasClass("sp-validation-error");
728
+ }
729
+
730
+ function move() {
731
+ updateUI();
732
+
733
+ callbacks.move(get());
734
+ boundElement.trigger('move.spectrum', [ get() ]);
735
+ }
736
+
737
+ function updateUI() {
738
+
739
+ textInput.removeClass("sp-validation-error");
740
+
741
+ updateHelperLocations();
742
+
743
+ // Update dragger background color (gradients take care of saturation and value).
744
+ var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
745
+ dragger.css("background-color", flatColor.toHexString());
746
+
747
+ // Get a format that alpha will be included in (hex and names ignore alpha)
748
+ var format = currentPreferredFormat;
749
+ if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
750
+ if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
751
+ format = "rgb";
752
+ }
753
+ }
754
+
755
+ var realColor = get({ format: format }),
756
+ displayColor = '';
757
+
758
+ //reset background info for preview element
759
+ previewElement.removeClass("sp-clear-display");
760
+ previewElement.css('background-color', 'transparent');
761
+
762
+ if (!realColor && allowEmpty) {
763
+ // Update the replaced elements background with icon indicating no color selection
764
+ previewElement.addClass("sp-clear-display");
765
+ }
766
+ else {
767
+ var realHex = realColor.toHexString(),
768
+ realRgb = realColor.toRgbString();
769
+
770
+ // Update the replaced elements background color (with actual selected color)
771
+ if (rgbaSupport || realColor.alpha === 1) {
772
+ previewElement.css("background-color", realRgb);
773
+ }
774
+ else {
775
+ previewElement.css("background-color", "transparent");
776
+ previewElement.css("filter", realColor.toFilter());
777
+ }
778
+
779
+ if (opts.showAlpha) {
780
+ var rgb = realColor.toRgb();
781
+ rgb.a = 0;
782
+ var realAlpha = tinycolor(rgb).toRgbString();
783
+ var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
784
+
785
+ if (IE) {
786
+ alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
787
+ }
788
+ else {
789
+ alphaSliderInner.css("background", "-webkit-" + gradient);
790
+ alphaSliderInner.css("background", "-moz-" + gradient);
791
+ alphaSliderInner.css("background", "-ms-" + gradient);
792
+ // Use current syntax gradient on unprefixed property.
793
+ alphaSliderInner.css("background",
794
+ "linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
795
+ }
796
+ }
797
+
798
+ displayColor = realColor.toString(format);
799
+ }
800
+
801
+ // Update the text entry input as it changes happen
802
+ if (opts.showInput) {
803
+ textInput.val(displayColor);
804
+ }
805
+
806
+ if (opts.showPalette) {
807
+ drawPalette();
808
+ }
809
+
810
+ drawInitial();
811
+ }
812
+
813
+ function updateHelperLocations() {
814
+ var s = currentSaturation;
815
+ var v = currentValue;
816
+
817
+ if(allowEmpty && isEmpty) {
818
+ //if selected color is empty, hide the helpers
819
+ alphaSlideHelper.hide();
820
+ slideHelper.hide();
821
+ dragHelper.hide();
822
+ }
823
+ else {
824
+ //make sure helpers are visible
825
+ alphaSlideHelper.show();
826
+ slideHelper.show();
827
+ dragHelper.show();
828
+
829
+ // Where to show the little circle in that displays your current selected color
830
+ var dragX = s * dragWidth;
831
+ var dragY = dragHeight - (v * dragHeight);
832
+ dragX = Math.max(
833
+ -dragHelperHeight,
834
+ Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
835
+ );
836
+ dragY = Math.max(
837
+ -dragHelperHeight,
838
+ Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
839
+ );
840
+ dragHelper.css({
841
+ "top": dragY + "px",
842
+ "left": dragX + "px"
843
+ });
844
+
845
+ var alphaX = currentAlpha * alphaWidth;
846
+ alphaSlideHelper.css({
847
+ "left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
848
+ });
849
+
850
+ // Where to show the bar that displays your current selected hue
851
+ var slideY = (currentHue) * slideHeight;
852
+ slideHelper.css({
853
+ "top": (slideY - slideHelperHeight) + "px"
854
+ });
855
+ }
856
+ }
857
+
858
+ function updateOriginalInput(fireCallback) {
859
+ var color = get(),
860
+ displayColor = '',
861
+ hasChanged = !tinycolor.equals(color, colorOnShow);
862
+
863
+ if (color) {
864
+ displayColor = color.toString(currentPreferredFormat);
865
+ // Update the selection palette with the current color
866
+ addColorToSelectionPalette(color);
867
+ }
868
+
869
+ if (isInput) {
870
+ boundElement.val(displayColor);
871
+ }
872
+
873
+ if (fireCallback && hasChanged) {
874
+ callbacks.change(color);
875
+ boundElement.trigger('change', [ color ]);
876
+ }
877
+ }
878
+
879
+ function reflow() {
880
+ if (!visible) {
881
+ return; // Calculations would be useless and wouldn't be reliable anyways
882
+ }
883
+ dragWidth = dragger.width();
884
+ dragHeight = dragger.height();
885
+ dragHelperHeight = dragHelper.height();
886
+ slideWidth = slider.width();
887
+ slideHeight = slider.height();
888
+ slideHelperHeight = slideHelper.height();
889
+ alphaWidth = alphaSlider.width();
890
+ alphaSlideHelperWidth = alphaSlideHelper.width();
891
+
892
+ if (!flat) {
893
+ container.css("position", "absolute");
894
+ if (opts.offset) {
895
+ container.offset(opts.offset);
896
+ } else {
897
+ container.offset(getOffset(container, offsetElement));
898
+ }
899
+ }
900
+
901
+ updateHelperLocations();
902
+
903
+ if (opts.showPalette) {
904
+ drawPalette();
905
+ }
906
+
907
+ boundElement.trigger('reflow.spectrum');
908
+ }
909
+
910
+ function destroy() {
911
+ boundElement.show();
912
+ offsetElement.unbind("click.spectrum touchstart.spectrum");
913
+ container.remove();
914
+ replacer.remove();
915
+ spectrums[spect.id] = null;
916
+ }
917
+
918
+ function option(optionName, optionValue) {
919
+ if (optionName === undefined) {
920
+ return $.extend({}, opts);
921
+ }
922
+ if (optionValue === undefined) {
923
+ return opts[optionName];
924
+ }
925
+
926
+ opts[optionName] = optionValue;
927
+
928
+ if (optionName === "preferredFormat") {
929
+ currentPreferredFormat = opts.preferredFormat;
930
+ }
931
+ applyOptions();
932
+ }
933
+
934
+ function enable() {
935
+ disabled = false;
936
+ boundElement.attr("disabled", false);
937
+ offsetElement.removeClass("sp-disabled");
938
+ }
939
+
940
+ function disable() {
941
+ hide();
942
+ disabled = true;
943
+ boundElement.attr("disabled", true);
944
+ offsetElement.addClass("sp-disabled");
945
+ }
946
+
947
+ function setOffset(coord) {
948
+ opts.offset = coord;
949
+ reflow();
950
+ }
951
+
952
+ initialize();
953
+
954
+ var spect = {
955
+ show: show,
956
+ hide: hide,
957
+ toggle: toggle,
958
+ reflow: reflow,
959
+ option: option,
960
+ enable: enable,
961
+ disable: disable,
962
+ offset: setOffset,
963
+ set: function (c) {
964
+ set(c);
965
+ updateOriginalInput();
966
+ },
967
+ get: get,
968
+ destroy: destroy,
969
+ container: container
970
+ };
971
+
972
+ spect.id = spectrums.push(spect) - 1;
973
+
974
+ return spect;
975
+ }
976
+
977
+ /**
978
+ * checkOffset - get the offset below/above and left/right element depending on screen position
979
+ * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
980
+ */
981
+ function getOffset(picker, input) {
982
+ var extraY = 0;
983
+ var dpWidth = picker.outerWidth();
984
+ var dpHeight = picker.outerHeight();
985
+ var inputHeight = input.outerHeight();
986
+ var doc = picker[0].ownerDocument;
987
+ var docElem = doc.documentElement;
988
+ var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
989
+ var viewHeight = docElem.clientHeight + $(doc).scrollTop();
990
+ var offset = input.offset();
991
+ offset.top += inputHeight;
992
+
993
+ offset.left -=
994
+ Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
995
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
996
+
997
+ offset.top -=
998
+ Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
999
+ Math.abs(dpHeight + inputHeight - extraY) : extraY));
1000
+
1001
+ return offset;
1002
+ }
1003
+
1004
+ /**
1005
+ * noop - do nothing
1006
+ */
1007
+ function noop() {
1008
+
1009
+ }
1010
+
1011
+ /**
1012
+ * stopPropagation - makes the code only doing this a little easier to read in line
1013
+ */
1014
+ function stopPropagation(e) {
1015
+ e.stopPropagation();
1016
+ }
1017
+
1018
+ /**
1019
+ * Create a function bound to a given object
1020
+ * Thanks to underscore.js
1021
+ */
1022
+ function bind(func, obj) {
1023
+ var slice = Array.prototype.slice;
1024
+ var args = slice.call(arguments, 2);
1025
+ return function () {
1026
+ return func.apply(obj, args.concat(slice.call(arguments)));
1027
+ };
1028
+ }
1029
+
1030
+ /**
1031
+ * Lightweight drag helper. Handles containment within the element, so that
1032
+ * when dragging, the x is within [0,element.width] and y is within [0,element.height]
1033
+ */
1034
+ function draggable(element, onmove, onstart, onstop) {
1035
+ onmove = onmove || function () { };
1036
+ onstart = onstart || function () { };
1037
+ onstop = onstop || function () { };
1038
+ var doc = document;
1039
+ var dragging = false;
1040
+ var offset = {};
1041
+ var maxHeight = 0;
1042
+ var maxWidth = 0;
1043
+ var hasTouch = ('ontouchstart' in window);
1044
+
1045
+ var duringDragEvents = {};
1046
+ duringDragEvents["selectstart"] = prevent;
1047
+ duringDragEvents["dragstart"] = prevent;
1048
+ duringDragEvents["touchmove mousemove"] = move;
1049
+ duringDragEvents["touchend mouseup"] = stop;
1050
+
1051
+ function prevent(e) {
1052
+ if (e.stopPropagation) {
1053
+ e.stopPropagation();
1054
+ }
1055
+ if (e.preventDefault) {
1056
+ e.preventDefault();
1057
+ }
1058
+ e.returnValue = false;
1059
+ }
1060
+
1061
+ function move(e) {
1062
+ if (dragging) {
1063
+ // Mouseup happened outside of window
1064
+ if (IE && doc.documentMode < 9 && !e.button) {
1065
+ return stop();
1066
+ }
1067
+
1068
+ var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];
1069
+ var pageX = t0 && t0.pageX || e.pageX;
1070
+ var pageY = t0 && t0.pageY || e.pageY;
1071
+
1072
+ var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
1073
+ var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
1074
+
1075
+ if (hasTouch) {
1076
+ // Stop scrolling in iOS
1077
+ prevent(e);
1078
+ }
1079
+
1080
+ onmove.apply(element, [dragX, dragY, e]);
1081
+ }
1082
+ }
1083
+
1084
+ function start(e) {
1085
+ var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
1086
+
1087
+ if (!rightclick && !dragging) {
1088
+ if (onstart.apply(element, arguments) !== false) {
1089
+ dragging = true;
1090
+ maxHeight = $(element).height();
1091
+ maxWidth = $(element).width();
1092
+ offset = $(element).offset();
1093
+
1094
+ $(doc).bind(duringDragEvents);
1095
+ $(doc.body).addClass("sp-dragging");
1096
+
1097
+ move(e);
1098
+
1099
+ prevent(e);
1100
+ }
1101
+ }
1102
+ }
1103
+
1104
+ function stop() {
1105
+ if (dragging) {
1106
+ $(doc).unbind(duringDragEvents);
1107
+ $(doc.body).removeClass("sp-dragging");
1108
+
1109
+ // Wait a tick before notifying observers to allow the click event
1110
+ // to fire in Chrome.
1111
+ setTimeout(function() {
1112
+ onstop.apply(element, arguments);
1113
+ }, 0);
1114
+ }
1115
+ dragging = false;
1116
+ }
1117
+
1118
+ $(element).bind("touchstart mousedown", start);
1119
+ }
1120
+
1121
+ function throttle(func, wait, debounce) {
1122
+ var timeout;
1123
+ return function () {
1124
+ var context = this, args = arguments;
1125
+ var throttler = function () {
1126
+ timeout = null;
1127
+ func.apply(context, args);
1128
+ };
1129
+ if (debounce) clearTimeout(timeout);
1130
+ if (debounce || !timeout) timeout = setTimeout(throttler, wait);
1131
+ };
1132
+ }
1133
+
1134
+ function inputTypeColorSupport() {
1135
+ return $.fn.spectrum.inputTypeColorSupport();
1136
+ }
1137
+
1138
+ /**
1139
+ * Define a jQuery plugin
1140
+ */
1141
+ var dataID = "spectrum.id";
1142
+ $.fn.spectrum = function (opts, extra) {
1143
+
1144
+ if (typeof opts == "string") {
1145
+
1146
+ var returnValue = this;
1147
+ var args = Array.prototype.slice.call( arguments, 1 );
1148
+
1149
+ this.each(function () {
1150
+ var spect = spectrums[$(this).data(dataID)];
1151
+ if (spect) {
1152
+ var method = spect[opts];
1153
+ if (!method) {
1154
+ throw new Error( "Spectrum: no such method: '" + opts + "'" );
1155
+ }
1156
+
1157
+ if (opts == "get") {
1158
+ returnValue = spect.get();
1159
+ }
1160
+ else if (opts == "container") {
1161
+ returnValue = spect.container;
1162
+ }
1163
+ else if (opts == "option") {
1164
+ returnValue = spect.option.apply(spect, args);
1165
+ }
1166
+ else if (opts == "destroy") {
1167
+ spect.destroy();
1168
+ $(this).removeData(dataID);
1169
+ }
1170
+ else {
1171
+ method.apply(spect, args);
1172
+ }
1173
+ }
1174
+ });
1175
+
1176
+ return returnValue;
1177
+ }
1178
+
1179
+ // Initializing a new instance of spectrum
1180
+ return this.spectrum("destroy").each(function () {
1181
+ var options = $.extend({}, opts, $(this).data());
1182
+ var spect = spectrum(this, options);
1183
+ $(this).data(dataID, spect.id);
1184
+ });
1185
+ };
1186
+
1187
+ $.fn.spectrum.load = true;
1188
+ $.fn.spectrum.loadOpts = {};
1189
+ $.fn.spectrum.draggable = draggable;
1190
+ $.fn.spectrum.defaults = defaultOpts;
1191
+ $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {
1192
+ if (typeof inputTypeColorSupport._cachedResult === "undefined") {
1193
+ var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null
1194
+ inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "";
1195
+ }
1196
+ return inputTypeColorSupport._cachedResult;
1197
+ };
1198
+
1199
+ $.spectrum = { };
1200
+ $.spectrum.localization = { };
1201
+ $.spectrum.palettes = { };
1202
+
1203
+ $.fn.spectrum.processNativeColorInputs = function () {
1204
+ var colorInputs = $("input[type=color]");
1205
+ if (colorInputs.length && !inputTypeColorSupport()) {
1206
+ colorInputs.spectrum({
1207
+ preferredFormat: "hex6"
1208
+ });
1209
+ }
1210
+ };
1211
+
1212
+ // TinyColor v1.1.2
1213
+ // https://github.com/bgrins/TinyColor
1214
+ // Brian Grinstead, MIT License
1215
+
1216
+ (function() {
1217
+
1218
+ var trimLeft = /^[\s,#]+/,
1219
+ trimRight = /\s+$/,
1220
+ tinyCounter = 0,
1221
+ math = Math,
1222
+ mathRound = math.round,
1223
+ mathMin = math.min,
1224
+ mathMax = math.max,
1225
+ mathRandom = math.random;
1226
+
1227
+ var tinycolor = function(color, opts) {
1228
+
1229
+ color = (color) ? color : '';
1230
+ opts = opts || { };
1231
+
1232
+ // If input is already a tinycolor, return itself
1233
+ if (color instanceof tinycolor) {
1234
+ return color;
1235
+ }
1236
+ // If we are called as a function, call using new instead
1237
+ if (!(this instanceof tinycolor)) {
1238
+ return new tinycolor(color, opts);
1239
+ }
1240
+
1241
+ var rgb = inputToRGB(color);
1242
+ this._originalInput = color,
1243
+ this._r = rgb.r,
1244
+ this._g = rgb.g,
1245
+ this._b = rgb.b,
1246
+ this._a = rgb.a,
1247
+ this._roundA = mathRound(100*this._a) / 100,
1248
+ this._format = opts.format || rgb.format;
1249
+ this._gradientType = opts.gradientType;
1250
+
1251
+ // Don't let the range of [0,255] come back in [0,1].
1252
+ // Potentially lose a little bit of precision here, but will fix issues where
1253
+ // .5 gets interpreted as half of the total, instead of half of 1
1254
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
1255
+ if (this._r < 1) { this._r = mathRound(this._r); }
1256
+ if (this._g < 1) { this._g = mathRound(this._g); }
1257
+ if (this._b < 1) { this._b = mathRound(this._b); }
1258
+
1259
+ this._ok = rgb.ok;
1260
+ this._tc_id = tinyCounter++;
1261
+ };
1262
+
1263
+ tinycolor.prototype = {
1264
+ isDark: function() {
1265
+ return this.getBrightness() < 128;
1266
+ },
1267
+ isLight: function() {
1268
+ return !this.isDark();
1269
+ },
1270
+ isValid: function() {
1271
+ return this._ok;
1272
+ },
1273
+ getOriginalInput: function() {
1274
+ return this._originalInput;
1275
+ },
1276
+ getFormat: function() {
1277
+ return this._format;
1278
+ },
1279
+ getAlpha: function() {
1280
+ return this._a;
1281
+ },
1282
+ getBrightness: function() {
1283
+ var rgb = this.toRgb();
1284
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
1285
+ },
1286
+ setAlpha: function(value) {
1287
+ this._a = boundAlpha(value);
1288
+ this._roundA = mathRound(100*this._a) / 100;
1289
+ return this;
1290
+ },
1291
+ toHsv: function() {
1292
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1293
+ return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
1294
+ },
1295
+ toHsvString: function() {
1296
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1297
+ var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
1298
+ return (this._a == 1) ?
1299
+ "hsv(" + h + ", " + s + "%, " + v + "%)" :
1300
+ "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
1301
+ },
1302
+ toHsl: function() {
1303
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1304
+ return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
1305
+ },
1306
+ toHslString: function() {
1307
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1308
+ var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
1309
+ return (this._a == 1) ?
1310
+ "hsl(" + h + ", " + s + "%, " + l + "%)" :
1311
+ "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
1312
+ },
1313
+ toHex: function(allow3Char) {
1314
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
1315
+ },
1316
+ toHexString: function(allow3Char) {
1317
+ return '#' + this.toHex(allow3Char);
1318
+ },
1319
+ toHex8: function() {
1320
+ return rgbaToHex(this._r, this._g, this._b, this._a);
1321
+ },
1322
+ toHex8String: function() {
1323
+ return '#' + this.toHex8();
1324
+ },
1325
+ toRgb: function() {
1326
+ return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
1327
+ },
1328
+ toRgbString: function() {
1329
+ return (this._a == 1) ?
1330
+ "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
1331
+ "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
1332
+ },
1333
+ toPercentageRgb: function() {
1334
+ return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
1335
+ },
1336
+ toPercentageRgbString: function() {
1337
+ return (this._a == 1) ?
1338
+ "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
1339
+ "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
1340
+ },
1341
+ toName: function() {
1342
+ if (this._a === 0) {
1343
+ return "transparent";
1344
+ }
1345
+
1346
+ if (this._a < 1) {
1347
+ return false;
1348
+ }
1349
+
1350
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
1351
+ },
1352
+ toFilter: function(secondColor) {
1353
+ var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
1354
+ var secondHex8String = hex8String;
1355
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
1356
+
1357
+ if (secondColor) {
1358
+ var s = tinycolor(secondColor);
1359
+ secondHex8String = s.toHex8String();
1360
+ }
1361
+
1362
+ return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
1363
+ },
1364
+ toString: function(format) {
1365
+ var formatSet = !!format;
1366
+ format = format || this._format;
1367
+
1368
+ var formattedString = false;
1369
+ var hasAlpha = this._a < 1 && this._a >= 0;
1370
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
1371
+
1372
+ if (needsAlphaFormat) {
1373
+ // Special case for "transparent", all other non-alpha formats
1374
+ // will return rgba when there is transparency.
1375
+ if (format === "name" && this._a === 0) {
1376
+ return this.toName();
1377
+ }
1378
+ return this.toRgbString();
1379
+ }
1380
+ if (format === "rgb") {
1381
+ formattedString = this.toRgbString();
1382
+ }
1383
+ if (format === "prgb") {
1384
+ formattedString = this.toPercentageRgbString();
1385
+ }
1386
+ if (format === "hex" || format === "hex6") {
1387
+ formattedString = this.toHexString();
1388
+ }
1389
+ if (format === "hex3") {
1390
+ formattedString = this.toHexString(true);
1391
+ }
1392
+ if (format === "hex8") {
1393
+ formattedString = this.toHex8String();
1394
+ }
1395
+ if (format === "name") {
1396
+ formattedString = this.toName();
1397
+ }
1398
+ if (format === "hsl") {
1399
+ formattedString = this.toHslString();
1400
+ }
1401
+ if (format === "hsv") {
1402
+ formattedString = this.toHsvString();
1403
+ }
1404
+
1405
+ return formattedString || this.toHexString();
1406
+ },
1407
+
1408
+ _applyModification: function(fn, args) {
1409
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
1410
+ this._r = color._r;
1411
+ this._g = color._g;
1412
+ this._b = color._b;
1413
+ this.setAlpha(color._a);
1414
+ return this;
1415
+ },
1416
+ lighten: function() {
1417
+ return this._applyModification(lighten, arguments);
1418
+ },
1419
+ brighten: function() {
1420
+ return this._applyModification(brighten, arguments);
1421
+ },
1422
+ darken: function() {
1423
+ return this._applyModification(darken, arguments);
1424
+ },
1425
+ desaturate: function() {
1426
+ return this._applyModification(desaturate, arguments);
1427
+ },
1428
+ saturate: function() {
1429
+ return this._applyModification(saturate, arguments);
1430
+ },
1431
+ greyscale: function() {
1432
+ return this._applyModification(greyscale, arguments);
1433
+ },
1434
+ spin: function() {
1435
+ return this._applyModification(spin, arguments);
1436
+ },
1437
+
1438
+ _applyCombination: function(fn, args) {
1439
+ return fn.apply(null, [this].concat([].slice.call(args)));
1440
+ },
1441
+ analogous: function() {
1442
+ return this._applyCombination(analogous, arguments);
1443
+ },
1444
+ complement: function() {
1445
+ return this._applyCombination(complement, arguments);
1446
+ },
1447
+ monochromatic: function() {
1448
+ return this._applyCombination(monochromatic, arguments);
1449
+ },
1450
+ splitcomplement: function() {
1451
+ return this._applyCombination(splitcomplement, arguments);
1452
+ },
1453
+ triad: function() {
1454
+ return this._applyCombination(triad, arguments);
1455
+ },
1456
+ tetrad: function() {
1457
+ return this._applyCombination(tetrad, arguments);
1458
+ }
1459
+ };
1460
+
1461
+ // If input is an object, force 1 into "1.0" to handle ratios properly
1462
+ // String input requires "1.0" as input, so 1 will be treated as 1
1463
+ tinycolor.fromRatio = function(color, opts) {
1464
+ if (typeof color == "object") {
1465
+ var newColor = {};
1466
+ for (var i in color) {
1467
+ if (color.hasOwnProperty(i)) {
1468
+ if (i === "a") {
1469
+ newColor[i] = color[i];
1470
+ }
1471
+ else {
1472
+ newColor[i] = convertToPercentage(color[i]);
1473
+ }
1474
+ }
1475
+ }
1476
+ color = newColor;
1477
+ }
1478
+
1479
+ return tinycolor(color, opts);
1480
+ };
1481
+
1482
+ // Given a string or object, convert that input to RGB
1483
+ // Possible string inputs:
1484
+ //
1485
+ // "red"
1486
+ // "#f00" or "f00"
1487
+ // "#ff0000" or "ff0000"
1488
+ // "#ff000000" or "ff000000"
1489
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
1490
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
1491
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
1492
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
1493
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
1494
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
1495
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
1496
+ //
1497
+ function inputToRGB(color) {
1498
+
1499
+ var rgb = { r: 0, g: 0, b: 0 };
1500
+ var a = 1;
1501
+ var ok = false;
1502
+ var format = false;
1503
+
1504
+ if (typeof color == "string") {
1505
+ color = stringInputToObject(color);
1506
+ }
1507
+
1508
+ if (typeof color == "object") {
1509
+ if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
1510
+ rgb = rgbToRgb(color.r, color.g, color.b);
1511
+ ok = true;
1512
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
1513
+ }
1514
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
1515
+ color.s = convertToPercentage(color.s);
1516
+ color.v = convertToPercentage(color.v);
1517
+ rgb = hsvToRgb(color.h, color.s, color.v);
1518
+ ok = true;
1519
+ format = "hsv";
1520
+ }
1521
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
1522
+ color.s = convertToPercentage(color.s);
1523
+ color.l = convertToPercentage(color.l);
1524
+ rgb = hslToRgb(color.h, color.s, color.l);
1525
+ ok = true;
1526
+ format = "hsl";
1527
+ }
1528
+
1529
+ if (color.hasOwnProperty("a")) {
1530
+ a = color.a;
1531
+ }
1532
+ }
1533
+
1534
+ a = boundAlpha(a);
1535
+
1536
+ return {
1537
+ ok: ok,
1538
+ format: color.format || format,
1539
+ r: mathMin(255, mathMax(rgb.r, 0)),
1540
+ g: mathMin(255, mathMax(rgb.g, 0)),
1541
+ b: mathMin(255, mathMax(rgb.b, 0)),
1542
+ a: a
1543
+ };
1544
+ }
1545
+
1546
+
1547
+ // Conversion Functions
1548
+ // --------------------
1549
+
1550
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
1551
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
1552
+
1553
+ // `rgbToRgb`
1554
+ // Handle bounds / percentage checking to conform to CSS color spec
1555
+ // <http://www.w3.org/TR/css3-color/>
1556
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
1557
+ // *Returns:* { r, g, b } in [0, 255]
1558
+ function rgbToRgb(r, g, b){
1559
+ return {
1560
+ r: bound01(r, 255) * 255,
1561
+ g: bound01(g, 255) * 255,
1562
+ b: bound01(b, 255) * 255
1563
+ };
1564
+ }
1565
+
1566
+ // `rgbToHsl`
1567
+ // Converts an RGB color value to HSL.
1568
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
1569
+ // *Returns:* { h, s, l } in [0,1]
1570
+ function rgbToHsl(r, g, b) {
1571
+
1572
+ r = bound01(r, 255);
1573
+ g = bound01(g, 255);
1574
+ b = bound01(b, 255);
1575
+
1576
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1577
+ var h, s, l = (max + min) / 2;
1578
+
1579
+ if(max == min) {
1580
+ h = s = 0; // achromatic
1581
+ }
1582
+ else {
1583
+ var d = max - min;
1584
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1585
+ switch(max) {
1586
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1587
+ case g: h = (b - r) / d + 2; break;
1588
+ case b: h = (r - g) / d + 4; break;
1589
+ }
1590
+
1591
+ h /= 6;
1592
+ }
1593
+
1594
+ return { h: h, s: s, l: l };
1595
+ }
1596
+
1597
+ // `hslToRgb`
1598
+ // Converts an HSL color value to RGB.
1599
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
1600
+ // *Returns:* { r, g, b } in the set [0, 255]
1601
+ function hslToRgb(h, s, l) {
1602
+ var r, g, b;
1603
+
1604
+ h = bound01(h, 360);
1605
+ s = bound01(s, 100);
1606
+ l = bound01(l, 100);
1607
+
1608
+ function hue2rgb(p, q, t) {
1609
+ if(t < 0) t += 1;
1610
+ if(t > 1) t -= 1;
1611
+ if(t < 1/6) return p + (q - p) * 6 * t;
1612
+ if(t < 1/2) return q;
1613
+ if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
1614
+ return p;
1615
+ }
1616
+
1617
+ if(s === 0) {
1618
+ r = g = b = l; // achromatic
1619
+ }
1620
+ else {
1621
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1622
+ var p = 2 * l - q;
1623
+ r = hue2rgb(p, q, h + 1/3);
1624
+ g = hue2rgb(p, q, h);
1625
+ b = hue2rgb(p, q, h - 1/3);
1626
+ }
1627
+
1628
+ return { r: r * 255, g: g * 255, b: b * 255 };
1629
+ }
1630
+
1631
+ // `rgbToHsv`
1632
+ // Converts an RGB color value to HSV
1633
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
1634
+ // *Returns:* { h, s, v } in [0,1]
1635
+ function rgbToHsv(r, g, b) {
1636
+
1637
+ r = bound01(r, 255);
1638
+ g = bound01(g, 255);
1639
+ b = bound01(b, 255);
1640
+
1641
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1642
+ var h, s, v = max;
1643
+
1644
+ var d = max - min;
1645
+ s = max === 0 ? 0 : d / max;
1646
+
1647
+ if(max == min) {
1648
+ h = 0; // achromatic
1649
+ }
1650
+ else {
1651
+ switch(max) {
1652
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1653
+ case g: h = (b - r) / d + 2; break;
1654
+ case b: h = (r - g) / d + 4; break;
1655
+ }
1656
+ h /= 6;
1657
+ }
1658
+ return { h: h, s: s, v: v };
1659
+ }
1660
+
1661
+ // `hsvToRgb`
1662
+ // Converts an HSV color value to RGB.
1663
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
1664
+ // *Returns:* { r, g, b } in the set [0, 255]
1665
+ function hsvToRgb(h, s, v) {
1666
+
1667
+ h = bound01(h, 360) * 6;
1668
+ s = bound01(s, 100);
1669
+ v = bound01(v, 100);
1670
+
1671
+ var i = math.floor(h),
1672
+ f = h - i,
1673
+ p = v * (1 - s),
1674
+ q = v * (1 - f * s),
1675
+ t = v * (1 - (1 - f) * s),
1676
+ mod = i % 6,
1677
+ r = [v, q, p, p, t, v][mod],
1678
+ g = [t, v, v, q, p, p][mod],
1679
+ b = [p, p, t, v, v, q][mod];
1680
+
1681
+ return { r: r * 255, g: g * 255, b: b * 255 };
1682
+ }
1683
+
1684
+ // `rgbToHex`
1685
+ // Converts an RGB color to hex
1686
+ // Assumes r, g, and b are contained in the set [0, 255]
1687
+ // Returns a 3 or 6 character hex
1688
+ function rgbToHex(r, g, b, allow3Char) {
1689
+
1690
+ var hex = [
1691
+ pad2(mathRound(r).toString(16)),
1692
+ pad2(mathRound(g).toString(16)),
1693
+ pad2(mathRound(b).toString(16))
1694
+ ];
1695
+
1696
+ // Return a 3 character hex if possible
1697
+ 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)) {
1698
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
1699
+ }
1700
+
1701
+ return hex.join("");
1702
+ }
1703
+ // `rgbaToHex`
1704
+ // Converts an RGBA color plus alpha transparency to hex
1705
+ // Assumes r, g, b and a are contained in the set [0, 255]
1706
+ // Returns an 8 character hex
1707
+ function rgbaToHex(r, g, b, a) {
1708
+
1709
+ var hex = [
1710
+ pad2(convertDecimalToHex(a)),
1711
+ pad2(mathRound(r).toString(16)),
1712
+ pad2(mathRound(g).toString(16)),
1713
+ pad2(mathRound(b).toString(16))
1714
+ ];
1715
+
1716
+ return hex.join("");
1717
+ }
1718
+
1719
+ // `equals`
1720
+ // Can be called with any tinycolor input
1721
+ tinycolor.equals = function (color1, color2) {
1722
+ if (!color1 || !color2) { return false; }
1723
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
1724
+ };
1725
+ tinycolor.random = function() {
1726
+ return tinycolor.fromRatio({
1727
+ r: mathRandom(),
1728
+ g: mathRandom(),
1729
+ b: mathRandom()
1730
+ });
1731
+ };
1732
+
1733
+
1734
+ // Modification Functions
1735
+ // ----------------------
1736
+ // Thanks to less.js for some of the basics here
1737
+ // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
1738
+
1739
+ function desaturate(color, amount) {
1740
+ amount = (amount === 0) ? 0 : (amount || 10);
1741
+ var hsl = tinycolor(color).toHsl();
1742
+ hsl.s -= amount / 100;
1743
+ hsl.s = clamp01(hsl.s);
1744
+ return tinycolor(hsl);
1745
+ }
1746
+
1747
+ function saturate(color, amount) {
1748
+ amount = (amount === 0) ? 0 : (amount || 10);
1749
+ var hsl = tinycolor(color).toHsl();
1750
+ hsl.s += amount / 100;
1751
+ hsl.s = clamp01(hsl.s);
1752
+ return tinycolor(hsl);
1753
+ }
1754
+
1755
+ function greyscale(color) {
1756
+ return tinycolor(color).desaturate(100);
1757
+ }
1758
+
1759
+ function lighten (color, amount) {
1760
+ amount = (amount === 0) ? 0 : (amount || 10);
1761
+ var hsl = tinycolor(color).toHsl();
1762
+ hsl.l += amount / 100;
1763
+ hsl.l = clamp01(hsl.l);
1764
+ return tinycolor(hsl);
1765
+ }
1766
+
1767
+ function brighten(color, amount) {
1768
+ amount = (amount === 0) ? 0 : (amount || 10);
1769
+ var rgb = tinycolor(color).toRgb();
1770
+ rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
1771
+ rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
1772
+ rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
1773
+ return tinycolor(rgb);
1774
+ }
1775
+
1776
+ function darken (color, amount) {
1777
+ amount = (amount === 0) ? 0 : (amount || 10);
1778
+ var hsl = tinycolor(color).toHsl();
1779
+ hsl.l -= amount / 100;
1780
+ hsl.l = clamp01(hsl.l);
1781
+ return tinycolor(hsl);
1782
+ }
1783
+
1784
+ // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
1785
+ // Values outside of this range will be wrapped into this range.
1786
+ function spin(color, amount) {
1787
+ var hsl = tinycolor(color).toHsl();
1788
+ var hue = (mathRound(hsl.h) + amount) % 360;
1789
+ hsl.h = hue < 0 ? 360 + hue : hue;
1790
+ return tinycolor(hsl);
1791
+ }
1792
+
1793
+ // Combination Functions
1794
+ // ---------------------
1795
+ // Thanks to jQuery xColor for some of the ideas behind these
1796
+ // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
1797
+
1798
+ function complement(color) {
1799
+ var hsl = tinycolor(color).toHsl();
1800
+ hsl.h = (hsl.h + 180) % 360;
1801
+ return tinycolor(hsl);
1802
+ }
1803
+
1804
+ function triad(color) {
1805
+ var hsl = tinycolor(color).toHsl();
1806
+ var h = hsl.h;
1807
+ return [
1808
+ tinycolor(color),
1809
+ tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
1810
+ tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
1811
+ ];
1812
+ }
1813
+
1814
+ function tetrad(color) {
1815
+ var hsl = tinycolor(color).toHsl();
1816
+ var h = hsl.h;
1817
+ return [
1818
+ tinycolor(color),
1819
+ tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
1820
+ tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
1821
+ tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
1822
+ ];
1823
+ }
1824
+
1825
+ function splitcomplement(color) {
1826
+ var hsl = tinycolor(color).toHsl();
1827
+ var h = hsl.h;
1828
+ return [
1829
+ tinycolor(color),
1830
+ tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
1831
+ tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
1832
+ ];
1833
+ }
1834
+
1835
+ function analogous(color, results, slices) {
1836
+ results = results || 6;
1837
+ slices = slices || 30;
1838
+
1839
+ var hsl = tinycolor(color).toHsl();
1840
+ var part = 360 / slices;
1841
+ var ret = [tinycolor(color)];
1842
+
1843
+ for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
1844
+ hsl.h = (hsl.h + part) % 360;
1845
+ ret.push(tinycolor(hsl));
1846
+ }
1847
+ return ret;
1848
+ }
1849
+
1850
+ function monochromatic(color, results) {
1851
+ results = results || 6;
1852
+ var hsv = tinycolor(color).toHsv();
1853
+ var h = hsv.h, s = hsv.s, v = hsv.v;
1854
+ var ret = [];
1855
+ var modification = 1 / results;
1856
+
1857
+ while (results--) {
1858
+ ret.push(tinycolor({ h: h, s: s, v: v}));
1859
+ v = (v + modification) % 1;
1860
+ }
1861
+
1862
+ return ret;
1863
+ }
1864
+
1865
+ // Utility Functions
1866
+ // ---------------------
1867
+
1868
+ tinycolor.mix = function(color1, color2, amount) {
1869
+ amount = (amount === 0) ? 0 : (amount || 50);
1870
+
1871
+ var rgb1 = tinycolor(color1).toRgb();
1872
+ var rgb2 = tinycolor(color2).toRgb();
1873
+
1874
+ var p = amount / 100;
1875
+ var w = p * 2 - 1;
1876
+ var a = rgb2.a - rgb1.a;
1877
+
1878
+ var w1;
1879
+
1880
+ if (w * a == -1) {
1881
+ w1 = w;
1882
+ } else {
1883
+ w1 = (w + a) / (1 + w * a);
1884
+ }
1885
+
1886
+ w1 = (w1 + 1) / 2;
1887
+
1888
+ var w2 = 1 - w1;
1889
+
1890
+ var rgba = {
1891
+ r: rgb2.r * w1 + rgb1.r * w2,
1892
+ g: rgb2.g * w1 + rgb1.g * w2,
1893
+ b: rgb2.b * w1 + rgb1.b * w2,
1894
+ a: rgb2.a * p + rgb1.a * (1 - p)
1895
+ };
1896
+
1897
+ return tinycolor(rgba);
1898
+ };
1899
+
1900
+
1901
+ // Readability Functions
1902
+ // ---------------------
1903
+ // <http://www.w3.org/TR/AERT#color-contrast>
1904
+
1905
+ // `readability`
1906
+ // Analyze the 2 colors and returns an object with the following properties:
1907
+ // `brightness`: difference in brightness between the two colors
1908
+ // `color`: difference in color/hue between the two colors
1909
+ tinycolor.readability = function(color1, color2) {
1910
+ var c1 = tinycolor(color1);
1911
+ var c2 = tinycolor(color2);
1912
+ var rgb1 = c1.toRgb();
1913
+ var rgb2 = c2.toRgb();
1914
+ var brightnessA = c1.getBrightness();
1915
+ var brightnessB = c2.getBrightness();
1916
+ var colorDiff = (
1917
+ Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) +
1918
+ Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) +
1919
+ Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b)
1920
+ );
1921
+
1922
+ return {
1923
+ brightness: Math.abs(brightnessA - brightnessB),
1924
+ color: colorDiff
1925
+ };
1926
+ };
1927
+
1928
+ // `readable`
1929
+ // http://www.w3.org/TR/AERT#color-contrast
1930
+ // Ensure that foreground and background color combinations provide sufficient contrast.
1931
+ // *Example*
1932
+ // tinycolor.isReadable("#000", "#111") => false
1933
+ tinycolor.isReadable = function(color1, color2) {
1934
+ var readability = tinycolor.readability(color1, color2);
1935
+ return readability.brightness > 125 && readability.color > 500;
1936
+ };
1937
+
1938
+ // `mostReadable`
1939
+ // Given a base color and a list of possible foreground or background
1940
+ // colors for that base, returns the most readable color.
1941
+ // *Example*
1942
+ // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
1943
+ tinycolor.mostReadable = function(baseColor, colorList) {
1944
+ var bestColor = null;
1945
+ var bestScore = 0;
1946
+ var bestIsReadable = false;
1947
+ for (var i=0; i < colorList.length; i++) {
1948
+
1949
+ // We normalize both around the "acceptable" breaking point,
1950
+ // but rank brightness constrast higher than hue.
1951
+
1952
+ var readability = tinycolor.readability(baseColor, colorList[i]);
1953
+ var readable = readability.brightness > 125 && readability.color > 500;
1954
+ var score = 3 * (readability.brightness / 125) + (readability.color / 500);
1955
+
1956
+ if ((readable && ! bestIsReadable) ||
1957
+ (readable && bestIsReadable && score > bestScore) ||
1958
+ ((! readable) && (! bestIsReadable) && score > bestScore)) {
1959
+ bestIsReadable = readable;
1960
+ bestScore = score;
1961
+ bestColor = tinycolor(colorList[i]);
1962
+ }
1963
+ }
1964
+ return bestColor;
1965
+ };
1966
+
1967
+
1968
+ // Big List of Colors
1969
+ // ------------------
1970
+ // <http://www.w3.org/TR/css3-color/#svg-color>
1971
+ var names = tinycolor.names = {
1972
+ aliceblue: "f0f8ff",
1973
+ antiquewhite: "faebd7",
1974
+ aqua: "0ff",
1975
+ aquamarine: "7fffd4",
1976
+ azure: "f0ffff",
1977
+ beige: "f5f5dc",
1978
+ bisque: "ffe4c4",
1979
+ black: "000",
1980
+ blanchedalmond: "ffebcd",
1981
+ blue: "00f",
1982
+ blueviolet: "8a2be2",
1983
+ brown: "a52a2a",
1984
+ burlywood: "deb887",
1985
+ burntsienna: "ea7e5d",
1986
+ cadetblue: "5f9ea0",
1987
+ chartreuse: "7fff00",
1988
+ chocolate: "d2691e",
1989
+ coral: "ff7f50",
1990
+ cornflowerblue: "6495ed",
1991
+ cornsilk: "fff8dc",
1992
+ crimson: "dc143c",
1993
+ cyan: "0ff",
1994
+ darkblue: "00008b",
1995
+ darkcyan: "008b8b",
1996
+ darkgoldenrod: "b8860b",
1997
+ darkgray: "a9a9a9",
1998
+ darkgreen: "006400",
1999
+ darkgrey: "a9a9a9",
2000
+ darkkhaki: "bdb76b",
2001
+ darkmagenta: "8b008b",
2002
+ darkolivegreen: "556b2f",
2003
+ darkorange: "ff8c00",
2004
+ darkorchid: "9932cc",
2005
+ darkred: "8b0000",
2006
+ darksalmon: "e9967a",
2007
+ darkseagreen: "8fbc8f",
2008
+ darkslateblue: "483d8b",
2009
+ darkslategray: "2f4f4f",
2010
+ darkslategrey: "2f4f4f",
2011
+ darkturquoise: "00ced1",
2012
+ darkviolet: "9400d3",
2013
+ deeppink: "ff1493",
2014
+ deepskyblue: "00bfff",
2015
+ dimgray: "696969",
2016
+ dimgrey: "696969",
2017
+ dodgerblue: "1e90ff",
2018
+ firebrick: "b22222",
2019
+ floralwhite: "fffaf0",
2020
+ forestgreen: "228b22",
2021
+ fuchsia: "f0f",
2022
+ gainsboro: "dcdcdc",
2023
+ ghostwhite: "f8f8ff",
2024
+ gold: "ffd700",
2025
+ goldenrod: "daa520",
2026
+ gray: "808080",
2027
+ green: "008000",
2028
+ greenyellow: "adff2f",
2029
+ grey: "808080",
2030
+ honeydew: "f0fff0",
2031
+ hotpink: "ff69b4",
2032
+ indianred: "cd5c5c",
2033
+ indigo: "4b0082",
2034
+ ivory: "fffff0",
2035
+ khaki: "f0e68c",
2036
+ lavender: "e6e6fa",
2037
+ lavenderblush: "fff0f5",
2038
+ lawngreen: "7cfc00",
2039
+ lemonchiffon: "fffacd",
2040
+ lightblue: "add8e6",
2041
+ lightcoral: "f08080",
2042
+ lightcyan: "e0ffff",
2043
+ lightgoldenrodyellow: "fafad2",
2044
+ lightgray: "d3d3d3",
2045
+ lightgreen: "90ee90",
2046
+ lightgrey: "d3d3d3",
2047
+ lightpink: "ffb6c1",
2048
+ lightsalmon: "ffa07a",
2049
+ lightseagreen: "20b2aa",
2050
+ lightskyblue: "87cefa",
2051
+ lightslategray: "789",
2052
+ lightslategrey: "789",
2053
+ lightsteelblue: "b0c4de",
2054
+ lightyellow: "ffffe0",
2055
+ lime: "0f0",
2056
+ limegreen: "32cd32",
2057
+ linen: "faf0e6",
2058
+ magenta: "f0f",
2059
+ maroon: "800000",
2060
+ mediumaquamarine: "66cdaa",
2061
+ mediumblue: "0000cd",
2062
+ mediumorchid: "ba55d3",
2063
+ mediumpurple: "9370db",
2064
+ mediumseagreen: "3cb371",
2065
+ mediumslateblue: "7b68ee",
2066
+ mediumspringgreen: "00fa9a",
2067
+ mediumturquoise: "48d1cc",
2068
+ mediumvioletred: "c71585",
2069
+ midnightblue: "191970",
2070
+ mintcream: "f5fffa",
2071
+ mistyrose: "ffe4e1",
2072
+ moccasin: "ffe4b5",
2073
+ navajowhite: "ffdead",
2074
+ navy: "000080",
2075
+ oldlace: "fdf5e6",
2076
+ olive: "808000",
2077
+ olivedrab: "6b8e23",
2078
+ orange: "ffa500",
2079
+ orangered: "ff4500",
2080
+ orchid: "da70d6",
2081
+ palegoldenrod: "eee8aa",
2082
+ palegreen: "98fb98",
2083
+ paleturquoise: "afeeee",
2084
+ palevioletred: "db7093",
2085
+ papayawhip: "ffefd5",
2086
+ peachpuff: "ffdab9",
2087
+ peru: "cd853f",
2088
+ pink: "ffc0cb",
2089
+ plum: "dda0dd",
2090
+ powderblue: "b0e0e6",
2091
+ purple: "800080",
2092
+ rebeccapurple: "663399",
2093
+ red: "f00",
2094
+ rosybrown: "bc8f8f",
2095
+ royalblue: "4169e1",
2096
+ saddlebrown: "8b4513",
2097
+ salmon: "fa8072",
2098
+ sandybrown: "f4a460",
2099
+ seagreen: "2e8b57",
2100
+ seashell: "fff5ee",
2101
+ sienna: "a0522d",
2102
+ silver: "c0c0c0",
2103
+ skyblue: "87ceeb",
2104
+ slateblue: "6a5acd",
2105
+ slategray: "708090",
2106
+ slategrey: "708090",
2107
+ snow: "fffafa",
2108
+ springgreen: "00ff7f",
2109
+ steelblue: "4682b4",
2110
+ tan: "d2b48c",
2111
+ teal: "008080",
2112
+ thistle: "d8bfd8",
2113
+ tomato: "ff6347",
2114
+ turquoise: "40e0d0",
2115
+ violet: "ee82ee",
2116
+ wheat: "f5deb3",
2117
+ white: "fff",
2118
+ whitesmoke: "f5f5f5",
2119
+ yellow: "ff0",
2120
+ yellowgreen: "9acd32"
2121
+ };
2122
+
2123
+ // Make it easy to access colors via `hexNames[hex]`
2124
+ var hexNames = tinycolor.hexNames = flip(names);
2125
+
2126
+
2127
+ // Utilities
2128
+ // ---------
2129
+
2130
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
2131
+ function flip(o) {
2132
+ var flipped = { };
2133
+ for (var i in o) {
2134
+ if (o.hasOwnProperty(i)) {
2135
+ flipped[o[i]] = i;
2136
+ }
2137
+ }
2138
+ return flipped;
2139
+ }
2140
+
2141
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
2142
+ function boundAlpha(a) {
2143
+ a = parseFloat(a);
2144
+
2145
+ if (isNaN(a) || a < 0 || a > 1) {
2146
+ a = 1;
2147
+ }
2148
+
2149
+ return a;
2150
+ }
2151
+
2152
+ // Take input from [0, n] and return it as [0, 1]
2153
+ function bound01(n, max) {
2154
+ if (isOnePointZero(n)) { n = "100%"; }
2155
+
2156
+ var processPercent = isPercentage(n);
2157
+ n = mathMin(max, mathMax(0, parseFloat(n)));
2158
+
2159
+ // Automatically convert percentage into number
2160
+ if (processPercent) {
2161
+ n = parseInt(n * max, 10) / 100;
2162
+ }
2163
+
2164
+ // Handle floating point rounding errors
2165
+ if ((math.abs(n - max) < 0.000001)) {
2166
+ return 1;
2167
+ }
2168
+
2169
+ // Convert into [0, 1] range if it isn't already
2170
+ return (n % max) / parseFloat(max);
2171
+ }
2172
+
2173
+ // Force a number between 0 and 1
2174
+ function clamp01(val) {
2175
+ return mathMin(1, mathMax(0, val));
2176
+ }
2177
+
2178
+ // Parse a base-16 hex value into a base-10 integer
2179
+ function parseIntFromHex(val) {
2180
+ return parseInt(val, 16);
2181
+ }
2182
+
2183
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
2184
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
2185
+ function isOnePointZero(n) {
2186
+ return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
2187
+ }
2188
+
2189
+ // Check to see if string passed in is a percentage
2190
+ function isPercentage(n) {
2191
+ return typeof n === "string" && n.indexOf('%') != -1;
2192
+ }
2193
+
2194
+ // Force a hex value to have 2 characters
2195
+ function pad2(c) {
2196
+ return c.length == 1 ? '0' + c : '' + c;
2197
+ }
2198
+
2199
+ // Replace a decimal with it's percentage value
2200
+ function convertToPercentage(n) {
2201
+ if (n <= 1) {
2202
+ n = (n * 100) + "%";
2203
+ }
2204
+
2205
+ return n;
2206
+ }
2207
+
2208
+ // Converts a decimal to a hex value
2209
+ function convertDecimalToHex(d) {
2210
+ return Math.round(parseFloat(d) * 255).toString(16);
2211
+ }
2212
+ // Converts a hex value to a decimal
2213
+ function convertHexToDecimal(h) {
2214
+ return (parseIntFromHex(h) / 255);
2215
+ }
2216
+
2217
+ var matchers = (function() {
2218
+
2219
+ // <http://www.w3.org/TR/css3-values/#integers>
2220
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
2221
+
2222
+ // <http://www.w3.org/TR/css3-values/#number-value>
2223
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
2224
+
2225
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
2226
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
2227
+
2228
+ // Actual matching.
2229
+ // Parentheses and commas are optional, but not required.
2230
+ // Whitespace can take the place of commas or opening paren
2231
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2232
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2233
+
2234
+ return {
2235
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
2236
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
2237
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
2238
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
2239
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
2240
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
2241
+ hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2242
+ hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
2243
+ hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
2244
+ };
2245
+ })();
2246
+
2247
+ // `stringInputToObject`
2248
+ // Permissive string parsing. Take in a number of formats, and output an object
2249
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
2250
+ function stringInputToObject(color) {
2251
+
2252
+ color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
2253
+ var named = false;
2254
+ if (names[color]) {
2255
+ color = names[color];
2256
+ named = true;
2257
+ }
2258
+ else if (color == 'transparent') {
2259
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
2260
+ }
2261
+
2262
+ // Try to match string input using regular expressions.
2263
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
2264
+ // Just return an object and let the conversion functions handle that.
2265
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
2266
+ var match;
2267
+ if ((match = matchers.rgb.exec(color))) {
2268
+ return { r: match[1], g: match[2], b: match[3] };
2269
+ }
2270
+ if ((match = matchers.rgba.exec(color))) {
2271
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
2272
+ }
2273
+ if ((match = matchers.hsl.exec(color))) {
2274
+ return { h: match[1], s: match[2], l: match[3] };
2275
+ }
2276
+ if ((match = matchers.hsla.exec(color))) {
2277
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
2278
+ }
2279
+ if ((match = matchers.hsv.exec(color))) {
2280
+ return { h: match[1], s: match[2], v: match[3] };
2281
+ }
2282
+ if ((match = matchers.hsva.exec(color))) {
2283
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
2284
+ }
2285
+ if ((match = matchers.hex8.exec(color))) {
2286
+ return {
2287
+ a: convertHexToDecimal(match[1]),
2288
+ r: parseIntFromHex(match[2]),
2289
+ g: parseIntFromHex(match[3]),
2290
+ b: parseIntFromHex(match[4]),
2291
+ format: named ? "name" : "hex8"
2292
+ };
2293
+ }
2294
+ if ((match = matchers.hex6.exec(color))) {
2295
+ return {
2296
+ r: parseIntFromHex(match[1]),
2297
+ g: parseIntFromHex(match[2]),
2298
+ b: parseIntFromHex(match[3]),
2299
+ format: named ? "name" : "hex"
2300
+ };
2301
+ }
2302
+ if ((match = matchers.hex3.exec(color))) {
2303
+ return {
2304
+ r: parseIntFromHex(match[1] + '' + match[1]),
2305
+ g: parseIntFromHex(match[2] + '' + match[2]),
2306
+ b: parseIntFromHex(match[3] + '' + match[3]),
2307
+ format: named ? "name" : "hex"
2308
+ };
2309
+ }
2310
+
2311
+ return false;
2312
+ }
2313
+
2314
+ window.tinycolor = tinycolor;
2315
+ })();
2316
+
2317
+ $(function () {
2318
+ if ($.fn.spectrum.load) {
2319
+ $.fn.spectrum.processNativeColorInputs();
2320
+ }
2321
+ });
2322
+
2323
+ });
assets/spectrum/spectrum.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .sp-container{position:absolute;top:0;left:0;display:inline-block;*display:inline;*zoom:1;z-index:9999994;overflow:hidden}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.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-clear-enabled .sp-hue{top:33px;height:77.5%}.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}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:0px;right:0;bottom:0;left:84%;height:28px}.sp-container,.sp-replacer,.sp-preview,.sp-dragger,.sp-slider,.sp-alpha,.sp-clear,.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-container.sp-palette-buttons-disabled .sp-palette-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}.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(#000), to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom, #000, 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, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-ms-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-o-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:-webkit-gradient(linear, left top, left bottom, from(red), color-stop(0.17, #ff0), color-stop(0.33, lime), color-stop(0.5, cyan), color-stop(0.67, blue), color-stop(0.83, #f0f), to(red));background:-webkit-linear-gradient(top, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%);background:linear-gradient(to bottom, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 67%, #f0f 83%, red 100%)}.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}.sp-cf:before,.sp-cf:after{content:"";display:table}.sp-cf:after{clear:both}.sp-cf{*zoom:1}@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}.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,.sp-clear{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,.sp-clear{border:solid 1px #666}.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}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.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}.sp-initial{float:left;border:solid 1px #333}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .sp-clear-display{background-position:center}.sp-palette-button-container,.sp-button-container{float:right}.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}.sp-container button{background-color:#eeeeee;background-image:-webkit-linear-gradient(top, #eee, #ccc);background-image:-moz-linear-gradient(top, #eee, #ccc);background-image:-ms-linear-gradient(top, #eee, #ccc);background-image:-o-linear-gradient(top, #eee, #ccc);background-image:linear-gradient(to bottom, #eee, #ccc);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, #ddd, #bbb);background-image:-moz-linear-gradient(top, #ddd, #bbb);background-image:-ms-linear-gradient(top, #ddd, #bbb);background-image:-o-linear-gradient(top, #ddd, #bbb);background-image:linear-gradient(to bottom, #ddd, #bbb);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=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==)}
assets/spectrum/spectrum.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):t(jQuery)}(function($,t){"use strict";function e(t,e,r,n){for(var a=[],i=0;i<t.length;i++){var o=t[i];if(o){var s=tinycolor(o),l=s.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";l+=tinycolor.equals(e,o)?" sp-thumb-active":"";var c=s.toString(n.preferredFormat||"rgb"),f=g?"background-color:"+s.toRgbString():"filter:"+s.toFilter();a.push('<span title="'+c+'" data-color="'+s.toRgbString()+'" class="'+l+'"><span class="sp-thumb-inner" style="'+f+';" /></span>')}else{a.push($("<div />").append($('<span data-color="" style="background-color:transparent;" class="'+"sp-clear-display"+'"></span>').attr("title",n.noColorSelectedText)).html())}}return"<div class='sp-cf "+r+"'>"+a.join("")+"</div>"}function r(){for(var t=0;t<d.length;t++)d[t]&&d[t].hide()}function n(t,e){var r=$.extend({},h,t);return r.callbacks={move:l(r.move,e),change:l(r.change,e),show:l(r.show,e),hide:l(r.hide,e),beforeShow:l(r.beforeShow,e)},r}function a(a,o){function l(){if(W.showPaletteOnly&&(W.showPalette=!0),It.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),W.palette){dt=W.palette.slice(0),pt=$.isArray(dt[0])?dt:[dt],gt={};for(var t=0;t<pt.length;t++)for(var e=0;e<pt[t].length;e++){var r=tinycolor(pt[t][e]).toRgbString();gt[r]=!0}}St.toggleClass("sp-flat",X),St.toggleClass("sp-input-disabled",!W.showInput),St.toggleClass("sp-alpha-enabled",W.showAlpha),St.toggleClass("sp-clear-enabled",Jt),St.toggleClass("sp-buttons-disabled",!W.showButtons),St.toggleClass("sp-palette-buttons-disabled",!W.togglePaletteOnly),St.toggleClass("sp-palette-disabled",!W.showPalette),St.toggleClass("sp-palette-only",W.showPaletteOnly),St.toggleClass("sp-initial-disabled",!W.showInitial),St.addClass(W.className).addClass(W.containerClassName),I()}function h(){function t(t){return t.data&&t.data.ignore?(T($(t.target).closest(".sp-thumb-el").data("color")),N()):(T($(t.target).closest(".sp-thumb-el").data("color")),N(),D(!0),W.hideAfterPaletteSelect&&H()),!1}if(p&&St.find("*:not(input)").attr("unselectable","on"),l(),Lt&&xt.after(Kt).hide(),Jt||Et.hide(),X)xt.after(St).hide();else{var e="parent"===W.appendTo?xt.parent():$(W.appendTo);1!==e.length&&(e=$("body")),e.append(St)}m(),Vt.bind("click.spectrum touchstart.spectrum",function(t){kt||P(),t.stopPropagation(),$(t.target).is("input")||t.preventDefault()}),(xt.is(":disabled")||!0===W.disabled)&&K(),St.click(s),Ot.change(C),Ot.bind("paste",function(){setTimeout(C,1)}),Ot.keydown(function(t){13==t.keyCode&&C()}),jt.text(W.cancelText),jt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),F(),H()}),Et.attr("title",W.clearText),Et.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Qt=!0,N(),X&&D(!0)}),Dt.text(W.chooseText),Dt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),p&&Ot.is(":focus")&&Ot.trigger("change"),q()&&(D(!0),H())}),It.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),It.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),W.showPaletteOnly=!W.showPaletteOnly,W.showPaletteOnly||X||St.css("left","-="+(Ct.outerWidth(!0)+5)),l()}),c(Ft,function(t,e,r){ht=t/ot,Qt=!1,r.shiftKey&&(ht=Math.round(10*ht)/10),N()},k,S),c(Mt,function(t,e){ct=parseFloat(e/at),Qt=!1,W.showAlpha||(ht=1),N()},k,S),c(Pt,function(t,e,r){if(r.shiftKey){if(!yt){var n=ft*et,a=rt-ut*rt,i=Math.abs(t-n)>Math.abs(e-a);yt=i?"x":"y"}}else yt=null;var o=!yt||"x"===yt,s=!yt||"y"===yt;o&&(ft=parseFloat(t/et)),s&&(ut=parseFloat((rt-e)/rt)),Qt=!1,W.showAlpha||(ht=1),N()},k,S),Wt?(T(Wt),j(),Yt=W.preferredFormat||tinycolor(Wt).format,y(Wt)):j(),X&&A();var r=p?"mousedown.spectrum":"click.spectrum touchstart.spectrum";qt.delegate(".sp-thumb-el",r,t),Nt.delegate(".sp-thumb-el:nth-child(1)",r,{ignore:!0},t)}function m(){if(G&&window.localStorage){try{var t=window.localStorage[G].split(",#");t.length>1&&(delete window.localStorage[G],$.each(t,function(t,e){y(e)}))}catch(t){}try{bt=window.localStorage[G].split(";")}catch(t){}}}function y(t){if(Y){var e=tinycolor(t).toRgbString();if(!gt[e]&&-1===$.inArray(e,bt))for(bt.push(e);bt.length>vt;)bt.shift();if(G&&window.localStorage)try{window.localStorage[G]=bt.join(";")}catch(t){}}}function w(){var t=[];if(W.showPalette)for(var e=0;e<bt.length;e++){var r=tinycolor(bt[e]).toRgbString();gt[r]||t.push(bt[e])}return t.reverse().slice(0,W.maxSelectionSize)}function _(){var t=O(),r=$.map(pt,function(r,n){return e(r,t,"sp-palette-row sp-palette-row-"+n,W)});m(),bt&&r.push(e(w(),t,"sp-palette-row sp-palette-row-selection",W)),qt.html(r.join(""))}function x(){if(W.showInitial){var t=Xt,r=O();Nt.html(e([t,r],r,"sp-palette-row-initial",W))}}function k(){(rt<=0||et<=0||at<=0)&&I(),tt=!0,St.addClass(mt),yt=null,xt.trigger("dragstart.spectrum",[O()])}function S(){tt=!1,St.removeClass(mt),xt.trigger("dragstop.spectrum",[O()])}function C(){var t=Ot.val();if(null!==t&&""!==t||!Jt){var e=tinycolor(t);e.isValid()?(T(e),D(!0)):Ot.addClass("sp-validation-error")}else T(null),D(!0)}function P(){Z?H():A()}function A(){var t=$.Event("beforeShow.spectrum");if(Z)return void I();xt.trigger(t,[O()]),!1===J.beforeShow(O())||t.isDefaultPrevented()||(r(),Z=!0,$(wt).bind("keydown.spectrum",M),$(wt).bind("click.spectrum",R),$(window).bind("resize.spectrum",U),Kt.addClass("sp-active"),St.removeClass("sp-hidden"),I(),j(),Xt=O(),x(),J.show(Xt),xt.trigger("show.spectrum",[Xt]))}function M(t){27===t.keyCode&&H()}function R(t){2!=t.button&&(tt||(Gt?D(!0):F(),H()))}function H(){Z&&!X&&(Z=!1,$(wt).unbind("keydown.spectrum",M),$(wt).unbind("click.spectrum",R),$(window).unbind("resize.spectrum",U),Kt.removeClass("sp-active"),St.addClass("sp-hidden"),J.hide(O()),xt.trigger("hide.spectrum",[O()]))}function F(){T(Xt,!0)}function T(t,e){if(tinycolor.equals(t,O()))return void j();var r,n;!t&&Jt?Qt=!0:(Qt=!1,r=tinycolor(t),n=r.toHsv(),ct=n.h%360/360,ft=n.s,ut=n.v,ht=n.a),j(),r&&r.isValid()&&!e&&(Yt=W.preferredFormat||r.getFormat())}function O(t){return t=t||{},Jt&&Qt?null:tinycolor.fromRatio({h:ct,s:ft,v:ut,a:Math.round(100*ht)/100},{format:t.format||Yt})}function q(){return!Ot.hasClass("sp-validation-error")}function N(){j(),J.move(O()),xt.trigger("move.spectrum",[O()])}function j(){Ot.removeClass("sp-validation-error"),E();var t=tinycolor.fromRatio({h:ct,s:1,v:1});Pt.css("background-color",t.toHexString());var e=Yt;ht<1&&(0!==ht||"name"!==e)&&("hex"!==e&&"hex3"!==e&&"hex6"!==e&&"name"!==e||(e="rgb"));var r=O({format:e}),n="";if($t.removeClass("sp-clear-display"),$t.css("background-color","transparent"),!r&&Jt)$t.addClass("sp-clear-display");else{var a=r.toHexString(),i=r.toRgbString();if(g||1===r.alpha?$t.css("background-color",i):($t.css("background-color","transparent"),$t.css("filter",r.toFilter())),W.showAlpha){var o=r.toRgb();o.a=0;var s=tinycolor(o).toRgbString(),l="linear-gradient(left, "+s+", "+a+")";p?Ht.css("filter",tinycolor(s).toFilter({gradientType:1},a)):(Ht.css("background","-webkit-"+l),Ht.css("background","-moz-"+l),Ht.css("background","-ms-"+l),Ht.css("background","linear-gradient(to right, "+s+", "+a+")"))}n=r.toString(e)}W.showInput&&Ot.val(n),W.showPalette&&_(),x()}function E(){var t=ft,e=ut;if(Jt&&Qt)Tt.hide(),Rt.hide(),At.hide();else{Tt.show(),Rt.show(),At.show();var r=t*et,n=rt-e*rt;r=Math.max(-nt,Math.min(et-nt,r-nt)),n=Math.max(-nt,Math.min(rt-nt,n-nt)),At.css({top:n+"px",left:r+"px"});var a=ht*ot;Tt.css({left:a-st/2+"px"});var i=ct*at;Rt.css({top:i-lt+"px"})}}function D(t){var e=O(),r="",n=!tinycolor.equals(e,Xt);e&&(r=e.toString(Yt),y(e)),zt&&xt.val(r),t&&n&&(J.change(e),xt.trigger("change",[e]))}function I(){Z&&(et=Pt.width(),rt=Pt.height(),nt=At.height(),it=Mt.width(),at=Mt.height(),lt=Rt.height(),ot=Ft.width(),st=Tt.width(),X||(St.css("position","absolute"),W.offset?St.offset(W.offset):St.offset(i(St,Vt))),E(),W.showPalette&&_(),xt.trigger("reflow.spectrum"))}function z(){xt.show(),Vt.unbind("click.spectrum touchstart.spectrum"),St.remove(),Kt.remove(),d[Ut.id]=null}function B(e,r){return e===t?$.extend({},W):r===t?W[e]:(W[e]=r,"preferredFormat"===e&&(Yt=W.preferredFormat),void l())}function L(){kt=!1,xt.attr("disabled",!1),Vt.removeClass("sp-disabled")}function K(){H(),kt=!0,xt.attr("disabled",!0),Vt.addClass("sp-disabled")}function V(t){W.offset=t,I()}var W=n(o,a),X=W.flat,Y=W.showSelectionPalette,G=W.localStorageKey,Q=W.theme,J=W.callbacks,U=f(I,10),Z=!1,tt=!1,et=0,rt=0,nt=0,at=0,it=0,ot=0,st=0,lt=0,ct=0,ft=0,ut=0,ht=1,dt=[],pt=[],gt={},bt=W.selectionPalette.slice(0),vt=W.maxSelectionSize,mt="sp-dragging",yt=null,wt=a.ownerDocument,_t=wt.body,xt=$(a),kt=!1,St=$(v,wt).addClass(Q),Ct=St.find(".sp-picker-container"),Pt=St.find(".sp-color"),At=St.find(".sp-dragger"),Mt=St.find(".sp-hue"),Rt=St.find(".sp-slider"),Ht=St.find(".sp-alpha-inner"),Ft=St.find(".sp-alpha"),Tt=St.find(".sp-alpha-handle"),Ot=St.find(".sp-input"),qt=St.find(".sp-palette"),Nt=St.find(".sp-initial"),jt=St.find(".sp-cancel"),Et=St.find(".sp-clear"),Dt=St.find(".sp-choose"),It=St.find(".sp-palette-toggle"),zt=xt.is("input"),Bt=zt&&"color"===xt.attr("type")&&u(),Lt=zt&&!X,Kt=Lt?$(b).addClass(Q).addClass(W.className).addClass(W.replacerClassName):$([]),Vt=Lt?Kt:xt,$t=Kt.find(".sp-preview-inner"),Wt=W.color||zt&&xt.val(),Xt=!1,Yt=W.preferredFormat,Gt=!W.showButtons||W.clickoutFiresChange,Qt=!Wt,Jt=W.allowEmpty&&!Bt;h();var Ut={show:A,hide:H,toggle:P,reflow:I,option:B,enable:L,disable:K,offset:V,set:function(t){T(t),D()},get:O,destroy:z,container:St};return Ut.id=d.push(Ut)-1,Ut}function i(t,e){var r=0,n=t.outerWidth(),a=t.outerHeight(),i=e.outerHeight(),o=t[0].ownerDocument,s=o.documentElement,l=s.clientWidth+$(o).scrollLeft(),c=s.clientHeight+$(o).scrollTop(),f=e.offset();return f.top+=i,f.left-=Math.min(f.left,f.left+n>l&&l>n?Math.abs(f.left+n-l):0),f.top-=Math.min(f.top,f.top+a>c&&c>a?Math.abs(a+i-0):0),f}function o(){}function s(t){t.stopPropagation()}function l(t,e){var r=Array.prototype.slice,n=r.call(arguments,2);return function(){return t.apply(e,n.concat(r.call(arguments)))}}function c(t,e,r,n){function a(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function i(r){if(c){if(p&&l.documentMode<9&&!r.button)return s();var n=r.originalEvent&&r.originalEvent.touches&&r.originalEvent.touches[0],i=n&&n.pageX||r.pageX,o=n&&n.pageY||r.pageY,g=Math.max(0,Math.min(i-f.left,h)),b=Math.max(0,Math.min(o-f.top,u));d&&a(r),e.apply(t,[g,b,r])}}function o(e){(e.which?3==e.which:2==e.button)||c||!1!==r.apply(t,arguments)&&(c=!0,u=$(t).height(),h=$(t).width(),f=$(t).offset(),$(l).bind(g),$(l.body).addClass("sp-dragging"),i(e),a(e))}function s(){c&&($(l).unbind(g),$(l.body).removeClass("sp-dragging"),setTimeout(function(){n.apply(t,arguments)},0)),c=!1}e=e||function(){},r=r||function(){},n=n||function(){};var l=document,c=!1,f={},u=0,h=0,d="ontouchstart"in window,g={};g.selectstart=a,g.dragstart=a,g["touchmove mousemove"]=i,g["touchend mouseup"]=s,$(t).bind("touchstart mousedown",o)}function f(t,e,r){var n;return function(){var a=this,i=arguments,o=function(){n=null,t.apply(a,i)};r&&clearTimeout(n),!r&&n||(n=setTimeout(o,e))}}function u(){return $.fn.spectrum.inputTypeColorSupport()}var h={beforeShow:o,move:o,change:o,show:o,hide:o,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},d=[],p=!!/msie/i.exec(window.navigator.userAgent),g=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div"),r=e.style;return r.cssText="background-color:rgba(0,0,0,.5)",t(r.backgroundColor,"rgba")||t(r.backgroundColor,"hsla")}(),b=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),v=function(){var t="";if(p)for(var e=1;e<=6;e++)t+="<div class='sp-"+e+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",t,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}(),m="spectrum.id";$.fn.spectrum=function(t,e){if("string"==typeof t){var r=this,n=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=d[$(this).data(m)];if(e){var a=e[t];if(!a)throw new Error("Spectrum: no such method: '"+t+"'");"get"==t?r=e.get():"container"==t?r=e.container:"option"==t?r=e.option.apply(e,n):"destroy"==t?(e.destroy(),$(this).removeData(m)):a.apply(e,n)}}),r}return this.spectrum("destroy").each(function(){var e=$.extend({},t,$(this).data()),r=a(this,e);$(this).data(m,r.id)})},$.fn.spectrum.load=!0,$.fn.spectrum.loadOpts={},$.fn.spectrum.draggable=c,$.fn.spectrum.defaults=h,$.fn.spectrum.inputTypeColorSupport=function t(){if(void 0===t._cachedResult){var e=$("<input type='color'/>")[0];t._cachedResult="color"===e.type&&""!==e.value}return t._cachedResult},$.spectrum={},$.spectrum.localization={},$.spectrum.palettes={},$.fn.spectrum.processNativeColorInputs=function(){var t=$("input[type=color]");t.length&&!u()&&t.spectrum({preferredFormat:"hex6"})},function(){function t(t){var r={r:0,g:0,b:0},a=1,o=!1,s=!1;return"string"==typeof t&&(t=T(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(r=e(t.r,t.g,t.b),o=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=R(t.s),t.v=R(t.v),r=i(t.h,t.s,t.v),o=!0,s="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=R(t.s),t.l=R(t.l),r=n(t.h,t.s,t.l),o=!0,s="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=x(a),{ok:o,format:t.format||s,r:D(255,I(r.r,0)),g:D(255,I(r.g,0)),b:D(255,I(r.b,0)),a:a}}function e(t,e,r){return{r:255*k(t,255),g:255*k(e,255),b:255*k(r,255)}}function r(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n=I(t,e,r),a=D(t,e,r),i,o,s=(n+a)/2;if(n==a)i=o=0;else{var l=n-a;switch(o=s>.5?l/(2-n-a):l/(n+a),n){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4;break}i/=6}return{h:i,s:o,l:s}}function n(t,e,r){function n(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,i,o;if(t=k(t,360),e=k(e,100),r=k(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function a(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n=I(t,e,r),a=D(t,e,r),i,o,s=n,l=n-a;if(o=0===n?0:l/n,n==a)i=0;else{switch(n){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4;break}i/=6}return{h:i,s:o,v:s}}function i(t,e,r){t=6*k(t,360),e=k(e,100),r=k(r,100);var n=j.floor(t),a=t-n,i=r*(1-e),o=r*(1-a*e),s=r*(1-(1-a)*e),l=n%6;return{r:255*[r,o,i,i,s,r][l],g:255*[s,r,r,o,i,i][l],b:255*[i,i,s,r,r,o][l]}}function o(t,e,r,n){var a=[M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function s(t,e,r,n){return[M(H(n)),M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))].join("")}function l(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s-=e/100,r.s=S(r.s),B(r)}function c(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s+=e/100,r.s=S(r.s),B(r)}function f(t){return B(t).desaturate(100)}function u(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l+=e/100,r.l=S(r.l),B(r)}function h(t,e){e=0===e?0:e||10;var r=B(t).toRgb();return r.r=I(0,D(255,r.r-E(-e/100*255))),r.g=I(0,D(255,r.g-E(-e/100*255))),r.b=I(0,D(255,r.b-E(-e/100*255))),B(r)}function d(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l-=e/100,r.l=S(r.l),B(r)}function p(t,e){var r=B(t).toHsl(),n=(E(r.h)+e)%360;return r.h=n<0?360+n:n,B(r)}function g(t){var e=B(t).toHsl();return e.h=(e.h+180)%360,B(e)}function b(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+120)%360,s:e.s,l:e.l}),B({h:(r+240)%360,s:e.s,l:e.l})]}function v(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+90)%360,s:e.s,l:e.l}),B({h:(r+180)%360,s:e.s,l:e.l}),B({h:(r+270)%360,s:e.s,l:e.l})]}function m(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+72)%360,s:e.s,l:e.l}),B({h:(r+216)%360,s:e.s,l:e.l})]}function y(t,e,r){e=e||6,r=r||30;var n=B(t).toHsl(),a=360/r,i=[B(t)];for(n.h=(n.h-(a*e>>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(B(n));return i}function w(t,e){e=e||6;for(var r=B(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(B({h:n,s:a,v:i})),i=(i+s)%1;return o}function _(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function k(t,e){P(t)&&(t="100%");var r=A(t);return t=D(e,I(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),j.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function S(t){return D(1,I(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function A(t){return"string"==typeof t&&-1!=t.indexOf("%")}function M(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function H(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return C(t)/255}function T(t){t=t.replace(O,"").replace(q,"").toLowerCase();var e=!1;if(L[t])t=L[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=V.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=V.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=V.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=V.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=V.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=V.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=V.hex8.exec(t))?{a:F(r[1]),r:C(r[2]),g:C(r[3]),b:C(r[4]),format:e?"name":"hex8"}:(r=V.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:!!(r=V.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}var O=/^[\s,#]+/,q=/\s+$/,N=0,j=Math,E=j.round,D=j.min,I=j.max,z=j.random,B=function(e,r){if(e=e||"",r=r||{},e instanceof B)return e;if(!(this instanceof B))return new B(e,r);var n=t(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=E(100*this._a)/100,this._format=r.format||n.format,this._gradientType=r.gradientType,this._r<1&&(this._r=E(this._r)),this._g<1&&(this._g=E(this._g)),this._b<1&&(this._b=E(this._b)),this._ok=n.ok,this._tc_id=N++};B.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=x(t),this._roundA=E(100*this._a)/100,this},toHsv:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=a(this._r,this._g,this._b),e=E(360*t.h),r=E(100*t.s),n=E(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=r(this._r,this._g,this._b),e=E(360*t.h),n=E(100*t.s),a=E(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+a+"%)":"hsla("+e+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return s(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:E(this._r),g:E(this._g),b:E(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+E(this._r)+", "+E(this._g)+", "+E(this._b)+")":"rgba("+E(this._r)+", "+E(this._g)+", "+E(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:E(100*k(this._r,255))+"%",g:E(100*k(this._g,255))+"%",b:E(100*k(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%)":"rgba("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(K[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+s(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){r=B(t).toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(u,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(c,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(w,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},B.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:R(t[n]));t=r}return B(t,e)},B.equals=function(t,e){return!(!t||!e)&&B(t).toRgbString()==B(e).toRgbString()},B.random=function(){return B.fromRatio({r:z(),g:z(),b:z()})},B.mix=function(t,e,r){r=0===r?0:r||50;var n=B(t).toRgb(),a=B(e).toRgb(),i=r/100,o=2*i-1,s=a.a-n.a,l;l=o*s==-1?o:(o+s)/(1+o*s),l=(l+1)/2;var c=1-l,f={r:a.r*l+n.r*c,g:a.g*l+n.g*c,b:a.b*l+n.b*c,a:a.a*i+n.a*(1-i)};return B(f)},B.readability=function(t,e){var r=B(t),n=B(e),a=r.toRgb(),i=n.toRgb(),o=r.getBrightness(),s=n.getBrightness(),l=Math.max(a.r,i.r)-Math.min(a.r,i.r)+Math.max(a.g,i.g)-Math.min(a.g,i.g)+Math.max(a.b,i.b)-Math.min(a.b,i.b);return{brightness:Math.abs(o-s),color:l}},B.isReadable=function(t,e){var r=B.readability(t,e);return r.brightness>125&&r.color>500},B.mostReadable=function(t,e){for(var r=null,n=0,a=!1,i=0;i<e.length;i++){var o=B.readability(t,e[i]),s=o.brightness>125&&o.color>500,l=o.brightness/125*3+o.color/500;(s&&!a||s&&a&&l>n||!s&&!a&&l>n)&&(a=s,n=l,r=B(e[i]))}return r};var L=B.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",rebeccapurple:"663399",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"},K=B.hexNames=_(L),V=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),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})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=B}(),$(function(){$.fn.spectrum.load&&$.fn.spectrum.processNativeColorInputs()})});
flag.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: GRAND FlaGallery
4
  Plugin URI: https://mypgc.co/
5
  Description: The Grand Flagallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
6
- Version: 5.2.1
7
  Author: Rattus
8
  Author URI: https://codeasily.com/
9
  Text Domain: flash-album-gallery
@@ -24,7 +24,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
24
  if (!class_exists('flagLoad')) {
25
  class flagLoad {
26
 
27
- var $version = '5.2.1';
28
  var $dbversion = '5.0';
29
  var $minium_WP = '3.7';
30
  var $minium_WPMU = '3.7';
@@ -322,15 +322,6 @@ class flagLoad {
322
  wp_deregister_script('easing');
323
  wp_register_script('easing', plugins_url('/flash-album-gallery/assets/jq-plugins/jquery.easing.js'), array('jquery'), '1.3.0', true);
324
  }
325
- if( !wp_script_is('fancybox', 'registered') || ($wp_scripts->registered['fancybox']->ver !== false && version_compare($wp_scripts->registered['fancybox']->ver, '1.3.4', '<'))){
326
- if( !defined('FANCYBOX_VERSION')){
327
- wp_deregister_style('fancybox');
328
- wp_register_style('fancybox', plugins_url('/flash-album-gallery/assets/fancybox/jquery.fancybox-1.3.4.css'), array(), '1.3.4');
329
- }
330
- wp_deregister_script('fancybox');
331
- wp_register_script('fancybox', plugins_url('/flash-album-gallery/assets/fancybox/jquery.fancybox-1.3.4.pack.js'), array('jquery', 'easing'), '1.3.4', true);
332
- }
333
-
334
 
335
  if( !wp_script_is('jplayer', 'registered') || version_compare($wp_scripts->registered['jplayer']->ver, '2.6.4', '<')){
336
  wp_deregister_script('jplayer');
3
  Plugin Name: GRAND FlaGallery
4
  Plugin URI: https://mypgc.co/
5
  Description: The Grand Flagallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
6
+ Version: 5.2.6
7
  Author: Rattus
8
  Author URI: https://codeasily.com/
9
  Text Domain: flash-album-gallery
24
  if (!class_exists('flagLoad')) {
25
  class flagLoad {
26
 
27
+ var $version = '5.2.6';
28
  var $dbversion = '5.0';
29
  var $minium_WP = '3.7';
30
  var $minium_WPMU = '3.7';
322
  wp_deregister_script('easing');
323
  wp_register_script('easing', plugins_url('/flash-album-gallery/assets/jq-plugins/jquery.easing.js'), array('jquery'), '1.3.0', true);
324
  }
 
 
 
 
 
 
 
 
 
325
 
326
  if( !wp_script_is('jplayer', 'registered') || version_compare($wp_scripts->registered['jplayer']->ver, '2.6.4', '<')){
327
  wp_deregister_script('jplayer');
full_window_template.php CHANGED
@@ -48,7 +48,7 @@ body > .flagallery-wrapper > div.flagallery { overflow: auto; overflow-x:hidden;
48
  global $gmedia;
49
 
50
  $backlink_text = isset($flag_custom["mb_button"][0]) && !empty($flag_custom["mb_button"][0])? $flag_custom["mb_button"][0] : __('Go Back', 'flash-album-gallery');
51
- $backlink = isset($flag_custom["mb_bg_link"][0]) && !empty($flag_custom["mb_bg_link"][0])? $flag_custom['mb_bg_link'][0] : '';
52
  if(!$backlink || $backlink == 'http://'){
53
  $backlink = isset($_SERVER["HTTP_REFERER"])? $_SERVER["HTTP_REFERER"] : '';
54
  }
48
  global $gmedia;
49
 
50
  $backlink_text = isset($flag_custom["mb_button"][0]) && !empty($flag_custom["mb_button"][0])? $flag_custom["mb_button"][0] : __('Go Back', 'flash-album-gallery');
51
+ $backlink = isset($flag_custom["mb_button_link"][0]) && !empty($flag_custom["mb_button_link"][0])? $flag_custom['mb_button_link'][0] : '';
52
  if(!$backlink || $backlink == 'http://'){
53
  $backlink = isset($_SERVER["HTTP_REFERER"])? $_SERVER["HTTP_REFERER"] : '';
54
  }
lib/skinobject.php CHANGED
@@ -88,7 +88,7 @@ function flagShowFlashAlbum($galleryID, $name='', $width='', $skin='', $linkto='
88
  foreach($pictures as $i => $pic){
89
  $pictures[$i]['alttext'] = stripslashes($pic['alttext']);
90
  $pictures[$i]['description'] = stripslashes($pic['description']);
91
- $pictures[$i]['meta_data'] = maybe_unserialize($pic['meta_data']);
92
  unset($pictures[$i]['meta_data']['0']);
93
  if(!isset($pictures[$i]['meta_data']['webview'])){
94
  $pictures[$i]['meta_data']['webview'] = flagAdmin::webview_image($pic['pid'], true);
88
  foreach($pictures as $i => $pic){
89
  $pictures[$i]['alttext'] = stripslashes($pic['alttext']);
90
  $pictures[$i]['description'] = stripslashes($pic['description']);
91
+ $pictures[$i]['meta_data'] = (array) maybe_unserialize($pic['meta_data']);
92
  unset($pictures[$i]['meta_data']['0']);
93
  if(!isset($pictures[$i]['meta_data']['webview'])){
94
  $pictures[$i]['meta_data']['webview'] = flagAdmin::webview_image($pic['pid'], true);
readme.txt CHANGED
@@ -14,6 +14,9 @@ Gallery Grand Flagallery - powerfull media and image gallery plugin. Easy interf
14
 
15
  **Demo:**
16
 
 
 
 
17
  * [AlbumsList Masonry](https://mypgc.co/portfolio-item/albumslist_masonry/)
18
  * [AlbumsList](https://mypgc.co/portfolio-item/albumslist/)
19
  * [WoowSlider](https://mypgc.co/portfolio-item/woowslider/)
@@ -57,6 +60,24 @@ See "Views" of each photo in the gallery and allow visitors to "Like" photos.
57
 
58
  == Changelog ==
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  = v5.2.1 - 07.05.2018 =
61
  * Fixed skin options not open on some themes
62
  * Small bug fixes
14
 
15
  **Demo:**
16
 
17
+ * [Grid](https://mypgc.co/portfolio-item/cicerone/)
18
+ * [Masonry Grid](https://mypgc.co/portfolio/cicerone-masonry/)
19
+ * [Justified Grid](https://mypgc.co/portfolio/cicerone-justified/)
20
  * [AlbumsList Masonry](https://mypgc.co/portfolio-item/albumslist_masonry/)
21
  * [AlbumsList](https://mypgc.co/portfolio-item/albumslist/)
22
  * [WoowSlider](https://mypgc.co/portfolio-item/woowslider/)
60
 
61
  == Changelog ==
62
 
63
+ = v5.2.6 - 03.09.2018 =
64
+ * Fixed GRANDPage Back button
65
+
66
+ = v5.2.5 - 08.08.2018 =
67
+ * PHP Error fix
68
+
69
+ = v5.2.4 - 13.06.2018 =
70
+ * Magnific Popup arrows fix for some themes
71
+ * Fix for Grand Pages edit screen: select galleries block
72
+ * PHP Notice fix for PHP 7
73
+
74
+ = v5.2.3 - 05.06.2018 =
75
+ * New WoowBox Gallery plugin
76
+ * Fixed Fancybox compatibility with some themes
77
+
78
+ = v5.2.2 - 24.05.2018 =
79
+ * Replace color picker in skins settings to support rgba (for future skins)
80
+
81
  = v5.2.1 - 07.05.2018 =
82
  * Fixed skin options not open on some themes
83
  * Small bug fixes
widgets/widgets.php CHANGED
@@ -166,7 +166,10 @@ class flagSlideshowWidget extends WP_Widget {
166
  }
167
 
168
  // register it
169
- add_action('widgets_init', create_function('', 'return register_widget("flagSlideshowWidget");'));
 
 
 
170
 
171
 
172
  class flagBannerWidget extends WP_Widget {
@@ -243,7 +246,10 @@ class flagBannerWidget extends WP_Widget {
243
  }
244
 
245
  // register it
246
- add_action('widgets_init', create_function('', 'return register_widget("flagBannerWidget");'));
 
 
 
247
 
248
  function flagBannerWidget($xml, $w = '100%') {
249
 
@@ -352,7 +358,10 @@ class flagWidget extends WP_Widget {
352
  }// end widget class
353
 
354
  // register it
355
- add_action('widgets_init', create_function('', 'return register_widget("flagWidget");'));
 
 
 
356
 
357
  /**
358
  * flagVideoWidget - The widget control for Grand Flagallery
@@ -497,7 +506,10 @@ class flagVideoWidget extends WP_Widget {
497
  }// end widget class
498
 
499
  // register it
500
- add_action('widgets_init', create_function('', 'return register_widget("flagVideoWidget");'));
 
 
 
501
 
502
 
503
  /**
@@ -580,7 +592,10 @@ class flagMusicWidget extends WP_Widget {
580
  }
581
 
582
  // register it
583
- add_action('widgets_init', create_function('', 'return register_widget("flagMusicWidget");'));
 
 
 
584
 
585
  function flagMusicWidget($xml, $w = '100%') {
586
 
166
  }
167
 
168
  // register it
169
+ add_action('widgets_init', 'register_flagSlideshowWidget');
170
+ function register_flagSlideshowWidget(){
171
+ register_widget("flagSlideshowWidget");
172
+ }
173
 
174
 
175
  class flagBannerWidget extends WP_Widget {
246
  }
247
 
248
  // register it
249
+ add_action('widgets_init', 'register_flagBannerWidget');
250
+ function register_flagBannerWidget(){
251
+ register_widget("flagBannerWidget");
252
+ }
253
 
254
  function flagBannerWidget($xml, $w = '100%') {
255
 
358
  }// end widget class
359
 
360
  // register it
361
+ add_action('widgets_init', 'register_flagWidget');
362
+ function register_flagWidget(){
363
+ register_widget("flagWidget");
364
+ }
365
 
366
  /**
367
  * flagVideoWidget - The widget control for Grand Flagallery
506
  }// end widget class
507
 
508
  // register it
509
+ add_action('widgets_init', 'register_flagVideoWidget');
510
+ function register_flagVideoWidget() {
511
+ register_widget("flagVideoWidget");
512
+ }
513
 
514
 
515
  /**
592
  }
593
 
594
  // register it
595
+ add_action('widgets_init', 'register_flagMusicWidget');
596
+ function register_flagMusicWidget() {
597
+ register_widget("flagMusicWidget");
598
+ }
599
 
600
  function flagMusicWidget($xml, $w = '100%') {
601