Child Theme Configurator - Version 1.5.2

Version Description

  • Automatically set additional stylesheets to parse based on parent theme links in head.
  • Render parent CSS including additional stylesheets
Download this release

Release Info

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

Code changes from version 1.5.1 to 1.5.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.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
- Version: 1.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -16,7 +16,7 @@ if ( !defined('ABSPATH')) exit;
16
  */
17
 
18
  defined('LF') or define('LF', "\n");
19
- define('CHLD_THM_CFG_VERSION', '1.5.1');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
22
 
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
9
+ Version: 1.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
16
  */
17
 
18
  defined('LF') or define('LF', "\n");
19
+ define('CHLD_THM_CFG_VERSION', '1.5.2');
20
  define('CHLD_THM_CFG_MAX_SELECTORS', '50000');
21
  define('CHLD_THM_CFG_MAX_RECURSE_LOOPS', '1000');
22
 
css/chld-thm-cfg.css CHANGED
@@ -74,6 +74,7 @@ a.nav-tab, a.nav-tab:focus, a.nav-tab:active {
74
  width: 25%;
75
  max-width: 250px;
76
  margin-right: 2.13%;
 
77
  }
78
 
79
  .ctc-input-cell-wide {
74
  width: 25%;
75
  max-width: 250px;
76
  margin-right: 2.13%;
77
+ word-wrap:break-word;
78
  }
79
 
