Version Description
- Small bug fix to javascript (casting number to string)
Download this release
Release Info
Developer | lilaeamedia |
Plugin | Child Theme Configurator |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- child-theme-configurator.php +1 -1
- includes/class-ctc-css.php +2 -2
- includes/class-ctc-ui.php +1 -1
- includes/class-ctc.php +3 -3
- js/chld-thm-cfg.js +22 -22
- js/chld-thm-cfg.min.js +2 -2
- readme.txt +4 -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.
|
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.2
|
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.
|
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.
|
46 |
$this->querykey = 0;
|
47 |
$this->selkey = 0;
|
48 |
$this->qskey = 0;
|
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.2
|
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.2';
|
46 |
$this->querykey = 0;
|
47 |
$this->selkey = 0;
|
48 |
$this->qskey = 0;
|
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.
|
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.2
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
includes/class-ctc.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
|
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
-
Version: 1.1.
|
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.
|
22 |
var $css;
|
23 |
var $optionsName;
|
24 |
var $menuName;
|
@@ -65,7 +65,7 @@ class Child_Theme_Configurator {
|
|
65 |
wp_enqueue_style('chld-thm-cfg-admin', $this->pluginURL . 'css/chld-thm-cfg.css');
|
66 |
wp_enqueue_script('iris');
|
67 |
wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
|
68 |
-
wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.
|
69 |
array('jquery-ui-autocomplete'), '1.0', true);
|
70 |
wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
|
71 |
apply_filters('ctc_localize_script', array(
|
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.2
|
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.2';
|
22 |
var $css;
|
23 |
var $optionsName;
|
24 |
var $menuName;
|
65 |
wp_enqueue_style('chld-thm-cfg-admin', $this->pluginURL . 'css/chld-thm-cfg.css');
|
66 |
wp_enqueue_script('iris');
|
67 |
wp_enqueue_script('ctc-thm-cfg-ctcgrad', $this->pluginURL . 'js/ctcgrad.min.js', array('iris'), '1.0');
|
68 |
+
wp_enqueue_script('chld-thm-cfg-admin', $this->pluginURL . 'js/chld-thm-cfg.js', //'js/chld-thm-cfg.js',
|
69 |
array('jquery-ui-autocomplete'), '1.0', true);
|
70 |
wp_localize_script( 'chld-thm-cfg-admin', 'ctcAjax',
|
71 |
apply_filters('ctc_localize_script', array(
|
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.
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
@@ -45,7 +45,7 @@ jQuery(document).ready(function($){
|
|
45 |
// set up objects for all neighboring inputs
|
46 |
$container.find('.ctc-parent-value, .ctc-child-value').each(function(){
|
47 |
var inputid = $(this).attr('id'),
|
48 |
-
inputparts = inputid.match(regex),
|
49 |
inputtheme = inputparts[3],
|
50 |
inputrule = ('undefined' == typeof inputparts[4] ? '' : inputparts[4]),
|
51 |
qsid = inputparts[5],
|
@@ -89,17 +89,17 @@ jQuery(document).ready(function($){
|
|
89 |
}
|
90 |
} else {
|
91 |
// handle borders
|
92 |
-
if (parts = inputrule.match(/^border(\-(top|right|bottom|left))?$/) && !value.match(/none/)) {
|
93 |
-
subparts = value.split(/ +/);
|
94 |
cssrules[inputtheme][inputrule + '-width'] = 'undefined' == typeof subparts[0] ? '' : subparts[0];
|
95 |
cssrules[inputtheme][inputrule + '-style'] = 'undefined' == typeof subparts[1] ? '' : subparts[1];
|
96 |
cssrules[inputtheme][inputrule + '-color'] = 'undefined' == typeof subparts[2] ? '' : subparts[2];
|
97 |
// handle background images
|
98 |
} else if ( 'background-image' == inputrule ) {
|
99 |
-
if (value.match(/url\(/)) {
|
100 |
cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
|
101 |
} else {
|
102 |
-
subparts = value.split(/ +/);
|
103 |
if (subparts.length > 2) {
|
104 |
gradient[inputtheme].origin = 'undefined' == typeof subparts[0] ? 'top' : subparts[0];
|
105 |
gradient[inputtheme].start = 'undefined' == typeof subparts[1] ? 'transparent' : subparts[1];
|
@@ -119,7 +119,7 @@ jQuery(document).ready(function($){
|
|
119 |
$($swatch).removeAttr('style');
|
120 |
if (has_gradient.parent) { $($swatch).ctcgrad(gradient.parent.origin, [gradient.parent.start, gradient.parent.end]); }
|
121 |
$($swatch).css(cssrules.parent);
|
122 |
-
if (!($swatch.attr('id').match(/parent/))){
|
123 |
if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
|
124 |
$($swatch).css(cssrules.child);
|
125 |
}
|
@@ -166,13 +166,13 @@ jQuery(document).ready(function($){
|
|
166 |
});
|
167 |
},
|
168 |
ctc_image_url = function(theme, value) {
|
169 |
-
var parts = value.match(/url\([" ]*(.+?)[" ]*\)/),
|
170 |
path = ('undefined' == typeof parts ? null : parts[1]),
|
171 |
url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
|
172 |
image_url;
|
173 |
if (!path) {
|
174 |
return false;
|
175 |
-
} else if (path.match(/^(http:|\/)/)) {
|
176 |
image_url = value;
|
177 |
} else {
|
178 |
image_url = 'url(' + url + path + ')';
|
@@ -294,8 +294,8 @@ jQuery(document).ready(function($){
|
|
294 |
|
295 |
html += (ctc_is_empty(newname) ? '' : ctcAjax.field_labels[newname] + ':<br/>')
|
296 |
+ '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
|
297 |
-
+ ((newname + rule).match(/color/) ? ' color-picker' : '')
|
298 |
-
+ ((newname).match(/url/) ? ' ctc-input-wide' : '')
|
299 |
+ '" value="' + newval + '" />' + lf;
|
300 |
html += '</div>' + lf;
|
301 |
});
|
@@ -578,8 +578,8 @@ jQuery(document).ready(function($){
|
|
578 |
ctc_decode_value = function(rule, value) {
|
579 |
value = ('undefined' == typeof value ? '' : value);
|
580 |
var obj = { 'orig': value };
|
581 |
-
if (rule.match(/^border(\-(top|right|bottom|left))?$/)) {
|
582 |
-
var params = value.split(/ +/);
|
583 |
obj['names'] = [
|
584 |
'_border_width',
|
585 |
'_border_style',
|
@@ -590,7 +590,7 @@ jQuery(document).ready(function($){
|
|
590 |
('undefined' == typeof params[1] ? '' : params[1]),
|
591 |
('undefined' == typeof params[2] ? '' : params[2])
|
592 |
];
|
593 |
-
} else if (rule.match(/^background\-image/)) {
|
594 |
obj['names'] = [
|
595 |
'_background_url',
|
596 |
'_background_origin',
|
@@ -598,8 +598,8 @@ jQuery(document).ready(function($){
|
|
598 |
'_background_color2'
|
599 |
];
|
600 |
obj['values'] = ['','','',''];
|
601 |
-
if (value.match(/:/)) {
|
602 |
-
var params = value.split(/:/);
|
603 |
obj['values'][1] = ('undefined' == typeof params[0] ? '' : params[0]);
|
604 |
obj['values'][2] = ('undefined' == typeof params[1] ? '' : params[1]);
|
605 |
obj['values'][3] = ('undefined' == typeof params[3] ? '' : params[3]);
|
@@ -759,13 +759,13 @@ jQuery(document).ready(function($){
|
|
759 |
},
|
760 |
ctc_validate = function() {
|
761 |
var regex = /[^\w\-]/,
|
762 |
-
newslug = $('#ctc_child_template').val().replace(regex).toLowerCase(),
|
763 |
-
slug = $('#ctc_theme_child').val().replace(regex).toLowerCase(),
|
764 |
type = $('input[name=ctc_child_type]:checked').val(),
|
765 |
errors = [];
|
766 |
if ('new' == type) slug = newslug;
|
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);
|
@@ -825,8 +825,8 @@ jQuery(document).ready(function($){
|
|
825 |
$('.ctc-option-panel-container').on('click', '.ctc-selector-handle', function(e) {
|
826 |
e.preventDefault();
|
827 |
ctc_set_notice('')
|
828 |
-
var id = $(this).attr('id').replace('_close', ''),
|
829 |
-
valid = id.replace(/\D+/g, '');
|
830 |
if ($('#' + id + '_container').is(':hidden')) {
|
831 |
if (1 != loading.val_qry) loading.val_qry = 0;
|
832 |
ctc_render_selector_value_inputs(valid);
|
@@ -849,7 +849,7 @@ jQuery(document).ready(function($){
|
|
849 |
$('#view_child_options,#view_parnt_options').on('click', function(e){
|
850 |
ctc_set_notice('')
|
851 |
var stamp = new Date().getTime(),
|
852 |
-
theme = $(this).attr('id').match(/(child|parnt)/)[1],
|
853 |
css_uri = ctcAjax.theme_uri + '/' + ctcAjax[theme] + '/style.css?' + stamp;
|
854 |
$.get(
|
855 |
css_uri,
|
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.2
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
45 |
// set up objects for all neighboring inputs
|
46 |
$container.find('.ctc-parent-value, .ctc-child-value').each(function(){
|
47 |
var inputid = $(this).attr('id'),
|
48 |
+
inputparts = inputid.toString().match(regex),
|
49 |
inputtheme = inputparts[3],
|
50 |
inputrule = ('undefined' == typeof inputparts[4] ? '' : inputparts[4]),
|
51 |
qsid = inputparts[5],
|
89 |
}
|
90 |
} else {
|
91 |
// handle borders
|
92 |
+
if (parts = inputrule.toString().match(/^border(\-(top|right|bottom|left))?$/) && !value.match(/none/)) {
|
93 |
+
subparts = value.toString().split(/ +/);
|
94 |
cssrules[inputtheme][inputrule + '-width'] = 'undefined' == typeof subparts[0] ? '' : subparts[0];
|
95 |
cssrules[inputtheme][inputrule + '-style'] = 'undefined' == typeof subparts[1] ? '' : subparts[1];
|
96 |
cssrules[inputtheme][inputrule + '-color'] = 'undefined' == typeof subparts[2] ? '' : subparts[2];
|
97 |
// handle background images
|
98 |
} else if ( 'background-image' == inputrule ) {
|
99 |
+
if (value.toString().match(/url\(/)) {
|
100 |
cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
|
101 |
} else {
|
102 |
+
subparts = value.toString().split(/ +/);
|
103 |
if (subparts.length > 2) {
|
104 |
gradient[inputtheme].origin = 'undefined' == typeof subparts[0] ? 'top' : subparts[0];
|
105 |
gradient[inputtheme].start = 'undefined' == typeof subparts[1] ? 'transparent' : subparts[1];
|
119 |
$($swatch).removeAttr('style');
|
120 |
if (has_gradient.parent) { $($swatch).ctcgrad(gradient.parent.origin, [gradient.parent.start, gradient.parent.end]); }
|
121 |
$($swatch).css(cssrules.parent);
|
122 |
+
if (!($swatch.attr('id').toString().match(/parent/))){
|
123 |
if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
|
124 |
$($swatch).css(cssrules.child);
|
125 |
}
|
166 |
});
|
167 |
},
|
168 |
ctc_image_url = function(theme, value) {
|
169 |
+
var parts = value.toString().match(/url\([" ]*(.+?)[" ]*\)/),
|
170 |
path = ('undefined' == typeof parts ? null : parts[1]),
|
171 |
url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
|
172 |
image_url;
|
173 |
if (!path) {
|
174 |
return false;
|
175 |
+
} else if (path.toString().match(/^(http:|\/)/)) {
|
176 |
image_url = value;
|
177 |
} else {
|
178 |
image_url = 'url(' + url + path + ')';
|
294 |
|
295 |
html += (ctc_is_empty(newname) ? '' : ctcAjax.field_labels[newname] + ':<br/>')
|
296 |
+ '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
|
297 |
+
+ ((newname + rule).toString().match(/color/) ? ' color-picker' : '')
|
298 |
+
+ ((newname).toString().match(/url/) ? ' ctc-input-wide' : '')
|
299 |
+ '" value="' + newval + '" />' + lf;
|
300 |
html += '</div>' + lf;
|
301 |
});
|
578 |
ctc_decode_value = function(rule, value) {
|
579 |
value = ('undefined' == typeof value ? '' : value);
|
580 |
var obj = { 'orig': value };
|
581 |
+
if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
|
582 |
+
var params = value.toString().split(/ +/);
|
583 |
obj['names'] = [
|
584 |
'_border_width',
|
585 |
'_border_style',
|
590 |
('undefined' == typeof params[1] ? '' : params[1]),
|
591 |
('undefined' == typeof params[2] ? '' : params[2])
|
592 |
];
|
593 |
+
} else if (rule.toString().match(/^background\-image/)) {
|
594 |
obj['names'] = [
|
595 |
'_background_url',
|
596 |
'_background_origin',
|
598 |
'_background_color2'
|
599 |
];
|
600 |
obj['values'] = ['','','',''];
|
601 |
+
if (value.toString().match(/:/)) {
|
602 |
+
var params = value.toString().split(/:/);
|
603 |
obj['values'][1] = ('undefined' == typeof params[0] ? '' : params[0]);
|
604 |
obj['values'][2] = ('undefined' == typeof params[1] ? '' : params[1]);
|
605 |
obj['values'][3] = ('undefined' == typeof params[3] ? '' : params[3]);
|
759 |
},
|
760 |
ctc_validate = function() {
|
761 |
var regex = /[^\w\-]/,
|
762 |
+
newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
|
763 |
+
slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
|
764 |
type = $('input[name=ctc_child_type]:checked').val(),
|
765 |
errors = [];
|
766 |
if ('new' == type) slug = newslug;
|
767 |
if (ctc_theme_exists(slug, type)) {
|
768 |
+
errors.push(ctcAjax.theme_exists_txt.toString().replace(/%s/, slug));
|
769 |
}
|
770 |
if ('' === slug) {
|
771 |
errors.push(ctcAjax.inval_theme_txt);
|
825 |
$('.ctc-option-panel-container').on('click', '.ctc-selector-handle', function(e) {
|
826 |
e.preventDefault();
|
827 |
ctc_set_notice('')
|
828 |
+
var id = $(this).attr('id').toString().replace('_close', ''),
|
829 |
+
valid = id.toString().replace(/\D+/g, '');
|
830 |
if ($('#' + id + '_container').is(':hidden')) {
|
831 |
if (1 != loading.val_qry) loading.val_qry = 0;
|
832 |
ctc_render_selector_value_inputs(valid);
|
849 |
$('#view_child_options,#view_parnt_options').on('click', function(e){
|
850 |
ctc_set_notice('')
|
851 |
var stamp = new Date().getTime(),
|
852 |
+
theme = $(this).attr('id').toString().match(/(child|parnt)/)[1],
|
853 |
css_uri = ctcAjax.theme_uri + '/' + ctcAjax[theme] + '/style.css?' + stamp;
|
854 |
$.get(
|
855 |
css_uri,
|
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.
|
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)});
|
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.2
|
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.toString().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.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!E.match(/none/)){z=E.toString().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.toString().match(/url\(/)){t[y]["background-image"]=d(y,E)}else{z=E.toString().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").toString().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.toString().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.toString().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).toString().match(/color/)?" color-picker":"")+((x).toString().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.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s=p.toString().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.toString().match(/^background\-image/)){q.names=["_background_url","_background_origin","_background_color1","_background_color2"];q.values=["","","",""];if(p.toString().match(/:/)){var s=p.toString().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().toString().replace(s).toLowerCase(),p=g("#ctc_theme_child").val().toString().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.toString().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").toString().replace("_close",""),p=r.toString().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").toString().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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -89,6 +89,9 @@ You can also create a secondary stylesheet that contains @font-face rules and im
|
|
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
|
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.2
|
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.2 =
|
93 |
+
* Small bug fix to javascript (casting number to string)
|
94 |
+
|
95 |
= 1.1.1 =
|
96 |
* Fixed major bug where inputs containing '0' were being ignored
|
97 |
* Removed "no leading digits" requirement for theme slug
|