Child Theme Configurator - Version 1.7.6

Version Description

  • Sanitize child theme slug
  • Remove cascade load order comments from generated CSS
  • Set admin background to prevent theme override
Download this release

Release Info

Developer lilaeamedia
Plugin Icon 128x128 Child Theme Configurator
Version 1.7.6
Comparing to
See all releases

Code changes from version 1.7.5.1 to 1.7.6

child-theme-configurator.php CHANGED
@@ -5,8 +5,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
5
  /*
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
- Description: Create a child theme that follows WP best practice to enqueue stylesheets. Easy to use CSS editor lets you find, preview and customize any style.
9
- Version: 1.7.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: chld_thm_cfg
@@ -22,7 +22,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
22
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
23
  defined( 'CHLD_THM_CFG_OPTIONS' ) or
24
  define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
25
- define( 'CHLD_THM_CFG_VERSION', '1.7.5.1' );
26
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
27
  defined( 'CHLD_THM_CFG_BPSEL' ) or
28
  define( 'CHLD_THM_CFG_BPSEL', '2500' );
5
  /*
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com
8
+ Description: Create child themes and customize styles, templates and functions. Enqueues stylesheets and web fonts. Handles rgba, vendor-prefixes and more.
9
+ Version: 1.7.6
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com
12
  Text Domain: chld_thm_cfg
22
  define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
23
  defined( 'CHLD_THM_CFG_OPTIONS' ) or
24
  define( 'CHLD_THM_CFG_OPTIONS', 'chld_thm_cfg_options' );
25
+ define( 'CHLD_THM_CFG_VERSION', '1.7.6' );
26
  define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
27
  defined( 'CHLD_THM_CFG_BPSEL' ) or
28
  define( 'CHLD_THM_CFG_BPSEL', '2500' );
css/chld-thm-cfg.css CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  p {
2
  line-height:1.4;
3
  }
@@ -909,6 +912,7 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
909
  /* Palettes */
910
  .sp-palette-container {
911
  border-right: solid 1px #ccc;
 
912
  }
913
 