80
  .ctc-input-cell-wide {
css/lilaea-logo.png ADDED
Binary file
includes/class-ctc-css.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Class: Child_Theme_Configurator_CSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
- Version: 1.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -37,6 +37,7 @@ class Child_Theme_Configurator_CSS {
37
  var $styles; // temporary update cache
38
  var $child; // child theme slug
39
  var $parnt; // parent theme slug
 
40
  var $configtype; // theme or plugin extension
41
  var $child_name; // child theme name
42
  var $child_author; // stylesheet author
@@ -45,7 +46,7 @@ class Child_Theme_Configurator_CSS {
45
 
46
  function __construct($parent = '') {
47
  // scalars
48
- $this->version = '1.5.1';
49
  $this->querykey = 0;
50
  $this->selkey = 0;
51
  $this->qskey = 0;
@@ -74,6 +75,7 @@ class Child_Theme_Configurator_CSS {
74
  $this->dict_seq = array();
75
  $this->sel_ndx = array();
76
  $this->val_ndx = array();
 
77
  $this->imports = array('child' => array(), 'parnt' => array());
78
  }
79
 
@@ -103,6 +105,8 @@ class Child_Theme_Configurator_CSS {
103
  return $this->child;
104
  case 'parnt':
105
  return $this->parnt;
 
 
106
  case 'configtype':
107
  return $this->configtype;
108
  case 'child_name':
@@ -112,8 +116,15 @@ class Child_Theme_Configurator_CSS {
112
  case 'version':
113
  return $this->child_version;
114
  case 'preview':
115
- $template = (empty($params['key']) || 'child' == $params['key']) ? 'child' : 'parnt';
116
- $this->get_raw_css($template);
 
 
 
 
 
 
 
117
  return $this->styles;
118
  endswitch;
119
  return FALSE;
@@ -129,14 +140,12 @@ class Child_Theme_Configurator_CSS {
129
  else return FALSE;
130
  }
131
 
132
- function get_raw_css($template = 'child') {
133
- if ($this->read_stylesheet($template, 'style.css')):
134
- if (preg_match("/\}[\w\#\.]/", $this->styles)): // prettify compressed CSS
135
- $this->styles = preg_replace("/\*\/\s*/s", "*/\n", $this->styles); // end comment
136
- $this->styles = preg_replace("/\{\s*/s", " {\n ", $this->styles); // open brace
137
- $this->styles = preg_replace("/;\s*/s", ";\n ", $this->styles); // semicolon
138
- $this->styles = preg_replace("/\s*\}\s*/s", "\n}\n", $this->styles); // close brace
139
- endif;
140
  endif;
141
  }
142
 
@@ -245,7 +254,6 @@ class Child_Theme_Configurator_CSS {
245
  $stylesheet = apply_filters('chld_thm_cfg_' . $template, $themedir . '/' . $file , $this);
246
 
247
  // read stylesheet
248
- $this->styles = '';
249
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'read')):
250
  $import_url = preg_replace('%^' . preg_quote($themedir) . '/%', '', $stylesheet_verified);
251
  $this->styles .= @file_get_contents($stylesheet_verified) . "\n";
6
  Class: Child_Theme_Configurator_CSS
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Handles all CSS output, parsing, normalization
9
+ Version: 1.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
37
  var $styles; // temporary update cache
38
  var $child; // child theme slug
39
  var $parnt; // parent theme slug
40
+ var $parntss; // parent additional stylesheets
41
  var $configtype; // theme or plugin extension
42
  var $child_name; // child theme name
43
  var $child_author; // stylesheet author
46
 
47
  function __construct($parent = '') {
48
  // scalars
49
+ $this->version = '1.5.2';
50
  $this->querykey = 0;
51
  $this->selkey = 0;
52
  $this->qskey = 0;
75
  $this->dict_seq = array();
76
  $this->sel_ndx = array();
77
  $this->val_ndx = array();
78
+ $this->parntss = array();
79
  $this->imports = array('child' => array(), 'parnt' => array());
80
  }
81
 
105
  return $this->child;
106
  case 'parnt':
107
  return $this->parnt;
108
+ case 'parntss':
109
+ return isset($this->parntss) ? $this->parntss : array();
110
  case 'configtype':
111
  return $this->configtype;
112
  case 'child_name':
116
  case 'version':
117
  return $this->child_version;
118
  case 'preview':
119
+ $this->styles = '';
120
+ if (empty($params['key']) || 'child' == $params['key']):
121
+ $this->read_stylesheet('child');
122
+ else:
123
+ foreach ($this->parntss as $template)
124
+ $this->read_stylesheet('parnt', $template);
125
+ $this->read_stylesheet('parnt');
126
+ endif;
127
+ $this->normalize_css();
128
  return $this->styles;
129
  endswitch;
130
  return FALSE;
140
  else return FALSE;
141
  }
142
 
143
+ function normalize_css() {
144
+ if (preg_match("/\}[\w\#\.]/", $this->styles)): // prettify compressed CSS
145
+ $this->styles = preg_replace("/\*\/\s*/s", "*/\n", $this->styles); // end comment
146
+ $this->styles = preg_replace("/\{\s*/s", " {\n ", $this->styles); // open brace
147
+ $this->styles = preg_replace("/;\s*/s", ";\n ", $this->styles); // semicolon
148
+ $this->styles = preg_replace("/\s*\}\s*/s", "\n}\n", $this->styles); // close brace
 
 
149
  endif;
150
  }
151
 
254
  $stylesheet = apply_filters('chld_thm_cfg_' . $template, $themedir . '/' . $file , $this);
255
 
256
  // read stylesheet
 
257
  if ($stylesheet_verified = $this->is_file_ok($stylesheet, 'read')):
258
  $import_url = preg_replace('%^' . preg_quote($themedir) . '/%', '', $stylesheet_verified);
259
  $this->styles .= @file_get_contents($stylesheet_verified) . "\n";
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.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
- Version: 1.5.1
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
@@ -20,7 +20,6 @@ class Child_Theme_Configurator_UI {
20
 
21
  function __construct() {
22
  $this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
23
- $this->extLink = '<a href="http://www.lilaeamedia.com/total-wordpress-customization-pagecells-responsive-theme-framework/" target="_blank" title="' . __('Total WordPress Customization with PageCells Responsive Theme Framework', 'chld_thm_cfg') . '" style="float:right"><img src="http://www.lilaeamedia.com/images/logos/pagecells-310.png" height="40" width="310" alt="PageCells Responsive Framework" /></a>';
24
  }
25
 
26
  function render_options() {
@@ -37,8 +36,7 @@ class Child_Theme_Configurator_UI {
37
  add_thickbox(); ?>
38
 
39
  <div class="wrap">
40
- <div id="icon-tools" class="icon32"></div>
41
- <?php echo $this->extLink; ?>
42
  <h2><?php echo $chld_thm_cfg->pluginName; ?> v.<?php echo CHLD_THM_CFG_VERSION;?></h2>
43
  <?php if ('POST' == $_SERVER['REQUEST_METHOD'] && !$chld_thm_cfg->fs):
44
  echo $chld_thm_cfg->fs_prompt;
@@ -189,8 +187,7 @@ class Child_Theme_Configurator_UI {
189
  <div class="ctc-input-cell">
190
  <label>
191
  <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
192
- value="<?php echo $stylesheet; ?>" />
193
- <?php echo $stylesheet; ?></label>
194
  </div>
195
  <?php endforeach; ?>
196
  </div>
5
  Class: Child_Theme_Configurator_UI
6
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
+ Version: 1.5.2
9
  Author: Lilaea Media
10
  Author URI: http://www.lilaeamedia.com/
11
  Text Domain: chld_thm_cfg
20
 
21
  function __construct() {
22
  $this->swatch_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
 
23
  }
24
 
25
  function render_options() {
36
  add_thickbox(); ?>
37
 
38
  <div class="wrap">
39
+ <a href="http://www.lilaeamedia.com/plugins/child-theme-plugin-styles/" target="_blank" title="<?php _e('Get CTC for Plugins and other tools', 'chld_thm_cfg'); ?>" style="float:right"><img src="<?php echo $chld_thm_cfg->pluginURL; ?>/css/lilaea-logo.png" height="36" width="145" alt="<?php _e('Lilaea Media - Responsive Tools for a Mobile World', 'chld_thm_cfg'); ?>" /></a>
 
40
  <h2><?php echo $chld_thm_cfg->pluginName; ?> v.<?php echo CHLD_THM_CFG_VERSION;?></h2>
41
  <?php if ('POST' == $_SERVER['REQUEST_METHOD'] && !$chld_thm_cfg->fs):
42
  echo $chld_thm_cfg->fs_prompt;
187
  <div class="ctc-input-cell">
188
  <label>
189
  <input class="ctc_checkbox" name="ctc_additional_css[]" type="checkbox"
190
+ value="<?php echo $stylesheet; ?>" /><?php echo $stylesheet; ?></label>
 
191
  </div>
192
  <?php endforeach; ?>
193
  </div>
includes/class-ctc.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
- Version: 1.5.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -84,10 +84,11 @@ class Child_Theme_Configurator {
84
  wp_enqueue_script('iris');
85
  // wp_enqueue_script('thickbox');
86
  wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
87
- wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.min.js',
88
  array('jquery-ui-autocomplete'), '1.0', TRUE);
89
  wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
90
  apply_filters('chld_thm_cfg_localize_script', array(
 
91
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
92
  'theme_uri' => get_theme_root_uri(),
93
  'themes' => $this->themes,
@@ -97,6 +98,7 @@ class Child_Theme_Configurator {
97
  . $this->css->get_prop('child') . '/style.css', $this->css),
98
  'parnt' => $this->css->get_prop('parnt'),
99
  'child' => $this->css->get_prop('child'),
 
100
  'imports' => $this->css->get_prop('imports'),
101
  'rule' => $this->css->get_prop('rule'),
102
  'sel_ndx' => $this->css->get_prop('sel_ndx'),
@@ -315,8 +317,10 @@ class Child_Theme_Configurator {
315
  $this->css->parse_css_file('parnt');
316
  $this->css->parse_css_file('child');
317
  if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
 
318
  foreach ($_POST['ctc_additional_css'] as $file):
319
  $this->css->parse_css_file('parnt', $file);
 
320
  endforeach;
321
  endif;
322
  if (FALSE === $this->css->write_css(isset($_POST['ctc_backup']))):
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
+ Version: 1.5.2
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
84
  wp_enqueue_script('iris');
85
  // wp_enqueue_script('thickbox');
86
  wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
87
+ wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.js',
88
  array('jquery-ui-autocomplete'), '1.0', TRUE);
89
  wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
90
  apply_filters('chld_thm_cfg_localize_script', array(
91
+ 'homeurl' => get_home_url(),
92
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
93
  'theme_uri' => get_theme_root_uri(),
94
  'themes' => $this->themes,
98
  . $this->css->get_prop('child') . '/style.css', $this->css),
99
  'parnt' => $this->css->get_prop('parnt'),
100
  'child' => $this->css->get_prop('child'),
101
+ 'addl_css' => $this->css->get_prop('parntss'),
102
  'imports' => $this->css->get_prop('imports'),
103
  'rule' => $this->css->get_prop('rule'),
104
  'sel_ndx' => $this->css->get_prop('sel_ndx'),
317
  $this->css->parse_css_file('parnt');
318
  $this->css->parse_css_file('child');
319
  if (isset($_POST['ctc_additional_css']) && is_array($_POST['ctc_additional_css'])):
320
+ $this->css->parentss = array();
321
  foreach ($_POST['ctc_additional_css'] as $file):
322
  $this->css->parse_css_file('parnt', $file);
323
+ $this->css->parntss[] = $file;
324
  endforeach;
325
  endif;
326
  if (FALSE === $this->css->write_css(isset($_POST['ctc_backup']))):
js/chld-thm-cfg.js CHANGED
@@ -2,14 +2,14 @@
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
- * Version: 1.5.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2014 Lilaea Media
10
  */
11
  jQuery(document).ready(function($){
12
-
13
  var lf = "\n",
14
  currentQuery = 'base',
15
  currentSel,
@@ -17,27 +17,45 @@ jQuery(document).ready(function($){
17
  rewrite_id,
18
  rewrite_sel,
19
  quot_regex = new RegExp('"', 'g'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  // initialize functions
21
- esc_quot = function(str){
22
  return ctc_is_empty(str) ? str : str.toString().replace(quot_regex, '&quot;');
23
- },
24
- ctc_setup_iris = function(obj) {
 
25
  $(obj).iris({
26
  change: function() {
27
  ctc_coalesce_inputs(obj);
28
  }
29
  });
30
- },
31
- from_ascii = function(str) {
 
32
  var ascii = parseInt(str),
33
  chr = String.fromCharCode(ascii)
34
  return chr;
35
- },
36
- to_ascii = function(str) {
 
37
  var ascii = str.charCodeAt(0);
38
  return ascii;
39
- },
40
- ctc_coalesce_inputs = function(obj) {
 
41
  var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
42
  $container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
43
  $swatch = $container.find('.ctc-swatch').first(),
@@ -147,8 +165,9 @@ jQuery(document).ready(function($){
147
  }
148
  }
149
  return postdata;
150
- },
151
- ctc_update_cache = function(response) {
 
152
  var currQuery, currSelId, currRuleId;
153
  $(response).each(function(){
154
  switch (this.obj) {
@@ -193,8 +212,9 @@ jQuery(document).ready(function($){
193
  break;
194
  }
195
  });
196
- },
197
- ctc_image_url = function(theme, value) {
 
198
  var parts = value.toString().match(/url\(['" ]*(.+?)['" ]*\)/),
199
  path = ctc_is_empty(parts) ? null : parts[1],
200
  url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
@@ -207,9 +227,9 @@ jQuery(document).ready(function($){
207
  image_url = 'url(' + url + path + ')';
208
  }
209
  return image_url;
210
- },
211
 
212
- ctc_is_empty = function(obj) {
213
  // first bail when definitely empty or undefined (true) NOTE: zero is not empty
214
  if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
215
  // then, if this is bool, string or number it must not be empty (false)
@@ -233,9 +253,9 @@ jQuery(document).ready(function($){
233
  // this must be an unsupported datatype, so return not empty
234
  return false;
235
 
236
- },
237
 
238
- ctc_load_queries = function() {
239
  var arr = [];
240
  if (1 === loading.sel_ndx) return arr;
241
  if (0 === loading.sel_ndx) { // {
@@ -251,9 +271,9 @@ jQuery(document).ready(function($){
251
  });
252
  }
253
  return arr;
254
- },
255
 
256
- ctc_load_selectors = function(query) {
257
  var arr = [];
258
  if (1 === loading.sel_ndx) {
259
  return arr;
@@ -271,9 +291,9 @@ jQuery(document).ready(function($){
271
  });
272
  }
273
  return arr;
274
- },
275
 
276
- ctc_load_rules = function() {
277
  var arr = [];
278
  if (1 === loading.rule) return arr;
279
  if (0 === loading.rule) {
@@ -294,9 +314,9 @@ jQuery(document).ready(function($){
294
  return -1;
295
  return 0;
296
  });
297
- },
298
 
299
- ctc_render_child_rule_input = function(qsid, rule, seq) {
300
  var html = '',
301
  value = (ctc_is_empty(ctcAjax.sel_val[qsid])
302
  || ctc_is_empty(ctcAjax.sel_val[qsid].value)
@@ -347,8 +367,9 @@ jQuery(document).ready(function($){
347
  html += '</div><!-- end input row -->' + lf;
348
  }
349
  return html;
350
- },
351
- ctc_render_selector_inputs = function(qsid) {
 
352
  if (1 === loading.sel_val) {
353
  return false;
354
  }
@@ -383,7 +404,8 @@ jQuery(document).ready(function($){
383
  }
384
  }
385
  }
386
- ctc_render_css_preview = function(theme) {
 
387
  if (1 === loading.preview) {
388
  return false;
389
  }
@@ -401,8 +423,9 @@ jQuery(document).ready(function($){
401
  $('#view_'+theme+'_options_panel').text(ctcAjax.previewResponse);
402
  loading.preview = 0;
403
  }
404
- },
405
- ctc_render_rule_value_inputs = function(ruleid) {
 
406
  if (1 === loading.rule_val) return false;
407
 
408
  if (0 == loading.rule_val) {
@@ -434,9 +457,9 @@ jQuery(document).ready(function($){
434
  $('#ctc_rule_value_inputs').html(html).find('.ctc-swatch').each(function() {
435
  ctc_coalesce_inputs(this);
436
  });
437
- },
438
 
439
- ctc_render_selector_value_inputs = function(valid) {
440
  if (1 == loading.val_qry) return false;
441
  var params,
442
  page_ruleid,
@@ -471,8 +494,9 @@ jQuery(document).ready(function($){
471
  ctc_coalesce_inputs(this);
472
  });
473
 
474
- },
475
- ctc_query_css = function(obj, key, callback, params) {
 
476
  var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
477
  status_sel = '#ctc_status_' + obj + ('val_qry' == obj ? '_' + key : '');
478
 
@@ -535,8 +559,9 @@ jQuery(document).ready(function($){
535
 
536
  });
537
  return false;
538
- },
539
- ctc_save = function(obj) {
 
540
  var postdata = {},
541
  $selector, $query, $imports, $rule,
542
  id = $(obj).attr('id'), newsel;
@@ -615,8 +640,9 @@ jQuery(document).ready(function($){
615
  $('.ctc-status-icon').addClass('failure');
616
  });
617
  return false;
618
- },
619
- ctc_decode_value = function(rule, value) {
 
620
  value = ('undefined' == typeof value ? '' : value);
621
  var obj = { 'orig': value };
622
  if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
@@ -653,9 +679,9 @@ jQuery(document).ready(function($){
653
  obj['values'] = [ value ];
654
  }
655
  return obj;
656
- },
657
 
658
- ctc_set_query = function(value) {
659
  currentQuery = value;
660
  $('#ctc_sel_ovrd_query').val('');
661
  $('#ctc_sel_ovrd_query_selected').text(value);
@@ -665,9 +691,9 @@ jQuery(document).ready(function($){
665
  ctc_setup_selector_menu(value);
666
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
667
  $('#ctc_new_selector_row').show();
668
- },
669
 
670
- ctc_set_selector = function(value,label) {
671
  $('#ctc_sel_ovrd_selector').val('');
672
  $('#ctc_sel_ovrd_selector_selected').text(label);
673
  $('#ctc_sel_ovrd_qsid').val(value);
@@ -676,17 +702,18 @@ jQuery(document).ready(function($){
676
  ctc_render_selector_inputs(value);
677
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
678
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle').show();
679
- },
680
 
681
- ctc_set_rule = function(value,label) {
682
  $('#ctc_rule_menu').val('');
683
  $('#ctc_rule_menu_selected').text(label);
684
  if (1 != loading.rule_val) loading.rule_val = 0;
685
  ctc_render_rule_value_inputs(value);
686
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
687
  $('#ctc_rule_value_inputs,#ctc_input_row_rule_header').show();
688
- },
689
- ctc_setup_query_menu = function() {
 
690
  ctc_queries = ctc_load_queries();
691
  $('#ctc_sel_ovrd_query').autocomplete({
692
  source: ctc_queries,
@@ -699,8 +726,9 @@ jQuery(document).ready(function($){
699
  },
700
  focus: function(e) { e.preventDefault(); }
701
  });
702
- },
703
- ctc_setup_selector_menu = function(query) {
 
704
  ctc_selectors = ctc_load_selectors(query);
705
  $('#ctc_sel_ovrd_selector').autocomplete({
706
  source: ctc_selectors,
@@ -712,8 +740,9 @@ jQuery(document).ready(function($){
712
  },
713
  focus: function(e) { e.preventDefault(); }
714
  });
715
- },
716
- ctc_setup_rule_menu = function() {
 
717
  ctc_rules = ctc_load_rules();
718
  $('#ctc_rule_menu').autocomplete({
719
  source: ctc_rules,
@@ -726,8 +755,9 @@ jQuery(document).ready(function($){
726
  },
727
  focus: function(e) { e.preventDefault(); }
728
  });
729
- },
730
- ctc_filtered_rules = function(request, response) {
 
731
  var arr = [],
732
  noval = (ctc_is_empty(ctcAjax.sel_val[currentSel])) || (ctc_is_empty(ctcAjax.sel_val[currentSel].value));
733
  if (ctc_is_empty(ctc_rules)) {
@@ -754,8 +784,9 @@ jQuery(document).ready(function($){
754
  }
755
  });
756
  response(arr);
757
- },
758
- ctc_setup_new_rule_menu = function() {
 
759
  $('#ctc_new_rule_menu').autocomplete({
760
  source: ctc_filtered_rules,
761
  //minLength: 0,
@@ -779,14 +810,16 @@ jQuery(document).ready(function($){
779
  },
780
  focus: function(e) { e.preventDefault(); }
781
  });
782
- },
783
- ctc_setup_menus = function() {
 
784
  ctc_setup_query_menu();
785
  ctc_setup_selector_menu(currentQuery);
786
  ctc_setup_rule_menu();
787
  ctc_setup_new_rule_menu();
788
- },
789
- ctc_theme_exists = function(testslug, testtype) {
 
790
  var exists = false;
791
  $.each(ctcAjax.themes, function(type, theme){
792
  $.each(theme, function(slug, data){
@@ -798,9 +831,9 @@ jQuery(document).ready(function($){
798
  if (exists) return false;
799
  });
800
  return exists;
801
- },
802
 
803
- ctc_set_notice = function(noticearr) {
804
  var errorHtml = '';
805
  if (false === ctc_is_empty(noticearr)) {
806
  $.each(noticearr, function(type, list){
@@ -812,8 +845,9 @@ jQuery(document).ready(function($){
812
  });
813
  }
814
  $('#ctc_error_notice').html(errorHtml);
815
- },
816
- ctc_validate = function() {
 
817
  var regex = /[^\w\-]/,
818
  newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
819
  slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
@@ -834,19 +868,40 @@ jQuery(document).ready(function($){
834
  return false;
835
  }
836
  return true;
837
- },
838
- ctc_set_theme_menu = function(e) {
 
839
  var slug = $('#ctc_theme_child').val();
840
  if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
841
  $('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
842
  $('#ctc_child_author').val(ctcAjax.themes.child[slug].Author);
843
  $('#ctc_child_version').val(ctcAjax.themes.child[slug].Version);
844
  }
845
- },
846
- fade_update_notice = function() {
 
847
  $('.updated, .error').slideUp('slow', function(){ $('.updated').remove(); });
848
- },
849
- ctc_focus_panel = function(id) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  var panelid = id + '_panel';
851
  $('.nav-tab').removeClass('nav-tab-active');
852
  $('.ctc-option-panel').removeClass('ctc-option-panel-active');
@@ -854,8 +909,9 @@ jQuery(document).ready(function($){
854
  $(id).addClass('nav-tab-active');
855
  $('.ctc-option-panel-container').scrollTop(0);
856
  $(panelid).addClass('ctc-option-panel-active');
857
- },
858
- ctc_selector_edit = function(obj) {
 
859
  var qsid = $(obj).attr('id').match(/_(\d+)$/)[1],
860
  q = ctcAjax.sel_val[qsid].query,
861
  s = ctcAjax.sel_val[qsid].selector,
@@ -863,8 +919,9 @@ jQuery(document).ready(function($){
863
  ctc_set_query(q);
864
  ctc_set_selector(qsid, s);
865
  ctc_focus_panel(id);
866
- },
867
- ctc_selector_input_toggle = function(obj) {
 
868
  var origval;
869
  if ($('#ctc_rewrite_selector').length) {
870
  origval = $('#ctc_rewrite_selector_orig').val();
@@ -878,21 +935,6 @@ jQuery(document).ready(function($){
878
  $(obj).text(ctcAjax.cancel_txt);
879
  }
880
  }
881
- // initialize vars
882
- // ajax semaphores: 0 = reload, 1 = loading, 2 = loaded
883
- loading = {
884
- 'rule': 2,
885
- 'sel_ndx': 2,
886
- 'val_qry': 0,
887
- 'rule_val': 0,
888
- 'sel_val': 0,
889
- 'preview': 0
890
- },
891
-
892
- ctc_selectors = [],
893
- ctc_queries = [],
894
- ctc_rules = [];
895
- // -- end var definitions
896
 
897
  // initialize Iris color picker
898
  $('.color-picker').each(function() {
@@ -958,8 +1000,7 @@ jQuery(document).ready(function($){
958
  // initialize menus
959
  ctc_setup_menus();
960
  ctc_set_query(currentQuery);
 
961
  $('input[type=submit],input[type=button]').prop('disabled', false);
962
  setTimeout(fade_update_notice, 6000);
963
- });
964
-
965
-
2
  * Script: chld-thm-cfg.js
3
  * Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
4
  * Description: Handles jQuery, AJAX and other UI
5
+ * Version: 1.5.2
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2014 Lilaea Media
10
  */
11
  jQuery(document).ready(function($){
12
+ // initialize vars
13
  var lf = "\n",
14
  currentQuery = 'base',
15
  currentSel,
17
  rewrite_id,
18
  rewrite_sel,
19
  quot_regex = new RegExp('"', 'g'),
20
+ // ajax semaphores: 0 = reload, 1 = loading, 2 = loaded
21
+ loading = {
22
+ 'rule': 2,
23
+ 'sel_ndx': 2,
24
+ 'val_qry': 0,
25
+ 'rule_val': 0,
26
+ 'sel_val': 0,
27
+ 'preview': 0
28
+ },
29
+ ctc_selectors = [],
30
+ ctc_queries = [],
31
+ ctc_rules = [];
32
+ // -- end var definitions
33
+
34
  // initialize functions
35
+ function esc_quot(str){
36
  return ctc_is_empty(str) ? str : str.toString().replace(quot_regex, '&quot;');
37
+ }
38
+
39
+ function ctc_setup_iris(obj) {
40
  $(obj).iris({
41
  change: function() {
42
  ctc_coalesce_inputs(obj);
43
  }
44
  });
45
+ }
46
+
47
+ function from_ascii(str) {
48
  var ascii = parseInt(str),
49
  chr = String.fromCharCode(ascii)
50
  return chr;
51
+ }
52
+
53
+ function to_ascii(str) {
54
  var ascii = str.charCodeAt(0);
55
  return ascii;
56
+ }
57
+
58
+ function ctc_coalesce_inputs(obj) {
59
  var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
60
  $container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
61
  $swatch = $container.find('.ctc-swatch').first(),
165
  }
166
  }
167
  return postdata;
168
+ }
169
+
170
+ function ctc_update_cache(response) {
171
  var currQuery, currSelId, currRuleId;
172
  $(response).each(function(){
173
  switch (this.obj) {
212
  break;
213
  }
214
  });
215
+ }
216
+
217
+ function ctc_image_url(theme, value) {
218
  var parts = value.toString().match(/url\(['" ]*(.+?)['" ]*\)/),
219
  path = ctc_is_empty(parts) ? null : parts[1],
220
  url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
227
  image_url = 'url(' + url + path + ')';
228
  }
229
  return image_url;
230
+ }
231
 
232
+ function ctc_is_empty(obj) {
233
  // first bail when definitely empty or undefined (true) NOTE: zero is not empty
234
  if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
235
  // then, if this is bool, string or number it must not be empty (false)
253
  // this must be an unsupported datatype, so return not empty
254
  return false;
255
 
256
+ }
257
 
258
+ function ctc_load_queries() {
259
  var arr = [];
260
  if (1 === loading.sel_ndx) return arr;
261
  if (0 === loading.sel_ndx) { // {
271
  });
272
  }
273
  return arr;
274
+ }
275
 
276
+ function ctc_load_selectors(query) {
277
  var arr = [];
278
  if (1 === loading.sel_ndx) {
279
  return arr;
291
  });
292
  }
293
  return arr;
294
+ }
295
 
296
+ function ctc_load_rules() {
297
  var arr = [];
298
  if (1 === loading.rule) return arr;
299
  if (0 === loading.rule) {
314
  return -1;
315
  return 0;
316
  });
317
+ }
318
 
319
+ function ctc_render_child_rule_input(qsid, rule, seq) {
320
  var html = '',
321
  value = (ctc_is_empty(ctcAjax.sel_val[qsid])
322
  || ctc_is_empty(ctcAjax.sel_val[qsid].value)
367
  html += '</div><!-- end input row -->' + lf;
368
  }
369
  return html;
370
+ }
371
+
372
+ function ctc_render_selector_inputs(qsid) {
373
  if (1 === loading.sel_val) {
374
  return false;
375
  }
404
  }
405
  }
406
  }
407
+
408
+ function ctc_render_css_preview(theme) {
409
  if (1 === loading.preview) {
410
  return false;
411
  }
423
  $('#view_'+theme+'_options_panel').text(ctcAjax.previewResponse);
424
  loading.preview = 0;
425
  }
426
+ }
427
+
428
+ function ctc_render_rule_value_inputs(ruleid) {
429
  if (1 === loading.rule_val) return false;
430
 
431
  if (0 == loading.rule_val) {
457
  $('#ctc_rule_value_inputs').html(html).find('.ctc-swatch').each(function() {
458
  ctc_coalesce_inputs(this);
459
  });
460
+ }
461
 
462
+ function ctc_render_selector_value_inputs(valid) {
463
  if (1 == loading.val_qry) return false;
464
  var params,
465
  page_ruleid,
494
  ctc_coalesce_inputs(this);
495
  });
496
 
497
+ }
498
+
499
+ function ctc_query_css(obj, key, callback, params) {
500
  var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
501
  status_sel = '#ctc_status_' + obj + ('val_qry' == obj ? '_' + key : '');
502
 
559
 
560
  });
561
  return false;
562
+ }
563
+
564
+ function ctc_save(obj) {
565
  var postdata = {},
566
  $selector, $query, $imports, $rule,
567
  id = $(obj).attr('id'), newsel;
640
  $('.ctc-status-icon').addClass('failure');
641
  });
642
  return false;
643
+ }
644
+
645
+ function ctc_decode_value(rule, value) {
646
  value = ('undefined' == typeof value ? '' : value);
647
  var obj = { 'orig': value };
648
  if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
679
  obj['values'] = [ value ];
680
  }
681
  return obj;
682
+ }
683
 
684
+ function ctc_set_query(value) {
685
  currentQuery = value;
686
  $('#ctc_sel_ovrd_query').val('');
687
  $('#ctc_sel_ovrd_query_selected').text(value);
691
  ctc_setup_selector_menu(value);
692
  ctc_coalesce_inputs('#ctc_child_all_0_swatch');
693
  $('#ctc_new_selector_row').show();
694
+ }
695
 
696
+ function ctc_set_selector(value,label) {
697
  $('#ctc_sel_ovrd_selector').val('');
698
  $('#ctc_sel_ovrd_selector_selected').text(label);
699
  $('#ctc_sel_ovrd_qsid').val(value);
702
  ctc_render_selector_inputs(value);
703
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
704
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle').show();
705
+ }
706
 
707
+ function ctc_set_rule(value,label) {
708
  $('#ctc_rule_menu').val('');
709
  $('#ctc_rule_menu_selected').text(label);
710
  if (1 != loading.rule_val) loading.rule_val = 0;
711
  ctc_render_rule_value_inputs(value);
712
  $('.ctc-rewrite-toggle').text(ctcAjax.rename_txt);
713
  $('#ctc_rule_value_inputs,#ctc_input_row_rule_header').show();
714
+ }
715
+
716
+ function ctc_setup_query_menu() {
717
  ctc_queries = ctc_load_queries();
718
  $('#ctc_sel_ovrd_query').autocomplete({
719
  source: ctc_queries,
726
  },
727
  focus: function(e) { e.preventDefault(); }
728
  });
729
+ }
730
+
731
+ function ctc_setup_selector_menu(query) {
732
  ctc_selectors = ctc_load_selectors(query);
733
  $('#ctc_sel_ovrd_selector').autocomplete({
734
  source: ctc_selectors,
740
  },
741
  focus: function(e) { e.preventDefault(); }
742
  });
743
+ }
744
+
745
+ function ctc_setup_rule_menu() {
746
  ctc_rules = ctc_load_rules();
747
  $('#ctc_rule_menu').autocomplete({
748
  source: ctc_rules,
755
  },
756
  focus: function(e) { e.preventDefault(); }
757
  });
758
+ }
759
+
760
+ function ctc_filtered_rules(request, response) {
761
  var arr = [],
762
  noval = (ctc_is_empty(ctcAjax.sel_val[currentSel])) || (ctc_is_empty(ctcAjax.sel_val[currentSel].value));
763
  if (ctc_is_empty(ctc_rules)) {
784
  }
785
  });
786
  response(arr);
787
+ }
788
+
789
+ function ctc_setup_new_rule_menu() {
790
  $('#ctc_new_rule_menu').autocomplete({
791
  source: ctc_filtered_rules,
792
  //minLength: 0,
810
  },
811
  focus: function(e) { e.preventDefault(); }
812
  });
813
+ }
814
+
815
+ function ctc_setup_menus() {
816
  ctc_setup_query_menu();
817
  ctc_setup_selector_menu(currentQuery);
818
  ctc_setup_rule_menu();
819
  ctc_setup_new_rule_menu();
820
+ }
821
+
822
+ function ctc_theme_exists(testslug, testtype) {
823
  var exists = false;
824
  $.each(ctcAjax.themes, function(type, theme){
825
  $.each(theme, function(slug, data){
831
  if (exists) return false;
832
  });
833
  return exists;
834
+ }
835
 
836
+ function ctc_set_notice(noticearr) {
837
  var errorHtml = '';
838
  if (false === ctc_is_empty(noticearr)) {
839
  $.each(noticearr, function(type, list){
845
  });
846
  }
847
  $('#ctc_error_notice').html(errorHtml);
848
+ }
849
+
850
+ function ctc_validate() {
851
  var regex = /[^\w\-]/,
852
  newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
853
  slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
868
  return false;
869
  }
870
  return true;
871
+ }
872
+
873
+ function ctc_set_theme_menu(e) {
874
  var slug = $('#ctc_theme_child').val();
875
  if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
876
  $('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
877
  $('#ctc_child_author').val(ctcAjax.themes.child[slug].Author);
878
  $('#ctc_child_version').val(ctcAjax.themes.child[slug].Version);
879
  }
880
+ }
881
+
882
+ function fade_update_notice() {
883
  $('.updated, .error').slideUp('slow', function(){ $('.updated').remove(); });
884
+ }
885
+
886
+ function ctc_set_addl_css() {
887
+ var template = $('#ctc_theme_parnt').val(),
888
+ url = ctcAjax.homeurl + '?preview=1&template=' + template + '&stylesheet=' + template,
889
+ regex = new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?" + ctcAjax.theme_uri + '/' + template + '/(.+?\\.css)[^>]+?>', 'g'),
890
+ head,
891
+ additional;
892
+ if (ctc_is_empty(template)) return;
893
+ $.get(url, function(data){
894
+ while (additional = regex.exec(data)){
895
+ ctcAjax.addl_css.push(additional[1]);
896
+ if ('style.css' == additional[1]) break; // bail after main stylesheet
897
+ $('.ctc_checkbox').each(function(ndx,el){
898
+ if ($(this).val() == additional[1]) $(this).prop('checked', true);
899
+ });
900
+ }
901
+ });
902
+ }
903
+
904
+ function ctc_focus_panel(id) {
905
  var panelid = id + '_panel';
906
  $('.nav-tab').removeClass('nav-tab-active');
907
  $('.ctc-option-panel').removeClass('ctc-option-panel-active');
909
  $(id).addClass('nav-tab-active');
910
  $('.ctc-option-panel-container').scrollTop(0);
911
  $(panelid).addClass('ctc-option-panel-active');
912
+ }
913
+
914
+ function ctc_selector_edit(obj) {
915
  var qsid = $(obj).attr('id').match(/_(\d+)$/)[1],
916
  q = ctcAjax.sel_val[qsid].query,
917
  s = ctcAjax.sel_val[qsid].selector,
919
  ctc_set_query(q);
920
  ctc_set_selector(qsid, s);
921
  ctc_focus_panel(id);
922
+ }
923
+
924
+ function ctc_selector_input_toggle(obj) {
925
  var origval;
926
  if ($('#ctc_rewrite_selector').length) {
927
  origval = $('#ctc_rewrite_selector_orig').val();
935
  $(obj).text(ctcAjax.cancel_txt);
936
  }
937
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
938
 
939
  // initialize Iris color picker
940
  $('.color-picker').each(function() {
1000
  // initialize menus
1001
  ctc_setup_menus();
1002
  ctc_set_query(currentQuery);
1003
+ ctc_set_addl_css();
1004
  $('input[type=submit],input[type=button]').prop('disabled', false);
1005
  setTimeout(fade_update_notice, 6000);
1006
+ });
 
 
js/chld-thm-cfg.min.js CHANGED
@@ -1,5 +1 @@
1
- /*!
2
- * Script: chld-thm-cfg.min.js
3
- * Copyright (C) 2014 Lilaea Media
4
- */
5
- ;jQuery(document).ready(function(c){var l="\n",u="base",h,b={},r,s,p=new RegExp('"',"g"),n=function(v){return t(v)?v:v.toString().replace(p,"&quot;")},k=function(v){c(v).iris({change:function(){f(v)}})},e=function(x){var v=parseInt(x),w=String.fromCharCode(v);return w},m=function(w){var v=w.charCodeAt(0);return v},f=function(B){var x=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,C=c(B).parents(".ctc-selector-row, .ctc-parent-row").first(),A=C.find(".ctc-swatch").first(),z={parent:{},child:{}},y={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},w={child:false,parent:false},v={};C.find(".ctc-parent-value, .ctc-child-value").each(function(){var K=c(this).attr("id"),D=K.toString().match(x),L=D[2],E=D[3],N=("undefined"==typeof D[4]?"":D[4]),J=D[5],I=("undefined"==typeof D[6]?"":D[6]),M=("parent"==E?c(this).text():c(this).val()),F="ctc_"+L+"_child_"+N+"_i_"+J,H,G;if("child"==E){v[K]=M;v[F]=(c("#"+F).is(":checked"))?1:0}if(""!=M){if(false===t(I)){switch(I){case"_border_width":z[E][N+"-width"]=M;break;case"_border_style":z[E][N+"-style"]=M;break;case"_border_color":z[E][N+"-color"]=M;break;case"_background_url":z[E]["background-image"]=i(E,M);break;case"_background_color":z[E]["background-color"]=B.value;break;case"_background_color1":y[E].start=M;w[E]=true;break;case"_background_color2":y[E].end=M;w[E]=true;break;case"_background_origin":y[E].origin=M;w[E]=true;break}}else{if(H=N.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!M.match(/none/)){G=M.toString().split(/ +/);z[E][N+"-width"]="undefined"==typeof G[0]?"":G[0];z[E][N+"-style"]="undefined"==typeof G[1]?"":G[1];z[E][N+"-color"]="undefined"==typeof G[2]?"":G[2]}else{if("background-image"==N){if(M.toString().match(/url\(/)){z[E]["background-image"]=i(E,M)}else{G=M.toString().split(/ +/);if(G.length>2){y[E].origin="undefined"==typeof G[0]?"top":G[0];y[E].start="undefined"==typeof G[1]?"transparent":G[1];y[E].end="undefined"==typeof G[2]?"transparent":G[2];w[E]=true}else{z[E]["background-image"]=M}}}else{z[E][N]=M}}}}});if("undefined"!=typeof A&&false===t(A.attr("id"))){c(A).removeAttr("style");if(w.parent){c(A).ctcgrad(y.parent.origin,[y.parent.start,y.parent.end])}c(A).css(z.parent);if(!(A.attr("id").toString().match(/parent/))){if(w.child){c(A).ctcgrad(y.child.origin,[y.child.start,y.child.end])}c(A).css(z.child)}}return v},o=function(w){var v,x,y;c(w).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;y=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":if(t(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){if(t(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;v=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;x=this.key;break;case"rewrite":r=this.key;s=this.data;break}})},i=function(z,w){var y=w.toString().match(/url\(['" ]*(.+?)['" ]*\)/),x=t(y)?null:y[1],v=ctcAjax.theme_uri+"/"+("parent"==z?ctcAjax.parnt:ctcAjax.child)+"/",A;if(!x){return false}else{if(x.toString().match(/^(https?:|\/)/)){A=w}else{A="url("+v+x+")"}}return A},t=function(w){if("undefined"==typeof w||false===w||null===w||""===w){return true}if(true===w||"string"===typeof w||"number"===typeof w){return false}if("object"===typeof w){for(var v in w){if(w.hasOwnProperty(v)){return false}}return true}return false},a=function(){var v=[];if(1===loading.sel_ndx){return v}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return v}if(false===t(ctcAjax.sel_ndx)){c.each(ctcAjax.sel_ndx,function(w,x){var y={label:w,value:w};v.push(y)})}return v},q=function(w){var v=[];if(1===loading.sel_ndx){return v}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",w,ctc_setup_selector_menu);return v}if(false===t(ctcAjax.sel_ndx[w])){c.each(ctcAjax.sel_ndx[w],function(x,y){var z={label:x,value:y};v.push(z)})}return v},d=function(){var v=[];if(1===loading.rule){return v}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return v}if(false===t(ctcAjax.rule)){c.each(ctcAjax.rule,function(w,x){var y={label:x.replace(/\d+/g,e),value:w};v.push(y)})}return v.sort(function(x,w){if(x.label>w.label){return 1}if(x.label<w.label){return -1}return 0})},j=function(z,B,E){var x="",C=(t(ctcAjax.sel_val[z])||t(ctcAjax.sel_val[z].value)||t(ctcAjax.sel_val[z].value[B])?"":ctcAjax.sel_val[z].value[B]),w=ctc_decode_value(B,("undefined"==typeof C?"":C.parnt)),A=(false===t(C.i_parnt)&&C.i_parnt)?ctcAjax.important_label:"",y=ctc_decode_value(B,("undefined"==typeof C?"":C.child)),v=(false===t(C.i_child)&&C.i_child)?1:0,D="ctc_"+E+"_child_"+B+"_i_"+z;if(false===t(ctcAjax.sel_val[z])){x+='<div class="ctc-'+("ovrd"==E?"input":"selector")+'-row clearfix">'+l;x+='<div class="ctc-input-cell">'+("ovrd"==E?B.replace(/\d+/g,e):ctcAjax.sel_val[z].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+z+'" >'+ctcAjax.edit_txt+"</a> "+(t(w.orig)?ctcAjax.child_only_txt:""))+"</div>"+l;if("ovrd"==E){x+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+E+"_parent_"+B+"_"+z+'">'+(t(w.orig)?"[no value]":w.orig+A)+"</div>"+l}x+='<div class="ctc-input-cell">'+l;if(false===t(w.names)){c.each(w.names,function(F,G){G=(t(G)?"":G);x+='<div class="ctc-child-input-cell">'+l;var I="ctc_"+E+"_child_"+B+"_"+z+G,H;if(false===(H=y.values.shift())){H=""}x+=(t(G)?"":ctcAjax.field_labels[G]+":<br/>")+'<input type="text" id="'+I+'" name="'+I+'" class="ctc-child-value'+((G+B).toString().match(/color/)?" color-picker":"")+((G).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+n(H)+'" />'+l;x+="</div>"+l});x+='<label for="'+D+'"><input type="checkbox" id="'+D+'" name="'+D+'" value="1" '+(1===v?"checked":"")+" />"+ctcAjax.important_label+"</label>"+l}x+="</div>"+l;x+=("ovrd"==E?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+B+"_"+z+'_swatch">'+ctcAjax.swatch_txt+"</div>"+l+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+B+"_"+z+'_cell">'+l+'<input type="button" class="button ctc-save-input" id="ctc_save_'+B+"_"+z+'" name="ctc_save_'+B+"_"+z+'" value="Save" /></div>'+l);x+="</div><!-- end input row -->"+l}return x},g=function(v){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",v,g);return false}var y,w,x;if(t(ctcAjax.sel_val[v])){c("#ctc_sel_ovrd_rule_inputs").html("")}else{if(t(ctcAjax.sel_val[v].seq)){c("#ctc_child_load_order_container").html("")}else{y="ctc_ovrd_child_seq_"+v;x=parseInt(ctcAjax.sel_val[v].seq);w='<input type="text" id="'+y+'" name="'+y+'" class="ctc-child-value" value="'+x+'" />';c("#ctc_child_load_order_container").html(w)}if(t(ctcAjax.sel_val[v].value)){c("#ctc_sel_ovrd_rule_inputs").html("")}else{w="";c.each(ctcAjax.sel_val[v].value,function(A,z){w+=j(v,A,"ovrd")});c("#ctc_sel_ovrd_rule_inputs").html(w).find(".color-picker").each(function(){k(this)});f("#ctc_child_all_0_swatch")}}};ctc_render_css_preview=function(v){if(1===loading.preview){return false}if(0==loading.preview){loading.preview=1;var v;if(!(v=c(this).attr("id").toString().match(/(child|parnt)/)[1])){v="child"}ctc_set_notice("");ctc_query_css("preview",v,ctc_render_css_preview);return false}if(2==loading.preview){c("#view_"+v+"_options_panel").text(ctcAjax.previewResponse);loading.preview=0}},ctc_render_rule_value_inputs=function(w){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",w,ctc_render_rule_value_inputs);return false}var x=ctcAjax.rule[w],v='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+x+'">'+l;if(false===t(ctcAjax.rule_val[w])){c.each(ctcAjax.rule_val[w],function(z,A){var y=ctc_decode_value(x,A);v+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+x+"_"+z+'">'+l;v+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+z+"_parent_"+x+"_"+z+'">'+y.orig+"</div>"+l;v+='<div class="ctc-input-cell">'+l;v+='<div class="ctc-swatch ctc-specific" id="ctc_'+z+"_parent_"+x+"_"+z+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+l;v+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+x+"_"+z+'">'+ctcAjax.selector_txt+"</a></div>"+l;v+='<div id="ctc_selector_'+x+"_"+z+'_container" class="ctc-selector-container clearfix">'+l;v+='<a href="#" id="ctc_selector_'+x+"_"+z+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+z+'"></div>'+l;v+='<div id="ctc_selector_'+x+"_"+z+'_rows"></div>'+l;v+="</div></div>"+l});v+="</div>"+l}c("#ctc_rule_value_inputs").html(v).find(".ctc-swatch").each(function(){f(this)})},ctc_render_selector_value_inputs=function(y){if(1==loading.val_qry){return false}var A,w,z=c("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,m),v,x="";if(0===loading.val_qry){loading.val_qry=1;A={rule:z};ctc_query_css("val_qry",y,ctc_render_selector_value_inputs,A);return false}if(false===t(ctcAjax.val_qry[y])){c.each(ctcAjax.val_qry[y],function(C,B){page_rule=C;c.each(B,function(E,D){x+='<h4 class="ctc-query-heading">'+E+"</h4>"+l;if(false===t(D)){c.each(D,function(F,G){ctcAjax.sel_val[F]=G;x+=j(F,C,y)})}})})}v="#ctc_selector_"+z+"_"+y+"_rows";c(v).html(x).find(".color-picker").each(function(){k(this)});c(v).find(".ctc-swatch").each(function(){f(this)})},ctc_query_css=function(x,w,A,y){var v={ctc_query_obj:x,ctc_query_key:w},z="#ctc_status_"+x+("val_qry"==x?"_"+w:"");if("object"===typeof y){c.each(y,function(B,C){v["ctc_query_"+B]=C})}c(".ctc-status-icon").remove();c(z).append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();v.action="ctc_query";v._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,v,function(B){loading[x]=2;c(".ctc-status-icon").removeClass("spinner");if(t(B)){c(".ctc-status-icon").addClass("failure");if("preview"==x){ctcAjax.previewResponse=ctcAjax.css_fail_txt;A(w)}}else{c(".ctc-status-icon").addClass("success");if("preview"==x){ctcAjax.previewResponse=B.shift().data}else{o(B)}if("function"===typeof A){A(w)}return false}},"json").fail(function(){c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure");if("preview"==x){ctcAjax.previewResponse=ctcAjax.css_fail_txt;loading[x]=2;A(w)}else{loading[x]=0}});return false},ctc_save=function(A){var y={},B,x,v,w,C=c(A).attr("id"),z;if(t(b[C])){b[C]=0}b[C]++;c(A).prop("disabled",true);c(".ctc-status-icon").remove();c(A).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();if((B=c("#ctc_new_selectors"))&&"ctc_save_new_selectors"==c(A).attr("id")){y.ctc_new_selectors=B.val();if(x=c("#ctc_sel_ovrd_query_selected")){y.ctc_sel_ovrd_query=x.text()}}else{if((v=c("#ctc_child_imports"))&&"ctc_save_imports"==c(A).attr("id")){y.ctc_child_imports=v.val()}else{y=f(A)}}c("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){z=c("#ctc_rewrite_selector").val(),origsel=c("#ctc_rewrite_selector_orig").val();if(t(z)||!z.toString().match(/\w/)){z=origsel}else{y.ctc_rewrite_selector=z}c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_selector_selected").html(z)});y.action="ctc_update";y._wpnonce=c("#_wpnonce").val();c.post(ctcAjax.ajaxurl,y,function(D){c(A).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");if(t(D)){c(".ctc-status-icon").addClass("failure")}else{c(".ctc-status-icon").addClass("success");c("#ctc_new_selectors").val("");o(D);ctc_setup_menus();if(false===t(r)){ctc_set_selector(r,s);r=s=null}}return false},"json").fail(function(){c(A).prop("disabled",false);c(".ctc-status-icon").removeClass("spinner");c(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(x,v){v=("undefined"==typeof v?"":v);var w={orig:v};if(x.toString().match(/^border(\-(top|right|bottom|left))?$/)){var y=v.toString().split(/ +/);w.names=["_border_width","_border_style","_border_color"];w.values=[("undefined"==typeof y[0]?"":y[0]),("undefined"==typeof y[1]?"":y[1]),("undefined"==typeof y[2]?"":y[2])]}else{if(x.toString().match(/^background\-image/)){w.names=["_background_url","_background_origin","_background_color1","_background_color2"];w.values=["","","",""];if(false===(t(v))&&!(v.toString().match(/url/))){var y=v.toString().split(/:/);w.values[1]=("undefined"==typeof y[0]?"":y[0]);w.values[2]=("undefined"==typeof y[1]?"":y[1]);w.values[3]=("undefined"==typeof y[3]?"":y[3]);w.orig=[w.values[1],w.values[2],w.values[3]].join(" ")}else{w.values[0]=v}}else{w.names=[""];w.values=[v]}}return w},ctc_set_query=function(v){u=v;c("#ctc_sel_ovrd_query").val("");c("#ctc_sel_ovrd_query_selected").text(v);c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").html("&nbsp;");c("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(v);f("#ctc_child_all_0_swatch");c("#ctc_new_selector_row").show()},ctc_set_selector=function(w,v){c("#ctc_sel_ovrd_selector").val("");c("#ctc_sel_ovrd_selector_selected").text(v);c("#ctc_sel_ovrd_qsid").val(w);h=w;if(1!=loading.sel_val){loading.sel_val=0}g(w);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()},ctc_set_rule=function(w,v){c("#ctc_rule_menu").val("");c("#ctc_rule_menu_selected").text(v);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(w);c(".ctc-rewrite-toggle").text(ctcAjax.rename_txt);c("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=a();c("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(w,v){ctc_set_query(v.item.value);return false},focus:function(v){v.preventDefault()}})},ctc_setup_selector_menu=function(v){ctc_selectors=q(v);c("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(x,w){ctc_set_selector(w.item.value,w.item.label);return false},focus:function(w){w.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=d();c("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(w,v){ctc_set_rule(v.item.value,v.item.label);return false},focus:function(v){v.preventDefault()}})},ctc_filtered_rules=function(y,w){var v=[],x=(t(ctcAjax.sel_val[h]))||(t(ctcAjax.sel_val[h].value));if(t(ctc_rules)){ctc_rules=d()}c.each(ctc_rules,function(z,C){var A=false,B=new RegExp(c.ui.autocomplete.escapeRegex(y.term),"i");if(B.test(C.label)){if(false===x){c.each(ctcAjax.sel_val[h].value,function(E,D){if(C.label==E.replace(/\d+/g,e)){A=true;return false}});if(A){return}}v.push(C)}});w(v)},ctc_setup_new_rule_menu=function(){c("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(w,v){w.preventDefault();var x=c(j(h,v.item.label.replace(/[^\w\-]/g,m),"ovrd"));c("#ctc_sel_ovrd_rule_inputs").append(x);c("#ctc_new_rule_menu").val("");if(t(ctcAjax.sel_val[h].value)){ctcAjax.sel_val[h]["value"]={}}ctcAjax.sel_val[h].value[v.item.label]={child:""};x.find('input[type="text"]').each(function(y,z){if(c(z).hasClass("color-picker")){k(z)}c(z).focus()});return false},focus:function(v){v.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(u);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(v,w){var x=false;c.each(ctcAjax.themes,function(y,z){c.each(z,function(A,B){if(A==v&&("parnt"==y||"new"==w)){x=true;return false}});if(x){return false}});return x},ctc_set_notice=function(v){var w="";if(false===t(v)){c.each(v,function(x,y){w+='<div class="'+x+'"><ul>'+l;c(y).each(function(z,A){w+="<li>"+A.toString()+"</li>"+l});w+="</ul></div>"})}c("#ctc_error_notice").html(w)},ctc_validate=function(){var y=/[^\w\-]/,w=c("#ctc_child_template").val().toString().replace(y).toLowerCase(),v=c("#ctc_theme_child").val().toString().replace(y).toLowerCase(),x=c("input[name=ctc_child_type]:checked").val(),z=[];if("new"==x){v=w}if(ctc_theme_exists(v,x)){z.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,v))}if(""===v){z.push(ctcAjax.inval_theme_txt)}if(""===c("#ctc_child_name").val()){z.push(ctcAjax.inval_name_txt)}if(z.length){ctc_set_notice({error:z});return false}return true},ctc_set_theme_menu=function(w){var v=c("#ctc_theme_child").val();if(false===t(ctcAjax.themes.child[v])){c("#ctc_child_name").val(ctcAjax.themes.child[v].Name);c("#ctc_child_author").val(ctcAjax.themes.child[v].Author);c("#ctc_child_version").val(ctcAjax.themes.child[v].Version)}},fade_update_notice=function(){c(".updated, .error").slideUp("slow",function(){c(".updated").remove()})},ctc_focus_panel=function(w){var v=w+"_panel";c(".nav-tab").removeClass("nav-tab-active");c(".ctc-option-panel").removeClass("ctc-option-panel-active");c(".ctc-selector-container").hide();c(w).addClass("nav-tab-active");c(".ctc-option-panel-container").scrollTop(0);c(v).addClass("ctc-option-panel-active")},ctc_selector_edit=function(y){var v=c(y).attr("id").match(/_(\d+)$/)[1],x=ctcAjax.sel_val[v].query,w=ctcAjax.sel_val[v].selector,z="#query_selector_options";ctc_set_query(x);ctc_set_selector(v,w);ctc_focus_panel(z)},ctc_selector_input_toggle=function(w){var v;if(c("#ctc_rewrite_selector").length){v=c("#ctc_rewrite_selector_orig").val();c("#ctc_sel_ovrd_selector_selected").text(v);c(w).text(ctcAjax.rename_txt)}else{v=c("#ctc_sel_ovrd_selector_selected").text();c("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+n(v)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+n(v)+'"/>');c(w).text(ctcAjax.cancel_txt)}};loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];c(".color-picker").each(function(){k(this)});c(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");c(this).iris("toggle");c(".iris-picker").css({position:"absolute","z-index":10})});c(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");c(".color-picker").not(this).iris("hide")});c(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){f(this)});c(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(w){w.preventDefault();ctc_set_notice("");var x=c(this).attr("id").toString().replace("_close",""),v=x.toString().match(/_(\d+)$/)[1];if(c("#"+x+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(v)}c("#"+x+"_container").fadeToggle("fast");c(".ctc-selector-container").not("#"+x+"_container").fadeOut("fast")});c(".nav-tab").on("click",function(v){v.preventDefault();ctc_set_notice("");c(".ctc-status-icon").remove();var w="#"+c(this).attr("id");ctc_focus_panel(w)});c("#view_child_options,#view_parnt_options").on("click",ctc_render_css_preview);c("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});c("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);c(document).on("click",".ctc-save-input",function(v){ctc_save(this)});c(document).on("click",".ctc-selector-edit",function(v){ctc_selector_edit(this)});c(document).on("click",".ctc-rewrite-toggle",function(v){v.preventDefault();ctc_selector_input_toggle(this)});c(document).on("change","#ctc_theme_parnt",function(v){c(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>');c(".spinner").show();document.location="?page=chld_thm_cfg_menu&ctc_parent="+c(this).val()});c(document).on("click","#ctc_additional_css_label",function(v){c(this).toggleClass("open");c("#ctc_additional_css_files").slideToggle("fast")});ctc_setup_menus();ctc_set_query(u);c("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
1
+ jQuery(document).ready(function(t){function e(t){return s(t)?t:t.toString().replace(B,"&quot;")}function c(e){t(e).iris({change:function(){r(e)}})}function a(t){var e=parseInt(t),c=String.fromCharCode(e);return c}function n(t){var e=t.charCodeAt(0);return e}function r(e){var c=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,a=t(e).parents(".ctc-selector-row, .ctc-parent-row").first(),n=a.find(".ctc-swatch").first(),r={parent:{},child:{}},l={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return a.find(".ctc-parent-value, .ctc-child-value").each(function(){var a,n,u=t(this).attr("id"),d=u.toString().match(c),v=d[2],p=d[3],h="undefined"==typeof d[4]?"":d[4],f=d[5],x="undefined"==typeof d[6]?"":d[6],m="parent"==p?t(this).text():t(this).val(),g="ctc_"+v+"_child_"+h+"_i_"+f;if("child"==p&&(_[u]=m,_[g]=t("#"+g).is(":checked")?1:0),""!=m)if(!1===s(x))switch(x){case"_border_width":r[p][h+"-width"]=m;break;case"_border_style":r[p][h+"-style"]=m;break;case"_border_color":r[p][h+"-color"]=m;break;case"_background_url":r[p]["background-image"]=i(p,m);break;case"_background_color":r[p]["background-color"]=e.value;break;case"_background_color1":l[p].start=m,o[p]=!0;break;case"_background_color2":l[p].end=m,o[p]=!0;break;case"_background_origin":l[p].origin=m,o[p]=!0}else(a=h.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!m.match(/none/))?(n=m.toString().split(/ +/),r[p][h+"-width"]="undefined"==typeof n[0]?"":n[0],r[p][h+"-style"]="undefined"==typeof n[1]?"":n[1],r[p][h+"-color"]="undefined"==typeof n[2]?"":n[2]):"background-image"==h?m.toString().match(/url\(/)?r[p]["background-image"]=i(p,m):(n=m.toString().split(/ +/),n.length>2?(l[p].origin="undefined"==typeof n[0]?"top":n[0],l[p].start="undefined"==typeof n[1]?"transparent":n[1],l[p].end="undefined"==typeof n[2]?"transparent":n[2],o[p]=!0):r[p]["background-image"]=m):r[p][h]=m}),"undefined"!=typeof n&&!1===s(n.attr("id"))&&(t(n).removeAttr("style"),o.parent&&t(n).ctcgrad(l.parent.origin,[l.parent.start,l.parent.end]),t(n).css(r.parent),n.attr("id").toString().match(/parent/)||(o.child&&t(n).ctcgrad(l.child.origin,[l.child.start,l.child.end]),t(n).css(r.child))),_}function l(e){var c,a,n;t(e).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data,n=this.key;break;case"val_qry":ctcAjax.val_qry[this.key]=this.data;break;case"rule":ctcAjax.rule=this.data;break;case"sel_ndx":s(this.key)?ctcAjax.sel_ndx=this.data:"qsid"==this.key?(s(ctcAjax.sel_ndx[this.data.query])&&(ctcAjax.sel_ndx[this.data.query]={}),ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid):(ctcAjax.sel_ndx[this.key]=this.data,c=this.key);break;case"sel_val":ctcAjax.sel_val[this.key]=this.data,a=this.key;break;case"rewrite":N=this.key,P=this.data}})}function i(t,e){var c,a=e.toString().match(/url\(['" ]*(.+?)['" ]*\)/),n=s(a)?null:a[1],r=ctcAjax.theme_uri+"/"+("parent"==t?ctcAjax.parnt:ctcAjax.child)+"/";return n?c=n.toString().match(/^(https?:|\/)/)?e:"url("+r+n+")":!1}function s(t){if("undefined"==typeof t||!1===t||null===t||""===t)return!0;if(!0===t||"string"==typeof t||"number"==typeof t)return!1;if("object"==typeof t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}return!1}function o(){var e=[];return 1===G.sel_ndx?e:0===G.sel_ndx?(G.sel_ndx=1,x("sel_ndx",null,b),e):(!1===s(ctcAjax.sel_ndx)&&t.each(ctcAjax.sel_ndx,function(t){var c={label:t,value:t};e.push(c)}),e)}function _(e){var c=[];return 1===G.sel_ndx?c:0===G.sel_ndx?(G.sel_ndx=1,x("sel_ndx",e,A),c):(!1===s(ctcAjax.sel_ndx[e])&&t.each(ctcAjax.sel_ndx[e],function(t,e){var a={label:t,value:e};c.push(a)}),c)}function u(){var e=[];return 1===G.rule?e:0===G.rule?(G.rule=1,x("rule",null,k),e):(!1===s(ctcAjax.rule)&&t.each(ctcAjax.rule,function(t,c){var n={label:c.replace(/\d+/g,a),value:t};e.push(n)}),e.sort(function(t,e){return t.label>e.label?1:t.label<e.label?-1:0}))}function d(c,n,r){var l="",i=s(ctcAjax.sel_val[c])||s(ctcAjax.sel_val[c].value)||s(ctcAjax.sel_val[c].value[n])?"":ctcAjax.sel_val[c].value[n],o=g(n,"undefined"==typeof i?"":i.parnt),_=!1===s(i.i_parnt)&&i.i_parnt?ctcAjax.important_label:"",u=g(n,"undefined"==typeof i?"":i.child),d=!1===s(i.i_child)&&i.i_child?1:0,v="ctc_"+r+"_child_"+n+"_i_"+c;return!1===s(ctcAjax.sel_val[c])&&(l+='<div class="ctc-'+("ovrd"==r?"input":"selector")+'-row clearfix">'+Q,l+='<div class="ctc-input-cell">'+("ovrd"==r?n.replace(/\d+/g,a):ctcAjax.sel_val[c].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+c+'" >'+ctcAjax.edit_txt+"</a> "+(s(o.orig)?ctcAjax.child_only_txt:""))+"</div>"+Q,"ovrd"==r&&(l+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+r+"_parent_"+n+"_"+c+'">'+(s(o.orig)?"[no value]":o.orig+_)+"</div>"+Q),l+='<div class="ctc-input-cell">'+Q,!1===s(o.names)&&(t.each(o.names,function(t,a){a=s(a)?"":a,l+='<div class="ctc-child-input-cell">'+Q;var i,o="ctc_"+r+"_child_"+n+"_"+c+a;!1===(i=u.values.shift())&&(i=""),l+=(s(a)?"":ctcAjax.field_labels[a]+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((a+n).toString().match(/color/)?" color-picker":"")+(a.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+e(i)+'" />'+Q,l+="</div>"+Q}),l+='<label for="'+v+'"><input type="checkbox" id="'+v+'" name="'+v+'" value="1" '+(1===d?"checked":"")+" />"+ctcAjax.important_label+"</label>"+Q),l+="</div>"+Q,l+="ovrd"==r?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+n+"_"+c+'_swatch">'+ctcAjax.swatch_txt+"</div>"+Q+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+n+"_"+c+'_cell">'+Q+'<input type="button" class="button ctc-save-input" id="ctc_save_'+n+"_"+c+'" name="ctc_save_'+n+"_"+c+'" value="Save" /></div>'+Q,l+="</div><!-- end input row -->"+Q),l}function v(e){if(1===G.sel_val)return!1;if(0==G.sel_val)return G.sel_val=1,x("sel_val",e,v),!1;var a,n,l;s(ctcAjax.sel_val[e])?t("#ctc_sel_ovrd_rule_inputs").html(""):(s(ctcAjax.sel_val[e].seq)?t("#ctc_child_load_order_container").html(""):(a="ctc_ovrd_child_seq_"+e,l=parseInt(ctcAjax.sel_val[e].seq),n='<input type="text" id="'+a+'" name="'+a+'" class="ctc-child-value" value="'+l+'" />',t("#ctc_child_load_order_container").html(n)),s(ctcAjax.sel_val[e].value)?t("#ctc_sel_ovrd_rule_inputs").html(""):(n="",t.each(ctcAjax.sel_val[e].value,function(t){n+=d(e,t,"ovrd")}),t("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){c(this)}),r("#ctc_child_all_0_swatch")))}function p(e){if(1===G.preview)return!1;if(0==G.preview){G.preview=1;var e;return(e=t(this).attr("id").toString().match(/(child|parnt)/)[1])||(e="child"),F(""),x("preview",e,p),!1}2==G.preview&&(t("#view_"+e+"_options_panel").text(ctcAjax.previewResponse),G.preview=0)}function h(e){if(1===G.rule_val)return!1;if(0==G.rule_val)return G.rule_val=1,x("rule_val",e,h),!1;var c=ctcAjax.rule[e],a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+c+'">'+Q;!1===s(ctcAjax.rule_val[e])&&(t.each(ctcAjax.rule_val[e],function(t,e){var n=g(c,e);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+c+"_"+t+'">'+Q,a+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+t+"_parent_"+c+"_"+t+'">'+n.orig+"</div>"+Q,a+='<div class="ctc-input-cell">'+Q,a+='<div class="ctc-swatch ctc-specific" id="ctc_'+t+"_parent_"+c+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+Q,a+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+c+"_"+t+'">'+ctcAjax.selector_txt+"</a></div>"+Q,a+='<div id="ctc_selector_'+c+"_"+t+'_container" class="ctc-selector-container clearfix">'+Q,a+='<a href="#" id="ctc_selector_'+c+"_"+t+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+t+'"></div>'+Q,a+='<div id="ctc_selector_'+c+"_"+t+'_rows"></div>'+Q,a+="</div></div>"+Q}),a+="</div>"+Q),t("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){r(this)})}function f(e){if(1==G.val_qry)return!1;var a,l,i=t("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,n),o="";return 0===G.val_qry?(G.val_qry=1,a={rule:i},x("val_qry",e,f,a),!1):(!1===s(ctcAjax.val_qry[e])&&t.each(ctcAjax.val_qry[e],function(c,a){page_rule=c,t.each(a,function(a,n){o+='<h4 class="ctc-query-heading">'+a+"</h4>"+Q,!1===s(n)&&t.each(n,function(t,a){ctcAjax.sel_val[t]=a,o+=d(t,c,e)})})}),l="#ctc_selector_"+i+"_"+e+"_rows",t(l).html(o).find(".color-picker").each(function(){c(this)}),void t(l).find(".ctc-swatch").each(function(){r(this)}))}function x(e,c,a,n){var r={ctc_query_obj:e,ctc_query_key:c},i="#ctc_status_"+e+("val_qry"==e?"_"+c:"");return"object"==typeof n&&t.each(n,function(t,e){r["ctc_query_"+t]=e}),t(".ctc-status-icon").remove(),t(i).append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),r.action="ctc_query",r._wpnonce=t("#_wpnonce").val(),t.post(ctcAjax.ajaxurl,r,function(n){return G[e]=2,t(".ctc-status-icon").removeClass("spinner"),s(n)?(t(".ctc-status-icon").addClass("failure"),void("preview"==e&&(ctcAjax.previewResponse=ctcAjax.css_fail_txt,a(c)))):(t(".ctc-status-icon").addClass("success"),"preview"==e?ctcAjax.previewResponse=n.shift().data:l(n),"function"==typeof a&&a(c),!1)},"json").fail(function(){t(".ctc-status-icon").removeClass("spinner"),t(".ctc-status-icon").addClass("failure"),"preview"==e?(ctcAjax.previewResponse=ctcAjax.css_fail_txt,G[e]=2,a(c)):G[e]=0}),!1}function m(e){var c,a,n,i,o={},_=t(e).attr("id");return s(V[_])&&(V[_]=0),V[_]++,t(e).prop("disabled",!0),t(".ctc-status-icon").remove(),t(e).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),(c=t("#ctc_new_selectors"))&&"ctc_save_new_selectors"==t(e).attr("id")?(o.ctc_new_selectors=c.val(),(a=t("#ctc_sel_ovrd_query_selected"))&&(o.ctc_sel_ovrd_query=a.text())):(n=t("#ctc_child_imports"))&&"ctc_save_imports"==t(e).attr("id")?o.ctc_child_imports=n.val():o=r(e),t("#ctc_sel_ovrd_selector_selected").find("#ctc_rewrite_selector").each(function(){i=t("#ctc_rewrite_selector").val(),origsel=t("#ctc_rewrite_selector_orig").val(),s(i)||!i.toString().match(/\w/)?i=origsel:o.ctc_rewrite_selector=i,t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#ctc_sel_ovrd_selector_selected").html(i)}),o.action="ctc_update",o._wpnonce=t("#_wpnonce").val(),t.post(ctcAjax.ajaxurl,o,function(c){return t(e).prop("disabled",!1),t(".ctc-status-icon").removeClass("spinner"),s(c)?t(".ctc-status-icon").addClass("failure"):(t(".ctc-status-icon").addClass("success"),t("#ctc_new_selectors").val(""),l(c),C(),!1===s(N)&&(j(N,P),N=P=null)),!1},"json").fail(function(){t(e).prop("disabled",!1),t(".ctc-status-icon").removeClass("spinner"),t(".ctc-status-icon").addClass("failure")}),!1}function g(t,e){e="undefined"==typeof e?"":e;var c={orig:e};if(t.toString().match(/^border(\-(top|right|bottom|left))?$/)){var a=e.toString().split(/ +/);c.names=["_border_width","_border_style","_border_color"],c.values=["undefined"==typeof a[0]?"":a[0],"undefined"==typeof a[1]?"":a[1],"undefined"==typeof a[2]?"":a[2]]}else if(t.toString().match(/^background\-image/))if(c.names=["_background_url","_background_origin","_background_color1","_background_color2"],c.values=["","","",""],!1!==s(e)||e.toString().match(/url/))c.values[0]=e;else{var a=e.toString().split(/:/);c.values[1]="undefined"==typeof a[0]?"":a[0],c.values[2]="undefined"==typeof a[1]?"":a[1],c.values[3]="undefined"==typeof a[3]?"":a[3],c.orig=[c.values[1],c.values[2],c.values[3]].join(" ")}else c.names=[""],c.values=[e];return c}function w(e){U=e,t("#ctc_sel_ovrd_query").val(""),t("#ctc_sel_ovrd_query_selected").text(e),t("#ctc_sel_ovrd_selector").val(""),t("#ctc_sel_ovrd_selector_selected").html("&nbsp;"),t("#ctc_sel_ovrd_rule_inputs").html(""),A(e),r("#ctc_child_all_0_swatch"),t("#ctc_new_selector_row").show()}function j(e,c){t("#ctc_sel_ovrd_selector").val(""),t("#ctc_sel_ovrd_selector_selected").text(c),t("#ctc_sel_ovrd_qsid").val(e),O=e,1!=G.sel_val&&(G.sel_val=0),v(e),t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,.ctc-rewrite-toggle").show()}function y(e,c){t("#ctc_rule_menu").val(""),t("#ctc_rule_menu_selected").text(c),1!=G.rule_val&&(G.rule_val=0),h(e),t(".ctc-rewrite-toggle").text(ctcAjax.rename_txt),t("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()}function b(){J=o(),t("#ctc_sel_ovrd_query").autocomplete({source:J,minLength:0,selectFirst:!0,autoFocus:!0,select:function(t,e){return w(e.item.value),!1},focus:function(t){t.preventDefault()}})}function A(e){H=_(e),t("#ctc_sel_ovrd_selector").autocomplete({source:H,selectFirst:!0,autoFocus:!0,select:function(t,e){return j(e.item.value,e.item.label),!1},focus:function(t){t.preventDefault()}})}function k(){K=u(),t("#ctc_rule_menu").autocomplete({source:K,selectFirst:!0,autoFocus:!0,select:function(t,e){return y(e.item.value,e.item.label),!1},focus:function(t){t.preventDefault()}})}function q(e,c){var n=[],r=s(ctcAjax.sel_val[O])||s(ctcAjax.sel_val[O].value);s(K)&&(K=u()),t.each(K,function(c,l){var i=!1,s=new RegExp(t.ui.autocomplete.escapeRegex(e.term),"i");if(s.test(l.label)){if(!1===r&&(t.each(ctcAjax.sel_val[O].value,function(t){return l.label==t.replace(/\d+/g,a)?(i=!0,!1):void 0}),i))return;n.push(l)}}),c(n)}function S(){t("#ctc_new_rule_menu").autocomplete({source:q,selectFirst:!0,autoFocus:!0,select:function(e,a){e.preventDefault();var r=t(d(O,a.item.label.replace(/[^\w\-]/g,n),"ovrd"));return t("#ctc_sel_ovrd_rule_inputs").append(r),t("#ctc_new_rule_menu").val(""),s(ctcAjax.sel_val[O].value)&&(ctcAjax.sel_val[O].value={}),ctcAjax.sel_val[O].value[a.item.label]={child:""},r.find('input[type="text"]').each(function(e,a){t(a).hasClass("color-picker")&&c(a),t(a).focus()}),!1},focus:function(t){t.preventDefault()}})}function C(){b(),A(U),k(),S()}function D(e,c){var a=!1;return t.each(ctcAjax.themes,function(n,r){return t.each(r,function(t){return t!=e||"parnt"!=n&&"new"!=c?void 0:(a=!0,!1)}),a?!1:void 0}),a}function F(e){var c="";!1===s(e)&&t.each(e,function(e,a){c+='<div class="'+e+'"><ul>'+Q,t(a).each(function(t,e){c+="<li>"+e.toString()+"</li>"+Q}),c+="</ul></div>"}),t("#ctc_error_notice").html(c)}function R(){var e=/[^\w\-]/,c=t("#ctc_child_template").val().toString().replace(e).toLowerCase(),a=t("#ctc_theme_child").val().toString().replace(e).toLowerCase(),n=t("input[name=ctc_child_type]:checked").val(),r=[];return"new"==n&&(a=c),D(a,n)&&r.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,a)),""===a&&r.push(ctcAjax.inval_theme_txt),""===t("#ctc_child_name").val()&&r.push(ctcAjax.inval_name_txt),r.length?(F({error:r}),!1):!0}function $(){var e=t("#ctc_theme_child").val();!1===s(ctcAjax.themes.child[e])&&(t("#ctc_child_name").val(ctcAjax.themes.child[e].Name),t("#ctc_child_author").val(ctcAjax.themes.child[e].Author),t("#ctc_child_version").val(ctcAjax.themes.child[e].Version))}function T(){t(".updated, .error").slideUp("slow",function(){t(".updated").remove()})}function E(){var e,c=t("#ctc_theme_parnt").val(),a=ctcAjax.homeurl+"?preview=1&template="+c+"&stylesheet="+c,n=new RegExp("<link rel=[\"']stylesheet[\"'][^>]+?"+ctcAjax.theme_uri+"/"+c+"/(.+?\\.css)[^>]+?>","g");s(c)||t.get(a,function(c){for(;(e=n.exec(c))&&(ctcAjax.addl_css.push(e[1]),"style.css"!=e[1]);)t(".ctc_checkbox").each(function(){t(this).val()==e[1]&&t(this).prop("checked",!0)})})}function L(e){var c=e+"_panel";t(".nav-tab").removeClass("nav-tab-active"),t(".ctc-option-panel").removeClass("ctc-option-panel-active"),t(".ctc-selector-container").hide(),t(e).addClass("nav-tab-active"),t(".ctc-option-panel-container").scrollTop(0),t(c).addClass("ctc-option-panel-active")}function z(e){var c=t(e).attr("id").match(/_(\d+)$/)[1],a=ctcAjax.sel_val[c].query,n=ctcAjax.sel_val[c].selector,r="#query_selector_options";w(a),j(c,n),L(r)}function I(c){var a;t("#ctc_rewrite_selector").length?(a=t("#ctc_rewrite_selector_orig").val(),t("#ctc_sel_ovrd_selector_selected").text(a),t(c).text(ctcAjax.rename_txt)):(a=t("#ctc_sel_ovrd_selector_selected").text(),t("#ctc_sel_ovrd_selector_selected").html('<input id="ctc_rewrite_selector" name="ctc_rewrite_selector" type="text" value="'+e(a)+'" autocomplete="off" /><input id="ctc_rewrite_selector_orig" name="ctc_rewrite_selector_orig" type="hidden" value="'+e(a)+'"/>'),t(c).text(ctcAjax.cancel_txt))}var O,N,P,Q="\n",U="base",V={},B=new RegExp('"',"g"),G={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0,preview:0},H=[],J=[],K=[];t(".color-picker").each(function(){c(this)}),t(".ctc-option-panel-container").on("focus",".color-picker",function(){F(""),t(this).iris("toggle"),t(".iris-picker").css({position:"absolute","z-index":10})}),t(".ctc-option-panel-container").on("focus","input",function(){F(""),t(".color-picker").not(this).iris("hide")}),t(".ctc-option-panel-container").on("change",".ctc-child-value, input[type=checkbox]",function(){r(this)}),t(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(e){e.preventDefault(),F("");var c=t(this).attr("id").toString().replace("_close",""),a=c.toString().match(/_(\d+)$/)[1];t("#"+c+"_container").is(":hidden")&&(1!=G.val_qry&&(G.val_qry=0),f(a)),t("#"+c+"_container").fadeToggle("fast"),t(".ctc-selector-container").not("#"+c+"_container").fadeOut("fast")}),t(".nav-tab").on("click",function(e){e.preventDefault(),F(""),t(".ctc-status-icon").remove();var c="#"+t(this).attr("id");L(c)}),t("#view_child_options,#view_parnt_options").on("click",p),t("#ctc_load_form").on("submit",function(){return R()&&confirm(ctcAjax.load_txt)}),t("#parent_child_options_panel").on("change","#ctc_theme_child",$),t(document).on("click",".ctc-save-input",function(){m(this)}),t(document).on("click",".ctc-selector-edit",function(){z(this)}),t(document).on("click",".ctc-rewrite-toggle",function(t){t.preventDefault(),I(this)}),t(document).on("change","#ctc_theme_parnt",function(){t(this).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner"></span>'),t(".spinner").show(),document.location="?page=chld_thm_cfg_menu&ctc_parent="+t(this).val()}),t(document).on("click","#ctc_additional_css_label",function(){t(this).toggleClass("open"),t("#ctc_additional_css_files").slideToggle("fast")}),C(),w(U),E(),t("input[type=submit],input[type=button]").prop("disabled",!1),setTimeout(T,6e3)});
 
 
 
 
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, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 4.0
7
- Stable tag: 1.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -226,6 +226,10 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
226
 
227
  == Changelog ==
228
 
 
 
 
 
229
  = 1.5.1 =
230
  * Added copy option to Parent/Child tab to assign menu locations, sidebars/widgets, custom header, background, and other options to the new Child Theme.
231
 
@@ -368,7 +372,8 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
368
 
369
  == Upgrade Notice ==
370
 
371
- Added copy option to Parent/Child tab to assign menu locations, sidebars/widgets, custom header, background, and other options to the new Child Theme.
 
372
 
373
  == Create Your Child Theme ==
374
 
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.7
6
  Tested up to: 4.0
7
+ Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
226
 
227
  == Changelog ==
228
 
229
+ = 1.5.2 =
230
+ * Automatically set additional stylesheets to parse based on parent theme links in head.
231
+ * Render parent CSS including additional stylesheets
232
+
233
  = 1.5.1 =
234
  * Added copy option to Parent/Child tab to assign menu locations, sidebars/widgets, custom header, background, and other options to the new Child Theme.
235
 
372
 
373
  == Upgrade Notice ==
374
 
375
+ * Automatically set additional stylesheets to parse based on parent theme links in head.
376
+ * Render parent CSS including additional stylesheets
377
 
378
  == Create Your Child Theme ==
379