Child Theme Configurator - Version 1.7.4.2

Version Description

  • Will not write child theme stylesheet if error detected in functions.php
Download this release

Release Info

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

Code changes from version 1.7.4.1 to 1.7.4.2

child-theme-configurator.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
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.4.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.4.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' );
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.4.2
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.4.2' );
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
@@ -565,11 +565,12 @@ h3.theme-name {
565
  margin-left:2em;
566
  }
567
  #get_pro_panel h3 a {
568
- display: inline-block;
569
  padding:5px 10px;
570
  background-color: rgb(198, 66, 0);
571
  color: #fff;
572
  text-decoration: none;
 
573
  }
574
 
575
  #get_pro_panel h3 a:hover {
565
  margin-left:2em;
566
  }
567
  #get_pro_panel h3 a {
568
+ display: block;
569
  padding:5px 10px;
570
  background-color: rgb(198, 66, 0);
571
  color: #fff;
572
  text-decoration: none;
573
+ text-align: center;
574
  }
575
 
576
  #get_pro_panel h3 a:hover {
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 output, parsing, normalization
9
- Version: 1.7.4.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
6
  Class: ChildThemeConfiguratorCSS
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Handles all CSS output, parsing, normalization
9
+ Version: 1.7.4.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
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.4.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.4.2
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.4.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.4.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
@@ -670,25 +670,28 @@ class ChildThemeConfiguratorAdmin {
670
  $this->enqueue_parent_css( $this->css, TRUE );
671
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
672
  do_action( 'chld_thm_cfg_addl_files', $this );
673
- // set flag to skip import link conversion on ajax save
674
- $this->css->converted = 1;
675
-
676
- // try to write new stylsheet. If it fails send alert.
677
- if ( FALSE === $this->css->write_css( isset( $_POST[ 'ctc_backup' ] ) ) ):
678
- $this->debug( 'failed to write', __FUNCTION__ );
679
- $this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg' );
680
- add_action( 'admin_notices', array( $this, 'writable_notice' ) );
681
- return FALSE;
682
- endif;
683
-
684
- // save new object to WP options table
685
- $this->css->save_config();
686
-
687
- // plugin hook for additional child theme setup functions
688
- do_action( 'chld_thm_cfg_addl_options', $this );
689
-
690
- // return message id 1, which says new child theme created successfully;
691
- return 1;
 
 
 
692
  endif;
693
  return FALSE;
694
  }
@@ -1499,6 +1502,7 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_child_css', 999 );
1499
 
1500
  $this->memory[ $key ][ $label ][ $step ][ 'selectors' ] = isset( $this->css ) ? $this->css->qskey : 0;
1501
  }
 
1502
  function calc_memory_usage() {
1503
  //$this->debug( print_r( $this->memory, TRUE ), __FUNCTION__ );
1504
 
@@ -1517,7 +1521,6 @@ add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_child_css', 999 );
1517
  endforeach;
1518
  endforeach;
1519
  $this->debug( "\n" . implode( "\n", $results ), __FUNCTION__ );
1520
-
1521
  }
1522
 
1523
  function get_free_memory() {
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.childthemeconfigurator.com/
8
  Description: Main Controller Class
9
+ Version: 1.7.4.2
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.4.2' );
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
670
  $this->enqueue_parent_css( $this->css, TRUE );
671
  // hook for add'l plugin files and subdirectories. Must run after stylesheets are parsed to apply latest options
672
  do_action( 'chld_thm_cfg_addl_files', $this );
673
+ // do not continue if errors
674
+ if ( empty ( $this->errors ) ):
675
+ // set flag to skip import link conversion on ajax save
676
+ $this->css->converted = 1;
677
+
678
+ // try to write new stylsheet. If it fails send alert.
679
+ if ( FALSE === $this->css->write_css( isset( $_POST[ 'ctc_backup' ] ) ) ):
680
+ $this->debug( 'failed to write', __FUNCTION__ );
681
+ $this->errors[] = __( 'Your stylesheet is not writable.', 'chld_thm_cfg' );
682
+ add_action( 'admin_notices', array( $this, 'writable_notice' ) );
683
+ return FALSE;
684
+ endif;
685
+
686
+ // save new object to WP options table
687
+ $this->css->save_config();
688
+
689
+ // plugin hook for additional child theme setup functions
690
+ do_action( 'chld_thm_cfg_addl_options', $this );
691
+
692
+ // return message id 1, which says new child theme created successfully;
693
+ return 1;
694
+ endif;
695
  endif;
696
  return FALSE;
697
  }