914
  .sp-palette-only .sp-palette-container {
1
+ body {
2
+ background:none !important;
3
+ }
4
  p {
5
  line-height:1.4;
6
  }
912
  /* Palettes */
913
  .sp-palette-container {
914
  border-right: solid 1px #ccc;
915
+ max-width: 60px;
916
  }
917
 
918
  .sp-palette-only .sp-palette-container {
includes/class-ctc-css.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
- Version: 1.7.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -1049,8 +1049,8 @@ class ChildThemeConfiguratorCSS {
1049
  /** FIXME ** need better way to sort rules and multiple values ***/
1050
  $this->encode_shorthand( $shorthand, $rule_output );
1051
  if ( count( $rule_output ) ):
1052
- // show load order
1053
- $sel_output .= isset( $this->dict_seq[ $qsid ] )?'/*' . $this->dict_seq[ $qsid ] . '*/' . LF:'';
1054
  $sel_output .= $sel . ' {' . LF . $this->stringify_rule_output( $rule_output ) . '}' . LF;
1055
  $has_selector = 1;
1056
  endif;
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS input, output, parsing, normalization and storage
9
+ Version: 1.7.6
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
1049
  /** FIXME ** need better way to sort rules and multiple values ***/
1050
  $this->encode_shorthand( $shorthand, $rule_output );
1051
  if ( count( $rule_output ) ):
1052
+ // show load order -- removed in v.1.7.6 by popular demand
1053
+ //$sel_output .= isset( $this->dict_seq[ $qsid ] )?'/*' . $this->dict_seq[ $qsid ] . '*/' . LF:'';
1054
  $sel_output .= $sel . ' {' . LF . $this->stringify_rule_output( $rule_output ) . '}' . LF;
1055
  $has_selector = 1;
1056
  endif;
includes/class-ctc-ui.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
- Version: 1.7.5.1
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.childthemeconfigurator.com/
7
  Description: Handles the plugin User Interface
8
+ Version: 1.7.6
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
includes/class-ctc.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Main Controller Class
9
- Version: 1.7.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -108,7 +108,7 @@ class ChildThemeConfiguratorAdmin {
108
  }
109
 
110
  function enqueue_scripts() {
111
- wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chld-thm-cfg.css', array(), '1.7.5.1' );
112
 
113
  // we need to use local jQuery UI Widget/Menu/Selectmenu 1.11.2 because selectmenu is not included in < 1.11.2
114
  // this will be updated in a later release to use WP Core scripts when it is widely adopted
@@ -214,7 +214,7 @@ class ChildThemeConfiguratorAdmin {
214
  // organize into parent and child themes
215
  $group = $theme->parent() ? 'child' : 'parnt';
216
  // get the theme slug
217
- $slug = $theme->get_stylesheet();
218
  // get the theme slug
219
  $version = $theme->get( 'Version' );
220
  // strip auto-generated timestamp from CTC child theme version
@@ -715,6 +715,13 @@ class ChildThemeConfiguratorAdmin {
715
  return $input;
716
  }
717
 
 
 
 
 
 
 
 
718
  function update_redirect( $msg = 1 ) {
719
  if ( empty( $this->is_ajax ) ):
720
  if ( $this->is_debug )
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Main Controller Class
9
+ Version: 1.7.6
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
108
  }
109
 
110
  function enqueue_scripts() {
111
+ wp_enqueue_style( 'chld-thm-cfg-admin', CHLD_THM_CFG_URL . 'css/chld-thm-cfg.css', array(), '1.7.6' );
112
 
113
  // we need to use local jQuery UI Widget/Menu/Selectmenu 1.11.2 because selectmenu is not included in < 1.11.2
114
  // this will be updated in a later release to use WP Core scripts when it is widely adopted
214
  // organize into parent and child themes
215
  $group = $theme->parent() ? 'child' : 'parnt';
216
  // get the theme slug
217
+ $slug = $this->sanitize_slug( $theme->get_stylesheet() );
218
  // get the theme slug
219
  $version = $theme->get( 'Version' );
220
  // strip auto-generated timestamp from CTC child theme version
715
  return $input;
716
  }
717
 
718
+ /**
719
+ * remove slashes and non-alphas from stylesheet name
720
+ */
721
+ function sanitize_slug( $slug ) {
722
+ return preg_replace( "/[^\w\-]/", '', $slug );
723
+ }
724
+
725
  function update_redirect( $msg = 1 ) {
726
  if ( empty( $this->is_ajax ) ):
727
  if ( $this->is_debug )
includes/forms/addl_panels.php CHANGED
@@ -25,6 +25,7 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
25
  <li><h3><?php _e( 'Customize Plugin Stylesheets', 'chld_thm_cfg' ); ?></h3>
26
  <p><?php _e( 'Apply the power of CTC\'s top-rated interface to your site\'s plugin styles. All new design makes it much easier to get the results you want.', 'chld_thm_cfg' ); ?></p></li>
27
  <li><h3><?php _e( 'Quick Preview', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Test your child theme with a single click.', 'chld_thm_cfg' ); ?></p></li>
 
28
  <li><h3><?php _e( 'Find related styles', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'chld_thm_cfg' ); ?></p></li>
29
  <li><h3><?php _e( 'Find styles by Nav Menu', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'chld_thm_cfg' ); ?></p></li>
30
  <li><h3><?php _e( 'Most recent edits', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'chld_thm_cfg' ); ?></p></li>
25
  <li><h3><?php _e( 'Customize Plugin Stylesheets', 'chld_thm_cfg' ); ?></h3>
26
  <p><?php _e( 'Apply the power of CTC\'s top-rated interface to your site\'s plugin styles. All new design makes it much easier to get the results you want.', 'chld_thm_cfg' ); ?></p></li>
27
  <li><h3><?php _e( 'Quick Preview', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Test your child theme with a single click.', 'chld_thm_cfg' ); ?></p></li>
28
+ <li><h3><?php _e( 'Color Palettes', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Keep the colors you select just a click away. No more searching for hex codes and RGB values.', 'chld_thm_cfg' ); ?></p></li>
29
  <li><h3><?php _e( 'Find related styles', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Use the "All Styles" panel to edit groups of selectors from a single combined list.', 'chld_thm_cfg' ); ?></p></li>
30
  <li><h3><?php _e( 'Find styles by Nav Menu', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Tweak menus quickly and easily.', 'chld_thm_cfg' ); ?></p></li>
31
  <li><h3><?php _e( 'Most recent edits', 'chld_thm_cfg' ); ?></h3><p><?php _e( 'Return to recently edited selectors from a toggleable sidebar.', 'chld_thm_cfg' ); ?></p></li>
includes/help/help_en_US.php CHANGED
@@ -37,7 +37,7 @@ This option imports the parent stylesheet from the child stylesheet. This enable
37
  <!-- END tab -->
38
  <!-- BEGIN tab -->
39
  <h3 id="ctc_tutorial">Tutorial Video</h3>
40
- <iframe src="//fast.wistia.net/embed/iframe/c0fbu8jhtj" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe><!-- END tab -->
41
  <!-- BEGIN tab -->
42
  <h3 id="ctc_query_selector">Query/Selector Tab</h3>
43
  <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>property</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Property/Value" tab.</p>
37
  <!-- END tab -->
38
  <!-- BEGIN tab -->
39
  <h3 id="ctc_tutorial">Tutorial Video</h3>
40
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/NQ1M-ZlRScY?rel=0&modestbranding=1" frameborder="0" allowfullscreen></iframe><!-- END tab -->
41
  <!-- BEGIN tab -->
42
  <h3 id="ctc_query_selector">Query/Selector Tab</h3>
43
  <p>There are two ways to identify and override parent styles. The Child Theme Configurator lets you search styles by <strong>selector</strong> and by <strong>property</strong>. If you wish to change a specific selector (e.g., h1), use the "Query/Selector" tab. If you have a specific value you wish to change site-wide (e.g., the color of the type), use the "Property/Value" tab.</p>
js/chld-thm-cfg.js CHANGED
@@ -2,7 +2,7 @@
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.childthemeconfigurator.com/
4
  * Description: Handles jQuery, AJAX and other UI
5
- * Version: 1.7.5.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -609,8 +609,9 @@
609
  },
610
 
611
  setup_spectrum: function( obj ) {
612
- var self = this,
613
- colortxt = $( obj ).attr( 'id' ) + '_colortxt';
 
614
  try {
615
  $( obj ).spectrum( {
616
  showInput: true,
@@ -622,7 +623,13 @@
622
  move: function( color ) {
623
  $( obj ).data( 'color', color );
624
  self.coalesce_inputs( obj );
625
- }
 
 
 
 
 
 
626
  } ).on( 'change', function( e ){
627
  var color = $( this ).spectrum( 'get' );
628
  //console.log( 'color change: ' + color );
@@ -636,6 +643,7 @@
636
  function() {
637
  self.coalesce_inputs( $this );
638
  $( $this ).spectrum( 'set', $val );
 
639
  },
640
  500
641
  ) );
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.childthemeconfigurator.com/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 1.7.6
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
609
  },
610
 
611
  setup_spectrum: function( obj ) {
612
+ var self = this,
613
+ colortxt = $( obj ).attr( 'id' ) + '_colortxt',
614
+ palette = !self.is_empty( ctcAjax.palette );
615
  try {
616
  $( obj ).spectrum( {
617
  showInput: true,
623
  move: function( color ) {
624
  $( obj ).data( 'color', color );
625
  self.coalesce_inputs( obj );
626
+ },
627
+ showPalette: palette ? true : false,
628
+ showSelectionPalette: palette ? true : false,
629
+ palette: [ ],
630
+ maxSelectionSize: 36,
631
+ localStorageKey: "ctc-palette." + ctcAjax.child,
632
+ hideAfterPaletteSelect: true,
633
  } ).on( 'change', function( e ){
634
  var color = $( this ).spectrum( 'get' );
635
  //console.log( 'color change: ' + color );
643
  function() {
644
  self.coalesce_inputs( $this );
645
  $( $this ).spectrum( 'set', $val );
646
+
647
  },
648
  500
649
  ) );
js/chld-thm-cfg.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e.chldthmcfg={esc_quot:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},getxt:function(e){return(text=ctcAjax[e+"_txt"])?text:""},from_ascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},to_ascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(ctcAjax.themes,function(i,a){return e.each(a,function(e,a){return e.toLowerCase()!==t.toLowerCase()||"parnt"!=i&&"new"!=c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,a=e("input[name=ctc_child_type]:checked").val(),r=[];return"new"==a&&(i=n),t.theme_exists(i,a)&&r.push(t.getxt("theme_exists").toString().replace(/%s/,i)),""===i&&r.push(t.getxt("inval_theme")),""===e("#ctc_child_name").val()&&r.push(t.getxt("inval_name")),r.length?(t.set_notice({error:r}),!1):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=slugbase=c+"-child",i=ctcAjax.themes.parnt[c].Name+" Child",a="",r="",s="00";t.theme_exists(n,"new");)a=""==a?2:a+1,r=s.substring(0,s.length-a.toString().length)+a.toString(),n=slugbase+r;t.testslug=n,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.esc_quot(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},fade_update_notice:function(){e(".updated, .error").slideUp("slow",function(){e(".updated").remove()})},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,a=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),r=a.find(".ctc-swatch").first(),s={parent:{},child:{}},l={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},_={child:!1,parent:!1},o={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,a,r=e(this).attr("id"),u=r.toString().match(i),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[7],v=u[5],f="undefined"==typeof u[7]?"":u[8],g="parent"==p?e(this).text().replace(/!$/,""):"seq"!=h&&"ctc_delete_query_selector"==n?"":e(this).val(),y="seq"==h?!1:"ctc_"+d+"_child_"+h+"_i_"+v+"_"+m;if("child"==p&&(c.is_empty(e(this).data("color"))||(g=c.color_text(e(this).data("color")),e(this).data("color",null)),o[r]=g,y&&(o[y]=e("#"+y).is(":checked")?1:0)),""!==g)if(c.is_empty(f))if(t=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!g.match(/none/)){var x=new RegExp(c.border_regx+c.color_regx,"i"),a=g.toString().match(x);c.is_empty(a)||(a.shift(),s[p][h+"-width"]=a.shift()||"",a.shift(),s[p][h+"-style"]=a.shift()||"",s[p][h+"-color"]=a.shift()||"")}else if("background-image"!=h||g.match(/none/))"seq"!=h&&(s[p][h]=g);else if(g.toString().match(/url\(/))s[p]["background-image"]=c.image_url(p,g);else{var w=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i"),a=g.toString().match(w);!c.is_empty(a)&&a.length>2?(a.shift(),l[p].origin=a.shift()||"top",l[p].start=a.shift()||"transparent",l[p].end=a.shift()||"transparent",_[p]=!0):s[p]["background-image"]=g}else switch(f){case"_border_width":s[p][h+"-width"]="none"==g?0:g;break;case"_border_style":s[p][h+"-style"]=g;break;case"_border_color":s[p][h+"-color"]=g;break;case"_background_url":s[p]["background-image"]=c.image_url(p,g);break;case"_background_color":s[p]["background-color"]=g;break;case"_background_color1":l[p].start=g,_[p]=!0;break;case"_background_color2":l[p].end=g,_[p]=!0;break;case"_background_origin":l[p].origin=g,_[p]=!0}}),"undefined"==typeof r||c.is_empty(r.attr("id"))||(r.removeAttr("style"),_.parent&&r.ctcgrad(l.parent.origin,[l.parent.start,l.parent.end]),r.css(s.parent),r.attr("id").toString().match(/parent/)||(_.child&&r.ctcgrad(l.child.origin,[l.child.start,l.child.end]),r.css(s.child)),r.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=new RegExp(c.border_regx+"("+c.color_regx+")?","i"),a=t.toString().match(i);c.is_empty(a)&&(a=[]),n.names=["_border_width","_border_style","_border_color"],orig=a.shift(),n.values[0]=a.shift()||"",a.shift(),n.values[1]=a.shift()||"",a.shift(),n.values[2]=a.shift()||""}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var r,s,a=t.toString().split(/:/);n.values[1]=a.shift()||"",n.values[2]=a.shift()||"",r=a.shift()||"",n.values[3]=a.shift()||"",s=a.shift()||"",n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}return n},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),a=n.is_empty(i)?null:i[1],r=ctcAjax.theme_uri+"/"+("parent"==e?ctcAjax.parnt:ctcAjax.child)+"/";return a?c=a.toString().match(/^(data:|https?:|\/)/)?t:"url("+r+a+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.current_query)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.current_query)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.current_qsid)},get_queries:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,a={};return nextval=n?c.child.pop():null,e.each(["parnt","child"],function(t,r){i.is_empty(c[r])||e.each(c[r],function(e,t){n?parseInt(t[2])>=parseInt(nextval[2])&&(nextval[2]=parseInt(t[2])+1):(i.is_empty(a[t[2]])&&(a[t[2]]={}),a[t[2]][r]=t)})}),n&&(a[nextval[2]]={parnt:[],child:nextval}),a},input_row:function(t,c,n,i,a){var r=this,s="";if(!r.is_empty(i)&&!r.is_empty(i.value)&&!r.is_empty(i.value[c])){var l=i.value[c],_=r.merge_ruleval_arrays(c,l,a);e.each(_,function(a,l){var _=r.decode_value(c,r.is_empty(l.parnt)?"":l.parnt[0]),o=r.is_empty(l.parnt)||0==l.parnt[1]?0:1,u=r.decode_value(c,r.is_empty(l.child)?"":l.child[0]),d=r.is_empty(l.child)||0==l.child[1]?0:1;if(s+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',s+="ovrd"==n?c.replace(/\d+/g,r.from_ascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+r.getxt("edit")+"</a> "+(r.is_empty(_.orig)?r.getxt("child_only"):""),s+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!=n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+a+'">'+(r.is_empty(_.orig)?"[no value]":_.orig+(o?r.getxt("important"):""))+'</div><div class="ctc-input-cell">',!r.is_empty(_.names)){e.each(_.names,function(e,i){i=r.is_empty(i)?"":i,s+='<div class="ctc-child-input-cell clear">';var l,_="ctc_"+n+"_child_"+c+"_"+t+"_"+a+i;!1===(l=u.values.shift())&&(l=""),s+=(r.is_empty(i)?"":r.getxt(i)+":<br/>")+'<input type="text" id="'+_+'" name="'+_+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+r.esc_quot(l)+'" /></div>'});var p="ctc_"+n+"_child_"+c+"_i_"+t+"_"+a;s+='<label for="'+p+'"><input type="checkbox" id="'+p+'" name="'+p+'" value="1" '+(d?"checked":"")+" />"+r.getxt("important")+"</label>"}s+="</div>","ovrd"!=n&&(s+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+a+'_swatch">'+r.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+a+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+a+'" name="ctc_save_'+c+"_"+t+"_"+a+'" value="Save" /></div>'),s+="</div><!-- end input row -->\n"})}return s},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var e,t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){{var c=this;e(t).attr("id")+"_colortxt"}try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)}}).on("change",function(t){e(this).spectrum("get");c.coalesce_inputs(this)}).on("keyup",function(t){var n=this,i=e(this).val();clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(n),e(n).spectrum("set",i)},500))})}catch(n){c.jquery_exception(n,"Spectrum Color Picker")}},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_query(c.item.value),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_selector(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var i,a,r=n.item.label.replace(/[^\w\-]/g,t.to_ascii);return t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.is_empty(t.current_qsdata.value[n.item.label])&&(t.current_qsdata.value[n.item.label]={}),t.is_empty(t.current_qsdata.value[n.item.label].child)&&(t.current_qsdata.value[n.item.label].child=[]),t.current_qsdata.value[n.item.label].child.push(["",0,1,1]),i=e(t.input_row(t.current_qsid,r,"ovrd",t.current_qsdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.find('input[type="text"]').each(function(c,n){a||(a=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),a&&e(a).focus(),t.jquery_err.length&&t.jquery_notice("setup_new_rule_menu"),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_existing:function(){var t=this;if(e("#ctc_theme_child").length&&e("#ctc_child_type_existing").is(":checked")){var c=e("#ctc_theme_child").val();t.is_empty(c)||(e("#ctc_child_name").val(ctcAjax.themes.child[c].Name),e("#ctc_child_author").val(ctcAjax.themes.child[c].Author),e("#ctc_child_version").val(ctcAjax.themes.child[c].Version),e("#ctc_child_authoruri").val(ctcAjax.themes.child[c].AuthorURI),e("#ctc_child_themeuri").val(ctcAjax.themes.child[c].ThemeURI),e("#ctc_child_descr").val(ctcAjax.themes.child[c].Descr),e("#ctc_child_tags").val(ctcAjax.themes.child[c].Tags),e("#ctc_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#input_row_duplicate_theme").show())}},set_notice:function(t){var c=this,n="";c.is_empty(t)||e.each(t,function(t,c){n+='<div class="'+t+'"><ul>\n',e(c).each(function(e,t){n+="<li>"+t.toString()+"</li>\n"}),n+="</ul></div>"}),e("#ctc_error_notice").html(n),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(t){e("#ctc_theme_parnt").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+t.value},set_child_menu:function(t){var c,n,i=this;i.is_empty(ctcAjax.themes.child[t.value])||(c=ctcAjax.themes.child[t.value].Template,n=e("#ctc_theme_parnt").val(),c==n?(e("#ctc_child_name").val(ctcAjax.themes.child[t.value].Name),e("#ctc_child_author").val(ctcAjax.themes.child[t.value].Author),e("#ctc_child_version").val(ctcAjax.themes.child[t.value].Version)):(e("#ctc_theme_child").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+c+"&ctc_child="+t.value))},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.current_query=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),c.load_selectors(),void c.scrolltop())},set_selector:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.current_qsid=t,n.reload_menus=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.current_qsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload_menus=!0,c.load_selector_values()},set_addl_css:function(){var t,c=this,n=e("#ctc_theme_parnt").val(),i=ctcAjax.theme_uri.replace(/^https?:\/\//,""),a=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),r=a+"?preview=1&p=x&template="+n+"&stylesheet="+n,s=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+i+"/"+n+"/(.+?\\.css)[^>]+?>","g");c.is_empty(n)||(n!=ctcAjax.parnt?e.get(r,function(c){for(;(t=s.exec(c))&&"style.css"!=t[1];)t[1].match(/bootstrap/)||e(".ctc_checkbox").each(function(c,n){e(this).val()==t[1]&&e(this).prop("checked",!0)});c=null}):e(ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(t,n){e(this).val()==c&&e(this).prop("checked",!0)})}))},query_css:function(t,c,n){var i=this,a={ctc_query_obj:t,ctc_query_key:c},r="#ctc_status_"+t+("val_qry"==t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){a["ctc_query_"+e]=t}),e(".query-icon").remove(),e(r+" .ctc-status-icon").remove(),e(r).append('<span class="ctc-status-icon spinner query-icon"></span>'),e(".spinner").show(),a.action=i.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_query":"ctc_plgqry",a._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,a)},save:function(t){var c,n,i,a,r,s=this,l=(ctcAjax.ajaxurl,{}),_=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),_.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),l.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"==e(t).attr("id")?(l.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(l.ctc_sel_ovrd_query=n.text()),s.reload_menus=!0):(i=e("#ctc_child_imports"))&&"ctc_save_imports"==_?l.ctc_child_imports=i.val():"ctc_is_debug"==_?l.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:l=s.coalesce_inputs(t),e(".save-icon").show(),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){a=e("#ctc_rewrite_selector").val(),r=e("#ctc_rewrite_selector_orig").val(),s.is_empty(a)||!a.toString().match(/\w/)?a=r:(l.ctc_rewrite_selector=a,s.reload_menus=!0),e(".ctc-rewrite-toggle").text(s.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(a)}),l.action=s.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_update":"ctc_plugin",l._wpnonce=e("#_wpnonce").val(),s.ajax_post("qsid",l)},ajax_post:function(t,c,n){var i=this,a=ctcAjax.ajaxurl;e.ajax({url:a,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"==t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jquery_err.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){var c=this,n=[],i=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(t,i){var a=e(this).prop("src");c.is_empty(a)||!a.match(/jquery(\.min|\.js|\-?ui)/i)||a.match(/load\-scripts.php/)||n.push("<code><small>"+a.split(/\?/)[0]+"</small></code>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jquery_err.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin")),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,a=this;a.current_qsid=t.key,a.current_qsdata=t.data,e("#ctc_sel_ovrd_qsid").val(a.current_qsid),a.is_empty(a.current_qsdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+a.current_qsid,i=parseInt(a.current_qsdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),a.is_empty(a.current_qsdata.value)?(e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_rule_header").hide()):(n="",e.each(a.current_qsdata.value,function(e,t){n+=a.input_row(a.current_qsid,e,"ovrd",a.current_qsdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){a.setup_spectrum(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch"),e("#ctc_sel_ovrd_rule_header").show()),a.jquery_err.length?a.jquery_notice("update.qsid"):(a.reload_menus&&(a.set_query(a.current_qsdata.query),a.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(a.current_qsdata.selector),e(".ctc-rewrite-toggle").text(a.getxt("rename")),e("#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show())},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var a=c.decode_value(n,t);i+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+a.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c=this,n="";c.is_empty(t.data)||e.each(t.data,function(i,a){page_rule=i,e.each(a,function(a,r){n+='<h4 class="ctc-query-heading">'+a+"</h4>\n",c.is_empty(r)||e.each(r,function(e,a){n+=c.input_row(e,i,t.key,a)})})}),selector="#ctc_selector_"+rule+"_"+t.key+"_rows",e(selector).html(n).find(".color-picker").each(function(){c.setup_spectrum(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice("val_qry")},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_container").html(t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)}},init:function(){var t=this;if(t.autogen_slugs(),t.set_existing(),!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>");return e("#ctc_theme_option_"+c.value).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.is_empty(t.jquery_err)?(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n=e(this).attr("id").toString().replace("_close",""),i=n.toString().match(/_([^_]+)_(\d+)$/);e("#"+n+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(rule=i[1],valid=i[2],t.query_css("val_qry",valid,{rule:rule}))),e("#"+n+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+n+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(c){var n=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(n)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+n+" {\n\n}")}),e("#ctc_configtype").on("change",function(c){var n=e(this).val();if(t.is_empty(n)||"theme"==n){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(i){t.jquery_exception(i,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(i){t.jquery_exception(i,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){c.preventDefault(),e(".ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e(".ctc-section-toggle").on("click",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .update-nag").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){return c.preventDefault(),$this=e("#ctc_save_query_selector"),$this.hasClass("ajax-pending")?!1:($this.addClass("ajax-pending"),t.save($this),!1)}),e("#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!0),e("#ctc_child_type_new").prop("checked",!1),e("#ctc_child_template").val(""),t.set_existing()}),e("#ctc_duplicate_theme").on("click",function(){e("#ctc_duplicate_theme").is(":checked")?(e("#ctc_child_name").val(t.testname),e("#ctc_duplicate_theme_slug").val(t.testslug)):t.set_existing()}),e("#ctc_child_type_new, #ctc_child_template").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!1),e("#ctc_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#ctc_child_type_new").prop("checked",!0),e("#input_row_duplicate_theme").hide(),e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug)}),e("#ctc_is_debug").on("change",function(e){t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),t.set_addl_css(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),setTimeout(t.fade_update_notice,2e4)):t.jquery_notice("init")},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmcfg.init()}(jQuery);
1
+ !function(e){e.chldthmcfg={esc_quot:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,"&quot;")},getxt:function(e){return(text=ctcAjax[e+"_txt"])?text:""},from_ascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},to_ascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(ctcAjax.themes,function(i,a){return e.each(a,function(e,a){return e.toLowerCase()!==t.toLowerCase()||"parnt"!=i&&"new"!=c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c):n,a=e("input[name=ctc_child_type]:checked").val(),r=[];return"new"==a&&(i=n),t.theme_exists(i,a)&&r.push(t.getxt("theme_exists").toString().replace(/%s/,i)),""===i&&r.push(t.getxt("inval_theme")),""===e("#ctc_child_name").val()&&r.push(t.getxt("inval_name")),r.length?(t.set_notice({error:r}),!1):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=slugbase=c+"-child",i=ctcAjax.themes.parnt[c].Name+" Child",a="",r="",s="00";t.theme_exists(n,"new");)a=""==a?2:a+1,r=s.substring(0,s.length-a.toString().length)+a.toString(),n=slugbase+r;t.testslug=n,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},selector_input_toggle:function(t){var c,n=this;e("#ctc_rewrite_selector").length?(c=e("#ctc_rewrite_selector_orig").val(),e("#ctc_sel_ovrd_selector_selected").text(c),e(t).text(n.getxt("rename"))):(c=e("#ctc_sel_ovrd_selector_selected").text(),e("#ctc_sel_ovrd_selector_selected").html('<textarea id="ctc_rewrite_selector" name="ctc_rewrite_selector" autocomplete="off"></textarea><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n.esc_quot(c)+'"/>'),e("#ctc_rewrite_selector").val(c),e(t).text(n.getxt("cancel")))},fade_update_notice:function(){e(".updated, .error").slideUp("slow",function(){e(".updated").remove()})},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),i=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,a=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),r=a.find(".ctc-swatch").first(),s={parent:{},child:{}},l={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},_={child:!1,parent:!1},o={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,a,r=e(this).attr("id"),u=r.toString().match(i),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[7],v=u[5],f="undefined"==typeof u[7]?"":u[8],g="parent"==p?e(this).text().replace(/!$/,""):"seq"!=h&&"ctc_delete_query_selector"==n?"":e(this).val(),y="seq"==h?!1:"ctc_"+d+"_child_"+h+"_i_"+v+"_"+m;if("child"==p&&(c.is_empty(e(this).data("color"))||(g=c.color_text(e(this).data("color")),e(this).data("color",null)),o[r]=g,y&&(o[y]=e("#"+y).is(":checked")?1:0)),""!==g)if(c.is_empty(f))if(t=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!g.match(/none/)){var x=new RegExp(c.border_regx+c.color_regx,"i"),a=g.toString().match(x);c.is_empty(a)||(a.shift(),s[p][h+"-width"]=a.shift()||"",a.shift(),s[p][h+"-style"]=a.shift()||"",s[p][h+"-color"]=a.shift()||"")}else if("background-image"!=h||g.match(/none/))"seq"!=h&&(s[p][h]=g);else if(g.toString().match(/url\(/))s[p]["background-image"]=c.image_url(p,g);else{var w=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i"),a=g.toString().match(w);!c.is_empty(a)&&a.length>2?(a.shift(),l[p].origin=a.shift()||"top",l[p].start=a.shift()||"transparent",l[p].end=a.shift()||"transparent",_[p]=!0):s[p]["background-image"]=g}else switch(f){case"_border_width":s[p][h+"-width"]="none"==g?0:g;break;case"_border_style":s[p][h+"-style"]=g;break;case"_border_color":s[p][h+"-color"]=g;break;case"_background_url":s[p]["background-image"]=c.image_url(p,g);break;case"_background_color":s[p]["background-color"]=g;break;case"_background_color1":l[p].start=g,_[p]=!0;break;case"_background_color2":l[p].end=g,_[p]=!0;break;case"_background_origin":l[p].origin=g,_[p]=!0}}),"undefined"==typeof r||c.is_empty(r.attr("id"))||(r.removeAttr("style"),_.parent&&r.ctcgrad(l.parent.origin,[l.parent.start,l.parent.end]),r.css(s.parent),r.attr("id").toString().match(/parent/)||(_.child&&r.ctcgrad(l.child.origin,[l.child.start,l.child.end]),r.css(s.child)),r.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=new RegExp(c.border_regx+"("+c.color_regx+")?","i"),a=t.toString().match(i);c.is_empty(a)&&(a=[]),n.names=["_border_width","_border_style","_border_color"],orig=a.shift(),n.values[0]=a.shift()||"",a.shift(),n.values[1]=a.shift()||"",a.shift(),n.values[2]=a.shift()||""}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var r,s,a=t.toString().split(/:/);n.values[1]=a.shift()||"",n.values[2]=a.shift()||"",r=a.shift()||"",n.values[3]=a.shift()||"",s=a.shift()||"",n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}return n},image_url:function(e,t){var c,n=this,i=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),a=n.is_empty(i)?null:i[1],r=ctcAjax.theme_uri+"/"+("parent"==e?ctcAjax.parnt:ctcAjax.child)+"/";return a?c=a.toString().match(/^(data:|https?:|\/)/)?t:"url("+r+a+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.current_query)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.current_query)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.current_qsid)},get_queries:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(this.element.data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],i=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){i.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var i=this,a={};return nextval=n?c.child.pop():null,e.each(["parnt","child"],function(t,r){i.is_empty(c[r])||e.each(c[r],function(e,t){n?parseInt(t[2])>=parseInt(nextval[2])&&(nextval[2]=parseInt(t[2])+1):(i.is_empty(a[t[2]])&&(a[t[2]]={}),a[t[2]][r]=t)})}),n&&(a[nextval[2]]={parnt:[],child:nextval}),a},input_row:function(t,c,n,i,a){var r=this,s="";if(!r.is_empty(i)&&!r.is_empty(i.value)&&!r.is_empty(i.value[c])){var l=i.value[c],_=r.merge_ruleval_arrays(c,l,a);e.each(_,function(a,l){var _=r.decode_value(c,r.is_empty(l.parnt)?"":l.parnt[0]),o=r.is_empty(l.parnt)||0==l.parnt[1]?0:1,u=r.decode_value(c,r.is_empty(l.child)?"":l.child[0]),d=r.is_empty(l.child)||0==l.child[1]?0:1;if(s+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',s+="ovrd"==n?c.replace(/\d+/g,r.from_ascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+r.getxt("edit")+"</a> "+(r.is_empty(_.orig)?r.getxt("child_only"):""),s+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!=n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+a+'">'+(r.is_empty(_.orig)?"[no value]":_.orig+(o?r.getxt("important"):""))+'</div><div class="ctc-input-cell">',!r.is_empty(_.names)){e.each(_.names,function(e,i){i=r.is_empty(i)?"":i,s+='<div class="ctc-child-input-cell clear">';var l,_="ctc_"+n+"_child_"+c+"_"+t+"_"+a+i;!1===(l=u.values.shift())&&(l=""),s+=(r.is_empty(i)?"":r.getxt(i)+":<br/>")+'<input type="text" id="'+_+'" name="'+_+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+r.esc_quot(l)+'" /></div>'});var p="ctc_"+n+"_child_"+c+"_i_"+t+"_"+a;s+='<label for="'+p+'"><input type="checkbox" id="'+p+'" name="'+p+'" value="1" '+(d?"checked":"")+" />"+r.getxt("important")+"</label>"}s+="</div>","ovrd"!=n&&(s+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+a+'_swatch">'+r.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+a+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+a+'" name="ctc_save_'+c+"_"+t+"_"+a+'" value="Save" /></div>'),s+="</div><!-- end input row -->\n"})}return s},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var e,t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=(e(t).attr("id")+"_colortxt",!c.is_empty(ctcAjax.palette));try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:n?!0:!1,showSelectionPalette:n?!0:!1,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(t){e(this).spectrum("get");c.coalesce_inputs(this)}).on("keyup",function(t){var n=this,i=e(this).val();clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(n),e(n).spectrum("set",i)},500))})}catch(i){c.jquery_exception(i,"Spectrum Color Picker")}},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_query(c.item.value),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_selector(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var i,a,r=n.item.label.replace(/[^\w\-]/g,t.to_ascii);return t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.is_empty(t.current_qsdata.value[n.item.label])&&(t.current_qsdata.value[n.item.label]={}),t.is_empty(t.current_qsdata.value[n.item.label].child)&&(t.current_qsdata.value[n.item.label].child=[]),t.current_qsdata.value[n.item.label].child.push(["",0,1,1]),i=e(t.input_row(t.current_qsid,r,"ovrd",t.current_qsdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(i),e("#ctc_new_rule_menu").val(""),i.find('input[type="text"]').each(function(c,n){a||(a=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),a&&e(a).focus(),t.jquery_err.length&&t.jquery_notice("setup_new_rule_menu"),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_existing:function(){var t=this;if(e("#ctc_theme_child").length&&e("#ctc_child_type_existing").is(":checked")){var c=e("#ctc_theme_child").val();t.is_empty(c)||(e("#ctc_child_name").val(ctcAjax.themes.child[c].Name),e("#ctc_child_author").val(ctcAjax.themes.child[c].Author),e("#ctc_child_version").val(ctcAjax.themes.child[c].Version),e("#ctc_child_authoruri").val(ctcAjax.themes.child[c].AuthorURI),e("#ctc_child_themeuri").val(ctcAjax.themes.child[c].ThemeURI),e("#ctc_child_descr").val(ctcAjax.themes.child[c].Descr),e("#ctc_child_tags").val(ctcAjax.themes.child[c].Tags),e("#ctc_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#input_row_duplicate_theme").show())}},set_notice:function(t){var c=this,n="";c.is_empty(t)||e.each(t,function(t,c){n+='<div class="'+t+'"><ul>\n',e(c).each(function(e,t){n+="<li>"+t.toString()+"</li>\n"}),n+="</ul></div>"}),e("#ctc_error_notice").html(n),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(t){e("#ctc_theme_parnt").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+t.value},set_child_menu:function(t){var c,n,i=this;i.is_empty(ctcAjax.themes.child[t.value])||(c=ctcAjax.themes.child[t.value].Template,n=e("#ctc_theme_parnt").val(),c==n?(e("#ctc_child_name").val(ctcAjax.themes.child[t.value].Name),e("#ctc_child_author").val(ctcAjax.themes.child[t.value].Author),e("#ctc_child_version").val(ctcAjax.themes.child[t.value].Version)):(e("#ctc_theme_child").parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),e(".spinner").show(),document.location="?page="+ctcAjax.page+"&ctc_parent="+c+"&ctc_child="+t.value))},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.current_query=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),c.load_selectors(),void c.scrolltop())},set_selector:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.current_qsid=t,n.reload_menus=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.current_qsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload_menus=!0,c.load_selector_values()},set_addl_css:function(){var t,c=this,n=e("#ctc_theme_parnt").val(),i=ctcAjax.theme_uri.replace(/^https?:\/\//,""),a=ctcAjax.homeurl.replace(/^https?/,ctcAjax.ssl?"https":"http"),r=a+"?preview=1&p=x&template="+n+"&stylesheet="+n,s=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+i+"/"+n+"/(.+?\\.css)[^>]+?>","g");c.is_empty(n)||(n!=ctcAjax.parnt?e.get(r,function(c){for(;(t=s.exec(c))&&"style.css"!=t[1];)t[1].match(/bootstrap/)||e(".ctc_checkbox").each(function(c,n){e(this).val()==t[1]&&e(this).prop("checked",!0)});c=null}):e(ctcAjax.addl_css).each(function(t,c){e("#ctc_stylesheet_files .ctc_checkbox").each(function(t,n){e(this).val()==c&&e(this).prop("checked",!0)})}))},query_css:function(t,c,n){var i=this,a={ctc_query_obj:t,ctc_query_key:c},r="#ctc_status_"+t+("val_qry"==t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){a["ctc_query_"+e]=t}),e(".query-icon").remove(),e(r+" .ctc-status-icon").remove(),e(r).append('<span class="ctc-status-icon spinner query-icon"></span>'),e(".spinner").show(),a.action=i.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_query":"ctc_plgqry",a._wpnonce=e("#_wpnonce").val(),i.ajax_post(t,a)},save:function(t){var c,n,i,a,r,s=this,l=(ctcAjax.ajaxurl,{}),_=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),_.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),l.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"==e(t).attr("id")?(l.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(l.ctc_sel_ovrd_query=n.text()),s.reload_menus=!0):(i=e("#ctc_child_imports"))&&"ctc_save_imports"==_?l.ctc_child_imports=i.val():"ctc_is_debug"==_?l.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:l=s.coalesce_inputs(t),e(".save-icon").show(),e("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){a=e("#ctc_rewrite_selector").val(),r=e("#ctc_rewrite_selector_orig").val(),s.is_empty(a)||!a.toString().match(/\w/)?a=r:(l.ctc_rewrite_selector=a,s.reload_menus=!0),e(".ctc-rewrite-toggle").text(s.getxt("rename")),e("#ctc_sel_ovrd_selector_selected").html(a)}),l.action=s.is_empty(e("#ctc_action").val())||"plugin"!=e("#ctc_action").val()?"ctc_update":"ctc_plugin",l._wpnonce=e("#_wpnonce").val(),s.ajax_post("qsid",l)},ajax_post:function(t,c,n){var i=this,a=ctcAjax.ajaxurl;e.ajax({url:a,data:c,dataType:i.is_empty(n)?"json":n,type:"POST"}).done(function(e){i.handle_success(t,e)}).fail(function(){i.handle_failure(t)})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"==t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,i=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jquery_err.push("<code><small>"+t+": "+e.message+i+n+"</small></code>")},jquery_notice:function(t){var c=this,n=[],i=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(t,i){var a=e(this).prop("src");c.is_empty(a)||!a.match(/jquery(\.min|\.js|\-?ui)/i)||a.match(/load\-scripts.php/)||n.push("<code><small>"+a.split(/\?/)[0]+"</small></code>")}),i.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),i.push(c.jquery_err.join("<br/>")),n.length&&i.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),i.push(c.getxt("plugin")),c.set_notice({error:i})},update:{qsid:function(t){var c,n,i,a=this;a.current_qsid=t.key,a.current_qsdata=t.data,e("#ctc_sel_ovrd_qsid").val(a.current_qsid),a.is_empty(a.current_qsdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+a.current_qsid,i=parseInt(a.current_qsdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+i+'" />',e("#ctc_child_load_order_container").html(n)),a.is_empty(a.current_qsdata.value)?(e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_rule_header").hide()):(n="",e.each(a.current_qsdata.value,function(e,t){n+=a.input_row(a.current_qsid,e,"ovrd",a.current_qsdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){a.setup_spectrum(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch"),e("#ctc_sel_ovrd_rule_header").show()),a.jquery_err.length?a.jquery_notice("update.qsid"):(a.reload_menus&&(a.set_query(a.current_qsdata.query),a.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(a.current_qsdata.selector),e(".ctc-rewrite-toggle").text(a.getxt("rename")),e("#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show())},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),i='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var a=c.decode_value(n,t);i+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+a.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),i+="</div>\n"),e("#ctc_rule_value_inputs").html(i).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c=this,n="";c.is_empty(t.data)||e.each(t.data,function(i,a){page_rule=i,e.each(a,function(a,r){n+='<h4 class="ctc-query-heading">'+a+"</h4>\n",c.is_empty(r)||e.each(r,function(e,a){n+=c.input_row(e,i,t.key,a)})})}),selector="#ctc_selector_"+rule+"_"+t.key+"_rows",e(selector).html(n).find(".color-picker").each(function(){c.setup_spectrum(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice("val_qry")},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_container").html(t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)}},init:function(){var t=this;if(t.autogen_slugs(),t.set_existing(),!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>");return e("#ctc_theme_option_"+c.value).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.is_empty(t.jquery_err)?(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n=e(this).attr("id").toString().replace("_close",""),i=n.toString().match(/_([^_]+)_(\d+)$/);e("#"+n+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(rule=i[1],valid=i[2],t.query_css("val_qry",valid,{rule:rule}))),e("#"+n+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+n+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(c){var n=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(n)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+n+" {\n\n}")}),e("#ctc_configtype").on("change",function(c){var n=e(this).val();if(t.is_empty(n)||"theme"==n){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(i){t.jquery_exception(i,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(i){t.jquery_exception(i,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){c.preventDefault(),e(".ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e(".ctc-section-toggle").on("click",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .update-nag").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){return c.preventDefault(),$this=e("#ctc_save_query_selector"),$this.hasClass("ajax-pending")?!1:($this.addClass("ajax-pending"),t.save($this),!1)}),e("#ctc_theme_child, #ctc_theme_child-button, #ctc_child_type_existing").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!0),e("#ctc_child_type_new").prop("checked",!1),e("#ctc_child_template").val(""),t.set_existing()}),e("#ctc_duplicate_theme").on("click",function(){e("#ctc_duplicate_theme").is(":checked")?(e("#ctc_child_name").val(t.testname),e("#ctc_duplicate_theme_slug").val(t.testslug)):t.set_existing()}),e("#ctc_child_type_new, #ctc_child_template").on("focus click",function(){e("#ctc_child_type_existing").prop("checked",!1),e("#ctc_duplicate_theme").prop("checked",!1),e("#ctc_duplicate_theme_slug").val(""),e("#ctc_child_type_new").prop("checked",!0),e("#input_row_duplicate_theme").hide(),e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug)}),e("#ctc_is_debug").on("change",function(e){t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),t.set_addl_css(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),setTimeout(t.fade_update_notice,2e4)):t.jquery_notice("init")},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmcfg.init()}(jQuery);
js/spectrum.js CHANGED
@@ -466,6 +466,10 @@
466
  set($(e.target).closest(".sp-thumb-el").data("color"));
467
  move();
468
  }
 
 
 
 
469
  else {
470
  set($(e.target).closest(".sp-thumb-el").data("color"));
471
  move();
@@ -506,6 +510,18 @@
506
  }
507
  }
508
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  function addColorToSelectionPalette(color) {
510
  if (showSelectionPalette) {
511
  var rgb = tinycolor(color).toRgbString();
466
  set($(e.target).closest(".sp-thumb-el").data("color"));
467
  move();
468
  }
469
+ else if ( e.altKey ) {
470
+ removeColorFromSelectionPalette( $(e.target).closest(".sp-thumb-el").data("color") );
471
+ drawPalette();
472
+ }
473
  else {
474
  set($(e.target).closest(".sp-thumb-el").data("color"));
475
  move();
510
  }
511
  }
512
 
513
+ function removeColorFromSelectionPalette( rgbString ) {
514
+ while (selectionPalette.indexOf( rgbString ) !== -1) {
515
+ selectionPalette.splice(selectionPalette.indexOf( rgbString ), 1 );
516
+ }
517
+ if (localStorageKey && window.localStorage) {
518
+ try {
519
+ window.localStorage[localStorageKey] = selectionPalette.join(";");
520
+ }
521
+ catch(e) { }
522
+ }
523
+ }
524
+
525
  function addColorToSelectionPalette(color) {
526
  if (showSelectionPalette) {
527
  var rgb = tinycolor(color).toRgbString();
js/spectrum.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t:t(jQuery)}(function(t,e){"use strict";function r(e,r,n,a){for(var i=[],s=0;s<e.length;s++){var o=e[s];if(o){var l=tinycolor(o),c=l.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=tinycolor.equals(r,o)?" sp-thumb-active":"";var f=l.toString(a.preferredFormat||"rgb"),u=b?"background-color:"+l.toRgbString():"filter:"+l.toFilter();i.push('<span title="'+f+'" data-color="'+l.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+u+';" /></span>')}else{var h="sp-clear-display";i.push(t("<div />").append(t('<span data-color="" style="background-color:transparent;" class="'+h+'"></span>').attr("title",a.noColorSelectedText)).html())}}return"<div class='sp-cf "+n+"'>"+i.join("")+"</div>"}function n(){for(var t=0;t<p.length;t++)p[t]&&p[t].hide()}function a(e,r){var n=t.extend({},d,e);return n.callbacks={move:c(n.move,r),change:c(n.change,r),show:c(n.show,r),hide:c(n.hide,r),beforeShow:c(n.beforeShow,r)},n}function i(i,o){function c(){if(W.showPaletteOnly&&(W.showPalette=!0),Dt.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),W.palette){dt=W.palette.slice(0),pt=t.isArray(dt[0])?dt:[dt],gt={};for(var e=0;e<pt.length;e++)for(var r=0;r<pt[e].length;r++){var n=tinycolor(pt[e][r]).toRgbString();gt[n]=!0}}kt.toggleClass("sp-flat",X),kt.toggleClass("sp-input-disabled",!W.showInput),kt.toggleClass("sp-alpha-enabled",W.showAlpha),kt.toggleClass("sp-clear-enabled",Jt),kt.toggleClass("sp-buttons-disabled",!W.showButtons),kt.toggleClass("sp-palette-buttons-disabled",!W.togglePaletteOnly),kt.toggleClass("sp-palette-disabled",!W.showPalette),kt.toggleClass("sp-palette-only",W.showPaletteOnly),kt.toggleClass("sp-initial-disabled",!W.showInitial),kt.addClass(W.className).addClass(W.containerClassName),z()}function d(){function e(e){return e.data&&e.data.ignore?(O(t(e.target).closest(".sp-thumb-el").data("color")),j()):(O(t(e.target).closest(".sp-thumb-el").data("color")),j(),I(!0),W.hideAfterPaletteSelect&&F()),!1}if(g&&kt.find("*:not(input)").attr("unselectable","on"),c(),Bt&&_t.after(Lt),Jt||jt.hide(),X)_t.after(kt).hide();else{var r="parent"===W.appendTo?_t.parent():t(W.appendTo);1!==r.length&&(r=t("body")),r.append(kt)}y(),Kt.on("click.spectrum touchstart.spectrum",function(e){xt||A(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(_t.is(":disabled")||W.disabled===!0)&&V(),kt.click(l),Tt.change(P),Tt.bind("paste",function(){setTimeout(P,1)}),Tt.keydown(function(t){13==t.keyCode&&P()}),Et.text(W.cancelText),Et.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),T(),F()}),jt.attr("title",W.clearText),jt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Qt=!0,j(),X&&I(!0)}),qt.text(W.chooseText),qt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),g&&Tt.is(":focus")&&Tt.trigger("change"),E()&&(I(!0),F())}),Dt.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),Dt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),W.showPaletteOnly=!W.showPaletteOnly,W.showPaletteOnly||X||kt.css("left","-="+(St.outerWidth(!0)+5)),c()}),f(Ht,function(t,e,r){ht=t/st,Qt=!1,r.shiftKey&&(ht=Math.round(10*ht)/10),j()},S,C),f(At,function(t,e){ct=parseFloat(e/at),Qt=!1,W.showAlpha||(ht=1),j()},S,C),f(Ct,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 s=!yt||"x"===yt,o=!yt||"y"===yt;s&&(ft=parseFloat(t/et)),o&&(ut=parseFloat((rt-e)/rt)),Qt=!1,W.showAlpha||(ht=1),j()},S,C),$t?(O($t),q(),w($t)):q(),X&&M();var n=g?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Ot.delegate(".sp-thumb-el",n,e),Nt.delegate(".sp-thumb-el:nth-child(1)",n,{ignore:!0},e)}function y(){if(G&&window.localStorage){try{var e=window.localStorage[G].split(",#");e.length>1&&(delete window.localStorage[G],t.each(e,function(t,e){w(e)}))}catch(r){}try{bt=window.localStorage[G].split(";")}catch(r){}}}function w(e){if(Y){var r=tinycolor(e).toRgbString();if(!gt[r]&&-1===t.inArray(r,bt))for(bt.push(r);bt.length>vt;)bt.shift();if(G&&window.localStorage)try{window.localStorage[G]=bt.join(";")}catch(n){}}}function _(){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 x(){var e=N(),n=t.map(pt,function(t,n){return r(t,e,"sp-palette-row sp-palette-row-"+n,W)});y(),bt&&n.push(r(_(),e,"sp-palette-row sp-palette-row-selection",W)),Ot.html(n.join(""))}function k(){if(W.showInitial){var t=Wt,e=N();Nt.html(r([t,e],e,"sp-palette-row-initial",W))}}function S(){(0>=rt||0>=et||0>=at)&&z(),tt=!0,kt.addClass(mt),yt=null,_t.trigger("dragstart.spectrum",[N()])}function C(){tt=!1,kt.removeClass(mt),_t.trigger("dragstop.spectrum",[N()])}function P(t){var e=Tt.val();if(null!==e&&""!==e||!Jt){var r=tinycolor(e);r.isValid()?(Xt=Yt=r.getFormat(),O(r),I(!0)):Tt.addClass("sp-validation-error")}else O(null),I(!0)}function A(){Z?F():M()}function M(){var e=t.Event("beforeShow.spectrum");return Z?void z():(_t.trigger(e,[N()]),void(J.beforeShow(N())===!1||e.isDefaultPrevented()||(n(),Z=!0,t(wt).bind("keydown.spectrum",R),t(wt).bind("click.spectrum",H),t(window).bind("resize.spectrum",U),Lt.addClass("sp-active"),kt.removeClass("sp-hidden"),z(),q(),Wt=N(),k(),J.show(Wt),_t.trigger("show.spectrum",[Wt]))))}function R(t){27===t.keyCode&&F()}function H(t){2!=t.button&&(tt||(Gt?I(!0):T(),F()))}function F(){Z&&!X&&(Z=!1,t(wt).unbind("keydown.spectrum",R),t(wt).unbind("click.spectrum",H),t(window).unbind("resize.spectrum",U),Lt.removeClass("sp-active"),kt.addClass("sp-hidden"),J.hide(N()),_t.trigger("hide.spectrum",[N()]))}function T(){O(Wt,!0)}function O(t,e){if(tinycolor.equals(t,N()))return void q();var r,n,a;!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),q(),r&&r.isValid()&&!e&&(a=r.getFormat(),"name"===a&&(Xt=a),Yt=Xt||a)}function N(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 E(){return!Tt.hasClass("sp-validation-error")}function j(){q(),J.move(N()),_t.trigger("move.spectrum",[N()])}function q(){Tt.removeClass("sp-validation-error"),D();var t=tinycolor.fromRatio({h:ct,s:1,v:1});Ct.css("background-color",t.toHexString());var e=Yt;1>ht&&(0!==ht||"name"!==e)&&("hex"===e||"hex3"===e||"hex6"===e||"name"===e)&&(e="rgb");var r=N({format:e}),n="";if(Vt.removeClass("sp-clear-display"),Vt.css("background-color","transparent"),!r&&Jt)Vt.addClass("sp-clear-display");else{var a=r.toHexString(),i=r.toRgbString();if(b||1===r.alpha?Vt.css("background-color",i):(Vt.css("background-color","transparent"),Vt.css("filter",r.toFilter())),W.showAlpha){var s=r.toRgb();s.a=0;var o=tinycolor(s).toRgbString(),l="linear-gradient(left, "+o+", "+a+")";g?Rt.css("filter",tinycolor(o).toFilter({gradientType:1},a)):(Rt.css("background","-webkit-"+l),Rt.css("background","-moz-"+l),Rt.css("background","-ms-"+l),Rt.css("background","linear-gradient(to right, "+o+", "+a+")"))}n=r.toString(e)}W.showInput&&Tt.val(n),W.showPalette&&x(),k()}function D(){var t=ft,e=ut;if(Jt&&Qt)Ft.hide(),Mt.hide(),Pt.hide();else{Ft.show(),Mt.show(),Pt.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)),Pt.css({top:n+"px",left:r+"px"});var a=ht*st;Ft.css({left:a-ot/2+"px"});var i=ct*at;Mt.css({top:i-lt+"px"})}}function I(t){var e=N(),r="",n=!tinycolor.equals(e,Wt),a=Yt;e&&(1>ht&&(0!==ht||"name"!==a)&&("hex"===a||"hex3"===a||"hex6"===a||"name"===a)&&(a="rgb"),r=e.toString(a),w(e)),It&&_t.val(r),t&&n&&(J.change(e),_t.trigger("change",[e]))}function z(){et=Ct.width(),rt=Ct.height(),nt=Pt.height(),it=At.width(),at=At.height(),lt=Mt.height(),st=Ht.width(),ot=Ft.width(),X||(kt.css("position","absolute"),kt.offset(W.offset?W.offset:s(kt,Kt))),D(),W.showPalette&&x(),_t.trigger("reflow.spectrum")}function B(){_t.show(),Kt.unbind("click.spectrum touchstart.spectrum"),kt.remove(),Lt.remove(),p[Ut.id]=null}function L(r,n){return r===e?t.extend({},W):n===e?W[r]:(W[r]=n,void c())}function K(){xt=!1,_t.attr("disabled",!1),Kt.removeClass("sp-disabled")}function V(){F(),xt=!0,_t.attr("disabled",!0),Kt.addClass("sp-disabled")}function $(t){W.offset=t,z()}var W=a(o,i),X=W.flat,Y=W.showSelectionPalette,G=W.localStorageKey,Q=W.theme,J=W.callbacks,U=u(z,10),Z=!1,tt=!1,et=0,rt=0,nt=0,at=0,it=0,st=0,ot=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=i.ownerDocument,_t=(wt.body,t(i)),xt=!1,kt=t(m,wt).addClass(Q),St=kt.find(".sp-picker-container"),Ct=kt.find(".sp-color"),Pt=kt.find(".sp-dragger"),At=kt.find(".sp-hue"),Mt=kt.find(".sp-slider"),Rt=kt.find(".sp-alpha-inner"),Ht=kt.find(".sp-alpha"),Ft=kt.find(".sp-alpha-handle"),Tt=kt.find(".sp-input"),Ot=kt.find(".sp-palette"),Nt=kt.find(".sp-initial"),Et=kt.find(".sp-cancel"),jt=kt.find(".sp-clear"),qt=kt.find(".sp-choose"),Dt=kt.find(".sp-palette-toggle"),It=_t.is("input"),zt=It&&"color"===_t.attr("type")&&h(),Bt=It&&!X,Lt=Bt?t(v).addClass(Q).addClass(W.className).addClass(W.replacerClassName):t([]),Kt=Bt?Lt:_t,Vt=Lt.find(".sp-preview-inner"),$t=W.color||It&&_t.val(),Wt=!1,Xt=W.preferredFormat,Yt=Xt,Gt=!W.showButtons||W.clickoutFiresChange,Qt=!$t,Jt=W.allowEmpty&&!zt;d();var Ut={show:M,hide:F,toggle:A,reflow:z,option:L,enable:K,disable:V,offset:$,set:function(t){O(t)},get:N,destroy:B,container:kt};return Ut.id=p.push(Ut)-1,Ut}function s(e,r){var n=0,a=e.outerWidth(),i=e.outerHeight(),s=r.outerHeight(),o=e[0].ownerDocument,l=o.documentElement,c=l.clientWidth+t(o).scrollLeft(),f=l.clientHeight+t(o).scrollTop(),u=r.offset();return u.top+=s,u.left-=Math.min(u.left,u.left+a>c&&c>a?Math.abs(u.left+a-c):0),u.top-=Math.min(u.top,u.top+i>f&&f>i?Math.abs(i+s-n):n),u}function o(){}function l(t){t.stopPropagation()}function c(t,e){var r=Array.prototype.slice,n=r.call(arguments,2);return function(){return t.apply(e,n.concat(r.call(arguments)))}}function f(e,r,n,a){function i(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function s(t){if(f){if(g&&c.documentMode<9&&!t.button)return l();var n=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],a=n&&n.pageX||t.pageX,s=n&&n.pageY||t.pageY,o=Math.max(0,Math.min(a-u.left,d)),b=Math.max(0,Math.min(s-u.top,h));p&&i(t),r.apply(e,[o,b,t])}}function o(r){var a=r.which?3==r.which:2==r.button;a||f||n.apply(e,arguments)!==!1&&(f=!0,h=t(e).height(),d=t(e).width(),u=t(e).offset(),t(c).bind(b),t(c.body).addClass("sp-dragging"),s(r),i(r))}function l(){f&&(t(c).unbind(b),t(c.body).removeClass("sp-dragging"),setTimeout(function(){a.apply(e,arguments)},0)),f=!1}r=r||function(){},n=n||function(){},a=a||function(){};var c=document,f=!1,u={},h=0,d=0,p="ontouchstart"in window,b={};b.selectstart=i,b.dragstart=i,b["touchmove mousemove"]=s,b["touchend mouseup"]=l,t(e).bind("touchstart mousedown",o)}function u(t,e,r){var n;return function(){var a=this,i=arguments,s=function(){n=null,t.apply(a,i)};r&&clearTimeout(n),(r||!n)&&(n=setTimeout(s,e))}}function h(){return t.fn.spectrum.inputTypeColorSupport()}var d={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},p=[],g=!!/msie/i.exec(window.navigator.userAgent),b=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")}(),v=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),m=function(){var t="";if(g)for(var e=1;6>=e;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("")}(),y="spectrum.id";t.fn.spectrum=function(e,r){if("string"==typeof e){var n=this,a=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=p[t(this).data(y)];if(r){var i=r[e];if(!i)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?n=r.get():"container"==e?n=r.container:"option"==e?n=r.option.apply(r,a):"destroy"==e?(r.destroy(),t(this).removeData(y)):i.apply(r,a)}}),n}return this.spectrum("destroy").each(function(){var r=t.extend({},e,t(this).data()),n=i(this,r);t(this).data(y,n.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=f,t.fn.spectrum.defaults=d,t.fn.spectrum.inputTypeColorSupport=function w(){if("undefined"==typeof w._cachedResult){var e=t("<input type='color' value='!' />")[0];w._cachedResult="color"===e.type&&"!"!==e.value}return w._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!h()&&e.spectrum({preferredFormat:"hex6"})},function(){function t(t){var r={r:0,g:0,b:0},a=1,s=!1,o=!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),s=!0,o="%"===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),s=!0,o="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),s=!0,o="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=x(a),{ok:s,format:t.format||o,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,a,i=I(t,e,r),s=D(t,e,r),o=(i+s)/2;if(i==s)n=a=0;else{var l=i-s;switch(a=o>.5?l/(2-i-s):l/(i+s),i){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:a,l:o}}function n(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var a,i,s;if(t=k(t,360),e=k(e,100),r=k(r,100),0===e)a=i=s=r;else{var o=.5>r?r*(1+e):r+e-r*e,l=2*r-o;a=n(l,o,t+1/3),i=n(l,o,t),s=n(l,o,t-1/3)}return{r:255*a,g:255*i,b:255*s}}function a(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n,a,i=I(t,e,r),s=D(t,e,r),o=i,l=i-s;if(a=0===i?0:l/i,i==s)n=0;else{switch(i){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:a,v:o}}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),s=r*(1-a*e),o=r*(1-(1-a)*e),l=n%6,c=[r,s,i,i,o,r][l],f=[o,r,r,s,i,i][l],u=[i,i,o,r,r,s][l];return{r:255*c,g:255*f,b:255*u}}function s(t,e,r,n){var a=[M(q(t).toString(16)),M(q(e).toString(16)),M(q(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 o(t,e,r,n){var a=[M(H(n)),M(q(t).toString(16)),M(q(e).toString(16)),M(q(r).toString(16))];return a.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-q(255*-(e/100)))),r.g=I(0,D(255,r.g-q(255*-(e/100)))),r.b=I(0,D(255,r.b-q(255*-(e/100)))),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=(q(r.h)+e)%360;return r.h=0>n?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,s=[],o=1/e;e--;)s.push(B({h:n,s:a,v:i})),i=(i+o)%1;return s}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)||0>t||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 1>=t&&(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(N,"").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"}:!1}var O=/^[\s,#]+/,N=/\s+$/,E=0,j=Math,q=j.round,D=j.min,I=j.max,z=j.random,B=function(e,r){if(e=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=q(100*this._a)/100,this._format=r.format||n.format,this._gradientType=r.gradientType,this._r<1&&(this._r=q(this._r)),this._g<1&&(this._g=q(this._g)),this._b<1&&(this._b=q(this._b)),this._ok=n.ok,this._tc_id=E++};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=q(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=q(360*t.h),r=q(100*t.s),n=q(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=q(360*t.h),n=q(100*t.s),a=q(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+a+"%)":"hsla("+e+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return s(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return o(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*k(this._r,255))+"%",g:q(100*k(this._g,255))+"%",b:q(100*k(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*k(this._r,255))+"%, "+q(100*k(this._g,255))+"%, "+q(100*k(this._b,255))+"%)":"rgba("+q(100*k(this._r,255))+"%, "+q(100*k(this._g,255))+"%, "+q(100*k(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:K[s(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var e="#"+o(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=B(t);r=a.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,a=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("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())},_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)&&("a"===n?r[n]=t[n]:r[n]=R(t[n]));t=r}return B(t,e)},B.equals=function(t,e){return t&&e?B(t).toRgbString()==B(e).toRgbString():!1},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,a=B(t).toRgb(),i=B(e).toRgb(),s=r/100,o=2*s-1,l=i.a-a.a;n=o*l==-1?o:(o+l)/(1+o*l),n=(n+1)/2;var c=1-n,f={r:i.r*n+a.r*c,g:i.g*n+a.g*c,b:i.b*n+a.b*c,a:i.a*s+a.a*(1-s)};return B(f)},B.readability=function(t,e){var r=B(t),n=B(e),a=r.toRgb(),i=n.toRgb(),s=r.getBrightness(),o=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(s-o),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 s=B.readability(t,e[i]),o=s.brightness>125&&s.color>500,l=3*(s.brightness/125)+s.color/500;(o&&!a||o&&a&&l>n||!o&&!a&&l>n)&&(a=o,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}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})});
1
+ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t:t(jQuery)}(function(t,e){"use strict";function r(e,r,n,a){for(var i=[],s=0;s<e.length;s++){var o=e[s];if(o){var l=tinycolor(o),c=l.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=tinycolor.equals(r,o)?" sp-thumb-active":"";var f=l.toString(a.preferredFormat||"rgb"),u=b?"background-color:"+l.toRgbString():"filter:"+l.toFilter();i.push('<span title="'+f+'" data-color="'+l.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+u+';" /></span>')}else{var h="sp-clear-display";i.push(t("<div />").append(t('<span data-color="" style="background-color:transparent;" class="'+h+'"></span>').attr("title",a.noColorSelectedText)).html())}}return"<div class='sp-cf "+n+"'>"+i.join("")+"</div>"}function n(){for(var t=0;t<p.length;t++)p[t]&&p[t].hide()}function a(e,r){var n=t.extend({},d,e);return n.callbacks={move:c(n.move,r),change:c(n.change,r),show:c(n.show,r),hide:c(n.hide,r),beforeShow:c(n.beforeShow,r)},n}function i(i,o){function c(){if(X.showPaletteOnly&&(X.showPalette=!0),It.text(X.showPaletteOnly?X.togglePaletteMoreText:X.togglePaletteLessText),X.palette){pt=X.palette.slice(0),gt=t.isArray(pt[0])?pt:[pt],bt={};for(var e=0;e<gt.length;e++)for(var r=0;r<gt[e].length;r++){var n=tinycolor(gt[e][r]).toRgbString();bt[n]=!0}}St.toggleClass("sp-flat",Y),St.toggleClass("sp-input-disabled",!X.showInput),St.toggleClass("sp-alpha-enabled",X.showAlpha),St.toggleClass("sp-clear-enabled",Ut),St.toggleClass("sp-buttons-disabled",!X.showButtons),St.toggleClass("sp-palette-buttons-disabled",!X.togglePaletteOnly),St.toggleClass("sp-palette-disabled",!X.showPalette),St.toggleClass("sp-palette-only",X.showPaletteOnly),St.toggleClass("sp-initial-disabled",!X.showInitial),St.addClass(X.className).addClass(X.containerClassName),B()}function d(){function e(e){return e.data&&e.data.ignore?(N(t(e.target).closest(".sp-thumb-el").data("color")),q()):e.altKey?(w(t(e.target).closest(".sp-thumb-el").data("color")),k()):(N(t(e.target).closest(".sp-thumb-el").data("color")),q(),z(!0),X.hideAfterPaletteSelect&&T()),!1}if(g&&St.find("*:not(input)").attr("unselectable","on"),c(),Lt&&xt.after(Kt),Ut||qt.hide(),Y)xt.after(St).hide();else{var r="parent"===X.appendTo?xt.parent():t(X.appendTo);1!==r.length&&(r=t("body")),r.append(St)}y(),Vt.on("click.spectrum touchstart.spectrum",function(e){kt||M(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(xt.is(":disabled")||X.disabled===!0)&&$(),St.click(l),Ot.change(A),Ot.bind("paste",function(){setTimeout(A,1)}),Ot.keydown(function(t){13==t.keyCode&&A()}),Et.text(X.cancelText),Et.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),O(),T()}),qt.attr("title",X.clearText),qt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Jt=!0,q(),Y&&z(!0)}),Dt.text(X.chooseText),Dt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),g&&Ot.is(":focus")&&Ot.trigger("change"),E()&&(z(!0),T())}),It.text(X.showPaletteOnly?X.togglePaletteMoreText:X.togglePaletteLessText),It.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),X.showPaletteOnly=!X.showPaletteOnly,X.showPaletteOnly||Y||St.css("left","-="+(Ct.outerWidth(!0)+5)),c()}),f(Ft,function(t,e,r){dt=t/ot,Jt=!1,r.shiftKey&&(dt=Math.round(10*dt)/10),q()},C,P),f(Mt,function(t,e){ft=parseFloat(e/it),Jt=!1,X.showAlpha||(dt=1),q()},C,P),f(Pt,function(t,e,r){if(r.shiftKey){if(!wt){var n=ut*rt,a=nt-ht*nt,i=Math.abs(t-n)>Math.abs(e-a);wt=i?"x":"y"}}else wt=null;var s=!wt||"x"===wt,o=!wt||"y"===wt;s&&(ut=parseFloat(t/rt)),o&&(ht=parseFloat((nt-e)/nt)),Jt=!1,X.showAlpha||(dt=1),q()},C,P),Wt?(N(Wt),D(),_(Wt)):D(),Y&&R();var n=g?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Nt.delegate(".sp-thumb-el",n,e),jt.delegate(".sp-thumb-el:nth-child(1)",n,{ignore:!0},e)}function y(){if(Q&&window.localStorage){try{var e=window.localStorage[Q].split(",#");e.length>1&&(delete window.localStorage[Q],t.each(e,function(t,e){_(e)}))}catch(r){}try{vt=window.localStorage[Q].split(";")}catch(r){}}}function w(t){for(;-1!==vt.indexOf(t);)vt.splice(vt.indexOf(t),1);if(Q&&window.localStorage)try{window.localStorage[Q]=vt.join(";")}catch(e){}}function _(e){if(G){var r=tinycolor(e).toRgbString();if(!bt[r]&&-1===t.inArray(r,vt))for(vt.push(r);vt.length>mt;)vt.shift();if(Q&&window.localStorage)try{window.localStorage[Q]=vt.join(";")}catch(n){}}}function x(){var t=[];if(X.showPalette)for(var e=0;e<vt.length;e++){var r=tinycolor(vt[e]).toRgbString();bt[r]||t.push(vt[e])}return t.reverse().slice(0,X.maxSelectionSize)}function k(){var e=j(),n=t.map(gt,function(t,n){return r(t,e,"sp-palette-row sp-palette-row-"+n,X)});y(),vt&&n.push(r(x(),e,"sp-palette-row sp-palette-row-selection",X)),Nt.html(n.join(""))}function S(){if(X.showInitial){var t=Xt,e=j();jt.html(r([t,e],e,"sp-palette-row-initial",X))}}function C(){(0>=nt||0>=rt||0>=it)&&B(),et=!0,St.addClass(yt),wt=null,xt.trigger("dragstart.spectrum",[j()])}function P(){et=!1,St.removeClass(yt),xt.trigger("dragstop.spectrum",[j()])}function A(t){var e=Ot.val();if(null!==e&&""!==e||!Ut){var r=tinycolor(e);r.isValid()?(Yt=Gt=r.getFormat(),N(r),z(!0)):Ot.addClass("sp-validation-error")}else N(null),z(!0)}function M(){tt?T():R()}function R(){var e=t.Event("beforeShow.spectrum");return tt?void B():(xt.trigger(e,[j()]),void(U.beforeShow(j())===!1||e.isDefaultPrevented()||(n(),tt=!0,t(_t).bind("keydown.spectrum",H),t(_t).bind("click.spectrum",F),t(window).bind("resize.spectrum",Z),Kt.addClass("sp-active"),St.removeClass("sp-hidden"),B(),D(),Xt=j(),S(),U.show(Xt),xt.trigger("show.spectrum",[Xt]))))}function H(t){27===t.keyCode&&T()}function F(t){2!=t.button&&(et||(Qt?z(!0):O(),T()))}function T(){tt&&!Y&&(tt=!1,t(_t).unbind("keydown.spectrum",H),t(_t).unbind("click.spectrum",F),t(window).unbind("resize.spectrum",Z),Kt.removeClass("sp-active"),St.addClass("sp-hidden"),U.hide(j()),xt.trigger("hide.spectrum",[j()]))}function O(){N(Xt,!0)}function N(t,e){if(tinycolor.equals(t,j()))return void D();var r,n,a;!t&&Ut?Jt=!0:(Jt=!1,r=tinycolor(t),n=r.toHsv(),ft=n.h%360/360,ut=n.s,ht=n.v,dt=n.a),D(),r&&r.isValid()&&!e&&(a=r.getFormat(),"name"===a&&(Yt=a),Gt=Yt||a)}function j(t){return t=t||{},Ut&&Jt?null:tinycolor.fromRatio({h:ft,s:ut,v:ht,a:Math.round(100*dt)/100},{format:t.format||Gt})}function E(){return!Ot.hasClass("sp-validation-error")}function q(){D(),U.move(j()),xt.trigger("move.spectrum",[j()])}function D(){Ot.removeClass("sp-validation-error"),I();var t=tinycolor.fromRatio({h:ft,s:1,v:1});Pt.css("background-color",t.toHexString());var e=Gt;1>dt&&(0!==dt||"name"!==e)&&("hex"===e||"hex3"===e||"hex6"===e||"name"===e)&&(e="rgb");var r=j({format:e}),n="";if($t.removeClass("sp-clear-display"),$t.css("background-color","transparent"),!r&&Ut)$t.addClass("sp-clear-display");else{var a=r.toHexString(),i=r.toRgbString();if(b||1===r.alpha?$t.css("background-color",i):($t.css("background-color","transparent"),$t.css("filter",r.toFilter())),X.showAlpha){var s=r.toRgb();s.a=0;var o=tinycolor(s).toRgbString(),l="linear-gradient(left, "+o+", "+a+")";g?Ht.css("filter",tinycolor(o).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, "+o+", "+a+")"))}n=r.toString(e)}X.showInput&&Ot.val(n),X.showPalette&&k(),S()}function I(){var t=ut,e=ht;if(Ut&&Jt)Tt.hide(),Rt.hide(),At.hide();else{Tt.show(),Rt.show(),At.show();var r=t*rt,n=nt-e*nt;r=Math.max(-at,Math.min(rt-at,r-at)),n=Math.max(-at,Math.min(nt-at,n-at)),At.css({top:n+"px",left:r+"px"});var a=dt*ot;Tt.css({left:a-lt/2+"px"});var i=ft*it;Rt.css({top:i-ct+"px"})}}function z(t){var e=j(),r="",n=!tinycolor.equals(e,Xt),a=Gt;e&&(1>dt&&(0!==dt||"name"!==a)&&("hex"===a||"hex3"===a||"hex6"===a||"name"===a)&&(a="rgb"),r=e.toString(a),_(e)),zt&&xt.val(r),t&&n&&(U.change(e),xt.trigger("change",[e]))}function B(){rt=Pt.width(),nt=Pt.height(),at=At.height(),st=Mt.width(),it=Mt.height(),ct=Rt.height(),ot=Ft.width(),lt=Tt.width(),Y||(St.css("position","absolute"),St.offset(X.offset?X.offset:s(St,Vt))),I(),X.showPalette&&k(),xt.trigger("reflow.spectrum")}function L(){xt.show(),Vt.unbind("click.spectrum touchstart.spectrum"),St.remove(),Kt.remove(),p[Zt.id]=null}function K(r,n){return r===e?t.extend({},X):n===e?X[r]:(X[r]=n,void c())}function V(){kt=!1,xt.attr("disabled",!1),Vt.removeClass("sp-disabled")}function $(){T(),kt=!0,xt.attr("disabled",!0),Vt.addClass("sp-disabled")}function W(t){X.offset=t,B()}var X=a(o,i),Y=X.flat,G=X.showSelectionPalette,Q=X.localStorageKey,J=X.theme,U=X.callbacks,Z=u(B,10),tt=!1,et=!1,rt=0,nt=0,at=0,it=0,st=0,ot=0,lt=0,ct=0,ft=0,ut=0,ht=0,dt=1,pt=[],gt=[],bt={},vt=X.selectionPalette.slice(0),mt=X.maxSelectionSize,yt="sp-dragging",wt=null,_t=i.ownerDocument,xt=(_t.body,t(i)),kt=!1,St=t(m,_t).addClass(J),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"),Nt=St.find(".sp-palette"),jt=St.find(".sp-initial"),Et=St.find(".sp-cancel"),qt=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")&&h(),Lt=zt&&!Y,Kt=Lt?t(v).addClass(J).addClass(X.className).addClass(X.replacerClassName):t([]),Vt=Lt?Kt:xt,$t=Kt.find(".sp-preview-inner"),Wt=X.color||zt&&xt.val(),Xt=!1,Yt=X.preferredFormat,Gt=Yt,Qt=!X.showButtons||X.clickoutFiresChange,Jt=!Wt,Ut=X.allowEmpty&&!Bt;d();var Zt={show:R,hide:T,toggle:M,reflow:B,option:K,enable:V,disable:$,offset:W,set:function(t){N(t)},get:j,destroy:L,container:St};return Zt.id=p.push(Zt)-1,Zt}function s(e,r){var n=0,a=e.outerWidth(),i=e.outerHeight(),s=r.outerHeight(),o=e[0].ownerDocument,l=o.documentElement,c=l.clientWidth+t(o).scrollLeft(),f=l.clientHeight+t(o).scrollTop(),u=r.offset();return u.top+=s,u.left-=Math.min(u.left,u.left+a>c&&c>a?Math.abs(u.left+a-c):0),u.top-=Math.min(u.top,u.top+i>f&&f>i?Math.abs(i+s-n):n),u}function o(){}function l(t){t.stopPropagation()}function c(t,e){var r=Array.prototype.slice,n=r.call(arguments,2);return function(){return t.apply(e,n.concat(r.call(arguments)))}}function f(e,r,n,a){function i(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function s(t){if(f){if(g&&c.documentMode<9&&!t.button)return l();var n=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],a=n&&n.pageX||t.pageX,s=n&&n.pageY||t.pageY,o=Math.max(0,Math.min(a-u.left,d)),b=Math.max(0,Math.min(s-u.top,h));p&&i(t),r.apply(e,[o,b,t])}}function o(r){var a=r.which?3==r.which:2==r.button;a||f||n.apply(e,arguments)!==!1&&(f=!0,h=t(e).height(),d=t(e).width(),u=t(e).offset(),t(c).bind(b),t(c.body).addClass("sp-dragging"),s(r),i(r))}function l(){f&&(t(c).unbind(b),t(c.body).removeClass("sp-dragging"),setTimeout(function(){a.apply(e,arguments)},0)),f=!1}r=r||function(){},n=n||function(){},a=a||function(){};var c=document,f=!1,u={},h=0,d=0,p="ontouchstart"in window,b={};b.selectstart=i,b.dragstart=i,b["touchmove mousemove"]=s,b["touchend mouseup"]=l,t(e).bind("touchstart mousedown",o)}function u(t,e,r){var n;return function(){var a=this,i=arguments,s=function(){n=null,t.apply(a,i)};r&&clearTimeout(n),(r||!n)&&(n=setTimeout(s,e))}}function h(){return t.fn.spectrum.inputTypeColorSupport()}var d={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},p=[],g=!!/msie/i.exec(window.navigator.userAgent),b=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")}(),v=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),m=function(){var t="";if(g)for(var e=1;6>=e;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("")}(),y="spectrum.id";t.fn.spectrum=function(e,r){if("string"==typeof e){var n=this,a=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=p[t(this).data(y)];if(r){var i=r[e];if(!i)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?n=r.get():"container"==e?n=r.container:"option"==e?n=r.option.apply(r,a):"destroy"==e?(r.destroy(),t(this).removeData(y)):i.apply(r,a)}}),n}return this.spectrum("destroy").each(function(){var r=t.extend({},e,t(this).data()),n=i(this,r);t(this).data(y,n.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=f,t.fn.spectrum.defaults=d,t.fn.spectrum.inputTypeColorSupport=function w(){if("undefined"==typeof w._cachedResult){var e=t("<input type='color' value='!' />")[0];w._cachedResult="color"===e.type&&"!"!==e.value}return w._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!h()&&e.spectrum({preferredFormat:"hex6"})},function(){function t(t){var r={r:0,g:0,b:0},a=1,s=!1,o=!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),s=!0,o="%"===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),s=!0,o="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),s=!0,o="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=x(a),{ok:s,format:t.format||o,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,a,i=I(t,e,r),s=D(t,e,r),o=(i+s)/2;if(i==s)n=a=0;else{var l=i-s;switch(a=o>.5?l/(2-i-s):l/(i+s),i){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:a,l:o}}function n(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var a,i,s;if(t=k(t,360),e=k(e,100),r=k(r,100),0===e)a=i=s=r;else{var o=.5>r?r*(1+e):r+e-r*e,l=2*r-o;a=n(l,o,t+1/3),i=n(l,o,t),s=n(l,o,t-1/3)}return{r:255*a,g:255*i,b:255*s}}function a(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var n,a,i=I(t,e,r),s=D(t,e,r),o=i,l=i-s;if(a=0===i?0:l/i,i==s)n=0;else{switch(i){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:a,v:o}}function i(t,e,r){t=6*k(t,360),e=k(e,100),r=k(r,100);var n=E.floor(t),a=t-n,i=r*(1-e),s=r*(1-a*e),o=r*(1-(1-a)*e),l=n%6,c=[r,s,i,i,o,r][l],f=[o,r,r,s,i,i][l],u=[i,i,o,r,r,s][l];return{r:255*c,g:255*f,b:255*u}}function s(t,e,r,n){var a=[M(q(t).toString(16)),M(q(e).toString(16)),M(q(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 o(t,e,r,n){var a=[M(H(n)),M(q(t).toString(16)),M(q(e).toString(16)),M(q(r).toString(16))];return a.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-q(255*-(e/100)))),r.g=I(0,D(255,r.g-q(255*-(e/100)))),r.b=I(0,D(255,r.b-q(255*-(e/100)))),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=(q(r.h)+e)%360;return r.h=0>n?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,s=[],o=1/e;e--;)s.push(B({h:n,s:a,v:i})),i=(i+o)%1;return s}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)||0>t||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),E.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 1>=t&&(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(N,"").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"}:!1}var O=/^[\s,#]+/,N=/\s+$/,j=0,E=Math,q=E.round,D=E.min,I=E.max,z=E.random,B=function(e,r){if(e=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=q(100*this._a)/100,this._format=r.format||n.format,this._gradientType=r.gradientType,this._r<1&&(this._r=q(this._r)),this._g<1&&(this._g=q(this._g)),this._b<1&&(this._b=q(this._b)),this._ok=n.ok,this._tc_id=j++};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=q(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=q(360*t.h),r=q(100*t.s),n=q(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=q(360*t.h),n=q(100*t.s),a=q(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+a+"%)":"hsla("+e+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return s(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return o(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*k(this._r,255))+"%",g:q(100*k(this._g,255))+"%",b:q(100*k(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*k(this._r,255))+"%, "+q(100*k(this._g,255))+"%, "+q(100*k(this._b,255))+"%)":"rgba("+q(100*k(this._r,255))+"%, "+q(100*k(this._g,255))+"%, "+q(100*k(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:K[s(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var e="#"+o(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=B(t);r=a.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,a=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("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())},_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)&&("a"===n?r[n]=t[n]:r[n]=R(t[n]));t=r}return B(t,e)},B.equals=function(t,e){return t&&e?B(t).toRgbString()==B(e).toRgbString():!1},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,a=B(t).toRgb(),i=B(e).toRgb(),s=r/100,o=2*s-1,l=i.a-a.a;n=o*l==-1?o:(o+l)/(1+o*l),n=(n+1)/2;var c=1-n,f={r:i.r*n+a.r*c,g:i.g*n+a.g*c,b:i.b*n+a.b*c,a:i.a*s+a.a*(1-s)};return B(f)},B.readability=function(t,e){var r=B(t),n=B(e),a=r.toRgb(),i=n.toRgb(),s=r.getBrightness(),o=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(s-o),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 s=B.readability(t,e[i]),o=s.brightness>125&&s.color>500,l=3*(s.brightness/125)+s.color/500;(o&&!a||o&&a&&l>n||!o&&!a&&l>n)&&(a=o,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}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})});
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: child theme, child themes, customize theme, CSS, responsive, css editor, child theme generator, child theme creator, stylesheet, customizer
5
  Requires at least: 3.9
6
  Tested up to: 4.3
7
- Stable tag: 1.7.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -276,6 +276,11 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
276
  7. Files tab
277
 
278
  == Changelog ==
 
 
 
 
 
279
  = 1.7.5.1 =
280
  * Refactored background normalization function to better follow CSS specification.
281
  * Check child theme exists function case-insensitive.
@@ -530,7 +535,7 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
530
  * Initial release.
531
 
532
  == Upgrade Notice ==
533
- 1.7.5.1 aligns background normalization function with CSS spec.
534
 
535
  == Override Parent Styles ==
536
 
4
  Tags: child theme, child themes, customize theme, CSS, responsive, css editor, child theme generator, child theme creator, stylesheet, customizer
5
  Requires at least: 3.9
6
  Tested up to: 4.3
7
+ Stable tag: 1.7.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
276
  7. Files tab
277
 
278
  == Changelog ==
279
+ = 1.7.6 =
280
+ * Sanitize child theme slug
281
+ * Remove cascade load order comments from generated CSS
282
+ * Set admin background to prevent theme override
283
+
284
  = 1.7.5.1 =
285
  * Refactored background normalization function to better follow CSS specification.
286
  * Check child theme exists function case-insensitive.
535
  * Initial release.
536
 
537
  == Upgrade Notice ==
538
+ 1.7.6 Minor changes to improve UI and CSS generation.
539
 
540
  == Override Parent Styles ==
541