Version Description
- Automatically add action parent RTL stylesheet when child theme does not have one.
- Handle case where parent theme changes queue action incorrectly points to non-existent child theme stylesheet.
- Correctly copies customizer css to child theme.
Download this release
Release Info
Developer | lilaeamedia |
Plugin | Child Theme Configurator |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.0.4 to 2.4.0
- child-theme-configurator.php +1 -1
- css/chldthmcfg.css +1 -0
- css/ctc-support.jpg +0 -0
- css/hook-highlighter.jpg +0 -0
- includes/classes/Admin.php +81 -7
- includes/classes/CSS.php +11 -6
- includes/classes/Core.php +1 -1
- includes/classes/UI.php +2 -1
- includes/forms/addl_panels.php +6 -7
- includes/forms/parent-child.php +5 -4
- includes/forms/webfonts.php +3 -3
- includes/help/en_US.php +6 -3
- js/chldthmcfg.js +205 -170
- js/chldthmcfg.min.js +1 -1
- readme.txt +6 -2
child-theme-configurator.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
6 |
Plugin Name: Child Theme Configurator
|
7 |
Plugin URI: http://www.childthemeconfigurator.com
|
8 |
Description: When using the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
|
9 |
-
Version: 2.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com
|
12 |
Text Domain: child-theme-configurator
|
6 |
Plugin Name: Child Theme Configurator
|
7 |
Plugin URI: http://www.childthemeconfigurator.com
|
8 |
Description: When using the Customizer is not enough - Create child themes and customize styles, templates, functions and more.
|
9 |
+
Version: 2.4.0
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com
|
12 |
Text Domain: child-theme-configurator
|
css/chldthmcfg.css
CHANGED
@@ -228,6 +228,7 @@ a.ctc-recent-tab {
|
|
228 |
float: left;
|
229 |
width: 60%;
|
230 |
margin-right: 2%;
|
|
|
231 |
}
|
232 |
.ctc-input-cell-wide input[type="text"] {
|
233 |
width: 100%;
|
228 |
float: left;
|
229 |
width: 60%;
|
230 |
margin-right: 2%;
|
231 |
+
margin-bottom: 1em;
|
232 |
}
|
233 |
.ctc-input-cell-wide input[type="text"] {
|
234 |
width: 100%;
|
css/ctc-support.jpg
ADDED
Binary file
|
css/hook-highlighter.jpg
ADDED
Binary file
|
includes/classes/Admin.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
6 |
Class: ChildThemeConfiguratorAdmin
|
7 |
Plugin URI: http://www.childthemeconfigurator.com/
|
8 |
Description: Main Controller Class
|
9 |
-
Version: 2.3.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: child-theme-configurator
|
@@ -634,13 +634,15 @@ class ChildThemeConfiguratorAdmin {
|
|
634 |
$this->evaluate_signals();
|
635 |
endif;
|
636 |
|
637 |
-
// v2.1.3 -
|
638 |
$this->css->forcedep = array();
|
639 |
if ( isset( $_POST[ 'ctc_forcedep' ] ) && is_array( $_POST[ 'ctc_forcedep' ] ) ):
|
640 |
-
foreach ( $_POST[ 'ctc_forcedep' ] as $handle )
|
641 |
$this->css->forcedep[ sanitize_text_field( $handle ) ] = 1;
|
|
|
|
|
642 |
endif;
|
643 |
-
|
644 |
// roll back CTC Pro Genesis handling option
|
645 |
if ( $this->genesis ):
|
646 |
$handling = 'separate';
|
@@ -883,6 +885,17 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
883 |
$this->debug( 'forcedep: ' . print_r( $this->get( 'forcedep' ), TRUE ) . ' deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
|
884 |
. ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' reorder: ' . $reorder
|
885 |
. ' ignoreparnt: ' . $ignoreparnt . ' priority: ' . $priority . ' childtype: ' . $this->childtype, __FUNCTION__, __CLASS__ );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
886 |
// enqueue parent stylesheet
|
887 |
if ( 'enqueue' == $enq && $hasstyles && !$parntloaded && !$ignoreparnt ):
|
888 |
// Sanity check: remove dependency to parent css handle to avoid loop v2.3.0
|
@@ -925,7 +938,15 @@ add_action( 'wp_head', 'chld_thm_cfg_add_parent_dep', 2 );
|
|
925 |
endforeach;
|
926 |
endif;
|
927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
928 |
|
|
|
929 |
// if child not loaded, enqueue it and add it to dependencies
|
930 |
if ( 'separate' != $handling && ( ( $csswphead || $cssunreg || $cssnotheme )
|
931 |
|| ( 'new' != $this->childtype && !$childloaded )
|
@@ -1014,6 +1035,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
|
|
1014 |
$phpopen = 0;
|
1015 |
$in_comment = 0;
|
1016 |
$foundit = FALSE;
|
|
|
|
|
|
|
1017 |
if ( $markerdata ):
|
1018 |
$state = TRUE;
|
1019 |
foreach ( $markerdata as $n => $markerline ):
|
@@ -1045,6 +1069,14 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
|
|
1045 |
if ( preg_match( "/wp_enqueue_style.+?'chld_thm_cfg_ext\d+'.+?'(.+?)'/", $markerline, $matches ) ):
|
1046 |
$this->debug( 'external link found : ' . $matches[ 1 ] );
|
1047 |
$this->convert_enqueue_to_import( $matches[ 1 ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1048 |
endif;
|
1049 |
endif;
|
1050 |
if ( strpos( $markerline, '// END ' . $marker ) !== FALSE ):
|
@@ -1790,7 +1822,35 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
|
|
1790 |
// so we need cases for active parent, active child or neither
|
1791 |
function copy_theme_mods( $from, $to ) {
|
1792 |
if ( strlen( $from ) && strlen( $to ) ):
|
1793 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1794 |
do_action( 'chld_thm_cfg_copy_theme_mods', $from, $to );
|
1795 |
endif;
|
1796 |
}
|
@@ -2066,10 +2126,9 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
|
|
2066 |
function evaluate_signals() {
|
2067 |
if ( !isset( $_POST[ 'ctc_analysis' ] ) ) return;
|
2068 |
$analysis = json_decode( urldecode( $_POST[ 'ctc_analysis' ] ) );
|
2069 |
-
//die( print_r( $analysis, TRUE ) );
|
2070 |
// stylesheets loaded outside wp_styles queue
|
2071 |
$unregs = array( 'thm_past_wphead', 'thm_unregistered', 'dep_unregistered', 'css_past_wphead', 'dep_past_wphead' );
|
2072 |
-
//echo '<pre><code>' . print_r( $analysis, TRUE ) . "</code></pre>\n";
|
2073 |
|
2074 |
// if this is a self-contained child theme ( e.g., Genesis ) use child as baseline
|
2075 |
$baseline = $this->get( 'ignoreparnt' ) ? 'child' : 'parnt';
|
@@ -2087,6 +2146,21 @@ defined( 'CHLD_THM_CFG_IGNORE_PARENT' ) or define( 'CHLD_THM_CFG_IGNORE_PARENT',
|
|
2087 |
$this->css->addl_css[] = sanitize_text_field( $import );
|
2088 |
endforeach;
|
2089 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2090 |
|
2091 |
// store stylesheet dependencies
|
2092 |
if ( isset( $analysis->{ $baseline } ) ):
|
6 |
Class: ChildThemeConfiguratorAdmin
|
7 |
Plugin URI: http://www.childthemeconfigurator.com/
|
8 |
Description: Main Controller Class
|
9 |
+
Version: 2.3.1
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: child-theme-configurator
|
634 |
$this->evaluate_signals();
|
635 |
endif;
|
636 |
|
637 |
+
// v2.1.3 - remove dependency for specific stylesheets
|
638 |
$this->css->forcedep = array();
|
639 |
if ( isset( $_POST[ 'ctc_forcedep' ] ) && is_array( $_POST[ 'ctc_forcedep' ] ) ):
|
640 |
+
foreach ( $_POST[ 'ctc_forcedep' ] as $handle ):
|
641 |
$this->css->forcedep[ sanitize_text_field( $handle ) ] = 1;
|
642 |
+
$this->debug( 'Removing dependency: ' . $handle, __FUNCTION__, __CLASS__ );
|
643 |
+
endforeach;
|
644 |
endif;
|
645 |
+
|
646 |
// roll back CTC Pro Genesis handling option
|
647 |
if ( $this->genesis ):
|
648 |
$handling = 'separate';
|
885 |
$this->debug( 'forcedep: ' . print_r( $this->get( 'forcedep' ), TRUE ) . ' deps: ' . print_r( $deps, TRUE ) . ' enq: ' . $enq . ' handling: ' . $handling
|
886 |
. ' hasstyles: ' . $hasstyles . ' parntloaded: ' . $parntloaded . ' childloaded: ' . $childloaded . ' reorder: ' . $reorder
|
887 |
. ' ignoreparnt: ' . $ignoreparnt . ' priority: ' . $priority . ' childtype: ' . $this->childtype, __FUNCTION__, __CLASS__ );
|
888 |
+
// add RTL handler
|
889 |
+
$code .= "
|
890 |
+
if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
|
891 |
+
function chld_thm_cfg_locale_css( \$uri ){
|
892 |
+
if ( empty( \$uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
|
893 |
+
\$uri = get_template_directory_uri() . '/rtl.css';
|
894 |
+
return \$uri;
|
895 |
+
}
|
896 |
+
endif;
|
897 |
+
add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );
|
898 |
+
";
|
899 |
// enqueue parent stylesheet
|
900 |
if ( 'enqueue' == $enq && $hasstyles && !$parntloaded && !$ignoreparnt ):
|
901 |
// Sanity check: remove dependency to parent css handle to avoid loop v2.3.0
|
938 |
endforeach;
|
939 |
endif;
|
940 |
|
941 |
+
// deregister and re-register swaps
|
942 |
+
foreach ( $this->get( 'swappath' ) as $sphandle => $sppath ):
|
943 |
+
$enqueues[] = " if ( !file_exists( trailingslashit( get_stylesheet_directory() ) . '" . $sppath . "' ) ):";
|
944 |
+
$enqueues[] = " wp_deregister_style( '" . $sphandle . "' );";
|
945 |
+
$enqueues[] = " wp_register_style( '" . $sphandle . "', trailingslashit( get_template_directory_uri() ) . '" . $sppath . "' );";
|
946 |
+
$enqueues[] = " endif;";
|
947 |
+
endforeach;
|
948 |
|
949 |
+
//die( print_r( $enqueues, TRUE ) );
|
950 |
// if child not loaded, enqueue it and add it to dependencies
|
951 |
if ( 'separate' != $handling && ( ( $csswphead || $cssunreg || $cssnotheme )
|
952 |
|| ( 'new' != $this->childtype && !$childloaded )
|
1035 |
$phpopen = 0;
|
1036 |
$in_comment = 0;
|
1037 |
$foundit = FALSE;
|
1038 |
+
if ( $getexternals ):
|
1039 |
+
$this->debug( 'Read only, returning.', __FUNCTION__, __CLASS__ );
|
1040 |
+
endif;
|
1041 |
if ( $markerdata ):
|
1042 |
$state = TRUE;
|
1043 |
foreach ( $markerdata as $n => $markerline ):
|
1069 |
if ( preg_match( "/wp_enqueue_style.+?'chld_thm_cfg_ext\d+'.+?'(.+?)'/", $markerline, $matches ) ):
|
1070 |
$this->debug( 'external link found : ' . $matches[ 1 ] );
|
1071 |
$this->convert_enqueue_to_import( $matches[ 1 ] );
|
1072 |
+
// look for deregister/register link paths for swapping parent/child
|
1073 |
+
elseif ( preg_match( "/wp_register_style[^']+'(.+?)'[^']+'(.+?)'/", $markerline, $matches ) ):
|
1074 |
+
$this->debug( 'link swap found : ' . $matches[ 1 ] . ' => ' . $matches[ 2 ] );
|
1075 |
+
|
1076 |
+
$handle = sanitize_text_field( $matches[ 1 ] );
|
1077 |
+
$path = sanitize_text_field( $matches[ 2 ] );
|
1078 |
+
$this->css->swappath[ $handle ] = $path;
|
1079 |
+
|
1080 |
endif;
|
1081 |
endif;
|
1082 |
if ( strpos( $markerline, '// END ' . $marker ) !== FALSE ):
|
1822 |
// so we need cases for active parent, active child or neither
|
1823 |
function copy_theme_mods( $from, $to ) {
|
1824 |
if ( strlen( $from ) && strlen( $to ) ):
|
1825 |
+
|
1826 |
+
// get parent theme settings
|
1827 |
+
$mods = $this->get_theme_mods( $from );
|
1828 |
+
|
1829 |
+
// handle custom css
|
1830 |
+
$css = wp_get_custom_css( $from );
|
1831 |
+
$r = wp_update_custom_css_post( $css, array(
|
1832 |
+
'stylesheet' => $to
|
1833 |
+
) );
|
1834 |
+
|
1835 |
+
// if ok, set id in child theme mods
|
1836 |
+
if ( !( $r instanceof WP_Error ) ):
|
1837 |
+
$post_id = $r->ID;
|
1838 |
+
$mods[ 'custom_css_post_id' ] = $post_id;
|
1839 |
+
endif;
|
1840 |
+
|
1841 |
+
// set new mods based on parent
|
1842 |
+
$this->set_theme_mods( $to, $mods );
|
1843 |
+
|
1844 |
+
// handle randomized custom headers
|
1845 |
+
$headers = get_posts( array(
|
1846 |
+
'post_type' => 'attachment',
|
1847 |
+
'meta_key' => '_wp_attachment_is_custom_header',
|
1848 |
+
'meta_value' => $from,
|
1849 |
+
'orderby' => 'none',
|
1850 |
+
'nopaging' => true ) );
|
1851 |
+
foreach ( $headers as $header )
|
1852 |
+
add_post_meta( $header->ID, '_wp_attachment_is_custom_header', $to );
|
1853 |
+
|
1854 |
do_action( 'chld_thm_cfg_copy_theme_mods', $from, $to );
|
1855 |
endif;
|
1856 |
}
|
2126 |
function evaluate_signals() {
|
2127 |
if ( !isset( $_POST[ 'ctc_analysis' ] ) ) return;
|
2128 |
$analysis = json_decode( urldecode( $_POST[ 'ctc_analysis' ] ) );
|
2129 |
+
//die( '<pre><code><small>' . print_r( $analysis, TRUE ) . '</small></code></pre>' );
|
2130 |
// stylesheets loaded outside wp_styles queue
|
2131 |
$unregs = array( 'thm_past_wphead', 'thm_unregistered', 'dep_unregistered', 'css_past_wphead', 'dep_past_wphead' );
|
|
|
2132 |
|
2133 |
// if this is a self-contained child theme ( e.g., Genesis ) use child as baseline
|
2134 |
$baseline = $this->get( 'ignoreparnt' ) ? 'child' : 'parnt';
|
2146 |
$this->css->addl_css[] = sanitize_text_field( $import );
|
2147 |
endforeach;
|
2148 |
endif;
|
2149 |
+
|
2150 |
+
// store any detected swaps
|
2151 |
+
foreach ( $analysis->parnt->swaps as $swap ):
|
2152 |
+
if ( ( $handle = sanitize_text_field( $swap[ 0 ] ) ) && ( $path = sanitize_text_field( $swap[ 1 ] ) ) ):
|
2153 |
+
$this->css->swappath[ $handle ] = $path;
|
2154 |
+
$this->debug( 'Setting link swap: ' . $handle . ' => ' . $path, __FUNCTION__, __CLASS__ );
|
2155 |
+
endif;
|
2156 |
+
endforeach;
|
2157 |
+
|
2158 |
+
//echo ( print_r( $this->css->swappath, TRUE ) );
|
2159 |
+
|
2160 |
+
/*
|
2161 |
+
die( '<pre><code>Baseline: ' . $baseline . PHP_EOL . print_r( $analysis, TRUE ) . PHP_EOL
|
2162 |
+
. 'Swap Paths: ' . print_r( $this->css->swappath, TRUE ) . '</code></pre>' );
|
2163 |
+
*/
|
2164 |
|
2165 |
// store stylesheet dependencies
|
2166 |
if ( isset( $analysis->{ $baseline } ) ):
|
includes/classes/CSS.php
CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
6 |
Class: ChildThemeConfiguratorCSS
|
7 |
Plugin URI: http://www.childthemeconfigurator.com/
|
8 |
Description: Handles all CSS input, output, parsing, normalization and storage
|
9 |
-
Version: 2.3.
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
@@ -49,6 +49,7 @@ class ChildThemeConfiguratorCSS {
|
|
49 |
var $parnt_deps; //
|
50 |
var $child_deps; //
|
51 |
var $forcedep;
|
|
|
52 |
var $addl_css;
|
53 |
var $cssunreg;
|
54 |
var $csswphead;
|
@@ -95,6 +96,7 @@ class ChildThemeConfiguratorCSS {
|
|
95 |
var $configvars = array(
|
96 |
'addl_css',
|
97 |
'forcedep',
|
|
|
98 |
'cssunreg',
|
99 |
'csswphead',
|
100 |
'cssnotheme',
|
@@ -167,7 +169,7 @@ class ChildThemeConfiguratorCSS {
|
|
167 |
$this->parnt = '';
|
168 |
$this->ignoreparnt = 0;
|
169 |
$this->qpriority = 10;
|
170 |
-
$this->version = '2.
|
171 |
|
172 |
// do not set enqueue, not being set is used to flag old versions
|
173 |
|
@@ -183,6 +185,7 @@ class ChildThemeConfiguratorCSS {
|
|
183 |
function ctc() {
|
184 |
return ChildThemeConfigurator::ctc();
|
185 |
}
|
|
|
186 |
function mem_chk() {
|
187 |
$currmemory = $this->memory;
|
188 |
if ( function_exists( 'memory_get_peak_usage' ) ) {
|
@@ -337,6 +340,8 @@ class ChildThemeConfiguratorCSS {
|
|
337 |
return empty( $this->parnt_imp ) ? array() : $this->parnt_imp;
|
338 |
case 'forcedep': // v2.1.3
|
339 |
return empty( $this->forcedep ) ? array() : array_keys( $this->forcedep );
|
|
|
|
|
340 |
case 'parnt_deps':
|
341 |
return empty( $this->parnt_deps ) ? array() : $this->quotify_dependencies( 'parnt_deps' );
|
342 |
case 'child_deps':
|
@@ -1922,17 +1927,17 @@ class ChildThemeConfiguratorCSS {
|
|
1922 |
switch ( $dict ):
|
1923 |
case 'dict_seq':
|
1924 |
case 'dict_token':
|
1925 |
-
|
1926 |
case 'sel_ndx':
|
1927 |
$this->{ $dict } = array();
|
1928 |
-
|
1929 |
case 'val_ndx':
|
1930 |
foreach ( $this->val_ndx as $qsid => $rulearr ):
|
1931 |
foreach ( $rulearr as $ruleid => $valarr )
|
1932 |
$this->convert_ruleval_array( $this->val_ndx[ $qsid ][ $ruleid ] );
|
1933 |
$this->pack_val_ndx( $qsid, $this->val_ndx[ $qsid ] );
|
1934 |
endforeach;
|
1935 |
-
|
1936 |
case 'dict_qs':
|
1937 |
$qsarr = array();
|
1938 |
foreach ( $this->dict_qs as $qsid => $arr ):
|
@@ -1940,7 +1945,7 @@ class ChildThemeConfiguratorCSS {
|
|
1940 |
$qsarr[ $qsid ] = $qs;
|
1941 |
endforeach;
|
1942 |
$this->dict_qs = $qsarr;
|
1943 |
-
|
1944 |
default:
|
1945 |
$this->{ $dict } = array_flip( $this->{ $dict } );
|
1946 |
foreach ( $this->{ $dict } as $key => $val ):
|
6 |
Class: ChildThemeConfiguratorCSS
|
7 |
Plugin URI: http://www.childthemeconfigurator.com/
|
8 |
Description: Handles all CSS input, output, parsing, normalization and storage
|
9 |
+
Version: 2.3.1
|
10 |
Author: Lilaea Media
|
11 |
Author URI: http://www.lilaeamedia.com/
|
12 |
Text Domain: chld_thm_cfg
|
49 |
var $parnt_deps; //
|
50 |
var $child_deps; //
|
51 |
var $forcedep;
|
52 |
+
var $swappath;
|
53 |
var $addl_css;
|
54 |
var $cssunreg;
|
55 |
var $csswphead;
|
96 |
var $configvars = array(
|
97 |
'addl_css',
|
98 |
'forcedep',
|
99 |
+
'swappath',
|
100 |
'cssunreg',
|
101 |
'csswphead',
|
102 |
'cssnotheme',
|
169 |
$this->parnt = '';
|
170 |
$this->ignoreparnt = 0;
|
171 |
$this->qpriority = 10;
|
172 |
+
$this->version = '2.4.0';
|
173 |
|
174 |
// do not set enqueue, not being set is used to flag old versions
|
175 |
|
185 |
function ctc() {
|
186 |
return ChildThemeConfigurator::ctc();
|
187 |
}
|
188 |
+
|
189 |
function mem_chk() {
|
190 |
$currmemory = $this->memory;
|
191 |
if ( function_exists( 'memory_get_peak_usage' ) ) {
|
340 |
return empty( $this->parnt_imp ) ? array() : $this->parnt_imp;
|
341 |
case 'forcedep': // v2.1.3
|
342 |
return empty( $this->forcedep ) ? array() : array_keys( $this->forcedep );
|
343 |
+
case 'swappath': // v2.3.1
|
344 |
+
return empty( $this->swappath ) ? array() : (array) $this->swappath;
|
345 |
case 'parnt_deps':
|
346 |
return empty( $this->parnt_deps ) ? array() : $this->quotify_dependencies( 'parnt_deps' );
|
347 |
case 'child_deps':
|
1927 |
switch ( $dict ):
|
1928 |
case 'dict_seq':
|
1929 |
case 'dict_token':
|
1930 |
+
break;
|
1931 |
case 'sel_ndx':
|
1932 |
$this->{ $dict } = array();
|
1933 |
+
break;
|
1934 |
case 'val_ndx':
|
1935 |
foreach ( $this->val_ndx as $qsid => $rulearr ):
|
1936 |
foreach ( $rulearr as $ruleid => $valarr )
|
1937 |
$this->convert_ruleval_array( $this->val_ndx[ $qsid ][ $ruleid ] );
|
1938 |
$this->pack_val_ndx( $qsid, $this->val_ndx[ $qsid ] );
|
1939 |
endforeach;
|
1940 |
+
break;
|
1941 |
case 'dict_qs':
|
1942 |
$qsarr = array();
|
1943 |
foreach ( $this->dict_qs as $qsid => $arr ):
|
1945 |
$qsarr[ $qsid ] = $qs;
|
1946 |
endforeach;
|
1947 |
$this->dict_qs = $qsarr;
|
1948 |
+
break;
|
1949 |
default:
|
1950 |
$this->{ $dict } = array_flip( $this->{ $dict } );
|
1951 |
foreach ( $this->{ $dict } as $key => $val ):
|
includes/classes/Core.php
CHANGED
@@ -14,7 +14,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
14 |
define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
|
15 |
defined( 'CHLD_THM_CFG_DOCS_URL' ) or
|
16 |
define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
|
17 |
-
define( 'CHLD_THM_CFG_VERSION', '2.
|
18 |
define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
|
19 |
define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
|
20 |
define( 'CHLD_THM_CFG_PRO_MIN_VERSION', '2.2.0' );
|
14 |
define( 'LILAEAMEDIA_URL', "http://www.lilaeamedia.com" );
|
15 |
defined( 'CHLD_THM_CFG_DOCS_URL' ) or
|
16 |
define( 'CHLD_THM_CFG_DOCS_URL', "http://www.childthemeconfigurator.com" );
|
17 |
+
define( 'CHLD_THM_CFG_VERSION', '2.4.0' );
|
18 |
define( 'CHLD_THM_CFG_PREV_VERSION', '1.7.9.1' );
|
19 |
define( 'CHLD_THM_CFG_MIN_WP_VERSION', '3.7' );
|
20 |
define( 'CHLD_THM_CFG_PRO_MIN_VERSION', '2.2.0' );
|
includes/classes/UI.php
CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
5 |
Class: ChildThemeConfiguratorUI
|
6 |
Plugin URI: http://www.childthemeconfigurator.com/
|
7 |
Description: Handles the plugin User Interface
|
8 |
-
Version: 2.
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
@@ -282,6 +282,7 @@ class ChildThemeConfiguratorUI {
|
|
282 |
'child' => $this->css()->get_prop( 'child' ),
|
283 |
'addl_css' => $this->css()->get_prop( 'addl_css' ),
|
284 |
'forcedep' => $this->css()->get_prop( 'forcedep' ),
|
|
|
285 |
'imports' => $this->css()->get_prop( 'imports' ),
|
286 |
'converted' => $this->css()->get_prop( 'converted' ),
|
287 |
'is_debug' => $this->ctc()->is_debug,
|
5 |
Class: ChildThemeConfiguratorUI
|
6 |
Plugin URI: http://www.childthemeconfigurator.com/
|
7 |
Description: Handles the plugin User Interface
|
8 |
+
Version: 2.4.0
|
9 |
Author: Lilaea Media
|
10 |
Author URI: http://www.lilaeamedia.com/
|
11 |
Text Domain: chld_thm_cfg
|
282 |
'child' => $this->css()->get_prop( 'child' ),
|
283 |
'addl_css' => $this->css()->get_prop( 'addl_css' ),
|
284 |
'forcedep' => $this->css()->get_prop( 'forcedep' ),
|
285 |
+
'swappath' => $this->css()->get_prop( 'swappath' ),
|
286 |
'imports' => $this->css()->get_prop( 'imports' ),
|
287 |
'converted' => $this->css()->get_prop( 'converted' ),
|
288 |
'is_debug' => $this->ctc()->is_debug,
|
includes/forms/addl_panels.php
CHANGED
@@ -5,14 +5,13 @@ if ( !defined( 'CHLD_THM_CFG_PRO_VERSION' ) ):
|
|
5 |
?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" >
|
6 |
<div class="ctc-input-row clearfix">
|
7 |
<div class="ctc-input-cell"><div style="padding:0 40px">
|
8 |
-
<
|
9 |
-
<p
|
10 |
-
<h3><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/cart/?add-to-cart=4549" title="<?php _e( 'Order Now', 'child-theme-configurator' ); ?>"><?php _e( 'Order Now', 'child-theme-configurator' ); ?></a></h3><small><?php _e( '*Prices and offers subject to change.', 'child-theme-configurator' ); ?></small><hr style="margin:20px 0" />
|
11 |
-
<a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/iw-banner.jpg'; ?>" width="430" height="430" /></a>
|
12 |
-
<p><?php _e( 'IntelliWidget is a versatile widget manager that does the work of multiple plugins by combining custom page menus, featured posts, sliders and other dynamic content features into a single plugin that can display on a per-page or site-wide basis.', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/plugins/intelliwidget/" title="<?php _e( 'Learn more about IntelliWidget', 'child-theme-configurator' ); ?>">
|
13 |
<?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
|
14 |
-
<a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/
|
15 |
-
<p><?php _e( '
|
|
|
|
|
16 |
<?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p>
|
17 |
</div></div>
|
18 |
<div class="ctc-input-cell-wide">
|
5 |
?><div id="get_pro_panel" class="ctc-option-panel<?php echo 'get_pro' == $active_tab ? ' ctc-option-panel-active' : ''; ?>" >
|
6 |
<div class="ctc-input-row clearfix">
|
7 |
<div class="ctc-input-cell"><div style="padding:0 40px">
|
8 |
+
<a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/product/premium-support-install-set-troubleshoot/" title="<?php _e( 'Learn more about Premium Support', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/ctc-support.jpg'; ?>" width="430" height="430" /></a>
|
9 |
+
<p><?php _e( 'Maybe you are having trouble getting your child theme to work, or just don’t want to mess with it ... <strong>Let us set it up for you!</strong>', 'child-theme-configurator' ); ?> <a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/product/premium-support-install-set-troubleshoot/" title="<?php _e( 'Learn more about Premium Support', 'child-theme-configurator' ); ?>">
|
|
|
|
|
|
|
10 |
<?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p><hr style="margin:20px 0" />
|
11 |
+
<a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/product/hook-highlighter/" title="<?php _e( 'Learn more about Hook Highlighter', 'child-theme-configurator' ); ?>"><img src="<?php echo CHLD_THM_CFG_URL . 'css/hook-highlighter.jpg'; ?>" width="430" height="430" /></a>
|
12 |
+
<p><?php _e( 'Hook Highlighter provides Administrators insight into the internal program flow of WordPress when activated on any front-facing page of a website.', 'child-theme-configurator' ); ?></p>
|
13 |
+
<p><?php _e( 'Display action and filter hooks, program files and backtrace information inline for the current page.', 'child-theme-configurator' ); ?></p>
|
14 |
+
<p><a target="_blank" href="<?php echo LILAEAMEDIA_URL; ?>/product/hook-highlighter/" title="<?php _e( 'Learn more about Hook Highlighter', 'child-theme-configurator' ); ?>">
|
15 |
<?php _e( 'Learn more', 'child-theme-configurator'); ?><i class="dashicons dashicons-external" style="text-decoration:none"></i></a></p>
|
16 |
</div></div>
|
17 |
<div class="ctc-input-cell-wide">
|
includes/forms/parent-child.php
CHANGED
@@ -286,6 +286,7 @@ if ( !defined( 'ABSPATH' ) )exit;
|
|
286 |
<p class="howto indent"><?php _e( 'Let the Configurator (try to) resolve any stylesheet issues listed above. This can fix many, but not all, common problems.', 'child-theme-configurator' ); ?></p></label>
|
287 |
</div>
|
288 |
</div>
|
|
|
289 |
<div id="ctc_dependencies_container" style="display:none">
|
290 |
<div class="ctc-input-cell ctc-clear">
|
291 |
<p class="howto">
|
@@ -293,12 +294,12 @@ if ( !defined( 'ABSPATH' ) )exit;
|
|
293 |
</div>
|
294 |
<div class="ctc-input-cell-wide sep">
|
295 |
<strong class="indent">
|
296 |
-
<?php _e( '
|
297 |
</strong>
|
|
|
298 |
<p class="howto indent">
|
299 |
-
<?php _e( 'By default, the order of stylesheets that load prior to the primary stylesheet is preserved by treating them as dependencies. In some cases, stylesheets are detected in the preview that are not used site-wide. If necessary, dependency can be removed for specific stylesheets
|
300 |
</p>
|
301 |
-
<div id="ctc_dependencies"></div>
|
302 |
</div>
|
303 |
</div>
|
304 |
<?php //do_action( 'chld_thm_cfg_enqueue_options' ); // removed for ctc 2.0 ?>
|
@@ -398,7 +399,7 @@ if ( !defined( 'ABSPATH' ) )exit;
|
|
398 |
<strong>
|
399 |
<?php _e( 'NOTE:', 'child-theme-configurator' ); ?>
|
400 |
</strong>
|
401 |
-
<?php _e( "This option replaces the Child Theme's existing Menus, Widgets and other Customizer Settings with those from the Parent Theme. You should only need to use this option the first time you configure a Child Theme.", 'child-theme-configurator' ); ?>
|
402 |
</label>
|
403 |
|
404 |
|
286 |
<p class="howto indent"><?php _e( 'Let the Configurator (try to) resolve any stylesheet issues listed above. This can fix many, but not all, common problems.', 'child-theme-configurator' ); ?></p></label>
|
287 |
</div>
|
288 |
</div>
|
289 |
+
|
290 |
<div id="ctc_dependencies_container" style="display:none">
|
291 |
<div class="ctc-input-cell ctc-clear">
|
292 |
<p class="howto">
|
294 |
</div>
|
295 |
<div class="ctc-input-cell-wide sep">
|
296 |
<strong class="indent">
|
297 |
+
<?php _e( 'Do not force dependency for these stylesheet handles:', 'child-theme-configurator' ); ?>
|
298 |
</strong>
|
299 |
+
<p id="ctc_dependencies"></p>
|
300 |
<p class="howto indent">
|
301 |
+
<?php _e( 'By default, the order of stylesheets that load prior to the primary stylesheet is preserved by treating them as dependencies. In some cases, stylesheets are detected in the preview that are not used site-wide. If necessary, dependency can be removed for specific stylesheets above.', 'child-theme-configurator' ); ?>
|
302 |
</p>
|
|
|
303 |
</div>
|
304 |
</div>
|
305 |
<?php //do_action( 'chld_thm_cfg_enqueue_options' ); // removed for ctc 2.0 ?>
|
399 |
<strong>
|
400 |
<?php _e( 'NOTE:', 'child-theme-configurator' ); ?>
|
401 |
</strong>
|
402 |
+
<?php _e( "This option replaces the Child Theme's existing Menus, Widgets and other Customizer Settings with those from the Parent Theme. You should only need to use this option the first time you configure a Child Theme. <strong>Some themes use additional options that cannot be copied with the free verson of CTC. Click the \"Upgrade\" tab for more information.</strong>", 'child-theme-configurator' ); ?>
|
403 |
</label>
|
404 |
|
405 |
|
includes/forms/webfonts.php
CHANGED
@@ -20,10 +20,10 @@ $ctcpage = apply_filters( 'chld_thm_cfg_admin_page', CHLD_THM_CFG_MENU );
|
|
20 |
<p><?php _e( 'Use <code>@import url( [path] );</code> to link additional stylesheets. Child Theme Configurator uses the <code>@import</code> keyword to identify them and convert them to <code><link></code> tags. <strong>Example:</strong>');?></p>
|
21 |
<p><code>@import url(http://fonts.googleapis.com/css?family=Oswald);</code></p>
|
22 |
<strong>
|
23 |
-
<?php _e( '
|
24 |
</strong>
|
25 |
-
<p><?php _e( '
|
26 |
-
<p><code>@import url(
|
27 |
</div>
|
28 |
<div class="ctc-input-cell-wide">
|
29 |
<textarea id="ctc_child_imports" name="ctc_child_imports" wrap="off"><?php
|
20 |
<p><?php _e( 'Use <code>@import url( [path] );</code> to link additional stylesheets. Child Theme Configurator uses the <code>@import</code> keyword to identify them and convert them to <code><link></code> tags. <strong>Example:</strong>');?></p>
|
21 |
<p><code>@import url(http://fonts.googleapis.com/css?family=Oswald);</code></p>
|
22 |
<strong>
|
23 |
+
<?php _e( 'Local Font Files', 'child-theme-configurator' ); ?>
|
24 |
</strong>
|
25 |
+
<p><?php _e( 'Use a relative path to link to webfont kit stylesheets you have uploaded to your Child Theme. <strong>Example:</strong>');?></p>
|
26 |
+
<p><code>@import url(my_web_fonts/stylesheet.css);</code></p>
|
27 |
</div>
|
28 |
<div class="ctc-input-cell-wide">
|
29 |
<textarea id="ctc_child_imports" name="ctc_child_imports" wrap="off"><?php
|
includes/help/en_US.php
CHANGED
@@ -107,6 +107,10 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
107 |
<!-- END tab -->
|
108 |
<!-- BEGIN tab -->
|
109 |
<h3 id="ctc_faq">FAQs</h3>
|
|
|
|
|
|
|
|
|
110 |
<h5 id="broken_theme">HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it!</h5>
|
111 |
<p>To back out of a broken theme you have to manually rename the offending theme directory name (via FTP, SSH or your web host control panel file manager) so that WordPress can't find it. WordPress will then throw an error and revert back to the default theme (currently twenty-fourteen).</p>
|
112 |
|
@@ -136,8 +140,6 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
136 |
<li><strong>Options: </strong> Every theme handles options in its own way. Most often, they will create a set of options and store them in the WordPress database. Some options are specific to the active theme (or child theme), and some are specific to the parent theme only (meaning the child theme CANNOT override them). You will have to find out from the theme author which are which.</li>
|
137 |
</ul>
|
138 |
</p>
|
139 |
-
<h5 id="existing_parent">How do I move changes I have already made to my theme into a Child Theme?</h5>
|
140 |
-
<p><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#child_from_modified_parent" class="scroll-to">Follow these steps</a>. </p>
|
141 |
<h5 id="web_fonts">How do I add Web Fonts?</h5>
|
142 |
<p>The easiest method is to paste the @import code provided by <a href="http://www.google.com/fonts" title="Google Fonts">Google</a>, <a href="http://www.fontsquirrel.com/" title="Font Squirrel">Font Squirrel</a> or any other Web Font site into the Web Fonts tab. The fonts will then be available to use as a value of the <strong>font-family</strong> property. Be sure you understand the license for any embedded fonts. </p>
|
143 |
<p>You can also create a secondary stylesheet that contains @font-face rules and import it using the Web Fonts tab. </p>
|
@@ -207,7 +209,8 @@ The plugin only loads the bulk of the code in the admin when you are using the t
|
|
207 |
<!-- END tab -->
|
208 |
<!-- BEGIN sidebar -->
|
209 |
<h4>Our plugins will not nag you for donations...</h4>
|
210 |
-
<
|
|
|
211 |
<h4>Introducing CTC Pro</h4>
|
212 |
<a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Learn more about CTC Pro"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="150" height="48" /></a>
|
213 |
<p style="font-size:smaller">Designed by WordPress developers who use it every day, CTC Pro adds plugin stylesheets and other features to make design work quicker and easier. This is a free upgrade for users that purchased the Plugins Extension. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Child Theme Configurator Pro">Learn more</a></p>
|
107 |
<!-- END tab -->
|
108 |
<!-- BEGIN tab -->
|
109 |
<h3 id="ctc_faq">FAQs</h3>
|
110 |
+
<h5 id="existing_parent">How do I move changes I have already made to my theme into a Child Theme?</h5>
|
111 |
+
<p><a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/how-to-use/#child_from_modified_parent" class="scroll-to">Follow these steps</a>.</p>
|
112 |
+
<h5 id="constants_defined">When I run the analyzer I get "Constants Already Defined" notice in PHP Debug Output</h5>
|
113 |
+
<p>This is a misconfiguration created by the Bluehost auto-installer. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-faqs/#constants" class="scroll-to">How to fix.</a></p>
|
114 |
<h5 id="broken_theme">HELP! I changed a file and now I am unable to access my website or login to wp-admin to fix it!</h5>
|
115 |
<p>To back out of a broken theme you have to manually rename the offending theme directory name (via FTP, SSH or your web host control panel file manager) so that WordPress can't find it. WordPress will then throw an error and revert back to the default theme (currently twenty-fourteen).</p>
|
116 |
|
140 |
<li><strong>Options: </strong> Every theme handles options in its own way. Most often, they will create a set of options and store them in the WordPress database. Some options are specific to the active theme (or child theme), and some are specific to the parent theme only (meaning the child theme CANNOT override them). You will have to find out from the theme author which are which.</li>
|
141 |
</ul>
|
142 |
</p>
|
|
|
|
|
143 |
<h5 id="web_fonts">How do I add Web Fonts?</h5>
|
144 |
<p>The easiest method is to paste the @import code provided by <a href="http://www.google.com/fonts" title="Google Fonts">Google</a>, <a href="http://www.fontsquirrel.com/" title="Font Squirrel">Font Squirrel</a> or any other Web Font site into the Web Fonts tab. The fonts will then be available to use as a value of the <strong>font-family</strong> property. Be sure you understand the license for any embedded fonts. </p>
|
145 |
<p>You can also create a secondary stylesheet that contains @font-face rules and import it using the Web Fonts tab. </p>
|
209 |
<!-- END tab -->
|
210 |
<!-- BEGIN sidebar -->
|
211 |
<h4>Our plugins will not nag you for donations...</h4>
|
212 |
+
<p style="font-size:smaller">...but we LOVE referrals.</p><a href="http://wordpress.org/support/view/plugin-reviews/child-theme-configurator?rate=5#postform">Give Us 5 Stars</a>
|
213 |
+
<p style="font-size:smaller">If you would like to support the production of useful tutorials and continued improvement of our software, please consider <a target="blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8QE5YJ8WE96AJ">making a donation</a>.</p>
|
214 |
<h4>Introducing CTC Pro</h4>
|
215 |
<a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Learn more about CTC Pro"><img src="<?php echo CHLD_THM_CFG_URL . 'css/pro-banner.jpg'; ?>" width="150" height="48" /></a>
|
216 |
<p style="font-size:smaller">Designed by WordPress developers who use it every day, CTC Pro adds plugin stylesheets and other features to make design work quicker and easier. This is a free upgrade for users that purchased the Plugins Extension. <a href="<?php echo CHLD_THM_CFG_DOCS_URL; ?>/child-theme-configurator-pro/" title="Child Theme Configurator Pro">Learn more</a></p>
|
js/chldthmcfg.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Script: chldthmcfg.js
|
3 |
* Plugin URI: http://www.childthemeconfigurator.com/
|
4 |
* Description: Handles jQuery, AJAX and other UI
|
5 |
-
* Version: 2.
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
@@ -17,7 +17,6 @@
|
|
17 |
( function( $ ) {
|
18 |
'use strict';
|
19 |
$.chldthmcfg = {
|
20 |
-
//console.log( 'executing main function' );
|
21 |
escquo: function( str ) {
|
22 |
var self = this;
|
23 |
return self.is_empty( str ) ? str : str.toString().replace( /"/g, '"' );
|
@@ -37,8 +36,8 @@
|
|
37 |
getname: function( themetype ){
|
38 |
var self = this,
|
39 |
stylesheet = ( 'child' === themetype ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt );
|
40 |
-
//console.log( 'getname: ' + stylesheet );
|
41 |
-
//console.log( window.ctcAjax.themes );
|
42 |
if ( self.is_empty( window.ctcAjax.themes[ themetype ][ stylesheet ] ) ){
|
43 |
return '';
|
44 |
} else {
|
@@ -170,7 +169,7 @@
|
|
170 |
}
|
171 |
self.testslug = slug;
|
172 |
self.testname = name + ( padded.length ? ' ' + padded : '' );
|
173 |
-
//console.log( 'autogen_slugs: parent: ' + parent + ' slug: ' + slug );
|
174 |
}
|
175 |
},
|
176 |
|
@@ -195,7 +194,7 @@
|
|
195 |
$( '.ctc-rewrite-toggle' ).each( function( ndx, el ){
|
196 |
inputtype = $( el ).hasClass( 'rewrite-query' ) ? 'query' : 'selector';
|
197 |
value = $( '#ctc_sel_ovrd_' + inputtype + '_selected' ).text();
|
198 |
-
//console.log( 'maybe_show_rewrite inputtype: ' + inputtype + ' value: ' + value );
|
199 |
if ( value.match( /^[\s\u00A0]*$/ ) ){
|
200 |
$( el ).hide();
|
201 |
} else {
|
@@ -210,7 +209,7 @@
|
|
210 |
* modified v2.3.0
|
211 |
*/
|
212 |
selector_input_toggle: function( obj ) {
|
213 |
-
//console.log( 'selector_input_toggle: ' + $( obj ).attr( 'id' ) );
|
214 |
var self = this,
|
215 |
origval,
|
216 |
inputtype = $( obj ).hasClass( 'rewrite-query' ) ? 'query' : 'selector',
|
@@ -233,7 +232,7 @@
|
|
233 |
},
|
234 |
|
235 |
coalesce_inputs: function( obj ) {
|
236 |
-
|
237 |
var self = this,
|
238 |
id = $( obj ).attr( 'id' ),
|
239 |
regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,
|
@@ -269,8 +268,8 @@
|
|
269 |
$( this ).val() ) ), // clear values if delete was clicked
|
270 |
important = ( 'seq' === inputrule ? false : 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid + '_' + rulevalid ),
|
271 |
parts, subparts;
|
272 |
-
|
273 |
-
|
274 |
if ( 'child' === inputtheme ) {
|
275 |
if ( !self.is_empty( $( this ).data( 'color' ) ) ) {
|
276 |
value = self.color_text( $( this ).data( 'color' ) );
|
@@ -318,10 +317,10 @@
|
|
318 |
if ( ( parts = inputrule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) && !value.match( /none/ ) ) ) {
|
319 |
var borderregx = new RegExp( self.border_regx + self.color_regx, 'i' );
|
320 |
subparts = value.toString().match( borderregx );
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
if ( !self.is_empty( subparts ) ) {
|
326 |
subparts.shift();
|
327 |
cssrules[ inputtheme ][ inputrule + '-width' ] = subparts.shift() || '';
|
@@ -336,10 +335,10 @@
|
|
336 |
} else {
|
337 |
var gradregex = new RegExp( self.grad_regx + self.color_regx + self.color_regx, 'i' );
|
338 |
subparts = value.toString().match( gradregex );
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
if ( !self.is_empty( subparts ) && subparts.length > 2 ) {
|
344 |
subparts.shift();
|
345 |
gradient[ inputtheme ].origin = subparts.shift() || 'top';
|
@@ -362,14 +361,14 @@
|
|
362 |
if ( has_gradient.parent ) {
|
363 |
swatch.ctcgrad( gradient.parent.origin, [ gradient.parent.start, gradient.parent.end ] );
|
364 |
}
|
365 |
-
|
366 |
-
|
367 |
swatch.css( cssrules.parent );
|
368 |
if ( !( swatch.attr( 'id' ).toString().match( /parent/ ) ) ) {
|
369 |
if ( has_gradient.child ) {
|
370 |
swatch.ctcgrad( gradient.child.origin, [ gradient.child.start, gradient.child.end ] );
|
371 |
}
|
372 |
-
//console.log( cssrules.child );
|
373 |
swatch.css( cssrules.child );
|
374 |
}
|
375 |
swatch.css( {'z-index':-1} );
|
@@ -378,7 +377,7 @@
|
|
378 |
},
|
379 |
|
380 |
decode_value: function( rule, value ) {
|
381 |
-
|
382 |
value = ( 'undefined' === typeof value ? '' : value );
|
383 |
var self = this,
|
384 |
obj = {
|
@@ -400,9 +399,9 @@
|
|
400 |
'_border_color',
|
401 |
];
|
402 |
orig = params.shift();
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
obj.values[ 0 ] = params.shift() || '';
|
407 |
params.shift();
|
408 |
obj.values[ 1 ] = params.shift() || '';
|
@@ -419,8 +418,8 @@
|
|
419 |
if ( !self.is_empty( value ) && !( value.toString().match( /(url|none)/ ) ) ) {
|
420 |
var stop1, stop2;
|
421 |
params = value.toString().split( /:/ );
|
422 |
-
|
423 |
-
|
424 |
obj.values[ 1 ] = params.shift() || '';
|
425 |
obj.values[ 2 ] = params.shift() || '';
|
426 |
stop1 = params.shift() || '';
|
@@ -435,7 +434,7 @@
|
|
435 |
obj.values[ 0 ] = value;
|
436 |
}
|
437 |
}
|
438 |
-
|
439 |
return obj;
|
440 |
},
|
441 |
|
@@ -457,7 +456,7 @@
|
|
457 |
|
458 |
setup_menus: function() {
|
459 |
var self = this;
|
460 |
-
//console.log( 'setup_menus' );
|
461 |
self.setup_query_menu();
|
462 |
self.setup_selector_menu();
|
463 |
self.setup_rule_menu();
|
@@ -470,35 +469,35 @@
|
|
470 |
|
471 |
load_queries: function() {
|
472 |
var self = this;
|
473 |
-
//console.log( 'load_queries' );
|
474 |
// retrieve unique media queries
|
475 |
self.query_css( 'queries', null );
|
476 |
},
|
477 |
|
478 |
load_selectors: function() {
|
479 |
var self = this;
|
480 |
-
//console.log( 'load_selectors' );
|
481 |
// retrieve unique selectors from query value
|
482 |
self.query_css( 'selectors', self.currquery );
|
483 |
},
|
484 |
|
485 |
load_rules: function() {
|
486 |
var self = this;
|
487 |
-
//console.log( 'load_rules' );
|
488 |
// retrieve all unique rules
|
489 |
self.query_css( 'rules', null );
|
490 |
},
|
491 |
|
492 |
load_selector_values: function() {
|
493 |
var self = this;
|
494 |
-
//console.log( 'load_selector_values: ' + self.currqsid );
|
495 |
// retrieve individual values from qsid
|
496 |
self.query_css( 'qsid', self.currqsid );
|
497 |
},
|
498 |
|
499 |
get_queries: function( request, response ) {
|
500 |
-
//console.log( 'get_queries' );
|
501 |
-
//console.log( this );
|
502 |
var //self = this,
|
503 |
arr = [],
|
504 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
@@ -516,7 +515,7 @@
|
|
516 |
},
|
517 |
|
518 |
get_selectors: function( request, response ) {
|
519 |
-
//console.log( 'get_selectors' );
|
520 |
var //self = this,
|
521 |
arr = [],
|
522 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
@@ -534,7 +533,7 @@
|
|
534 |
},
|
535 |
|
536 |
get_rules: function( request, response ) {
|
537 |
-
//console.log( 'get_rules' );
|
538 |
var //self = this,
|
539 |
arr = [],
|
540 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
@@ -552,7 +551,7 @@
|
|
552 |
},
|
553 |
|
554 |
get_filtered_rules: function( request, response ) {
|
555 |
-
//console.log( 'get_filtered_rules' );
|
556 |
var arr = [],
|
557 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); //,
|
558 |
$.each( $( '#ctc_rule_menu' ).data( 'menu' ), function( key, val ) {
|
@@ -569,11 +568,11 @@
|
|
569 |
* this function puts them into parent/child columns by rulevalid
|
570 |
*/
|
571 |
merge_ruleval_arrays: function( rule, value, isnew ) {
|
572 |
-
|
573 |
var self = this,
|
574 |
valarr = {},
|
575 |
nextval = isnew ? value.child.pop() : null; // if new rule, pop off the top before counting
|
576 |
-
|
577 |
$.each( [ 'parnt', 'child' ], function( ndx, themetype ) {
|
578 |
// iterate through parent and child val arrays and populate new assoc array with parent/child for each rulevalid
|
579 |
if ( !self.is_empty( value[ themetype ] ) ) {
|
@@ -613,7 +612,7 @@
|
|
613 |
* isnew is passed true when new rule is selected from menu
|
614 |
*/
|
615 |
input_row: function( qsid, rule, seq, data, isnew ) {
|
616 |
-
//console.log( 'in input_row' );
|
617 |
var self = this,
|
618 |
html = '';
|
619 |
if ( !self.is_empty( data ) && !self.is_empty( data.value ) && !self.is_empty( data.value[ rule ] ) ) {
|
@@ -682,11 +681,11 @@
|
|
682 |
|
683 |
css_preview: function( theme ) {
|
684 |
var self = this;
|
685 |
-
//console.log( 'css_preview: ' + theme );
|
686 |
if ( !( theme = theme.match( /(child|parnt)/ )[ 1 ] ) ) {
|
687 |
theme = 'child';
|
688 |
}
|
689 |
-
//console.log( 'css_preview: ' + theme );
|
690 |
// retrieve raw stylesheet ( parent or child )
|
691 |
self.query_css( 'preview', theme );
|
692 |
},
|
@@ -724,7 +723,7 @@
|
|
724 |
hideAfterPaletteSelect: true,
|
725 |
} ).on( 'change', function( ){
|
726 |
//var color = $( this ).spectrum( 'get' );
|
727 |
-
//console.log( 'color change: ' + color );
|
728 |
self.coalesce_inputs( this );
|
729 |
} ).on( 'keyup', function( ) {
|
730 |
// update spectrum ui to match text input after half-second delay
|
@@ -761,7 +760,7 @@
|
|
761 |
|
762 |
setup_query_menu: function() {
|
763 |
var self = this;
|
764 |
-
//console.log( 'setup_query_menu' );
|
765 |
try {
|
766 |
$( '#ctc_sel_ovrd_query' ).autocomplete( {
|
767 |
source: self.get_queries,
|
@@ -791,7 +790,7 @@
|
|
791 |
|
792 |
setup_selector_menu: function() {
|
793 |
var self = this;
|
794 |
-
//console.log( 'setup_selector_menu' );
|
795 |
try {
|
796 |
$( '#ctc_sel_ovrd_selector' ).autocomplete( {
|
797 |
source: self.get_selectors,
|
@@ -819,7 +818,7 @@
|
|
819 |
|
820 |
setup_rule_menu: function() {
|
821 |
var self = this;
|
822 |
-
//console.log( 'setup_rule_menu' );
|
823 |
try {
|
824 |
$( '#ctc_rule_menu' ).autocomplete( {
|
825 |
source: self.get_rules,
|
@@ -848,13 +847,13 @@
|
|
848 |
selectFirst: true,
|
849 |
autoFocus: true,
|
850 |
select: function( e, ui ) {
|
851 |
-
//console.log( 'new rule selected' );
|
852 |
e.preventDefault();
|
853 |
var newrule = ui.item.label.replace( /[^\w\-]/g, self.toascii ),
|
854 |
row,
|
855 |
first;
|
856 |
-
//console.log( 'current qsdata before:' );
|
857 |
-
//console.log( self.currdata );
|
858 |
if ( self.is_empty( self.currdata.value ) ) {
|
859 |
self.currdata.value = {};
|
860 |
}
|
@@ -864,8 +863,8 @@
|
|
864 |
if ( self.is_empty( self.currdata.value[ ui.item.label ].child ) ) {
|
865 |
self.currdata.value[ ui.item.label ].child = [];
|
866 |
}
|
867 |
-
//console.log( 'current qsdata after:' );
|
868 |
-
//console.log( self.currdata );
|
869 |
// seed current qsdata with new blank value with id 1
|
870 |
// this will be modified during input_row function to be next id in order
|
871 |
self.currdata.value[ ui.item.label ].child.push( [ '', 0, 1, 1 ] );
|
@@ -912,7 +911,7 @@
|
|
912 |
$( '#ctc_configure_submit .ctc-step' ).text( '9' );
|
913 |
if ( $( '#ctc_theme_child' ).length && !$( '#ctc_child_type_new' ).is( ':checked' ) ) {
|
914 |
themedir = $( '#ctc_theme_child' ).val();
|
915 |
-
//console.log( 'update_form (existing) ... ' + themedir );
|
916 |
self.existing = 1;
|
917 |
self.currparnt = window.ctcAjax.themes.child[ themedir ].Template;
|
918 |
self.autogen_slugs();
|
@@ -948,9 +947,9 @@
|
|
948 |
//themedir = $( '#ctc_theme_parnt' ).val();
|
949 |
$( '#ctc_theme_parnt' ).val( self.currparnt );
|
950 |
$( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( $.chldthmcfg.getname( 'parnt' ) );
|
951 |
-
//console.log( 'update_form (new) ... ' + self.currparnt );
|
952 |
//self.set_parent_menu( document.getElementById( 'ctc_theme_parnt' ) );
|
953 |
-
//console.log( 'setting to new...' + $( '#ctc_theme_parnt' ).val() );
|
954 |
self.set_theme_params( 'parnt', self.currparnt );
|
955 |
$( '#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug' ).slideUp( 'fast' );
|
956 |
$( '#input_row_new_theme_option' ).slideDown( 'fast' );
|
@@ -999,7 +998,7 @@
|
|
999 |
if ( self.is_empty( value ) ) {
|
1000 |
return false;
|
1001 |
}
|
1002 |
-
//console.log( 'set_query: ' + value );
|
1003 |
self.currquery = value;
|
1004 |
$( '#ctc_sel_ovrd_query' ).val( '' );
|
1005 |
$( '#ctc_sel_ovrd_query_selected' ).text( value );
|
@@ -1014,7 +1013,7 @@
|
|
1014 |
* added v2.3.0
|
1015 |
*/
|
1016 |
reset_qsid: function(){
|
1017 |
-
//console.log( 'resetting all qsid inputs...' );
|
1018 |
self.currqsid = null;
|
1019 |
$( '#ctc_sel_ovrd_rule_inputs' ).empty();
|
1020 |
$( '#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container' ).hide().find( '.ctc-child-value' ).remove();
|
@@ -1027,7 +1026,7 @@
|
|
1027 |
if ( self.is_empty( value ) ) {
|
1028 |
return false;
|
1029 |
}
|
1030 |
-
//console.log( 'set_selector: ' + value + ' label: ' + label );
|
1031 |
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
1032 |
self.currqsid = value;
|
1033 |
self.reload = false;
|
@@ -1036,7 +1035,7 @@
|
|
1036 |
},
|
1037 |
|
1038 |
set_rule: function( value, label ) {
|
1039 |
-
//console.log( 'set_rule: ' + value + ' label: ' + label );
|
1040 |
var self = this;
|
1041 |
if ( self.is_empty( value ) ) {
|
1042 |
return false;
|
@@ -1052,7 +1051,7 @@
|
|
1052 |
|
1053 |
set_qsid: function( obj ) {
|
1054 |
var self = this;
|
1055 |
-
//console.log( 'set_qsid: ' + $( obj ).attr( 'id' ) );
|
1056 |
self.currqsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[ 1 ];
|
1057 |
self.focus_panel( '#query_selector_options' );
|
1058 |
self.reload = true;
|
@@ -1063,7 +1062,7 @@
|
|
1063 |
* Retrieve data from server and execute callback on completion
|
1064 |
*/
|
1065 |
query_css: function( obj, key, params ) {
|
1066 |
-
//console.log( 'query_css: ' + obj + ' key: ' + key );
|
1067 |
var self = this,
|
1068 |
postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
|
1069 |
status_sel = '#ctc_status_' + obj + ( 'val_qry' === obj ? '_' + key : '' );
|
@@ -1074,25 +1073,25 @@
|
|
1074 |
} );
|
1075 |
}
|
1076 |
$( '.query-icon,.ctc-status-icon' ).remove();
|
1077 |
-
//console.log( status_sel + ' ' + $( status_sel ).length );
|
1078 |
$( status_sel + ' .ctc-status-icon' ).remove();
|
1079 |
$( status_sel ).append( '<span class="ctc-status-icon spinner is-active query-icon"></span>' );
|
1080 |
// add wp ajax action to array
|
1081 |
-
//console.log( $( '#ctc_action' ).val() );
|
1082 |
postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
|
1083 |
'plugin' === $( '#ctc_action' ).val() ) ?
|
1084 |
'ctc_plgqry' : 'ctc_query';
|
1085 |
postdata._wpnonce = $( '#_wpnonce' ).val();
|
1086 |
// ajax post input data
|
1087 |
-
//console.log( 'query_css postdata:' );
|
1088 |
-
//console.log( postdata );
|
1089 |
self.ajax_post( obj, postdata );
|
1090 |
},
|
1091 |
/**
|
1092 |
* Post data to server for saving and execute callback on completion
|
1093 |
*/
|
1094 |
save: function( obj ) {
|
1095 |
-
//console.log( 'save: ' + $( obj ).attr( 'id' ) );
|
1096 |
var self = this,
|
1097 |
postdata = {},
|
1098 |
$selector,
|
@@ -1147,22 +1146,22 @@
|
|
1147 |
$( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
|
1148 |
} );
|
1149 |
// add wp ajax action to array
|
1150 |
-
//console.log( $( '#ctc_action' ).val() );
|
1151 |
postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
|
1152 |
'plugin' === $( '#ctc_action' ).val() ) ?
|
1153 |
'ctc_plugin' : 'ctc_update';
|
1154 |
postdata._wpnonce = $( '#_wpnonce' ).val();
|
1155 |
-
//console.log( postdata );
|
1156 |
// ajax post input data
|
1157 |
self.ajax_post( 'qsid', postdata );
|
1158 |
},
|
1159 |
|
1160 |
ajax_post: function( obj, data, datatype ) {
|
1161 |
var self = this;
|
1162 |
-
//console.log( 'ajax_post: ' + obj );
|
1163 |
-
//console.log( data );
|
1164 |
-
//console.log( window.ctcAjax.ajaxurl );
|
1165 |
-
//console.log( window.ctcAjax.ajaxurl );
|
1166 |
// get ajax url from localized object
|
1167 |
$.ajax( {
|
1168 |
url: window.ctcAjax.ajaxurl,
|
@@ -1174,11 +1173,11 @@
|
|
1174 |
( self.is_empty( datatype ) ? 'json' : datatype ),
|
1175 |
type: 'POST'
|
1176 |
} ).done( function( response ) {
|
1177 |
-
//console.log( response );
|
1178 |
self.handle_success( obj, response );
|
1179 |
} ).fail( function() { // jxr, status, err ) {
|
1180 |
-
//console.log( status );
|
1181 |
-
//console.log( err );
|
1182 |
self.handle_failure( obj );
|
1183 |
} ).always( function() {
|
1184 |
if ( self.jqueryerr.length ) {
|
@@ -1189,7 +1188,7 @@
|
|
1189 |
|
1190 |
handle_failure: function( obj ) {
|
1191 |
var self = this;
|
1192 |
-
//console.log( 'handle_failure: ' + obj );
|
1193 |
$( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
|
1194 |
$( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
|
1195 |
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
@@ -1203,8 +1202,8 @@
|
|
1203 |
handle_success: function( obj, response ) {
|
1204 |
var self = this;
|
1205 |
// query response
|
1206 |
-
//console.log( 'handle_success: ' + obj );
|
1207 |
-
//console.log( response );
|
1208 |
// hide spinner
|
1209 |
$( '.query-icon, .save-icon' ).removeClass( 'spinner' );
|
1210 |
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
@@ -1221,10 +1220,10 @@
|
|
1221 |
// update ui from each response object
|
1222 |
$( response ).each( function() {
|
1223 |
if ( 'function' === typeof self.update[ this.obj ] ) {
|
1224 |
-
//console.log( 'executing method update.' + this.obj );
|
1225 |
self.update[ this.obj ].call( self, this );
|
1226 |
} else {
|
1227 |
-
//console.log( 'Fail: no method update.' + this.obj );
|
1228 |
}
|
1229 |
} );
|
1230 |
}
|
@@ -1235,11 +1234,11 @@
|
|
1235 |
ln = self.is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
|
1236 |
fn = self.is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[ 0 ];
|
1237 |
self.jqueryerr.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
|
1238 |
-
//console.log( 'jquery error detected' );
|
1239 |
},
|
1240 |
|
1241 |
jquery_notice: function( fn ) {
|
1242 |
-
//console.log( fn );
|
1243 |
fn = null;
|
1244 |
var self = this,
|
1245 |
culprits = [],
|
@@ -1284,8 +1283,8 @@
|
|
1284 |
id, html, val, empty;
|
1285 |
self.currqsid = res.key;
|
1286 |
self.currdata = res.data;
|
1287 |
-
//console.log( 'update: ' + self.reload );
|
1288 |
-
//console.log( 'update.qsid: ' + self.currqsid );
|
1289 |
$( '#ctc_sel_ovrd_qsid' ).val( self.currqsid );
|
1290 |
if ( self.is_empty( self.currdata.seq ) ) {
|
1291 |
$( '#ctc_child_load_order_container' ).empty();
|
@@ -1297,13 +1296,13 @@
|
|
1297 |
$( '#ctc_child_load_order_container' ).html( html );
|
1298 |
}
|
1299 |
if ( self.is_empty( self.currdata.value ) ) {
|
1300 |
-
//console.log( 'qsdata is empty' );
|
1301 |
empty = true;
|
1302 |
$( '#ctc_sel_ovrd_rule_inputs' ).empty();
|
1303 |
// prune empty selectors after clearing data to prune
|
1304 |
self.load_selectors();
|
1305 |
} else {
|
1306 |
-
//console.log( 'qsdata NOT empty' );
|
1307 |
empty = false;
|
1308 |
html = '';
|
1309 |
$.each( self.currdata.value, function( rule, value ) {
|
@@ -1318,7 +1317,7 @@
|
|
1318 |
// if ( self.jqueryerr.length ) {
|
1319 |
// self.jquery_notice( 'update.qsid' );
|
1320 |
// } else {
|
1321 |
-
//console.log( 'reload menus: ' + ( self.reload ? 'true' : 'false' ) );
|
1322 |
if ( self.reload ) {
|
1323 |
self.load_queries();
|
1324 |
self.load_selectors();
|
@@ -1344,12 +1343,12 @@
|
|
1344 |
},
|
1345 |
// render list of unique values for given rule on Property/Value tab
|
1346 |
rule_val: function( res ) {
|
1347 |
-
//console.log( 'update.rule_val: ' + res.key );
|
1348 |
-
//console.log( res.data );
|
1349 |
var self = this,
|
1350 |
rule = $( '#ctc_rule_menu_selected' ).text(),
|
1351 |
html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + "\n";
|
1352 |
-
//console.log( 'rule: ' + rule );
|
1353 |
if ( !self.is_empty( res.data ) ) {
|
1354 |
$.each( res.data, function( valid, value ) {
|
1355 |
var parentObj = self.decode_value( rule, value );
|
@@ -1385,8 +1384,8 @@
|
|
1385 |
},
|
1386 |
// render list of selectors grouped by query for given value on Property/Value Tab
|
1387 |
val_qry: function( res ) {
|
1388 |
-
//console.log( 'in val_qry' );
|
1389 |
-
//console.log( res );
|
1390 |
var self = this,
|
1391 |
html = '',
|
1392 |
page_rule,
|
@@ -1405,7 +1404,7 @@
|
|
1405 |
} );
|
1406 |
}
|
1407 |
selector = '#ctc_selector_' + page_rule + '_' + res.key + '_rows';
|
1408 |
-
//console.log( selector );
|
1409 |
|
1410 |
$( selector ).html( html ).find( '.color-picker' ).each( function() {
|
1411 |
self.setup_spectrum( this );
|
@@ -1432,16 +1431,16 @@
|
|
1432 |
// render debug output
|
1433 |
debug: function( res ) {
|
1434 |
$( '#ctc_debug_box' ).val( $( '#ctc_debug_box' ).val() + res.data );
|
1435 |
-
//console.log( 'debug:' );
|
1436 |
-
//console.log( res.data );
|
1437 |
},
|
1438 |
// render stylesheet preview on child or parent css tab
|
1439 |
preview: function( res ) {
|
1440 |
$( '#view_' + res.key + '_options_panel' ).text( res.data );
|
1441 |
},
|
1442 |
dismiss: function() { // res ) {
|
1443 |
-
//console.log( 'dismiss came home!' );
|
1444 |
-
//console.log( res );
|
1445 |
//var self = this;
|
1446 |
//self.dismiss_notice();
|
1447 |
}
|
@@ -1449,7 +1448,7 @@
|
|
1449 |
},
|
1450 |
// applies core dismiss behavior to injected elements
|
1451 |
bind_dismiss: function( el ) {
|
1452 |
-
//console.log( 'bind_dismiss' );
|
1453 |
var self = this,
|
1454 |
$this = $( el ),
|
1455 |
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
|
@@ -1473,7 +1472,7 @@
|
|
1473 |
});
|
1474 |
},
|
1475 |
reset_handling: function() {
|
1476 |
-
//console.log( '----> resetting form...' );
|
1477 |
$( '#parnt_analysis_notice .notice, #child_analysis_notice .notice' ).slideUp();
|
1478 |
$( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
|
1479 |
$( '#ctc_handling_primary' ).prop( 'checked', true );
|
@@ -1482,13 +1481,13 @@
|
|
1482 |
},
|
1483 |
// initialize object vars, bind event listeners to elements, load menus and start plugin
|
1484 |
init: function() {
|
1485 |
-
//console.log( 'initializing...' )
|
1486 |
var self = this;
|
1487 |
//self.jquery_exception( { 'message':'testing' }, 'Testing' );
|
1488 |
// try to initialize theme menus
|
1489 |
if ( !$( '#ctc_theme_parnt' ).is( 'input' ) ) {
|
1490 |
|
1491 |
-
//console.log( 'initializing theme select menus...' );
|
1492 |
try {
|
1493 |
$.widget( 'ctc.themeMenu', $.ui.selectmenu, {
|
1494 |
_renderItem: function( ul, item ) {
|
@@ -1556,7 +1555,7 @@
|
|
1556 |
} );
|
1557 |
|
1558 |
$( '#ctc_main' ).on( 'click', '.ctc-upgrade-notice .notice-dismiss', function() { // e ) {
|
1559 |
-
//console.log( 'dismiss upgrade clicked!' );
|
1560 |
//e.preventDefault();
|
1561 |
var postdata = {
|
1562 |
'action': 'ctc_dismiss',
|
@@ -1566,7 +1565,7 @@
|
|
1566 |
} );
|
1567 |
|
1568 |
if ( self.is_empty( self.jqueryerr ) ){
|
1569 |
-
//console.log( 'delegating event bindings...' )
|
1570 |
$( '#ctc_main' ).on( 'click', '.ctc-selector-handle', function( e ) {
|
1571 |
//'.ctc-option-panel-container'
|
1572 |
e.preventDefault();
|
@@ -1603,11 +1602,11 @@
|
|
1603 |
|
1604 |
$( '#ctc_main' ).on( 'keydown', '.ctc-selector-container .ctc-child-value[type=text]', function( e ) {
|
1605 |
if ( 13 === e.which ) {
|
1606 |
-
//console.log( 'return key pressed' );
|
1607 |
var $obj = $( this ).parents( '.ctc-selector-row' ).find( '.ctc-save-input[type=button]' ).first();
|
1608 |
if ( $obj.length ) {
|
1609 |
e.preventDefault();
|
1610 |
-
//console.log( $obj.attr( 'id' ) );
|
1611 |
if ( $obj.hasClass( 'ajax-pending' ) ) {
|
1612 |
return false;
|
1613 |
}
|
@@ -1647,7 +1646,7 @@
|
|
1647 |
} else {
|
1648 |
$( '#ctc_export_theme' ).val( self.currparnt );
|
1649 |
}
|
1650 |
-
//console.log( 'backup clicked - theme: ' + $( '#ctc_export_theme' ).val() );
|
1651 |
// submit form
|
1652 |
$( '#ctc_export_theme_form' ).submit();
|
1653 |
// submit form
|
@@ -1710,7 +1709,7 @@
|
|
1710 |
} );
|
1711 |
|
1712 |
$( '#ctc_rule_value_form' ).on( 'submit', function( e ) {
|
1713 |
-
//console.log( 'rule value empty submit' );
|
1714 |
e.preventDefault();
|
1715 |
return false;
|
1716 |
} );
|
@@ -1718,7 +1717,7 @@
|
|
1718 |
// update interface for existing child theme
|
1719 |
$( '#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset' )
|
1720 |
.on( 'focus click', function() {
|
1721 |
-
//console.log( 'child type clicked!' );
|
1722 |
self.reset_handling();
|
1723 |
self.update_form();
|
1724 |
} );
|
@@ -1740,16 +1739,16 @@
|
|
1740 |
document.location = $( this ).prop( 'href' );
|
1741 |
return false;
|
1742 |
} );
|
1743 |
-
//console.log( 'loading autoselect menus...' )
|
1744 |
// initialize autoselect menus
|
1745 |
self.setup_menus();
|
1746 |
|
1747 |
// turn on submit buttons (disabled until everything is loaded to prevent errors)
|
1748 |
-
//console.log( 'releasing submit buttons...' )
|
1749 |
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
1750 |
self.scrolltop();
|
1751 |
self.update_form();
|
1752 |
-
//console.log( 'Ready.' );
|
1753 |
}
|
1754 |
if ( self.jqueryerr.length ) {
|
1755 |
self.jquery_notice();
|
@@ -1777,7 +1776,7 @@
|
|
1777 |
},
|
1778 |
|
1779 |
trmcss: function( str ) {
|
1780 |
-
//console.log( 'trmcss: ' + str );
|
1781 |
return 'undefined' === typeof str ? '' : str.replace( /\-css$/, '' );
|
1782 |
},
|
1783 |
show_loading: function( resubmit, text ) {
|
@@ -1803,7 +1802,7 @@
|
|
1803 |
* which executes an http request on the server side. If both methods fail, notify user.
|
1804 |
*/
|
1805 |
analyze_theme: function( themetype ) {
|
1806 |
-
//console.log( 'analyze_theme' );
|
1807 |
var self = this,
|
1808 |
now = Math.floor( $.now() / 1000 ),
|
1809 |
stylesheet = ( 'child' === themetype ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
|
@@ -1816,15 +1815,15 @@
|
|
1816 |
/**
|
1817 |
* First, try to fetch home page using ajax get
|
1818 |
*/
|
1819 |
-
//console.log( 'Fetching home page: ' + url );
|
1820 |
$.get( url, function( data ) {
|
1821 |
-
//console.log( data );
|
1822 |
self.parse_page( themetype, data );
|
1823 |
$( document ).trigger( 'analysisdone' );
|
1824 |
} ).fail( function( xhr, status, err ){
|
1825 |
-
//console.log( status );
|
1826 |
-
//console.log( err );
|
1827 |
-
//console.log( xhr );
|
1828 |
/**
|
1829 |
* if this fails due to cross domain or other issue,
|
1830 |
* try fetching using ajax call that requests page on server side.
|
@@ -1855,7 +1854,7 @@
|
|
1855 |
/**
|
1856 |
* if xhr fails both times there is a bigger problem.
|
1857 |
*/
|
1858 |
-
//console.log( xhr );
|
1859 |
self.analysis[ themetype ].signals.failure = 1;
|
1860 |
self.analysis[ themetype ].signals.xhrajaxerr = err;
|
1861 |
$( document ).trigger( 'analysisdone' );
|
@@ -1887,13 +1886,13 @@
|
|
1887 |
// retrieve enqueued stylesheet ids
|
1888 |
if ( ( queue = body.match( /BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/ ) ) ) {
|
1889 |
self.analysis[ themetype ].queue = queue[ 1 ].split(/\n/);
|
1890 |
-
//console.log( 'QUEUE:' );
|
1891 |
-
//console.log( self.analysis[ themetype ].queue );
|
1892 |
} else {
|
1893 |
self.analysis[ themetype ].queue = [];
|
1894 |
self.analysis[ themetype ].signals.thm_noqueue = 1;
|
1895 |
//self.analysis[ themetype ].signals.failure = 1;
|
1896 |
-
//console.log( 'NO QUEUE' );
|
1897 |
}
|
1898 |
if ( ( queue = body.match( /BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/ ) ) ) {
|
1899 |
self.analysis[ themetype ].irreg = queue[ 1 ].split(/\n/);
|
@@ -1955,8 +1954,8 @@
|
|
1955 |
linktheme = $.chldthmcfg.currparnt === stylesheettheme ? 'parnt' : 'child',
|
1956 |
noid = 0;
|
1957 |
// console.log( 'stylesheetid: ' + stylesheetid + ' stylesheetpath: ' + stylesheetpath );
|
1958 |
-
|
1959 |
-
if ( '' === stylesheetid || -1 ===
|
1960 |
noid = 1;
|
1961 |
// console.log( 'no id for ' + stylesheetpath + ' in ' + themetype + '!' );
|
1962 |
} else if ( 0 === stylesheetid.indexOf( 'chld_thm_cfg' ) ) { // handle ctc-generated links
|
@@ -1979,15 +1978,15 @@
|
|
1979 |
} else {
|
1980 |
// console.log( 'adding external stylesheet dependency' );
|
1981 |
self.analysis[ themetype ].signals.ctc_ext_loaded = 1; // flag that external stylesheet link detected
|
1982 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
|
1983 |
}
|
1984 |
} else if ( 'chld_thm_cfg_child' === stylesheetid ) {
|
1985 |
self.analysis[ themetype ].signals.ctc_child_loaded = 1; // flag that ctc child stylesheet link detected
|
1986 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
|
1987 |
// console.log( 'signal: ctc_child_loaded' );
|
1988 |
} else if ( 'chld_thm_cfg_parent' === stylesheetid ) {
|
1989 |
self.analysis[ themetype ].signals.ctc_parnt_loaded = 1; // flag that ctc parent stylesheet link detected
|
1990 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
|
1991 |
// console.log( 'signal: ctc_parnt_loaded' );
|
1992 |
if ( themeloaded ){
|
1993 |
// console.log( 'parent link out of sequence' );
|
@@ -2021,18 +2020,18 @@
|
|
2021 |
if ( noid ) {
|
2022 |
if ( testloaded ) {
|
2023 |
self.analysis[ themetype ].signals.thm_past_wphead = 1;
|
2024 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ 'thm_past_wphead', stylesheetpath ] );
|
2025 |
// console.log( 'signal: thm_past_wphead (Unreachable theme stylesheet detected ' + stylesheetpath );
|
2026 |
} else {
|
2027 |
self.analysis[ themetype ].signals.thm_unregistered = 1;
|
2028 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ 'thm_unregistered', stylesheetpath ] );
|
2029 |
// console.log( 'signal: thm_unregistered (Unregistered theme stylesheet detected) ' + stylesheetpath );
|
2030 |
}
|
2031 |
} else {
|
2032 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
|
2033 |
// console.log( 'Theme stylesheet OK! ' + stylesheetid + ' ' + stylesheetpath );
|
2034 |
}
|
2035 |
-
|
2036 |
} else if ( stylesheetpath.match( /rtl.*?\.css$/ ) ) {
|
2037 |
self.analysis[ themetype ].signals.thm_rtl = 1;
|
2038 |
} else if ( 'ctc-test.css' === stylesheetpath ) { // flag test stylesheet link
|
@@ -2061,7 +2060,7 @@
|
|
2061 |
} else {
|
2062 |
self.dependencies[ stylesheetid ] = stylesheetpath;
|
2063 |
}
|
2064 |
-
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath ] );
|
2065 |
}
|
2066 |
}
|
2067 |
if ( ! themeloaded ){
|
@@ -2076,7 +2075,7 @@
|
|
2076 |
* for child theme setup and display results to user.
|
2077 |
*/
|
2078 |
css_notice: function() {
|
2079 |
-
//console.log( 'in css_notice' );
|
2080 |
var self = this,
|
2081 |
themetype = $.chldthmcfg.existing ? 'child' : 'parnt',
|
2082 |
name = $.chldthmcfg.getname( themetype ),
|
@@ -2095,8 +2094,9 @@
|
|
2095 |
anlz,
|
2096 |
debugtxt = '',
|
2097 |
dep_inputs,
|
|
|
2098 |
errflags = {};
|
2099 |
-
|
2100 |
if ( self.analysis[ themetype ].signals.failure ||
|
2101 |
( self.analysis[ themetype ].signals.thm_noqueue && !self.phperr[ themetype ].length ) ) {
|
2102 |
//if ( $( '#ctc_is_debug' ).is( ':checked' ) ) {
|
@@ -2108,7 +2108,7 @@
|
|
2108 |
style: 'notice-warning'
|
2109 |
} );
|
2110 |
} else {
|
2111 |
-
// test errors
|
2112 |
if ( self.phperr[ themetype ].length ) {
|
2113 |
$.each( self.phperr[ themetype ], function( index, err ) {
|
2114 |
if ( err.match( /Fatal error/i ) ) {
|
@@ -2119,16 +2119,18 @@
|
|
2119 |
}
|
2120 |
/*
|
2121 |
if ( $.chldthmcfg.existing && err.match( /(FileNotFoundException|Failed opening|failed to open stream)/i ) ) {
|
2122 |
-
//console.log( 'Probably using get_stylesheet_directory()' );
|
2123 |
notice.subhead = 'A file cannot be found in the Child Theme\'s directory.';
|
2124 |
}
|
2125 |
*/
|
2126 |
errnotice.errlist += err + "\n";
|
2127 |
} );
|
|
|
2128 |
if ( errflags.fatal ){
|
2129 |
errnotice.style = 'error';
|
2130 |
errnotice.headline = $.chldthmcfg.getxt( 'anlz8', name );
|
2131 |
}
|
|
|
2132 |
if ( errflags.config ){
|
2133 |
errnotice.msg = $.chldthmcfg.getxt( 'anlzconfig', name ) + errnotice.msg;
|
2134 |
}
|
@@ -2148,6 +2150,7 @@
|
|
2148 |
msg: $.chldthmcfg.getxt( 'anlzcache2' )
|
2149 |
} );
|
2150 |
} else if ( !self.analysis[ themetype ].signals.thm_noqueue ) { // !errflags.fatal &&
|
|
|
2151 |
if ( self.analysis[ themetype ].signals.thm_past_wphead || self.analysis[ themetype ].signals.dep_past_wphead ) {
|
2152 |
// || self.analysis[ themetype ].signals.css_past_wphead ){
|
2153 |
notice.notices.push( {
|
@@ -2158,6 +2161,7 @@
|
|
2158 |
$( '#ctc_repairheader' ).prop( 'checked', true );
|
2159 |
$( '#ctc_repairheader_container' ).show();
|
2160 |
}
|
|
|
2161 |
if ( self.analysis[ themetype ].signals.thm_unregistered ) {
|
2162 |
if (
|
2163 |
!self.analysis[ themetype ].signals.ctc_child_loaded &&
|
@@ -2173,10 +2177,13 @@
|
|
2173 |
}
|
2174 |
}
|
2175 |
if ( 'child' === themetype ) {
|
|
|
2176 |
if ( self.analysis.child.signals.ctc_parnt_reorder ) {
|
2177 |
// console.log( 'reorder flag detected, resubmitting.' );
|
|
|
2178 |
resubmit = 1;
|
2179 |
}
|
|
|
2180 |
if ( !self.analysis.child.signals.ctc_child_loaded &&
|
2181 |
!self.analysis.child.signals.ctc_sep_loaded &&
|
2182 |
!self.analysis.child.signals.thm_child_loaded ){
|
@@ -2185,8 +2192,10 @@
|
|
2185 |
style: 'notice-warning',
|
2186 |
msg: $.chldthmcfg.getxt( 'anlz14' )
|
2187 |
} );
|
|
|
2188 |
resubmit = 1;
|
2189 |
}
|
|
|
2190 |
if ( self.analysis[ themetype ].signals.ctc_gen_loaded ) {
|
2191 |
notice.notices.push( {
|
2192 |
headline: $.chldthmcfg.getxt( 'anlz31' ),
|
@@ -2194,6 +2203,7 @@
|
|
2194 |
style: 'notice-warning'
|
2195 |
} );
|
2196 |
}
|
|
|
2197 |
if ( !self.analysis.parnt.signals.thm_no_styles &&
|
2198 |
!self.analysis.child.signals.ctc_gen_loaded &&
|
2199 |
!self.analysis.child.signals.thm_parnt_loaded &&
|
@@ -2205,8 +2215,10 @@
|
|
2205 |
style: 'notice-warning',
|
2206 |
msg: $.chldthmcfg.getxt( 'anlz16' )
|
2207 |
} );
|
|
|
2208 |
resubmit = 1;
|
2209 |
}
|
|
|
2210 |
if ( self.analysis.child.signals.thm_unregistered &&
|
2211 |
self.analysis.child.signals.thm_child_loaded &&
|
2212 |
'thm_unregistered' === self.analysis.child.signals.thm_child_loaded &&
|
@@ -2220,7 +2232,7 @@
|
|
2220 |
$( '#ctc_repairheader_container' ).show();
|
2221 |
$( '#ctc_repairheader' ).prop( 'checked', true );
|
2222 |
}
|
2223 |
-
|
2224 |
if ( !self.analysis.child.signals.thm_is_ctc &&
|
2225 |
!$( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
|
2226 |
notice.notices.push( {
|
@@ -2229,21 +2241,34 @@
|
|
2229 |
style: 'notice-warning'
|
2230 |
} );
|
2231 |
}
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
headline: $.chldthmcfg.getxt( 'anlzrtl' ),
|
2236 |
-
msg: $.chldthmcfg.getxt( 'anlzrtl2' ),
|
2237 |
-
style: 'notice-warning'
|
2238 |
-
} );
|
2239 |
-
}
|
2240 |
|
|
|
|
|
|
|
2241 |
}
|
2242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2243 |
if ( self.analysis[ themetype ].signals.ctc_sep_loaded || self.analysis[ themetype ].signals.ctc_gen_loaded ){
|
2244 |
-
//console.log( 'Separate stylesheet detected' );
|
2245 |
$( '#ctc_handling_separate' ).prop( 'checked', true );
|
2246 |
}
|
|
|
2247 |
if ( !notice.notices.length ) {
|
2248 |
notice.notices.push( {
|
2249 |
headline: '' + ( 'child' === themetype ? $.chldthmcfg.getxt( 'anlz17' ) : $.chldthmcfg.getxt( 'anlz18' ) ) + '',
|
@@ -2251,27 +2276,31 @@
|
|
2251 |
msg: ''
|
2252 |
} );
|
2253 |
}
|
2254 |
-
|
2255 |
if ( 'child' === themetype && self.analysis.child.signals.thm_has_import ) {
|
2256 |
notice.notices.push( {
|
2257 |
headline: $.chldthmcfg.getxt( 'anlz21' ),
|
2258 |
msg: $.chldthmcfg.getxt( 'anlz22' ),
|
2259 |
style: 'notice-warning'
|
2260 |
} );
|
2261 |
-
//console.log( 'Import parent detected' );
|
2262 |
$( '#ctc_enqueue_import' ).prop( 'checked', true );
|
2263 |
}
|
|
|
2264 |
if ( self.analysis[ themetype ].signals.thm_ignoreparnt || self.analysis[ themetype ].signals.ctc_gen_loaded ){
|
2265 |
-
//console.log( 'Ignore parent detected' );
|
2266 |
$( '#ctc_ignoreparnt' ).prop( 'checked', true );
|
|
|
2267 |
if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2268 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
|
|
2269 |
resubmit = 1;
|
2270 |
resubmitdata.ctc_enqueue = 'none';
|
2271 |
}
|
2272 |
} else {
|
2273 |
$( '#ctc_ignoreparnt' ).prop( 'checked', false );
|
2274 |
}
|
|
|
2275 |
if ( !self.analysis[ themetype ].signals.ctc_sep_loaded &&
|
2276 |
!self.analysis[ themetype ].signals.ctc_gen_loaded &&
|
2277 |
!self.analysis[ themetype ].signals.ctc_child_loaded &&
|
@@ -2281,7 +2310,7 @@
|
|
2281 |
var sheets = '';
|
2282 |
$.each( self.analysis[ themetype ].deps[ 1 ], function( ndx, el ) {
|
2283 |
if ( el[ 1 ].match( /^style.*?\.css$/ ) ) { return; }
|
2284 |
-
sheets += '<li>' + el[ 1 ] + "</li>\n";
|
2285 |
} );
|
2286 |
if ( '' !== sheets ) {
|
2287 |
sheets = "<ul class='howto' style='padding-left:1em'>\n" + sheets + "</ul>\n";
|
@@ -2292,6 +2321,7 @@
|
|
2292 |
} );
|
2293 |
}
|
2294 |
}
|
|
|
2295 |
if ( 'child' === themetype && self.analysis[ themetype ].signals.thm_parnt_loaded ) {
|
2296 |
//if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2297 |
notice.notices.push( {
|
@@ -2301,10 +2331,11 @@
|
|
2301 |
} );
|
2302 |
//}
|
2303 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
|
|
2304 |
resubmit = 1;
|
2305 |
resubmitdata.ctc_enqueue = 'none';
|
2306 |
}
|
2307 |
-
// if no parent styles, no need to enqueue
|
2308 |
if ( self.analysis.parnt.signals.thm_no_styles ) {
|
2309 |
//if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2310 |
notice.notices.push( {
|
@@ -2314,6 +2345,7 @@
|
|
2314 |
} );
|
2315 |
//}
|
2316 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
|
|
2317 |
resubmit = 1;
|
2318 |
resubmitdata.ctc_enqueue = 'none';
|
2319 |
}
|
@@ -2330,6 +2362,7 @@
|
|
2330 |
|
2331 |
$( 'input[name="ctc_analysis"]' ).val( hidden );
|
2332 |
resubmitdata.ctc_analysis = hidden;
|
|
|
2333 |
if ( self.is_success() && resubmit && !self.resubmitting ){
|
2334 |
self.resubmitting = 1;
|
2335 |
self.resubmit( resubmitdata );
|
@@ -2338,7 +2371,7 @@
|
|
2338 |
self.resubmitting = 0;
|
2339 |
self.hide_loading();
|
2340 |
$.each( notice.notices, function( ndx, notice ){
|
2341 |
-
//console.log( notice );
|
2342 |
var $out = $( '<div class="' + notice.style + ' notice is-dismissible dashicons-before" >' +
|
2343 |
'<h4>' + notice.headline + '</h4>' +
|
2344 |
notice.msg +
|
@@ -2367,9 +2400,9 @@
|
|
2367 |
$.each( self.dependencies, function( ndx, el ){
|
2368 |
// console.log( 'setting dependecy: ' + ndx + ' ' + el );
|
2369 |
if ( el ) {
|
2370 |
-
dep_inputs += '<label><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_' + ndx +
|
2371 |
'" name="ctc_forcedep[]" type="checkbox" value="' + ndx + '" autocomplete="off" ' +
|
2372 |
-
( -1 !==
|
2373 |
' />' + ndx + "</label><br/>\n";
|
2374 |
}
|
2375 |
});
|
@@ -2382,6 +2415,7 @@
|
|
2382 |
$( '#ctc_dependencies_container' ).hide();
|
2383 |
}
|
2384 |
|
|
|
2385 |
if ( !$( '#ctc_child_type_reset' ).is( ':checked' ) ) {
|
2386 |
$( '#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit' ).slideDown( 'fast' );
|
2387 |
if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
|
@@ -2399,10 +2433,8 @@
|
|
2399 |
$( '#input_row_theme_slug' ).slideDown( 'fast' );
|
2400 |
}
|
2401 |
}
|
2402 |
-
|
2403 |
-
//console.log( 'end css_notice' );
|
2404 |
}
|
2405 |
-
|
2406 |
},
|
2407 |
resubmit: function( data ) {
|
2408 |
var self = this;
|
@@ -2410,22 +2442,23 @@
|
|
2410 |
self.show_loading( true );
|
2411 |
data.action = 'ctc_update';
|
2412 |
data._wpnonce = $( '#_wpnonce' ).val();
|
2413 |
-
//console.log( '=====>>> RESUBMIT CALLED! <<<=====' );
|
2414 |
-
//console.log( data );
|
|
|
2415 |
$.ajax( {
|
2416 |
url: window.ctcAjax.ajaxurl,
|
2417 |
data: data,
|
2418 |
//dataType: 'json',
|
2419 |
type: 'POST'
|
2420 |
} ).done( function() { // response ) {
|
2421 |
-
//console.log( 'resubmit done:' );
|
2422 |
-
//console.log( response );
|
2423 |
self.hide_loading();
|
2424 |
self.do_analysis();
|
2425 |
} ).fail( function() { // xhr, status, err ) {
|
2426 |
//self.do_analysis();
|
2427 |
self.hide_loading();
|
2428 |
-
//console.log( status + ' ' + err );
|
2429 |
// FIXME: handle failure
|
2430 |
} );
|
2431 |
},
|
@@ -2438,7 +2471,8 @@
|
|
2438 |
failure: 0
|
2439 |
},
|
2440 |
queue: [],
|
2441 |
-
irreg: []
|
|
|
2442 |
},
|
2443 |
child: {
|
2444 |
deps: [[],[]],
|
@@ -2446,7 +2480,8 @@
|
|
2446 |
failure: 0
|
2447 |
},
|
2448 |
queue: [],
|
2449 |
-
irreg: []
|
|
|
2450 |
}
|
2451 |
};
|
2452 |
self.phperr = { parnt: [], child: [] };
|
@@ -2463,17 +2498,17 @@
|
|
2463 |
},
|
2464 |
// initialize object vars, bind event listeners to elements, load menus and start plugin
|
2465 |
init: function() {
|
2466 |
-
//console.log( 'initializing...' )
|
2467 |
var self = this;
|
2468 |
// ajax request done
|
2469 |
$( document ).on( 'analysisdone', function(){
|
2470 |
self.done++;
|
2471 |
-
//console.log( 'analysis came home ' + self.done );
|
2472 |
-
//console.log( 'existing: ' + $.chldthmcfg.existing );
|
2473 |
-
//console.log( 'parent: ' + $( '#ctc_theme_parnt' ).val() );
|
2474 |
// all ajax requests done
|
2475 |
if ( self.done > $.chldthmcfg.existing ){
|
2476 |
-
//console.log( 'analysis complete!' );
|
2477 |
self.done = 0;
|
2478 |
self.css_notice();
|
2479 |
}
|
2 |
* Script: chldthmcfg.js
|
3 |
* Plugin URI: http://www.childthemeconfigurator.com/
|
4 |
* Description: Handles jQuery, AJAX and other UI
|
5 |
+
* Version: 2.4.0
|
6 |
* Author: Lilaea Media
|
7 |
* Author URI: http://www.lilaeamedia.com/
|
8 |
* License: GPLv2
|
17 |
( function( $ ) {
|
18 |
'use strict';
|
19 |
$.chldthmcfg = {
|
|
|
20 |
escquo: function( str ) {
|
21 |
var self = this;
|
22 |
return self.is_empty( str ) ? str : str.toString().replace( /"/g, '"' );
|
36 |
getname: function( themetype ){
|
37 |
var self = this,
|
38 |
stylesheet = ( 'child' === themetype ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt );
|
39 |
+
// console.log( 'getname: ' + stylesheet );
|
40 |
+
// console.log( window.ctcAjax.themes );
|
41 |
if ( self.is_empty( window.ctcAjax.themes[ themetype ][ stylesheet ] ) ){
|
42 |
return '';
|
43 |
} else {
|
169 |
}
|
170 |
self.testslug = slug;
|
171 |
self.testname = name + ( padded.length ? ' ' + padded : '' );
|
172 |
+
// console.log( 'autogen_slugs: parent: ' + parent + ' slug: ' + slug );
|
173 |
}
|
174 |
},
|
175 |
|
194 |
$( '.ctc-rewrite-toggle' ).each( function( ndx, el ){
|
195 |
inputtype = $( el ).hasClass( 'rewrite-query' ) ? 'query' : 'selector';
|
196 |
value = $( '#ctc_sel_ovrd_' + inputtype + '_selected' ).text();
|
197 |
+
// console.log( 'maybe_show_rewrite inputtype: ' + inputtype + ' value: ' + value );
|
198 |
if ( value.match( /^[\s\u00A0]*$/ ) ){
|
199 |
$( el ).hide();
|
200 |
} else {
|
209 |
* modified v2.3.0
|
210 |
*/
|
211 |
selector_input_toggle: function( obj ) {
|
212 |
+
// console.log( 'selector_input_toggle: ' + $( obj ).attr( 'id' ) );
|
213 |
var self = this,
|
214 |
origval,
|
215 |
inputtype = $( obj ).hasClass( 'rewrite-query' ) ? 'query' : 'selector',
|
232 |
},
|
233 |
|
234 |
coalesce_inputs: function( obj ) {
|
235 |
+
//**// console.log( 'coalesce_inputs ' + $( obj ).attr( 'id' ) );
|
236 |
var self = this,
|
237 |
id = $( obj ).attr( 'id' ),
|
238 |
regex = /^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,
|
268 |
$( this ).val() ) ), // clear values if delete was clicked
|
269 |
important = ( 'seq' === inputrule ? false : 'ctc_' + inputseq + '_child_' + inputrule + '_i_' + qsid + '_' + rulevalid ),
|
270 |
parts, subparts;
|
271 |
+
//**// console.log( inputparts );
|
272 |
+
//**// console.log( 'value: ' + value );
|
273 |
if ( 'child' === inputtheme ) {
|
274 |
if ( !self.is_empty( $( this ).data( 'color' ) ) ) {
|
275 |
value = self.color_text( $( this ).data( 'color' ) );
|
317 |
if ( ( parts = inputrule.toString().match( /^border(\-(top|right|bottom|left))?$/ ) && !value.match( /none/ ) ) ) {
|
318 |
var borderregx = new RegExp( self.border_regx + self.color_regx, 'i' );
|
319 |
subparts = value.toString().match( borderregx );
|
320 |
+
//**// console.log( 'border after regex: ');
|
321 |
+
//**// console.log( value );
|
322 |
+
//**// console.log( borderregx );
|
323 |
+
//**// console.log( subparts );
|
324 |
if ( !self.is_empty( subparts ) ) {
|
325 |
subparts.shift();
|
326 |
cssrules[ inputtheme ][ inputrule + '-width' ] = subparts.shift() || '';
|
335 |
} else {
|
336 |
var gradregex = new RegExp( self.grad_regx + self.color_regx + self.color_regx, 'i' );
|
337 |
subparts = value.toString().match( gradregex );
|
338 |
+
//**// console.log( 'background-image after regex: ');
|
339 |
+
//**// console.log( value );
|
340 |
+
//**// console.log( gradregex );
|
341 |
+
//**// console.log( subparts );
|
342 |
if ( !self.is_empty( subparts ) && subparts.length > 2 ) {
|
343 |
subparts.shift();
|
344 |
gradient[ inputtheme ].origin = subparts.shift() || 'top';
|
361 |
if ( has_gradient.parent ) {
|
362 |
swatch.ctcgrad( gradient.parent.origin, [ gradient.parent.start, gradient.parent.end ] );
|
363 |
}
|
364 |
+
//**// console.log( 'combined css rules' );
|
365 |
+
//**// console.log( cssrules );
|
366 |
swatch.css( cssrules.parent );
|
367 |
if ( !( swatch.attr( 'id' ).toString().match( /parent/ ) ) ) {
|
368 |
if ( has_gradient.child ) {
|
369 |
swatch.ctcgrad( gradient.child.origin, [ gradient.child.start, gradient.child.end ] );
|
370 |
}
|
371 |
+
// console.log( cssrules.child );
|
372 |
swatch.css( cssrules.child );
|
373 |
}
|
374 |
swatch.css( {'z-index':-1} );
|
377 |
},
|
378 |
|
379 |
decode_value: function( rule, value ) {
|
380 |
+
//**// console.log( 'in decode_value ( ' + rule + ' ...' );
|
381 |
value = ( 'undefined' === typeof value ? '' : value );
|
382 |
var self = this,
|
383 |
obj = {
|
399 |
'_border_color',
|
400 |
];
|
401 |
orig = params.shift();
|
402 |
+
//**// console.log( value );
|
403 |
+
//**// console.log( regex );
|
404 |
+
//**// console.log( params );
|
405 |
obj.values[ 0 ] = params.shift() || '';
|
406 |
params.shift();
|
407 |
obj.values[ 1 ] = params.shift() || '';
|
418 |
if ( !self.is_empty( value ) && !( value.toString().match( /(url|none)/ ) ) ) {
|
419 |
var stop1, stop2;
|
420 |
params = value.toString().split( /:/ );
|
421 |
+
//**// console.log( value );
|
422 |
+
//**// console.log( params );
|
423 |
obj.values[ 1 ] = params.shift() || '';
|
424 |
obj.values[ 2 ] = params.shift() || '';
|
425 |
stop1 = params.shift() || '';
|
434 |
obj.values[ 0 ] = value;
|
435 |
}
|
436 |
}
|
437 |
+
//**// console.log( obj );
|
438 |
return obj;
|
439 |
},
|
440 |
|
456 |
|
457 |
setup_menus: function() {
|
458 |
var self = this;
|
459 |
+
// console.log( 'setup_menus' );
|
460 |
self.setup_query_menu();
|
461 |
self.setup_selector_menu();
|
462 |
self.setup_rule_menu();
|
469 |
|
470 |
load_queries: function() {
|
471 |
var self = this;
|
472 |
+
// console.log( 'load_queries' );
|
473 |
// retrieve unique media queries
|
474 |
self.query_css( 'queries', null );
|
475 |
},
|
476 |
|
477 |
load_selectors: function() {
|
478 |
var self = this;
|
479 |
+
// console.log( 'load_selectors' );
|
480 |
// retrieve unique selectors from query value
|
481 |
self.query_css( 'selectors', self.currquery );
|
482 |
},
|
483 |
|
484 |
load_rules: function() {
|
485 |
var self = this;
|
486 |
+
// console.log( 'load_rules' );
|
487 |
// retrieve all unique rules
|
488 |
self.query_css( 'rules', null );
|
489 |
},
|
490 |
|
491 |
load_selector_values: function() {
|
492 |
var self = this;
|
493 |
+
// console.log( 'load_selector_values: ' + self.currqsid );
|
494 |
// retrieve individual values from qsid
|
495 |
self.query_css( 'qsid', self.currqsid );
|
496 |
},
|
497 |
|
498 |
get_queries: function( request, response ) {
|
499 |
+
// console.log( 'get_queries' );
|
500 |
+
// console.log( this );
|
501 |
var //self = this,
|
502 |
arr = [],
|
503 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
515 |
},
|
516 |
|
517 |
get_selectors: function( request, response ) {
|
518 |
+
// console.log( 'get_selectors' );
|
519 |
var //self = this,
|
520 |
arr = [],
|
521 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
533 |
},
|
534 |
|
535 |
get_rules: function( request, response ) {
|
536 |
+
// console.log( 'get_rules' );
|
537 |
var //self = this,
|
538 |
arr = [],
|
539 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
|
551 |
},
|
552 |
|
553 |
get_filtered_rules: function( request, response ) {
|
554 |
+
// console.log( 'get_filtered_rules' );
|
555 |
var arr = [],
|
556 |
matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); //,
|
557 |
$.each( $( '#ctc_rule_menu' ).data( 'menu' ), function( key, val ) {
|
568 |
* this function puts them into parent/child columns by rulevalid
|
569 |
*/
|
570 |
merge_ruleval_arrays: function( rule, value, isnew ) {
|
571 |
+
//**// console.log( 'merge_ruleval_arrays' );
|
572 |
var self = this,
|
573 |
valarr = {},
|
574 |
nextval = isnew ? value.child.pop() : null; // if new rule, pop off the top before counting
|
575 |
+
//**// console.log( value );
|
576 |
$.each( [ 'parnt', 'child' ], function( ndx, themetype ) {
|
577 |
// iterate through parent and child val arrays and populate new assoc array with parent/child for each rulevalid
|
578 |
if ( !self.is_empty( value[ themetype ] ) ) {
|
612 |
* isnew is passed true when new rule is selected from menu
|
613 |
*/
|
614 |
input_row: function( qsid, rule, seq, data, isnew ) {
|
615 |
+
// console.log( 'in input_row' );
|
616 |
var self = this,
|
617 |
html = '';
|
618 |
if ( !self.is_empty( data ) && !self.is_empty( data.value ) && !self.is_empty( data.value[ rule ] ) ) {
|
681 |
|
682 |
css_preview: function( theme ) {
|
683 |
var self = this;
|
684 |
+
// console.log( 'css_preview: ' + theme );
|
685 |
if ( !( theme = theme.match( /(child|parnt)/ )[ 1 ] ) ) {
|
686 |
theme = 'child';
|
687 |
}
|
688 |
+
// console.log( 'css_preview: ' + theme );
|
689 |
// retrieve raw stylesheet ( parent or child )
|
690 |
self.query_css( 'preview', theme );
|
691 |
},
|
723 |
hideAfterPaletteSelect: true,
|
724 |
} ).on( 'change', function( ){
|
725 |
//var color = $( this ).spectrum( 'get' );
|
726 |
+
// console.log( 'color change: ' + color );
|
727 |
self.coalesce_inputs( this );
|
728 |
} ).on( 'keyup', function( ) {
|
729 |
// update spectrum ui to match text input after half-second delay
|
760 |
|
761 |
setup_query_menu: function() {
|
762 |
var self = this;
|
763 |
+
// console.log( 'setup_query_menu' );
|
764 |
try {
|
765 |
$( '#ctc_sel_ovrd_query' ).autocomplete( {
|
766 |
source: self.get_queries,
|
790 |
|
791 |
setup_selector_menu: function() {
|
792 |
var self = this;
|
793 |
+
// console.log( 'setup_selector_menu' );
|
794 |
try {
|
795 |
$( '#ctc_sel_ovrd_selector' ).autocomplete( {
|
796 |
source: self.get_selectors,
|
818 |
|
819 |
setup_rule_menu: function() {
|
820 |
var self = this;
|
821 |
+
// console.log( 'setup_rule_menu' );
|
822 |
try {
|
823 |
$( '#ctc_rule_menu' ).autocomplete( {
|
824 |
source: self.get_rules,
|
847 |
selectFirst: true,
|
848 |
autoFocus: true,
|
849 |
select: function( e, ui ) {
|
850 |
+
// console.log( 'new rule selected' );
|
851 |
e.preventDefault();
|
852 |
var newrule = ui.item.label.replace( /[^\w\-]/g, self.toascii ),
|
853 |
row,
|
854 |
first;
|
855 |
+
// console.log( 'current qsdata before:' );
|
856 |
+
// console.log( self.currdata );
|
857 |
if ( self.is_empty( self.currdata.value ) ) {
|
858 |
self.currdata.value = {};
|
859 |
}
|
863 |
if ( self.is_empty( self.currdata.value[ ui.item.label ].child ) ) {
|
864 |
self.currdata.value[ ui.item.label ].child = [];
|
865 |
}
|
866 |
+
// console.log( 'current qsdata after:' );
|
867 |
+
// console.log( self.currdata );
|
868 |
// seed current qsdata with new blank value with id 1
|
869 |
// this will be modified during input_row function to be next id in order
|
870 |
self.currdata.value[ ui.item.label ].child.push( [ '', 0, 1, 1 ] );
|
911 |
$( '#ctc_configure_submit .ctc-step' ).text( '9' );
|
912 |
if ( $( '#ctc_theme_child' ).length && !$( '#ctc_child_type_new' ).is( ':checked' ) ) {
|
913 |
themedir = $( '#ctc_theme_child' ).val();
|
914 |
+
// console.log( 'update_form (existing) ... ' + themedir );
|
915 |
self.existing = 1;
|
916 |
self.currparnt = window.ctcAjax.themes.child[ themedir ].Template;
|
917 |
self.autogen_slugs();
|
947 |
//themedir = $( '#ctc_theme_parnt' ).val();
|
948 |
$( '#ctc_theme_parnt' ).val( self.currparnt );
|
949 |
$( '#ctc_theme_parnt-button .ui-selectmenu-text' ).text( $.chldthmcfg.getname( 'parnt' ) );
|
950 |
+
// console.log( 'update_form (new) ... ' + self.currparnt );
|
951 |
//self.set_parent_menu( document.getElementById( 'ctc_theme_parnt' ) );
|
952 |
+
// console.log( 'setting to new...' + $( '#ctc_theme_parnt' ).val() );
|
953 |
self.set_theme_params( 'parnt', self.currparnt );
|
954 |
$( '#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug' ).slideUp( 'fast' );
|
955 |
$( '#input_row_new_theme_option' ).slideDown( 'fast' );
|
998 |
if ( self.is_empty( value ) ) {
|
999 |
return false;
|
1000 |
}
|
1001 |
+
// console.log( 'set_query: ' + value );
|
1002 |
self.currquery = value;
|
1003 |
$( '#ctc_sel_ovrd_query' ).val( '' );
|
1004 |
$( '#ctc_sel_ovrd_query_selected' ).text( value );
|
1013 |
* added v2.3.0
|
1014 |
*/
|
1015 |
reset_qsid: function(){
|
1016 |
+
// console.log( 'resetting all qsid inputs...' );
|
1017 |
self.currqsid = null;
|
1018 |
$( '#ctc_sel_ovrd_rule_inputs' ).empty();
|
1019 |
$( '#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container' ).hide().find( '.ctc-child-value' ).remove();
|
1026 |
if ( self.is_empty( value ) ) {
|
1027 |
return false;
|
1028 |
}
|
1029 |
+
// console.log( 'set_selector: ' + value + ' label: ' + label );
|
1030 |
$( '#ctc_sel_ovrd_selector' ).val( '' );
|
1031 |
self.currqsid = value;
|
1032 |
self.reload = false;
|
1035 |
},
|
1036 |
|
1037 |
set_rule: function( value, label ) {
|
1038 |
+
// console.log( 'set_rule: ' + value + ' label: ' + label );
|
1039 |
var self = this;
|
1040 |
if ( self.is_empty( value ) ) {
|
1041 |
return false;
|
1051 |
|
1052 |
set_qsid: function( obj ) {
|
1053 |
var self = this;
|
1054 |
+
// console.log( 'set_qsid: ' + $( obj ).attr( 'id' ) );
|
1055 |
self.currqsid = $( obj ).attr( 'id' ).match( /_(\d+)$/ )[ 1 ];
|
1056 |
self.focus_panel( '#query_selector_options' );
|
1057 |
self.reload = true;
|
1062 |
* Retrieve data from server and execute callback on completion
|
1063 |
*/
|
1064 |
query_css: function( obj, key, params ) {
|
1065 |
+
// console.log( 'query_css: ' + obj + ' key: ' + key );
|
1066 |
var self = this,
|
1067 |
postdata = { 'ctc_query_obj' : obj, 'ctc_query_key': key },
|
1068 |
status_sel = '#ctc_status_' + obj + ( 'val_qry' === obj ? '_' + key : '' );
|
1073 |
} );
|
1074 |
}
|
1075 |
$( '.query-icon,.ctc-status-icon' ).remove();
|
1076 |
+
// console.log( status_sel + ' ' + $( status_sel ).length );
|
1077 |
$( status_sel + ' .ctc-status-icon' ).remove();
|
1078 |
$( status_sel ).append( '<span class="ctc-status-icon spinner is-active query-icon"></span>' );
|
1079 |
// add wp ajax action to array
|
1080 |
+
// console.log( $( '#ctc_action' ).val() );
|
1081 |
postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
|
1082 |
'plugin' === $( '#ctc_action' ).val() ) ?
|
1083 |
'ctc_plgqry' : 'ctc_query';
|
1084 |
postdata._wpnonce = $( '#_wpnonce' ).val();
|
1085 |
// ajax post input data
|
1086 |
+
// console.log( 'query_css postdata:' );
|
1087 |
+
// console.log( postdata );
|
1088 |
self.ajax_post( obj, postdata );
|
1089 |
},
|
1090 |
/**
|
1091 |
* Post data to server for saving and execute callback on completion
|
1092 |
*/
|
1093 |
save: function( obj ) {
|
1094 |
+
// console.log( 'save: ' + $( obj ).attr( 'id' ) );
|
1095 |
var self = this,
|
1096 |
postdata = {},
|
1097 |
$selector,
|
1146 |
$( '.ctc-rewrite-toggle' ).text( self.getxt( 'rename' ) );
|
1147 |
} );
|
1148 |
// add wp ajax action to array
|
1149 |
+
// console.log( $( '#ctc_action' ).val() );
|
1150 |
postdata.action = ( !self.is_empty( $( '#ctc_action' ).val() ) &&
|
1151 |
'plugin' === $( '#ctc_action' ).val() ) ?
|
1152 |
'ctc_plugin' : 'ctc_update';
|
1153 |
postdata._wpnonce = $( '#_wpnonce' ).val();
|
1154 |
+
// console.log( postdata );
|
1155 |
// ajax post input data
|
1156 |
self.ajax_post( 'qsid', postdata );
|
1157 |
},
|
1158 |
|
1159 |
ajax_post: function( obj, data, datatype ) {
|
1160 |
var self = this;
|
1161 |
+
// console.log( 'ajax_post: ' + obj );
|
1162 |
+
// console.log( data );
|
1163 |
+
// console.log( window.ctcAjax.ajaxurl );
|
1164 |
+
// console.log( window.ctcAjax.ajaxurl );
|
1165 |
// get ajax url from localized object
|
1166 |
$.ajax( {
|
1167 |
url: window.ctcAjax.ajaxurl,
|
1173 |
( self.is_empty( datatype ) ? 'json' : datatype ),
|
1174 |
type: 'POST'
|
1175 |
} ).done( function( response ) {
|
1176 |
+
// console.log( response );
|
1177 |
self.handle_success( obj, response );
|
1178 |
} ).fail( function() { // jxr, status, err ) {
|
1179 |
+
// console.log( status );
|
1180 |
+
// console.log( err );
|
1181 |
self.handle_failure( obj );
|
1182 |
} ).always( function() {
|
1183 |
if ( self.jqueryerr.length ) {
|
1188 |
|
1189 |
handle_failure: function( obj ) {
|
1190 |
var self = this;
|
1191 |
+
// console.log( 'handle_failure: ' + obj );
|
1192 |
$( '.query-icon, .save-icon' ).removeClass( 'spinner' ).addClass( 'failure' );
|
1193 |
$( 'input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input' ).prop( 'disabled', false );
|
1194 |
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
1202 |
handle_success: function( obj, response ) {
|
1203 |
var self = this;
|
1204 |
// query response
|
1205 |
+
// console.log( 'handle_success: ' + obj );
|
1206 |
+
// console.log( response );
|
1207 |
// hide spinner
|
1208 |
$( '.query-icon, .save-icon' ).removeClass( 'spinner' );
|
1209 |
$( '.ajax-pending' ).removeClass( 'ajax-pending' );
|
1220 |
// update ui from each response object
|
1221 |
$( response ).each( function() {
|
1222 |
if ( 'function' === typeof self.update[ this.obj ] ) {
|
1223 |
+
// console.log( 'executing method update.' + this.obj );
|
1224 |
self.update[ this.obj ].call( self, this );
|
1225 |
} else {
|
1226 |
+
// console.log( 'Fail: no method update.' + this.obj );
|
1227 |
}
|
1228 |
} );
|
1229 |
}
|
1234 |
ln = self.is_empty( exn.lineNumber ) ? '' : ' line: ' + exn.lineNumber,
|
1235 |
fn = self.is_empty( exn.fileName ) ? '' : ' ' + exn.fileName.split( /\?/ )[ 0 ];
|
1236 |
self.jqueryerr.push( '<code><small>' + type + ': ' + exn.message + fn + ln + '</small></code>' );
|
1237 |
+
// console.log( 'jquery error detected' );
|
1238 |
},
|
1239 |
|
1240 |
jquery_notice: function( fn ) {
|
1241 |
+
// console.log( fn );
|
1242 |
fn = null;
|
1243 |
var self = this,
|
1244 |
culprits = [],
|
1283 |
id, html, val, empty;
|
1284 |
self.currqsid = res.key;
|
1285 |
self.currdata = res.data;
|
1286 |
+
// console.log( 'update: ' + self.reload );
|
1287 |
+
// console.log( 'update.qsid: ' + self.currqsid );
|
1288 |
$( '#ctc_sel_ovrd_qsid' ).val( self.currqsid );
|
1289 |
if ( self.is_empty( self.currdata.seq ) ) {
|
1290 |
$( '#ctc_child_load_order_container' ).empty();
|
1296 |
$( '#ctc_child_load_order_container' ).html( html );
|
1297 |
}
|
1298 |
if ( self.is_empty( self.currdata.value ) ) {
|
1299 |
+
// console.log( 'qsdata is empty' );
|
1300 |
empty = true;
|
1301 |
$( '#ctc_sel_ovrd_rule_inputs' ).empty();
|
1302 |
// prune empty selectors after clearing data to prune
|
1303 |
self.load_selectors();
|
1304 |
} else {
|
1305 |
+
// console.log( 'qsdata NOT empty' );
|
1306 |
empty = false;
|
1307 |
html = '';
|
1308 |
$.each( self.currdata.value, function( rule, value ) {
|
1317 |
// if ( self.jqueryerr.length ) {
|
1318 |
// self.jquery_notice( 'update.qsid' );
|
1319 |
// } else {
|
1320 |
+
// console.log( 'reload menus: ' + ( self.reload ? 'true' : 'false' ) );
|
1321 |
if ( self.reload ) {
|
1322 |
self.load_queries();
|
1323 |
self.load_selectors();
|
1343 |
},
|
1344 |
// render list of unique values for given rule on Property/Value tab
|
1345 |
rule_val: function( res ) {
|
1346 |
+
// console.log( 'update.rule_val: ' + res.key );
|
1347 |
+
// console.log( res.data );
|
1348 |
var self = this,
|
1349 |
rule = $( '#ctc_rule_menu_selected' ).text(),
|
1350 |
html = '<div class="ctc-input-row clearfix" id="ctc_rule_row_' + rule + '">' + "\n";
|
1351 |
+
// console.log( 'rule: ' + rule );
|
1352 |
if ( !self.is_empty( res.data ) ) {
|
1353 |
$.each( res.data, function( valid, value ) {
|
1354 |
var parentObj = self.decode_value( rule, value );
|
1384 |
},
|
1385 |
// render list of selectors grouped by query for given value on Property/Value Tab
|
1386 |
val_qry: function( res ) {
|
1387 |
+
// console.log( 'in val_qry' );
|
1388 |
+
// console.log( res );
|
1389 |
var self = this,
|
1390 |
html = '',
|
1391 |
page_rule,
|
1404 |
} );
|
1405 |
}
|
1406 |
selector = '#ctc_selector_' + page_rule + '_' + res.key + '_rows';
|
1407 |
+
// console.log( selector );
|
1408 |
|
1409 |
$( selector ).html( html ).find( '.color-picker' ).each( function() {
|
1410 |
self.setup_spectrum( this );
|
1431 |
// render debug output
|
1432 |
debug: function( res ) {
|
1433 |
$( '#ctc_debug_box' ).val( $( '#ctc_debug_box' ).val() + res.data );
|
1434 |
+
// console.log( 'debug:' );
|
1435 |
+
// console.log( res.data );
|
1436 |
},
|
1437 |
// render stylesheet preview on child or parent css tab
|
1438 |
preview: function( res ) {
|
1439 |
$( '#view_' + res.key + '_options_panel' ).text( res.data );
|
1440 |
},
|
1441 |
dismiss: function() { // res ) {
|
1442 |
+
// console.log( 'dismiss came home!' );
|
1443 |
+
// console.log( res );
|
1444 |
//var self = this;
|
1445 |
//self.dismiss_notice();
|
1446 |
}
|
1448 |
},
|
1449 |
// applies core dismiss behavior to injected elements
|
1450 |
bind_dismiss: function( el ) {
|
1451 |
+
// console.log( 'bind_dismiss' );
|
1452 |
var self = this,
|
1453 |
$this = $( el ),
|
1454 |
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
|
1472 |
});
|
1473 |
},
|
1474 |
reset_handling: function() {
|
1475 |
+
// console.log( '----> resetting form...' );
|
1476 |
$( '#parnt_analysis_notice .notice, #child_analysis_notice .notice' ).slideUp();
|
1477 |
$( '#ctc_enqueue_enqueue' ).prop( 'checked', true );
|
1478 |
$( '#ctc_handling_primary' ).prop( 'checked', true );
|
1481 |
},
|
1482 |
// initialize object vars, bind event listeners to elements, load menus and start plugin
|
1483 |
init: function() {
|
1484 |
+
// console.log( 'initializing...' )
|
1485 |
var self = this;
|
1486 |
//self.jquery_exception( { 'message':'testing' }, 'Testing' );
|
1487 |
// try to initialize theme menus
|
1488 |
if ( !$( '#ctc_theme_parnt' ).is( 'input' ) ) {
|
1489 |
|
1490 |
+
// console.log( 'initializing theme select menus...' );
|
1491 |
try {
|
1492 |
$.widget( 'ctc.themeMenu', $.ui.selectmenu, {
|
1493 |
_renderItem: function( ul, item ) {
|
1555 |
} );
|
1556 |
|
1557 |
$( '#ctc_main' ).on( 'click', '.ctc-upgrade-notice .notice-dismiss', function() { // e ) {
|
1558 |
+
// console.log( 'dismiss upgrade clicked!' );
|
1559 |
//e.preventDefault();
|
1560 |
var postdata = {
|
1561 |
'action': 'ctc_dismiss',
|
1565 |
} );
|
1566 |
|
1567 |
if ( self.is_empty( self.jqueryerr ) ){
|
1568 |
+
// console.log( 'delegating event bindings...' )
|
1569 |
$( '#ctc_main' ).on( 'click', '.ctc-selector-handle', function( e ) {
|
1570 |
//'.ctc-option-panel-container'
|
1571 |
e.preventDefault();
|
1602 |
|
1603 |
$( '#ctc_main' ).on( 'keydown', '.ctc-selector-container .ctc-child-value[type=text]', function( e ) {
|
1604 |
if ( 13 === e.which ) {
|
1605 |
+
// console.log( 'return key pressed' );
|
1606 |
var $obj = $( this ).parents( '.ctc-selector-row' ).find( '.ctc-save-input[type=button]' ).first();
|
1607 |
if ( $obj.length ) {
|
1608 |
e.preventDefault();
|
1609 |
+
// console.log( $obj.attr( 'id' ) );
|
1610 |
if ( $obj.hasClass( 'ajax-pending' ) ) {
|
1611 |
return false;
|
1612 |
}
|
1646 |
} else {
|
1647 |
$( '#ctc_export_theme' ).val( self.currparnt );
|
1648 |
}
|
1649 |
+
// console.log( 'backup clicked - theme: ' + $( '#ctc_export_theme' ).val() );
|
1650 |
// submit form
|
1651 |
$( '#ctc_export_theme_form' ).submit();
|
1652 |
// submit form
|
1709 |
} );
|
1710 |
|
1711 |
$( '#ctc_rule_value_form' ).on( 'submit', function( e ) {
|
1712 |
+
// console.log( 'rule value empty submit' );
|
1713 |
e.preventDefault();
|
1714 |
return false;
|
1715 |
} );
|
1717 |
// update interface for existing child theme
|
1718 |
$( '#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset' )
|
1719 |
.on( 'focus click', function() {
|
1720 |
+
// console.log( 'child type clicked!' );
|
1721 |
self.reset_handling();
|
1722 |
self.update_form();
|
1723 |
} );
|
1739 |
document.location = $( this ).prop( 'href' );
|
1740 |
return false;
|
1741 |
} );
|
1742 |
+
// console.log( 'loading autoselect menus...' )
|
1743 |
// initialize autoselect menus
|
1744 |
self.setup_menus();
|
1745 |
|
1746 |
// turn on submit buttons (disabled until everything is loaded to prevent errors)
|
1747 |
+
// console.log( 'releasing submit buttons...' )
|
1748 |
$( 'input[type=submit], input[type=button]' ).prop( 'disabled', false );
|
1749 |
self.scrolltop();
|
1750 |
self.update_form();
|
1751 |
+
// console.log( 'Ready.' );
|
1752 |
}
|
1753 |
if ( self.jqueryerr.length ) {
|
1754 |
self.jquery_notice();
|
1776 |
},
|
1777 |
|
1778 |
trmcss: function( str ) {
|
1779 |
+
// console.log( 'trmcss: ' + str );
|
1780 |
return 'undefined' === typeof str ? '' : str.replace( /\-css$/, '' );
|
1781 |
},
|
1782 |
show_loading: function( resubmit, text ) {
|
1802 |
* which executes an http request on the server side. If both methods fail, notify user.
|
1803 |
*/
|
1804 |
analyze_theme: function( themetype ) {
|
1805 |
+
// console.log( 'analyze_theme' );
|
1806 |
var self = this,
|
1807 |
now = Math.floor( $.now() / 1000 ),
|
1808 |
stylesheet = ( 'child' === themetype ? $.chldthmcfg.currchild : $.chldthmcfg.currparnt ),
|
1815 |
/**
|
1816 |
* First, try to fetch home page using ajax get
|
1817 |
*/
|
1818 |
+
// console.log( 'Fetching home page: ' + url );
|
1819 |
$.get( url, function( data ) {
|
1820 |
+
// console.log( data );
|
1821 |
self.parse_page( themetype, data );
|
1822 |
$( document ).trigger( 'analysisdone' );
|
1823 |
} ).fail( function( xhr, status, err ){
|
1824 |
+
// console.log( status );
|
1825 |
+
// console.log( err );
|
1826 |
+
// console.log( xhr );
|
1827 |
/**
|
1828 |
* if this fails due to cross domain or other issue,
|
1829 |
* try fetching using ajax call that requests page on server side.
|
1854 |
/**
|
1855 |
* if xhr fails both times there is a bigger problem.
|
1856 |
*/
|
1857 |
+
// console.log( xhr );
|
1858 |
self.analysis[ themetype ].signals.failure = 1;
|
1859 |
self.analysis[ themetype ].signals.xhrajaxerr = err;
|
1860 |
$( document ).trigger( 'analysisdone' );
|
1886 |
// retrieve enqueued stylesheet ids
|
1887 |
if ( ( queue = body.match( /BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/ ) ) ) {
|
1888 |
self.analysis[ themetype ].queue = queue[ 1 ].split(/\n/);
|
1889 |
+
// console.log( 'QUEUE:' );
|
1890 |
+
// console.log( self.analysis[ themetype ].queue );
|
1891 |
} else {
|
1892 |
self.analysis[ themetype ].queue = [];
|
1893 |
self.analysis[ themetype ].signals.thm_noqueue = 1;
|
1894 |
//self.analysis[ themetype ].signals.failure = 1;
|
1895 |
+
// console.log( 'NO QUEUE' );
|
1896 |
}
|
1897 |
if ( ( queue = body.match( /BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/ ) ) ) {
|
1898 |
self.analysis[ themetype ].irreg = queue[ 1 ].split(/\n/);
|
1954 |
linktheme = $.chldthmcfg.currparnt === stylesheettheme ? 'parnt' : 'child',
|
1955 |
noid = 0;
|
1956 |
// console.log( 'stylesheetid: ' + stylesheetid + ' stylesheetpath: ' + stylesheetpath );
|
1957 |
+
// flag stylesheet links that have no id or are not in wp_styles
|
1958 |
+
if ( '' === stylesheetid || -1 === self.analysis[ themetype ].queue.indexOf( stylesheetid ) ) {
|
1959 |
noid = 1;
|
1960 |
// console.log( 'no id for ' + stylesheetpath + ' in ' + themetype + '!' );
|
1961 |
} else if ( 0 === stylesheetid.indexOf( 'chld_thm_cfg' ) ) { // handle ctc-generated links
|
1978 |
} else {
|
1979 |
// console.log( 'adding external stylesheet dependency' );
|
1980 |
self.analysis[ themetype ].signals.ctc_ext_loaded = 1; // flag that external stylesheet link detected
|
1981 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath, linktheme ] );
|
1982 |
}
|
1983 |
} else if ( 'chld_thm_cfg_child' === stylesheetid ) {
|
1984 |
self.analysis[ themetype ].signals.ctc_child_loaded = 1; // flag that ctc child stylesheet link detected
|
1985 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath, linktheme ] );
|
1986 |
// console.log( 'signal: ctc_child_loaded' );
|
1987 |
} else if ( 'chld_thm_cfg_parent' === stylesheetid ) {
|
1988 |
self.analysis[ themetype ].signals.ctc_parnt_loaded = 1; // flag that ctc parent stylesheet link detected
|
1989 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath, linktheme ] );
|
1990 |
// console.log( 'signal: ctc_parnt_loaded' );
|
1991 |
if ( themeloaded ){
|
1992 |
// console.log( 'parent link out of sequence' );
|
2020 |
if ( noid ) {
|
2021 |
if ( testloaded ) {
|
2022 |
self.analysis[ themetype ].signals.thm_past_wphead = 1;
|
2023 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ 'thm_past_wphead', stylesheetpath, linktheme ] );
|
2024 |
// console.log( 'signal: thm_past_wphead (Unreachable theme stylesheet detected ' + stylesheetpath );
|
2025 |
} else {
|
2026 |
self.analysis[ themetype ].signals.thm_unregistered = 1;
|
2027 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ 'thm_unregistered', stylesheetpath, linktheme ] );
|
2028 |
// console.log( 'signal: thm_unregistered (Unregistered theme stylesheet detected) ' + stylesheetpath );
|
2029 |
}
|
2030 |
} else {
|
2031 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath, linktheme ] );
|
2032 |
// console.log( 'Theme stylesheet OK! ' + stylesheetid + ' ' + stylesheetpath );
|
2033 |
}
|
2034 |
+
// test for rtl because it may occur past test.css boundary and flag false positive
|
2035 |
} else if ( stylesheetpath.match( /rtl.*?\.css$/ ) ) {
|
2036 |
self.analysis[ themetype ].signals.thm_rtl = 1;
|
2037 |
} else if ( 'ctc-test.css' === stylesheetpath ) { // flag test stylesheet link
|
2060 |
} else {
|
2061 |
self.dependencies[ stylesheetid ] = stylesheetpath;
|
2062 |
}
|
2063 |
+
self.analysis[ themetype ].deps[ themeloaded ].push( [ stylesheetid, stylesheetpath, linktheme ] );
|
2064 |
}
|
2065 |
}
|
2066 |
if ( ! themeloaded ){
|
2075 |
* for child theme setup and display results to user.
|
2076 |
*/
|
2077 |
css_notice: function() {
|
2078 |
+
// console.log( 'in css_notice' );
|
2079 |
var self = this,
|
2080 |
themetype = $.chldthmcfg.existing ? 'child' : 'parnt',
|
2081 |
name = $.chldthmcfg.getname( themetype ),
|
2094 |
anlz,
|
2095 |
debugtxt = '',
|
2096 |
dep_inputs,
|
2097 |
+
swap_inputs,
|
2098 |
errflags = {};
|
2099 |
+
// test if CTC is unable to load theme page at all
|
2100 |
if ( self.analysis[ themetype ].signals.failure ||
|
2101 |
( self.analysis[ themetype ].signals.thm_noqueue && !self.phperr[ themetype ].length ) ) {
|
2102 |
//if ( $( '#ctc_is_debug' ).is( ':checked' ) ) {
|
2108 |
style: 'notice-warning'
|
2109 |
} );
|
2110 |
} else {
|
2111 |
+
// test for PHP errors in loaded theme page
|
2112 |
if ( self.phperr[ themetype ].length ) {
|
2113 |
$.each( self.phperr[ themetype ], function( index, err ) {
|
2114 |
if ( err.match( /Fatal error/i ) ) {
|
2119 |
}
|
2120 |
/*
|
2121 |
if ( $.chldthmcfg.existing && err.match( /(FileNotFoundException|Failed opening|failed to open stream)/i ) ) {
|
2122 |
+
// console.log( 'Probably using get_stylesheet_directory()' );
|
2123 |
notice.subhead = 'A file cannot be found in the Child Theme\'s directory.';
|
2124 |
}
|
2125 |
*/
|
2126 |
errnotice.errlist += err + "\n";
|
2127 |
} );
|
2128 |
+
// highlight fatal errors in red
|
2129 |
if ( errflags.fatal ){
|
2130 |
errnotice.style = 'error';
|
2131 |
errnotice.headline = $.chldthmcfg.getxt( 'anlz8', name );
|
2132 |
}
|
2133 |
+
// otherwise display errors as warnings
|
2134 |
if ( errflags.config ){
|
2135 |
errnotice.msg = $.chldthmcfg.getxt( 'anlzconfig', name ) + errnotice.msg;
|
2136 |
}
|
2150 |
msg: $.chldthmcfg.getxt( 'anlzcache2' )
|
2151 |
} );
|
2152 |
} else if ( !self.analysis[ themetype ].signals.thm_noqueue ) { // !errflags.fatal &&
|
2153 |
+
// test for stylesheet links past wp head and set repair flag input if necessary
|
2154 |
if ( self.analysis[ themetype ].signals.thm_past_wphead || self.analysis[ themetype ].signals.dep_past_wphead ) {
|
2155 |
// || self.analysis[ themetype ].signals.css_past_wphead ){
|
2156 |
notice.notices.push( {
|
2161 |
$( '#ctc_repairheader' ).prop( 'checked', true );
|
2162 |
$( '#ctc_repairheader_container' ).show();
|
2163 |
}
|
2164 |
+
// test for unregistered stylesheet links
|
2165 |
if ( self.analysis[ themetype ].signals.thm_unregistered ) {
|
2166 |
if (
|
2167 |
!self.analysis[ themetype ].signals.ctc_child_loaded &&
|
2177 |
}
|
2178 |
}
|
2179 |
if ( 'child' === themetype ) {
|
2180 |
+
// test for reorder flag
|
2181 |
if ( self.analysis.child.signals.ctc_parnt_reorder ) {
|
2182 |
// console.log( 'reorder flag detected, resubmitting.' );
|
2183 |
+
// console.log( 'resubmitting 1' );
|
2184 |
resubmit = 1;
|
2185 |
}
|
2186 |
+
// test for presence of a child theme stylesheet
|
2187 |
if ( !self.analysis.child.signals.ctc_child_loaded &&
|
2188 |
!self.analysis.child.signals.ctc_sep_loaded &&
|
2189 |
!self.analysis.child.signals.thm_child_loaded ){
|
2192 |
style: 'notice-warning',
|
2193 |
msg: $.chldthmcfg.getxt( 'anlz14' )
|
2194 |
} );
|
2195 |
+
// console.log( 'resubmitting 2' );
|
2196 |
resubmit = 1;
|
2197 |
}
|
2198 |
+
// test for deprecated Genesis methods
|
2199 |
if ( self.analysis[ themetype ].signals.ctc_gen_loaded ) {
|
2200 |
notice.notices.push( {
|
2201 |
headline: $.chldthmcfg.getxt( 'anlz31' ),
|
2203 |
style: 'notice-warning'
|
2204 |
} );
|
2205 |
}
|
2206 |
+
// test for presence of parent stylesheet or ignore parent flag
|
2207 |
if ( !self.analysis.parnt.signals.thm_no_styles &&
|
2208 |
!self.analysis.child.signals.ctc_gen_loaded &&
|
2209 |
!self.analysis.child.signals.thm_parnt_loaded &&
|
2215 |
style: 'notice-warning',
|
2216 |
msg: $.chldthmcfg.getxt( 'anlz16' )
|
2217 |
} );
|
2218 |
+
// console.log( 'resubmitting 3' );
|
2219 |
resubmit = 1;
|
2220 |
}
|
2221 |
+
// test for redundant stylesheet link (old CTC version)
|
2222 |
if ( self.analysis.child.signals.thm_unregistered &&
|
2223 |
self.analysis.child.signals.thm_child_loaded &&
|
2224 |
'thm_unregistered' === self.analysis.child.signals.thm_child_loaded &&
|
2232 |
$( '#ctc_repairheader_container' ).show();
|
2233 |
$( '#ctc_repairheader' ).prop( 'checked', true );
|
2234 |
}
|
2235 |
+
// test for unconfigured non-CTC child theme
|
2236 |
if ( !self.analysis.child.signals.thm_is_ctc &&
|
2237 |
!$( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
|
2238 |
notice.notices.push( {
|
2241 |
style: 'notice-warning'
|
2242 |
} );
|
2243 |
}
|
2244 |
+
|
2245 |
+
|
2246 |
+
}
|
|
|
|
|
|
|
|
|
|
|
2247 |
|
2248 |
+
// test for additional stylesheets that switched from parent to child
|
2249 |
+
if ( 'object' !== typeof window.ctcAjax.swappath ){
|
2250 |
+
window.ctcAjax.swappath = {};
|
2251 |
}
|
2252 |
+
$.each( self.analysis.parnt.deps[ 0 ], function( ndx, el ) {
|
2253 |
+
$.each( self.analysis.child.deps[ 0 ], function( ndx2, el2 ) {
|
2254 |
+
if ( el2[ 0 ] === el[ 0 ] && el2[ 2 ] !== el[ 2 ] ){
|
2255 |
+
// this one changed
|
2256 |
+
//console.log( 'link path changed', el, el2 );
|
2257 |
+
self.analysis.parnt.swaps.push( el2 );
|
2258 |
+
window.ctcAjax.swappath[ el2[ 0 ] ] = el2[ 1 ];
|
2259 |
+
// console.log( 'resubmitting 7' );
|
2260 |
+
resubmit = 1;
|
2261 |
+
}
|
2262 |
+
} );
|
2263 |
+
} );
|
2264 |
+
|
2265 |
+
|
2266 |
+
// set stylesheet handling method input
|
2267 |
if ( self.analysis[ themetype ].signals.ctc_sep_loaded || self.analysis[ themetype ].signals.ctc_gen_loaded ){
|
2268 |
+
// console.log( 'Separate stylesheet detected' );
|
2269 |
$( '#ctc_handling_separate' ).prop( 'checked', true );
|
2270 |
}
|
2271 |
+
// if no notices, display OK message
|
2272 |
if ( !notice.notices.length ) {
|
2273 |
notice.notices.push( {
|
2274 |
headline: '' + ( 'child' === themetype ? $.chldthmcfg.getxt( 'anlz17' ) : $.chldthmcfg.getxt( 'anlz18' ) ) + '',
|
2276 |
msg: ''
|
2277 |
} );
|
2278 |
}
|
2279 |
+
// if using @import, display warning
|
2280 |
if ( 'child' === themetype && self.analysis.child.signals.thm_has_import ) {
|
2281 |
notice.notices.push( {
|
2282 |
headline: $.chldthmcfg.getxt( 'anlz21' ),
|
2283 |
msg: $.chldthmcfg.getxt( 'anlz22' ),
|
2284 |
style: 'notice-warning'
|
2285 |
} );
|
2286 |
+
// console.log( 'Import parent detected' );
|
2287 |
$( '#ctc_enqueue_import' ).prop( 'checked', true );
|
2288 |
}
|
2289 |
+
// set ignore parent input
|
2290 |
if ( self.analysis[ themetype ].signals.thm_ignoreparnt || self.analysis[ themetype ].signals.ctc_gen_loaded ){
|
2291 |
+
// console.log( 'Ignore parent detected' );
|
2292 |
$( '#ctc_ignoreparnt' ).prop( 'checked', true );
|
2293 |
+
// resubmit if this requires a change
|
2294 |
if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2295 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
2296 |
+
// console.log( 'resubmitting 4' );
|
2297 |
resubmit = 1;
|
2298 |
resubmitdata.ctc_enqueue = 'none';
|
2299 |
}
|
2300 |
} else {
|
2301 |
$( '#ctc_ignoreparnt' ).prop( 'checked', false );
|
2302 |
}
|
2303 |
+
// test for additional stylesheets after main theme stylesheet
|
2304 |
if ( !self.analysis[ themetype ].signals.ctc_sep_loaded &&
|
2305 |
!self.analysis[ themetype ].signals.ctc_gen_loaded &&
|
2306 |
!self.analysis[ themetype ].signals.ctc_child_loaded &&
|
2310 |
var sheets = '';
|
2311 |
$.each( self.analysis[ themetype ].deps[ 1 ], function( ndx, el ) {
|
2312 |
if ( el[ 1 ].match( /^style.*?\.css$/ ) ) { return; }
|
2313 |
+
sheets += '<li class="code">' + el[ 1 ] + "</li>\n";
|
2314 |
} );
|
2315 |
if ( '' !== sheets ) {
|
2316 |
sheets = "<ul class='howto' style='padding-left:1em'>\n" + sheets + "</ul>\n";
|
2321 |
} );
|
2322 |
}
|
2323 |
}
|
2324 |
+
// test if theme is already loading parent stylesheet from child theme and resubmit
|
2325 |
if ( 'child' === themetype && self.analysis[ themetype ].signals.thm_parnt_loaded ) {
|
2326 |
//if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2327 |
notice.notices.push( {
|
2331 |
} );
|
2332 |
//}
|
2333 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
2334 |
+
// console.log( 'resubmitting 5' );
|
2335 |
resubmit = 1;
|
2336 |
resubmitdata.ctc_enqueue = 'none';
|
2337 |
}
|
2338 |
+
// test if no parent styles, no need to enqueue and resubmit
|
2339 |
if ( self.analysis.parnt.signals.thm_no_styles ) {
|
2340 |
//if ( !$( '#ctc_enqueue_none' ).is( ':checked' ) ) {
|
2341 |
notice.notices.push( {
|
2345 |
} );
|
2346 |
//}
|
2347 |
$( '#ctc_enqueue_none' ).prop( 'checked', true );
|
2348 |
+
// console.log( 'resubmitting 6' );
|
2349 |
resubmit = 1;
|
2350 |
resubmitdata.ctc_enqueue = 'none';
|
2351 |
}
|
2362 |
|
2363 |
$( 'input[name="ctc_analysis"]' ).val( hidden );
|
2364 |
resubmitdata.ctc_analysis = hidden;
|
2365 |
+
|
2366 |
if ( self.is_success() && resubmit && !self.resubmitting ){
|
2367 |
self.resubmitting = 1;
|
2368 |
self.resubmit( resubmitdata );
|
2371 |
self.resubmitting = 0;
|
2372 |
self.hide_loading();
|
2373 |
$.each( notice.notices, function( ndx, notice ){
|
2374 |
+
// console.log( notice );
|
2375 |
var $out = $( '<div class="' + notice.style + ' notice is-dismissible dashicons-before" >' +
|
2376 |
'<h4>' + notice.headline + '</h4>' +
|
2377 |
notice.msg +
|
2400 |
$.each( self.dependencies, function( ndx, el ){
|
2401 |
// console.log( 'setting dependecy: ' + ndx + ' ' + el );
|
2402 |
if ( el ) {
|
2403 |
+
dep_inputs += '<label class="code"><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_' + ndx +
|
2404 |
'" name="ctc_forcedep[]" type="checkbox" value="' + ndx + '" autocomplete="off" ' +
|
2405 |
+
( -1 !== window.ctcAjax.forcedep.indexOf( ndx ) ? 'checked' : '' ) +
|
2406 |
' />' + ndx + "</label><br/>\n";
|
2407 |
}
|
2408 |
});
|
2415 |
$( '#ctc_dependencies_container' ).hide();
|
2416 |
}
|
2417 |
|
2418 |
+
|
2419 |
if ( !$( '#ctc_child_type_reset' ).is( ':checked' ) ) {
|
2420 |
$( '#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit' ).slideDown( 'fast' );
|
2421 |
if ( $( '#ctc_child_type_duplicate' ).is( ':checked' ) ) {
|
2433 |
$( '#input_row_theme_slug' ).slideDown( 'fast' );
|
2434 |
}
|
2435 |
}
|
2436 |
+
// console.log( 'end css_notice' );
|
|
|
2437 |
}
|
|
|
2438 |
},
|
2439 |
resubmit: function( data ) {
|
2440 |
var self = this;
|
2442 |
self.show_loading( true );
|
2443 |
data.action = 'ctc_update';
|
2444 |
data._wpnonce = $( '#_wpnonce' ).val();
|
2445 |
+
// console.log( '=====>>> RESUBMIT CALLED! <<<=====' );
|
2446 |
+
// console.log( data );
|
2447 |
+
// console.log( self.analysis );
|
2448 |
$.ajax( {
|
2449 |
url: window.ctcAjax.ajaxurl,
|
2450 |
data: data,
|
2451 |
//dataType: 'json',
|
2452 |
type: 'POST'
|
2453 |
} ).done( function() { // response ) {
|
2454 |
+
// console.log( 'resubmit done:' );
|
2455 |
+
// console.log( response );
|
2456 |
self.hide_loading();
|
2457 |
self.do_analysis();
|
2458 |
} ).fail( function() { // xhr, status, err ) {
|
2459 |
//self.do_analysis();
|
2460 |
self.hide_loading();
|
2461 |
+
// console.log( status + ' ' + err );
|
2462 |
// FIXME: handle failure
|
2463 |
} );
|
2464 |
},
|
2471 |
failure: 0
|
2472 |
},
|
2473 |
queue: [],
|
2474 |
+
irreg: [],
|
2475 |
+
swaps: []
|
2476 |
},
|
2477 |
child: {
|
2478 |
deps: [[],[]],
|
2480 |
failure: 0
|
2481 |
},
|
2482 |
queue: [],
|
2483 |
+
irreg: [],
|
2484 |
+
swaps: []
|
2485 |
}
|
2486 |
};
|
2487 |
self.phperr = { parnt: [], child: [] };
|
2498 |
},
|
2499 |
// initialize object vars, bind event listeners to elements, load menus and start plugin
|
2500 |
init: function() {
|
2501 |
+
// console.log( 'initializing...' )
|
2502 |
var self = this;
|
2503 |
// ajax request done
|
2504 |
$( document ).on( 'analysisdone', function(){
|
2505 |
self.done++;
|
2506 |
+
// console.log( 'analysis came home ' + self.done );
|
2507 |
+
// console.log( 'existing: ' + $.chldthmcfg.existing );
|
2508 |
+
// console.log( 'parent: ' + $( '#ctc_theme_parnt' ).val() );
|
2509 |
// all ajax requests done
|
2510 |
if ( self.done > $.chldthmcfg.existing ){
|
2511 |
+
// console.log( 'analysis complete!' );
|
2512 |
self.done = 0;
|
2513 |
self.css_notice();
|
2514 |
}
|
js/chldthmcfg.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
!function(e){"use strict";e.chldthmcfg={escquo:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,""")},getxt:function(e,t){var c=window.ctcAjax[e+"_txt"];return c?(t&&(c=c.replace(/%s/,t)),c):""},getname:function(t){var c=this,n="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt;return c.is_empty(window.ctcAjax.themes[t][n])?"":window.ctcAjax.themes[t][n].Name},frascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},toascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e,t){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if("undefined"!=typeof t&&"0"===e||0===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var c in e)if(e.hasOwnProperty(c))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(window.ctcAjax.themes,function(a,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==a&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/g,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",a=e("#ctc_theme_child").length&&!t.is_empty(e("#ctc_theme_child").val())?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),i=[];return"new"===s&&(a=n),t.theme_exists(a,s)&&i.push(t.getxt("theme_exists").toString().replace(/%s/,a)),t.is_empty(a)&&i.push(t.getxt("inval_theme")),i.length?(t.set_notice({error:i}),!1):"reset"===s?!!confirm(t.getxt("load")):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",a=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?n:c+"-child",s=a,i=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?e.chldthmcfg.getname("child"):e.chldthmcfg.getname("parnt")+" Child",l="",r="",o="00";t.theme_exists(s,"new");)l=t.is_empty(l)?2:l+1,r=o.substring(0,o.length-l.toString().length)+l.toString(),s=a+r;t.testslug=s,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},maybe_show_rewrite:function(){var t,c,n=this;e(".ctc-rewrite-toggle").each(function(a,s){t=e(s).hasClass("rewrite-query")?"query":"selector",c=e("#ctc_sel_ovrd_"+t+"_selected").text(),c.match(/^[\s\u00A0]*$/)?e(s).hide():(e(s).text(n.getxt("rename")),e(s).show())})},selector_input_toggle:function(t){var c,n=this,a=e(t).hasClass("rewrite-query")?"query":"selector",s="ctc_rewrite_"+a,i="ctc_sel_ovrd_"+a+"_selected";e("#"+s).length?(c=e("#"+s+"_orig").val(),e("#"+i).empty().text(c),e(t).text(n.getxt("rename"))):(c=e("#"+i).text(),e("#"+i).html('<textarea id="'+s+'" name="'+s+'" autocomplete="off"></textarea><input id="'+s+'_orig" name="'+s+'_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#"+s).val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),a=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),i=s.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return s.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,s,i=e(this).attr("id"),d=i.toString().match(a),u=d[2],h=d[3],p="undefined"==typeof d[4]?"":d[4],m=d[7],g=d[5],f="undefined"==typeof d[7]?"":d[8],y="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),v="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(y=c.color_text(e(this).data("color")),e(this).data("color",null)),_[i]=y,v&&(_[v]=e("#"+v).is(":checked")?1:0)),""!==y)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!y.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=y.toString().match(w),c.is_empty(s)||(s.shift(),l[h][p+"-width"]=s.shift()||"",s.shift(),l[h][p+"-style"]=s.shift()||"",l[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||y.match(/none/))"seq"!==p&&(l[h][p]=y);else if(y.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,y);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=y.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),r[h].origin=s.shift()||"top",r[h].start=s.shift()||"transparent",r[h].end=s.shift()||"transparent",o[h]=!0):l[h]["background-image"]=y}else switch(f){case"_border_width":l[h][p+"-width"]="none"===y?0:y;break;case"_border_style":l[h][p+"-style"]=y;break;case"_border_color":l[h][p+"-color"]=y;break;case"_background_url":l[h]["background-image"]=c.image_url(h,y);break;case"_background_color":l[h]["background-color"]=y;break;case"_background_color1":r[h].start=y,o[h]=!0;break;case"_background_color2":r[h].end=y,o[h]=!0;break;case"_background_origin":r[h].origin=y,o[h]=!0}}),"undefined"==typeof i||c.is_empty(i.attr("id"))||(i.removeAttr("style"),o.parent&&i.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),i.css(l.parent),i.attr("id").toString().match(/parent/)||(o.child&&i.ctcgrad(r.child.origin,[r.child.start,r.child.end]),i.css(l.child)),i.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,a={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,i=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(i),n.is_empty(c)&&(c=[]),a.names=["_border_width","_border_style","_border_color"],s=c.shift(),a.values[0]=c.shift()||"",c.shift(),a.values[1]=c.shift()||"",c.shift(),a.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(a.names=["_background_url","_background_origin","_background_color1","_background_color2"],a.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))a.values[0]=t;else{var l,r;c=t.toString().split(/:/),a.values[1]=c.shift()||"",a.values[2]=c.shift()||"",l=c.shift()||"",a.values[3]=c.shift()||"",r=c.shift()||"",a.orig=[a.values[1],a.values[2],a.values[3]].join(" ")}return a},image_url:function(e,t){var c,n=this,a=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(a)?null:a[1],i=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+i+s+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.currquery)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.currquery)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.currqsid)},get_queries:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var a=this,s={},i=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){a.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(i[2])&&(i[2]=parseInt(t[2])+1):(a.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[i[2]]={parnt:[],child:i}),s},input_row:function(t,c,n,a,s){var i=this,l="";if(!i.is_empty(a)&&!i.is_empty(a.value)&&!i.is_empty(a.value[c])){var r=a.value[c],o=i.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=i.decode_value(c,i.is_empty(r.parnt)?"":r.parnt[0]),_=i.is_empty(r.parnt)||i.is_empty(r.parnt[1],1)?0:1,d=i.decode_value(c,i.is_empty(r.child)?"":r.child[0]),u=i.is_empty(r.child)||i.is_empty(r.child[1],1)?0:1;if(l+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',l+="ovrd"===n?c.replace(/\d+/g,i.frascii):a.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+i.getxt("edit")+"</a> "+(i.is_empty(o.orig)?i.getxt("child_only"):""),l+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(i.is_empty(o.orig)?"[no value]":o.orig+(_?i.getxt("important"):""))+'</div><div class="ctc-input-cell">',!i.is_empty(o.names)){e.each(o.names,function(e,a){a=i.is_empty(a)?"":a,l+='<div class="ctc-child-input-cell ctc-clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+a;!1===(r=d.values.shift())&&(r=""),l+=(i.is_empty(a)?"":i.getxt(a)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((a+c).toString().match(/color/)?" color-picker":"")+(a.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+i.escquo(r)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;l+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+i.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+i.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+s+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+s+'" name="ctc_save_'+c+"_"+t+"_"+s+'" value="Save" /></div>'),l+="</div><!-- end input row -->\n"})}return l},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=!c.is_empty(window.ctcAjax.palette);try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:!!n,showSelectionPalette:!!n,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+window.ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(){c.coalesce_inputs(this)}).on("keyup",function(){var t=this,n=c.addhash(e(this).val());e(t).val(n),clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(t),e(t).spectrum("set",n)},500))})}catch(a){c.jquery_exception(a,"Spectrum Color Picker")}},addhash:function(e){return e.replace(/^#?([a-f0-9]{3,6}.*)/,"#$1")},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_query").length?(e("#ctc_rewrite_query").val(n.item.value),e("#ctc_sel_ovrd_query").val("")):(t.set_query(n.item.value),t.reset_qsid()),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_selector").length?(e("#ctc_rewrite_selector").val(n.item.label),e("#ctc_sel_ovrd_selector").val("")):t.set_selector(n.item.value,n.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var a,s,i=n.item.label.replace(/[^\w\-]/g,t.toascii);return t.is_empty(t.currdata.value)&&(t.currdata.value={}),t.is_empty(t.currdata.value[n.item.label])&&(t.currdata.value[n.item.label]={}),t.is_empty(t.currdata.value[n.item.label].child)&&(t.currdata.value[n.item.label].child=[]),t.currdata.value[n.item.label].child.push(["",0,1,1]),a=e(t.input_row(t.currqsid,i,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(a),e("#ctc_new_rule_menu").val(""),a.find('input[type="text"]').each(function(c,n){s||(s=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),s&&e(s).focus(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_theme_params:function(t,c){e("#ctc_child_author").val(window.ctcAjax.themes[t][c].Author),e("#ctc_child_version").val(window.ctcAjax.themes[t][c].Version),e("#ctc_child_authoruri").val(window.ctcAjax.themes[t][c].AuthorURI),e("#ctc_child_themeuri").val(window.ctcAjax.themes[t][c].ThemeURI),e("#ctc_child_descr").val(window.ctcAjax.themes[t][c].Descr),e("#ctc_child_tags").val(window.ctcAjax.themes[t][c].Tags)},update_form:function(){var t,c=this;e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug").slideUp("fast"),e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_theme_child").length&&!e("#ctc_child_type_new").is(":checked")?(t=e("#ctc_theme_child").val(),c.existing=1,c.currparnt=window.ctcAjax.themes.child[t].Template,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(c.getname("parnt")),c.set_theme_params("child",t),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_child_template").val(c.testslug),e("#ctc_child_name").val(c.testname),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Duplicate Child Theme")):e("#ctc_child_type_reset").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("3"),e("#ctc_configure_submit").slideDown("fast"),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").hide(),e("#ctc_enqueue_none").prop("checked",!0),e("#ctc_load_styles").val("Reset Child Theme to Previous State")):(e("#ctc_child_template").val(""),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_child_name").val(c.getname("child")),e("#ctc_load_styles").val("Configure Child Theme")),e("#input_row_existing_theme_option").slideDown("fast"),e("#input_row_new_theme_option").slideUp("fast")):(c.existing=0,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(e.chldthmcfg.getname("parnt")),c.set_theme_params("parnt",c.currparnt),e("#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug").slideUp("fast"),e("#input_row_new_theme_option").slideDown("fast"),e("#ctc_child_name").val(c.testname),e("#ctc_child_template").val(c.testslug),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Create New Child Theme"))},set_notice:function(t){var c,n=this,a="";n.is_empty(t)||e.each(t,function(t,c){a+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){a+="<li>"+t.toString()+"</li>\n"}),a+="</ul></div>"}),c=e(a),e("#ctc_error_notice").html(c),n.bind_dismiss(c),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(e){var t=this;t.currparnt=e.value,t.update_form()},set_child_menu:function(e){var t=this;t.currchild=e.value,t.update_form()},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.currquery=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html(" "),c.load_selectors(),void c.scrolltop())},reset_qsid:function(){self.currqsid=null,e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container").hide().find(".ctc-child-value").remove(),e(".ctc-rewrite-toggle").hide()},set_selector:function(t,c){var n=this;return c=null,n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.currqsid=t,n.reload=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.currqsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload=!0,c.load_selector_values()},query_css:function(t,c,n){var a=this,s={ctc_query_obj:t,ctc_query_key:c},i="#ctc_status_"+t+("val_qry"===t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){s["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(i+" .ctc-status-icon").remove(),e(i).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=a.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),a.ajax_post(t,s)},save:function(t){var c,n,a,s,i,l=this,r={},o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),r.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(r.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(r.ctc_sel_ovrd_query=n.text()),l.reload=!0):(a=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=a.val():"ctc_is_debug"===o?r.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:r=l.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e.each(["query","selector"],function(t,c){e("#ctc_rewrite_"+c).length&&(s=e("#ctc_rewrite_"+c).val(),i=e("#ctc_rewrite_"+c+"_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=i:(r["ctc_rewrite_"+c]=s,l.reload=!0),e("#ctc_sel_ovrd_"+c+"_selected").html(s)),e(".ctc-rewrite-toggle").text(l.getxt("rename"))}),r.action=l.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",r._wpnonce=e("#_wpnonce").val(),l.ajax_post("qsid",r)},ajax_post:function(t,c,n){var a=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:a.is_empty(n)?"json":n,type:"POST"}).done(function(e){a.handle_success(t,e)}).fail(function(){a.handle_failure(t)}).always(function(){a.jqueryerr.length&&a.jquery_notice()})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"===t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,a=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+a+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],a=[];c.jqueryerr.length&&(e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var t=e(this).prop("src");c.is_empty(t)||!t.match(/jquery(\.min|\.js|\-?ui)/i)||t.match(/load\-scripts.php/)||n.push("<code><small>"+t.split(/\?/)[0]+"</small></code>")}),a.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),a.push(c.jqueryerr.join("<br/>")),n.length&&a.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),a.push(c.getxt("plugin"))),c.set_notice({error:a})},update:{qsid:function(t){var c,n,a,s,i=this;i.currqsid=t.key,i.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(i.currqsid),i.is_empty(i.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+i.currqsid,a=parseInt(i.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+a+'" />',e("#ctc_child_load_order_container").html(n)),i.is_empty(i.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty(),i.load_selectors()):(s=!1,n="",e.each(i.currdata.value,function(e,t){t=null,n+=i.input_row(i.currqsid,e,"ovrd",i.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){i.setup_spectrum(this)}),i.coalesce_inputs("#ctc_child_all_0_swatch")),i.reload&&(i.load_queries(),i.load_selectors(),i.set_query(i.currdata.query),i.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(i.currdata.selector),i.maybe_show_rewrite(),s?i.reset_qsid():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,#input_row_load_order").fadeIn()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var s=c.decode_value(n,t);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+s.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),a+="</div>\n"),e("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,a=this,s="";a.is_empty(t.data)||e.each(t.data,function(n,i){c=n,e.each(i,function(c,i){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",a.is_empty(i)||e.each(i,function(e,c){s+=a.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){a.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){a.coalesce_inputs(this)})},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_box").val(e("#ctc_debug_box").val()+t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)},dismiss:function(){}},bind_dismiss:function(t){var c=this,n=e(t),a=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";a.find(".screen-reader-text").text(s),n.append(a),a.on("click.wp-dismiss-notice",function(e){e.preventDefault(),c.dismiss_notice(t)})},dismiss_notice:function(t){e(t).fadeTo(100,0,function(){e(this).slideUp(100,function(){e(this).remove()})})},reset_handling:function(){e("#parnt_analysis_notice .notice, #child_analysis_notice .notice").slideUp(),e("#ctc_enqueue_enqueue").prop("checked",!0),e("#ctc_handling_primary").prop("checked",!0),e("#ctc_ignoreparnt").prop("checked",!1),e("#ctc_repairheader").prop("checked",!1)},init:function(){var t=this;if(!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>"),a=c.value.replace(/[^\w\-]/g,"");return e("#ctc_theme_option_"+a).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.reset_handling(),t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(window.ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.reset_handling(),t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.currparnt=e("#ctc_theme_parnt").val(),t.currchild=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",e("#ctc_main").on("click",".ctc-section-toggle",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .notice-warning, .updated, .error").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#ctc_main").on("click",".ctc-upgrade-notice .notice-dismiss",function(){var c={action:"ctc_dismiss",_wpnonce:e("#_wpnonce").val()};t.ajax_post("dismiss",c)}),t.is_empty(t.jqueryerr)&&(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n,a,s=e(this).attr("id").toString().replace("_close",""),i=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(n=i[1],a=i[2],t.query_css("val_qry",a,{rule:n}))),e("#"+s+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+s+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_main").on("click",".ctc-backup-theme",function(c){c.preventDefault(),t.existing?e("#ctc_export_theme").val(t.currchild):e("#ctc_export_theme").val(t.currparnt),e("#ctc_export_theme_form").submit()}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"===c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){if(c.preventDefault(),e(c.target).hasClass("ctc-disabled"))return!1;e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(c.target).hasClass("ajax-pending")||e(c.target).hasClass("ctc-disabled")?!1:(e(c.target).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){c.preventDefault();var n=e("#ctc_save_query_selector");return n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}),e("#ctc_rule_value_form").on("submit",function(e){return e.preventDefault(),!1}),e("#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset").on("focus click",function(){t.reset_handling(),t.update_form()}),e("#ctc_is_debug").on("change",function(){e(this).is(":checked")?e("#ctc_debug_box").length||e("#ctc_debug_container").html('<textarea id="ctc_debug_box"></textarea>'):e("#ctc_debug_box").remove(),t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),t.update_form()),t.jqueryerr.length&&t.jquery_notice()},testslug:"",testname:"",reload:!1,currquery:"base",currqsid:null,currdata:{},currparnt:"",currchild:"",existing:!1,jqueryerr:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmanalyze={escrgx:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},trmcss:function(e){return"undefined"==typeof e?"":e.replace(/\-css$/,"")},show_loading:function(t,c){var n=e.chldthmcfg.existing?"child":"parnt",a=c?c:e.chldthmcfg.getname(n),s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+a+"...</strong>";self.noticediv="",e("#"+n+"_analysis_notice").html(s)},hide_loading:function(){e(".ctc_analyze_loading").fadeTo(200,0,function(){e(this).slideUp(200,function(){e(this).remove()})})},setssl:function(e){return e.replace(/^https?/,window.ctcAjax.ssl?"https":"http")},analyze_theme:function(t){var c=this,n=Math.floor(e.now()/1e3),a="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s="&template="+encodeURIComponent(e.chldthmcfg.currparnt)+"&stylesheet="+encodeURIComponent(a)+"&now="+n,i=c.setssl(window.ctcAjax.homeurl),l=i+s;c.analysis[t].url=l,e.get(l,function(n){c.parse_page(t,n),e(document).trigger("analysisdone")}).fail(function(n,s,i){c.analysis[t].signals.xhrgeterr=i,e.ajax({url:window.ctcAjax.ajaxurl,data:{action:"ctc_analyze",stylesheet:a,template:e.chldthmcfg.currparnt,
|
2 |
-
_wpnonce:e("#_wpnonce").val()},dataType:"json",type:"POST"}).done(function(n){n.signals.httperr?(c.analysis[t].signals.failure=1,c.analysis[t].signals.httperr=n.signals.httperr):c.parse_page(t,n.body),e(document).trigger("analysisdone")}).fail(function(n,a,s){c.analysis[t].signals.failure=1,c.analysis[t].signals.xhrajaxerr=s,e(document).trigger("analysisdone")})})},parse_page:function(t,c){var n,a,s,i=this,l=window.ctcAjax.theme_dir,r="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,o=i.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+i.escrgx(r):""),_=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+i.escrgx(l)+"/("+o+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),d=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,u=0,h=0;if("child"===t){c.match(/^[\s\S]*?<head>([\s\S]*?)<\/head>/)}for((a=c.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?i.analysis[t].queue=a[1].split(/\n/):(i.analysis[t].queue=[],i.analysis[t].signals.thm_noqueue=1),(a=c.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?i.analysis[t].irreg=a[1].split(/\n/):i.analysis[t].irreg=[],c.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(i.analysis[t].signals.thm_ignoreparnt=1),c.match(/IS_CTC_THEME/)&&(i.analysis[t].signals.thm_is_ctc=1),c.match(/NO_CTC_STYLES/)&&(i.analysis[t].signals.thm_no_styles=1),c.match(/HAS_CTC_IMPORT/)&&(i.analysis[t].signals.thm_has_import=1),c.match(/HAS_WP_CACHE/)&&(i.analysis[t].signals.thm_has_cache=1),c.match(/HAS_WP_ROCKET/)&&(i.analysis[t].signals.thm_has_wprocket=1),c.match(/HAS_AUTOPTIMIZE/)&&(i.analysis[t].signals.thm_has_autoptimize=1),c=c.replace(/<!\-\-[\s\S]*?\-\->/g,"");n=d.exec(c);){var p=n[0].replace(/<.*?>/g,"");i.phperr[t].push(p),i.analysis[t].signals.err_php=1,p.match(/Fatal error/i)&&(i.analysis[t].signals.err_fatal=1)}for(;s=_.exec(c);){var m=i.trmcss(s[2]),g=s[3],f=s[4],y=e.chldthmcfg.currparnt===g?"parnt":"child",v=0;if(""===m||-1===e.inArray(m,i.analysis[t].queue))v=1;else if(0===m.indexOf("chld_thm_cfg")){f.match(/^ctc\-style.*?\.css$/)?(u=1,i.analysis[t].signals.ctc_sep_loaded=1):f.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(u=1,i.analysis[t].signals.ctc_gen_loaded=1):m.match(/^chld_thm_cfg_ext/)?f.match(/rtl.*?\.css$/)?i.analysis[t].signals.thm_rtl=1:(i.analysis[t].signals.ctc_ext_loaded=1,i.analysis[t].deps[u].push([m,f])):"chld_thm_cfg_child"===m?(i.analysis[t].signals.ctc_child_loaded=1,i.analysis[t].deps[u].push([m,f])):"chld_thm_cfg_parent"===m&&(i.analysis[t].signals.ctc_parnt_loaded=1,i.analysis[t].deps[u].push([m,f]),u&&(i.analysis[t].signals.ctc_parnt_reorder=1));continue}if(f.match(/^style.*?\.css$/))u=1,"parnt"===y?v?i.analysis[t].signals.thm_parnt_loaded="thm_unregistered":(i.analysis[t].signals.thm_parnt_loaded=m,"child"===t&&i.analysis[t].signals.thm_child_loaded&&(i.analysis[t].signals.ctc_parnt_reorder=1)):i.analysis[t].signals.thm_child_loaded=v?"thm_unregistered":m,v?h?(i.analysis[t].signals.thm_past_wphead=1,i.analysis[t].deps[u].push(["thm_past_wphead",f])):(i.analysis[t].signals.thm_unregistered=1,i.analysis[t].deps[u].push(["thm_unregistered",f])):i.analysis[t].deps[u].push([m,f]);else if(f.match(/rtl.*?\.css$/))i.analysis[t].signals.thm_rtl=1;else if("ctc-test.css"===f)h=1;else{var w=null;v&&(w="dep_unregistered"),h&&(w=u?"css_past_wphead":"dep_past_wphead"),w?(i.analysis[t].signals[w]=1,m=w):i.dependencies[m]=f,i.analysis[t].deps[u].push([m,f])}}u||(i.analysis[t].signals.thm_notheme=1)},css_notice:function(){var t,c,n=this,a=e.chldthmcfg.existing?"child":"parnt",s=e.chldthmcfg.getname(a),i="",l={notices:[]},r={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:"",msg:e.chldthmcfg.getxt("anlz7")},o=0,_={},d="",u={};if(n.analysis[a].signals.failure||n.analysis[a].signals.thm_noqueue&&!n.phperr[a].length)d=e.chldthmcfg.getxt("anlz33").replace(/%1/,'<a href="'+n.analysis[a].url+'" target="_new">').replace(/%2/,"</a>"),l.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5")+d,style:"notice-warning"});else if(n.phperr[a].length&&(e.each(n.phperr[a],function(e,t){t.match(/Fatal error/i)&&(u.fatal=1),t.match(/Constant \w+ already defined in .+?wp-config.php/i)&&(u.config=1),r.errlist+=t+"\n"}),u.fatal&&(r.style="error",r.headline=e.chldthmcfg.getxt("anlz8",s)),u.config&&(r.msg=e.chldthmcfg.getxt("anlzconfig",s)+r.msg),r.msg='<div style="background-color:#ffeebb;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_errs">'+e.chldthmcfg.getxt("anlz6")+'</div><div id="ctc_analysis_errs_content"><textarea>'+r.errlist+"</textarea></div></div>"+r.msg,l.notices.push(r)),n.analysis[a].signals.thm_has_wprocket&&n.analysis[a].signals.thm_has_autoptimize)l.notices.push({headline:e.chldthmcfg.getxt("anlzcache1"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlzcache2")});else if(!n.analysis[a].signals.thm_noqueue){if((n.analysis[a].signals.thm_past_wphead||n.analysis[a].signals.dep_past_wphead)&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz9"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz10")}),e("#ctc_repairheader").prop("checked",!0),e("#ctc_repairheader_container").show()),n.analysis[a].signals.thm_unregistered&&(n.analysis[a].signals.ctc_child_loaded||n.analysis[a].signals.ctc_sep_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz11"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz12")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0))),"child"===a&&(n.analysis.child.signals.ctc_parnt_reorder&&(o=1),n.analysis.child.signals.ctc_child_loaded||n.analysis.child.signals.ctc_sep_loaded||n.analysis.child.signals.thm_child_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=1),n.analysis[a].signals.ctc_gen_loaded&&l.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),n.analysis.parnt.signals.thm_no_styles||n.analysis.child.signals.ctc_gen_loaded||n.analysis.child.signals.thm_parnt_loaded||n.analysis.child.signals.ctc_parnt_loaded||n.analysis.child.signals.thm_ignoreparnt||n.analysis.child.signals.thm_has_import||(l.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=1),n.analysis.child.signals.thm_unregistered&&n.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===n.analysis.child.signals.thm_child_loaded&&n.analysis.child.signals.ctc_child_loaded&&n.analysis.child.signals.ctc_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz28"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz29")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0)),n.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||l.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"}),!n.analysis.child.signals.thm_rtl&&n.analysis.parnt.signals.thm_rtl&&l.notices.push({headline:e.chldthmcfg.getxt("anlzrtl"),msg:e.chldthmcfg.getxt("anlzrtl2"),style:"notice-warning"})),(n.analysis[a].signals.ctc_sep_loaded||n.analysis[a].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),l.notices.length||l.notices.push({headline:""+("child"===a?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===a&&n.analysis.child.signals.thm_has_import&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),n.analysis[a].signals.thm_ignoreparnt||n.analysis[a].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),!n.analysis[a].signals.ctc_sep_loaded&&!n.analysis[a].signals.ctc_gen_loaded&&!n.analysis[a].signals.ctc_child_loaded&&!n.analysis[a].signals.thm_unregistered&&!n.analysis[a].signals.thm_past_wphead&&n.analysis[a].deps[1].length){var h="";e.each(n.analysis[a].deps[1],function(e,t){t[1].match(/^style.*?\.css$/)||(h+="<li>"+t[1]+"</li>\n")}),""!==h&&(h="<ul class='howto' style='padding-left:1em'>\n"+h+"</ul>\n",l.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:h+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===a&&n.analysis[a].signals.thm_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none"),n.analysis.parnt.signals.thm_no_styles&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")}return i=encodeURIComponent(JSON.stringify(n.analysis)),e('input[name="ctc_analysis"]').val(i),_.ctc_analysis=i,n.is_success()&&o&&!n.resubmitting?(n.resubmitting=1,void n.resubmit(_)):(n.resubmitting=0,n.hide_loading(),e.each(l.notices,function(t,c){var n=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(n),n.hide().appendTo("#"+a+"_analysis_notice").slideDown()}),t='<div style="background-color:#ddd;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_obj">'+e.chldthmcfg.getxt("anlz30")+'</div><div id="ctc_analysis_obj_content" style="display:none"><textarea style="font-family:monospace;font-size:10px">'+JSON.stringify(n.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+a+"_analysis_notice"),c="",e.each(n.dependencies,function(t,n){n&&(c+='<label><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_'+t+'" name="ctc_forcedep[]" type="checkbox" value="'+t+'" autocomplete="off" '+(-1!==e.inArray(t,window.ctcAjax.forcedep)?"checked":"")+" />"+t+"</label><br/>\n")}),c.length?(e("#ctc_dependencies").html(c),e("#ctc_dependencies_container").show()):(e("#ctc_dependencies").empty(),e("#ctc_dependencies_container").hide()),e("#ctc_child_type_reset").is(":checked")||(e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit").slideDown("fast"),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("8"),e("#ctc_copy_theme_mods").find("input").prop("checked",!1)):(e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_copy_theme_mods").slideDown("fast")),e("#ctc_child_type_duplicate").is(":checked")||e("#ctc_child_type_new").is(":checked")?(e("#input_row_theme_slug").hide(),e("#input_row_new_theme_slug").slideDown("fast")):(e("#input_row_new_theme_slug").hide(),e("#input_row_theme_slug").slideDown("fast"))),void 0)},resubmit:function(t){var c=this;c.hide_loading(),c.show_loading(!0),t.action="ctc_update",t._wpnonce=e("#_wpnonce").val(),e.ajax({url:window.ctcAjax.ajaxurl,data:t,type:"POST"}).done(function(){c.hide_loading(),c.do_analysis()}).fail(function(){c.hide_loading()})},do_analysis:function(){var t=this;t.analysis={parnt:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[]},child:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[]}},t.phperr={parnt:[],child:[]},t.dependencies={},t.done=0,t.show_loading(!1),t.analyze_theme("parnt"),e.chldthmcfg.existing&&t.analyze_theme("child")},init:function(){var t=this;e(document).on("analysisdone",function(){t.done++,t.done>e.chldthmcfg.existing&&(t.done=0,t.css_notice())}),e("#ctc_main").on("click",".ctc-analyze-theme",function(){t.is_success()&&e.chldthmcfg.dismiss_notice(e(".ctc-success-response").parent(".notice")),t.do_analysis()}),t.is_success()&&!window.ctcAjax.pluginmode&&t.do_analysis()},analysis:{},done:0,resubmitting:0,dependencies:{},is_success:function(){return e(".ctc-success-response").length}},e("#request-filesystem-credentials-form").length||(e.chldthmcfg.init(),e.chldthmanalyze.init())}(jQuery);
|
1 |
!function(e){"use strict";e.chldthmcfg={escquo:function(e){var t=this;return t.is_empty(e)?e:e.toString().replace(/"/g,""")},getxt:function(e,t){var c=window.ctcAjax[e+"_txt"];return c?(t&&(c=c.replace(/%s/,t)),c):""},getname:function(t){var c=this,n="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt;return c.is_empty(window.ctcAjax.themes[t][n])?"":window.ctcAjax.themes[t][n].Name},frascii:function(e){var t=parseInt(e),c=String.fromCharCode(t);return c},toascii:function(e){var t=e.charCodeAt(0);return t},is_empty:function(e,t){if("undefined"==typeof e||!1===e||null===e||""===e)return!0;if("undefined"!=typeof t&&"0"===e||0===e)return!0;if(!0===e||"string"==typeof e||"number"==typeof e)return!1;if("object"==typeof e){for(var c in e)if(e.hasOwnProperty(c))return!1;return!0}return!1},theme_exists:function(t,c){var n=!1;return e.each(window.ctcAjax.themes,function(a,s){return e.each(s,function(e,s){return s=null,e.toLowerCase()!==t.toLowerCase()||"parnt"!==a&&"new"!==c?void 0:(n=!0,!1)}),n?!1:void 0}),n},validate:function(){var t=this,c=/[^\w\-]/g,n=e("#ctc_child_template").length?e("#ctc_child_template").val().toString().replace(c):"",a=e("#ctc_theme_child").length&&!t.is_empty(e("#ctc_theme_child").val())?e("#ctc_theme_child").val().toString().replace(c):n,s=e("input[name=ctc_child_type]:checked").val(),i=[];return"new"===s&&(a=n),t.theme_exists(a,s)&&i.push(t.getxt("theme_exists").toString().replace(/%s/,a)),t.is_empty(a)&&i.push(t.getxt("inval_theme")),i.length?(t.set_notice({error:i}),!1):"reset"===s?!!confirm(t.getxt("load")):!0},autogen_slugs:function(){if(e("#ctc_theme_parnt").length){for(var t=this,c=e("#ctc_theme_parnt").val(),n=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",a=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?n:c+"-child",s=a,i=""!==n&&e("#ctc_child_type_duplicate").is(":checked")?e.chldthmcfg.getname("child"):e.chldthmcfg.getname("parnt")+" Child",l="",r="",o="00";t.theme_exists(s,"new");)l=t.is_empty(l)?2:l+1,r=o.substring(0,o.length-l.toString().length)+l.toString(),s=a+r;t.testslug=s,t.testname=i+(r.length?" "+r:"")}},focus_panel:function(t){var c=t+"_panel";e(".nav-tab").removeClass("nav-tab-active"),e(".ctc-option-panel").removeClass("ctc-option-panel-active"),e(t).addClass("nav-tab-active"),e(".ctc-option-panel-container").scrollTop(0),e(c).addClass("ctc-option-panel-active")},maybe_show_rewrite:function(){var t,c,n=this;e(".ctc-rewrite-toggle").each(function(a,s){t=e(s).hasClass("rewrite-query")?"query":"selector",c=e("#ctc_sel_ovrd_"+t+"_selected").text(),c.match(/^[\s\u00A0]*$/)?e(s).hide():(e(s).text(n.getxt("rename")),e(s).show())})},selector_input_toggle:function(t){var c,n=this,a=e(t).hasClass("rewrite-query")?"query":"selector",s="ctc_rewrite_"+a,i="ctc_sel_ovrd_"+a+"_selected";e("#"+s).length?(c=e("#"+s+"_orig").val(),e("#"+i).empty().text(c),e(t).text(n.getxt("rename"))):(c=e("#"+i).text(),e("#"+i).html('<textarea id="'+s+'" name="'+s+'" autocomplete="off"></textarea><input id="'+s+'_orig" name="'+s+'_orig" type="hidden" value="'+n.escquo(c)+'"/>'),e("#"+s).val(c),e(t).text(n.getxt("cancel")))},coalesce_inputs:function(t){var c=this,n=e(t).attr("id"),a=/^(ctc_(ovrd|\d+)_(parent|child)_([0-9a-z\-]+)_(\d+?)(_(\d+))?)(_\w+)?$/,s=e(t).parents(".ctc-selector-row, .ctc-parent-row").first(),i=s.find(".ctc-swatch").first(),l={parent:{},child:{}},r={parent:{origin:"",start:"",end:""},child:{origin:"",start:"",end:""}},o={child:!1,parent:!1},_={};return s.find(".ctc-parent-value, .ctc-child-value").each(function(){var t,s,i=e(this).attr("id"),d=i.toString().match(a),u=d[2],h=d[3],p="undefined"==typeof d[4]?"":d[4],m=d[7],g=d[5],f="undefined"==typeof d[7]?"":d[8],y="parent"===h?e(this).text().replace(/!$/,""):"seq"!==p&&"ctc_delete_query_selector"===n?"":e(this).val(),v="seq"===p?!1:"ctc_"+u+"_child_"+p+"_i_"+g+"_"+m;if("child"===h&&(c.is_empty(e(this).data("color"))||(y=c.color_text(e(this).data("color")),e(this).data("color",null)),_[i]=y,v&&(_[v]=e("#"+v).is(":checked")?1:0)),""!==y)if(c.is_empty(f))if(t=p.toString().match(/^border(\-(top|right|bottom|left))?$/)&&!y.match(/none/)){var w=new RegExp(c.border_regx+c.color_regx,"i");s=y.toString().match(w),c.is_empty(s)||(s.shift(),l[h][p+"-width"]=s.shift()||"",s.shift(),l[h][p+"-style"]=s.shift()||"",l[h][p+"-color"]=s.shift()||"")}else if("background-image"!==p||y.match(/none/))"seq"!==p&&(l[h][p]=y);else if(y.toString().match(/url\(/))l[h]["background-image"]=c.image_url(h,y);else{var x=new RegExp(c.grad_regx+c.color_regx+c.color_regx,"i");s=y.toString().match(x),!c.is_empty(s)&&s.length>2?(s.shift(),r[h].origin=s.shift()||"top",r[h].start=s.shift()||"transparent",r[h].end=s.shift()||"transparent",o[h]=!0):l[h]["background-image"]=y}else switch(f){case"_border_width":l[h][p+"-width"]="none"===y?0:y;break;case"_border_style":l[h][p+"-style"]=y;break;case"_border_color":l[h][p+"-color"]=y;break;case"_background_url":l[h]["background-image"]=c.image_url(h,y);break;case"_background_color":l[h]["background-color"]=y;break;case"_background_color1":r[h].start=y,o[h]=!0;break;case"_background_color2":r[h].end=y,o[h]=!0;break;case"_background_origin":r[h].origin=y,o[h]=!0}}),"undefined"==typeof i||c.is_empty(i.attr("id"))||(i.removeAttr("style"),o.parent&&i.ctcgrad(r.parent.origin,[r.parent.start,r.parent.end]),i.css(l.parent),i.attr("id").toString().match(/parent/)||(o.child&&i.ctcgrad(r.child.origin,[r.child.start,r.child.end]),i.css(l.child)),i.css({"z-index":-1})),_},decode_value:function(e,t){t="undefined"==typeof t?"":t;var c,n=this,a={orig:t,names:[""],values:[t]};if(e.toString().match(/^border(\-(top|right|bottom|left))?$/)){var s,i=new RegExp(n.border_regx+"("+n.color_regx+")?","i");c=t.toString().match(i),n.is_empty(c)&&(c=[]),a.names=["_border_width","_border_style","_border_color"],s=c.shift(),a.values[0]=c.shift()||"",c.shift(),a.values[1]=c.shift()||"",c.shift(),a.values[2]=c.shift()||""}else if(e.toString().match(/^background\-image/))if(a.names=["_background_url","_background_origin","_background_color1","_background_color2"],a.values=["","","",""],n.is_empty(t)||t.toString().match(/(url|none)/))a.values[0]=t;else{var l,r;c=t.toString().split(/:/),a.values[1]=c.shift()||"",a.values[2]=c.shift()||"",l=c.shift()||"",a.values[3]=c.shift()||"",r=c.shift()||"",a.orig=[a.values[1],a.values[2],a.values[3]].join(" ")}return a},image_url:function(e,t){var c,n=this,a=t.toString().match(/url\(['" ]*(.+?)['" ]*\)/),s=n.is_empty(a)?null:a[1],i=window.ctcAjax.theme_uri+"/"+("parent"===e?window.ctcAjax.parnt:window.ctcAjax.child)+"/";return s?c=s.toString().match(/^(data:|https?:|\/)/)?t:"url("+i+s+")":!1},setup_menus:function(){var e=this;e.setup_query_menu(),e.setup_selector_menu(),e.setup_rule_menu(),e.setup_new_rule_menu(),e.load_queries(),e.load_rules(),e.set_query(e.currquery)},load_queries:function(){var e=this;e.query_css("queries",null)},load_selectors:function(){var e=this;e.query_css("selectors",e.currquery)},load_rules:function(){var e=this;e.query_css("rules",null)},load_selector_values:function(){var e=this;e.query_css("qsid",e.currqsid)},get_queries:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(t)&&n.push({label:t,value:t})}),c(n)},get_selectors:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.chldthmcfg.is_empty(this.element.data("menu"))?n.push({label:window.ctcAjax.nosels_txt,value:null}):e.each(this.element.data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},get_filtered_rules:function(t,c){var n=[],a=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");e.each(e("#ctc_rule_menu").data("menu"),function(e,t){a.test(e)&&n.push({label:e,value:t})}),c(n)},merge_ruleval_arrays:function(t,c,n){var a=this,s={},i=n?c.child.pop():null;return e.each(["parnt","child"],function(t,l){a.is_empty(c[l])||e.each(c[l],function(e,t){n?parseInt(t[2])>=parseInt(i[2])&&(i[2]=parseInt(t[2])+1):(a.is_empty(s[t[2]])&&(s[t[2]]={}),s[t[2]][l]=t)})}),n&&(s[i[2]]={parnt:[],child:i}),s},input_row:function(t,c,n,a,s){var i=this,l="";if(!i.is_empty(a)&&!i.is_empty(a.value)&&!i.is_empty(a.value[c])){var r=a.value[c],o=i.merge_ruleval_arrays(c,r,s);e.each(o,function(s,r){var o=i.decode_value(c,i.is_empty(r.parnt)?"":r.parnt[0]),_=i.is_empty(r.parnt)||i.is_empty(r.parnt[1],1)?0:1,d=i.decode_value(c,i.is_empty(r.child)?"":r.child[0]),u=i.is_empty(r.child)||i.is_empty(r.child[1],1)?0:1;if(l+='<div class="ctc-'+("ovrd"===n?"input":"selector")+'-row clearfix"><div class="ctc-input-cell">',l+="ovrd"===n?c.replace(/\d+/g,i.frascii):a.selector+'<br/><a href="#" class="ctc-selector-edit" id="ctc_selector_edit_'+t+'" >'+i.getxt("edit")+"</a> "+(i.is_empty(o.orig)?i.getxt("child_only"):""),l+='</div><div class="ctc-parent-value ctc-input-cell"'+("ovrd"!==n?' style="display:none"':"")+' id="ctc_'+n+"_parent_"+c+"_"+t+"_"+s+'">'+(i.is_empty(o.orig)?"[no value]":o.orig+(_?i.getxt("important"):""))+'</div><div class="ctc-input-cell">',!i.is_empty(o.names)){e.each(o.names,function(e,a){a=i.is_empty(a)?"":a,l+='<div class="ctc-child-input-cell ctc-clear">';var r,o="ctc_"+n+"_child_"+c+"_"+t+"_"+s+a;!1===(r=d.values.shift())&&(r=""),l+=(i.is_empty(a)?"":i.getxt(a)+":<br/>")+'<input type="text" id="'+o+'" name="'+o+'" class="ctc-child-value'+((a+c).toString().match(/color/)?" color-picker":"")+(a.toString().match(/url/)?" ctc-input-wide":"")+'" value="'+i.escquo(r)+'" /></div>'});var h="ctc_"+n+"_child_"+c+"_i_"+t+"_"+s;l+='<label for="'+h+'"><input type="checkbox" id="'+h+'" name="'+h+'" value="1" '+(u?"checked":"")+" />"+i.getxt("important")+"</label>"}l+="</div>","ovrd"!==n&&(l+='<div class="ctc-swatch ctc-specific" id="ctc_child_'+c+"_"+t+"_"+s+'_swatch">'+i.getxt("swatch")+'</div><div class="ctc-child-input-cell ctc-button-cell" id="ctc_save_'+c+"_"+t+"_"+s+'_cell"><input type="button" class="button ctc-save-input" id="ctc_save_'+c+"_"+t+"_"+s+'" name="ctc_save_'+c+"_"+t+"_"+s+'" value="Save" /></div>'),l+="</div><!-- end input row -->\n"})}return l},scrolltop:function(){e("html, body, .ctc-option-panel-container").animate({scrollTop:0})},css_preview:function(e){var t=this;(e=e.match(/(child|parnt)/)[1])||(e="child"),t.query_css("preview",e)},setup_iris:function(e){var t=this;t.setup_spectrum(e)},setup_spectrum:function(t){var c=this,n=!c.is_empty(window.ctcAjax.palette);try{e(t).spectrum({showInput:!0,allowEmpty:!0,showAlpha:!0,showInitial:!0,preferredFormat:"hex",clickoutFiresChange:!0,move:function(n){e(t).data("color",n),c.coalesce_inputs(t)},showPalette:!!n,showSelectionPalette:!!n,palette:[],maxSelectionSize:36,localStorageKey:"ctc-palette."+window.ctcAjax.child,hideAfterPaletteSelect:!0}).on("change",function(){c.coalesce_inputs(this)}).on("keyup",function(){var t=this,n=c.addhash(e(this).val());e(t).val(n),clearTimeout(e(this).data("spectrumTimer")),e(this).data("spectrumTimer",setTimeout(function(){c.coalesce_inputs(t),e(t).spectrum("set",n)},500))})}catch(a){c.jquery_exception(a,"Spectrum Color Picker")}},addhash:function(e){return e.replace(/^#?([a-f0-9]{3,6}.*)/,"#$1")},color_text:function(e){var t=this;return t.is_empty(e)?"":e.getAlpha()<1?e.toRgbString():e.toHexString()},setup_query_menu:function(){var t=this;try{e("#ctc_sel_ovrd_query").autocomplete({source:t.get_queries,minLength:0,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_query").length?(e("#ctc_rewrite_query").val(n.item.value),e("#ctc_sel_ovrd_query").val("")):(t.set_query(n.item.value),t.reset_qsid()),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Query Menu")}},setup_selector_menu:function(){var t=this;try{e("#ctc_sel_ovrd_selector").autocomplete({source:t.get_selectors,selectFirst:!0,autoFocus:!0,select:function(c,n){return e("#ctc_rewrite_selector").length?(e("#ctc_rewrite_selector").val(n.item.label),e("#ctc_sel_ovrd_selector").val("")):t.set_selector(n.item.value,n.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Selector Menu")}},setup_rule_menu:function(){var t=this;try{e("#ctc_rule_menu").autocomplete({source:t.get_rules,selectFirst:!0,autoFocus:!0,select:function(e,c){return t.set_rule(c.item.value,c.item.label),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"Property Menu")}},setup_new_rule_menu:function(){var t=this;try{e("#ctc_new_rule_menu").autocomplete({source:t.get_filtered_rules,selectFirst:!0,autoFocus:!0,select:function(c,n){c.preventDefault();var a,s,i=n.item.label.replace(/[^\w\-]/g,t.toascii);return t.is_empty(t.currdata.value)&&(t.currdata.value={}),t.is_empty(t.currdata.value[n.item.label])&&(t.currdata.value[n.item.label]={}),t.is_empty(t.currdata.value[n.item.label].child)&&(t.currdata.value[n.item.label].child=[]),t.currdata.value[n.item.label].child.push(["",0,1,1]),a=e(t.input_row(t.currqsid,i,"ovrd",t.currdata,!0)),e("#ctc_sel_ovrd_rule_inputs").append(a),e("#ctc_new_rule_menu").val(""),a.find('input[type="text"]').each(function(c,n){s||(s=n),e(n).hasClass("color-picker")&&t.setup_spectrum(n)}),s&&e(s).focus(),!1},focus:function(e){e.preventDefault()}}).data("menu",{})}catch(c){t.jquery_exception(c,"New Property Menu")}},set_theme_params:function(t,c){e("#ctc_child_author").val(window.ctcAjax.themes[t][c].Author),e("#ctc_child_version").val(window.ctcAjax.themes[t][c].Version),e("#ctc_child_authoruri").val(window.ctcAjax.themes[t][c].AuthorURI),e("#ctc_child_themeuri").val(window.ctcAjax.themes[t][c].ThemeURI),e("#ctc_child_descr").val(window.ctcAjax.themes[t][c].Descr),e("#ctc_child_tags").val(window.ctcAjax.themes[t][c].Tags)},update_form:function(){var t,c=this;e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_additional_css_files_container,#input_row_new_theme_slug,#input_row_duplicate_theme_slug,#ctc_copy_theme_mods,#ctc_child_header_parameters,#ctc_configure_submit,#input_row_theme_slug").slideUp("fast"),e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_theme_child").length&&!e("#ctc_child_type_new").is(":checked")?(t=e("#ctc_theme_child").val(),c.existing=1,c.currparnt=window.ctcAjax.themes.child[t].Template,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(c.getname("parnt")),c.set_theme_params("child",t),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_child_template").val(c.testslug),e("#ctc_child_name").val(c.testname),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Duplicate Child Theme")):e("#ctc_child_type_reset").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("3"),e("#ctc_configure_submit").slideDown("fast"),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").hide(),e("#ctc_enqueue_none").prop("checked",!0),e("#ctc_load_styles").val("Reset Child Theme to Previous State")):(e("#ctc_child_template").val(""),e("#theme_slug_container").text(t),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_child_name").val(c.getname("child")),e("#ctc_load_styles").val("Configure Child Theme")),e("#input_row_existing_theme_option").slideDown("fast"),e("#input_row_new_theme_option").slideUp("fast")):(c.existing=0,c.autogen_slugs(),e("#ctc_theme_parnt").val(c.currparnt),e("#ctc_theme_parnt-button .ui-selectmenu-text").text(e.chldthmcfg.getname("parnt")),c.set_theme_params("parnt",c.currparnt),e("#input_row_existing_theme_option,#input_row_duplicate_theme_container,#input_row_theme_slug").slideUp("fast"),e("#input_row_new_theme_option").slideDown("fast"),e("#ctc_child_name").val(c.testname),e("#ctc_child_template").val(c.testslug),e(".ctc-analyze-theme, .ctc-analyze-howto").show(),e("#ctc_load_styles").val("Create New Child Theme"))},set_notice:function(t){var c,n=this,a="";n.is_empty(t)||e.each(t,function(t,c){a+='<div class="'+t+' notice is-dismissible dashicons-before"><ul>\n',e(c).each(function(e,t){a+="<li>"+t.toString()+"</li>\n"}),a+="</ul></div>"}),c=e(a),e("#ctc_error_notice").html(c),n.bind_dismiss(c),e("html, body").animate({scrollTop:0},"slow")},set_parent_menu:function(e){var t=this;t.currparnt=e.value,t.update_form()},set_child_menu:function(e){var t=this;t.currchild=e.value,t.update_form()},set_query:function(t){var c=this;return c.is_empty(t)?!1:(c.currquery=t,e("#ctc_sel_ovrd_query").val(""),e("#ctc_sel_ovrd_query_selected").text(t),e("#ctc_sel_ovrd_selector").val(""),e("#ctc_sel_ovrd_selector_selected").html(" "),c.load_selectors(),void c.scrolltop())},reset_qsid:function(){self.currqsid=null,e("#ctc_sel_ovrd_rule_inputs").empty(),e("#ctc_sel_ovrd_new_rule,#input_row_load_order,#ctc_sel_ovrd_rule_inputs_container").hide().find(".ctc-child-value").remove(),e(".ctc-rewrite-toggle").hide()},set_selector:function(t,c){var n=this;return c=null,n.is_empty(t)?!1:(e("#ctc_sel_ovrd_selector").val(""),n.currqsid=t,n.reload=!1,n.load_selector_values(),void n.scrolltop())},set_rule:function(t,c){var n=this;return n.is_empty(t)?!1:(e("#ctc_rule_menu").val(""),e("#ctc_rule_menu_selected").text(c),e(".ctc-rewrite-toggle").text(n.getxt("rename")),e("#ctc_rule_value_inputs, #ctc_input_row_rule_header").show(),n.query_css("rule_val",t),void n.scrolltop())},set_qsid:function(t){var c=this;c.currqsid=e(t).attr("id").match(/_(\d+)$/)[1],c.focus_panel("#query_selector_options"),c.reload=!0,c.load_selector_values()},query_css:function(t,c,n){var a=this,s={ctc_query_obj:t,ctc_query_key:c},i="#ctc_status_"+t+("val_qry"===t?"_"+c:"");"object"==typeof n&&e.each(n,function(e,t){s["ctc_query_"+e]=t}),e(".query-icon,.ctc-status-icon").remove(),e(i+" .ctc-status-icon").remove(),e(i).append('<span class="ctc-status-icon spinner is-active query-icon"></span>'),s.action=a.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_query":"ctc_plgqry",s._wpnonce=e("#_wpnonce").val(),a.ajax_post(t,s)},save:function(t){var c,n,a,s,i,l=this,r={},o=e(t).attr("id");e(t).prop("disabled",!0),e(".ctc-query-icon,.ctc-status-icon").remove(),e(t).parent(".ctc-textarea-button-cell, .ctc-button-cell").append('<span class="ctc-status-icon spinner save-icon"></span>'),o.match(/ctc_configtype/)?(e(t).parents(".ctc-input-row").first().append('<span class="ctc-status-icon spinner save-icon"></span>'),r.ctc_configtype=e(t).val()):(c=e("#ctc_new_selectors"))&&"ctc_save_new_selectors"===e(t).attr("id")?(r.ctc_new_selectors=c.val(),(n=e("#ctc_sel_ovrd_query_selected"))&&(r.ctc_sel_ovrd_query=n.text()),l.reload=!0):(a=e("#ctc_child_imports"))&&"ctc_save_imports"===o?r.ctc_child_imports=a.val():"ctc_is_debug"===o?r.ctc_is_debug=e("#ctc_is_debug").is(":checked")?1:0:r=l.coalesce_inputs(t),e(".save-icon").addClass("is-active"),e.each(["query","selector"],function(t,c){e("#ctc_rewrite_"+c).length&&(s=e("#ctc_rewrite_"+c).val(),i=e("#ctc_rewrite_"+c+"_orig").val(),l.is_empty(s)||!s.toString().match(/\w/)?s=i:(r["ctc_rewrite_"+c]=s,l.reload=!0),e("#ctc_sel_ovrd_"+c+"_selected").html(s)),e(".ctc-rewrite-toggle").text(l.getxt("rename"))}),r.action=l.is_empty(e("#ctc_action").val())||"plugin"!==e("#ctc_action").val()?"ctc_update":"ctc_plugin",r._wpnonce=e("#_wpnonce").val(),l.ajax_post("qsid",r)},ajax_post:function(t,c,n){var a=this;e.ajax({url:window.ctcAjax.ajaxurl,data:c,dataType:a.is_empty(n)?"json":n,type:"POST"}).done(function(e){a.handle_success(t,e)}).fail(function(){a.handle_failure(t)}).always(function(){a.jqueryerr.length&&a.jquery_notice()})},handle_failure:function(t){var c=this;e(".query-icon, .save-icon").removeClass("spinner").addClass("failure"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(".ajax-pending").removeClass("ajax-pending"),"preview"===t&&e("#view_parnt_options_panel,#view_child_options_panel").text(c.getxt("css_fail"))},handle_success:function(t,c){var n=this;e(".query-icon, .save-icon").removeClass("spinner"),e(".ajax-pending").removeClass("ajax-pending"),n.is_empty(c)?n.handle_failure(t):(e("#ctc_new_selectors").val(""),e(".query-icon, .save-icon").addClass("success"),e("input[type=submit], input[type=button], input[type=checkbox],.ctc-delete-input").prop("disabled",!1),e(c).each(function(){"function"==typeof n.update[this.obj]&&n.update[this.obj].call(n,this)}))},jquery_exception:function(e,t){var c=this,n=c.is_empty(e.lineNumber)?"":" line: "+e.lineNumber,a=c.is_empty(e.fileName)?"":" "+e.fileName.split(/\?/)[0];c.jqueryerr.push("<code><small>"+t+": "+e.message+a+n+"</small></code>")},jquery_notice:function(t){t=null;var c=this,n=[],a=[];c.jqueryerr.length&&(e("input[type=submit], input[type=button]").prop("disabled",!0),e("script").each(function(){var t=e(this).prop("src");c.is_empty(t)||!t.match(/jquery(\.min|\.js|\-?ui)/i)||t.match(/load\-scripts.php/)||n.push("<code><small>"+t.split(/\?/)[0]+"</small></code>")}),a.push("<strong>"+c.getxt("js")+"</strong> "+c.getxt("contact")),a.push(c.jqueryerr.join("<br/>")),n.length&&a.push(c.getxt("jquery")+"<br/>"+n.join("<br/>")),a.push(c.getxt("plugin"))),c.set_notice({error:a})},update:{qsid:function(t){var c,n,a,s,i=this;i.currqsid=t.key,i.currdata=t.data,e("#ctc_sel_ovrd_qsid").val(i.currqsid),i.is_empty(i.currdata.seq)?e("#ctc_child_load_order_container").empty():(c="ctc_ovrd_child_seq_"+i.currqsid,a=parseInt(i.currdata.seq),n='<input type="text" id="'+c+'" name="'+c+'" class="ctc-child-value" value="'+a+'" />',e("#ctc_child_load_order_container").html(n)),i.is_empty(i.currdata.value)?(s=!0,e("#ctc_sel_ovrd_rule_inputs").empty(),i.load_selectors()):(s=!1,n="",e.each(i.currdata.value,function(e,t){t=null,n+=i.input_row(i.currqsid,e,"ovrd",i.currdata)}),e("#ctc_sel_ovrd_rule_inputs").html(n).find(".color-picker").each(function(){i.setup_spectrum(this)}),i.coalesce_inputs("#ctc_child_all_0_swatch")),i.reload&&(i.load_queries(),i.load_selectors(),i.set_query(i.currdata.query),i.load_rules()),e("#ctc_sel_ovrd_selector_selected").text(i.currdata.selector),i.maybe_show_rewrite(),s?i.reset_qsid():e("#ctc_sel_ovrd_rule_header,#ctc_sel_ovrd_new_rule,#ctc_sel_ovrd_rule_inputs_container,#ctc_sel_ovrd_rule_inputs,#input_row_load_order").fadeIn()},rule_val:function(t){var c=this,n=e("#ctc_rule_menu_selected").text(),a='<div class="ctc-input-row clearfix" id="ctc_rule_row_'+n+'">\n';c.is_empty(t.data)||(e.each(t.data,function(e,t){var s=c.decode_value(n,t);a+='<div class="ctc-parent-row clearfix" id="ctc_rule_row_'+n+"_"+e+'">\n<div class="ctc-input-cell ctc-parent-value" id="ctc_'+e+"_parent_"+n+"_"+e+'">'+s.orig+'</div>\n<div class="ctc-input-cell">\n<div class="ctc-swatch ctc-specific" id="ctc_'+e+"_parent_"+n+"_"+e+'_swatch">'+c.getxt("swatch")+'</div></div>\n<div class="ctc-input-cell"><a href="#" class="ctc-selector-handle" id="ctc_selector_'+n+"_"+e+'">'+c.getxt("selector")+'</a></div>\n<div id="ctc_selector_'+n+"_"+e+'_container" class="ctc-selector-container">\n<a href="#" id="ctc_selector_'+n+"_"+e+'_close" class="ctc-selector-handle ctc-exit" title="'+c.getxt("close")+'"></a><div id="ctc_selector_'+n+"_"+e+'_inner_container" class="ctc-selector-inner-container clearfix">\n<div id="ctc_status_val_qry_'+e+'"></div>\n<div id="ctc_selector_'+n+"_"+e+'_rows"></div>\n</div></div></div>\n'}),a+="</div>\n"),e("#ctc_rule_value_inputs").html(a).find(".ctc-swatch").each(function(){c.coalesce_inputs(this)})},val_qry:function(t){var c,n,a=this,s="";a.is_empty(t.data)||e.each(t.data,function(n,i){c=n,e.each(i,function(c,i){s+='<h4 class="ctc-query-heading">'+c+"</h4>\n",a.is_empty(i)||e.each(i,function(e,c){s+=a.input_row(e,n,t.key,c)})})}),n="#ctc_selector_"+c+"_"+t.key+"_rows",e(n).html(s).find(".color-picker").each(function(){a.setup_spectrum(this)}),e(n).find(".ctc-swatch").each(function(){a.coalesce_inputs(this)})},queries:function(t){e("#ctc_sel_ovrd_query").data("menu",t.data)},selectors:function(t){e("#ctc_sel_ovrd_selector").data("menu",t.data)},rules:function(t){e("#ctc_rule_menu").data("menu",t.data)},debug:function(t){e("#ctc_debug_box").val(e("#ctc_debug_box").val()+t.data)},preview:function(t){e("#view_"+t.key+"_options_panel").text(t.data)},dismiss:function(){}},bind_dismiss:function(t){var c=this,n=e(t),a=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),s=window.commonL10n.dismiss||"";a.find(".screen-reader-text").text(s),n.append(a),a.on("click.wp-dismiss-notice",function(e){e.preventDefault(),c.dismiss_notice(t)})},dismiss_notice:function(t){e(t).fadeTo(100,0,function(){e(this).slideUp(100,function(){e(this).remove()})})},reset_handling:function(){e("#parnt_analysis_notice .notice, #child_analysis_notice .notice").slideUp(),e("#ctc_enqueue_enqueue").prop("checked",!0),e("#ctc_handling_primary").prop("checked",!0),e("#ctc_ignoreparnt").prop("checked",!1),e("#ctc_repairheader").prop("checked",!1)},init:function(){var t=this;if(!e("#ctc_theme_parnt").is("input")){try{e.widget("ctc.themeMenu",e.ui.selectmenu,{_renderItem:function(t,c){var n=e("<li>"),a=c.value.replace(/[^\w\-]/g,"");return e("#ctc_theme_option_"+a).detach().appendTo(n),n.appendTo(t)}})}catch(c){t.jquery_exception(c,"Theme Menu")}try{e("#ctc_theme_parnt").themeMenu({select:function(e,c){t.reset_handling(),t.set_parent_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_parnt").themeMenu("destroy"):e("#ctc_theme_parnt-button").remove(),t.jquery_exception(c,"Parent Theme Menu")}if(t.is_empty(window.ctcAjax.themes.child))e("#ctc_child_name").length&&(e("#ctc_child_name").val(t.testname),e("#ctc_child_template").val(t.testslug));else try{e("#ctc_theme_child").themeMenu({select:function(e,c){t.reset_handling(),t.set_child_menu(c.item)}})}catch(c){"function"==typeof themeMenu?e("#ctc_theme_child").themeMenu("destroy"):e("#ctc_theme_child-button").remove(),t.jquery_exception(c,"Child Theme Menu")}}t.currparnt=e("#ctc_theme_parnt").val(),t.currchild=e("#ctc_theme_child").length?e("#ctc_theme_child").val():"",e("#ctc_main").on("click",".ctc-section-toggle",function(t){t.preventDefault(),e(this).parents(".ctc-input-row, .notice-warning, .updated, .error").first().find(".ctc-section-toggle").each(function(){e(this).toggleClass("open")});var c=e(this).attr("id").replace(/\d$/,"")+"_content";return e("#"+c).stop().slideToggle("fast"),!1}),e("#ctc_main").on("click",".ctc-upgrade-notice .notice-dismiss",function(){var c={action:"ctc_dismiss",_wpnonce:e("#_wpnonce").val()};t.ajax_post("dismiss",c)}),t.is_empty(t.jqueryerr)&&(e("#ctc_main").on("click",".ctc-selector-handle",function(c){if(c.preventDefault(),e(this).hasClass("ajax-pending"))return!1;e(this).addClass("ajax-pending");var n,a,s=e(this).attr("id").toString().replace("_close",""),i=s.toString().match(/_([^_]+)_(\d+)$/);e("#"+s+"_container").is(":hidden")&&(t.is_empty(i[1])||t.is_empty(i[2])||(n=i[1],a=i[2],t.query_css("val_qry",a,{rule:n}))),e("#"+s+"_container").fadeToggle("fast"),e(".ctc-selector-container").not("#"+s+"_container").fadeOut("fast")}),e("#ctc_main").on("click",".ctc-save-input[type=button], .ctc-delete-input",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),t.save(this),!1)}),e("#ctc_main").on("keydown",".ctc-selector-container .ctc-child-value[type=text]",function(c){if(13===c.which){var n=e(this).parents(".ctc-selector-row").find(".ctc-save-input[type=button]").first();if(n.length)return c.preventDefault(),n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}}),e("#ctc_main").on("click",".ctc-selector-edit",function(c){return c.preventDefault(),e(this).hasClass("ajax-pending")?!1:(e(this).addClass("ajax-pending"),void t.set_qsid(this))}),e("#ctc_main").on("click",".ctc-rewrite-toggle",function(e){e.preventDefault(),t.selector_input_toggle(this)}),e("#ctc_main").on("click","#ctc_copy_selector",function(){var c=e("#ctc_sel_ovrd_selector_selected").text().trim();t.is_empty(c)||e("#ctc_new_selectors").val(e("#ctc_new_selectors").val()+"\n"+c+" {\n\n}")}),e("#ctc_main").on("click",".ctc-backup-theme",function(c){c.preventDefault(),t.existing?e("#ctc_export_theme").val(t.currchild):e("#ctc_export_theme").val(t.currparnt),e("#ctc_export_theme_form").submit()}),e("#ctc_configtype").on("change",function(){var c=e(this).val();if(t.is_empty(c)||"theme"===c){e(".ctc-theme-only, .ctc-themeonly-container").removeClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!1);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("enable")}catch(n){t.jquery_exception(n,"Theme Menu")}}else{e(".ctc-theme-only, .ctc-themeonly-container").addClass("ctc-disabled"),e(".ctc-theme-only, .ctc-themeonly-container input").prop("disabled",!0);try{e("#ctc_theme_parnt, #ctc_theme_child").themeMenu("disable")}catch(n){t.jquery_exception(n,"Theme Menu")}}}),e(".nav-tab").on("click",function(c){if(c.preventDefault(),e(c.target).hasClass("ctc-disabled"))return!1;e(".ctc-query-icon,.ctc-status-icon").remove();var n="#"+e(this).attr("id");t.focus_panel(n)}),e("#view_child_options, #view_parnt_options").on("click",function(c){return e(c.target).hasClass("ajax-pending")||e(c.target).hasClass("ctc-disabled")?!1:(e(c.target).addClass("ajax-pending"),void t.css_preview(e(this).attr("id")))}),e("#ctc_load_form").on("submit",function(){return t.validate()}),e("#ctc_query_selector_form").on("submit",function(c){c.preventDefault();var n=e("#ctc_save_query_selector");return n.hasClass("ajax-pending")?!1:(n.addClass("ajax-pending"),t.save(n),!1)}),e("#ctc_rule_value_form").on("submit",function(e){return e.preventDefault(),!1}),e("#ctc_child_type_new,#ctc_child_type_existing,#ctc_child_type_duplicate,#ctc_child_type_reset").on("focus click",function(){t.reset_handling(),t.update_form()}),e("#ctc_is_debug").on("change",function(){e(this).is(":checked")?e("#ctc_debug_box").length||e("#ctc_debug_container").html('<textarea id="ctc_debug_box"></textarea>'):e("#ctc_debug_box").remove(),t.save(this)}),e(".ctc-live-preview").on("click",function(t){return t.stopImmediatePropagation(),t.preventDefault(),document.location=e(this).prop("href"),!1}),t.setup_menus(),e("input[type=submit], input[type=button]").prop("disabled",!1),t.scrolltop(),t.update_form()),t.jqueryerr.length&&t.jquery_notice()},testslug:"",testname:"",reload:!1,currquery:"base",currqsid:null,currdata:{},currparnt:"",currchild:"",existing:!1,jqueryerr:[],color_regx:"\\s+(\\#[a-f0-9]{3,6}|rgba?\\([\\d., ]+?\\)|hsla?\\([\\d%., ]+?\\)|[a-z]+)",border_regx:"(\\w+)(\\s+(\\w+))?",grad_regx:"(\\w+)"},e.chldthmanalyze={escrgx:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},trmcss:function(e){return"undefined"==typeof e?"":e.replace(/\-css$/,"")},show_loading:function(t,c){var n=e.chldthmcfg.existing?"child":"parnt",a=c?c:e.chldthmcfg.getname(n),s='<strong class="ctc_analyze_loading"><span class="spinner is-active"></span>'+e.chldthmcfg.getxt(t?"anlz1":"anlz2")+" "+a+"...</strong>";self.noticediv="",e("#"+n+"_analysis_notice").html(s)},hide_loading:function(){e(".ctc_analyze_loading").fadeTo(200,0,function(){e(this).slideUp(200,function(){e(this).remove()})})},setssl:function(e){return e.replace(/^https?/,window.ctcAjax.ssl?"https":"http")},analyze_theme:function(t){var c=this,n=Math.floor(e.now()/1e3),a="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,s="&template="+encodeURIComponent(e.chldthmcfg.currparnt)+"&stylesheet="+encodeURIComponent(a)+"&now="+n,i=c.setssl(window.ctcAjax.homeurl),l=i+s;c.analysis[t].url=l,e.get(l,function(n){c.parse_page(t,n),e(document).trigger("analysisdone")}).fail(function(n,s,i){c.analysis[t].signals.xhrgeterr=i,e.ajax({url:window.ctcAjax.ajaxurl,data:{action:"ctc_analyze",stylesheet:a,template:e.chldthmcfg.currparnt,
|
2 |
+
_wpnonce:e("#_wpnonce").val()},dataType:"json",type:"POST"}).done(function(n){n.signals.httperr?(c.analysis[t].signals.failure=1,c.analysis[t].signals.httperr=n.signals.httperr):c.parse_page(t,n.body),e(document).trigger("analysisdone")}).fail(function(n,a,s){c.analysis[t].signals.failure=1,c.analysis[t].signals.xhrajaxerr=s,e(document).trigger("analysisdone")})})},parse_page:function(t,c){var n,a,s,i=this,l=window.ctcAjax.theme_dir,r="child"===t?e.chldthmcfg.currchild:e.chldthmcfg.currparnt,o=i.escrgx(e.chldthmcfg.currparnt)+("child"===t?"|"+i.escrgx(r):""),_=new RegExp("<link( rel=[\"']stylesheet[\"'] id=['\"]([^'\"]+?)['\"])?[^>]+?"+i.escrgx(l)+"/("+o+")/([^\"']+\\.css)(\\?[^\"']+)?[\"'][^>]+>","gi"),d=/<br \/>\n[^\n]+?(fatal|strict|notice|warning|error)[\s\S]+?<br \/>/gi,u=0,h=0;if("child"===t){c.match(/^[\s\S]*?<head>([\s\S]*?)<\/head>/)}for((a=c.match(/BEGIN WP QUEUE\n([\s\S]*?)\nEND WP QUEUE/))?i.analysis[t].queue=a[1].split(/\n/):(i.analysis[t].queue=[],i.analysis[t].signals.thm_noqueue=1),(a=c.match(/BEGIN CTC IRREGULAR\n([\s\S]*?)\nEND CTC IRREGULAR/))?i.analysis[t].irreg=a[1].split(/\n/):i.analysis[t].irreg=[],c.match(/CHLD_THM_CFG_IGNORE_PARENT/)&&(i.analysis[t].signals.thm_ignoreparnt=1),c.match(/IS_CTC_THEME/)&&(i.analysis[t].signals.thm_is_ctc=1),c.match(/NO_CTC_STYLES/)&&(i.analysis[t].signals.thm_no_styles=1),c.match(/HAS_CTC_IMPORT/)&&(i.analysis[t].signals.thm_has_import=1),c.match(/HAS_WP_CACHE/)&&(i.analysis[t].signals.thm_has_cache=1),c.match(/HAS_WP_ROCKET/)&&(i.analysis[t].signals.thm_has_wprocket=1),c.match(/HAS_AUTOPTIMIZE/)&&(i.analysis[t].signals.thm_has_autoptimize=1),c=c.replace(/<!\-\-[\s\S]*?\-\->/g,"");n=d.exec(c);){var p=n[0].replace(/<.*?>/g,"");i.phperr[t].push(p),i.analysis[t].signals.err_php=1,p.match(/Fatal error/i)&&(i.analysis[t].signals.err_fatal=1)}for(;s=_.exec(c);){var m=i.trmcss(s[2]),g=s[3],f=s[4],y=e.chldthmcfg.currparnt===g?"parnt":"child",v=0;if(""===m||-1===i.analysis[t].queue.indexOf(m))v=1;else if(0===m.indexOf("chld_thm_cfg")){f.match(/^ctc\-style.*?\.css$/)?(u=1,i.analysis[t].signals.ctc_sep_loaded=1):f.match(/^ctc\-genesis([\-\.]min)?\.css$/)?(u=1,i.analysis[t].signals.ctc_gen_loaded=1):m.match(/^chld_thm_cfg_ext/)?f.match(/rtl.*?\.css$/)?i.analysis[t].signals.thm_rtl=1:(i.analysis[t].signals.ctc_ext_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_child"===m?(i.analysis[t].signals.ctc_child_loaded=1,i.analysis[t].deps[u].push([m,f,y])):"chld_thm_cfg_parent"===m&&(i.analysis[t].signals.ctc_parnt_loaded=1,i.analysis[t].deps[u].push([m,f,y]),u&&(i.analysis[t].signals.ctc_parnt_reorder=1));continue}if(f.match(/^style.*?\.css$/))u=1,"parnt"===y?v?i.analysis[t].signals.thm_parnt_loaded="thm_unregistered":(i.analysis[t].signals.thm_parnt_loaded=m,"child"===t&&i.analysis[t].signals.thm_child_loaded&&(i.analysis[t].signals.ctc_parnt_reorder=1)):i.analysis[t].signals.thm_child_loaded=v?"thm_unregistered":m,v?h?(i.analysis[t].signals.thm_past_wphead=1,i.analysis[t].deps[u].push(["thm_past_wphead",f,y])):(i.analysis[t].signals.thm_unregistered=1,i.analysis[t].deps[u].push(["thm_unregistered",f,y])):i.analysis[t].deps[u].push([m,f,y]);else if(f.match(/rtl.*?\.css$/))i.analysis[t].signals.thm_rtl=1;else if("ctc-test.css"===f)h=1;else{var w=null;v&&(w="dep_unregistered"),h&&(w=u?"css_past_wphead":"dep_past_wphead"),w?(i.analysis[t].signals[w]=1,m=w):i.dependencies[m]=f,i.analysis[t].deps[u].push([m,f,y])}}u||(i.analysis[t].signals.thm_notheme=1)},css_notice:function(){var t,c,n=this,a=e.chldthmcfg.existing?"child":"parnt",s=e.chldthmcfg.getname(a),i="",l={notices:[]},r={style:"notice-warning",headline:e.chldthmcfg.getxt("anlz3",s),errlist:"",msg:e.chldthmcfg.getxt("anlz7")},o=0,_={},d="",u={};if(n.analysis[a].signals.failure||n.analysis[a].signals.thm_noqueue&&!n.phperr[a].length)d=e.chldthmcfg.getxt("anlz33").replace(/%1/,'<a href="'+n.analysis[a].url+'" target="_new">').replace(/%2/,"</a>"),l.notices.push({headline:e.chldthmcfg.getxt("anlz4",s),msg:e.chldthmcfg.getxt("anlz5")+d,style:"notice-warning"});else if(n.phperr[a].length&&(e.each(n.phperr[a],function(e,t){t.match(/Fatal error/i)&&(u.fatal=1),t.match(/Constant \w+ already defined in .+?wp-config.php/i)&&(u.config=1),r.errlist+=t+"\n"}),u.fatal&&(r.style="error",r.headline=e.chldthmcfg.getxt("anlz8",s)),u.config&&(r.msg=e.chldthmcfg.getxt("anlzconfig",s)+r.msg),r.msg='<div style="background-color:#ffeebb;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_errs">'+e.chldthmcfg.getxt("anlz6")+'</div><div id="ctc_analysis_errs_content"><textarea>'+r.errlist+"</textarea></div></div>"+r.msg,l.notices.push(r)),n.analysis[a].signals.thm_has_wprocket&&n.analysis[a].signals.thm_has_autoptimize)l.notices.push({headline:e.chldthmcfg.getxt("anlzcache1"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlzcache2")});else if(!n.analysis[a].signals.thm_noqueue){if((n.analysis[a].signals.thm_past_wphead||n.analysis[a].signals.dep_past_wphead)&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz9"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz10")}),e("#ctc_repairheader").prop("checked",!0),e("#ctc_repairheader_container").show()),n.analysis[a].signals.thm_unregistered&&(n.analysis[a].signals.ctc_child_loaded||n.analysis[a].signals.ctc_sep_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz11"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz12")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0))),"child"===a&&(n.analysis.child.signals.ctc_parnt_reorder&&(o=1),n.analysis.child.signals.ctc_child_loaded||n.analysis.child.signals.ctc_sep_loaded||n.analysis.child.signals.thm_child_loaded||(l.notices.push({headline:e.chldthmcfg.getxt("anlz13"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz14")}),o=1),n.analysis[a].signals.ctc_gen_loaded&&l.notices.push({headline:e.chldthmcfg.getxt("anlz31"),msg:e.chldthmcfg.getxt("anlz32"),style:"notice-warning"}),n.analysis.parnt.signals.thm_no_styles||n.analysis.child.signals.ctc_gen_loaded||n.analysis.child.signals.thm_parnt_loaded||n.analysis.child.signals.ctc_parnt_loaded||n.analysis.child.signals.thm_ignoreparnt||n.analysis.child.signals.thm_has_import||(l.notices.push({headline:e.chldthmcfg.getxt("anlz15"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz16")}),o=1),n.analysis.child.signals.thm_unregistered&&n.analysis.child.signals.thm_child_loaded&&"thm_unregistered"===n.analysis.child.signals.thm_child_loaded&&n.analysis.child.signals.ctc_child_loaded&&n.analysis.child.signals.ctc_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz28"),style:"notice-warning",msg:e.chldthmcfg.getxt("anlz29")}),e("#ctc_repairheader_container").show(),e("#ctc_repairheader").prop("checked",!0)),n.analysis.child.signals.thm_is_ctc||e("#ctc_child_type_duplicate").is(":checked")||l.notices.push({headline:e.chldthmcfg.getxt("anlz19"),msg:e.chldthmcfg.getxt("anlz20"),style:"notice-warning"})),"object"!=typeof window.ctcAjax.swappath&&(window.ctcAjax.swappath={}),e.each(n.analysis.parnt.deps[0],function(t,c){e.each(n.analysis.child.deps[0],function(e,t){t[0]===c[0]&&t[2]!==c[2]&&(n.analysis.parnt.swaps.push(t),window.ctcAjax.swappath[t[0]]=t[1],o=1)})}),(n.analysis[a].signals.ctc_sep_loaded||n.analysis[a].signals.ctc_gen_loaded)&&e("#ctc_handling_separate").prop("checked",!0),l.notices.length||l.notices.push({headline:""+("child"===a?e.chldthmcfg.getxt("anlz17"):e.chldthmcfg.getxt("anlz18")),style:"updated",msg:""}),"child"===a&&n.analysis.child.signals.thm_has_import&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz21"),msg:e.chldthmcfg.getxt("anlz22"),style:"notice-warning"}),e("#ctc_enqueue_import").prop("checked",!0)),n.analysis[a].signals.thm_ignoreparnt||n.analysis[a].signals.ctc_gen_loaded?(e("#ctc_ignoreparnt").prop("checked",!0),e("#ctc_enqueue_none").is(":checked")||(e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")):e("#ctc_ignoreparnt").prop("checked",!1),!n.analysis[a].signals.ctc_sep_loaded&&!n.analysis[a].signals.ctc_gen_loaded&&!n.analysis[a].signals.ctc_child_loaded&&!n.analysis[a].signals.thm_unregistered&&!n.analysis[a].signals.thm_past_wphead&&n.analysis[a].deps[1].length){var h="";e.each(n.analysis[a].deps[1],function(e,t){t[1].match(/^style.*?\.css$/)||(h+='<li class="code">'+t[1]+"</li>\n")}),""!==h&&(h="<ul class='howto' style='padding-left:1em'>\n"+h+"</ul>\n",l.notices.push({headline:e.chldthmcfg.getxt("anlz23"),msg:h+e.chldthmcfg.getxt("anlz24"),style:"updated"}))}"child"===a&&n.analysis[a].signals.thm_parnt_loaded&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz25"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none"),n.analysis.parnt.signals.thm_no_styles&&(l.notices.push({headline:e.chldthmcfg.getxt("anlz27"),msg:e.chldthmcfg.getxt("anlz26"),style:"updated"}),e("#ctc_enqueue_none").prop("checked",!0),o=1,_.ctc_enqueue="none")}return i=encodeURIComponent(JSON.stringify(n.analysis)),e('input[name="ctc_analysis"]').val(i),_.ctc_analysis=i,n.is_success()&&o&&!n.resubmitting?(n.resubmitting=1,void n.resubmit(_)):(n.resubmitting=0,n.hide_loading(),e.each(l.notices,function(t,c){var n=e('<div class="'+c.style+' notice is-dismissible dashicons-before" ><h4>'+c.headline+"</h4>"+c.msg+"</div>");e.chldthmcfg.bind_dismiss(n),n.hide().appendTo("#"+a+"_analysis_notice").slideDown()}),t='<div style="background-color:#ddd;padding:6px"><div class="ctc-section-toggle" id="ctc_analysis_obj">'+e.chldthmcfg.getxt("anlz30")+'</div><div id="ctc_analysis_obj_content" style="display:none"><textarea style="font-family:monospace;font-size:10px">'+JSON.stringify(n.analysis,null,2)+"</textarea></div></div>",e(t).appendTo("#"+a+"_analysis_notice"),c="",e.each(n.dependencies,function(e,t){t&&(c+='<label class="code"><input class="ctc_checkbox ctc-themeonly" id="ctc_forcedep_'+e+'" name="ctc_forcedep[]" type="checkbox" value="'+e+'" autocomplete="off" '+(-1!==window.ctcAjax.forcedep.indexOf(e)?"checked":"")+" />"+e+"</label><br/>\n")}),c.length?(e("#ctc_dependencies").html(c),e("#ctc_dependencies_container").show()):(e("#ctc_dependencies").empty(),e("#ctc_dependencies_container").hide()),e("#ctc_child_type_reset").is(":checked")||(e("#input_row_stylesheet_handling_container,#input_row_parent_handling_container,#ctc_child_header_parameters,#ctc_configure_submit").slideDown("fast"),e("#ctc_child_type_duplicate").is(":checked")?(e("#ctc_configure_submit .ctc-step").text("8"),e("#ctc_copy_theme_mods").find("input").prop("checked",!1)):(e("#ctc_configure_submit .ctc-step").text("9"),e("#ctc_copy_theme_mods").slideDown("fast")),e("#ctc_child_type_duplicate").is(":checked")||e("#ctc_child_type_new").is(":checked")?(e("#input_row_theme_slug").hide(),e("#input_row_new_theme_slug").slideDown("fast")):(e("#input_row_new_theme_slug").hide(),e("#input_row_theme_slug").slideDown("fast"))),void 0)},resubmit:function(t){var c=this;c.hide_loading(),c.show_loading(!0),t.action="ctc_update",t._wpnonce=e("#_wpnonce").val(),e.ajax({url:window.ctcAjax.ajaxurl,data:t,type:"POST"}).done(function(){c.hide_loading(),c.do_analysis()}).fail(function(){c.hide_loading()})},do_analysis:function(){var t=this;t.analysis={parnt:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]},child:{deps:[[],[]],signals:{failure:0},queue:[],irreg:[],swaps:[]}},t.phperr={parnt:[],child:[]},t.dependencies={},t.done=0,t.show_loading(!1),t.analyze_theme("parnt"),e.chldthmcfg.existing&&t.analyze_theme("child")},init:function(){var t=this;e(document).on("analysisdone",function(){t.done++,t.done>e.chldthmcfg.existing&&(t.done=0,t.css_notice())}),e("#ctc_main").on("click",".ctc-analyze-theme",function(){t.is_success()&&e.chldthmcfg.dismiss_notice(e(".ctc-success-response").parent(".notice")),t.do_analysis()}),t.is_success()&&!window.ctcAjax.pluginmode&&t.do_analysis()},analysis:{},done:0,resubmitting:0,dependencies:{},is_success:function(){return e(".ctc-success-response").length}},e("#request-filesystem-credentials-form").length||(e.chldthmcfg.init(),e.chldthmanalyze.init())}(jQuery);
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: child, theme, child theme, child themes, custom styles, customize styles, customize theme, css, responsive, css editor, child theme editor, child theme generator, child theme creator, style, stylesheet, customizer, childtheme, childthemes
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.6.36
|
7 |
-
Tested up to:
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -288,6 +288,10 @@ https://www.youtube.com/watch?v=iBiiAgsK4G4
|
|
288 |
7. Files tab
|
289 |
|
290 |
== Changelog ==
|
|
|
|
|
|
|
|
|
291 |
= 2.3.0.4 =
|
292 |
* strip scripts during template scan to prevent false positives
|
293 |
= 2.3.0.3 =
|
4 |
Tags: child, theme, child theme, child themes, custom styles, customize styles, customize theme, css, responsive, css editor, child theme editor, child theme generator, child theme creator, style, stylesheet, customizer, childtheme, childthemes
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.6.36
|
7 |
+
Tested up to: 5.0.3
|
8 |
+
Stable tag: 2.4.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
288 |
7. Files tab
|
289 |
|
290 |
== Changelog ==
|
291 |
+
= 2.4.0 =
|
292 |
+
* Automatically add action parent RTL stylesheet when child theme does not have one.
|
293 |
+
* Handle case where parent theme changes queue action incorrectly points to non-existent child theme stylesheet.
|
294 |
+
* Correctly copies customizer css to child theme.
|
295 |
= 2.3.0.4 =
|
296 |
* strip scripts during template scan to prevent false positives
|
297 |
= 2.3.0.3 =
|