1502
 
1503
  $this->memory[ $key ][ $label ][ $step ][ 'selectors' ] = isset( $this->css ) ? $this->css->qskey : 0;
1504
  }
1505
+
1506
  function calc_memory_usage() {
1507
  //$this->debug( print_r( $this->memory, TRUE ), __FUNCTION__ );
1508
 
1521
  endforeach;
1522
  endforeach;
1523
  $this->debug( "\n" . implode( "\n", $results ), __FUNCTION__ );
 
1524
  }
1525
 
1526
  function get_free_memory() {
includes/forms/addl_panels.php CHANGED
@@ -5,6 +5,9 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
5
  ?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?> >
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
 
 
 
8
  <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
9
  <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'chld_thm_cfg' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>">
10
  <?php _e( 'Learn more', 'chld_thm_cfg'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
@@ -31,6 +34,9 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
31
  <li><h3><?php _e( 'Online Documentation', 'chld_thm_cfg' ); ?></h3></li>
32
  <li><h3><?php _e( 'Tutorial Videos', 'chld_thm_cfg' ); ?></h3></li>
33
  </ul>
34
- <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Upgrade Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Buy Now - Only $17.95 USD*', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices subject to change.', 'chld_thm_cfg' ); ?></small></div>
 
 
 
35
  </div></div><?php
36
  endif;
5
  ?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" <?php echo $hidechild; ?> >
6
  <div class="ctc-input-row clearfix">
7
  <div class="ctc-input-cell"><div style="padding:0 40px">
8
+ <h1>Upgrade Offer</h1>
9
+ <p class="larger"><?php _e( 'Use coupon code', 'chld_thm_cfg' ); ?><code><strong><?php _e( 'wordpress-org', 'chld_thm_cfg' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'chld_thm_cfg' ); ?></p>
10
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Order Now', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'chld_thm_cfg' ); ?></small><hr style="margin:20px 0" />
11
  <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
12
  <p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'chld_thm_cfg' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'chld_thm_cfg' ); ?>">
13
  <?php _e( 'Learn more', 'chld_thm_cfg'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
34
  <li><h3><?php _e( 'Online Documentation', 'chld_thm_cfg' ); ?></h3></li>
35
  <li><h3><?php _e( 'Tutorial Videos', 'chld_thm_cfg' ); ?></h3></li>
36
  </ul>
37
+ <h1>Upgrade Offer</h1>
38
+ <p class="larger"><?php _e( 'Use coupon code', 'chld_thm_cfg' ); ?><code><strong><?php _e( 'wordpress-org', 'chld_thm_cfg' ); ?></strong></code><?php _e( 'and get <strong>20% off entire order</strong>.', 'chld_thm_cfg' ); ?></p>
39
+ <h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=1710" title="<?php _e( 'Order Now', 'chld_thm_cfg' ); ?>"><?php _e( 'Order Now', 'chld_thm_cfg' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'chld_thm_cfg' ); ?></small>
40
+ </div>
41
  </div></div><?php
42
  endif;
includes/forms/addl_tabs.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'CHLD_THM_CFG_PLUGINS_VERSION' ) ):
5
  ?>
6
  <a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&amp;tab=get_pro"
7
  class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
8
- <?php _e( 'Get Pro', 'chld_thm_cfg_plugins' ); ?>
9
  </a>
10
  <?php
11
  endif;
5
  ?>
6
  <a id="get_pro" href="?page=<?php echo CHLD_THM_CFG_MENU; ?>&amp;tab=get_pro"
7
  class="nav-tab<?php echo 'get_pro' == $active_tab ? ' nav-tab-active' : ''; ?>" <?php echo $hidechild; ?>>
8
+ <?php _e( 'Upgrade', 'chld_thm_cfg_plugins' ); ?>
9
  </a>
10
  <?php
11
  endif;
includes/forms/files.php CHANGED
@@ -93,18 +93,4 @@ if ( !defined( 'ABSPATH' ) ) exit;
93
  echo $files_tab_options;
94
  ?>
95
  </div>
