Version Description
- Bugs fixed: "star hack" rules no longer throwing js error. Important flag now works on borders and gradients.
Download this release
Release Info
Developer | lilaeamedia |
Plugin | Child Theme Configurator |
Version | 1.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- child-theme-configurator.php +1 -1
- chld-thm-cfg.js +946 -0
- chld-thm-cfg.min.js +11 -0
- includes/class-ctc-css.php +10 -3
- includes/class-ctc-ui.php +2 -2
- includes/class-ctc.php +2 -2
- js/chld-thm-cfg.js +18 -10
- 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 a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
|
9 |
-
Version: 1.2.
|
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 a Child Theme from any installed Theme. Each CSS selector, rule and value can then be searched, previewed and modified.
|
9 |
+
Version: 1.2.1
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
chld-thm-cfg.js
ADDED
@@ -0,0 +1,946 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
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.2.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($){
|
12 |
+
|
13 |
+
var lf = "\n",
|
14 |
+
currentQuery = 'base',
|
15 |
+
currentSel,
|
16 |
+
saveEvents = {},
|
17 |
+
// initialize functions
|
18 |
+
ctc_setup_iris = function(obj) {
|
19 |
+
$(obj).iris({
|
20 |
+
change: function() {
|
21 |
+
ctc_coalesce_inputs(obj);
|
22 |
+
}
|
23 |
+
});
|
24 |
+
},
|
25 |
+
from_ascii = function(str) {
|
26 |
+
var ascii = parseInt(str),
|
27 |
+
chr = String.fromCharCode(ascii)
|
28 |
+
return chr;
|
29 |
+
},
|
30 |
+
to_ascii = function(str) {
|
31 |
+
var ascii = str.charCodeAt(0);
|
32 |
+
return ascii;
|
33 |
+
},
|
34 |
+
ctc_coalesce_inputs = function(obj) {
|
35 |
+
var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
|
36 |
+
$container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
|
37 |
+
$swatch = $container.find('.ctc-swatch').first(),
|
38 |
+
cssrules = { 'parent': {}, 'child': {} },
|
39 |
+
gradient = {
|
40 |
+
'parent': {
|
41 |
+
'origin': '',
|
42 |
+
'start': '',
|
43 |
+
'end': ''
|
44 |
+
},
|
45 |
+
'child': {
|
46 |
+
'origin': '',
|
47 |
+
'start': '',
|
48 |
+
'end': ''
|
49 |
+
}
|
50 |
+
},
|
51 |
+
has_gradient = { 'child': false, 'parent': false },
|
52 |
+
postdata = {};
|
53 |
+
// set up objects for all neighboring inputs
|
54 |
+
$container.find('.ctc-parent-value, .ctc-child-value').each(function(){
|
55 |
+
var inputid = $(this).attr('id'),
|
56 |
+
inputparts = inputid.toString().match(regex),
|
57 |
+
inputseq = inputparts[2],
|
58 |
+
inputtheme = inputparts[3],
|
59 |
+
inputrule = ('undefined' == typeof inputparts[4] ? '' : inputparts[4]),
|
60 |
+
qsid = inputparts[5],
|
61 |
+
rulepart = ('undefined' == typeof inputparts[6] ? '' : inputparts[6]),
|
62 |
+
value = ('parent' == inputtheme ? $(this).text() : $(this).val()),
|
63 |
+
important = 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid,
|
64 |
+
parts, subparts;
|
65 |
+
if ('child' == inputtheme) {
|
66 |
+
postdata[inputid] = value;
|
67 |
+
postdata[important] = ($('#' + important).is(':checked')) ? 1 : 0;
|
68 |
+
}
|
69 |
+
/*if ('' === value) {
|
70 |
+
$('#'+important).prop('checked', false);
|
71 |
+
return;
|
72 |
+
}*/
|
73 |
+
// handle specific inputs
|
74 |
+
if (false === ctc_is_empty(rulepart)) {
|
75 |
+
switch(rulepart) {
|
76 |
+
case '_border_width':
|
77 |
+
cssrules[inputtheme][inputrule + '-width'] = value;
|
78 |
+
break;
|
79 |
+
case '_border_style':
|
80 |
+
cssrules[inputtheme][inputrule + '-style'] = value;
|
81 |
+
break;
|
82 |
+
case '_border_color':
|
83 |
+
cssrules[inputtheme][inputrule + '-color'] = value;
|
84 |
+
break;
|
85 |
+
case '_background_url':
|
86 |
+
cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
|
87 |
+
break;
|
88 |
+
case '_background_color':
|
89 |
+
cssrules[inputtheme]['background-color'] = obj.value;
|
90 |
+
break;
|
91 |
+
case '_background_color1':
|
92 |
+
gradient[inputtheme].start = value;
|
93 |
+
has_gradient[inputtheme] = true;
|
94 |
+
break;
|
95 |
+
case '_background_color2':
|
96 |
+
gradient[inputtheme].end = value;
|
97 |
+
has_gradient[inputtheme] = true;
|
98 |
+
break;
|
99 |
+
case '_background_origin':
|
100 |
+
gradient[inputtheme].origin = value;
|
101 |
+
has_gradient[inputtheme] = true;
|
102 |
+
break;
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
// handle borders
|
106 |
+
if (parts = inputrule.toString().match(/^border(\-(top|right|bottom|left))?$/) && !value.match(/none/)) {
|
107 |
+
subparts = value.toString().split(/ +/);
|
108 |
+
cssrules[inputtheme][inputrule + '-width'] = 'undefined' == typeof subparts[0] ? '' : subparts[0];
|
109 |
+
cssrules[inputtheme][inputrule + '-style'] = 'undefined' == typeof subparts[1] ? '' : subparts[1];
|
110 |
+
cssrules[inputtheme][inputrule + '-color'] = 'undefined' == typeof subparts[2] ? '' : subparts[2];
|
111 |
+
// handle background images
|
112 |
+
} else if ( 'background-image' == inputrule ) {
|
113 |
+
if (value.toString().match(/url\(/)) {
|
114 |
+
cssrules[inputtheme]['background-image'] = ctc_image_url(inputtheme, value);
|
115 |
+
} else {
|
116 |
+
subparts = value.toString().split(/ +/);
|
117 |
+
if (subparts.length > 2) {
|
118 |
+
gradient[inputtheme].origin = 'undefined' == typeof subparts[0] ? 'top' : subparts[0];
|
119 |
+
gradient[inputtheme].start = 'undefined' == typeof subparts[1] ? 'transparent' : subparts[1];
|
120 |
+
gradient[inputtheme].end = 'undefined' == typeof subparts[2] ? 'transparent' : subparts[2];
|
121 |
+
has_gradient[inputtheme] = true;
|
122 |
+
} else {
|
123 |
+
cssrules[inputtheme]['background-image'] = value;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
} else {
|
127 |
+
cssrules[inputtheme][inputrule] = value;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
});
|
131 |
+
// update swatch
|
132 |
+
if ('undefined' != typeof $swatch) {
|
133 |
+
$($swatch).removeAttr('style');
|
134 |
+
if (has_gradient.parent) { $($swatch).ctcgrad(gradient.parent.origin, [gradient.parent.start, gradient.parent.end]); }
|
135 |
+
$($swatch).css(cssrules.parent);
|
136 |
+
if (!($swatch.attr('id').toString().match(/parent/))){
|
137 |
+
if (has_gradient.child) { $($swatch).ctcgrad(gradient.child.origin, [gradient.child.start, gradient.child.end]); }
|
138 |
+
$($swatch).css(cssrules.child);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
return postdata;
|
142 |
+
},
|
143 |
+
ctc_update_cache = function(response) {
|
144 |
+
var currQuery, currSelId, currRule;
|
145 |
+
$(response).each(function(){
|
146 |
+
switch (this.obj) {
|
147 |
+
case 'imports':
|
148 |
+
ctcAjax.imports = this.data;
|
149 |
+
break;
|
150 |
+
|
151 |
+
case 'rule_val':
|
152 |
+
ctcAjax.rule_val[this.key] = this.data;
|
153 |
+
currRuleId = this.key;
|
154 |
+
break;
|
155 |
+
|
156 |
+
case 'val_qry':
|
157 |
+
ctcAjax.val_qry[this.key] = this.data;
|
158 |
+
break;
|
159 |
+
|
160 |
+
case 'rule':
|
161 |
+
ctcAjax.rule = this.data;
|
162 |
+
break;
|
163 |
+
|
164 |
+
case 'sel_ndx':
|
165 |
+
if (ctc_is_empty(this.key)) {
|
166 |
+
ctcAjax.sel_ndx = this.data;
|
167 |
+
} else if ('qsid' == this.key) {
|
168 |
+
if (ctc_is_empty(ctcAjax.sel_ndx[this.data.query])) {
|
169 |
+
ctcAjax.sel_ndx[this.data.query] = {}
|
170 |
+
}
|
171 |
+
ctcAjax.sel_ndx[this.data.query][this.data.selector] = this.data.qsid;
|
172 |
+
} else {
|
173 |
+
ctcAjax.sel_ndx[this.key] = this.data;
|
174 |
+
currQuery = this.key;
|
175 |
+
}
|
176 |
+
break;
|
177 |
+
|
178 |
+
case 'sel_val':
|
179 |
+
ctcAjax.sel_val[this.key] = this.data;
|
180 |
+
currSelId = this.key;
|
181 |
+
break;
|
182 |
+
}
|
183 |
+
});
|
184 |
+
},
|
185 |
+
ctc_image_url = function(theme, value) {
|
186 |
+
var parts = value.toString().match(/url\([" ]*(.+?)[" ]*\)/),
|
187 |
+
path = ctc_is_empty(parts) ? null : parts[1],
|
188 |
+
url = ctcAjax.theme_uri + '/' + ('parent' == theme ? ctcAjax.parnt : ctcAjax.child) + '/',
|
189 |
+
image_url;
|
190 |
+
if (!path) {
|
191 |
+
return false;
|
192 |
+
} else if (path.toString().match(/^(https?:|\/)/)) {
|
193 |
+
image_url = value;
|
194 |
+
} else {
|
195 |
+
image_url = 'url(' + url + path + ')';
|
196 |
+
}
|
197 |
+
return image_url;
|
198 |
+
},
|
199 |
+
|
200 |
+
ctc_is_empty = function(obj) {
|
201 |
+
// first bail when definitely empty or undefined (true) NOTE: zero is not empty
|
202 |
+
if ('undefined' == typeof obj || false === obj || null === obj || '' === obj) { return true; }
|
203 |
+
// then, if this is bool, string or number it must not be empty (false)
|
204 |
+
if (true === obj || "string" === typeof obj || "number" === typeof obj) { return false; }
|
205 |
+
// thanks to Abena Kuttin for Win safe version
|
206 |
+
// check for object type to be safe
|
207 |
+
if ("object" === typeof obj) {
|
208 |
+
// Use a standard for in loop
|
209 |
+
for (var x in obj) {
|
210 |
+
// A for in will iterate over members on the prototype
|
211 |
+
// chain as well, but Object.getOwnPropertyNames returns
|
212 |
+
// only those directly on the object, so use hasOwnProperty.
|
213 |
+
if (obj.hasOwnProperty(x)) {
|
214 |
+
// any value means not empty (false)
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
// no properties, so return empty (true)
|
219 |
+
return true;
|
220 |
+
}
|
221 |
+
// this must be an unsupported datatype, so return not empty
|
222 |
+
return false;
|
223 |
+
|
224 |
+
},
|
225 |
+
|
226 |
+
ctc_load_queries = function() {
|
227 |
+
var arr = [];
|
228 |
+
if (1 === loading.sel_ndx) return arr;
|
229 |
+
if (0 === loading.sel_ndx) { // {
|
230 |
+
// retrieve from server
|
231 |
+
loading.sel_ndx = 1;
|
232 |
+
ctc_query_css('sel_ndx', null, ctc_setup_query_menu);
|
233 |
+
return arr;
|
234 |
+
}
|
235 |
+
if (false === ctc_is_empty(ctcAjax.sel_ndx)) {
|
236 |
+
$.each(ctcAjax.sel_ndx, function(key, value) {
|
237 |
+
var obj = { label: key, value: key };
|
238 |
+
arr.push(obj);
|
239 |
+
});
|
240 |
+
}
|
241 |
+
return arr;
|
242 |
+
},
|
243 |
+
|
244 |
+
ctc_load_selectors = function(query) {
|
245 |
+
var arr = [];
|
246 |
+
if (1 === loading.sel_ndx) {
|
247 |
+
return arr;
|
248 |
+
}
|
249 |
+
if (0 === loading.sel_ndx) {
|
250 |
+
// retrieve from server
|
251 |
+
loading.sel_ndx = 1;
|
252 |
+
ctc_query_css('sel_ndx', query, ctc_setup_selector_menu);
|
253 |
+
return arr;
|
254 |
+
}
|
255 |
+
if (false === ctc_is_empty(ctcAjax.sel_ndx[query])) {
|
256 |
+
$.each(ctcAjax.sel_ndx[query], function(key, value) {
|
257 |
+
var obj = { label: key, value: value };
|
258 |
+
arr.push(obj);
|
259 |
+
});
|
260 |
+
}
|
261 |
+
return arr;
|
262 |
+
},
|
263 |
+
|
264 |
+
ctc_load_rules = function() {
|
265 |
+
var arr = [];
|
266 |
+
if (1 === loading.rule) return arr;
|
267 |
+
if (0 === loading.rule) {
|
268 |
+
loading.rule = 1;
|
269 |
+
ctc_query_css('rule', null, ctc_setup_rule_menu);
|
270 |
+
return arr;
|
271 |
+
}
|
272 |
+
if (false === ctc_is_empty(ctcAjax.rule)) {
|
273 |
+
$.each(ctcAjax.rule, function(key, value) {
|
274 |
+
var obj = { label: value.replace(/\d+/g, from_ascii), value: key };
|
275 |
+
arr.push(obj);
|
276 |
+
});
|
277 |
+
}
|
278 |
+
return arr.sort(function (a, b) {
|
279 |
+
if (a.label > b.label)
|
280 |
+
return 1;
|
281 |
+
if (a.label < b.label)
|
282 |
+
return -1;
|
283 |
+
return 0;
|
284 |
+
});
|
285 |
+
},
|
286 |
+
|
287 |
+
ctc_render_child_rule_input = function(qsid, rule, seq) {
|
288 |
+
var html = '',
|
289 |
+
value = (ctc_is_empty(ctcAjax.sel_val[qsid])
|
290 |
+
|| ctc_is_empty(ctcAjax.sel_val[qsid].value)
|
291 |
+
|| ctc_is_empty(ctcAjax.sel_val[qsid].value[rule]) ? '' : ctcAjax.sel_val[qsid].value[rule]),
|
292 |
+
oldRuleObj = ctc_decode_value(rule, ('undefined' == typeof value ? '' : value['parnt'])),
|
293 |
+
oldRuleFlag = (false === ctc_is_empty(value['i_parnt']) && value['i_parnt']) ?
|
294 |
+
ctcAjax.important_label : '',
|
295 |
+
newRuleObj = ctc_decode_value(rule, ('undefined' == typeof value ? '' : value['child'])),
|
296 |
+
newRuleFlag = (false === ctc_is_empty(value['i_child']) && value['i_child']) ? 1 : 0,
|
297 |
+
impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid;
|
298 |
+
if (false === ctc_is_empty(ctcAjax.sel_val[qsid])) {
|
299 |
+
html += '<div class="ctc-' + ('ovrd' == seq ? 'input' : 'selector' ) + '-row clearfix">' + lf;
|
300 |
+
html += '<div class="ctc-input-cell">' + ('ovrd' == seq ? rule.replace(/\d+/g, from_ascii) : ctcAjax.sel_val[qsid].selector
|
301 |
+
+ '<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_' + qsid + '" >' + ctcAjax.edit_txt + '</a> '
|
302 |
+
+ (ctc_is_empty(oldRuleObj.orig) ? ctcAjax.child_only_txt : ''))
|
303 |
+
+ '</div>' + lf;
|
304 |
+
if ('ovrd' == seq) {
|
305 |
+
html += '<div class="ctc-parent-value ctc-input-cell" id="ctc_' + seq + '_parent_' + rule + '_' + qsid + '">'
|
306 |
+
+ (ctc_is_empty(oldRuleObj.orig) ? '[no value]' : oldRuleObj.orig + oldRuleFlag) + '</div>' + lf;
|
307 |
+
}
|
308 |
+
html += '<div class="ctc-input-cell">' + lf;
|
309 |
+
if (false === ctc_is_empty(oldRuleObj.names)){
|
310 |
+
$.each(oldRuleObj.names, function(ndx, newname) {
|
311 |
+
newname = (ctc_is_empty(newname) ? '' : newname);
|
312 |
+
html += '<div class="ctc-child-input-cell">' + lf;
|
313 |
+
var id = 'ctc_' + seq + '_child_' + rule + '_' + qsid + newname,
|
314 |
+
newval;
|
315 |
+
if (false === (newval = newRuleObj.values.shift()) ){
|
316 |
+
newval = '';
|
317 |
+
}
|
318 |
+
|
319 |
+
html += (ctc_is_empty(newname) ? '' : ctcAjax.field_labels[newname] + ':<br/>')
|
320 |
+
+ '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value'
|
321 |
+
+ ((newname + rule).toString().match(/color/) ? ' color-picker' : '')
|
322 |
+
+ ((newname).toString().match(/url/) ? ' ctc-input-wide' : '')
|
323 |
+
+ '" value="' + newval + '" />' + lf;
|
324 |
+
html += '</div>' + lf;
|
325 |
+
});
|
326 |
+
html += '<label for="' + impid + '"><input type="checkbox" id="' + impid + '" name="' + impid + '" value="1" '
|
327 |
+
+ (1 === newRuleFlag ? 'checked' : '') + ' />' + ctcAjax.important_label + '</label>' + lf;
|
328 |
+
}
|
329 |
+
html += '</div>' + lf;
|
330 |
+
html += ('ovrd' == seq ? '' : '<div class="ctc-swatch ctc-specific" id="ctc_child_' + rule + '_' + qsid + '_swatch">'
|
331 |
+
+ ctcAjax.swatch_txt + '</div>' + lf
|
332 |
+
+ '<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_' + rule + '_' + qsid + '_cell">' + lf
|
333 |
+
+ '<input type="button" class="button ctc-save-input" id="ctc_save_' + rule + '_' + qsid
|
334 |
+
+ '" name="ctc_save_' + rule + '_' + qsid + '" value="Save" /></div>' + lf);
|
335 |
+
html += '</div><!-- end input row -->' + lf;
|
336 |
+
}
|
337 |
+
return html;
|
338 |
+
},
|
339 |
+
|
340 |
+
ctc_render_selector_inputs = function(qsid) {
|
341 |
+
if (1 === loading.sel_val) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (0 == loading.sel_val) {
|
345 |
+
loading.sel_val = 1;
|
346 |
+
ctc_query_css('sel_val', qsid, ctc_render_selector_inputs);
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
var id, html, val;
|
350 |
+
if (ctc_is_empty(ctcAjax.sel_val[qsid])) {
|
351 |
+
$('#ctc_sel_ovrd_rule_inputs').html('')
|
352 |
+
} else {
|
353 |
+
if (ctc_is_empty(ctcAjax.sel_val[qsid].seq)) {
|
354 |
+
$('#ctc_child_load_order_container').html('');
|
355 |
+
} else {
|
356 |
+
id = 'ctc_ovrd_child_seq_' + qsid;
|
357 |
+
val = parseInt(ctcAjax.sel_val[qsid].seq);
|
358 |
+
html = '<input type="text" id="' + id + '" name="' + id + '" class="ctc-child-value" value="' + val + '" />';
|
359 |
+
$('#ctc_child_load_order_container').html(html);
|
360 |
+
}
|
361 |
+
if (ctc_is_empty(ctcAjax.sel_val[qsid].value)){
|
362 |
+
$('#ctc_sel_ovrd_rule_inputs').html('');
|
363 |
+
} else {
|
364 |
+
html = '';
|
365 |
+
$.each(ctcAjax.sel_val[qsid].value, function(rule, value) {
|
366 |
+
html += ctc_render_child_rule_input(qsid, rule, 'ovrd');
|
367 |
+
});
|
368 |
+
$('#ctc_sel_ovrd_rule_inputs').html(html).find('.color-picker').each(function() {
|
369 |
+
ctc_setup_iris(this);
|
370 |
+
});
|
371 |
+
ctc_coalesce_inputs('#ctc_child_all_0_swatch');
|
372 |
+
}
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
ctc_render_rule_value_inputs = function(ruleid) {
|
377 |
+
if (1 === loading.rule_val) return false;
|
378 |
+
|
379 |
+
if (0 == loading.rule_val) {
|
380 |
+
loading.rule_val = 1;
|
381 |
+
ctc_query_css('rule_val', ruleid, ctc_render_rule_value_inputs);
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
var rule = ctcAjax.rule[ruleid],
|
385 |
+
html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + lf;
|
386 |
+
if (false === ctc_is_empty(ctcAjax.rule_val[ruleid])){
|
387 |
+
$.each(ctcAjax.rule_val[ruleid], function(valid, value) {
|
388 |
+
var oldRuleObj = ctc_decode_value(rule, value);
|
389 |
+
html += '<div class="ctc-parent-row clearfix" id="ctc_rule_row_' + rule + '_' + valid + '">' + lf;
|
390 |
+
html += '<div class="ctc-input-cell ctc-parent-value" id="ctc_' + valid + '_parent_' + rule + '_' + valid + '">'
|
391 |
+
+ oldRuleObj.orig + '</div>' + lf;
|
392 |
+
html += '<div class="ctc-input-cell">' + lf;
|
393 |
+
html += '<div class="ctc-swatch ctc-specific" id="ctc_' + valid + '_parent_' + rule + '_' + valid + '_swatch">'
|
394 |
+
+ ctcAjax.swatch_txt + '</div></div>' + lf;
|
395 |
+
html += '<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_' + rule + '_' + valid + '">'
|
396 |
+
+ ctcAjax.selector_txt + '</a></div>' + lf;
|
397 |
+
html += '<div id="ctc_selector_' + rule + '_' + valid + '_container" class="ctc-selector-container clearfix">' + lf;
|
398 |
+
html += '<a href="#" id="ctc_selector_' + rule + '_' + valid + '_close" class="ctc-selector-handle" style="float:right">'
|
399 |
+
+ ctcAjax.close_txt + '</a><div id="ctc_status_val_qry_' + valid + '"></div>' + lf;
|
400 |
+
html += '<div id="ctc_selector_' + rule + '_' + valid + '_rows"></div>' + lf;
|
401 |
+
html += '</div></div>' + lf;
|
402 |
+
});
|
403 |
+
html += '</div>' + lf;
|
404 |
+
}
|
405 |
+
$('#ctc_rule_value_inputs').html(html).find('.ctc-swatch').each(function() {
|
406 |
+
ctc_coalesce_inputs(this);
|
407 |
+
});
|
408 |
+
},
|
409 |
+
|
410 |
+
ctc_render_selector_value_inputs = function(valid) {
|
411 |
+
if (1 == loading.val_qry) return false;
|
412 |
+
var params,
|
413 |
+
page_ruleid,
|
414 |
+
rule = $('#ctc_rule_menu_selected').text().replace(/[^\w\-]/g, to_ascii),
|
415 |
+
selector,
|
416 |
+
html = '';
|
417 |
+
if (0 === loading.val_qry) {
|
418 |
+
loading.val_qry = 1;
|
419 |
+
params = { 'rule': rule };
|
420 |
+
ctc_query_css('val_qry', valid, ctc_render_selector_value_inputs, params);
|
421 |
+
return false;
|
422 |
+
}
|
423 |
+
if (false === ctc_is_empty(ctcAjax.val_qry[valid])){
|
424 |
+
$.each(ctcAjax.val_qry[valid], function(rule, queries) {
|
425 |
+
page_rule = rule;
|
426 |
+
$.each(queries, function(query, selectors) {
|
427 |
+
html += '<h4 class="ctc-query-heading">' + query + '</h4>' + lf;
|
428 |
+
if (false === ctc_is_empty(selectors)){
|
429 |
+
$.each(selectors, function(qsid, data) {
|
430 |
+
ctcAjax.sel_val[qsid] = data;
|
431 |
+
html += ctc_render_child_rule_input(qsid, rule, valid);
|
432 |
+
});
|
433 |
+
}
|
434 |
+
});
|
435 |
+
});
|
436 |
+
}
|
437 |
+
selector = '#ctc_selector_' + rule + '_' + valid + '_rows';
|
438 |
+
$(selector).html(html).find('.color-picker').each(function() {
|
439 |
+
ctc_setup_iris(this);
|
440 |
+
});
|
441 |
+
$(selector).find('.ctc-swatch').each(function() {
|
442 |
+
ctc_coalesce_inputs(this);
|
443 |
+
});
|
444 |
+
|
445 |
+
},
|
446 |
+
ctc_query_css = function(obj, key, callback, params) {
|
447 |
+
var postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
|
448 |
+
status_sel = '#ctc_status_' + obj + ('val_qry' == obj ? '_' + key : '');
|
449 |
+
|
450 |
+
if ('object' === typeof params) {
|
451 |
+
$.each(params, function(key, val){
|
452 |
+
postdata['ctc_query_' + key] = val;
|
453 |
+
});
|
454 |
+
}
|
455 |
+
$('.ctc-status-icon').remove();
|
456 |
+
$(status_sel).append('<span class="ctc-status-icon spinner"></span>');
|
457 |
+
$('.spinner').show();
|
458 |
+
// add wp ajax action to array
|
459 |
+
postdata['action'] = 'ctc_query';
|
460 |
+
postdata['_wpnonce'] = $('#_wpnonce').val();
|
461 |
+
// ajax post input data
|
462 |
+
$.post(
|
463 |
+
// get ajax url from localized object
|
464 |
+
ctcAjax.ajaxurl,
|
465 |
+
//Data
|
466 |
+
postdata,
|
467 |
+
//on success function
|
468 |
+
function(response){
|
469 |
+
// hide spinner
|
470 |
+
loading[obj] = 2;
|
471 |
+
$('.ctc-status-icon').removeClass('spinner');
|
472 |
+
// show check mark
|
473 |
+
if (ctc_is_empty(response)) {
|
474 |
+
$('.ctc-status-icon').addClass('failure');
|
475 |
+
} else {
|
476 |
+
$('.ctc-status-icon').addClass('success');
|
477 |
+
// update data objects
|
478 |
+
ctc_update_cache(response);
|
479 |
+
if ('function' === typeof callback) {
|
480 |
+
callback(key);
|
481 |
+
}
|
482 |
+
return false;
|
483 |
+
}
|
484 |
+
},'json'
|
485 |
+
).fail(function(){
|
486 |
+
loading[obj] = 0;
|
487 |
+
// hide spinner
|
488 |
+
$('.ctc-status-icon').removeClass('spinner');
|
489 |
+
// show check mark
|
490 |
+
$('.ctc-status-icon').addClass('failure');
|
491 |
+
});
|
492 |
+
return false;
|
493 |
+
},
|
494 |
+
ctc_save = function(obj) {
|
495 |
+
var postdata = {},
|
496 |
+
$selector, $query, $imports, $rule,
|
497 |
+
id = $(obj).attr('id');
|
498 |
+
if (ctc_is_empty(saveEvents[id])) {
|
499 |
+
saveEvents[id] = 0;
|
500 |
+
}
|
501 |
+
saveEvents[id]++;
|
502 |
+
// disable the button until ajax returns
|
503 |
+
$(obj).prop('disabled', true);
|
504 |
+
// clear previous success/fail icons
|
505 |
+
$('.ctc-status-icon').remove();
|
506 |
+
// show spinner
|
507 |
+
$(obj).parent('.ctc-textarea-button-cell, .ctc-button-cell').append('<span class="ctc-status-icon spinner"></span>');
|
508 |
+
$('.spinner').show();
|
509 |
+
if (($selector = $('#ctc_new_selectors')) && 'ctc_save_new_selectors' == $(obj).attr('id')) {
|
510 |
+
postdata['ctc_new_selectors'] = $selector.val();
|
511 |
+
if ($query = $('#ctc_sel_ovrd_query_selected')) {
|
512 |
+
postdata['ctc_sel_ovrd_query'] = $query.text();
|
513 |
+
}
|
514 |
+
} else if (($imports = $('#ctc_child_imports')) && 'ctc_save_imports' == $(obj).attr('id')) {
|
515 |
+
postdata['ctc_child_imports'] = $imports.val();
|
516 |
+
} else {
|
517 |
+
// coalesce inputs
|
518 |
+
postdata = ctc_coalesce_inputs(obj);
|
519 |
+
}
|
520 |
+
// add wp ajax action to array
|
521 |
+
postdata['action'] = 'ctc_update';
|
522 |
+
postdata['_wpnonce'] = $('#_wpnonce').val();
|
523 |
+
// ajax post input data
|
524 |
+
$.post(
|
525 |
+
// get ajax url from localized object
|
526 |
+
ctcAjax.ajaxurl,
|
527 |
+
//Data
|
528 |
+
postdata,
|
529 |
+
//on success function
|
530 |
+
function(response){
|
531 |
+
// release button
|
532 |
+
$(obj).prop('disabled', false);
|
533 |
+
// hide spinner
|
534 |
+
$('.ctc-status-icon').removeClass('spinner');
|
535 |
+
// show check mark
|
536 |
+
if (ctc_is_empty(response)) {
|
537 |
+
$('.ctc-status-icon').addClass('failure');
|
538 |
+
} else {
|
539 |
+
$('.ctc-status-icon').addClass('success');
|
540 |
+
$('#ctc_new_selectors').val('');
|
541 |
+
// update data objects
|
542 |
+
ctc_update_cache(response);
|
543 |
+
ctc_setup_menus();
|
544 |
+
}
|
545 |
+
return false;
|
546 |
+
}, 'json'
|
547 |
+
).fail(function(){
|
548 |
+
// release button
|
549 |
+
$(obj).prop('disabled', false);
|
550 |
+
// hide spinner
|
551 |
+
$('.ctc-status-icon').removeClass('spinner');
|
552 |
+
// show check mark
|
553 |
+
$('.ctc-status-icon').addClass('failure');
|
554 |
+
});
|
555 |
+
return false;
|
556 |
+
},
|
557 |
+
/* stub for future ajax loader
|
558 |
+
ctc_load_css = function(e) {
|
559 |
+
|
560 |
+
|
561 |
+
var postdata = $(this).serializeArray();
|
562 |
+
// disable the button until ajax returns
|
563 |
+
$('#ctc_load_styles').prop('disabled', true);
|
564 |
+
// clear previous success/fail icons
|
565 |
+
$('.ctc-status-icon').remove();
|
566 |
+
// show spinner
|
567 |
+
$('#ctc_load_styles').parent('.ctc-input-cell').append('<span class="ctc-status-icon spinner"></span>');
|
568 |
+
$('.spinner').show();
|
569 |
+
return true;
|
570 |
+
|
571 |
+
// ajax post input data
|
572 |
+
$.post(
|
573 |
+
// get ajax url from localized object
|
574 |
+
ctcAjax.ajaxurl,
|
575 |
+
//Data
|
576 |
+
postdata,
|
577 |
+
//on success function
|
578 |
+
function(response){
|
579 |
+
// release button
|
580 |
+
$('#ctc_load_styles').prop('disabled', false);
|
581 |
+
// hide spinner
|
582 |
+
$('.ctc-status-icon').removeClass('spinner');
|
583 |
+
// show check mark
|
584 |
+
if (ctc_is_empty(response.updated)) {
|
585 |
+
$('.ctc-status-icon').addClass('failure');
|
586 |
+
// update notice
|
587 |
+
if (false === ctc_is_empty(response.error)) {
|
588 |
+
ctc_set_notice({'error': response.error});
|
589 |
+
}
|
590 |
+
} else {
|
591 |
+
$('.ctc-status-icon').addClass('success');
|
592 |
+
// update notice
|
593 |
+
if (false === ctc_is_empty(response.updated)) {
|
594 |
+
ctc_set_notice({'updated': response.updated});
|
595 |
+
}
|
596 |
+
if (false === ctc_is_empty(response.themes)) {
|
597 |
+
ctcAjax.themes = response.themes;
|
598 |
+
}
|
599 |
+
if (false === ctc_is_empty(response.menu)) {
|
600 |
+
$('#ctc_theme_child').html(response.menu);
|
601 |
+
}
|
602 |
+
$('.nav-tab, .ctc-option-panel, .ctc-radio, .ctc-select, label').fadeIn('fast');
|
603 |
+
}
|
604 |
+
return false;
|
605 |
+
},
|
606 |
+
'json'
|
607 |
+
).fail(function(){
|
608 |
+
// release button
|
609 |
+
$('#ctc_load_styles').prop('disabled', false);
|
610 |
+
// hide spinner
|
611 |
+
$('.ctc-status-icon').removeClass('spinner');
|
612 |
+
// show check mark
|
613 |
+
$('.ctc-status-icon').addClass('failure');
|
614 |
+
});
|
615 |
+
return false;
|
616 |
+
},*/
|
617 |
+
ctc_decode_value = function(rule, value) {
|
618 |
+
value = ('undefined' == typeof value ? '' : value);
|
619 |
+
var obj = { 'orig': value };
|
620 |
+
if (rule.toString().match(/^border(\-(top|right|bottom|left))?$/)) {
|
621 |
+
var params = value.toString().split(/ +/);
|
622 |
+
obj['names'] = [
|
623 |
+
'_border_width',
|
624 |
+
'_border_style',
|
625 |
+
'_border_color',
|
626 |
+
];
|
627 |
+
obj['values'] = [
|
628 |
+
('undefined' == typeof params[0] ? '' : params[0]),
|
629 |
+
('undefined' == typeof params[1] ? '' : params[1]),
|
630 |
+
('undefined' == typeof params[2] ? '' : params[2])
|
631 |
+
];
|
632 |
+
} else if (rule.toString().match(/^background\-image/)) {
|
633 |
+
obj['names'] = [
|
634 |
+
'_background_url',
|
635 |
+
'_background_origin',
|
636 |
+
'_background_color1',
|
637 |
+
'_background_color2'
|
638 |
+
];
|
639 |
+
obj['values'] = ['','','',''];
|
640 |
+
if (false === (ctc_is_empty(value)) && !(value.toString().match(/url/))) {
|
641 |
+
var params = value.toString().split(/:/);
|
642 |
+
obj['values'][1] = ('undefined' == typeof params[0] ? '' : params[0]);
|
643 |
+
obj['values'][2] = ('undefined' == typeof params[1] ? '' : params[1]);
|
644 |
+
obj['values'][3] = ('undefined' == typeof params[3] ? '' : params[3]);
|
645 |
+
obj['orig'] = [ obj['values'][1], obj['values'][2], obj['values'][3] ].join(' '); // display "origin color1 color2"
|
646 |
+
} else {
|
647 |
+
obj['values'][0] = value;
|
648 |
+
}
|
649 |
+
} else {
|
650 |
+
obj['names'] = [''];
|
651 |
+
obj['values'] = [ value ];
|
652 |
+
}
|
653 |
+
return obj;
|
654 |
+
},
|
655 |
+
|
656 |
+
ctc_set_query = function(value) {
|
657 |
+
currentQuery = value;
|
658 |
+
$('#ctc_sel_ovrd_query').val('');
|
659 |
+
$('#ctc_sel_ovrd_query_selected').text(value);
|
660 |
+
$('#ctc_sel_ovrd_selector').val('');
|
661 |
+
$('#ctc_sel_ovrd_selector_selected').html(' ');
|
662 |
+
$('#ctc_sel_ovrd_rule_inputs').html('');
|
663 |
+
ctc_setup_selector_menu(value);
|
664 |
+
ctc_coalesce_inputs('#ctc_child_all_0_swatch');
|
665 |
+
$('#ctc_new_selector_row').show();
|
666 |
+
},
|
667 |
+
|
668 |
+
ctc_set_selector = function(value,label) {
|
669 |
+
$('#ctc_sel_ovrd_selector').val('');
|
670 |
+
$('#ctc_sel_ovrd_selector_selected').text(label);
|
671 |
+
$('#ctc_sel_ovrd_qsid').val(value);
|
672 |
+
currentSel = value;
|
673 |
+
if (1 != loading.sel_val) loading.sel_val = 0;
|
674 |
+
ctc_render_selector_inputs(value);
|
675 |
+
$('#ctc_sel_ovrd_new_rule, #ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs').show();
|
676 |
+
},
|
677 |
+
|
678 |
+
ctc_set_rule = function(value,label) {
|
679 |
+
$('#ctc_rule_menu').val('');
|
680 |
+
$('#ctc_rule_menu_selected').text(label);
|
681 |
+
if (1 != loading.rule_val) loading.rule_val = 0;
|
682 |
+
ctc_render_rule_value_inputs(value);
|
683 |
+
$('#ctc_rule_value_inputs,#ctc_input_row_rule_header').show();
|
684 |
+
},
|
685 |
+
ctc_setup_query_menu = function() {
|
686 |
+
ctc_queries = ctc_load_queries();
|
687 |
+
$('#ctc_sel_ovrd_query').autocomplete({
|
688 |
+
source: ctc_queries,
|
689 |
+
minLength: 0,
|
690 |
+
selectFirst: true,
|
691 |
+
autoFocus: true,
|
692 |
+
select: function(e, ui) {
|
693 |
+
ctc_set_query(ui.item.value);
|
694 |
+
return false;
|
695 |
+
},
|
696 |
+
focus: function(e) { e.preventDefault(); }
|
697 |
+
});
|
698 |
+
},
|
699 |
+
ctc_setup_selector_menu = function(query) {
|
700 |
+
ctc_selectors = ctc_load_selectors(query);
|
701 |
+
$('#ctc_sel_ovrd_selector').autocomplete({
|
702 |
+
source: ctc_selectors,
|
703 |
+
selectFirst: true,
|
704 |
+
autoFocus: true,
|
705 |
+
select: function(e, ui) {
|
706 |
+
ctc_set_selector(ui.item.value, ui.item.label);
|
707 |
+
return false;
|
708 |
+
},
|
709 |
+
focus: function(e) { e.preventDefault(); }
|
710 |
+
});
|
711 |
+
},
|
712 |
+
ctc_setup_rule_menu = function() {
|
713 |
+
ctc_rules = ctc_load_rules();
|
714 |
+
$('#ctc_rule_menu').autocomplete({
|
715 |
+
source: ctc_rules,
|
716 |
+
//minLength: 0,
|
717 |
+
selectFirst: true,
|
718 |
+
autoFocus: true,
|
719 |
+
select: function(e, ui) {
|
720 |
+
ctc_set_rule(ui.item.value, ui.item.label);
|
721 |
+
return false;
|
722 |
+
},
|
723 |
+
focus: function(e) { e.preventDefault(); }
|
724 |
+
});
|
725 |
+
},
|
726 |
+
ctc_filtered_rules = function(request, response) {
|
727 |
+
var arr = [],
|
728 |
+
noval = (ctc_is_empty(ctcAjax.sel_val[currentSel])) || (ctc_is_empty(ctcAjax.sel_val[currentSel].value));
|
729 |
+
if (ctc_is_empty(ctc_rules)) {
|
730 |
+
ctc_rules = ctc_load_rules();
|
731 |
+
}
|
732 |
+
$.each(ctc_rules, function(key, val){
|
733 |
+
var skip = false,
|
734 |
+
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
735 |
+
if (matcher.test( val.label )) {
|
736 |
+
if (false === noval) {
|
737 |
+
// skip rule if in current selector array
|
738 |
+
$.each(ctcAjax.sel_val[currentSel].value, function(rule, value) {
|
739 |
+
if (val.label == rule.replace(/\d+/g, from_ascii)) {
|
740 |
+
skip = true;
|
741 |
+
return false;
|
742 |
+
}
|
743 |
+
});
|
744 |
+
if (skip) {
|
745 |
+
return;
|
746 |
+
}
|
747 |
+
}
|
748 |
+
// add rule
|
749 |
+
arr.push(val);
|
750 |
+
}
|
751 |
+
});
|
752 |
+
response(arr);
|
753 |
+
},
|
754 |
+
ctc_setup_new_rule_menu = function() {
|
755 |
+
$('#ctc_new_rule_menu').autocomplete({
|
756 |
+
source: ctc_filtered_rules,
|
757 |
+
//minLength: 0,
|
758 |
+
selectFirst: true,
|
759 |
+
autoFocus: true,
|
760 |
+
select: function(e, ui) {
|
761 |
+
e.preventDefault();
|
762 |
+
var n = $(ctc_render_child_rule_input(currentSel, ui.item.label, 'ovrd'));
|
763 |
+
$('#ctc_sel_ovrd_rule_inputs').append(n);
|
764 |
+
$('#ctc_new_rule_menu').val('');
|
765 |
+
if (ctc_is_empty(ctcAjax.sel_val[currentSel].value)) {
|
766 |
+
ctcAjax.sel_val[currentSel]['value'] = {};
|
767 |
+
}
|
768 |
+
ctcAjax.sel_val[currentSel].value[ui.item.label] = {'child': ''};
|
769 |
+
n.find('input[type="text"]').each(function(ndx, el){
|
770 |
+
if ($(el).hasClass('color-picker'))
|
771 |
+
ctc_setup_iris(el);
|
772 |
+
$(el).focus();
|
773 |
+
});
|
774 |
+
return false;
|
775 |
+
},
|
776 |
+
focus: function(e) { e.preventDefault(); }
|
777 |
+
});
|
778 |
+
},
|
779 |
+
ctc_setup_menus = function() {
|
780 |
+
ctc_setup_query_menu();
|
781 |
+
ctc_setup_selector_menu(currentQuery);
|
782 |
+
ctc_setup_rule_menu();
|
783 |
+
ctc_setup_new_rule_menu();
|
784 |
+
},
|
785 |
+
ctc_theme_exists = function(testslug, testtype) {
|
786 |
+
var exists = false;
|
787 |
+
$.each(ctcAjax.themes, function(type, theme){
|
788 |
+
$.each(theme, function(slug, data){
|
789 |
+
if (slug == testslug && ('parnt' == type || 'new' == testtype)) {
|
790 |
+
exists = true;
|
791 |
+
return false;
|
792 |
+
}
|
793 |
+
});
|
794 |
+
if (exists) return false;
|
795 |
+
});
|
796 |
+
return exists;
|
797 |
+
},
|
798 |
+
|
799 |
+
ctc_set_notice = function(noticearr) {
|
800 |
+
var errorHtml = '';
|
801 |
+
if (false === ctc_is_empty(noticearr)) {
|
802 |
+
$.each(noticearr, function(type, list){
|
803 |
+
errorHtml += '<div class="' + type + '"><ul>' + lf;
|
804 |
+
$(list).each(function(ndx, el){
|
805 |
+
errorHtml += '<li>' + el.toString() + '</li>' + lf;
|
806 |
+
});
|
807 |
+
errorHtml += '</ul></div>';
|
808 |
+
});
|
809 |
+
}
|
810 |
+
$('#ctc_error_notice').html(errorHtml);
|
811 |
+
},
|
812 |
+
ctc_validate = function() {
|
813 |
+
var regex = /[^\w\-]/,
|
814 |
+
newslug = $('#ctc_child_template').val().toString().replace(regex).toLowerCase(),
|
815 |
+
slug = $('#ctc_theme_child').val().toString().replace(regex).toLowerCase(),
|
816 |
+
type = $('input[name=ctc_child_type]:checked').val(),
|
817 |
+
errors = [];
|
818 |
+
if ('new' == type) slug = newslug;
|
819 |
+
if (ctc_theme_exists(slug, type)) {
|
820 |
+
errors.push(ctcAjax.theme_exists_txt.toString().replace(/%s/, slug));
|
821 |
+
}
|
822 |
+
if ('' === slug) {
|
823 |
+
errors.push(ctcAjax.inval_theme_txt);
|
824 |
+
}
|
825 |
+
if ('' === $('#ctc_child_name').val()) {
|
826 |
+
errors.push(ctcAjax.inval_name_txt);
|
827 |
+
}
|
828 |
+
if (errors.length) {
|
829 |
+
ctc_set_notice({'error': errors});
|
830 |
+
return false;
|
831 |
+
}
|
832 |
+
return true;
|
833 |
+
},
|
834 |
+
ctc_set_theme_menu = function(e) {
|
835 |
+
var slug = $('#ctc_theme_child').val();
|
836 |
+
if (false === ctc_is_empty(ctcAjax.themes.child[slug])) {
|
837 |
+
$('#ctc_child_name').val(ctcAjax.themes.child[slug].Name);
|
838 |
+
$('#ctc_child_author').val(ctcAjax.themes.child[slug].Author);
|
839 |
+
$('#ctc_child_version').val(ctcAjax.themes.child[slug].Version);
|
840 |
+
}
|
841 |
+
},
|
842 |
+
fade_update_notice = function() {
|
843 |
+
$('.updated, .error').slideUp('slow', function(){ $('.updated').remove(); });
|
844 |
+
},
|
845 |
+
ctc_focus_panel = function(id) {
|
846 |
+
var panelid = id + '_panel';
|
847 |
+
$('.nav-tab').removeClass('nav-tab-active');
|
848 |
+
$('.ctc-option-panel').removeClass('ctc-option-panel-active');
|
849 |
+
$('.ctc-selector-container').hide();
|
850 |
+
$(id).addClass('nav-tab-active');
|
851 |
+
$('.ctc-option-panel-container').scrollTop(0);
|
852 |
+
$(panelid).addClass('ctc-option-panel-active');
|
853 |
+
},
|
854 |
+
ctc_selector_edit = function(obj) {
|
855 |
+
var qsid = $(obj).attr('id').match(/_(\d+)$/)[1],
|
856 |
+
q = ctcAjax.sel_val[qsid].query,
|
857 |
+
s = ctcAjax.sel_val[qsid].selector,
|
858 |
+
id = '#query_selector_options';
|
859 |
+
ctc_set_query(q);
|
860 |
+
ctc_set_selector(qsid, s);
|
861 |
+
ctc_focus_panel(id);
|
862 |
+
|
863 |
+
},
|
864 |
+
// initialize vars
|
865 |
+
// ajax semaphores: 0 = reload, 1 = loading, 2 = loaded
|
866 |
+
loading = {
|
867 |
+
'rule': 2,
|
868 |
+
'sel_ndx': 2,
|
869 |
+
'val_qry': 0,
|
870 |
+
'rule_val': 0,
|
871 |
+
'sel_val': 0
|
872 |
+
},
|
873 |
+
|
874 |
+
ctc_selectors = [],
|
875 |
+
ctc_queries = [],
|
876 |
+
ctc_rules = [];
|
877 |
+
// -- end var definitions
|
878 |
+
|
879 |
+
// initialize Iris color picker
|
880 |
+
$('.color-picker').each(function() {
|
881 |
+
ctc_setup_iris(this);
|
882 |
+
});
|
883 |
+
// bind event handlers
|
884 |
+
$('.ctc-option-panel-container').on('focus', '.color-picker', function(){
|
885 |
+
ctc_set_notice('')
|
886 |
+
$(this).iris('toggle');
|
887 |
+
$('.iris-picker').css({'position':'absolute', 'z-index':10});
|
888 |
+
});
|
889 |
+
$('.ctc-option-panel-container').on('focus', 'input', function() {
|
890 |
+
ctc_set_notice('')
|
891 |
+
$('.color-picker').not(this).iris('hide');
|
892 |
+
});
|
893 |
+
$('.ctc-option-panel-container').on('change', '.ctc-child-value, input[type=checkbox]', function() {
|
894 |
+
ctc_coalesce_inputs(this);
|
895 |
+
});
|
896 |
+
$('.ctc-option-panel-container').on('click', '.ctc-selector-handle', function(e) {
|
897 |
+
e.preventDefault();
|
898 |
+
ctc_set_notice('')
|
899 |
+
var id = $(this).attr('id').toString().replace('_close', ''),
|
900 |
+
valid = id.toString().match(/_(\d+)$/)[1];
|
901 |
+
if ($('#' + id + '_container').is(':hidden')) {
|
902 |
+
if (1 != loading.val_qry) loading.val_qry = 0;
|
903 |
+
ctc_render_selector_value_inputs(valid);
|
904 |
+
}
|
905 |
+
$('#' + id + '_container').fadeToggle('fast');
|
906 |
+
$('.ctc-selector-container').not('#' + id + '_container').fadeOut('fast');
|
907 |
+
});
|
908 |
+
$('.nav-tab').on('click', function(e){
|
909 |
+
e.preventDefault();
|
910 |
+
// clear the notice box
|
911 |
+
ctc_set_notice('')
|
912 |
+
var id = '#' + $(this).attr('id');
|
913 |
+
ctc_focus_panel(id);
|
914 |
+
});
|
915 |
+
$('#view_child_options,#view_parnt_options').on('click', function(e){
|
916 |
+
ctc_set_notice('')
|
917 |
+
var stamp = new Date().getTime(),
|
918 |
+
theme = $(this).attr('id').toString().match(/(child|parnt)/)[1],
|
919 |
+
css_uri = ctcAjax.theme_uri + '/' + ctcAjax[theme] + '/style.css?' + stamp;
|
920 |
+
$.get(
|
921 |
+
css_uri,
|
922 |
+
function(response){
|
923 |
+
$('#view_'+theme+'_options_panel').text(response);
|
924 |
+
}
|
925 |
+
).fail(function(){
|
926 |
+
$('#view_'+theme+'_options_panel').text(ctcAjax.css_fail_txt);
|
927 |
+
});
|
928 |
+
});
|
929 |
+
$('#ctc_load_form').on('submit', function() {
|
930 |
+
return (ctc_validate() && confirm(ctcAjax.load_txt) ) ;
|
931 |
+
});
|
932 |
+
$('#parent_child_options_panel').on('change', '#ctc_theme_child', ctc_set_theme_menu );
|
933 |
+
$(document).on('click', '.ctc-save-input', function(e) {
|
934 |
+
ctc_save(this);
|
935 |
+
});
|
936 |
+
$(document).on('click', '.ctc-selector-edit', function(e) {
|
937 |
+
ctc_selector_edit(this);
|
938 |
+
});
|
939 |
+
// initialize menus
|
940 |
+
ctc_setup_menus();
|
941 |
+
ctc_set_query(currentQuery);
|
942 |
+
$('input[type=submit],input[type=button]').prop('disabled', false);
|
943 |
+
setTimeout(fade_update_notice, 6000);
|
944 |
+
});
|
945 |
+
|
946 |
+
|
chld-thm-cfg.min.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
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.2.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 p="\n",m="base",a,o={},q=function(r){g(r).iris({change:function(){k(r)}})},l=function(t){var r=parseInt(t),s=String.fromCharCode(r);return s},i=function(s){var r=s.charCodeAt(0);return r},k=function(x){var t=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,y=g(x).parents(".ctc-selector-row, .ctc-parent-row").first(),w=y.find(".ctc-swatch").first(),v={parent:{},child:{}},u={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},s={child:false,parent:false},r={};y.find(".ctc-parent-value, .ctc-child-value").each(function(){var G=g(this).attr("id"),z=G.toString().match(t),H=z[2],A=z[3],J=("undefined"==typeof z[4]?"":z[4]),F=z[5],E=("undefined"==typeof z[6]?"":z[6]),I=("parent"==A?g(this).text():g(this).val()),B="ctc_"+H+"_child_"+J+"_i_"+F,D,C;if("child"==A){r[G]=I;r[B]=(g("#"+B).is(":checked"))?1:0}if(false===b(E)){switch(E){case"_border_width":v[A][J+"-width"]=I;break;case"_border_style":v[A][J+"-style"]=I;break;case"_border_color":v[A][J+"-color"]=I;break;case"_background_url":v[A]["background-image"]=d(A,I);break;case"_background_color":v[A]["background-color"]=x.value;break;case"_background_color1":u[A].start=I;s[A]=true;break;case"_background_color2":u[A].end=I;s[A]=true;break;case"_background_origin":u[A].origin=I;s[A]=true;break}}else{if(D=J.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!I.match(/none/)){C=I.toString().split(/ +/);v[A][J+"-width"]="undefined"==typeof C[0]?"":C[0];v[A][J+"-style"]="undefined"==typeof C[1]?"":C[1];v[A][J+"-color"]="undefined"==typeof C[2]?"":C[2]}else{if("background-image"==J){if(I.toString().match(/url\(/)){v[A]["background-image"]=d(A,I)}else{C=I.toString().split(/ +/);if(C.length>2){u[A].origin="undefined"==typeof C[0]?"top":C[0];u[A].start="undefined"==typeof C[1]?"transparent":C[1];u[A].end="undefined"==typeof C[2]?"transparent":C[2];s[A]=true}else{v[A]["background-image"]=I}}}else{v[A][J]=I}}}});if("undefined"!=typeof w){g(w).removeAttr("style");if(s.parent){g(w).ctcgrad(u.parent.origin,[u.parent.start,u.parent.end])}g(w).css(v.parent);if(!(w.attr("id").toString().match(/parent/))){if(s.child){g(w).ctcgrad(u.child.origin,[u.child.start,u.child.end])}g(w).css(v.child)}}return r},c=function(t){var s,u,r;g(t).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){if(b(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;s=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;u=this.key;break}})},d=function(v,s){var u=s.toString().match(/url\([" ]*(.+?)[" ]*\)/),t=b(u)?null:u[1],r=ctcAjax.theme_uri+"/"+("parent"==v?ctcAjax.parnt:ctcAjax.child)+"/",w;if(!t){return false}else{if(t.toString().match(/^(https?:|\/)/)){w=s}else{w="url("+r+t+")"}}return w},b=function(s){if("undefined"==typeof s||false===s||null===s||""===s){return true}if(true===s||"string"===typeof s||"number"===typeof s){return false}if("object"===typeof s){for(var r in s){if(s.hasOwnProperty(r)){return false}}return true}return false},j=function(){var r=[];if(1===loading.sel_ndx){return r}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return r}if(false===b(ctcAjax.sel_ndx)){g.each(ctcAjax.sel_ndx,function(s,t){var u={label:s,value:s};r.push(u)})}return r},f=function(s){var r=[];if(1===loading.sel_ndx){return r}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",s,ctc_setup_selector_menu);return r}if(false===b(ctcAjax.sel_ndx[s])){g.each(ctcAjax.sel_ndx[s],function(t,u){var v={label:t,value:u};r.push(v)})}return r},n=function(){var r=[];if(1===loading.rule){return r}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return r}if(false===b(ctcAjax.rule)){g.each(ctcAjax.rule,function(s,t){var u={label:t.replace(/\d+/g,l),value:s};r.push(u)})}return r.sort(function(t,s){if(t.label>s.label){return 1}if(t.label<s.label){return -1}return 0})},h=function(v,x,A){var t="",y=(b(ctcAjax.sel_val[v])||b(ctcAjax.sel_val[v].value)||b(ctcAjax.sel_val[v].value[x])?"":ctcAjax.sel_val[v].value[x]),s=ctc_decode_value(x,("undefined"==typeof y?"":y.parnt)),w=(false===b(y.i_parnt)&&y.i_parnt)?ctcAjax.important_label:"",u=ctc_decode_value(x,("undefined"==typeof y?"":y.child)),r=(false===b(y.i_child)&&y.i_child)?1:0,z="ctc_"+A+"_child_"+x+"_i_"+v;if(false===b(ctcAjax.sel_val[v])){t+='<div class="ctc-'+("ovrd"==A?"input":"selector")+'-row clearfix">'+p;t+='<div class="ctc-input-cell">'+("ovrd"==A?x.replace(/\d+/g,l):ctcAjax.sel_val[v].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+v+'" >'+ctcAjax.edit_txt+"</a> "+(b(s.orig)?ctcAjax.child_only_txt:""))+"</div>"+p;if("ovrd"==A){t+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+A+"_parent_"+x+"_"+v+'">'+(b(s.orig)?"[no value]":s.orig+w)+"</div>"+p}t+='<div class="ctc-input-cell">'+p;if(false===b(s.names)){g.each(s.names,function(B,C){C=(b(C)?"":C);t+='<div class="ctc-child-input-cell">'+p;var E="ctc_"+A+"_child_"+x+"_"+v+C,D;if(false===(D=u.values.shift())){D=""}t+=(b(C)?"":ctcAjax.field_labels[C]+":<br/>")+'<input type="text" id="'+E+'" name="'+E+'" class="ctc-child-value'+((C+x).toString().match(/color/)?" color-picker":"")+((C).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+D+'" />'+p;t+="</div>"+p});t+='<label for="'+z+'"><input type="checkbox" id="'+z+'" name="'+z+'" value="1" '+(1===r?"checked":"")+" />"+ctcAjax.important_label+"</label>"+p}t+="</div>"+p;t+=("ovrd"==A?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+x+"_"+v+'_swatch">'+ctcAjax.swatch_txt+"</div>"+p+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+x+"_"+v+'_cell">'+p+'<input type="button" class="button ctc-save-input" id="ctc_save_'+x+"_"+v+'" name="ctc_save_'+x+"_"+v+'" value="Save" /></div>'+p);t+="</div><!-- end input row -->"+p}return t},e=function(r){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",r,e);return false}var u,s,t;if(b(ctcAjax.sel_val[r])){g("#ctc_sel_ovrd_rule_inputs").html("")}else{if(b(ctcAjax.sel_val[r].seq)){g("#ctc_child_load_order_container").html("")}else{u="ctc_ovrd_child_seq_"+r;t=parseInt(ctcAjax.sel_val[r].seq);s='<input type="text" id="'+u+'" name="'+u+'" class="ctc-child-value" value="'+t+'" />';g("#ctc_child_load_order_container").html(s)}if(b(ctcAjax.sel_val[r].value)){g("#ctc_sel_ovrd_rule_inputs").html("")}else{s="";g.each(ctcAjax.sel_val[r].value,function(w,v){s+=h(r,w,"ovrd")});g("#ctc_sel_ovrd_rule_inputs").html(s).find(".color-picker").each(function(){q(this)});k("#ctc_child_all_0_swatch")}}};ctc_render_rule_value_inputs=function(s){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",s,ctc_render_rule_value_inputs);return false}var t=ctcAjax.rule[s],r='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+t+'">'+p;if(false===b(ctcAjax.rule_val[s])){g.each(ctcAjax.rule_val[s],function(v,w){var u=ctc_decode_value(t,w);r+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+t+"_"+v+'">'+p;r+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+v+"_parent_"+t+"_"+v+'">'+u.orig+"</div>"+p;r+='<div class="ctc-input-cell">'+p;r+='<div class="ctc-swatch ctc-specific" id="ctc_'+v+"_parent_"+t+"_"+v+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+p;r+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+t+"_"+v+'">'+ctcAjax.selector_txt+"</a></div>"+p;r+='<div id="ctc_selector_'+t+"_"+v+'_container" class="ctc-selector-container clearfix">'+p;r+='<a href="#" id="ctc_selector_'+t+"_"+v+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+v+'"></div>'+p;r+='<div id="ctc_selector_'+t+"_"+v+'_rows"></div>'+p;r+="</div></div>"+p});r+="</div>"+p}g("#ctc_rule_value_inputs").html(r).find(".ctc-swatch").each(function(){k(this)})},ctc_render_selector_value_inputs=function(u){if(1==loading.val_qry){return false}var w,s,v=g("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,i),r,t="";if(0===loading.val_qry){loading.val_qry=1;w={rule:v};ctc_query_css("val_qry",u,ctc_render_selector_value_inputs,w);return false}if(false===b(ctcAjax.val_qry[u])){g.each(ctcAjax.val_qry[u],function(y,x){page_rule=y;g.each(x,function(A,z){t+='<h4 class="ctc-query-heading">'+A+"</h4>"+p;if(false===b(z)){g.each(z,function(B,C){ctcAjax.sel_val[B]=C;t+=h(B,y,u)})}})})}r="#ctc_selector_"+v+"_"+u+"_rows";g(r).html(t).find(".color-picker").each(function(){q(this)});g(r).find(".ctc-swatch").each(function(){k(this)})},ctc_query_css=function(t,s,w,u){var r={ctc_query_obj:t,ctc_query_key:s},v="#ctc_status_"+t+("val_qry"==t?"_"+s:"");if("object"===typeof u){g.each(u,function(x,y){r["ctc_query_"+x]=y})}g(".ctc-status-icon").remove();g(v).append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();r.action="ctc_query";r._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,r,function(x){loading[t]=2;g(".ctc-status-icon").removeClass("spinner");if(b(x)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");c(x);if("function"===typeof w){w(s)}return false}},"json").fail(function(){loading[t]=0;g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(v){var u={},w,t,r,s,x=g(v).attr("id");if(b(o[x])){o[x]=0}o[x]++;g(v).prop("disabled",true);g(".ctc-status-icon").remove();g(v).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();if((w=g("#ctc_new_selectors"))&&"ctc_save_new_selectors"==g(v).attr("id")){u.ctc_new_selectors=w.val();if(t=g("#ctc_sel_ovrd_query_selected")){u.ctc_sel_ovrd_query=t.text()}}else{if((r=g("#ctc_child_imports"))&&"ctc_save_imports"==g(v).attr("id")){u.ctc_child_imports=r.val()}else{u=k(v)}}u.action="ctc_update";u._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,u,function(y){g(v).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");if(b(y)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");g("#ctc_new_selectors").val("");c(y);ctc_setup_menus()}return false},"json").fail(function(){g(v).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(t,r){r=("undefined"==typeof r?"":r);var s={orig:r};if(t.toString().match(/^border(\-(top|right|bottom|left))?$/)){var u=r.toString().split(/ +/);s.names=["_border_width","_border_style","_border_color"];s.values=[("undefined"==typeof u[0]?"":u[0]),("undefined"==typeof u[1]?"":u[1]),("undefined"==typeof u[2]?"":u[2])]}else{if(t.toString().match(/^background\-image/)){s.names=["_background_url","_background_origin","_background_color1","_background_color2"];s.values=["","","",""];if(false===(b(r))&&!(r.toString().match(/url/))){var u=r.toString().split(/:/);s.values[1]=("undefined"==typeof u[0]?"":u[0]);s.values[2]=("undefined"==typeof u[1]?"":u[1]);s.values[3]=("undefined"==typeof u[3]?"":u[3]);s.orig=[s.values[1],s.values[2],s.values[3]].join(" ")}else{s.values[0]=r}}else{s.names=[""];s.values=[r]}}return s},ctc_set_query=function(r){m=r;g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(r);g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").html(" ");g("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(r);k("#ctc_child_all_0_swatch");g("#ctc_new_selector_row").show()},ctc_set_selector=function(s,r){g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").text(r);g("#ctc_sel_ovrd_qsid").val(s);a=s;if(1!=loading.sel_val){loading.sel_val=0}e(s);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(s,r){g("#ctc_rule_menu").val("");g("#ctc_rule_menu_selected").text(r);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(s);g("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=j();g("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(s,r){ctc_set_query(r.item.value);return false},focus:function(r){r.preventDefault()}})},ctc_setup_selector_menu=function(r){ctc_selectors=f(r);g("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(t,s){ctc_set_selector(s.item.value,s.item.label);return false},focus:function(s){s.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=n();g("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(s,r){ctc_set_rule(r.item.value,r.item.label);return false},focus:function(r){r.preventDefault()}})},ctc_filtered_rules=function(u,s){var r=[],t=(b(ctcAjax.sel_val[a]))||(b(ctcAjax.sel_val[a].value));if(b(ctc_rules)){ctc_rules=n()}g.each(ctc_rules,function(v,y){var w=false,x=new RegExp(g.ui.autocomplete.escapeRegex(u.term),"i");if(x.test(y.label)){if(false===t){g.each(ctcAjax.sel_val[a].value,function(A,z){if(y.label==A.replace(/\d+/g,l)){w=true;return false}});if(w){return}}r.push(y)}});s(r)},ctc_setup_new_rule_menu=function(){g("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(s,r){s.preventDefault();var t=g(h(a,r.item.label,"ovrd"));g("#ctc_sel_ovrd_rule_inputs").append(t);g("#ctc_new_rule_menu").val("");if(b(ctcAjax.sel_val[a].value)){ctcAjax.sel_val[a]["value"]={}}ctcAjax.sel_val[a].value[r.item.label]={child:""};t.find('input[type="text"]').each(function(u,v){if(g(v).hasClass("color-picker")){q(v)}g(v).focus()});return false},focus:function(r){r.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(m);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(r,s){var t=false;g.each(ctcAjax.themes,function(u,v){g.each(v,function(w,x){if(w==r&&("parnt"==u||"new"==s)){t=true;return false}});if(t){return false}});return t},ctc_set_notice=function(r){var s="";if(false===b(r)){g.each(r,function(t,u){s+='<div class="'+t+'"><ul>'+p;g(u).each(function(v,w){s+="<li>"+w.toString()+"</li>"+p});s+="</ul></div>"})}g("#ctc_error_notice").html(s)},ctc_validate=function(){var u=/[^\w\-]/,s=g("#ctc_child_template").val().toString().replace(u).toLowerCase(),r=g("#ctc_theme_child").val().toString().replace(u).toLowerCase(),t=g("input[name=ctc_child_type]:checked").val(),v=[];if("new"==t){r=s}if(ctc_theme_exists(r,t)){v.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,r))}if(""===r){v.push(ctcAjax.inval_theme_txt)}if(""===g("#ctc_child_name").val()){v.push(ctcAjax.inval_name_txt)}if(v.length){ctc_set_notice({error:v});return false}return true},ctc_set_theme_menu=function(s){var r=g("#ctc_theme_child").val();if(false===b(ctcAjax.themes.child[r])){g("#ctc_child_name").val(ctcAjax.themes.child[r].Name);g("#ctc_child_author").val(ctcAjax.themes.child[r].Author);g("#ctc_child_version").val(ctcAjax.themes.child[r].Version)}},fade_update_notice=function(){g(".updated, .error").slideUp("slow",function(){g(".updated").remove()})},ctc_focus_panel=function(s){var r=s+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(s).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(r).addClass("ctc-option-panel-active")},ctc_selector_edit=function(v){var r=g(v).attr("id").match(/_(\d+)$/)[1],u=ctcAjax.sel_val[r].query,t=ctcAjax.sel_val[r].selector,w="#query_selector_options";ctc_set_query(u);ctc_set_selector(r,t);ctc_focus_panel(w)},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(){q(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, input[type=checkbox]",function(){k(this)});g(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(s){s.preventDefault();ctc_set_notice("");var t=g(this).attr("id").toString().replace("_close",""),r=t.toString().match(/_(\d+)$/)[1];if(g("#"+t+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(r)}g("#"+t+"_container").fadeToggle("fast");g(".ctc-selector-container").not("#"+t+"_container").fadeOut("fast")});g(".nav-tab").on("click",function(r){r.preventDefault();ctc_set_notice("");var s="#"+g(this).attr("id");ctc_focus_panel(s)});g("#view_child_options,#view_parnt_options").on("click",function(u){ctc_set_notice("");var r=new Date().getTime(),t=g(this).attr("id").toString().match(/(child|parnt)/)[1],s=ctcAjax.theme_uri+"/"+ctcAjax[t]+"/style.css?"+r;g.get(s,function(v){g("#view_"+t+"_options_panel").text(v)}).fail(function(){g("#view_"+t+"_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(r){ctc_save(this)});g(document).on("click",".ctc-selector-edit",function(r){ctc_selector_edit(this)});ctc_setup_menus();ctc_set_query(m);g("input[type=submit],input[type=button]").prop("disabled",false);setTimeout(fade_update_notice,6000)});
|
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.2.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -43,7 +43,7 @@ class Child_Theme_Configurator_CSS {
|
|
43 |
|
44 |
function __construct() {
|
45 |
// scalars
|
46 |
-
$this->version = '1.2.
|
47 |
$this->querykey = 0;
|
48 |
$this->selkey = 0;
|
49 |
$this->qskey = 0;
|
@@ -409,6 +409,7 @@ class Child_Theme_Configurator_CSS {
|
|
409 |
if (false === strpos($ruleval, ':')) continue;
|
410 |
list($rule, $value) = explode(':', $ruleval, 2);
|
411 |
$rule = trim($rule);
|
|
|
412 |
$value = stripslashes(trim($value));
|
413 |
|
414 |
$rules = $values = array();
|
@@ -448,7 +449,12 @@ class Child_Theme_Configurator_CSS {
|
|
448 |
endforeach;
|
449 |
endforeach;
|
450 |
}
|
451 |
-
|
|
|
|
|
|
|
|
|
|
|
452 |
/*
|
453 |
* write_css
|
454 |
* converts normalized CSS object data into stylesheet.
|
@@ -589,6 +595,7 @@ class Child_Theme_Configurator_CSS {
|
|
589 |
$rules .= ' ' . $rule . ': ' . $value . $importantstr . ';' . LF;
|
590 |
endif;
|
591 |
else:
|
|
|
592 |
$rules .= ' ' . $rule . ': ' . $value . $importantstr . ';' . LF;
|
593 |
endif;
|
594 |
return $rules;
|
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.2.1
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
43 |
|
44 |
function __construct() {
|
45 |
// scalars
|
46 |
+
$this->version = '1.2.1';
|
47 |
$this->querykey = 0;
|
48 |
$this->selkey = 0;
|
49 |
$this->qskey = 0;
|
409 |
if (false === strpos($ruleval, ':')) continue;
|
410 |
list($rule, $value) = explode(':', $ruleval, 2);
|
411 |
$rule = trim($rule);
|
412 |
+
$rule = preg_replace_callback("/[^\w\-]/", array($this, 'to_ascii'), $rule);
|
413 |
$value = stripslashes(trim($value));
|
414 |
|
415 |
$rules = $values = array();
|
449 |
endforeach;
|
450 |
endforeach;
|
451 |
}
|
452 |
+
function to_ascii($matches) {
|
453 |
+
return ord($matches[0]);
|
454 |
+
}
|
455 |
+
function from_ascii($matches) {
|
456 |
+
return chr($matches[0]);
|
457 |
+
}
|
458 |
/*
|
459 |
* write_css
|
460 |
* converts normalized CSS object data into stylesheet.
|
595 |
$rules .= ' ' . $rule . ': ' . $value . $importantstr . ';' . LF;
|
596 |
endif;
|
597 |
else:
|
598 |
+
$rule = preg_replace_callback("/\d+/", array($this, 'from_ascii'), $rule);
|
599 |
$rules .= ' ' . $rule . ': ' . $value . $importantstr . ';' . LF;
|
600 |
endif;
|
601 |
return $rules;
|
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.2.
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
@@ -223,7 +223,7 @@ class Child_Theme_Configurator_UI {
|
|
223 |
<div id="ctc_status_sel_val"></div>
|
224 |
<div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
|
225 |
<input type="button" class="button button-primary ctc-save-input" id="ctc_save_query_selector"
|
226 |
-
name="ctc_save_query_selector" value="Save"
|
227 |
<input type="hidden" id="ctc_sel_ovrd_qsid"
|
228 |
name="ctc_sel_ovrd_qsid" value="" />
|
229 |
</div>
|
5 |
Class: Child_Theme_Configurator_UI
|
6 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
7 |
Description: Handles the plugin User Interface
|
8 |
+
Version: 1.2.1
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
223 |
<div id="ctc_status_sel_val"></div>
|
224 |
<div class="ctc-input-cell ctc-button-cell" id="ctc_save_query_selector_cell">
|
225 |
<input type="button" class="button button-primary ctc-save-input" id="ctc_save_query_selector"
|
226 |
+
name="ctc_save_query_selector" value="Save" disabled />
|
227 |
<input type="hidden" id="ctc_sel_ovrd_qsid"
|
228 |
name="ctc_sel_ovrd_qsid" value="" />
|
229 |
</div>
|
includes/class-ctc.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined('ABSPATH')) exit;
|
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
-
Version: 1.2.
|
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.2.
|
22 |
var $css;
|
23 |
var $optionsName;
|
24 |
var $menuName;
|
6 |
Class: Child_Theme_Configurator
|
7 |
Plugin URI: http://www.lilaeamedia.com/plugins/child-theme-configurator/
|
8 |
Description: Main Controller Class
|
9 |
+
Version: 1.2.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.2.1';
|
22 |
var $css;
|
23 |
var $optionsName;
|
24 |
var $menuName;
|
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.2.
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
@@ -22,9 +22,17 @@ jQuery(document).ready(function($){
|
|
22 |
}
|
23 |
});
|
24 |
},
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
ctc_coalesce_inputs = function(obj) {
|
27 |
-
var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([
|
28 |
$container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
|
29 |
$swatch = $container.find('.ctc-swatch').first(),
|
30 |
cssrules = { 'parent': {}, 'child': {} },
|
@@ -58,10 +66,10 @@ jQuery(document).ready(function($){
|
|
58 |
postdata[inputid] = value;
|
59 |
postdata[important] = ($('#' + important).is(':checked')) ? 1 : 0;
|
60 |
}
|
61 |
-
if ('' === value) {
|
62 |
$('#'+important).prop('checked', false);
|
63 |
return;
|
64 |
-
}
|
65 |
// handle specific inputs
|
66 |
if (false === ctc_is_empty(rulepart)) {
|
67 |
switch(rulepart) {
|
@@ -263,7 +271,7 @@ jQuery(document).ready(function($){
|
|
263 |
}
|
264 |
if (false === ctc_is_empty(ctcAjax.rule)) {
|
265 |
$.each(ctcAjax.rule, function(key, value) {
|
266 |
-
var obj = { label: value, value: key };
|
267 |
arr.push(obj);
|
268 |
});
|
269 |
}
|
@@ -289,7 +297,7 @@ jQuery(document).ready(function($){
|
|
289 |
impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid;
|
290 |
if (false === ctc_is_empty(ctcAjax.sel_val[qsid])) {
|
291 |
html += '<div class="ctc-' + ('ovrd' == seq ? 'input' : 'selector' ) + '-row clearfix">' + lf;
|
292 |
-
html += '<div class="ctc-input-cell">' + ('ovrd' == seq ? rule : ctcAjax.sel_val[qsid].selector
|
293 |
+ '<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_' + qsid + '" >' + ctcAjax.edit_txt + '</a> '
|
294 |
+ (ctc_is_empty(oldRuleObj.orig) ? ctcAjax.child_only_txt : ''))
|
295 |
+ '</div>' + lf;
|
@@ -403,7 +411,7 @@ jQuery(document).ready(function($){
|
|
403 |
if (1 == loading.val_qry) return false;
|
404 |
var params,
|
405 |
page_ruleid,
|
406 |
-
rule = $('#ctc_rule_menu_selected').text(),
|
407 |
selector,
|
408 |
html = '';
|
409 |
if (0 === loading.val_qry) {
|
@@ -728,7 +736,7 @@ jQuery(document).ready(function($){
|
|
728 |
if (false === noval) {
|
729 |
// skip rule if in current selector array
|
730 |
$.each(ctcAjax.sel_val[currentSel].value, function(rule, value) {
|
731 |
-
if (val.label == rule) {
|
732 |
skip = true;
|
733 |
return false;
|
734 |
}
|
@@ -889,7 +897,7 @@ jQuery(document).ready(function($){
|
|
889 |
e.preventDefault();
|
890 |
ctc_set_notice('')
|
891 |
var id = $(this).attr('id').toString().replace('_close', ''),
|
892 |
-
valid = id.toString().
|
893 |
if ($('#' + id + '_container').is(':hidden')) {
|
894 |
if (1 != loading.val_qry) loading.val_qry = 0;
|
895 |
ctc_render_selector_value_inputs(valid);
|
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.2.1
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
22 |
}
|
23 |
});
|
24 |
},
|
25 |
+
from_ascii = function(str) {
|
26 |
+
var ascii = parseInt(str),
|
27 |
+
chr = String.fromCharCode(ascii)
|
28 |
+
return chr;
|
29 |
+
},
|
30 |
+
to_ascii = function(str) {
|
31 |
+
var ascii = str.charCodeAt(0);
|
32 |
+
return ascii;
|
33 |
+
},
|
34 |
ctc_coalesce_inputs = function(obj) {
|
35 |
+
var regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,
|
36 |
$container = $(obj).parents('.ctc-selector-row, .ctc-parent-row').first(),
|
37 |
$swatch = $container.find('.ctc-swatch').first(),
|
38 |
cssrules = { 'parent': {}, 'child': {} },
|
66 |
postdata[inputid] = value;
|
67 |
postdata[important] = ($('#' + important).is(':checked')) ? 1 : 0;
|
68 |
}
|
69 |
+
/*if ('' === value) {
|
70 |
$('#'+important).prop('checked', false);
|
71 |
return;
|
72 |
+
}*/
|
73 |
// handle specific inputs
|
74 |
if (false === ctc_is_empty(rulepart)) {
|
75 |
switch(rulepart) {
|
271 |
}
|
272 |
if (false === ctc_is_empty(ctcAjax.rule)) {
|
273 |
$.each(ctcAjax.rule, function(key, value) {
|
274 |
+
var obj = { label: value.replace(/\d+/g, from_ascii), value: key };
|
275 |
arr.push(obj);
|
276 |
});
|
277 |
}
|
297 |
impid = 'ctc_' + seq + '_child_' + rule + '_i_' + qsid;
|
298 |
if (false === ctc_is_empty(ctcAjax.sel_val[qsid])) {
|
299 |
html += '<div class="ctc-' + ('ovrd' == seq ? 'input' : 'selector' ) + '-row clearfix">' + lf;
|
300 |
+
html += '<div class="ctc-input-cell">' + ('ovrd' == seq ? rule.replace(/\d+/g, from_ascii) : ctcAjax.sel_val[qsid].selector
|
301 |
+ '<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_' + qsid + '" >' + ctcAjax.edit_txt + '</a> '
|
302 |
+ (ctc_is_empty(oldRuleObj.orig) ? ctcAjax.child_only_txt : ''))
|
303 |
+ '</div>' + lf;
|
411 |
if (1 == loading.val_qry) return false;
|
412 |
var params,
|
413 |
page_ruleid,
|
414 |
+
rule = $('#ctc_rule_menu_selected').text().replace(/[^\w\-]/g, to_ascii),
|
415 |
selector,
|
416 |
html = '';
|
417 |
if (0 === loading.val_qry) {
|
736 |
if (false === noval) {
|
737 |
// skip rule if in current selector array
|
738 |
$.each(ctcAjax.sel_val[currentSel].value, function(rule, value) {
|
739 |
+
if (val.label == rule.replace(/\d+/g, from_ascii)) {
|
740 |
skip = true;
|
741 |
return false;
|
742 |
}
|
897 |
e.preventDefault();
|
898 |
ctc_set_notice('')
|
899 |
var id = $(this).attr('id').toString().replace('_close', ''),
|
900 |
+
valid = id.toString().match(/_(\d+)$/)[1];
|
901 |
if ($('#' + id + '_container').is(':hidden')) {
|
902 |
if (1 != loading.val_qry) loading.val_qry = 0;
|
903 |
ctc_render_selector_value_inputs(valid);
|
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.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="base",a,m={},o=function(p){g(p).iris({change:function(){j(p)}})},j=function(v){var r=/^(ctc_(ovrd|\d+)_(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 E=g(this).attr("id"),x=E.toString().match(r),F=x[2],y=x[3],H=("undefined"==typeof x[4]?"":x[4]),D=x[5],C=("undefined"==typeof x[6]?"":x[6]),G=("parent"==y?g(this).text():g(this).val()),z="ctc_"+F+"_child_"+H+"_i_"+D,B,A;if("child"==y){p[E]=G;p[z]=(g("#"+z).is(":checked"))?1:0}if(""===G){g("#"+z).prop("checked",false);return}if(false===b(C)){switch(C){case"_border_width":t[y][H+"-width"]=G;break;case"_border_style":t[y][H+"-style"]=G;break;case"_border_color":t[y][H+"-color"]=G;break;case"_background_url":t[y]["background-image"]=d(y,G);break;case"_background_color":t[y]["background-color"]=v.value;break;case"_background_color1":s[y].start=G;q[y]=true;break;case"_background_color2":s[y].end=G;q[y]=true;break;case"_background_origin":s[y].origin=G;q[y]=true;break}}else{if(B=H.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!G.match(/none/)){A=G.toString().split(/ +/);t[y][H+"-width"]="undefined"==typeof A[0]?"":A[0];t[y][H+"-style"]="undefined"==typeof A[1]?"":A[1];t[y][H+"-color"]="undefined"==typeof A[2]?"":A[2]}else{if("background-image"==H){if(G.toString().match(/url\(/)){t[y]["background-image"]=d(y,G)}else{A=G.toString().split(/ +/);if(A.length>2){s[y].origin="undefined"==typeof A[0]?"top":A[0];s[y].start="undefined"==typeof A[1]?"transparent":A[1];s[y].end="undefined"==typeof A[2]?"transparent":A[2];q[y]=true}else{t[y]["background-image"]=G}}}else{t[y][H]=G}}}});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){if(b(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;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(/^(https?:|\/)/)){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(t,v,y){var r="",w=(b(ctcAjax.sel_val[t])||b(ctcAjax.sel_val[t].value)||b(ctcAjax.sel_val[t].value[v])?"":ctcAjax.sel_val[t].value[v]),q=ctc_decode_value(v,("undefined"==typeof w?"":w.parnt)),u=(false===b(w.i_parnt)&&w.i_parnt)?ctcAjax.important_label:"",s=ctc_decode_value(v,("undefined"==typeof w?"":w.child)),p=(false===b(w.i_child)&&w.i_child)?1:0,x="ctc_"+y+"_child_"+v+"_i_"+t;if(false===b(ctcAjax.sel_val[t])){r+='<div class="ctc-'+("ovrd"==y?"input":"selector")+'-row clearfix">'+n;r+='<div class="ctc-input-cell">'+("ovrd"==y?v:ctcAjax.sel_val[t].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+ctcAjax.edit_txt+"</a> "+(b(q.orig)?ctcAjax.child_only_txt:""))+"</div>"+n;if("ovrd"==y){r+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+y+"_parent_"+v+"_"+t+'">'+(b(q.orig)?"[no value]":q.orig+u)+"</div>"+n}r+='<div class="ctc-input-cell">'+n;if(false===b(q.names)){g.each(q.names,function(z,A){A=(b(A)?"":A);r+='<div class="ctc-child-input-cell">'+n;var C="ctc_"+y+"_child_"+v+"_"+t+A,B;if(false===(B=s.values.shift())){B=""}r+=(b(A)?"":ctcAjax.field_labels[A]+":<br/>")+'<input type="text" id="'+C+'" name="'+C+'" class="ctc-child-value'+((A+v).toString().match(/color/)?" color-picker":"")+((A).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+B+'" />'+n;r+="</div>"+n});r+='<label for="'+x+'"><input type="checkbox" id="'+x+'" name="'+x+'" value="1" '+(1===p?"checked":"")+" />"+ctcAjax.important_label+"</label>"+n}r+="</div>"+n;r+=("ovrd"==y?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+v+"_"+t+'_swatch">'+ctcAjax.swatch_txt+"</div>"+n+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+v+"_"+t+'_cell">'+n+'<input type="button" class="button ctc-save-input" id="ctc_save_'+v+"_"+t+'" name="ctc_save_'+v+"_"+t+'" value="Save" /></div>'+n);r+="</div><!-- end input row -->"+n}return r},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 s,q,r;if(b(ctcAjax.sel_val[p])){g("#ctc_sel_ovrd_rule_inputs").html("")}else{if(b(ctcAjax.sel_val[p].seq)){g("#ctc_child_load_order_container").html("")}else{s="ctc_ovrd_child_seq_"+p;r=parseInt(ctcAjax.sel_val[p].seq);q='<input type="text" id="'+s+'" name="'+s+'" class="ctc-child-value" value="'+r+'" />';g("#ctc_child_load_order_container").html(q)}if(b(ctcAjax.sel_val[p].value)){g("#ctc_sel_ovrd_rule_inputs").html("")}else{q="";g.each(ctcAjax.sel_val[p].value,function(u,t){q+=h(p,u,"ovrd")});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_'+t+"_parent_"+r+"_"+t+'">'+s.orig+"</div>"+n;p+='<div class="ctc-input-cell">'+n;p+='<div class="ctc-swatch ctc-specific" id="ctc_'+t+"_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,s)})}})})}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("");c(w);ctc_setup_menus()}return false},"json").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(false===(b(p))&&!(p.toString().match(/url/))){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){k=p;g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(p);g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").html(" ");g("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(p);j("#ctc_child_all_0_swatch");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(s,q){var p=[],r=(b(ctcAjax.sel_val[a]))||(b(ctcAjax.sel_val[a].value));if(b(ctc_rules)){ctc_rules=l()}g.each(ctc_rules,function(t,w){var u=false,v=new RegExp(g.ui.autocomplete.escapeRegex(s.term),"i");if(v.test(w.label)){if(false===r){g.each(ctcAjax.sel_val[a].value,function(y,x){if(w.label==y){u=true;return false}});if(u){return}}p.push(w)}});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){q.preventDefault();var r=g(h(a,p.item.label,"ovrd"));g("#ctc_sel_ovrd_rule_inputs").append(r);g("#ctc_new_rule_menu").val("");if(b(ctcAjax.sel_val[a].value)){ctcAjax.sel_val[a]["value"]={}}ctcAjax.sel_val[a].value[p.item.label]={child:""};r.find('input[type="text"]').each(function(s,t){if(g(t).hasClass("color-picker")){o(t)}g(t).focus()});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, .error").slideUp("slow",function(){g(".updated").remove()})},ctc_focus_panel=function(q){var p=q+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(q).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(p).addClass("ctc-option-panel-active")},ctc_selector_edit=function(u){var p=g(u).attr("id").match(/_(\d+)$/)[1],t=ctcAjax.sel_val[p].query,r=ctcAjax.sel_val[p].selector,v="#query_selector_options";ctc_set_query(t);ctc_set_selector(p,r);ctc_focus_panel(v)},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, input[type=checkbox]",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(p){p.preventDefault();ctc_set_notice("");var q="#"+g(this).attr("id");ctc_focus_panel(q)});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)});g(document).on("click",".ctc-selector-edit",function(p){ctc_selector_edit(this)});ctc_setup_menus();ctc_set_query(k);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.2.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 p="\n",m="base",a,o={},q=function(r){g(r).iris({change:function(){k(r)}})},l=function(t){var r=parseInt(t),s=String.fromCharCode(r);return s},i=function(s){var r=s.charCodeAt(0);return r},k=function(x){var t=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+))(_\w+)?$/,y=g(x).parents(".ctc-selector-row, .ctc-parent-row").first(),w=y.find(".ctc-swatch").first(),v={parent:{},child:{}},u={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},s={child:false,parent:false},r={};y.find(".ctc-parent-value, .ctc-child-value").each(function(){var G=g(this).attr("id"),z=G.toString().match(t),H=z[2],A=z[3],J=("undefined"==typeof z[4]?"":z[4]),F=z[5],E=("undefined"==typeof z[6]?"":z[6]),I=("parent"==A?g(this).text():g(this).val()),B="ctc_"+H+"_child_"+J+"_i_"+F,D,C;if("child"==A){r[G]=I;r[B]=(g("#"+B).is(":checked"))?1:0}if(false===b(E)){switch(E){case"_border_width":v[A][J+"-width"]=I;break;case"_border_style":v[A][J+"-style"]=I;break;case"_border_color":v[A][J+"-color"]=I;break;case"_background_url":v[A]["background-image"]=d(A,I);break;case"_background_color":v[A]["background-color"]=x.value;break;case"_background_color1":u[A].start=I;s[A]=true;break;case"_background_color2":u[A].end=I;s[A]=true;break;case"_background_origin":u[A].origin=I;s[A]=true;break}}else{if(D=J.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!I.match(/none/)){C=I.toString().split(/ +/);v[A][J+"-width"]="undefined"==typeof C[0]?"":C[0];v[A][J+"-style"]="undefined"==typeof C[1]?"":C[1];v[A][J+"-color"]="undefined"==typeof C[2]?"":C[2]}else{if("background-image"==J){if(I.toString().match(/url\(/)){v[A]["background-image"]=d(A,I)}else{C=I.toString().split(/ +/);if(C.length>2){u[A].origin="undefined"==typeof C[0]?"top":C[0];u[A].start="undefined"==typeof C[1]?"transparent":C[1];u[A].end="undefined"==typeof C[2]?"transparent":C[2];s[A]=true}else{v[A]["background-image"]=I}}}else{v[A][J]=I}}}});if("undefined"!=typeof w){g(w).removeAttr("style");if(s.parent){g(w).ctcgrad(u.parent.origin,[u.parent.start,u.parent.end])}g(w).css(v.parent);if(!(w.attr("id").toString().match(/parent/))){if(s.child){g(w).ctcgrad(u.child.origin,[u.child.start,u.child.end])}g(w).css(v.child)}}return r},c=function(t){var s,u,r;g(t).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){if(b(ctcAjax.sel_ndx[this.data.query])){ctcAjax.sel_ndx[this.data.query]={}}ctcAjax.sel_ndx[this.data.query][this.data.selector]=this.data.qsid}else{ctcAjax.sel_ndx[this.key]=this.data;s=this.key}}break;case"sel_val":ctcAjax.sel_val[this.key]=this.data;u=this.key;break}})},d=function(v,s){var u=s.toString().match(/url\([" ]*(.+?)[" ]*\)/),t=("undefined"==typeof u?null:u[1]),r=ctcAjax.theme_uri+"/"+("parent"==v?ctcAjax.parnt:ctcAjax.child)+"/",w;if(!t){return false}else{if(t.toString().match(/^(https?:|\/)/)){w=s}else{w="url("+r+t+")"}}return w},b=function(s){if("undefined"==typeof s||false===s||null===s||""===s){return true}if(true===s||"string"===typeof s||"number"===typeof s){return false}if("object"===typeof s){for(var r in s){if(s.hasOwnProperty(r)){return false}}return true}return false},j=function(){var r=[];if(1===loading.sel_ndx){return r}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",null,ctc_setup_query_menu);return r}if(false===b(ctcAjax.sel_ndx)){g.each(ctcAjax.sel_ndx,function(s,t){var u={label:s,value:s};r.push(u)})}return r},f=function(s){var r=[];if(1===loading.sel_ndx){return r}if(0===loading.sel_ndx){loading.sel_ndx=1;ctc_query_css("sel_ndx",s,ctc_setup_selector_menu);return r}if(false===b(ctcAjax.sel_ndx[s])){g.each(ctcAjax.sel_ndx[s],function(t,u){var v={label:t,value:u};r.push(v)})}return r},n=function(){var r=[];if(1===loading.rule){return r}if(0===loading.rule){loading.rule=1;ctc_query_css("rule",null,ctc_setup_rule_menu);return r}if(false===b(ctcAjax.rule)){g.each(ctcAjax.rule,function(s,t){var u={label:t.replace(/\d+/g,l),value:s};r.push(u)})}return r.sort(function(t,s){if(t.label>s.label){return 1}if(t.label<s.label){return -1}return 0})},h=function(v,x,A){var t="",y=(b(ctcAjax.sel_val[v])||b(ctcAjax.sel_val[v].value)||b(ctcAjax.sel_val[v].value[x])?"":ctcAjax.sel_val[v].value[x]),s=ctc_decode_value(x,("undefined"==typeof y?"":y.parnt)),w=(false===b(y.i_parnt)&&y.i_parnt)?ctcAjax.important_label:"",u=ctc_decode_value(x,("undefined"==typeof y?"":y.child)),r=(false===b(y.i_child)&&y.i_child)?1:0,z="ctc_"+A+"_child_"+x+"_i_"+v;if(false===b(ctcAjax.sel_val[v])){t+='<div class="ctc-'+("ovrd"==A?"input":"selector")+'-row clearfix">'+p;t+='<div class="ctc-input-cell">'+("ovrd"==A?x.replace(/\d+/g,l):ctcAjax.sel_val[v].selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+v+'" >'+ctcAjax.edit_txt+"</a> "+(b(s.orig)?ctcAjax.child_only_txt:""))+"</div>"+p;if("ovrd"==A){t+='<div class="ctc-parent-value ctc-input-cell" id="ctc_'+A+"_parent_"+x+"_"+v+'">'+(b(s.orig)?"[no value]":s.orig+w)+"</div>"+p}t+='<div class="ctc-input-cell">'+p;if(false===b(s.names)){g.each(s.names,function(B,C){C=(b(C)?"":C);t+='<div class="ctc-child-input-cell">'+p;var E="ctc_"+A+"_child_"+x+"_"+v+C,D;if(false===(D=u.values.shift())){D=""}t+=(b(C)?"":ctcAjax.field_labels[C]+":<br/>")+'<input type="text" id="'+E+'" name="'+E+'" class="ctc-child-value'+((C+x).toString().match(/color/)?" color-picker":"")+((C).toString().match(/url/)?" ctc-input-wide":"")+'" value="'+D+'" />'+p;t+="</div>"+p});t+='<label for="'+z+'"><input type="checkbox" id="'+z+'" name="'+z+'" value="1" '+(1===r?"checked":"")+" />"+ctcAjax.important_label+"</label>"+p}t+="</div>"+p;t+=("ovrd"==A?"":'<div class="ctc-swatch ctc-specific" id="ctc_child_'+x+"_"+v+'_swatch">'+ctcAjax.swatch_txt+"</div>"+p+'<div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+x+"_"+v+'_cell">'+p+'<input type="button" class="button ctc-save-input" id="ctc_save_'+x+"_"+v+'" name="ctc_save_'+x+"_"+v+'" value="Save" /></div>'+p);t+="</div><!-- end input row -->"+p}return t},e=function(r){if(1===loading.sel_val){return false}if(0==loading.sel_val){loading.sel_val=1;ctc_query_css("sel_val",r,e);return false}var u,s,t;if(b(ctcAjax.sel_val[r])){g("#ctc_sel_ovrd_rule_inputs").html("")}else{if(b(ctcAjax.sel_val[r].seq)){g("#ctc_child_load_order_container").html("")}else{u="ctc_ovrd_child_seq_"+r;t=parseInt(ctcAjax.sel_val[r].seq);s='<input type="text" id="'+u+'" name="'+u+'" class="ctc-child-value" value="'+t+'" />';g("#ctc_child_load_order_container").html(s)}if(b(ctcAjax.sel_val[r].value)){g("#ctc_sel_ovrd_rule_inputs").html("")}else{s="";g.each(ctcAjax.sel_val[r].value,function(w,v){s+=h(r,w,"ovrd")});g("#ctc_sel_ovrd_rule_inputs").html(s).find(".color-picker").each(function(){q(this)});k("#ctc_child_all_0_swatch")}}};ctc_render_rule_value_inputs=function(s){if(1===loading.rule_val){return false}if(0==loading.rule_val){loading.rule_val=1;ctc_query_css("rule_val",s,ctc_render_rule_value_inputs);return false}var t=ctcAjax.rule[s],r='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+t+'">'+p;if(false===b(ctcAjax.rule_val[s])){g.each(ctcAjax.rule_val[s],function(v,w){var u=ctc_decode_value(t,w);r+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+t+"_"+v+'">'+p;r+='<div class="ctc-input-cell ctc-parent-value" id="ctc_'+v+"_parent_"+t+"_"+v+'">'+u.orig+"</div>"+p;r+='<div class="ctc-input-cell">'+p;r+='<div class="ctc-swatch ctc-specific" id="ctc_'+v+"_parent_"+t+"_"+v+'_swatch">'+ctcAjax.swatch_txt+"</div></div>"+p;r+='<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+t+"_"+v+'">'+ctcAjax.selector_txt+"</a></div>"+p;r+='<div id="ctc_selector_'+t+"_"+v+'_container" class="ctc-selector-container clearfix">'+p;r+='<a href="#" id="ctc_selector_'+t+"_"+v+'_close" class="ctc-selector-handle" style="float:right">'+ctcAjax.close_txt+'</a><div id="ctc_status_val_qry_'+v+'"></div>'+p;r+='<div id="ctc_selector_'+t+"_"+v+'_rows"></div>'+p;r+="</div></div>"+p});r+="</div>"+p}g("#ctc_rule_value_inputs").html(r).find(".ctc-swatch").each(function(){k(this)})},ctc_render_selector_value_inputs=function(u){if(1==loading.val_qry){return false}var w,s,v=g("#ctc_rule_menu_selected").text().replace(/[^\w\-]/g,i),r,t="";if(0===loading.val_qry){loading.val_qry=1;w={rule:v};ctc_query_css("val_qry",u,ctc_render_selector_value_inputs,w);return false}if(false===b(ctcAjax.val_qry[u])){g.each(ctcAjax.val_qry[u],function(y,x){page_rule=y;g.each(x,function(A,z){t+='<h4 class="ctc-query-heading">'+A+"</h4>"+p;if(false===b(z)){g.each(z,function(B,C){ctcAjax.sel_val[B]=C;t+=h(B,y,u)})}})})}r="#ctc_selector_"+v+"_"+u+"_rows";g(r).html(t).find(".color-picker").each(function(){q(this)});g(r).find(".ctc-swatch").each(function(){k(this)})},ctc_query_css=function(t,s,w,u){var r={ctc_query_obj:t,ctc_query_key:s},v="#ctc_status_"+t+("val_qry"==t?"_"+s:"");if("object"===typeof u){g.each(u,function(x,y){r["ctc_query_"+x]=y})}g(".ctc-status-icon").remove();g(v).append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();r.action="ctc_query";r._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,r,function(x){loading[t]=2;g(".ctc-status-icon").removeClass("spinner");if(b(x)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");c(x);if("function"===typeof w){w(s)}return false}},"json").fail(function(){loading[t]=0;g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_save=function(v){var u={},w,t,r,s,x=g(v).attr("id");if(b(o[x])){o[x]=0}o[x]++;g(v).prop("disabled",true);g(".ctc-status-icon").remove();g(v).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner"></span>');g(".spinner").show();if((w=g("#ctc_new_selectors"))&&"ctc_save_new_selectors"==g(v).attr("id")){u.ctc_new_selectors=w.val();if(t=g("#ctc_sel_ovrd_query_selected")){u.ctc_sel_ovrd_query=t.text()}}else{if((r=g("#ctc_child_imports"))&&"ctc_save_imports"==g(v).attr("id")){u.ctc_child_imports=r.val()}else{u=k(v)}}u.action="ctc_update";u._wpnonce=g("#_wpnonce").val();g.post(ctcAjax.ajaxurl,u,function(y){g(v).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");if(b(y)){g(".ctc-status-icon").addClass("failure")}else{g(".ctc-status-icon").addClass("success");g("#ctc_new_selectors").val("");c(y);ctc_setup_menus()}return false},"json").fail(function(){g(v).prop("disabled",false);g(".ctc-status-icon").removeClass("spinner");g(".ctc-status-icon").addClass("failure")});return false},ctc_decode_value=function(t,r){r=("undefined"==typeof r?"":r);var s={orig:r};if(t.toString().match(/^border(\-(top|right|bottom|left))?$/)){var u=r.toString().split(/ +/);s.names=["_border_width","_border_style","_border_color"];s.values=[("undefined"==typeof u[0]?"":u[0]),("undefined"==typeof u[1]?"":u[1]),("undefined"==typeof u[2]?"":u[2])]}else{if(t.toString().match(/^background\-image/)){s.names=["_background_url","_background_origin","_background_color1","_background_color2"];s.values=["","","",""];if(false===(b(r))&&!(r.toString().match(/url/))){var u=r.toString().split(/:/);s.values[1]=("undefined"==typeof u[0]?"":u[0]);s.values[2]=("undefined"==typeof u[1]?"":u[1]);s.values[3]=("undefined"==typeof u[3]?"":u[3]);s.orig=[s.values[1],s.values[2],s.values[3]].join(" ")}else{s.values[0]=r}}else{s.names=[""];s.values=[r]}}return s},ctc_set_query=function(r){m=r;g("#ctc_sel_ovrd_query").val("");g("#ctc_sel_ovrd_query_selected").text(r);g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").html(" ");g("#ctc_sel_ovrd_rule_inputs").html("");ctc_setup_selector_menu(r);k("#ctc_child_all_0_swatch");g("#ctc_new_selector_row").show()},ctc_set_selector=function(s,r){g("#ctc_sel_ovrd_selector").val("");g("#ctc_sel_ovrd_selector_selected").text(r);g("#ctc_sel_ovrd_qsid").val(s);a=s;if(1!=loading.sel_val){loading.sel_val=0}e(s);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(s,r){g("#ctc_rule_menu").val("");g("#ctc_rule_menu_selected").text(r);if(1!=loading.rule_val){loading.rule_val=0}ctc_render_rule_value_inputs(s);g("#ctc_rule_value_inputs,#ctc_input_row_rule_header").show()},ctc_setup_query_menu=function(){ctc_queries=j();g("#ctc_sel_ovrd_query").autocomplete({source:ctc_queries,minLength:0,selectFirst:true,autoFocus:true,select:function(s,r){ctc_set_query(r.item.value);return false},focus:function(r){r.preventDefault()}})},ctc_setup_selector_menu=function(r){ctc_selectors=f(r);g("#ctc_sel_ovrd_selector").autocomplete({source:ctc_selectors,selectFirst:true,autoFocus:true,select:function(t,s){ctc_set_selector(s.item.value,s.item.label);return false},focus:function(s){s.preventDefault()}})},ctc_setup_rule_menu=function(){ctc_rules=n();g("#ctc_rule_menu").autocomplete({source:ctc_rules,selectFirst:true,autoFocus:true,select:function(s,r){ctc_set_rule(r.item.value,r.item.label);return false},focus:function(r){r.preventDefault()}})},ctc_filtered_rules=function(u,s){var r=[],t=(b(ctcAjax.sel_val[a]))||(b(ctcAjax.sel_val[a].value));if(b(ctc_rules)){ctc_rules=n()}g.each(ctc_rules,function(v,y){var w=false,x=new RegExp(g.ui.autocomplete.escapeRegex(u.term),"i");if(x.test(y.label)){if(false===t){g.each(ctcAjax.sel_val[a].value,function(A,z){if(y.label==A.replace(/\d+/g,l)){w=true;return false}});if(w){return}}r.push(y)}});s(r)},ctc_setup_new_rule_menu=function(){g("#ctc_new_rule_menu").autocomplete({source:ctc_filtered_rules,selectFirst:true,autoFocus:true,select:function(s,r){s.preventDefault();var t=g(h(a,r.item.label,"ovrd"));g("#ctc_sel_ovrd_rule_inputs").append(t);g("#ctc_new_rule_menu").val("");if(b(ctcAjax.sel_val[a].value)){ctcAjax.sel_val[a]["value"]={}}ctcAjax.sel_val[a].value[r.item.label]={child:""};t.find('input[type="text"]').each(function(u,v){if(g(v).hasClass("color-picker")){q(v)}g(v).focus()});return false},focus:function(r){r.preventDefault()}})},ctc_setup_menus=function(){ctc_setup_query_menu();ctc_setup_selector_menu(m);ctc_setup_rule_menu();ctc_setup_new_rule_menu()},ctc_theme_exists=function(r,s){var t=false;g.each(ctcAjax.themes,function(u,v){g.each(v,function(w,x){if(w==r&&("parnt"==u||"new"==s)){t=true;return false}});if(t){return false}});return t},ctc_set_notice=function(r){var s="";if(false===b(r)){g.each(r,function(t,u){s+='<div class="'+t+'"><ul>'+p;g(u).each(function(v,w){s+="<li>"+w.toString()+"</li>"+p});s+="</ul></div>"})}g("#ctc_error_notice").html(s)},ctc_validate=function(){var u=/[^\w\-]/,s=g("#ctc_child_template").val().toString().replace(u).toLowerCase(),r=g("#ctc_theme_child").val().toString().replace(u).toLowerCase(),t=g("input[name=ctc_child_type]:checked").val(),v=[];if("new"==t){r=s}if(ctc_theme_exists(r,t)){v.push(ctcAjax.theme_exists_txt.toString().replace(/%s/,r))}if(""===r){v.push(ctcAjax.inval_theme_txt)}if(""===g("#ctc_child_name").val()){v.push(ctcAjax.inval_name_txt)}if(v.length){ctc_set_notice({error:v});return false}return true},ctc_set_theme_menu=function(s){var r=g("#ctc_theme_child").val();if(false===b(ctcAjax.themes.child[r])){g("#ctc_child_name").val(ctcAjax.themes.child[r].Name);g("#ctc_child_author").val(ctcAjax.themes.child[r].Author);g("#ctc_child_version").val(ctcAjax.themes.child[r].Version)}},fade_update_notice=function(){g(".updated, .error").slideUp("slow",function(){g(".updated").remove()})},ctc_focus_panel=function(s){var r=s+"_panel";g(".nav-tab").removeClass("nav-tab-active");g(".ctc-option-panel").removeClass("ctc-option-panel-active");g(".ctc-selector-container").hide();g(s).addClass("nav-tab-active");g(".ctc-option-panel-container").scrollTop(0);g(r).addClass("ctc-option-panel-active")},ctc_selector_edit=function(v){var r=g(v).attr("id").match(/_(\d+)$/)[1],u=ctcAjax.sel_val[r].query,t=ctcAjax.sel_val[r].selector,w="#query_selector_options";ctc_set_query(u);ctc_set_selector(r,t);ctc_focus_panel(w)},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(){q(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, input[type=checkbox]",function(){k(this)});g(".ctc-option-panel-container").on("click",".ctc-selector-handle",function(s){s.preventDefault();ctc_set_notice("");var t=g(this).attr("id").toString().replace("_close",""),r=t.toString().match(/_(\d+)$/)[1];if(g("#"+t+"_container").is(":hidden")){if(1!=loading.val_qry){loading.val_qry=0}ctc_render_selector_value_inputs(r)}g("#"+t+"_container").fadeToggle("fast");g(".ctc-selector-container").not("#"+t+"_container").fadeOut("fast")});g(".nav-tab").on("click",function(r){r.preventDefault();ctc_set_notice("");var s="#"+g(this).attr("id");ctc_focus_panel(s)});g("#view_child_options,#view_parnt_options").on("click",function(u){ctc_set_notice("");var r=new Date().getTime(),t=g(this).attr("id").toString().match(/(child|parnt)/)[1],s=ctcAjax.theme_uri+"/"+ctcAjax[t]+"/style.css?"+r;g.get(s,function(v){g("#view_"+t+"_options_panel").text(v)}).fail(function(){g("#view_"+t+"_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(r){ctc_save(this)});g(document).on("click",".ctc-selector-edit",function(r){ctc_selector_edit(this)});ctc_setup_menus();ctc_set_query(m);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.7
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -121,6 +121,9 @@ You can also create a secondary stylesheet that contains @font-face rules and im
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
124 |
= 1.2.0 =
|
125 |
* New features: Link to Query/Selector tab from specific Rule/Value selector, new rule focus on adding new rule. Bugs fixed: clear Query/Selector inputs when loaded selector is empty, use latest min.js script.
|
126 |
|
4 |
Tags: child theme, custom theme, CSS, responsive design, CSS editor, theme generator
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 3.8
|
7 |
+
Stable tag: 1.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 1.2.1 =
|
125 |
+
* Bugs fixed: "star hack" rules no longer throwing js error. Important flag now works on borders and gradients.
|
126 |
+
|
127 |
= 1.2.0 =
|
128 |
* New features: Link to Query/Selector tab from specific Rule/Value selector, new rule focus on adding new rule. Bugs fixed: clear Query/Selector inputs when loaded selector is empty, use latest min.js script.
|
129 |
|