Child Theme Configurator - Version 1.1.1

Version Description

  • Fixed major bug where inputs containing '0' were being ignored
  • Removed "no leading digits" requirement for theme slug
  • Change query sort function to keep parent order of queries without device width rules
  • Fixed gettext calls to use static namespace parameter
  • Auto populate child theme inputs when existing theme is selected
  • Correctly remove border when values are blanked
  • Fixed duplicate "new rule" bug on Query/Selector panel
  • added timestamp to backup file
  • Added encode_shorthand function to recombine margin/padding values when all 4 sides are present
Download this release

Release Info

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

Code changes from version 1.1.0 to 1.1.1

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 Child Theme from any Theme or Stylesheet
9
- Version: 1.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
6
  Plugin Name: Child Theme Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Create Child Theme from any Theme or Stylesheet
9
+ Version: 1.1.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
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.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -42,7 +42,7 @@ class Child_Theme_Configurator_CSS {
42
 
43
  function __construct() {
44
  // scalars
45
- $this->version = '1.1.0';
46
  $this->querykey = 0;
47
  $this->selkey = 0;
48
  $this->qskey = 0;
@@ -156,13 +156,13 @@ class Child_Theme_Configurator_CSS {
156
  else:
157
  $rules[] = 'background-image';
158
  $values[] = $url;
159
- if (!empty($parts[0]) && '' != $parts[0]):
160
  $rules[] = 'background-color';
161
  $values[] = trim($parts[0]);
162
  endif;
163
  $position = array();
164
  foreach(preg_split('/ +/', trim($parts[1])) as $part):
165
- if (empty($part) || '' == $part) continue;
166
  if (false === strpos($part, 'repeat')):
167
  $position[] = $part;
168
  else:
@@ -229,6 +229,34 @@ class Child_Theme_Configurator_CSS {
229
  $values[3] = $parts[3];
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  /*
233
  * parse_css_file
234
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
@@ -295,18 +323,19 @@ class Child_Theme_Configurator_CSS {
295
  endif;
296
  $qsid = $this->sel_ndx[$this->dict_query[$query]][$this->dict_sel[$sel]];
297
  $ruleid = $this->dict_rule[$rule];
298
- //$important = $this->is_important($value);
299
  if (!isset($this->dict_val[$value])):
300
  $this->dict_val[$value] = ++$this->valkey;
301
  endif;
302
  $this->val_ndx[$qsid][$ruleid][$template] = $this->dict_val[$value];
303
  $this->val_ndx[$qsid][$ruleid]['i'] = $important;
304
  // tell the UI to add a single cached query/selector data array:
305
- $this->updates[] = array(
306
  'obj' => 'sel_val',
307
  'key' => $qsid,
308
  'data' => $this->denorm_sel_val($qsid),
309
  );
 
310
  endif;
311
  }
312
 
@@ -403,7 +432,7 @@ class Child_Theme_Configurator_CSS {
403
  * New selectors are appended to the end of each media query block.
404
  * TODO: allow user to modify selector sequence, !important flags and @media sort
405
  */
406
- function write_css() {
407
  // write new stylesheet
408
  $output = '/*' . LF;
409
  $output .= 'Theme Name: ' . $this->child_name . LF;
@@ -434,16 +463,18 @@ class Child_Theme_Configurator_CSS {
434
  $has_value = 0;
435
  $sel = $selarr[$selid];
436
  if (!empty($this->val_ndx[$qsid])):
 
437
  foreach ($this->val_ndx[$qsid] as $ruleid => $valid):
438
- if (isset($valid['child']) && isset($valarr[$valid['child']]) && '' != $valarr[$valid['child']]):
439
  if (! $has_value):
440
  $sel_output .= $sel . ' {' . LF;
441
  $has_value = 1;
442
  $has_selector = 1;
443
  endif;
444
- $sel_output .= $this->add_vendor_rules($rulearr[$ruleid], $valarr[$valid['child']]);
445
  endif;
446
  endforeach;
 
447
  if ($has_value):
448
  $sel_output .= '}' . LF;
449
  endif;
@@ -458,9 +489,10 @@ class Child_Theme_Configurator_CSS {
458
  if (!is_dir($themedir)):
459
  mkdir($themedir, 0755);
460
  endif;
461
- // backup current stylesheet if no backup exists
462
- if (is_file($stylesheet) && !is_file($stylesheet . '.bak')):
463
- file_put_contents($stylesheet . '.bak', file_get_contents($stylesheet));
 
464
  endif;
465
  // write new stylesheet
466
  file_put_contents($stylesheet, $output);
@@ -472,9 +504,12 @@ class Child_Theme_Configurator_CSS {
472
  * These are based on commonly used practices and not all vendor prefixed are supported
473
  * TODO: verify this logic against vendor and W3C documentation
474
  */
475
- function add_vendor_rules($rule, $value) {
476
  $rules = '';
477
- if (preg_match("/^(box\-sizing|font\-smoothing|border\-radius|box\-shadow|transition)$/", $rule)):
 
 
 
478
  foreach(array('moz', 'webkit', 'o') as $prefix):
479
  $rules .= ' -' . $prefix . '-' . $rule . ': ' . $value . ';' . LF;
480
  endforeach;
@@ -625,7 +660,7 @@ class Child_Theme_Configurator_CSS {
625
  $ruleid = $this->dict_rule[$rule];
626
  $qsid = $matches[3];
627
  $value = sanitize_text_field($_POST[$post_key]);
628
- if (isset($this->val_ndx[$qsid][$ruleid]) && isset($this->val_ndx[$qsid][$ruleid]['child'])):
629
  $child_value = $this->val_ndx[$qsid][$ruleid]['child'];
630
  else:
631
  $child_value = $this->val_ndx[$qsid][$ruleid]['child'] = '';
@@ -634,8 +669,8 @@ class Child_Theme_Configurator_CSS {
634
  $parent_value = $this->val_ndx[$qsid][$ruleid]['parnt'];
635
  else:
636
  $parent_value = $this->val_ndx[$qsid][$ruleid]['parnt'] = '';
637
- endif;
638
- $important = $this->val_ndx[$qsid][$ruleid]['i'];
639
 
640
  $selarr = $this->denorm_query_sel($qsid);
641
  if (!empty($matches[5])):
@@ -677,7 +712,7 @@ class Child_Theme_Configurator_CSS {
677
  $value = '';
678
  endif;
679
  $this->update_arrays('child', $rule_part['query'], $rule_part['selector'],
680
- $rule, $value, $rule_part['important']);
681
  endforeach;
682
  endforeach;
683
  endif;
@@ -731,7 +766,7 @@ class Child_Theme_Configurator_CSS {
731
  foreach ($this->val_ndx as $selid => $rules):
732
  if (!isset($rules[$ruleid])) continue;
733
  foreach ($rules[$ruleid] as $theme => $val):
734
- if (!isset($val_arr[$val]) || '' == $val_arr[$val]) continue;
735
  $rule_sel_arr[$val] = $val_arr[$val];
736
  endforeach;
737
  endforeach;
@@ -786,7 +821,9 @@ class Child_Theme_Configurator_CSS {
786
  if (isset($this->val_ndx[$qsid]) && is_array($this->val_ndx[$qsid])):
787
  foreach ($this->val_ndx[$qsid] as $ruleid => $values):
788
  foreach ($values as $name => $val):
789
- if ('i' == $name || !isset($valarr[$val]) || '' == $valarr[$val]) continue;
 
 
790
  $selarr['value'][$rulearr[$ruleid]][$name] = $valarr[$val];
791
  endforeach;
792
  endforeach;
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.1.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
42
 
43
  function __construct() {
44
  // scalars
45
+ $this->version = '1.1.1';
46
  $this->querykey = 0;
47
  $this->selkey = 0;
48
  $this->qskey = 0;
156
  else:
157
  $rules[] = 'background-image';
158
  $values[] = $url;
159
+ if (!empty($parts[0]) && '' !== $parts[0]):
160
  $rules[] = 'background-color';
161
  $values[] = trim($parts[0]);
162
  endif;
163
  $position = array();
164
  foreach(preg_split('/ +/', trim($parts[1])) as $part):
165
+ if (empty($part) || '' === $part) continue;
166
  if (false === strpos($part, 'repeat')):
167
  $position[] = $part;
168
  else:
229
  $values[3] = $parts[3];
230
  }
231
 
232
+ function encode_shorthand($shorthand) {
233
+ $rules = '';
234
+ foreach (array_keys($shorthand) as $key):
235
+ $rule = $shorthand[$key];
236
+ if (4 == count($rule)):
237
+ $parts = array();
238
+ $parts[0] = $rule['top'];
239
+ if ($rule['left'] != $rule['right']):
240
+ $parts[3] = $rule['left'];
241
+ $parts[2] = $rule['bottom'];
242
+ $parts[1] = $rule['right'];
243
+ endif;
244
+ if ($rule['bottom'] != $rule['top']):
245
+ $parts[2] = $rule['bottom'];
246
+ $parts[1] = $rule['right'];
247
+ endif;
248
+ if ($rule['right'] != $rule['top']):
249
+ $parts[1] = $rule['right'];
250
+ endif;
251
+ $rules .= ' ' . $key . ': ' . implode(' ', $parts) . ';' . LF;
252
+ else:
253
+ foreach ($rule as $side => $value):
254
+ $rules .= ' ' . $key . '-' . $side . ': ' . $value . ';' . LF;
255
+ endforeach;
256
+ endif;
257
+ endforeach;
258
+ return $rules;
259
+ }
260
  /*
261
  * parse_css_file
262
  * reads stylesheet to get WordPress meta data and passes rest to parse_css
323
  endif;
324
  $qsid = $this->sel_ndx[$this->dict_query[$query]][$this->dict_sel[$sel]];
325
  $ruleid = $this->dict_rule[$rule];
326
+
327
  if (!isset($this->dict_val[$value])):
328
  $this->dict_val[$value] = ++$this->valkey;
329
  endif;
330
  $this->val_ndx[$qsid][$ruleid][$template] = $this->dict_val[$value];
331
  $this->val_ndx[$qsid][$ruleid]['i'] = $important;
332
  // tell the UI to add a single cached query/selector data array:
333
+ $updatearr = array(
334
  'obj' => 'sel_val',
335
  'key' => $qsid,
336
  'data' => $this->denorm_sel_val($qsid),
337
  );
338
+ $this->updates[] = $updatearr;
339
  endif;
340
  }
341
 
432
  * New selectors are appended to the end of each media query block.
433
  * TODO: allow user to modify selector sequence, !important flags and @media sort
434
  */
435
+ function write_css($backup = false) {
436
  // write new stylesheet
437
  $output = '/*' . LF;
438
  $output .= 'Theme Name: ' . $this->child_name . LF;
463
  $has_value = 0;
464
  $sel = $selarr[$selid];
465
  if (!empty($this->val_ndx[$qsid])):
466
+ $shorthand = array();
467
  foreach ($this->val_ndx[$qsid] as $ruleid => $valid):
468
+ if (isset($valid['child']) && isset($valarr[$valid['child']]) && '' !== $valarr[$valid['child']]):
469
  if (! $has_value):
470
  $sel_output .= $sel . ' {' . LF;
471
  $has_value = 1;
472
  $has_selector = 1;
473
  endif;
474
+ $sel_output .= $this->add_vendor_rules($rulearr[$ruleid], $valarr[$valid['child']], $shorthand);
475
  endif;
476
  endforeach;
477
+ $sel_output .= $this->encode_shorthand($shorthand);
478
  if ($has_value):
479
  $sel_output .= '}' . LF;
480
  endif;
489
  if (!is_dir($themedir)):
490
  mkdir($themedir, 0755);
491
  endif;
492
+ // backup current stylesheet
493
+ if ($backup && is_file($stylesheet)):
494
+ $timestamp = date('YmdHis', current_time('timestamp'));
495
+ file_put_contents($stylesheet . '-' . $timestamp . '.bak', file_get_contents($stylesheet));
496
  endif;
497
  // write new stylesheet
498
  file_put_contents($stylesheet, $output);
504
  * These are based on commonly used practices and not all vendor prefixed are supported
505
  * TODO: verify this logic against vendor and W3C documentation
506
  */
507
+ function add_vendor_rules($rule, $value, &$shorthand) {
508
  $rules = '';
509
+ if (preg_match("/^(margin|padding)\-(top|right|bottom|left)$/", $rule, $matches)):
510
+ $shorthand[$matches[1]][$matches[2]] = $value;
511
+ return '';
512
+ elseif (preg_match("/^(box\-sizing|font\-smoothing|border\-radius|box\-shadow|transition)$/", $rule)):
513
  foreach(array('moz', 'webkit', 'o') as $prefix):
514
  $rules .= ' -' . $prefix . '-' . $rule . ': ' . $value . ';' . LF;
515
  endforeach;
660
  $ruleid = $this->dict_rule[$rule];
661
  $qsid = $matches[3];
662
  $value = sanitize_text_field($_POST[$post_key]);
663
+ /*if (isset($this->val_ndx[$qsid][$ruleid]) && isset($this->val_ndx[$qsid][$ruleid]['child'])):
664
  $child_value = $this->val_ndx[$qsid][$ruleid]['child'];
665
  else:
666
  $child_value = $this->val_ndx[$qsid][$ruleid]['child'] = '';
669
  $parent_value = $this->val_ndx[$qsid][$ruleid]['parnt'];
670
  else:
671
  $parent_value = $this->val_ndx[$qsid][$ruleid]['parnt'] = '';
672
+ endif;*/
673
+ $important = empty($this->val_ndx[$qsid][$ruleid]['i']) ? 0 : $this->val_ndx[$qsid][$ruleid]['i'];
674
 
675
  $selarr = $this->denorm_query_sel($qsid);
676
  if (!empty($matches[5])):
712
  $value = '';
713
  endif;
714
  $this->update_arrays('child', $rule_part['query'], $rule_part['selector'],
715
+ $rule, trim($value), $rule_part['important']);
716
  endforeach;
717
  endforeach;
718
  endif;
766
  foreach ($this->val_ndx as $selid => $rules):
767
  if (!isset($rules[$ruleid])) continue;
768
  foreach ($rules[$ruleid] as $theme => $val):
769
+ if (!isset($val_arr[$val]) || '' === $val_arr[$val]) continue;
770
  $rule_sel_arr[$val] = $val_arr[$val];
771
  endforeach;
772
  endforeach;
821
  if (isset($this->val_ndx[$qsid]) && is_array($this->val_ndx[$qsid])):
822
  foreach ($this->val_ndx[$qsid] as $ruleid => $values):
823
  foreach ($values as $name => $val):
824
+ if ('i' == $name || !isset($valarr[$val]) || '' === $valarr[$val]):
825
+ continue;
826
+ endif;
827
  $selarr['value'][$rulearr[$ruleid]][$name] = $valarr[$val];
828
  endforeach;
829
  endforeach;
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.1.0
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.lilaeamedia.com/plugins/child-theme-configurator/
7
  Description: Handles the plugin User Interface
8
+ Version: 1.1.1
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.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
- Version: 1.1.0
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
@@ -18,7 +18,7 @@ require_once('class-ctc-ui.php');
18
  require_once('class-ctc-css.php');
19
  class Child_Theme_Configurator {
20
 
21
- var $version = '1.1.0';
22
  var $css;
23
  var $optionsName;
24
  var $menuName;
@@ -132,7 +132,7 @@ class Child_Theme_Configurator {
132
  function load_css() {
133
  if (!($this->css = get_option($this->optionsName))
134
  || !is_object($this->css)
135
- // upgrade to v.1.1.0
136
  || !($version = $this->css->get_property('version')))
137
 
138
  $this->css = new Child_Theme_Configurator_CSS();
@@ -211,7 +211,7 @@ class Child_Theme_Configurator {
211
  $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
212
  endif;
213
  endif;
214
- if (empty($child) || preg_match("%^[^a-z]%", $child)):
215
  $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
216
  endif;
217
  if (empty($name)):
@@ -229,7 +229,7 @@ class Child_Theme_Configurator {
229
  $this->css->set_property('child_version', $version);
230
  $this->css->parse_css_file('parnt');
231
  $this->css->parse_css_file('child');
232
- $this->css->write_css();
233
  update_option($this->optionsName, $this->css);
234
  endif;
235
  }
6
  Class: Child_Theme_Configurator
7
  Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
8
  Description: Main Controller Class
9
+ Version: 1.1.1
10
  Author: Lilaea Media
11
  Author URI: http://www.lilaeamedia.com/
12
  Text Domain: chld_thm_cfg
18
  require_once('class-ctc-css.php');
19
  class Child_Theme_Configurator {
20
 
21
+ var $version = '1.1.1';
22
  var $css;
23
  var $optionsName;
24
  var $menuName;
132
  function load_css() {
133
  if (!($this->css = get_option($this->optionsName))
134
  || !is_object($this->css)
135
+ // upgrade to v.1.1.1
136
  || !($version = $this->css->get_property('version')))
137
 
138
  $this->css = new Child_Theme_Configurator_CSS();
211
  $this->errors[] = sprintf(__('<strong>%s</strong> exists. Please enter a different Child Theme template name', 'chld_thm_cfg'), $child);
212
  endif;
213
  endif;
214
+ if (empty($child)):
215
  $this->errors[] = __('Please enter a valid Child Theme template name', 'chld_thm_cfg');
216
  endif;
217
  if (empty($name)):
229
  $this->css->set_property('child_version', $version);
230
  $this->css->parse_css_file('parnt');
231
  $this->css->parse_css_file('child');
232
+ $this->css->write_css(true); // backup current stylesheet
233
  update_option($this->optionsName, $this->css);
234
  endif;
235
  }
js/chld-thm-cfg.js CHANGED
@@ -2,7 +2,7 @@
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.1.0
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
@@ -11,7 +11,9 @@
11
  jQuery(document).ready(function($){
12
 
13
  var lf = "\n",
14
-
 
 
15
  // initialize functions
16
  ctc_setup_iris = function(obj) {
17
  $(obj).iris({
@@ -53,7 +55,7 @@ jQuery(document).ready(function($){
53
  if ('child' == inputtheme) {
54
  postdata[inputid] = value;
55
  }
56
- if (ctc_is_empty(value)) return;
57
  // handle specific inputs
58
  if (false === ctc_is_empty(rulepart)) {
59
  switch(rulepart) {
@@ -179,8 +181,8 @@ jQuery(document).ready(function($){
179
  },
180
 
181
  ctc_is_empty = function(obj) {
182
- // first bail when definitely empty or undefined (true)
183
- if ('undefined' == typeof obj || false === obj || null === obj || '' === obj || 0 === obj) { return true; }
184
  // then, if this is bool, string or number it must not be empty (false)
185
  if (true === obj || "string" === typeof obj || "number" === typeof obj) { return false; }
186
  // thanks to Abena Kuttin for Win safe version
@@ -286,7 +288,7 @@ jQuery(document).ready(function($){
286
  html += '<div class="ctc-child-input-cell">' + lf;
287
  var id = 'ctc_' + (specific? '' : 'ovrd_') + 'child_' + rule + '_' + qsid + newname,
288
  newval;
289
- if (!(newval = newRuleObj.values.shift()) ){
290
  newval = '';
291
  }
292
 
@@ -450,7 +452,12 @@ jQuery(document).ready(function($){
450
  },
451
  ctc_save = function(obj) {
452
  var postdata = {},
453
- $selector, $query, $imports, $rule;
 
 
 
 
 
454
  // disable the button until ajax returns
455
  $(obj).prop('disabled', true);
456
  // clear previous success/fail icons
@@ -480,6 +487,7 @@ jQuery(document).ready(function($){
480
  postdata,
481
  //on success function
482
  function(response){
 
483
  // release button
484
  $(obj).prop('disabled', false);
485
  // hide spinner
@@ -491,12 +499,12 @@ jQuery(document).ready(function($){
491
  $('.ctc-status-icon').addClass('success');
492
  $('#ctc_new_selectors').val('');
493
  // update data objects
494
- ctc_update_cache(response);
495
- ctc_setup_menus();
496
  }
497
  return false;
498
- },
499
- 'json'
500
  ).fail(function(){
501
  // release button
502
  $(obj).prop('disabled', false);
@@ -609,6 +617,7 @@ jQuery(document).ready(function($){
609
  ctc_set_query = function(value) {
610
  $('#ctc_sel_ovrd_query').val('');
611
  $('#ctc_sel_ovrd_query_selected').text(value);
 
612
  ctc_setup_selector_menu(value);
613
  $('#ctc_new_selector_row').show();
614
  },
@@ -617,6 +626,7 @@ jQuery(document).ready(function($){
617
  $('#ctc_sel_ovrd_selector').val('');
618
  $('#ctc_sel_ovrd_selector_selected').text(label);
619
  $('#ctc_sel_ovrd_qsid').val(value);
 
620
  if (1 != loading.sel_val) loading.sel_val = 0;
621
  ctc_render_selector_inputs(value);
622
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs').show();
@@ -670,18 +680,45 @@ jQuery(document).ready(function($){
670
  focus: function(e) { e.preventDefault(); }
671
  });
672
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  ctc_setup_new_rule_menu = function() {
674
  $('#ctc_new_rule_menu').autocomplete({
675
- source: ctc_rules,
676
  //minLength: 0,
677
  selectFirst: true,
678
  autoFocus: true,
679
  select: function(e, ui) {
680
- var qsid = $('#ctc_sel_ovrd_qsid').val();
681
- $('#ctc_sel_ovrd_rule_inputs').append(ctc_render_child_rule_input(qsid, ui.item.label, false)).find('.color-picker').each(function() {
682
  ctc_setup_iris(this);
683
  });
684
  $('#ctc_new_rule_menu').val('');
 
685
  return false;
686
  },
687
  focus: function(e) { e.preventDefault(); }
@@ -689,7 +726,7 @@ jQuery(document).ready(function($){
689
  },
690
  ctc_setup_menus = function() {
691
  ctc_setup_query_menu();
692
- ctc_setup_selector_menu('');
693
  ctc_setup_rule_menu();
694
  ctc_setup_new_rule_menu();
695
  },
@@ -730,10 +767,10 @@ jQuery(document).ready(function($){
730
  if (ctc_theme_exists(slug, type)) {
731
  errors.push(ctcAjax.theme_exists_txt.replace(/%s/, slug));
732
  }
733
- if ('' == slug || slug.match(/^[^a-z]/)) {
734
  errors.push(ctcAjax.inval_theme_txt);
735
  }
736
- if ('' == $('#ctc_child_name').val()) {
737
  errors.push(ctcAjax.inval_name_txt);
738
  }
739
  if (errors.length) {
@@ -742,7 +779,7 @@ jQuery(document).ready(function($){
742
  }
743
  return true;
744
  },
745
- ctc_set_theme_menu = function() {
746
  var slug = $('#ctc_theme_child').val();
747
  if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
748
  $('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
@@ -763,9 +800,9 @@ jQuery(document).ready(function($){
763
  'sel_val': 0
764
  },
765
 
766
- ctc_selectors = [],
767
- ctc_queries = [],
768
- ctc_rules = [];
769
  // -- end var definitions
770
 
771
  // initialize Iris color picker
@@ -826,6 +863,7 @@ jQuery(document).ready(function($){
826
  $('#ctc_load_form').on('submit', function() {
827
  return (ctc_validate() && confirm(ctcAjax.load_txt) ) ;
828
  });
 
829
  $(document).on('click', '.ctc-save-input', function(e) {
830
  ctc_save(this);
831
  });
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.1.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
11
  jQuery(document).ready(function($){
12
 
13
  var lf = "\n",
14
+ currentQuery = '',
15
+ currentSel,
16
+ saveEvents = {},
17
  // initialize functions
18
  ctc_setup_iris = function(obj) {
19
  $(obj).iris({
55
  if ('child' == inputtheme) {
56
  postdata[inputid] = value;
57
  }
58
+ if ('' === value) return;
59
  // handle specific inputs
60
  if (false === ctc_is_empty(rulepart)) {
61
  switch(rulepart) {
181
  },
182
 
183
  ctc_is_empty = function(obj) {
184
+ // first bail when definitely empty or undefined (true) NOTE: zero is not empty
185
+ if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
186
  // then, if this is bool, string or number it must not be empty (false)
187
  if (true === obj || "string" === typeof obj || "number" === typeof obj) { return false; }
188
  // thanks to Abena Kuttin for Win safe version
288
  html += '<div class="ctc-child-input-cell">' + lf;
289
  var id = 'ctc_' + (specific? '' : 'ovrd_') + 'child_' + rule + '_' + qsid + newname,
290
  newval;
291
+ if (false === (newval = newRuleObj.values.shift()) ){
292
  newval = '';
293
  }
294
 
452
  },
453
  ctc_save = function(obj) {
454
  var postdata = {},
455
+ $selector, $query, $imports, $rule,
456
+ id = $(obj).attr('id');
457
+ if (ctc_is_empty(saveEvents[id])) {
458
+ saveEvents[id] = 0;
459
+ }
460
+ saveEvents[id]++;
461
  // disable the button until ajax returns
462
  $(obj).prop('disabled', true);
463
  // clear previous success/fail icons
487
  postdata,
488
  //on success function
489
  function(response){
490
+ //console.log(response);
491
  // release button
492
  $(obj).prop('disabled', false);
493
  // hide spinner
499
  $('.ctc-status-icon').addClass('success');
500
  $('#ctc_new_selectors').val('');
501
  // update data objects
502
+ ////ctc_update_cache(response);
503
+ ////ctc_setup_menus();
504
  }
505
  return false;
506
+ }/*,
507
+ 'json'*/
508
  ).fail(function(){
509
  // release button
510
  $(obj).prop('disabled', false);
617
  ctc_set_query = function(value) {
618
  $('#ctc_sel_ovrd_query').val('');
619
  $('#ctc_sel_ovrd_query_selected').text(value);
620
+ currentQuery = value;
621
  ctc_setup_selector_menu(value);
622
  $('#ctc_new_selector_row').show();
623
  },
626
  $('#ctc_sel_ovrd_selector').val('');
627
  $('#ctc_sel_ovrd_selector_selected').text(label);
628
  $('#ctc_sel_ovrd_qsid').val(value);
629
+ currentSel = value;
630
  if (1 != loading.sel_val) loading.sel_val = 0;
631
  ctc_render_selector_inputs(value);
632
  $('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs').show();
680
  focus: function(e) { e.preventDefault(); }
681
  });
682
  },
683
+ ctc_filtered_rules = function(request, response) {
684
+ var arr = [];
685
+ if (false === (ctc_is_empty(ctcAjax.sel_val[currentSel]))) {
686
+ if (ctc_is_empty(ctc_rules)) {
687
+ ctc_rules = ctc_load_rules();
688
+ }
689
+ $.each(ctc_rules, function(key, val){
690
+ var skip = false,
691
+ matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
692
+ if (matcher.test( val.label )) {
693
+ // skip rule if in current selector array
694
+ $.each(ctcAjax.sel_val[currentSel].value, function(rule, value) {
695
+ if (val.label == rule) {
696
+ skip = true;
697
+ return false;
698
+ }
699
+ });
700
+ if (skip) {
701
+ return;
702
+ }
703
+ // add rule
704
+ arr.push(val);
705
+ }
706
+ });
707
+ }
708
+ response(arr);
709
+ },
710
  ctc_setup_new_rule_menu = function() {
711
  $('#ctc_new_rule_menu').autocomplete({
712
+ source: ctc_filtered_rules,
713
  //minLength: 0,
714
  selectFirst: true,
715
  autoFocus: true,
716
  select: function(e, ui) {
717
+ $('#ctc_sel_ovrd_rule_inputs').append(ctc_render_child_rule_input(currentSel, ui.item.label, false)).find('.color-picker').each(function() {
 
718
  ctc_setup_iris(this);
719
  });
720
  $('#ctc_new_rule_menu').val('');
721
+ ctcAjax.sel_val[currentSel].value[ui.item.label] = {'child': ''};
722
  return false;
723
  },
724
  focus: function(e) { e.preventDefault(); }
726
  },
727
  ctc_setup_menus = function() {
728
  ctc_setup_query_menu();
729
+ ctc_setup_selector_menu(currentQuery);
730
  ctc_setup_rule_menu();
731
  ctc_setup_new_rule_menu();
732
  },
767
  if (ctc_theme_exists(slug, type)) {
768
  errors.push(ctcAjax.theme_exists_txt.replace(/%s/, slug));
769
  }
770
+ if ('' === slug) {
771
  errors.push(ctcAjax.inval_theme_txt);
772
  }
773
+ if ('' === $('#ctc_child_name').val()) {
774
  errors.push(ctcAjax.inval_name_txt);
775
  }
776
  if (errors.length) {
779
  }
780
  return true;
781
  },
782
+ ctc_set_theme_menu = function(e) {
783
  var slug = $('#ctc_theme_child').val();
784
  if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
785
  $('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
800
  'sel_val': 0
801
  },
802
 
803
+ ctc_selectors = [],
804
+ ctc_queries = [],
805
+ ctc_rules = [];
806
  // -- end var definitions
807
 
808
  // initialize Iris color picker
863
  $('#ctc_load_form').on('submit', function() {
864
  return (ctc_validate() && confirm(ctcAjax.load_txt) ) ;
865
  });
866
+ $('#parent_child_options_panel').on('change', '#ctc_theme_child', ctc_set_theme_menu );
867
  $(document).on('click', '.ctc-save-input', function(e) {
868
  ctc_save(this);
869
  });
js/chld-thm-cfg.min.js CHANGED
@@ -2,10 +2,10 @@
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.1.0
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2013 Lilaea Media
10
  */
11
- ;jQuery(document).ready(function(f){var k="\n",l=function(m){f(m).iris({change:function(){i(m)}})},i=function(s){var o=/^(ctc_(ovrd_)?(parent|child)_([a-z\-]+)_(\d+))(_\w+)?$/,t=f(s).parents(".ctc-selector-row, .ctc-parent-row").first(),r=t.find(".ctc-swatch").first(),q={parent:{},child:{}},p={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},n={child:false,parent:false},m={};t.find(".ctc-parent-value, .ctc-child-value").each(function(){var A=f(this).attr("id"),u=A.match(o),v=u[3],C=("undefined"==typeof u[4]?"":u[4]),z=u[5],y=("undefined"==typeof u[6]?"":u[6]),B=("parent"==v?f(this).text():f(this).val()),x,w;if("child"==v){m[A]=B}if(a(B)){return}if(false===a(y)){switch(y){case"_border_width":q[v][C+"-width"]=B;break;case"_border_style":q[v][C+"-style"]=B;break;case"_border_color":q[v][C+"-color"]=B;break;case"_background_url":q[v]["background-image"]=c(v,B);break;case"_background_color":q[v]["background-color"]=s.value;break;case"_background_color1":p[v].start=B;n[v]=true;break;case"_background_color2":p[v].end=B;n[v]=true;break;case"_background_origin":p[v].origin=B;n[v]=true;break}}else{if(x=C.match(/^border(\-(top|right|bottom|left))?$/)&&!B.match(/none/)){w=B.split(/ +/);q[v][C+"-width"]="undefined"==typeof w[0]?"":w[0];q[v][C+"-style"]="undefined"==typeof w[1]?"":w[1];q[v][C+"-color"]="undefined"==typeof w[2]?"":w[2]}else{if("background-image"==C){if(B.match(/url\(/)){q[v]["background-image"]=c(v,B)}else{w=B.split(/ +/);if(w.length>2){p[v].origin="undefined"==typeof w[0]?"top":w[0];p[v].start="undefined"==typeof w[1]?"transparent":w[1];p[v].end="undefined"==typeof w[2]?"transparent":w[2];n[v]=true}else{q[v]["background-image"]=B}}}else{q[v][C]=B}}}});if("undefined"!=typeof r){f(r).removeAttr("style");if(n.parent){f(r).ctcgrad(p.parent.origin,[p.parent.start,p.parent.end])}f(r).css(q.parent);if(!(r.attr("id").match(/parent/))){if(n.child){f(r).ctcgrad(p.child.origin,[p.child.start,p.child.end])}f(r).css(q.child)}}return m},b=function(o){var n,p,m;f(o).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;currRuleId=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(a(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;n=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;p=this.key;break}})},c=function(q,n){var p=n.match(/url\([" ]*(.+?)[" ]*\)/),o=("undefined"==typeof p?null:p[1]),m=ctcAjax.theme_uri+"/"+("parent"==q?ctcAjax.parnt:ctcAjax.child)+"/",r;if(!o){return false}else{if(o.match(/^(http:|\/)/)){r=n}else{r="url("+m+o+")"}}return r},a=function(n){if("undefined"==typeof n||false===n||null===n||""===n||0===n){return true}if(true===n||"string"===typeof n||"number"===typeof n){return false}if("object"===typeof n){for(var m in n){if(n.hasOwnProperty(m)){return false}}return true}return false},h=function(){var m=[];if(1===loading.sel_ndx){return m}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return m}if(false===a(ctcAjax.sel_ndx)){f.each(ctcAjax.sel_ndx,function(n,o){var p={label:n,value:n};m.push(p)})}return m},e=function(n){var m=[];if(1===loading.sel_ndx){return m}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",n,ctc_setup_selector_menu);return m}if(false===a(ctcAjax.sel_ndx[n])){f.each(ctcAjax.sel_ndx[n],function(o,p){var q={label:o,value:p};m.push(q)})}return m},j=function(){var m=[];if(1===loading.rule){return m}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return m}if(false===a(ctcAjax.rule)){f.each(ctcAjax.rule,function(n,o){var p={label:o,value:n};m.push(p)})}return m.sort(function(o,n){if(o.label>n.label){return 1}if(o.label<n.label){return -1}return 0})},g=function(o,s,n){var p="",r=(a(ctcAjax.sel_val[o])||a(ctcAjax.sel_val[o].value)||a(ctcAjax.sel_val[o].value[s])?"":ctcAjax.sel_val[o].value[s]),q=ctc_decode_value(s,("undefined"==typeof r?"":r.parnt)),m=ctc_decode_value(s,("undefined"==typeof r?"":r.child));if(false===a(ctcAjax.sel_val[o])){p+='<div class="ctc-'+(n?"selector":"input")+'-row clearfix">'+k;p+='<div class="ctc-input-cell">'+(n?ctcAjax.sel_val[o].selector+(a(q.orig)?"<br/>"+ctcAjax.child_only_txt:""):s)+"</div>"+k;if(!n){p+='<div class="ctc-parent-value ctc-input-cell" id="ctc_parent_'+s+"_"+o+'">'+(a(q.orig)?"[no value]":q.orig)+"</div>"+k}p+='<div class="ctc-input-cell">'+k;if(false===a(q.names)){f.each(q.names,function(t,u){u=(a(u)?"":u);p+='<div class="ctc-child-input-cell">'+k;var w="ctc_"+(n?"":"ovrd_")+"child_"+s+"_"+o+u,v;if(!(v=m.values.shift())){v=""}p+=(a(u)?"":ctcAjax.field_labels[u]+":<br/>")+'<input type="text" id="'+w+'" name="'+w+'" class="ctc-child-value'+((u+s).match(/color/)?" color-picker":"")+((u).match(/url/)?" ctc-input-wide":"")+'" value="'+v+'" />'+k;p+="</div>"+k})}p+="</div>"+k;p+=(n?'<div class="ctc-swatch ctc-specific" id="ctc_child_'+s+"_"+o+'_swatch">'+ctcAjax.swatch_txt+"</div>"+k+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+s+"_"+o+'_cell">'+k+'<input type="button" class="button ctc-save-input" id="ctc_save_'+s+"_"+o+'" name="ctc_save_'+s+"_"+o+'" value="Save" /></div>'+k:"");p+="</div><!-- end input row -->"+k}return p},d=function(m){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",m,d);return false}var n="";if(false===a(ctcAjax.sel_val[m]&&false===a(ctcAjax.sel_val[m].value))){f.each(ctcAjax.sel_val[m].value,function(p,o){n+=g(m,p,false)})}f("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){l(this)});i("#ctc_child_all_0_swatch")};ctc_render_rule_value_inputs=function(n){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",n,ctc_render_rule_value_inputs);return false}var o=ctcAjax.rule[n],m='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+o+'">'+k;if(false===a(ctcAjax.rule_val[n])){f.each(ctcAjax.rule_val[n],function(q,r){var p=ctc_decode_value(o,r);m+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+o+"_"+q+'">'+k;m+='<div class="ctc-input-cell ctc-parent-value" id="ctc_parent_'+o+"_"+q+'">'+p.orig+"</div>"+k;m+='<div class="ctc-input-cell">'+k;m+='<div class="ctc-swatch ctc-specific" id="ctc_parent_'+o+"_"+q+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+k;m+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+o+"_"+q+'">'+ctcAjax.selector_txt+"</a></div>"+k;m+='<div id="ctc_selector_'+o+"_"+q+'_container" class="ctc-selector-container clearfix">'+k;m+='<a href="#" id="ctc_selector_'+o+"_"+q+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+q+'"></div>'+k;m+='<div id="ctc_selector_'+o+"_"+q+'_rows"></div>'+k;m+="</div></div>"+k});m+="</div>"+k}f("#ctc_rule_value_inputs").html(m).find(".ctc-swatch").each(function(){i(this)})},ctc_render_selector_value_inputs=function(p){if(1==loading.val_qry){return false}var r,n,q=f("#ctc_rule_menu_selected").text(),m,o="";if(0===loading.val_qry){loading.val_qry=1;r={rule:q};ctc_query_css("val_qry",p,ctc_render_selector_value_inputs,r);return false}if(false===a(ctcAjax.val_qry[p])){f.each(ctcAjax.val_qry[p],function(t,s){page_rule=t;f.each(s,function(v,u){o+='<h4 class="ctc-query-heading">'+v+"</h4>"+k;if(false===a(u)){f.each(u,function(w,x){ctcAjax.sel_val[w]=x;o+=g(w,t,true)})}})})}m="#ctc_selector_"+q+"_"+p+"_rows";f(m).html(o).find(".color-picker").each(function(){l(this)});f(m).find(".ctc-swatch").each(function(){i(this)})},ctc_query_css=function(o,n,r,p){var m={ctc_query_obj:o,ctc_query_key:n},q="#ctc_status_"+o+("val_qry"==o?"_"+n:"");if("object"===typeof p){f.each(p,function(s,t){m["ctc_query_"+s]=t})}f(".ctc-status-icon").remove();f(q).append('<span class="ctc-status-icon spinner"></span>');f(".spinner").show();m.action="ctc_query";m._wpnonce=f("#_wpnonce").val();f.post(ctcAjax.ajaxurl,m,function(s){loading[o]=2;f(".ctc-status-icon").removeClass("spinner");if(a(s)){f(".ctc-status-icon").addClass("failure")}else{f(".ctc-status-icon").addClass("success");b(s);if("function"===typeof r){r(n)}return false}},"json").fail(function(){loading[o]=0;f(".ctc-status-icon").removeClass("spinner");f(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(q){var p={},r,o,m,n;f(q).prop("disabled",true);f(".ctc-status-icon").remove();f(q).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');f(".spinner").show();if((r=f("#ctc_new_selectors"))&&"ctc_save_new_selectors"==f(q).attr("id")){p.ctc_new_selectors=r.val();if(o=f("#ctc_sel_ovrd_query_selected")){p.ctc_sel_ovrd_query=o.text()}}else{if((m=f("#ctc_child_imports"))&&"ctc_save_imports"==f(q).attr("id")){p.ctc_child_imports=m.val()}else{p=i(q)}}p.action="ctc_update";p._wpnonce=f("#_wpnonce").val();f.post(ctcAjax.ajaxurl,p,function(s){f(q).prop("disabled",false);f(".ctc-status-icon").removeClass("spinner");if(a(s)){f(".ctc-status-icon").addClass("failure")}else{f(".ctc-status-icon").addClass("success");f("#ctc_new_selectors").val("");b(s);ctc_setup_menus()}return false},"json").fail(function(){f(q).prop("disabled",false);f(".ctc-status-icon").removeClass("spinner");f(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(o,m){m=("undefined"==typeof m?"":m);var n={orig:m};if(o.match(/^border(\-(top|right|bottom|left))?$/)){var p=m.split(/ +/);n.names=["_border_width","_border_style","_border_color"];n.values=[("undefined"==typeof p[0]?"":p[0]),("undefined"==typeof p[1]?"":p[1]),("undefined"==typeof p[2]?"":p[2])]}else{if(o.match(/^background\-image/)){n.names=["_background_url","_background_origin","_background_color1","_background_color2"];n.values=["","","",""];if(m.match(/:/)){var p=m.split(/:/);n.values[1]=("undefined"==typeof p[0]?"":p[0]);n.values[2]=("undefined"==typeof p[1]?"":p[1]);n.values[3]=("undefined"==typeof p[3]?"":p[3]);n.orig=[n.values[1],n.values[2],n.values[3]].join(" ")}else{n.values[0]=m}}else{n.names=[""];n.values=[m]}}return n},ctc_set_query=function(m){f("#ctc_sel_ovrd_query").val("");f("#ctc_sel_ovrd_query_selected").text(m);ctc_setup_selector_menu(m);f("#ctc_new_selector_row").show()},ctc_set_selector=function(n,m){f("#ctc_sel_ovrd_selector").val("");f("#ctc_sel_ovrd_selector_selected").text(m);f("#ctc_sel_ovrd_qsid").val(n);if(1!=loading.sel_val){loading.sel_val=0}d(n);f("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},ctc_set_rule=function(n,m){f("#ctc_rule_menu").val("");f("#ctc_rule_menu_selected").text(m);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(n);f("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=h();f("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(n,m){ctc_set_query(m.item.value);return false},focus:function(m){m.preventDefault()}})},ctc_setup_selector_menu=function(m){ctc_selectors=e(m);f("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(o,n){ctc_set_selector(n.item.value,n.item.label);return false},focus:function(n){n.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=j();f("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(n,m){ctc_set_rule(m.item.value,m.item.label);return false},focus:function(m){m.preventDefault()}})},ctc_setup_new_rule_menu=function(){f("#ctc_new_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(o,n){var m=f("#ctc_sel_ovrd_qsid").val();f("#ctc_sel_ovrd_rule_inputs").append(g(m,n.item.label,false)).find(".color-picker").each(function(){l(this)});f("#ctc_new_rule_menu").val("");return false},focus:function(m){m.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu("");ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(m,n){var o=false;f.each(ctcAjax.themes,function(p,q){f.each(q,function(r,s){if(r==m&&("parnt"==p||"new"==n)){o=true;return false}});if(o){return false}});return o},ctc_set_notice=function(m){var n="";if(false===a(m)){f.each(m,function(o,p){n+='<div class="'+o+'"><ul>'+k;f(p).each(function(q,r){n+="<li>"+r.toString()+"</li>"+k});n+="</ul></div>"})}f("#ctc_error_notice").html(n)},ctc_validate=function(){var p=/[^\w\-]/,n=f("#ctc_child_template").val().replace(p).toLowerCase(),m=f("#ctc_theme_child").val().replace(p).toLowerCase(),o=f("input[name=ctc_child_type]:checked").val(),q=[];if("new"==o){m=n}if(ctc_theme_exists(m,o)){q.push(ctcAjax.theme_exists_txt.replace(/%s/,m))}if(""==m||m.match(/^[^a-z]/)){q.push(ctcAjax.inval_theme_txt)}if(""==f("#ctc_child_name").val()){q.push(ctcAjax.inval_name_txt)}if(q.length){ctc_set_notice({error:q});return false}return true},ctc_set_theme_menu=function(){var m=f("#ctc_theme_child").val();if(false===a(ctcAjax.themes.child[m])){f("#ctc_child_name").val(ctcAjax.themes.child[m].Name);f("#ctc_child_author").val(ctcAjax.themes.child[m].Author);f("#ctc_child_version").val(ctcAjax.themes.child[m].Version)}},fade_update_notice=function(){f(".updated").fadeOut("slow",function(){f(".updated").remove()})},loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];f(".color-picker").each(function(){l(this)});f(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");f(this).iris("toggle");f(".iris-picker").css({position:"absolute","z-index":10})});f(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");f(".color-picker").not(this).iris("hide")});f(".ctc-option-panel-container").on("change",".ctc-child-value",function(){i(this)});f(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(n){n.preventDefault();ctc_set_notice("");var o=f(this).attr("id").replace("_close",""),m=o.replace(/\D+/g,"");if(f("#"+o+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(m)}f("#"+o+"_container").fadeToggle("fast");f(".ctc-selector-container").not("#"+o+"_container").fadeOut("fast")});f(".nav-tab").on("click",function(n){n.preventDefault();ctc_set_notice("");var o="#"+f(this).attr("id"),m=o+"_panel";f(".nav-tab").removeClass("nav-tab-active");f(".ctc-option-panel").removeClass("ctc-option-panel-active");f(".ctc-selector-container").hide();f(o).addClass("nav-tab-active");f(".ctc-option-panel-container").scrollTop(0);f(m).addClass("ctc-option-panel-active")});f("#view_child_options,#view_parnt_options").on("click",function(p){ctc_set_notice("");var m=new Date().getTime(),o=f(this).attr("id").match(/(child|parnt)/)[1],n=ctcAjax.theme_uri+"/"+ctcAjax[o]+"/style.css?"+m;f.get(n,function(q){f("#view_"+o+"_options_panel").text(q)}).fail(function(){f("#view_"+o+"_options_panel").text(ctcAjax.css_fail_txt)})});f("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});f(document).on("click",".ctc-save-input",function(m){ctc_save(this)});ctc_setup_menus();f("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
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.1.1
6
  * Author: Lilaea Media
7
  * Author URI: http://www.lilaeamedia.com/
8
  * License: GPLv2
9
  * Copyright (C) 2013 Lilaea Media
10
  */
11
+ ;jQuery(document).ready(function(g){var n="\n",k="",a,m={},o=function(p){g(p).iris({change:function(){j(p)}})},j=function(v){var r=/^(ctc_(ovrd_)?(parent|child)_([a-z\-]+)_(\d+))(_\w+)?$/,w=g(v).parents(".ctc-selector-row, .ctc-parent-row").first(),u=w.find(".ctc-swatch").first(),t={parent:{},child:{}},s={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},q={child:false,parent:false},p={};w.find(".ctc-parent-value, .ctc-child-value").each(function(){var D=g(this).attr("id"),x=D.match(r),y=x[3],F=("undefined"==typeof x[4]?"":x[4]),C=x[5],B=("undefined"==typeof x[6]?"":x[6]),E=("parent"==y?g(this).text():g(this).val()),A,z;if("child"==y){p[D]=E}if(""===E){return}if(false===b(B)){switch(B){case"_border_width":t[y][F+"-width"]=E;break;case"_border_style":t[y][F+"-style"]=E;break;case"_border_color":t[y][F+"-color"]=E;break;case"_background_url":t[y]["background-image"]=d(y,E);break;case"_background_color":t[y]["background-color"]=v.value;break;case"_background_color1":s[y].start=E;q[y]=true;break;case"_background_color2":s[y].end=E;q[y]=true;break;case"_background_origin":s[y].origin=E;q[y]=true;break}}else{if(A=F.match(/^border(\-(top|right|bottom|left))?$/)&&!E.match(/none/)){z=E.split(/ +/);t[y][F+"-width"]="undefined"==typeof z[0]?"":z[0];t[y][F+"-style"]="undefined"==typeof z[1]?"":z[1];t[y][F+"-color"]="undefined"==typeof z[2]?"":z[2]}else{if("background-image"==F){if(E.match(/url\(/)){t[y]["background-image"]=d(y,E)}else{z=E.split(/ +/);if(z.length>2){s[y].origin="undefined"==typeof z[0]?"top":z[0];s[y].start="undefined"==typeof z[1]?"transparent":z[1];s[y].end="undefined"==typeof z[2]?"transparent":z[2];q[y]=true}else{t[y]["background-image"]=E}}}else{t[y][F]=E}}}});if("undefined"!=typeof u){g(u).removeAttr("style");if(q.parent){g(u).ctcgrad(s.parent.origin,[s.parent.start,s.parent.end])}g(u).css(t.parent);if(!(u.attr("id").match(/parent/))){if(q.child){g(u).ctcgrad(s.child.origin,[s.child.start,s.child.end])}g(u).css(t.child)}}return p},c=function(r){var q,s,p;g(r).each(function(){switch(this.obj){case"imports":ctcAjax.imports=this.data;break;case"rule_val":ctcAjax.rule_val[this.key]=this.data;currRuleId=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(b(this.key)){ctcAjax.sel_ndx=this.data}else{if("qsid"==this.key){ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;q=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;s=this.key;break}})},d=function(t,q){var s=q.match(/url\([" ]*(.+?)[" ]*\)/),r=("undefined"==typeof s?null:s[1]),p=ctcAjax.theme_uri+"/"+("parent"==t?ctcAjax.parnt:ctcAjax.child)+"/",u;if(!r){return false}else{if(r.match(/^(http:|\/)/)){u=q}else{u="url("+p+r+")"}}return u},b=function(q){if("undefined"==typeof q||false===q||null===q||""===q){return true}if(true===q||"string"===typeof q||"number"===typeof q){return false}if("object"===typeof q){for(var p in q){if(q.hasOwnProperty(p)){return false}}return true}return false},i=function(){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return p}if(false===b(ctcAjax.sel_ndx)){g.each(ctcAjax.sel_ndx,function(q,r){var s={label:q,value:q};p.push(s)})}return p},f=function(q){var p=[];if(1===loading.sel_ndx){return p}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",q,ctc_setup_selector_menu);return p}if(false===b(ctcAjax.sel_ndx[q])){g.each(ctcAjax.sel_ndx[q],function(r,s){var t={label:r,value:s};p.push(t)})}return p},l=function(){var p=[];if(1===loading.rule){return p}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return p}if(false===b(ctcAjax.rule)){g.each(ctcAjax.rule,function(q,r){var s={label:r,value:q};p.push(s)})}return p.sort(function(r,q){if(r.label>q.label){return 1}if(r.label<q.label){return -1}return 0})},h=function(r,v,q){var s="",u=(b(ctcAjax.sel_val[r])||b(ctcAjax.sel_val[r].value)||b(ctcAjax.sel_val[r].value[v])?"":ctcAjax.sel_val[r].value[v]),t=ctc_decode_value(v,("undefined"==typeof u?"":u.parnt)),p=ctc_decode_value(v,("undefined"==typeof u?"":u.child));if(false===b(ctcAjax.sel_val[r])){s+='<div class="ctc-'+(q?"selector":"input")+'-row clearfix">'+n;s+='<div class="ctc-input-cell">'+(q?ctcAjax.sel_val[r].selector+(b(t.orig)?"<br/>"+ctcAjax.child_only_txt:""):v)+"</div>"+n;if(!q){s+='<div class="ctc-parent-value ctc-input-cell" id="ctc_parent_'+v+"_"+r+'">'+(b(t.orig)?"[no value]":t.orig)+"</div>"+n}s+='<div class="ctc-input-cell">'+n;if(false===b(t.names)){g.each(t.names,function(w,x){x=(b(x)?"":x);s+='<div class="ctc-child-input-cell">'+n;var z="ctc_"+(q?"":"ovrd_")+"child_"+v+"_"+r+x,y;if(false===(y=p.values.shift())){y=""}s+=(b(x)?"":ctcAjax.field_labels[x]+":<br/>")+'<input type="text" id="'+z+'" name="'+z+'" class="ctc-child-value'+((x+v).match(/color/)?" color-picker":"")+((x).match(/url/)?" ctc-input-wide":"")+'" value="'+y+'" />'+n;s+="</div>"+n})}s+="</div>"+n;s+=(q?'<div class="ctc-swatch ctc-specific" id="ctc_child_'+v+"_"+r+'_swatch">'+ctcAjax.swatch_txt+"</div>"+n+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+v+"_"+r+'_cell">'+n+'<input type="button" class="button ctc-save-input" id="ctc_save_'+v+"_"+r+'" name="ctc_save_'+v+"_"+r+'" value="Save" /></div>'+n:"");s+="</div><!-- end input row -->"+n}return s},e=function(p){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",p,e);return false}var q="";if(false===b(ctcAjax.sel_val[p]&&false===b(ctcAjax.sel_val[p].value))){g.each(ctcAjax.sel_val[p].value,function(s,r){q+=h(p,s,false)})}g("#ctc_sel_ovrd_rule_inputs").html(q).find(".color-picker").each(function(){o(this)});j("#ctc_child_all_0_swatch")};ctc_render_rule_value_inputs=function(q){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",q,ctc_render_rule_value_inputs);return false}var r=ctcAjax.rule[q],p='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+r+'">'+n;if(false===b(ctcAjax.rule_val[q])){g.each(ctcAjax.rule_val[q],function(t,u){var s=ctc_decode_value(r,u);p+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+r+"_"+t+'">'+n;p+='<div class="ctc-input-cell ctc-parent-value" id="ctc_parent_'+r+"_"+t+'">'+s.orig+"</div>"+n;p+='<div class="ctc-input-cell">'+n;p+='<div class="ctc-swatch ctc-specific" id="ctc_parent_'+r+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+n;p+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+r+"_"+t+'">'+ctcAjax.selector_txt+"</a></div>"+n;p+='<div id="ctc_selector_'+r+"_"+t+'_container" class="ctc-selector-container clearfix">'+n;p+='<a href="#" id="ctc_selector_'+r+"_"+t+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+t+'"></div>'+n;p+='<div id="ctc_selector_'+r+"_"+t+'_rows"></div>'+n;p+="</div></div>"+n});p+="</div>"+n}g("#ctc_rule_value_inputs").html(p).find(".ctc-swatch").each(function(){j(this)})},ctc_render_selector_value_inputs=function(s){if(1==loading.val_qry){return false}var u,q,t=g("#ctc_rule_menu_selected").text(),p,r="";if(0===loading.val_qry){loading.val_qry=1;u={rule:t};ctc_query_css("val_qry",s,ctc_render_selector_value_inputs,u);return false}if(false===b(ctcAjax.val_qry[s])){g.each(ctcAjax.val_qry[s],function(w,v){page_rule=w;g.each(v,function(y,x){r+='<h4 class="ctc-query-heading">'+y+"</h4>"+n;if(false===b(x)){g.each(x,function(z,A){ctcAjax.sel_val[z]=A;r+=h(z,w,true)})}})})}p="#ctc_selector_"+t+"_"+s+"_rows";g(p).html(r).find(".color-picker").each(function(){o(this)});g(p).find(".ctc-swatch").each(function(){j(this)})},ctc_query_css=function(r,q,u,s){var p={ctc_query_obj:r,ctc_query_key:q},t="#ctc_status_"+r+("val_qry"==r?"_"+q:"");if("object"===typeof s){g.each(s,function(v,w){p["ctc_query_"+v]=w})}g(".ctc-status-icon").remove();g(t).append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();p.action="ctc_query";p._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,p,function(v){loading[r]=2;g(".ctc-status-icon").removeClass("spinner");if(b(v)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");c(v);if("function"===typeof u){u(q)}return false}},"json").fail(function(){loading[r]=0;g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(t){var s={},u,r,p,q,v=g(t).attr("id");if(b(m[v])){m[v]=0}m[v]++;g(t).prop("disabled",true);g(".ctc-status-icon").remove();g(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();if((u=g("#ctc_new_selectors"))&&"ctc_save_new_selectors"==g(t).attr("id")){s.ctc_new_selectors=u.val();if(r=g("#ctc_sel_ovrd_query_selected")){s.ctc_sel_ovrd_query=r.text()}}else{if((p=g("#ctc_child_imports"))&&"ctc_save_imports"==g(t).attr("id")){s.ctc_child_imports=p.val()}else{s=j(t)}}s.action="ctc_update";s._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,s,function(w){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");if(b(w)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");g("#ctc_new_selectors").val("")}return false}).fail(function(){g(t).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(r,p){p=("undefined"==typeof p?"":p);var q={orig:p};if(r.match(/^border(\-(top|right|bottom|left))?$/)){var s=p.split(/ +/);q.names=["_border_width","_border_style","_border_color"];q.values=[("undefined"==typeof s[0]?"":s[0]),("undefined"==typeof s[1]?"":s[1]),("undefined"==typeof s[2]?"":s[2])]}else{if(r.match(/^background\-image/)){q.names=["_background_url","_background_origin","_background_color1","_background_color2"];q.values=["","","",""];if(p.match(/:/)){var s=p.split(/:/);q.values[1]=("undefined"==typeof s[0]?"":s[0]);q.values[2]=("undefined"==typeof s[1]?"":s[1]);q.values[3]=("undefined"==typeof s[3]?"":s[3]);q.orig=[q.values[1],q.values[2],q.values[3]].join(" ")}else{q.values[0]=p}}else{q.names=[""];q.values=[p]}}return q},ctc_set_query=function(p){g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(p);k=p;ctc_setup_selector_menu(p);g("#ctc_new_selector_row").show()},ctc_set_selector=function(q,p){g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").text(p);g("#ctc_sel_ovrd_qsid").val(q);a=q;if(1!=loading.sel_val){loading.sel_val=0}e(q);g("#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs").show()},ctc_set_rule=function(q,p){g("#ctc_rule_menu").val("");g("#ctc_rule_menu_selected").text(p);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(q);g("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=i();g("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_query(p.item.value);return false},focus:function(p){p.preventDefault()}})},ctc_setup_selector_menu=function(p){ctc_selectors=f(p);g("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(r,q){ctc_set_selector(q.item.value,q.item.label);return false},focus:function(q){q.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=l();g("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(q,p){ctc_set_rule(p.item.value,p.item.label);return false},focus:function(p){p.preventDefault()}})},ctc_filtered_rules=function(r,q){var p=[];if(false===(b(ctcAjax.sel_val[a]))){if(b(ctc_rules)){ctc_rules=l()}g.each(ctc_rules,function(s,v){var t=false,u=new RegExp(g.ui.autocomplete.escapeRegex(r.term),"i");if(u.test(v.label)){g.each(ctcAjax.sel_val[a].value,function(x,w){if(v.label==x){t=true;return false}});if(t){return}p.push(v)}})}q(p)},ctc_setup_new_rule_menu=function(){g("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(q,p){g("#ctc_sel_ovrd_rule_inputs").append(h(a,p.item.label,false)).find(".color-picker").each(function(){o(this)});g("#ctc_new_rule_menu").val("");ctcAjax.sel_val[a].value[p.item.label]={child:""};return false},focus:function(p){p.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(k);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(p,q){var r=false;g.each(ctcAjax.themes,function(s,t){g.each(t,function(u,v){if(u==p&&("parnt"==s||"new"==q)){r=true;return false}});if(r){return false}});return r},ctc_set_notice=function(p){var q="";if(false===b(p)){g.each(p,function(r,s){q+='<div class="'+r+'"><ul>'+n;g(s).each(function(t,u){q+="<li>"+u.toString()+"</li>"+n});q+="</ul></div>"})}g("#ctc_error_notice").html(q)},ctc_validate=function(){var s=/[^\w\-]/,q=g("#ctc_child_template").val().replace(s).toLowerCase(),p=g("#ctc_theme_child").val().replace(s).toLowerCase(),r=g("input[name=ctc_child_type]:checked").val(),t=[];if("new"==r){p=q}if(ctc_theme_exists(p,r)){t.push(ctcAjax.theme_exists_txt.replace(/%s/,p))}if(""===p){t.push(ctcAjax.inval_theme_txt)}if(""===g("#ctc_child_name").val()){t.push(ctcAjax.inval_name_txt)}if(t.length){ctc_set_notice({error:t});return false}return true},ctc_set_theme_menu=function(q){var p=g("#ctc_theme_child").val();if(false===b(ctcAjax.themes.child[p])){g("#ctc_child_name").val(ctcAjax.themes.child[p].Name);g("#ctc_child_author").val(ctcAjax.themes.child[p].Author);g("#ctc_child_version").val(ctcAjax.themes.child[p].Version)}},fade_update_notice=function(){g(".updated").fadeOut("slow",function(){g(".updated").remove()})},loading={rule:2,sel_ndx:2,val_qry:0,rule_val:0,sel_val:0},ctc_selectors=[],ctc_queries=[],ctc_rules=[];g(".color-picker").each(function(){o(this)});g(".ctc-option-panel-container").on("focus",".color-picker",function(){ctc_set_notice("");g(this).iris("toggle");g(".iris-picker").css({position:"absolute","z-index":10})});g(".ctc-option-panel-container").on("focus","input",function(){ctc_set_notice("");g(".color-picker").not(this).iris("hide")});g(".ctc-option-panel-container").on("change",".ctc-child-value",function(){j(this)});g(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(q){q.preventDefault();ctc_set_notice("");var r=g(this).attr("id").replace("_close",""),p=r.replace(/\D+/g,"");if(g("#"+r+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(p)}g("#"+r+"_container").fadeToggle("fast");g(".ctc-selector-container").not("#"+r+"_container").fadeOut("fast")});g(".nav-tab").on("click",function(q){q.preventDefault();ctc_set_notice("");var r="#"+g(this).attr("id"),p=r+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(r).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(p).addClass("ctc-option-panel-active")});g("#view_child_options,#view_parnt_options").on("click",function(s){ctc_set_notice("");var p=new Date().getTime(),r=g(this).attr("id").match(/(child|parnt)/)[1],q=ctcAjax.theme_uri+"/"+ctcAjax[r]+"/style.css?"+p;g.get(q,function(t){g("#view_"+r+"_options_panel").text(t)}).fail(function(){g("#view_"+r+"_options_panel").text(ctcAjax.css_fail_txt)})});g("#ctc_load_form").on("submit",function(){return(ctc_validate()&&confirm(ctcAjax.load_txt))});g("#parent_child_options_panel").on("change","#ctc_theme_child",ctc_set_theme_menu);g(document).on("click",".ctc-save-input",function(p){ctc_save(this)});ctc_setup_menus();g("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
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.5
6
  Tested up to: 3.8
7
- Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -89,6 +89,17 @@ You can also create a secondary stylesheet that contains @font-face rules and im
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
 
 
 
 
 
92
  = 1.1.0 =
93
  * Corrected parsing for certain backgrounds and gradients (e.g., supports hsla color syntax)
94
  * Handle empty selectors
@@ -104,6 +115,10 @@ You can also create a secondary stylesheet that contains @font-face rules and im
104
 
105
  == Upgrade Notice ==
106
 
 
 
 
 
107
  = 1.0.0 =
108
  * Initial release.
109
 
4
  Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
5
  Requires at least: 3.5
6
  Tested up to: 3.8
7
+ Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
89
 
90
  == Changelog ==
91
 
92
+ = 1.1.1 =
93
+ * Fixed major bug where inputs containing '0' were being ignored
94
+ * Removed "no leading digits" requirement for theme slug
95
+ * Change query sort function to keep parent order of queries without device width rules
96
+ * Fixed gettext calls to use static namespace parameter
97
+ * Auto populate child theme inputs when existing theme is selected
98
+ * Correctly remove border when values are blanked
99
+ * Fixed duplicate "new rule" bug on Query/Selector panel
100
+ * added timestamp to backup file
101
+ * Added encode_shorthand function to recombine margin/padding values when all 4 sides are present
102
+
103
  = 1.1.0 =
104
  * Corrected parsing for certain backgrounds and gradients (e.g., supports hsla color syntax)
105
  * Handle empty selectors
115
 
116
  == Upgrade Notice ==
117
 
118
+ = 1.1.1 =
119
+ * This release fixes a major bug that caused input values containing '0' to be ignored
120
+ * Several other bugs fixed/improvements made, see change log for details.
121
+
122
  = 1.0.0 =
123
  * Initial release.
124