96
- <div class="ctc-input-row clearfix" id="input_row_debug">
97
- <div class="ctc-input-cell clear">
98
- <strong>
99
- <?php _e( 'Debug', 'chld_thm_cfg_plugins' ); ?>
100
- </strong>
101
- <p class="howto">
102
- <?php _e( 'Check the box to enable debugging output.', 'chld_thm_cfg_plugins' ); ?>
103
- </p>
104
- </div>
105
- <div class="ctc-input-cell">
106
- <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
107
- value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
108
- </div>
109
- </div>
110
  </div>
93
  echo $files_tab_options;
94
  ?>
95
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  </div>
includes/forms/parent-child.php CHANGED
@@ -120,6 +120,20 @@ if ( !defined( 'ABSPATH' ) ) exit;
120
  <?php _e( 'This will copy all child theme files and apply changes to new version.', 'chld_thm_cfg' ); ?>
121
  </div>
122
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </div>
124
  <?php $parent_handling = ( isset( $css->enqueue ) ? $css->enqueue : 'enqueue' ); ?>
125
  <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
120
  <?php _e( 'This will copy all child theme files and apply changes to new version.', 'chld_thm_cfg' ); ?>
121
  </div>
122
  </div>
123
+ <div class="ctc-input-row clearfix" id="input_row_debug">
124
+ <div class="ctc-input-cell">
125
+ <strong>
126
+ <?php _e( 'Debug', 'chld_thm_cfg_plugins' ); ?>
127
+ </strong>
128
+ </div>
129
+ <div class="ctc-input-cell">
130
+ <input class="ctc_checkbox" id="ctc_is_debug" name="ctc_is_debug" type="checkbox"
131
+ value="1" <?php echo checked( $this->ctc()->is_debug, 1 ); ?> autocomplete="off" />
132
+ </div>
133
+ <div class="ctc-input-cell howto">
134
+ <?php _e( 'Check the box to enable debugging output.', 'chld_thm_cfg_plugins' ); ?>
135
+ </div>
136
+ </div>
137
  </div>
138
  <?php $parent_handling = ( isset( $css->enqueue ) ? $css->enqueue : 'enqueue' ); ?>
139
  <div class="ctc-input-row clearfix ctc-themeonly-container<?php echo $disabledclass; ?>">
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.4.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -909,7 +909,7 @@
909
  var self = this;
910
  //console.log( 'handle_failure: ' + obj );
911
  $( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
912
- $( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
913
  $( '.ajax-pending' ).removeClass( 'ajax-pending' );
914
  //FIXME: return fail text in ajax response
915
  if ( 'preview' == obj )
@@ -934,7 +934,7 @@
934
  // show check mark
935
  // FIXME: distinction between save and query, update specific status icon
936
  $( '.query-icon, .save-icon' ).addClass( 'success' );
937
- $( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
938
  // update ui from each response object
939
  $( response ).each( function() {
940
  if ( 'function' == typeof self.update[ this.obj ] ) {
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.4.2
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
909
  var self = this;
910
  //console.log( 'handle_failure: ' + obj );
911
  $( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
912
+ $( 'input[type=submit], input[type=button], input[type=checkbox]' ).prop( 'disabled', false );
913
  $( '.ajax-pending' ).removeClass( 'ajax-pending' );
914
  //FIXME: return fail text in ajax response
915
  if ( 'preview' == obj )
934
  // show check mark
935
  // FIXME: distinction between save and query, update specific status icon
936
  $( '.query-icon, .save-icon' ).addClass( 'success' );
937
+ $( 'input[type=submit], input[type=button], input[type=checkbox]' ).prop( 'disabled', false );
938
  // update ui from each response object
939
  $( response ).each( function() {
940
  if ( 'function' == typeof self.update[ this.obj ] ) {
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!=t||"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).toLowerCase():"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c).toLowerCase():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(".ctc-selector-container").hide(),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=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,i=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),a=i.find(".ctc-swatch").first(),r={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},l={child:!1,parent:!1},o={};return i.find(".ctc-parent-value, .ctc-child-value").each(function(){var i,a,_=e(this).attr("id"),u=_.toString().match(n),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[5],v="undefined"==typeof u[6]?"":u[6],f="parent"==p?e(this).text().replace(/!$/,""):e(this).val(),g="ctc_"+d+"_child_"+h+"_i_"+m;if(c.is_empty(e(this).data("color"))||(f=e(this).data("color"),e(this).data("color",null)),"child"==p&&(o[_]=f,o[g]=e("#"+g).is(":checked")?1:0),""!=f)if(c.is_empty(v))(i=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!f.match(/none/))?(a=f.toString().split(/ +/),r[p][h+"-width"]="undefined"==typeof a[0]?"":a[0],r[p][h+"-style"]="undefined"==typeof a[1]?"":a[1],r[p][h+"-color"]="undefined"==typeof a[2]?"":a[2]):"background-image"!=h||f.match(/none/)?"seq"!=h&&(r[p][h]=f):f.toString().match(/url\(/)?r[p]["background-image"]=c.image_url(p,f):(a=f.toString().split(/ +/),a.length>2?(s[p].origin="undefined"==typeof a[0]?"top":a[0],s[p].start="undefined"==typeof a[1]?"transparent":a[1],s[p].end="undefined"==typeof a[2]?"transparent":a[2],l[p]=!0):r[p]["background-image"]=f);else switch(v){case"_border_width":r[p][h+"-width"]="none"==f?0:f;break;case"_border_style":r[p][h+"-style"]=f;break;case"_border_color":r[p][h+"-color"]=f;break;case"_background_url":r[p]["background-image"]=c.image_url(p,f);break;case"_background_color":r[p]["background-color"]=t.value;break;case"_background_color1":s[p].start=f,l[p]=!0;break;case"_background_color2":s[p].end=f,l[p]=!0;break;case"_background_origin":s[p].origin=f,l[p]=!0}}),"undefined"==typeof a||c.is_empty(a.attr("id"))||(a.removeAttr("style"),l.parent&&a.ctcgrad(s.parent.origin,[s.parent.start,s.parent.end]),a.css(r.parent),a.attr("id").toString().match(/parent/)||(l.child&&a.ctcgrad(s.child.origin,[s.child.start,s.child.end]),a.css(r.child)),a.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=t.toString().split(/ +/);n.names=["_border_width","_border_style","_border_color"],n.values=["undefined"==typeof i[0]?"":i[0],"undefined"==typeof i[1]?"":i[1],"undefined"==typeof i[2]?"":i[2]]}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],!1!==c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var i=t.toString().split(/:/);n.values[1]="undefined"==typeof i[0]?"":i[0],n.values[2]="undefined"==typeof i[1]?"":i[1],n.values[3]="undefined"==typeof i[3]?"":i[3],n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}else n.names=[""],n.values=[t];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"),a=e.chldthmcfg.current_qsdata,r=e.chldthmcfg.is_empty(a)||e.chldthmcfg.is_empty(a.value);e.each(e("#ctc_rule_menu").data("menu"),function(t,c){var s=!1;if(i.test(t)){if(!r&&(e.each(a.value,function(e,c){return t==e.replace(/\d+/g,self.from_ascii)?(s=!0,!1):void 0}),s))return;n.push({label:t,value:c})}}),c(n)},input_row:function(t,c,n,i){var a=this,r="",s=a.is_empty(i)||a.is_empty(i.value)||a.is_empty(i.value[c])?"":i.value[c],l=a.decode_value(c,a.is_empty(s)?"":s.parnt),o=a.is_empty(s)||a.is_empty(s.i_parnt)||1!=s.i_parnt?"":a.getxt("important"),_=a.decode_value(c,a.is_empty(s)?"":s.child),u=a.is_empty(s)||a.is_empty(s.i_child)||1!=s.i_child?0:1,d="ctc_"+n+"_child_"+c+"_i_"+t;return a.is_empty(i)||(r+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix">\n<div class="ctc-input-cell">'+("ovrd"==n?c.replace(/\d+/g,a.from_ascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+a.getxt("edit")+"</a> "+(a.is_empty(l.orig)?a.getxt("child_only"):""))+"</div>\n","ovrd"==n&&(r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+n+"_parent_"+c+"_"+t+'">'+(a.is_empty(l.orig)?"[no value]":l.orig+o)+"</div>\n"),r+='<div class="ctc-input-cell">\n',a.is_empty(l.names)||(e.each(l.names,function(e,i){i=a.is_empty(i)?"":i,r+='<div class="ctc-child-input-cell">\n';var s,l="ctc_"+n+"_child_"+c+"_"+t+i;!1===(s=_.values.shift())&&(s=""),r+=(a.is_empty(i)?"":a.getxt(i)+":<br/>")+'<input type="text" id="'+l+'" name="'+l+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+a.esc_quot(s)+'" />\n</div>\n'}),r+='<label for="'+d+'"><input type="checkbox" id="'+d+'" name="'+d+'" value="1" '+(1===u?"checked":"")+" />"+a.getxt("important")+"</label>\n"),r+="</div>\n"+("ovrd"==n?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+'_swatch">'+a.getxt("swatch")+'</div>\n<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+'_cell">\n<input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+'" name="ctc_save_'+c+"_"+t+'" value="Save" /></div>\n')+"</div><!-- end input row -->\n"),r},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(t){var c=this;try{e(t).iris({change:function(n,i){e(t).data("color",i.color.toString()),c.coalesce_inputs(t)}})}catch(n){c.jquery_exception(n,"Iris Color Picker")}},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,"Rule 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(),t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.current_qsdata.value[n.item.label]={child:""};var i,a=n.item.label.replace(/[^\w\-]/g,t.to_ascii),r=e(t.input_row(t.current_qsid,a,"ovrd",t.current_qsdata));return e("#ctc_sel_ovrd_rule_inputs").append(r),e("#ctc_new_rule_menu").val(""),r.find('input[type="text"]').each(function(c,n){i||(i=n),e(n).hasClass("color-picker")&&t.setup_iris(n)}),i&&e(i).focus(),t.jquery_err.length&&t.jquery_notice(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Rule 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(),console.log("template: "+c+" parent: "+n),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;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()},set_selector:function(t,c){var n=this;e("#ctc_sel_ovrd_selector").val(""),n.current_qsid=t,n.reload_menus=!1,n.load_selector_values()},set_rule:function(t,c){var n=this;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)},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,{}),o=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>'),o.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"==e(t).attr("id")?l.ctc_child_imports=i.val():"ctc_is_debug"==e(t).attr("id")?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]").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]").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(){var t=this,c=[],n=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(n,i){var a=e(this).prop("src");t.is_empty(a)||!a.match(/jquery(\.min|\.js|\-?ui)/i)||a.match(/load\-scripts.php/)||c.push("<code><small>"+a.split(/\?/)[0]+"</small></code>")}),n.push("<strong>"+t.getxt("js")+"</strong> "+t.getxt("contact")),1==ctcAjax.is_debug&&n.push(t.jquery_err.join("<br/>")),c.length&&n.push(t.getxt("jquery")+"<br/>"+c.join("<br/>")),n.push(t.getxt("plugin")),t.set_notice({error:n})},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_iris(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch"),e("#ctc_sel_ovrd_rule_header").show()),a.jquery_err.length?a.jquery_notice():(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_iris(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice()},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("focus",".color-picker",function(){try{e(".color-picker").not(this).iris("hide"),e(this).iris("toggle"),e(".iris-picker").css({position:"absolute","z-index":10})}catch(c){t.jquery_exception(c,"Iris Color Picker")}}),e("#ctc_main").on("change",".ctc-child-value, input[type=checkbox]",function(){t.coalesce_inputs(this)}),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]",function(c){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.save(this))}),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()},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[]}}(jQuery),jQuery(document).ready(function(e){e.chldthmcfg.init()});
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!=t||"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).toLowerCase():"",i=e("#ctc_theme_child").length?e("#ctc_theme_child").val().toString().replace(c).toLowerCase():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(".ctc-selector-container").hide(),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=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,i=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),a=i.find(".ctc-swatch").first(),r={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},l={child:!1,parent:!1},o={};return i.find(".ctc-parent-value, .ctc-child-value").each(function(){var i,a,_=e(this).attr("id"),u=_.toString().match(n),d=u[2],p=u[3],h="undefined"==typeof u[4]?"":u[4],m=u[5],v="undefined"==typeof u[6]?"":u[6],f="parent"==p?e(this).text().replace(/!$/,""):e(this).val(),g="ctc_"+d+"_child_"+h+"_i_"+m;if(c.is_empty(e(this).data("color"))||(f=e(this).data("color"),e(this).data("color",null)),"child"==p&&(o[_]=f,o[g]=e("#"+g).is(":checked")?1:0),""!=f)if(c.is_empty(v))(i=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!f.match(/none/))?(a=f.toString().split(/ +/),r[p][h+"-width"]="undefined"==typeof a[0]?"":a[0],r[p][h+"-style"]="undefined"==typeof a[1]?"":a[1],r[p][h+"-color"]="undefined"==typeof a[2]?"":a[2]):"background-image"!=h||f.match(/none/)?"seq"!=h&&(r[p][h]=f):f.toString().match(/url\(/)?r[p]["background-image"]=c.image_url(p,f):(a=f.toString().split(/ +/),a.length>2?(s[p].origin="undefined"==typeof a[0]?"top":a[0],s[p].start="undefined"==typeof a[1]?"transparent":a[1],s[p].end="undefined"==typeof a[2]?"transparent":a[2],l[p]=!0):r[p]["background-image"]=f);else switch(v){case"_border_width":r[p][h+"-width"]="none"==f?0:f;break;case"_border_style":r[p][h+"-style"]=f;break;case"_border_color":r[p][h+"-color"]=f;break;case"_background_url":r[p]["background-image"]=c.image_url(p,f);break;case"_background_color":r[p]["background-color"]=t.value;break;case"_background_color1":s[p].start=f,l[p]=!0;break;case"_background_color2":s[p].end=f,l[p]=!0;break;case"_background_origin":s[p].origin=f,l[p]=!0}}),"undefined"==typeof a||c.is_empty(a.attr("id"))||(a.removeAttr("style"),l.parent&&a.ctcgrad(s.parent.origin,[s.parent.start,s.parent.end]),a.css(r.parent),a.attr("id").toString().match(/parent/)||(l.child&&a.ctcgrad(s.child.origin,[s.child.start,s.child.end]),a.css(r.child)),a.css({"z-index":-1})),o},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c=this,n={orig:t};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var i=t.toString().split(/ +/);n.names=["_border_width","_border_style","_border_color"],n.values=["undefined"==typeof i[0]?"":i[0],"undefined"==typeof i[1]?"":i[1],"undefined"==typeof i[2]?"":i[2]]}else if(e.toString().match(/^background\-image/))if(n.names=["_background_url","_background_origin","_background_color1","_background_color2"],n.values=["","","",""],!1!==c.is_empty(t)||t.toString().match(/(url|none)/))n.values[0]=t;else{var i=t.toString().split(/:/);n.values[1]="undefined"==typeof i[0]?"":i[0],n.values[2]="undefined"==typeof i[1]?"":i[1],n.values[3]="undefined"==typeof i[3]?"":i[3],n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}else n.names=[""],n.values=[t];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"),a=e.chldthmcfg.current_qsdata,r=e.chldthmcfg.is_empty(a)||e.chldthmcfg.is_empty(a.value);e.each(e("#ctc_rule_menu").data("menu"),function(t,c){var s=!1;if(i.test(t)){if(!r&&(e.each(a.value,function(e,c){return t==e.replace(/\d+/g,self.from_ascii)?(s=!0,!1):void 0}),s))return;n.push({label:t,value:c})}}),c(n)},input_row:function(t,c,n,i){var a=this,r="",s=a.is_empty(i)||a.is_empty(i.value)||a.is_empty(i.value[c])?"":i.value[c],l=a.decode_value(c,a.is_empty(s)?"":s.parnt),o=a.is_empty(s)||a.is_empty(s.i_parnt)||1!=s.i_parnt?"":a.getxt("important"),_=a.decode_value(c,a.is_empty(s)?"":s.child),u=a.is_empty(s)||a.is_empty(s.i_child)||1!=s.i_child?0:1,d="ctc_"+n+"_child_"+c+"_i_"+t;return a.is_empty(i)||(r+='<div class="ctc-'+("ovrd"==n?"input":"selector")+'-row clearfix">\n<div class="ctc-input-cell">'+("ovrd"==n?c.replace(/\d+/g,a.from_ascii):i.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+a.getxt("edit")+"</a> "+(a.is_empty(l.orig)?a.getxt("child_only"):""))+"</div>\n","ovrd"==n&&(r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+n+"_parent_"+c+"_"+t+'">'+(a.is_empty(l.orig)?"[no value]":l.orig+o)+"</div>\n"),r+='<div class="ctc-input-cell">\n',a.is_empty(l.names)||(e.each(l.names,function(e,i){i=a.is_empty(i)?"":i,r+='<div class="ctc-child-input-cell">\n';var s,l="ctc_"+n+"_child_"+c+"_"+t+i;!1===(s=_.values.shift())&&(s=""),r+=(a.is_empty(i)?"":a.getxt(i)+":<br/>")+'<input type="text" id="'+l+'" name="'+l+'" class="ctc-child-value'+((i+c).toString().match(/color/)?" color-picker":"")+(i.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+a.esc_quot(s)+'" />\n</div>\n'}),r+='<label for="'+d+'"><input type="checkbox" id="'+d+'" name="'+d+'" value="1" '+(1===u?"checked":"")+" />"+a.getxt("important")+"</label>\n"),r+="</div>\n"+("ovrd"==n?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+'_swatch">'+a.getxt("swatch")+'</div>\n<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+'_cell">\n<input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+'" name="ctc_save_'+c+"_"+t+'" value="Save" /></div>\n')+"</div><!-- end input row -->\n"),r},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(t){var c=this;try{e(t).iris({change:function(n,i){e(t).data("color",i.color.toString()),c.coalesce_inputs(t)}})}catch(n){c.jquery_exception(n,"Iris Color Picker")}},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,"Rule 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(),t.is_empty(t.current_qsdata.value)&&(t.current_qsdata.value={}),t.current_qsdata.value[n.item.label]={child:""};var i,a=n.item.label.replace(/[^\w\-]/g,t.to_ascii),r=e(t.input_row(t.current_qsid,a,"ovrd",t.current_qsdata));return e("#ctc_sel_ovrd_rule_inputs").append(r),e("#ctc_new_rule_menu").val(""),r.find('input[type="text"]').each(function(c,n){i||(i=n),e(n).hasClass("color-picker")&&t.setup_iris(n)}),i&&e(i).focus(),t.jquery_err.length&&t.jquery_notice(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Rule 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(),console.log("template: "+c+" parent: "+n),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;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()},set_selector:function(t,c){var n=this;e("#ctc_sel_ovrd_selector").val(""),n.current_qsid=t,n.reload_menus=!1,n.load_selector_values()},set_rule:function(t,c){var n=this;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)},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,{}),o=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>'),o.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"==e(t).attr("id")?l.ctc_child_imports=i.val():"ctc_is_debug"==e(t).attr("id")?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]").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]").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(){var t=this,c=[],n=[];e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(n,i){var a=e(this).prop("src");t.is_empty(a)||!a.match(/jquery(\.min|\.js|\-?ui)/i)||a.match(/load\-scripts.php/)||c.push("<code><small>"+a.split(/\?/)[0]+"</small></code>")}),n.push("<strong>"+t.getxt("js")+"</strong> "+t.getxt("contact")),1==ctcAjax.is_debug&&n.push(t.jquery_err.join("<br/>")),c.length&&n.push(t.getxt("jquery")+"<br/>"+c.join("<br/>")),n.push(t.getxt("plugin")),t.set_notice({error:n})},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_iris(this)}),a.coalesce_inputs("#ctc_child_all_0_swatch"),e("#ctc_sel_ovrd_rule_header").show()),a.jquery_err.length?a.jquery_notice():(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_iris(this)}),e(selector).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)}),c.jquery_err.length&&c.jquery_notice()},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("focus",".color-picker",function(){try{e(".color-picker").not(this).iris("hide"),e(this).iris("toggle"),e(".iris-picker").css({position:"absolute","z-index":10})}catch(c){t.jquery_exception(c,"Iris Color Picker")}}),e("#ctc_main").on("change",".ctc-child-value, input[type=checkbox]",function(){t.coalesce_inputs(this)}),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]",function(c){return e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.save(this))}),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()},testslug:"",testname:"",reload_menus:!1,current_query:"base",current_qsid:null,current_qsdata:{},jquery_err:[]}}(jQuery),jQuery(document).ready(function(e){e.chldthmcfg.init()});
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.2
7
- Stable tag: 1.7.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -269,6 +269,9 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
269
  7. Files tab
270
 
271
  == Changelog ==
 
 
 
272
  = 1.7.4.1 =
273
  * Fixed minified JS
274
 
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.2
7
+ Stable tag: 1.7.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
269
  7. Files tab
270
 
271
  == Changelog ==
272
+ = 1.7.4.2 =
273
+ * Will not write child theme stylesheet if error detected in functions.php
274
+
275
  = 1.7.4.1 =
276
  * Fixed minified JS
277