diff --git a/functions.php b/functions.php
index b516a84..09283a2 100644
--- a/functions.php
+++ b/functions.php
@@ -141,38 +141,6 @@ function radiate_widgets_init() {
define( 'RADIATE_THEME_VERSION', $radiate_theme->get( 'Version' ) );
-/**
- * Enqueue scripts and styles.
- */
-function radiate_scripts() {
- // Load our main stylesheet.
- wp_enqueue_style( 'radiate-style', get_stylesheet_uri() );
-
- wp_enqueue_style( 'radiate-google-fonts', '//fonts.googleapis.com/css?family=Roboto|Merriweather:400,300' );
-
- // Add Genericons, used in the main stylesheet.
- wp_enqueue_style( 'radiate-genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.3.1' );
-
- wp_enqueue_script( 'radiate-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
-
- wp_enqueue_script( 'radiate-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
-
- wp_enqueue_script( 'radiate-custom-js', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ), false, true );
-
- $radiate_header_image_link = get_header_image();
- wp_localize_script( 'radiate-custom-js', 'radiateScriptParam', array( 'radiate_image_link' => $radiate_header_image_link ) );
-
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
-
- wp_enqueue_script( 'html5shiv', get_template_directory_uri() . '/js/html5shiv.js', array(), '3.7.3', false );
- wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' );
-
-}
-
-add_action( 'wp_enqueue_scripts', 'radiate_scripts' );
-
/**
* Enqueue Google fonts and editor styles.
*/
@@ -184,6 +152,17 @@ function radiate_block_editor_styles() {
add_action( 'enqueue_block_editor_assets', 'radiate_block_editor_styles', 1, 1 );
+/**
+ * Define URL Location Constants
+ */
+define( 'RADIATE_PARENT_DIR', get_template_directory() );
+define( 'RADIATE_INCLUDES_DIR', RADIATE_PARENT_DIR . '/inc' );
+define( 'RADIATE_CUSTOMIZER_DIR', RADIATE_INCLUDES_DIR . '/customizer' );
+
+define( 'RADIATE_PARENT_URL', get_template_directory_uri() );
+define( 'RADIATE_INCLUDES_URL', RADIATE_PARENT_URL . '/inc' );
+define( 'RADIATE_CUSTOMIZER_URL', RADIATE_INCLUDES_URL . '/customizer' );
+
/**
* Implement the Custom Header feature.
*/
@@ -202,7 +181,12 @@ function radiate_block_editor_styles() {
/**
* Customizer additions.
*/
-require get_template_directory() . '/inc/customizer.php';
+require get_template_directory() . '/inc/customizer/class-radiate-customizer.php';
+require get_template_directory() . '/inc/customizer/class-radiate-customizer-partials.php';
+require_once RADIATE_INCLUDES_DIR . '/class-radiate-dynamic-css.php';
+require_once RADIATE_INCLUDES_DIR . '/enqueue-scripts.php';
+require_once RADIATE_INCLUDES_DIR . '/demo-import-migration.php';
+require_once RADIATE_INCLUDES_DIR . '/depreciated/depreciated-functions.php';
/**
* Load Jetpack compatibility file.
@@ -220,3 +204,5 @@ function radiate_block_editor_styles() {
require get_template_directory() . '/inc/admin/class-radiate-upgrade-notice.php';
require get_template_directory() . '/inc/admin/class-radiate-theme-review-notice.php';
}
+
+
diff --git a/inc/class-radiate-dynamic-css.php b/inc/class-radiate-dynamic-css.php
new file mode 100644
index 0000000..b242de7
--- /dev/null
+++ b/inc/class-radiate-dynamic-css.php
@@ -0,0 +1,98 @@
+ array(
+ 'color' => esc_html( $primary_color ),
+ ),
+ '#masthead .search-form,.main-navigation a:hover,.main-navigation ul li ul li a:hover,.main-navigation ul li ul li:hover>a,.main-navigation ul li.current-menu-ancestor a,.main-navigation ul li.current-menu-item a,.main-navigation ul li.current-menu-item ul li a:hover,.main-navigation ul li.current_page_ancestor a,.main-navigation ul li.current_page_item a,.main-navigation ul li:hover>a, button,input[type=button],input[type=reset],input[type=submit], .main-small-navigation ul li ul li a:hover,.main-small-navigation ul li:hover,.main-small-navigation ul li a:hover,.main-small-navigation ul li ul li:hover>a,.main-small-navigation ul > .current_page_item, .main-small-navigation ul > .current-menu-item,.main-small-navigation ul li.current-menu-item ul li a:hover, a#back-top:before, .woocommerce ul.products li.product .onsale,.woocommerce span.onsale,.woocommerce #respond input#submit:hover, .woocommerce a.button:hover,
+ .wocommerce button.button:hover, .woocommerce input.button:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover,
+ .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover' => array(
+ 'background-color' => esc_html( $primary_color ),
+ ),
+ '.main-small-navigation ul li ul li.current-menu-item > a' => array(
+ 'background' => esc_html( $primary_color ),
+ ),
+ 'blockquote' => array(
+ 'border-left-color' => esc_html( $primary_color ),
+ ),
+ '#featured_pages a.more-link:hover' => array(
+ 'border-color' => esc_html( $primary_color ),
+ ),
+ );
+
+ $parse_css .= radiate_parse_css( '#632e9b', $primary_color, $primary_color_css );
+
+ // Add the custom CSS rendered dynamically, which is static.
+ $parse_css .= self::render_custom_output();
+
+ $parse_css .= $dynamic_css;
+
+ return apply_filters( 'radiate_theme_dynamic_css', $parse_css );
+
+ }
+
+ /**
+ * Function to output Custom CSS code, which does not have the specific CSS design option, ie, static CSS code.
+ *
+ * @return string
+ */
+ public static function render_custom_output() {
+
+ $primary_color = get_theme_mod( 'radiate_color_scheme', '#632e9b' );
+ $primary_dark = radiate_darkcolor( $primary_color, -50 );
+
+ $radiate_custom_css = '';
+
+ if ( $primary_color && $primary_color != '#632e9b' ) {
+ $radiate_custom_css .= '@media (max-width: 768px){.better-responsive-menu .sub-toggle{background:' . $primary_dark . '}}';
+ }
+
+ return $radiate_custom_css;
+
+ }
+
+
+}
+
diff --git a/inc/customize-controls/class-radiate-additional-control.php b/inc/customize-controls/class-radiate-additional-control.php
deleted file mode 100644
index 9cbffa2..0000000
--- a/inc/customize-controls/class-radiate-additional-control.php
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- url );
- $json['id'] = $this->id;
-
- return $json;
- }
-
- /**
- * An Underscore (JS) template for rendering this section.
- */
- protected function render_template() {
- ?>
-
-
-
- get_setting( 'blogname' )->transport = 'postMessage';
- $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
- $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
-}
-
-add_action( 'customize_register', 'radiate_customize_register' );
-
-/**
- * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
- */
-function radiate_customize_preview_js() {
- wp_enqueue_script( 'radiate_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
-}
-
-add_action( 'customize_preview_init', 'radiate_customize_preview_js' );
-
-/*****************************************************************************************/
-
-function radiate_register_theme_customizer( $wp_customize ) {
-
- // remove control
- $wp_customize->remove_control( 'blogdescription' );
-
-// Register `RADIATE_Upsell_Section` type section.
- $wp_customize->register_section_type( 'RADIATE_Upsell_Section' );
-
-// Add `RADIATE_Upsell_Section` to display pro link.
- $wp_customize->add_section(
- new RADIATE_Upsell_Section( $wp_customize, 'radiate_upsell_section',
- array(
- 'title' => esc_html__( 'View PRO version', 'radiate' ),
- 'url' => 'https://themegrill.com/themes/radiate/?utm_source=radiate-customizer&utm_medium=view-pro-link&utm_campaign=view-pro#free-vs-pro',
- 'capability' => 'edit_theme_options',
- 'priority' => 1,
- )
- )
- );
-
- // rename existing section
- $wp_customize->add_section( 'title_tagline', array(
- 'title' => __( 'Site Title', 'radiate' ),
- 'priority' => 20,
- ) );
-
- $wp_customize->add_setting(
- 'radiate_color_scheme',
- array(
- 'default' => '#632E9B',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_sanitize_hex_color',
- 'sanitize_js_callback' => 'radiate_sanitize_escaping',
- )
- );
-
- $wp_customize->add_control(
- new WP_Customize_Color_Control(
- $wp_customize,
- 'color_scheme',
- array(
- 'label' => __( 'Primary Color', 'radiate' ),
- 'section' => 'colors',
- 'settings' => 'radiate_color_scheme',
- )
- )
- );
-
- if ( ! function_exists( 'wp_update_custom_css_post' ) ) {
-
- $wp_customize->add_section(
- 'radiate_custom_css_section',
- array(
- 'title' => __( 'Custom CSS', 'radiate' ),
- 'priority' => 200,
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_custom_css',
- array(
- 'default' => '',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'wp_filter_nohtml_kses',
- 'sanitize_js_callback' => 'wp_filter_nohtml_kses',
- )
- );
-
- $wp_customize->add_control(
- new RADIATE_ADDITIONAL_Control (
- $wp_customize,
- 'radiate_custom_css',
- array(
- 'label' => __( 'Add your custom css here and design live! (for advanced users)', 'radiate' ),
- 'section' => 'radiate_custom_css_section',
- 'settings' => 'radiate_custom_css',
- )
- )
- );
- }
-
- $wp_customize->add_section(
- 'radiate_featured_section',
- array(
- 'title' => __( 'Front Page Featured Section', 'radiate' ),
- 'priority' => 220,
- )
- );
-
- $wp_customize->add_setting(
- 'page-setting-one',
- array(
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_sanitize_integer',
- )
- );
- $wp_customize->add_setting(
- 'page-setting-two',
- array(
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_sanitize_integer',
- )
- );
- $wp_customize->add_setting(
- 'page-setting-three',
- array(
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_sanitize_integer',
- )
- );
-
- $wp_customize->add_control(
- 'page-setting-one',
- array(
- 'type' => 'dropdown-pages',
- 'label' => __( 'First featured page', 'radiate' ),
- 'section' => 'radiate_featured_section',
- )
- );
- $wp_customize->add_control(
- 'page-setting-two',
- array(
- 'type' => 'dropdown-pages',
- 'label' => __( 'Second featured page', 'radiate' ),
- 'section' => 'radiate_featured_section',
- )
- );
- $wp_customize->add_control(
- 'page-setting-three',
- array(
- 'type' => 'dropdown-pages',
- 'label' => __( 'Third featured page', 'radiate' ),
- 'section' => 'radiate_featured_section',
- )
- );
-
- //Related post
- $wp_customize->add_section(
- 'radiate_related_posts_section',
- array(
- 'priority' => 245,
- 'title' => esc_html__( 'Related Posts', 'radiate' ),
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_related_posts_activate',
- array(
- 'default' => 0,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_checkbox_sanitize',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_related_posts_activate',
- array(
- 'type' => 'checkbox',
- 'label' => esc_html__( 'Check to activate the related posts', 'radiate' ),
- 'section' => 'radiate_related_posts_section',
- 'settings' => 'radiate_related_posts_activate',
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_related_posts',
- array(
- 'default' => 'categories',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_sanitize_radio',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_related_posts',
- array(
- 'type' => 'radio',
- 'label' => esc_html__( 'Related Posts Must Be Shown As:', 'radiate' ),
- 'section' => 'radiate_related_posts_section',
- 'settings' => 'radiate_related_posts',
- 'choices' => array(
- 'categories' => esc_html__( 'Related Posts By Categories', 'radiate' ),
- 'tags' => esc_html__( 'Related Posts By Tags', 'radiate' ),
- ),
- ) );
-
- // Author Bio
- $wp_customize->add_section(
- 'radiate_author_bio',
- array(
- 'title' => __( 'Author Bio', 'radiate' ),
- 'priority' => 250,
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_author_bio_show',
- array(
- 'default' => 0,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_checkbox_sanitize',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_author_bio_show',
- array(
- 'type' => 'checkbox',
- 'label' => __( 'Check to enable the Author Bio in the single post page.', 'radiate' ),
- 'section' => 'radiate_author_bio',
- 'settings' => 'radiate_author_bio_show',
- )
- );
-
- // Hide Search Icon
- $wp_customize->add_section(
- 'radiate_search_icon',
- array(
- 'title' => __( 'Header Search Icon', 'radiate' ),
- 'priority' => 270,
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_header_search_hide',
- array(
- 'default' => 0,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_checkbox_sanitize',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_header_search_hide',
- array(
- 'type' => 'checkbox',
- 'label' => __( 'Check to hide Header Search Icon.', 'radiate' ),
- 'section' => 'radiate_search_icon',
- 'settings' => 'radiate_header_search_hide',
- )
- );
-
- // Responsive Menu Style
- $wp_customize->add_section(
- 'radiate_menu_section',
- array(
- 'title' => esc_html__( 'Responsive Menu Style', 'radiate' ),
- 'priority' => 280,
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_new_menu_enable',
- array(
- 'default' => 0,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_checkbox_sanitize',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_new_menu_enable',
- array(
- 'type' => 'checkbox',
- 'label' => esc_html__( 'Switch to full width menu style.', 'radiate' ),
- 'section' => 'radiate_menu_section',
- 'settings' => 'radiate_new_menu_enable',
- )
- );
-
- $wp_customize->add_setting(
- 'radiate_responsive_menu_style',
- array(
- 'default' => 0,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'radiate_checkbox_sanitize',
- )
- );
-
- $wp_customize->add_control(
- 'radiate_responsive_menu_style',
- array(
- 'type' => 'checkbox',
- 'label' => esc_html__( 'Switch to new responsive menu style.', 'radiate' ),
- 'section' => 'radiate_menu_section',
- 'settings' => 'radiate_responsive_menu_style',
- )
- );
-
- function radiate_sanitize_hex_color( $color ) {
- if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) {
- return '#' . $unhashed;
- }
-
- return $color;
- }
-
- function radiate_sanitize_integer( $input ) {
- if ( is_numeric( $input ) ) {
- return intval( $input );
- }
- }
-
- function radiate_sanitize_escaping( $input ) {
- $input = esc_attr( $input );
-
- return $input;
- }
-
- function radiate_checkbox_sanitize( $input ) {
- if ( $input == 1 ) {
- return 1;
- } else {
- return '';
- }
- }
-
- function radiate_sanitize_radio( $input, $setting ) {
- // Ensuring that the input is a slug.
- $input = sanitize_key( $input );
- // Get the list of choices from the control associated with the setting.
- $choices = $setting->manager->get_control( $setting->id )->choices;
-
- // If the input is a valid key, return it, else, return the default.
- return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
- }
-
- // Fake sanitize function
- function radiate_sanitize_important_links() {
- return false;
- }
-
-}
-
-add_action( 'customize_register', 'radiate_register_theme_customizer' );
-
-if ( ! function_exists( 'radiate_darkcolor' ) ) :
- /**
- * Generate darker color
- * Source: http://stackoverflow.com/questions/3512311/how-to-generate-lighter-darker-color-with-php
- */
- function radiate_darkcolor( $hex, $steps ) {
- // Steps should be between -255 and 255. Negative = darker, positive = lighter
- $steps = max( - 255, min( 255, $steps ) );
-
- // Normalize into a six character long hex string
- $hex = str_replace( '#', '', $hex );
- if ( strlen( $hex ) == 3 ) {
- $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
- }
-
- // Split into three parts: R, G and B
- $color_parts = str_split( $hex, 2 );
- $return = '#';
-
- foreach ( $color_parts as $color ) {
- $color = hexdec( $color ); // Convert to decimal
- $color = max( 0, min( 255, $color + $steps ) ); // Adjust color
- $return .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code
- }
-
- return $return;
- }
-endif;
-
-
-function radiate_customizer_css() {
- $primary_color = get_theme_mod( 'radiate_color_scheme' );
- $primary_dark = radiate_darkcolor( $primary_color, - 50 );
- if ( $primary_color && $primary_color != '#632e9b' ) {
- $customizer_css = ' blockquote{border-color:#EAEAEA #EAEAEA #EAEAEA ' . $primary_color . '}.site-title a:hover,a{color:' . $primary_color . '}#masthead .search-form,.main-navigation a:hover,.main-navigation ul li ul li a:hover,.main-navigation ul li ul li:hover>a,.main-navigation ul li.current-menu-ancestor a,.main-navigation ul li.current-menu-item a,.main-navigation ul li.current-menu-item ul li a:hover,.main-navigation ul li.current_page_ancestor a,.main-navigation ul li.current_page_item a,.main-navigation ul li:hover>a{background-color:' . $primary_color . '}.header-search-icon:before{color:' . $primary_color . '}button,input[type=button],input[type=reset],input[type=submit]{background-color:' . $primary_color . '}#content .comments-area a.comment-edit-link:hover,#content .comments-area a.comment-permalink:hover,#content .comments-area article header cite a:hover,#content .entry-meta span a:hover,#content .entry-title a:hover,.comment .comment-reply-link:hover,.comments-area .comment-author-link a:hover,.entry-meta span:hover,.site-header .menu-toggle,.site-header .menu-toggle:hover{color:' . $primary_color . '}.main-small-navigation ul li ul li a:hover,.main-small-navigation ul li:hover,.main-small-navigation ul li a:hover,.main-small-navigation ul li ul li:hover>a,.main-small-navigation ul > .current_page_item, .main-small-navigation ul > .current-menu-item,.main-small-navigation ul li.current-menu-item ul li a:hover{background-color:' . $primary_color . '}#featured_pages a.more-link:hover{border-color:' . $primary_color . ';color:' . $primary_color . '}a#back-top:before{background-color:' . $primary_color . '}a#scroll-up span{color:' . $primary_color . '}
- .woocommerce ul.products li.product .onsale,.woocommerce span.onsale,.woocommerce #respond input#submit:hover, .woocommerce a.button:hover,
- .wocommerce button.button:hover, .woocommerce input.button:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover,
- .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover {background-color: ' . $primary_color . '}
- .woocommerce .woocommerce-message::before { color: ' . $primary_color . '; }
- .main-small-navigation ul li ul li.current-menu-item > a { background: ' . $primary_color . '; }
-
- @media (max-width: 768px){.better-responsive-menu .sub-toggle{background:' . $primary_dark . '}}';
- ?>
-
- a {
-// background: #ce3785;
-// color: #fff;
-// }
- $radiate_custom_css = get_theme_mod( 'radiate_custom_css' );
- if ( $radiate_custom_css && ! function_exists( 'wp_update_custom_css_post' ) ) {
- echo '';
- ?>
-
-
-
-
- 'radiate_customize_upsell_section',
+ 'type' => 'section',
+ 'title' => esc_html__( 'View Pro Version', 'radiate' ),
+ 'url' => 'https://themegrill.com/radiate-pricing/?utm_source=radiate-customizer&utm_medium=view-pro-link&utm_campaign=radiate-pricing',
+ 'priority' => 1,
+ 'section_callback' => 'Radiate_Upsell_Section',
+ ),
+
+ /**
+ * Panels.
+ */
+ array(
+ 'name' => 'radiate_global_options',
+ 'type' => 'panel',
+ 'title' => esc_html__( 'Global', 'radiate' ),
+ 'priority' => 10,
+ ),
+
+ array(
+ 'name' => 'radiate_header_options',
+ 'type' => 'panel',
+ 'title' => esc_html__( 'Header', 'radiate' ),
+ 'priority' => 20,
+ ),
+
+ array(
+ 'name' => 'radiate_front_page_options',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Front Page Featured Section', 'radiate' ),
+ 'priority' => 35,
+ ),
+
+ array(
+ 'name' => 'radiate_content_options',
+ 'type' => 'panel',
+ 'title' => esc_html__( 'Content', 'radiate' ),
+ 'priority' => 40,
+ ),
+
+
+ // Separator.
+ array(
+ 'name' => 'separator',
+ 'type' => 'section',
+ 'priority' => 80,
+ 'section_callback' => 'Radiate_WP_Customize_Separator',
+ ),
+
+ /**
+ * Global.
+ */
+
+ // Colors.
+ array(
+ 'name' => 'radiate_global_color_setting',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Colors', 'radiate' ),
+ 'panel' => 'radiate_global_options',
+ 'priority' => 10,
+ ),
+
+ array(
+ 'name' => 'radiate_primary_colors_section',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Primary Colors', 'radiate' ),
+ 'panel' => 'radiate_global_options',
+ 'section' => 'radiate_global_color_setting',
+ 'priority' => 10,
+ ),
+
+ array(
+ 'name' => 'radiate_link_colors_section',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Link Colors', 'radiate' ),
+ 'panel' => 'radiate_global_options',
+ 'section' => 'radiate_global_color_setting',
+ 'priority' => 10,
+ ),
+
+ // Background.
+ array(
+ 'name' => 'radiate_global_background_section',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Background', 'radiate' ),
+ 'panel' => 'radiate_global_options',
+ 'priority' => 20,
+ ),
+
+ /**
+ * Header.
+ */
+ array(
+ 'name' => 'title_tagline',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Site Identity', 'radiate' ),
+ 'panel' => 'radiate_header_options',
+ 'priority' => 5,
+ ),
+
+ array(
+ 'name' => 'radiate_header_main',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Primary Header', 'radiate' ),
+ 'panel' => 'radiate_header_options',
+ 'priority' => 30,
+ ),
+
+ array(
+ 'name' => 'radiate_header_primary_menu',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Primary Menu', 'radiate' ),
+ 'panel' => 'radiate_header_options',
+ 'priority' => 40,
+ ),
+
+ /**
+ * Content.
+ */
+ array(
+ 'name' => 'radiate_post_page_content_options',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Post/Page', 'radiate' ),
+ 'panel' => 'radiate_content_options',
+ 'priority' => 10,
+ ),
+
+ array(
+ 'name' => 'radiate_single_post_section',
+ 'type' => 'section',
+ 'title' => esc_html__( 'Single Post', 'radiate' ),
+ 'panel' => 'radiate_content_options',
+ 'priority' => 30,
+ ),
+
+ );
+
+ $options = array_merge( $options, $configs );
+
+ return $options;
+ }
+
+}
+
+return new Radiate_Customize_Register_Section_Panels();
diff --git a/inc/customizer/class-radiate-customizer.php b/inc/customizer/class-radiate-customizer.php
new file mode 100644
index 0000000..dbdb04e
--- /dev/null
+++ b/inc/customizer/class-radiate-customizer.php
@@ -0,0 +1,415 @@
+register_panel_type( 'Radiate_WP_Customize_Panel' );
+ $wp_customize->register_section_type( 'Radiate_WP_Customize_Section' );
+ $wp_customize->register_section_type( 'Radiate_Upsell_Section' );
+
+ /**
+ * Register controls.
+ */
+ /**
+ * WordPress default controls.
+ */
+ // Checkbox control.
+ Radiate_Customize_Base_Control::add_control(
+ 'checkbox',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_checkbox',
+ ),
+ )
+ );
+
+ // Radio control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radio',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Select control.
+ Radiate_Customize_Base_Control::add_control(
+ 'select',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Text control.
+ Radiate_Customize_Base_Control::add_control(
+ 'text',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_nohtml',
+ ),
+ )
+ );
+
+ // Number control.
+ Radiate_Customize_Base_Control::add_control(
+ 'number',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_number',
+ ),
+ )
+ );
+
+ // Email control.
+ Radiate_Customize_Base_Control::add_control(
+ 'email',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_email',
+ ),
+ )
+ );
+
+ // URL control.
+ Radiate_Customize_Base_Control::add_control(
+ 'url',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_url',
+ ),
+ )
+ );
+
+ // Textarea control.
+ Radiate_Customize_Base_Control::add_control(
+ 'textarea',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_html',
+ ),
+ )
+ );
+
+ // Dropdown pages control.
+ Radiate_Customize_Base_Control::add_control(
+ 'dropdown-pages',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_dropdown_pages',
+ ),
+ )
+ );
+
+ // Color control.
+ Radiate_Customize_Base_Control::add_control(
+ 'color',
+ array(
+ 'callback' => 'WP_Customize_Color_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_hex_color',
+ ),
+ )
+ );
+
+ // Image upload control.
+ Radiate_Customize_Base_Control::add_control(
+ 'image',
+ array(
+ 'callback' => 'WP_Customize_Image_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_image_upload',
+ ),
+ )
+ );
+
+ // Radio image control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-radio-image',
+ array(
+ 'callback' => 'Radiate_Radio_Image_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Heading control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-heading',
+ array(
+ 'callback' => 'Radiate_Heading_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Editor control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-editor',
+ array(
+ 'callback' => 'Radiate_Editor_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_html',
+ ),
+ )
+ );
+
+ // Color control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-color',
+ array(
+ 'callback' => 'Radiate_Color_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_alpha_color',
+ ),
+ )
+ );
+
+ // Buttonset control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-buttonset',
+ array(
+ 'callback' => 'Radiate_Buttonset_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Toggle control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-toggle',
+ array(
+ 'callback' => 'Radiate_Toggle_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_checkbox',
+ ),
+ )
+ );
+
+ // Divider control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-divider',
+ array(
+ 'callback' => 'Radiate_Divider_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Slider control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-slider',
+ array(
+ 'callback' => 'Radiate_Slider_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_number',
+ ),
+ )
+ );
+
+ // Custom control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-custom',
+ array(
+ 'callback' => 'Radiate_Custom_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Dropdown categories control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-dropdown-categories',
+ array(
+ 'callback' => 'Radiate_Dropdown_Categories_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_dropdown_categories',
+ ),
+ )
+ );
+
+ // Background control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-background',
+ array(
+ 'callback' => 'Radiate_Background_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_background',
+ ),
+ )
+ );
+
+ // Typography control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-typography',
+ array(
+ 'callback' => 'Radiate_Typography_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_typography',
+ ),
+ )
+ );
+
+ // Hidden control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-hidden',
+ array(
+ 'callback' => 'Radiate_Hidden_Control',
+ 'sanitize_callback' => '',
+ )
+ );
+
+ // Sortable control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-sortable',
+ array(
+ 'callback' => 'Radiate_Sortable_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_Sanitizes',
+ 'sanitize_sortable',
+ ),
+ )
+ );
+
+ // Group control.
+ Radiate_Customize_Base_Control::add_control(
+ 'Radiate-group',
+ array(
+ 'callback' => 'Radiate_Group_Control',
+ )
+ );
+
+ }
+
+ /**
+ * Include the required files for Customize option.
+ */
+ public function customize_options_file_include() {
+
+ // Include the required customize section and panels register file.
+ require RADIATE_CUSTOMIZER_DIR . '/class-radiate-customizer-register-sections-panels.php';
+
+ /**
+ * Include the required customize options file.
+ */
+ // Global.
+ require RADIATE_CUSTOMIZER_DIR . '/options/global/class-radiate-customize-colors-options.php';
+ require RADIATE_CUSTOMIZER_DIR . '/options/global/class-radiate-customize-background-options.php';
+
+// // Header.
+ require RADIATE_CUSTOMIZER_DIR . '/options/header/class-radiate-customize-site-identity-options.php';
+ require RADIATE_CUSTOMIZER_DIR . '/options/header/class-radiate-customize-primary-header-options.php';
+ require RADIATE_CUSTOMIZER_DIR . '/options/header/class-radiate-customize-primary-menu-options.php';
+
+
+ // Front page featured section.
+ require RADIATE_CUSTOMIZER_DIR . '/options/front-page/class-radiate-customize-front-page-options.php';
+
+ // Content.
+ require RADIATE_CUSTOMIZER_DIR . '/options/content/class-radiate-customize-single-post-options.php';
+
+ }
+
+}
+
+return new Radiate_Customizer();
diff --git a/inc/customizer/class-radiate-editor-custom-control.php b/inc/customizer/class-radiate-editor-custom-control.php
new file mode 100644
index 0000000..160243f
--- /dev/null
+++ b/inc/customizer/class-radiate-editor-custom-control.php
@@ -0,0 +1,69 @@
+json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+ <# var editorID = data.id.replace( '[', '-' ).replace( ']', '' ) #>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+
+
+ li {
+ list-style: none;
+}
+
+.customize-section-description .radiate-section-description ul > li:last-child {
+ margin-bottom: 0;
+}
+
+.customize-section-description .radiate-section-description a {
+ font-style: italic;
+}
+
+.customize-control {
+ background: #fff;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ margin-bottom: 0;
+ padding: 10px;
+ position: relative;
+}
+
+.customize-control .customize-control-title {
+ color: #444444;
+ font-size: 14px;
+ font-weight: 600;
+ margin-bottom: 0px;
+}
+
+.customize-control .radiate-control-tooltip {
+ position: absolute;
+ left: 10px;
+ top: 9px;
+}
+
+.customize-control .attachment-media-view .button-add-media {
+ background: #ebebeb;
+}
+
+.customize-control .attachment-media-view .button-add-media:hover {
+ background: #ffffff;
+}
+
+.customize-control select,
+.customize-control input[type]:not([type=range]):not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),
+.customize-control .select2-selection--single {
+ border-color: #eeeeee;
+ border-radius: 2px;
+ min-height: 34px;
+}
+
+.customize-control .customize-inside-control-row {
+ padding-bottom: 0;
+ padding-top: 0;
+}
+
+.customize-control.customize-control-radio .customize-inside-control-row, .customize-control.customize-control-checkbox .customize-inside-control-row {
+ padding-bottom: 6px;
+ padding-top: 6px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers {
+ position: absolute;
+ left: 0;
+ top: -3px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li {
+ float: right;
+ line-height: 0;
+ margin: 0;
+ padding-left: 2px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button {
+ background: transparent;
+ border: none;
+ color: rgba(68, 68, 68, 0.5);
+ cursor: pointer;
+ outline: none;
+ padding: 2px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button i {
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button.active {
+ color: #0073aa;
+}
+
+.customize-control.has-responsive-switchers .control-wrap:not(.active) {
+ display: none;
+ width: 100%;
+}
+
+.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
+ -webkit-transform: translateX(100%);
+ transform: translateX(100%);
+}
+
+#customize-theme-controls .customize-pane-child.current-section-parent {
+ -webkit-transform: translateX(100%);
+ transform: translateX(100%);
+}
+
+#customize-theme-controls .control-section.open {
+ height: 100%;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section {
+ margin-right: -12px;
+ margin-left: -12px;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title {
+ background-color: #ffffff;
+ border-bottom: 1px solid #ebebeb;
+ border-right: 4px solid #ffffff;
+ color: #444444;
+ -webkit-transition: .15s color ease-in-out, .15s background-color ease-in-out, .15s border-color ease-in-out;
+ transition: .15s color ease-in-out, .15s background-color ease-in-out, .15s border-color ease-in-out;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:after {
+ color: #a0a5aa;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover,
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:focus {
+ background: #f3f3f5;
+ border-right-color: #0073aa;
+ color: #0073aa;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover:after {
+ color: #0073aa;
+}
+
+#customize-theme-controls .accordion-section-title {
+ border-color: #ebebeb;
+ color: #444444;
+ font-weight: 600;
+}
+
+#customize-theme-controls .accordion-section-title:hover, #customize-theme-controls .accordion-section-title:focus {
+ border-right-color: #0073aa;
+ color: #0073aa;
+}
+
+.radiate-hide {
+ display: none !important;
+}
+
+.customize-control-checkbox,
+.customize-control-radio {
+ padding-bottom: 5px;
+ padding-top: 5px;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title {
+ background-color: #289DCC !important;
+ border-right-color: #0073aa;
+ color: #fff !important;
+ padding: 0;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a {
+ color: #fff;
+ display: block;
+ padding: 12px 15px 15px;
+ text-decoration: none;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a:hover {
+ background-color: #1f91bf !important;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title:after {
+ color: #fff !important;
+}
+
+#accordion-section-radiate_customize_upsell_section h3 a::after {
+ color: #fff;
+}
diff --git a/inc/customizer/core/assets/css/extend-customizer.css b/inc/customizer/core/assets/css/extend-customizer.css
new file mode 100644
index 0000000..6dc15e6
--- /dev/null
+++ b/inc/customizer/core/assets/css/extend-customizer.css
@@ -0,0 +1,221 @@
+a {
+ color: #0073aa;
+}
+
+a:focus {
+ -webkit-box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.8);
+ box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.8);
+}
+
+.button {
+ background: #ebebeb;
+ border-color: #0073aa;
+ color: #0073aa;
+ font-weight: 600;
+ -webkit-transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.button:hover {
+ background: #ffffff;
+ color: #0073aa;
+}
+
+.select2-container--default .select2-selection--single .select2-selection__arrow b {
+ margin-top: 0;
+}
+
+.tg-section-separator {
+ display: block !important;
+ margin-top: 4px;
+}
+
+.customize-section-description .radiate-section-description ul {
+ margin: 0;
+}
+
+.customize-section-description .radiate-section-description ul > li {
+ list-style: none;
+}
+
+.customize-section-description .radiate-section-description ul > li:last-child {
+ margin-bottom: 0;
+}
+
+.customize-section-description .radiate-section-description a {
+ font-style: italic;
+}
+
+.customize-control {
+ background: #fff;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ margin-bottom: 0;
+ padding: 10px;
+ position: relative;
+}
+
+.customize-control .customize-control-title {
+ color: #444444;
+ font-size: 14px;
+ font-weight: 600;
+ margin-bottom: 0px;
+}
+
+.customize-control .radiate-control-tooltip {
+ position: absolute;
+ right: 10px;
+ top: 9px;
+}
+
+.customize-control .attachment-media-view .button-add-media {
+ background: #ebebeb;
+}
+
+.customize-control .attachment-media-view .button-add-media:hover {
+ background: #ffffff;
+}
+
+.customize-control select,
+.customize-control input[type]:not([type=range]):not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),
+.customize-control .select2-selection--single {
+ border-color: #eeeeee;
+ border-radius: 2px;
+ min-height: 34px;
+}
+
+.customize-control .customize-inside-control-row {
+ padding-bottom: 0;
+ padding-top: 0;
+}
+
+.customize-control.customize-control-radio .customize-inside-control-row, .customize-control.customize-control-checkbox .customize-inside-control-row {
+ padding-bottom: 6px;
+ padding-top: 6px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers {
+ position: absolute;
+ right: 0;
+ top: -3px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li {
+ float: left;
+ line-height: 0;
+ margin: 0;
+ padding-right: 2px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button {
+ background: transparent;
+ border: none;
+ color: rgba(68, 68, 68, 0.5);
+ cursor: pointer;
+ outline: none;
+ padding: 2px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button i {
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.customize-control.has-responsive-switchers .responsive-switchers li button.active {
+ color: #0073aa;
+}
+
+.customize-control.has-responsive-switchers .control-wrap:not(.active) {
+ display: none;
+ width: 100%;
+}
+
+.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
+ -webkit-transform: translateX(-100%);
+ transform: translateX(-100%);
+}
+
+#customize-theme-controls .customize-pane-child.current-section-parent {
+ -webkit-transform: translateX(-100%);
+ transform: translateX(-100%);
+}
+
+#customize-theme-controls .control-section.open {
+ height: 100%;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section {
+ margin-left: -12px;
+ margin-right: -12px;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title {
+ background-color: #ffffff;
+ border-bottom: 1px solid #ebebeb;
+ border-left: 4px solid #ffffff;
+ color: #444444;
+ -webkit-transition: .15s color ease-in-out, .15s background-color ease-in-out, .15s border-color ease-in-out;
+ transition: .15s color ease-in-out, .15s background-color ease-in-out, .15s border-color ease-in-out;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:after {
+ color: #a0a5aa;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover,
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:focus {
+ background: #f3f3f5;
+ border-left-color: #0073aa;
+ color: #0073aa;
+}
+
+#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover:after {
+ color: #0073aa;
+}
+
+#customize-theme-controls .accordion-section-title {
+ border-color: #ebebeb;
+ color: #444444;
+ font-weight: 600;
+}
+
+#customize-theme-controls .accordion-section-title:hover, #customize-theme-controls .accordion-section-title:focus {
+ border-left-color: #0073aa;
+ color: #0073aa;
+}
+
+.radiate-hide {
+ display: none !important;
+}
+
+.customize-control-checkbox,
+.customize-control-radio {
+ padding-bottom: 5px;
+ padding-top: 5px;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title {
+ background-color: #289DCC !important;
+ border-left-color: #0073aa;
+ color: #fff !important;
+ padding: 0;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a {
+ color: #fff;
+ display: block;
+ padding: 12px 15px 15px;
+ text-decoration: none;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a:hover {
+ background-color: #1f91bf !important;
+}
+
+#accordion-section-radiate_customize_upsell_section h3.accordion-section-title:after {
+ color: #fff !important;
+}
+
+#accordion-section-radiate_customize_upsell_section h3 a::after {
+ color: #fff;
+}
diff --git a/inc/customizer/core/assets/css/extend-customizer.min-rtl.css b/inc/customizer/core/assets/css/extend-customizer.min-rtl.css
new file mode 100644
index 0000000..568f5a0
--- /dev/null
+++ b/inc/customizer/core/assets/css/extend-customizer.min-rtl.css
@@ -0,0 +1 @@
+a{color:#0073aa}a:focus{-webkit-box-shadow:0 0 0 1px rgba(0,115,170,0.8);box-shadow:0 0 0 1px rgba(0,115,170,0.8)}.button{background:#ebebeb;border-color:#0073aa;color:#0073aa;font-weight:600;-webkit-transition:all .15s cubic-bezier(0.4,0,0.2,1);transition:all .15s cubic-bezier(0.4,0,0.2,1)}.button:hover{background:#fff;color:#0073aa}.select2-container--default .select2-selection--single .select2-selection__arrow b{margin-top:0}.tg-section-separator{display:block !important;margin-top:4px}.customize-section-description .radiate-section-description ul{margin:0}.customize-section-description .radiate-section-description ul>li{list-style:none}.customize-section-description .radiate-section-description ul>li:last-child{margin-bottom:0}.customize-section-description .radiate-section-description a{font-style:italic}.customize-control{background:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:10px;position:relative}.customize-control .customize-control-title{color:#444;font-size:14px;font-weight:600;margin-bottom:0}.customize-control .radiate-control-tooltip{position:absolute;left:10px;top:9px}.customize-control .attachment-media-view .button-add-media{background:#ebebeb}.customize-control .attachment-media-view .button-add-media:hover{background:#fff}.customize-control select,.customize-control input[type]:not([type=range]):not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),.customize-control .select2-selection--single{border-color:#eee;border-radius:2px;min-height:34px}.customize-control .customize-inside-control-row{padding-bottom:0;padding-top:0}.customize-control.customize-control-radio .customize-inside-control-row,.customize-control.customize-control-checkbox .customize-inside-control-row{padding-bottom:6px;padding-top:6px}.customize-control.has-responsive-switchers .responsive-switchers{position:absolute;left:0;top:-3px}.customize-control.has-responsive-switchers .responsive-switchers li{float:right;line-height:0;margin:0;padding-left:2px}.customize-control.has-responsive-switchers .responsive-switchers li button{background:transparent;border:0;color:rgba(68,68,68,0.5);cursor:pointer;outline:0;padding:2px}.customize-control.has-responsive-switchers .responsive-switchers li button i{font-size:14px;line-height:20px}.customize-control.has-responsive-switchers .responsive-switchers li button.active{color:#0073aa}.customize-control.has-responsive-switchers .control-wrap:not(.active){display:none;width:100%}.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent{-webkit-transform:translateX(100%);transform:translateX(100%)}#customize-theme-controls .customize-pane-child.current-section-parent{-webkit-transform:translateX(100%);transform:translateX(100%)}#customize-theme-controls .control-section.open{height:100%}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section{margin-right:-12px;margin-left:-12px}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title{background-color:#fff;border-bottom:1px solid #ebebeb;border-right:4px solid #fff;color:#444;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:after{color:#a0a5aa}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover,#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:focus{background:#f3f3f5;border-right-color:#0073aa;color:#0073aa}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover:after{color:#0073aa}#customize-theme-controls .accordion-section-title{border-color:#ebebeb;color:#444;font-weight:600}#customize-theme-controls .accordion-section-title:hover,#customize-theme-controls .accordion-section-title:focus{border-right-color:#0073aa;color:#0073aa}.radiate-hide{display:none !important}.customize-control-checkbox,.customize-control-radio{padding-bottom:5px;padding-top:5px}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title{background-color:#289dcc !important;border-right-color:#0073aa;color:#fff !important;padding:0}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a{color:#fff;display:block;padding:12px 15px 15px;text-decoration:none}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a:hover{background-color:#1f91bf !important}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title:after{color:#fff !important}#accordion-section-radiate_customize_upsell_section h3 a::after{color:#fff}
\ No newline at end of file
diff --git a/inc/customizer/core/assets/css/extend-customizer.min.css b/inc/customizer/core/assets/css/extend-customizer.min.css
new file mode 100644
index 0000000..c3dbe72
--- /dev/null
+++ b/inc/customizer/core/assets/css/extend-customizer.min.css
@@ -0,0 +1 @@
+a{color:#0073aa}a:focus{-webkit-box-shadow:0 0 0 1px rgba(0,115,170,0.8);box-shadow:0 0 0 1px rgba(0,115,170,0.8)}.button{background:#ebebeb;border-color:#0073aa;color:#0073aa;font-weight:600;-webkit-transition:all .15s cubic-bezier(0.4,0,0.2,1);transition:all .15s cubic-bezier(0.4,0,0.2,1)}.button:hover{background:#fff;color:#0073aa}.select2-container--default .select2-selection--single .select2-selection__arrow b{margin-top:0}.tg-section-separator{display:block !important;margin-top:4px}.customize-section-description .radiate-section-description ul{margin:0}.customize-section-description .radiate-section-description ul>li{list-style:none}.customize-section-description .radiate-section-description ul>li:last-child{margin-bottom:0}.customize-section-description .radiate-section-description a{font-style:italic}.customize-control{background:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:0;padding:10px;position:relative}.customize-control .customize-control-title{color:#444;font-size:14px;font-weight:600;margin-bottom:0}.customize-control .radiate-control-tooltip{position:absolute;right:10px;top:9px}.customize-control .attachment-media-view .button-add-media{background:#ebebeb}.customize-control .attachment-media-view .button-add-media:hover{background:#fff}.customize-control select,.customize-control input[type]:not([type=range]):not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),.customize-control .select2-selection--single{border-color:#eee;border-radius:2px;min-height:34px}.customize-control .customize-inside-control-row{padding-bottom:0;padding-top:0}.customize-control.customize-control-radio .customize-inside-control-row,.customize-control.customize-control-checkbox .customize-inside-control-row{padding-bottom:6px;padding-top:6px}.customize-control.has-responsive-switchers .responsive-switchers{position:absolute;right:0;top:-3px}.customize-control.has-responsive-switchers .responsive-switchers li{float:left;line-height:0;margin:0;padding-right:2px}.customize-control.has-responsive-switchers .responsive-switchers li button{background:transparent;border:0;color:rgba(68,68,68,0.5);cursor:pointer;outline:0;padding:2px}.customize-control.has-responsive-switchers .responsive-switchers li button i{font-size:14px;line-height:20px}.customize-control.has-responsive-switchers .responsive-switchers li button.active{color:#0073aa}.customize-control.has-responsive-switchers .control-wrap:not(.active){display:none;width:100%}.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent{-webkit-transform:translateX(-100%);transform:translateX(-100%)}#customize-theme-controls .customize-pane-child.current-section-parent{-webkit-transform:translateX(-100%);transform:translateX(-100%)}#customize-theme-controls .control-section.open{height:100%}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section{margin-left:-12px;margin-right:-12px}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title{background-color:#fff;border-bottom:1px solid #ebebeb;border-left:4px solid #fff;color:#444;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:after{color:#a0a5aa}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover,#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:focus{background:#f3f3f5;border-left-color:#0073aa;color:#0073aa}#customize-theme-controls .control-section.control-section-radiate_section .accordion-section-title:hover:after{color:#0073aa}#customize-theme-controls .accordion-section-title{border-color:#ebebeb;color:#444;font-weight:600}#customize-theme-controls .accordion-section-title:hover,#customize-theme-controls .accordion-section-title:focus{border-left-color:#0073aa;color:#0073aa}.radiate-hide{display:none !important}.customize-control-checkbox,.customize-control-radio{padding-bottom:5px;padding-top:5px}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title{background-color:#289dcc !important;border-left-color:#0073aa;color:#fff !important;padding:0}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a{color:#fff;display:block;padding:12px 15px 15px;text-decoration:none}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title a:hover{background-color:#1f91bf !important}#accordion-section-radiate_customize_upsell_section h3.accordion-section-title:after{color:#fff !important}#accordion-section-radiate_customize_upsell_section h3 a::after{color:#fff}
\ No newline at end of file
diff --git a/inc/customizer/core/assets/js/customize-preview.js b/inc/customizer/core/assets/js/customize-preview.js
new file mode 100644
index 0000000..1680f00
--- /dev/null
+++ b/inc/customizer/core/assets/js/customize-preview.js
@@ -0,0 +1,257 @@
+/**
+ * File customizer.js.
+ *
+ * Theme Customizer enhancements for a better user experience.
+ *
+ * Contains handlers to make Theme Customizer preview reload changes asynchronously.
+ */
+
+( function ( $ ) {
+
+ // Site title.
+ wp.customize(
+ 'blogname',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ $( '#site-title a' ).text( to );
+ }
+ );
+ }
+ );
+
+ // Site description.
+ wp.customize(
+ 'blogdescription',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ $( '#site-description' ).text( to );
+ }
+ );
+ }
+ );
+
+ // Header display type.
+ wp.customize(
+ 'radiate_header_display_type',
+ function ( value ) {
+ value.bind(
+ function ( layout ) {
+ var display_type = layout;
+
+ if ( display_type === 'type_two' ) {
+ $( 'body' ).removeClass( 'header_display_type_two' ).addClass( 'header_display_type_one' );
+ } else if ( display_type === 'type_three' ) {
+ $( 'body' ).removeClass( 'header_display_type_one' ).addClass( 'header_display_type_two' );
+ } else if ( display_type === 'type_one' ) {
+ $( 'body' ).removeClass( 'header_display_type_one header_display_type_two' );
+ }
+ }
+ );
+ }
+ );
+
+ // Site Layout Option.
+ wp.customize(
+ 'radiate_site_layout',
+ function ( value ) {
+ value.bind(
+ function ( layout ) {
+ var site_layout = layout;
+
+ if ( 'wide_layout' === site_layout ) {
+ $( 'body' ).removeClass( 'box-layout' ).addClass( 'wide' );
+ } else if ( 'boxed_layout' === site_layout ) {
+ $( 'body' ).removeClass( 'wide' ).addClass( 'box-layout' );
+ }
+ }
+ );
+ }
+ );
+
+ // Footer copyright alignment.
+ wp.customize(
+ 'radiate_footer_copyright_alignment_setting',
+ function ( value ) {
+ value.bind(
+ function ( alignment ) {
+ var alignment_type = alignment;
+
+ if ( alignment_type === 'left' ) {
+ $( '#colophon' ).removeClass( 'copyright-right copyright-center' );
+ } else if ( alignment_type === 'right' ) {
+ $( '#colophon' ).removeClass( 'copyright-center' ).addClass( 'copyright-right' );
+ } else if ( alignment_type === 'center' ) {
+ $( '#colophon' ).removeClass( 'copyright-right' ).addClass( 'copyright-center' );
+ }
+ }
+ );
+ }
+ );
+
+ // Footer Main Area Display Type.
+ wp.customize(
+ 'radiate_main_footer_layout_display_type',
+ function ( value ) {
+ value.bind(
+ function ( layout ) {
+ var display_type = layout;
+
+ if ( display_type === 'type_two' ) {
+ $( '#colophon' ).removeClass( 'radiate-footer--classic-bordered' ).addClass( 'radiate-footer--classic' );
+ } else if ( display_type === 'type_three' ) {
+ $( '#colophon' ).removeClass( 'radiate-footer--classic' ).addClass( 'radiate-footer--classic-bordered' );
+ } else if ( display_type === 'type_one' ) {
+ $( '#colophon' ).removeClass( 'radiate-footer--classic radiate-footer--classic-bordered' );
+ }
+ }
+ );
+ }
+ );
+
+ // Remove all of the post meta.
+ wp.customize(
+ 'radiate_all_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.above-entry-meta,.below-entry-meta,.tg-module-meta,.tg-post-categories' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.above-entry-meta,.below-entry-meta,.tg-module-meta,.tg-post-categories' ).css(
+ {
+ 'display' : 'block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+ // Disable the author post meta only.
+ wp.customize(
+ 'radiate_author_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.below-entry-meta .byline,.tg-module-meta .tg-post-auther-name' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.below-entry-meta .byline,.tg-module-meta .tg-post-auther-name' ).css(
+ {
+ 'display' : 'inline-block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+ // Disable the date post meta only.
+ wp.customize(
+ 'radiate_date_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.below-entry-meta .posted-on,.tg-module-meta .tg-post-date' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.below-entry-meta .posted-on,.tg-module-meta .tg-post-date' ).css(
+ {
+ 'display' : 'inline-block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+ // Disable the category post meta only.
+ wp.customize(
+ 'radiate_category_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.above-entry-meta,.tg-post-categories' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.above-entry-meta,.tg-post-categories' ).css(
+ {
+ 'display' : 'inline-block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+ // Disable the comments post meta only.
+ wp.customize(
+ 'radiate_comments_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.below-entry-meta .comments,.tg-module-meta .tg-module-comments' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.below-entry-meta .comments,.tg-module-meta .tg-module-comments' ).css(
+ {
+ 'display' : 'inline-block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+ // Disable the tags post meta only.
+ wp.customize(
+ 'radiate_tags_entry_meta_remove',
+ function ( value ) {
+ value.bind(
+ function ( to ) {
+ if ( to ) {
+ $( '.below-entry-meta .tag-links' ).css(
+ {
+ 'display' : 'none'
+ }
+ );
+ } else {
+ $( '.below-entry-meta .tag-links' ).css(
+ {
+ 'display' : 'inline-block'
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+
+} )( jQuery );
diff --git a/inc/customizer/core/assets/js/customize-preview.min.js b/inc/customizer/core/assets/js/customize-preview.min.js
new file mode 100644
index 0000000..9148931
--- /dev/null
+++ b/inc/customizer/core/assets/js/customize-preview.min.js
@@ -0,0 +1 @@
+!function(o){wp.customize("blogname",function(e){e.bind(function(e){o("#site-title a").text(e)})}),wp.customize("blogdescription",function(e){e.bind(function(e){o("#site-description").text(e)})}),wp.customize("radiate_header_display_type",function(e){e.bind(function(e){"type_two"===e?o("body").removeClass("header_display_type_two").addClass("header_display_type_one"):"type_three"===e?o("body").removeClass("header_display_type_one").addClass("header_display_type_two"):"type_one"===e&&o("body").removeClass("header_display_type_one header_display_type_two")})}),wp.customize("radiate_site_layout",function(e){e.bind(function(e){"wide_layout"===e?o("body").removeClass("box-layout").addClass("wide"):"boxed_layout"===e&&o("body").removeClass("wide").addClass("box-layout")})}),wp.customize("radiate_footer_copyright_alignment_setting",function(e){e.bind(function(e){"left"===e?o("#colophon").removeClass("copyright-right copyright-center"):"right"===e?o("#colophon").removeClass("copyright-center").addClass("copyright-right"):"center"===e&&o("#colophon").removeClass("copyright-right").addClass("copyright-center")})}),wp.customize("radiate_main_footer_layout_display_type",function(e){e.bind(function(e){"type_two"===e?o("#colophon").removeClass("radiate-footer--classic-bordered").addClass("radiate-footer--classic"):"type_three"===e?o("#colophon").removeClass("radiate-footer--classic").addClass("radiate-footer--classic-bordered"):"type_one"===e&&o("#colophon").removeClass("radiate-footer--classic radiate-footer--classic-bordered")})}),wp.customize("radiate_all_entry_meta_remove",function(e){e.bind(function(e){e?o(".above-entry-meta,.below-entry-meta,.tg-module-meta,.tg-post-categories").css({display:"none"}):o(".above-entry-meta,.below-entry-meta,.tg-module-meta,.tg-post-categories").css({display:"block"})})}),wp.customize("radiate_author_entry_meta_remove",function(e){e.bind(function(e){e?o(".below-entry-meta .byline,.tg-module-meta .tg-post-auther-name").css({display:"none"}):o(".below-entry-meta .byline,.tg-module-meta .tg-post-auther-name").css({display:"inline-block"})})}),wp.customize("radiate_date_entry_meta_remove",function(e){e.bind(function(e){e?o(".below-entry-meta .posted-on,.tg-module-meta .tg-post-date").css({display:"none"}):o(".below-entry-meta .posted-on,.tg-module-meta .tg-post-date").css({display:"inline-block"})})}),wp.customize("radiate_category_entry_meta_remove",function(e){e.bind(function(e){e?o(".above-entry-meta,.tg-post-categories").css({display:"none"}):o(".above-entry-meta,.tg-post-categories").css({display:"inline-block"})})}),wp.customize("radiate_comments_entry_meta_remove",function(e){e.bind(function(e){e?o(".below-entry-meta .comments,.tg-module-meta .tg-module-comments").css({display:"none"}):o(".below-entry-meta .comments,.tg-module-meta .tg-module-comments").css({display:"inline-block"})})}),wp.customize("radiate_tags_entry_meta_remove",function(e){e.bind(function(e){e?o(".below-entry-meta .tag-links").css({display:"none"}):o(".below-entry-meta .tag-links").css({display:"inline-block"})})})}(jQuery);
\ No newline at end of file
diff --git a/inc/customizer/core/assets/js/customizer-controls-toggle.js b/inc/customizer/core/assets/js/customizer-controls-toggle.js
new file mode 100644
index 0000000..25232c4
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-controls-toggle.js
@@ -0,0 +1,65 @@
+/**
+ * Customizer controls toggle.
+ *
+ * @package Radiate
+ */
+
+(
+ function ( $ ) {
+
+ /* Internal shorthand */
+ var api = wp.customize;
+
+ /**
+ * Trigger hooks
+ */
+ RadiateControlTrigger = {
+
+ /**
+ * Trigger a hook.
+ *
+ * @method triggerHook
+ * @param {String} hook The hook to trigger.
+ * @param {Array} args An array of args to pass to the hook.
+ */
+ triggerHook : function ( hook, args ) {
+ $( 'body' ).trigger( 'radiate-control-trigger.' + hook, args );
+ },
+
+ /**
+ * Add a hook.
+ *
+ * @method addHook
+ * @param {String} hook The hook to add.
+ * @param {Function} callback A function to call when the hook is triggered.
+ */
+ addHook : function ( hook, callback ) {
+ $( 'body' ).on( 'radiate-control-trigger.' + hook, callback );
+ },
+
+ /**
+ * Remove a hook.
+ *
+ * @method removeHook
+ * @param {String} hook The hook to remove.
+ * @param {Function} callback The callback function to remove.
+ */
+ removeHook : function ( hook, callback ) {
+ $( 'body' ).off( 'radiate-control-trigger.' + hook, callback );
+ }
+
+ };
+
+ /**
+ * Helper class that contains data for showing and hiding controls.
+ *
+ * @class RadiateCustomizerToggles
+ */
+ RadiateCustomizerToggles = {
+
+ 'radiate_header_image_link' : [],
+
+ };
+
+ }
+)( jQuery );
diff --git a/inc/customizer/core/assets/js/customizer-controls-toggle.min.js b/inc/customizer/core/assets/js/customizer-controls-toggle.min.js
new file mode 100644
index 0000000..b1eb545
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-controls-toggle.min.js
@@ -0,0 +1 @@
+!function(g){wp.customize;RadiateControlTrigger={triggerHook:function(o,r){g("body").trigger("radiate-control-trigger."+o,r)},addHook:function(o,r){g("body").on("radiate-control-trigger."+o,r)},removeHook:function(o,r){g("body").off("radiate-control-trigger."+o,r)}},RadiateCustomizerToggles={radiate_header_image_link:[]}}(jQuery);
\ No newline at end of file
diff --git a/inc/customizer/core/assets/js/customizer-controls.js b/inc/customizer/core/assets/js/customizer-controls.js
new file mode 100644
index 0000000..79f6810
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-controls.js
@@ -0,0 +1,99 @@
+/**
+ * Customizer controls.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ /* Internal shorthand */
+ var api = wp.customize;
+
+ /**
+ * Helper class for the main Customizer interface.
+ *
+ * @class RadiateCustomizer
+ */
+ RadiateCustomizer = {
+
+ controls : {},
+
+ /**
+ * Initializes our custom logic for the Customizer.
+ *
+ * @method init
+ */
+ init : function () {
+ RadiateCustomizer._initToggles();
+ },
+
+ /**
+ * Initializes the logic for showing and hiding controls
+ * when a setting changes.
+ *
+ * @since 1.0.0
+ * @access private
+ * @method _initToggles
+ */
+ _initToggles : function () {
+
+ // Trigger the Adv Tab Click trigger.
+ RadiateControlTrigger.triggerHook( 'radiate-toggle-control', api );
+
+ // Loop through each setting.
+ $.each(
+ RadiateCustomizerToggles,
+ function ( settingId, toggles ) {
+
+ // Get the setting object.
+ api(
+ settingId,
+ function ( setting ) {
+
+ // Loop though the toggles for the setting.
+ $.each(
+ toggles,
+ function ( i, toggle ) {
+ // Loop through the controls for the toggle.
+ $.each(
+ toggle.controls,
+ function ( k, controlId ) {
+ // Get the control object.
+ api.control(
+ controlId,
+ function ( control ) {
+
+ // Define the visibility callback.
+ var visibility = function ( to ) {
+ control.container.toggle( toggle.callback( to ) );
+ };
+
+ // Init visibility.
+ visibility( setting.get() );
+
+ // Bind the visibility callback to the setting.
+ setting.bind( visibility );
+
+ }
+ );
+ }
+ );
+ }
+ );
+ }
+ );
+
+ }
+ );
+ }
+
+ };
+
+ $(
+ function () {
+ RadiateCustomizer.init();
+ }
+ );
+
+ }
+)( jQuery );
diff --git a/inc/customizer/core/assets/js/customizer-controls.min.js b/inc/customizer/core/assets/js/customizer-controls.min.js
new file mode 100644
index 0000000..77d1492
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-controls.min.js
@@ -0,0 +1 @@
+!function(c){var r=wp.customize;RadiateCustomizer={controls:{},init:function(){RadiateCustomizer._initToggles()},_initToggles:function(){RadiateControlTrigger.triggerHook("radiate-toggle-control",r),c.each(RadiateCustomizerToggles,function(o,n){r(o,function(i){c.each(n,function(o,t){c.each(t.controls,function(o,n){r.control(n,function(n){function o(o){n.container.toggle(t.callback(o))}o(i.get()),i.bind(o)})})})})})}},c(function(){RadiateCustomizer.init()})}(jQuery);
\ No newline at end of file
diff --git a/inc/customizer/core/assets/js/customizer-dependency.js b/inc/customizer/core/assets/js/customizer-dependency.js
new file mode 100644
index 0000000..d058dc0
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-dependency.js
@@ -0,0 +1,406 @@
+/**
+ * Customizer dependency controls.
+ *
+ * @package Radiate
+ */
+
+(
+ function ( $ ) {
+
+ 'use strict';
+
+ /* Internal shorthand */
+ var api = wp.customize;
+
+ /**
+ * Helper class for the main Customizer interface.
+ *
+ * @class Radiate_Customizer_FrameWork
+ */
+ var Radiate_Customizer_FrameWork = {
+
+ controls : {},
+
+ /**
+ * Initializes the logic for showing and hiding controls
+ * when a setting changes.
+ *
+ * @access private
+ * @method init
+ */
+ init : function () {
+ var $this = this;
+
+ $this.handleDependency();
+ $this.hideEmptySections();
+
+ api.bind(
+ 'change',
+ function ( setting, data ) {
+ var has_dependents = $this.hasDependentControls( setting.id );
+
+ if ( has_dependents ) {
+ $this.handleDependency();
+ $this.hideEmptySections();
+ }
+ }
+ );
+ },
+
+ /**
+ * Handles dependency for controls.
+ *
+ * @access private
+ * @method handleDependency
+ */
+ handleDependency : function () {
+ var $this = this,
+ values = api.get();
+
+ $this.checked_controls = {};
+
+ _.each(
+ values,
+ function ( value, id ) {
+ var control = api.control( id );
+
+ $this.checkControlVisibility( control, id );
+ }
+ );
+ },
+
+ /**
+ * Hide OR display controls according to dependency
+ *
+ * @access private
+ * @method checkControlVisibility
+ */
+ checkControlVisibility : function ( control, id ) {
+ var $this = this,
+ values = api.get();
+
+ if ( ! _.isUndefined( control ) ) {
+
+ // If control has dependency defined.
+ if ( 'undefined' != typeof RadiateCustomizerControlsToggle[id] ) {
+ var check = false,
+ dependency_param = RadiateCustomizerControlsToggle[id],
+ conditions = ! _.isUndefined( dependency_param.conditions ) ? dependency_param.conditions : dependency_param,
+ operator = ! _.isUndefined( dependency_param.operator ) ? dependency_param.operator : 'AND';
+
+ if ( 'undefined' !== typeof conditions ) {
+ check = $this.checkDependency( conditions, values, operator );
+ this.checked_controls[id] = check;
+
+ if ( ! check ) {
+ control.container.addClass( 'radiate-hide' );
+ } else {
+ control.container.removeClass( 'radiate-hide' );
+ }
+ }
+ }
+
+ }
+ },
+
+ /**
+ * Checks dependency condtions for controls
+ *
+ * @access private
+ * @method checkDependency
+ */
+ checkDependency : function ( conditions, values, compare_operator ) {
+
+ var control = this,
+ check = true,
+ returnNow = false,
+ testValue = conditions[0];
+
+ if ( _.isString( testValue ) ) {
+
+ var cond = conditions[1],
+ cond_val = conditions[2],
+ value;
+
+ if ( ! _.isUndefined( RadiateCustomizerControlsToggle[testValue] ) ) {
+ var conditions = ! _.isUndefined( RadiateCustomizerControlsToggle[testValue]['conditions'] ) ? RadiateCustomizerControlsToggle[testValue]['conditions'] : RadiateCustomizerControlsToggle[testValue];
+ var operator = ! _.isUndefined( RadiateCustomizerControlsToggle[testValue]['operator'] ) ? RadiateCustomizerControlsToggle[testValue]['operator'] : 'AND';
+
+ if ( ! _.isUndefined( conditions ) ) {
+ // Check visibility for dependent controls also.
+ if ( ! control.checkDependency( conditions, values, operator ) ) {
+ returnNow = true;
+ check = false;
+
+ if ( 'AND' == compare_operator ) {
+ return;
+ }
+ } else {
+ var control_obj = api.control( testValue );
+
+ control_obj.container.removeClass( 'radiate-hide' );
+ }
+ }
+ }
+
+ if ( ! _.isUndefined( values[testValue] ) && ! returnNow && check ) {
+ value = values[testValue];
+ check = control.compareValues( value, cond, cond_val );
+ }
+
+ } else if ( _.isArray( testValue ) ) {
+
+ $.each(
+ conditions,
+ function ( index, val ) {
+
+ var cond_key = val[0],
+ cond_cond = val[1],
+ cond_val = val[2],
+ test_val = ! _.isUndefined( values[cond_key] ) ? values[cond_key] : '';
+
+ if ( 'undefined' !== typeof RadiateCustomizerControlsToggle[cond_key] ) {
+ var conditions = ! _.isUndefined( RadiateCustomizerControlsToggle[cond_key]['conditions'] ) ? RadiateCustomizerControlsToggle[cond_key]['conditions'] : RadiateCustomizerControlsToggle[cond_key];
+ var operator = ! _.isUndefined( RadiateCustomizerControlsToggle[cond_key]['operator'] ) ? RadiateCustomizerControlsToggle[cond_key]['operator'] : 'AND';
+
+ if ( ! _.isUndefined( conditions ) ) {
+ // Check visibility for dependent controls also.
+ if ( ! control.checkDependency( conditions, values, operator ) ) {
+ check = false;
+
+ if ( 'AND' == compare_operator ) {
+ return;
+ }
+ } else {
+ check = true;
+ var control_obj = api.control( cond_key );
+
+ control_obj.container.removeClass( 'radiate-hide' );
+ }
+ }
+ } else {
+ check = true;
+ }
+
+ if ( check ) {
+ if ( 'AND' == compare_operator ) {
+ if ( ! control.compareValues( test_val, cond_cond, cond_val ) ) {
+ check = false;
+
+ return false;
+ }
+ } else {
+ if ( control.compareValues( test_val, cond_cond, cond_val ) ) {
+ returnNow = true;
+ check = true;
+ } else {
+ check = false;
+ }
+ }
+ }
+ }
+
+ );
+
+ // Break loop in case of OR operator.
+ if ( returnNow && 'OR' == compare_operator ) {
+ check = true;
+ }
+
+ }
+
+ return check;
+
+ },
+
+ /**
+ * Compare values of the dependent controls.
+ *
+ * @access private
+ * @method compareValues
+ */
+ compareValues : function ( value1, condition, value2 ) {
+
+ var equal = false;
+
+ switch ( condition ) {
+
+ case '===':
+ equal = (
+ value1 === value2
+ ) ? true : false;
+ break;
+
+ case '>':
+ equal = (
+ value1 > value2
+ ) ? true : false;
+ break;
+
+ case '<':
+ equal = (
+ value1 < value2
+ ) ? true : false;
+ break;
+
+ case '<=':
+ equal = (
+ value1 <= value2
+ ) ? true : false;
+ break;
+
+ case '>=':
+ equal = (
+ value1 >= value2
+ ) ? true : false;
+ break;
+
+ case '!=':
+ equal = (
+ value1 != value2
+ ) ? true : false;
+ break;
+
+ case 'empty':
+ var _v = _.clone( value1 );
+
+ if ( _.isObject( _v ) || _.isArray( _v ) ) {
+ _.each(
+ _v,
+ function ( v, i ) {
+ if ( _.isEmpty( v ) ) {
+ delete _v[i];
+ }
+ }
+ );
+
+ equal = _.isEmpty( _v ) ? true : false;
+ } else {
+ equal = _.isNull( _v ) || _v == '' ? true : false;
+ }
+ break;
+
+ case 'not_empty':
+ var _v = _.clone( value1 );
+
+ if ( _.isObject( _v ) || _.isArray( _v ) ) {
+ _.each(
+ _v,
+ function ( v, i ) {
+ if ( _.isEmpty( v ) ) {
+ delete _v[i];
+ }
+ }
+ )
+ }
+
+ equal = _.isEmpty( _v ) ? false : true;
+ break;
+
+ case 'contains':
+ if ( _.isArray( value1 ) ) {
+ if ( $.inArray( value2, value1 ) !== - 1 ) {
+ equal = true;
+ }
+ }
+ break;
+
+ default:
+ if ( _.isArray( value2 ) ) {
+ if ( ! _.isEmpty( value2 ) && ! _.isEmpty( value1 ) ) {
+ equal = _.contains( value2, value1 );
+ } else {
+ equal = false;
+ }
+ } else {
+ equal = (
+ value1 == value2
+ ) ? true : false;
+ }
+ break;
+
+ }
+
+ return equal;
+
+ },
+
+ /**
+ * Hide Section without Controls.
+ */
+ hideEmptySections : function () {
+
+ $( 'ul.accordion-section.control-section-radiate_section' ).each(
+ function () {
+ var parentId = $( this ).attr( 'id' ),
+ visibleIt = false,
+ controls = $( this ).find( ' > .customize-control' );
+
+ if ( controls.length > 0 ) {
+ controls.each(
+ function () {
+ if ( ! $( this ).hasClass( 'radiate-hide' ) && $( this ).css( 'display' ) != 'none' ) {
+ visibleIt = true;
+ }
+ }
+ );
+
+ if ( ! visibleIt ) {
+ $( '.control-section[aria-owns="' + parentId + '"]' ).addClass( 'radiate-hide' );
+ } else {
+ $( '.control-section[aria-owns="' + parentId + '"]' ).removeClass( 'radiate-hide' );
+ }
+ }
+ }
+ );
+
+ },
+
+ hasDependentControls : function ( control_id ) {
+ var check = false;
+
+ $.each(
+ RadiateCustomizerControlsToggle,
+ function ( index, val ) {
+
+ if ( ! _.isUndefined( val.conditions ) ) {
+ var conditions = val.conditions;
+
+ $.each(
+ conditions,
+ function ( index, val ) {
+
+ var control = val[0];
+
+ if ( control_id == control ) {
+ check = true;
+ return;
+ }
+ }
+ );
+ } else {
+ var control = val[0];
+
+ if ( control_id == control ) {
+ check = true;
+
+ return;
+ }
+ }
+
+ }
+ );
+
+ return check;
+ },
+
+ };
+
+ $(
+ function () {
+ Radiate_Customizer_FrameWork.init();
+ }
+ );
+
+ }
+)( jQuery );
diff --git a/inc/customizer/core/assets/js/customizer-dependency.min.js b/inc/customizer/core/assets/js/customizer-dependency.min.js
new file mode 100644
index 0000000..f50f95a
--- /dev/null
+++ b/inc/customizer/core/assets/js/customizer-dependency.min.js
@@ -0,0 +1 @@
+!function(t){"use strict";var C=wp.customize,o={controls:{},init:function(){var n=this;n.handleDependency(),n.hideEmptySections(),C.bind("change",function(o,e){n.hasDependentControls(o.id)&&(n.handleDependency(),n.hideEmptySections())})},handleDependency:function(){var i=this,o=C.get();i.checked_controls={},_.each(o,function(o,e){var n=C.control(e);i.checkControlVisibility(n,e)})},checkControlVisibility:function(o,e){var n,i,r,t=C.get();_.isUndefined(o)||void 0!==RadiateCustomizerControlsToggle[e]&&(n=!1,r=RadiateCustomizerControlsToggle[e],i=_.isUndefined(r.conditions)?r:r.conditions,r=_.isUndefined(r.operator)?"AND":r.operator,void 0!==i&&(n=this.checkDependency(i,t,r),(this.checked_controls[e]=n)?o.container.removeClass("radiate-hide"):o.container.addClass("radiate-hide")))},checkDependency:function(o,a,c){var l=this,d=!0,g=!1,e=o[0];if(_.isString(e)){var n=o[1],i=o[2];if(!_.isUndefined(RadiateCustomizerControlsToggle[e])){var o=_.isUndefined(RadiateCustomizerControlsToggle[e].conditions)?RadiateCustomizerControlsToggle[e]:RadiateCustomizerControlsToggle[e].conditions,r=_.isUndefined(RadiateCustomizerControlsToggle[e].operator)?"AND":RadiateCustomizerControlsToggle[e].operator;if(!_.isUndefined(o))if(l.checkDependency(o,a,r))C.control(e).container.removeClass("radiate-hide");else if(d=!(g=!0),"AND"==c)return}_.isUndefined(a[e])||g||!d||(r=a[e],d=l.compareValues(r,n,i))}else _.isArray(e)&&(t.each(o,function(o,e){var n=e[0],i=e[1],r=e[2],t=_.isUndefined(a[n])?"":a[n];if(void 0!==RadiateCustomizerControlsToggle[n]){var s=_.isUndefined(RadiateCustomizerControlsToggle[n].conditions)?RadiateCustomizerControlsToggle[n]:RadiateCustomizerControlsToggle[n].conditions,e=_.isUndefined(RadiateCustomizerControlsToggle[n].operator)?"AND":RadiateCustomizerControlsToggle[n].operator;if(!_.isUndefined(s))if(l.checkDependency(s,a,e))d=!0,C.control(n).container.removeClass("radiate-hide");else if(d=!1,"AND"==c)return}else d=!0;if(d)if("AND"==c){if(!l.compareValues(t,i,r))return d=!1}else d=!!l.compareValues(t,i,r)&&(g=!0)}),g&&"OR"==c&&(d=!0));return d},compareValues:function(o,e,n){var i=!1;switch(e){case"===":i=o===n;break;case">":i=n=":i=n<=o;break;case"!=":i=o!=n;break;case"empty":var r=_.clone(o),i=_.isObject(r)||_.isArray(r)?(_.each(r,function(o,e){_.isEmpty(o)&&delete r[e]}),!!_.isEmpty(r)):!(!_.isNull(r)&&""!=r);break;case"not_empty":r=_.clone(o);(_.isObject(r)||_.isArray(r))&&_.each(r,function(o,e){_.isEmpty(o)&&delete r[e]}),i=!_.isEmpty(r);break;case"contains":_.isArray(o)&&-1!==t.inArray(n,o)&&(i=!0);break;default:i=_.isArray(n)?!_.isEmpty(n)&&!_.isEmpty(o)&&_.contains(n,o):o==n}return i},hideEmptySections:function(){t("ul.accordion-section.control-section-radiate_section").each(function(){var o=t(this).attr("id"),e=!1,n=t(this).find(" > .customize-control");0&]/gim,
+ function ( i ) {
+ return '' + i.charCodeAt( 0 ) + ';';
+ }
+ );
+
+ // Remove the description from displaying below the controller's label.
+ description.remove();
+
+ // Add the help icon in description of customize controls.
+ li_wrapper.append( '' );
+ }
+ }
+ );
+ }
+ );
+
+ }
+)( jQuery );
+
+/**
+ * Responsive devices mode click event.
+ */
+jQuery( document ).ready(
+ function ( $ ) {
+
+ // Responsive switcher button click.
+ $( '.customize-control' ).on(
+ 'click',
+ '.responsive-switchers button',
+ function ( event ) {
+
+ // Set up variables.
+ var self = $( this ),
+ devices = $( '.responsive-switchers' ),
+ device = $( event.currentTarget ).data( 'device' ),
+ control = $( '.customize-control.has-responsive-switchers' ),
+ body = $( '.wp-full-overlay' ),
+ footer_devices = $( '.wp-full-overlay-footer .devices' );
+
+ // Switching the button class.
+ devices.find( 'button' ).removeClass( 'active' );
+ devices.find( 'button.preview-' + device ).addClass( 'active' );
+
+ // Switching the control class.
+ control.find( '.control-wrap' ).removeClass( 'active' );
+ control.find( '.control-wrap.' + device ).addClass( 'active' );
+
+ // Switching wrapper class.
+ body.removeClass( 'preview-desktop preview-tablet preview-mobile' ).addClass( 'preview-' + device );
+
+ // Switching panel footer buttons.
+ footer_devices.find( 'button' ).removeClass( 'active' ).attr( 'aria-pressed', false );
+ footer_devices.find( 'button.preview-' + device ).addClass( 'active' ).attr( 'aria-pressed', true );
+
+ }
+ );
+
+ // If panel footer buttons clicked.
+ $( '.wp-full-overlay-footer .devices' ).on(
+ 'click',
+ 'button',
+ function ( event ) {
+
+ // Set up variables.
+ var self = $( this ),
+ devices = $( '.customize-control.has-responsive-switchers .responsive-switchers' ),
+ device = $( event.currentTarget ).data( 'device' ),
+ control = $( '.customize-control.has-responsive-switchers' );
+
+ // Switching the button class.
+ devices.find( 'button' ).removeClass( 'active' );
+ devices.find( 'button.preview-' + device ).addClass( 'active' );
+
+ // Switching the control class.
+ control.find( '.control-wrap' ).removeClass( 'active' );
+ control.find( '.control-wrap.' + device ).addClass( 'active' );
+
+ }
+ );
+
+ }
+);
+
+/**
+ * Extend the Customize section to make it clickable.
+ *
+ * Currently used for the Radiate Upseel section only.
+ */
+(
+ function ( $, api ) {
+ api.sectionConstructor[ 'radiate-upsell-section' ] = api.Section.extend(
+ {
+ // No events for this type of section.
+ attachEvents: function () {
+ },
+
+ // Always make the section active.
+ isContextuallyActive: function () {
+ return true;
+ }
+ }
+ );
+ }
+)( jQuery, wp.customize );
diff --git a/inc/customizer/core/assets/js/extend-customizer.min.js b/inc/customizer/core/assets/js/extend-customizer.min.js
new file mode 100644
index 0000000..f0b55e5
--- /dev/null
+++ b/inc/customizer/core/assets/js/extend-customizer.min.js
@@ -0,0 +1 @@
+!function(o){var e,i,t,n,a,s;wp.customize.bind("pane-contents-reflowed",function(){var t=[],n=[];wp.customize.section.each(function(e){"radiate_section"===e.params.type&&void 0!==e.params.section&&n.push(e)}),n.sort(wp.customize.utils.prioritySort).reverse(),o.each(n,function(e,t){o("#sub-accordion-section-"+t.params.section).children(".section-meta").after(t.headContainer)}),wp.customize.panel.each(function(e){"radiate_panel"===e.params.type&&void 0!==e.params.panel&&t.push(e)}),t.sort(wp.customize.utils.prioritySort).reverse(),o.each(t,function(e,t){o("#sub-accordion-panel-"+t.params.panel).children(".panel-meta").after(t.headContainer)})}),e=wp.customize.Panel.prototype.embed,i=wp.customize.Panel.prototype.isContextuallyActive,t=wp.customize.Panel.prototype.attachEvents,wp.customize.Panel=wp.customize.Panel.extend({attachEvents:function(){var n;"radiate_panel"===this.params.type&&void 0!==this.params.panel?(t.call(this),(n=this).expanded.bind(function(e){var t=wp.customize.panel(n.params.panel);e?t.contentContainer.addClass("current-panel-parent"):t.contentContainer.removeClass("current-panel-parent")}),n.container.find(".customize-panel-back").off("click keydown").on("click keydown",function(e){wp.customize.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()&&wp.customize.panel(n.params.panel).expand())})):t.call(this)},embed:function(){"radiate_panel"===this.params.type&&void 0!==this.params.panel?(e.call(this),o("#sub-accordion-panel-"+this.params.panel).append(this.headContainer)):e.call(this)},isContextuallyActive:function(){var t,n=this,o=0;return"radiate_panel"!==this.params.type?i.call(this):(t=this._children("panel","section"),wp.customize.panel.each(function(e){e.params.panel&&e.params.panel===n.id&&t.push(e)}),t.sort(wp.customize.utils.prioritySort),_(t).each(function(e){e.active()&&e.isContextuallyActive()&&(o+=1)}),0!==o)}}),n=wp.customize.Section.prototype.embed,a=wp.customize.Section.prototype.isContextuallyActive,s=wp.customize.Section.prototype.attachEvents,wp.customize.Section=wp.customize.Section.extend({attachEvents:function(){var n=this;"radiate_section"===this.params.type&&void 0!==this.params.section?(s.call(n),n.expanded.bind(function(e){var t=wp.customize.section(n.params.section);e?t.contentContainer.addClass("current-section-parent"):t.contentContainer.removeClass("current-section-parent")}),n.container.find(".customize-section-back").off("click keydown").on("click keydown",function(e){wp.customize.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()&&wp.customize.section(n.params.section).expand())})):s.call(n)},embed:function(){var e=this;"radiate_section"===this.params.type&&void 0!==this.params.section?(n.call(e),o("#sub-accordion-section-"+this.params.section).append(e.headContainer)):n.call(e)},isContextuallyActive:function(){var t,n=this,o=0;return"radiate_section"!==this.params.type?a.call(this):(t=this._children("section","control"),wp.customize.section.each(function(e){e.params.section&&e.params.section===n.id&&t.push(e)}),t.sort(wp.customize.utils.prioritySort),_(t).each(function(e){void 0!==e.isContextuallyActive?e.active()&&e.isContextuallyActive()&&(o+=1):e.active()&&(o+=1)}),0!==o)}})}(jQuery),jQuery,wp.customize.bind("ready",function(){wp.customize.control.each(function(e,t){var n,o=e.container.find(".customize-control-description");o.length&&(e.container.find(".customize-control-title"),n=o.closest("li"),e=o.text().replace(/[u00A0-u9999<>&]/gim,function(e){return""+e.charCodeAt(0)+";"}),o.remove(),n.append(''))})}),jQuery(document).ready(function(a){a(".customize-control").on("click",".responsive-switchers button",function(e){a(this);var t=a(".responsive-switchers"),n=a(e.currentTarget).data("device"),o=a(".customize-control.has-responsive-switchers"),i=a(".wp-full-overlay"),e=a(".wp-full-overlay-footer .devices");t.find("button").removeClass("active"),t.find("button.preview-"+n).addClass("active"),o.find(".control-wrap").removeClass("active"),o.find(".control-wrap."+n).addClass("active"),i.removeClass("preview-desktop preview-tablet preview-mobile").addClass("preview-"+n),e.find("button").removeClass("active").attr("aria-pressed",!1),e.find("button.preview-"+n).addClass("active").attr("aria-pressed",!0)}),a(".wp-full-overlay-footer .devices").on("click","button",function(e){a(this);var t=a(".customize-control.has-responsive-switchers .responsive-switchers"),n=a(e.currentTarget).data("device"),e=a(".customize-control.has-responsive-switchers");t.find("button").removeClass("active"),t.find("button.preview-"+n).addClass("active"),e.find(".control-wrap").removeClass("active"),e.find(".control-wrap."+n).addClass("active")})}),function(e){e.sectionConstructor["radiate-upsell-section"]=e.Section.extend({attachEvents:function(){},isContextuallyActive:function(){return!0}})}((jQuery,wp.customize));
\ No newline at end of file
diff --git a/inc/customizer/core/assets/scss/extend-customizer.scss b/inc/customizer/core/assets/scss/extend-customizer.scss
new file mode 100644
index 0000000..fbd3d9e
--- /dev/null
+++ b/inc/customizer/core/assets/scss/extend-customizer.scss
@@ -0,0 +1,260 @@
+@import "../../custom-controls/assets/scss/variables";
+
+a{
+ color:$color-blue;
+ &:focus{
+ box-shadow: 0 0 0 1px rgba($color-blue,0.8);
+ }
+}
+.button{
+ background: $color-light-gray;
+ border-color: $color-blue;
+ color:$color-blue;
+ font-weight: 600;
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+ &:hover{
+ background: $color-white;
+ color:$color-blue;
+ }
+}
+
+.select2-container--default{
+ .select2-selection--single{
+ .select2-selection__arrow{
+ b{
+ margin-top: 0;
+ }
+ }
+ }
+
+
+}
+.tg-section-separator {
+ display: block !important;
+ margin-top: 4px;
+}
+
+.customize-section-description {
+
+ .radiate-section-description {
+
+ ul {
+ margin: 0;
+
+ > li {
+ list-style: none;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+ }
+
+ a {
+ font-style: italic;
+ }
+ }
+}
+.customize-control {
+ background:#fff;
+ box-sizing: border-box;
+ margin-bottom: 0;
+ padding: 10px;
+ position: relative;
+
+ .customize-control-title {
+ color:$color-black;
+ font-size:14px;
+ font-weight: 600;
+ margin-bottom:0px;
+ }
+
+ .radiate-control-tooltip {
+ position: absolute;
+ right: 10px;
+ top: 9px;
+ }
+
+ .attachment-media-view{
+ .button-add-media{
+ background: $color-light-gray;
+ &:hover{
+ background: $color-white;
+ }
+ }
+ }
+
+ select,
+ input[type]:not([type=range]):not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),
+ .select2-selection--single{
+ border-color:$color-gray;
+ border-radius: 2px;
+ min-height: 34px;
+ }
+
+ .customize-inside-control-row {
+ padding-bottom: 0;
+ padding-top: 0;
+ }
+
+ &.customize-control-radio,
+ &.customize-control-checkbox {
+ .customize-inside-control-row {
+ padding-bottom: 6px;
+ padding-top: 6px;
+ }
+ }
+
+ &.has-responsive-switchers {
+
+ .responsive-switchers {
+ position: absolute;
+ right: 0;
+ top: -3px;
+
+ li {
+ float: left;
+ line-height: 0;
+ margin: 0;
+ padding-right:2px;
+
+ button {
+ background: transparent;
+ border: none;
+ color: rgba($color-black, 0.5);
+ cursor: pointer;
+ outline: none;
+ padding: 2px;
+
+ i {
+ font-size: 14px;
+ line-height: 20px;
+ }
+
+ &.active {
+ color: $color-blue;
+ }
+ }
+ }
+ }
+
+ .control-wrap {
+
+ &:not(.active) {
+ display: none;
+ width: 100%;
+ }
+ }
+ }
+}
+
+
+
+#customize-theme-controls {
+
+ .in-sub-panel & {
+
+ .customize-pane-child.current-panel-parent {
+ transform: translateX(-100%);
+ }
+ }
+
+ .customize-pane-child.current-section-parent {
+ transform: translateX(-100%);
+ }
+
+ .control-section {
+
+ &.open {
+ height: 100%;
+ }
+
+ &.control-section-radiate_section {
+
+ .accordion-section {
+ margin-left: -12px;
+ margin-right: -12px;
+ }
+
+ .accordion-section-title {
+ background-color: $color-white;
+ border-bottom: 1px solid $color-light-gray;
+ border-left: 4px solid $color-white;
+ color: $color-black;
+ transition: .15s color ease-in-out, .15s background-color ease-in-out, .15s border-color ease-in-out;
+ }
+
+ .accordion-section-title:after {
+ color: #a0a5aa;
+ }
+
+ .accordion-section-title:hover,
+ .accordion-section-title:focus {
+ background: #f3f3f5;
+ border-left-color: $color-blue;
+ color: $color-blue;
+ }
+
+ .accordion-section-title:hover:after {
+ color: $color-blue;
+ }
+ }
+ }
+}
+
+#customize-theme-controls{
+ .accordion-section-title{
+ border-color:$color-light-gray;
+ color: $color-black;
+ font-weight: 600;
+ &:hover,&:focus{
+ border-left-color: $color-blue;
+ color: $color-blue;
+ }
+ }
+}
+
+.radiate-hide {
+ display: none !important;
+}
+
+.customize-control-checkbox,
+.customize-control-radio{
+ padding-bottom: 5px;
+ padding-top: 5px;
+}
+
+#accordion-section-radiate_customize_upsell_section {
+
+ h3 {
+
+ &.accordion-section-title {
+ background-color: #289DCC !important;
+ border-left-color: #0073aa;
+ color: #fff !important;
+ padding: 0;
+
+ a {
+ color: #fff;
+ display: block;
+ padding: 12px 15px 15px;
+ text-decoration: none;
+
+ &:hover {
+ background-color: #1f91bf !important;
+ }
+ }
+
+ &:after {
+ color: #fff !important;
+ }
+ }
+
+ a {
+
+ &::after {
+ color: #fff;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/inc/customizer/core/class-radiate-customize-base-option.php b/inc/customizer/core/class-radiate-customize-base-option.php
new file mode 100644
index 0000000..511432d
--- /dev/null
+++ b/inc/customizer/core/class-radiate-customize-base-option.php
@@ -0,0 +1,79 @@
+';
+ $content .= wp_kses_post( $args['description'] );
+
+ // Links.
+ if ( $args['links'] ) {
+
+ $content .= '';
+ foreach ( $args['links'] as $index => $link ) {
+
+ if ( $link['attrs'] ) {
+
+ $content .= '- ';
+
+ // Attribute mapping.
+ $attributes = ' target="_blank" ';
+ foreach ( $link['attrs'] as $attr => $attr_value ) {
+ $attributes .= ' ' . $attr . '="' . esc_attr( $attr_value ) . '" ';
+ }
+
+ $content .= '' . esc_html( $link['text'] ) . '
';
+
+ $content .= '';
+
+ }
+
+ }
+
+ $content .= '
';
+
+ }
+
+ $content .= '';
+
+ return $content;
+ }
+
+}
+
+return new Radiate_Customize_Base_Option();
diff --git a/inc/customizer/core/class-radiate-customizer-callbacks.php b/inc/customizer/core/class-radiate-customizer-callbacks.php
new file mode 100644
index 0000000..4a702a9
--- /dev/null
+++ b/inc/customizer/core/class-radiate-customizer-callbacks.php
@@ -0,0 +1,24 @@
+register_panel_type( 'Radiate_WP_Customize_Panel' );
+ $wp_customize->register_section_type( 'Radiate_WP_Customize_Section' );
+ $wp_customize->register_section_type( 'Radiate_WP_Customize_Separator' );
+ $wp_customize->register_panel_type( 'Radiate_WP_Customize_Panel' );
+ $wp_customize->register_section_type( 'Radiate_Upsell_Section' );
+
+ /**
+ * Register controls.
+ */
+ /**
+ * WordPress default controls.
+ */
+ // Checkbox control.
+ Radiate_Customize_Base_Control::add_control(
+ 'checkbox',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_checkbox',
+ ),
+ )
+ );
+
+ // Radio control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radio',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Select control.
+ Radiate_Customize_Base_Control::add_control(
+ 'select',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Text control.
+ Radiate_Customize_Base_Control::add_control(
+ 'text',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_nohtml',
+ ),
+ )
+ );
+
+ // Number control.
+ Radiate_Customize_Base_Control::add_control(
+ 'number',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_number',
+ ),
+ )
+ );
+
+ // Email control.
+ Radiate_Customize_Base_Control::add_control(
+ 'email',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_email',
+ ),
+ )
+ );
+
+ // URL control.
+ Radiate_Customize_Base_Control::add_control(
+ 'url',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_url',
+ ),
+ )
+ );
+
+ // Textarea control.
+ Radiate_Customize_Base_Control::add_control(
+ 'textarea',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_html',
+ ),
+ )
+ );
+
+ // Dropdown pages control.
+ Radiate_Customize_Base_Control::add_control(
+ 'dropdown-pages',
+ array(
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_dropdown_pages',
+ ),
+ )
+ );
+
+ // Color control.
+ Radiate_Customize_Base_Control::add_control(
+ 'color',
+ array(
+ 'callback' => 'WP_Customize_Color_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_hex_color',
+ ),
+ )
+ );
+
+ // Image upload control.
+ Radiate_Customize_Base_Control::add_control(
+ 'image',
+ array(
+ 'callback' => 'WP_Customize_Image_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_image_upload',
+ ),
+ )
+ );
+
+ /**
+ * Controls created via the theme.
+ */
+ // Radio image control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-radio-image',
+ array(
+ 'callback' => 'Radiate_Radio_Image_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Heading control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-heading',
+ array(
+ 'callback' => 'Radiate_Heading_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Navigate control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-navigate',
+ array(
+ 'callback' => 'Radiate_Navigate_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Editor control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-editor',
+ array(
+ 'callback' => 'Radiate_Editor_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_html',
+ ),
+ )
+ );
+
+ // Color control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-color',
+ array(
+ 'callback' => 'Radiate_Color_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_alpha_color',
+ ),
+ )
+ );
+
+ // Buttonset control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-buttonset',
+ array(
+ 'callback' => 'Radiate_Buttonset_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_radio_select',
+ ),
+ )
+ );
+
+ // Toggle control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-toggle',
+ array(
+ 'callback' => 'Radiate_Toggle_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_checkbox',
+ ),
+ )
+ );
+
+ // Divider control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-divider',
+ array(
+ 'callback' => 'Radiate_Divider_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Slider control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-slider',
+ array(
+ 'callback' => 'Radiate_Slider_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_number',
+ ),
+ )
+ );
+
+ // Custom control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-custom',
+ array(
+ 'callback' => 'Radiate_Custom_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_false_values',
+ ),
+ )
+ );
+
+ // Dropdown categories control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-dropdown-categories',
+ array(
+ 'callback' => 'Radiate_Dropdown_Categories_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_dropdown_categories',
+ ),
+ )
+ );
+
+ // Background control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-background',
+ array(
+ 'callback' => 'Radiate_Background_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_background',
+ ),
+ )
+ );
+
+ // Typography control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-typography',
+ array(
+ 'callback' => 'Radiate_Typography_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_typography',
+ ),
+ )
+ );
+
+ // Hidden control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-hidden',
+ array(
+ 'callback' => 'Radiate_Hidden_Control',
+ 'sanitize_callback' => '',
+ )
+ );
+
+ // Sortable control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-sortable',
+ array(
+ 'callback' => 'Radiate_Sortable_Control',
+ 'sanitize_callback' => array(
+ 'Radiate_Customizer_FrameWork_Sanitizes',
+ 'sanitize_sortable',
+ ),
+ )
+ );
+
+ // Group control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-group',
+ array(
+ 'callback' => 'Radiate_Group_Control',
+ )
+ );
+
+ // Title control.
+ Radiate_Customize_Base_Control::add_control(
+ 'radiate-title',
+ array(
+ 'callback' => 'Radiate_Title_Control',
+ )
+ );
+
+ }
+
+ /**
+ * Include the required customize options.
+ *
+ * @param WP_Customize_Manager $wp_customize Theme Customizer object.
+ *
+ * @return array Customizer options for registering panels, sections as well as controls.
+ */
+ public function get_customizer_configurations( $wp_customize ) {
+
+ return apply_filters( 'radiate_customizer_options', array(), $wp_customize );
+
+ }
+
+ /**
+ * Return default values for the Customize Configurations.
+ *
+ * @return array
+ */
+ public function get_radiate_customizer_default_configuration() {
+
+ $default_configuration = array(
+ 'priority' => null,
+ 'title' => null,
+ 'label' => null,
+ 'name' => null,
+ 'type' => null,
+ 'description' => null,
+ 'capability' => 'edit_theme_options',
+ 'datastore_type' => 'theme_mod',
+ 'settings' => null,
+ 'active_callback' => null,
+ 'sanitize_callback' => null,
+ 'sanitize_js_callback' => null,
+ 'theme_supports' => null,
+ 'transport' => null,
+ 'default' => null,
+ 'selector' => null,
+ 'radiate_fields' => array(),
+ );
+
+ return apply_filters( 'radiate_customizer_default_configuration', $default_configuration );
+
+ }
+
+ /**
+ * Process and Register Customizer Panels, Sections, Settings and Controls.
+ *
+ * @param WP_Customize_Manager $wp_customize Reference to WP_Customize_Manager.
+ *
+ * @return void
+ */
+ public function register_customize_settings( $wp_customize ) {
+
+ $configurations = $this->get_customizer_configurations( $wp_customize );
+
+ foreach ( $configurations as $key => $config ) {
+ $config = wp_parse_args(
+ $config,
+ $this->get_radiate_customizer_default_configuration()
+ );
+
+ switch ( $config['type'] ) {
+
+ case 'panel':
+ // Remove `panel` type from configuration for registering it in different way.
+ unset( $config['type'] );
+
+ $this->register_panel( $config, $wp_customize );
+
+ break;
+
+ case 'section':
+ // Remove `section` type from configuration for registering it in different way.
+ unset( $config['type'] );
+
+ $this->register_section( $config, $wp_customize );
+
+ break;
+
+ case 'sub-control':
+ // Remove `sub-control` type from configuration for registering it in different way.
+ unset( $config['type'] );
+
+ $this->register_sub_control_setting( $config, $wp_customize );
+
+ break;
+
+ case 'control':
+ // Remove `control` type from configuration for registering it in different way.
+ unset( $config['type'] );
+
+ $this->register_setting_control( $config, $wp_customize );
+
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * Register Customizer Panel.
+ *
+ * @param array $config Customize options configuration settings.
+ * @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager.
+ *
+ * @return void
+ */
+ public function register_panel( $config, $wp_customize ) {
+
+ $wp_customize->add_panel(
+ new Radiate_WP_Customize_Panel(
+ $wp_customize,
+ $config['name'],
+ $config
+ )
+ );
+
+ }
+
+ /**
+ * Register Customizer Section.
+ *
+ * @param array $config Customize options configuration settings.
+ * @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager.
+ *
+ * @return void
+ */
+ public function register_section( $config, $wp_customize ) {
+
+ $section_callback = isset( $config['section_callback'] ) ? $config['section_callback'] : 'Radiate_WP_Customize_Section';
+
+ $wp_customize->add_section(
+ new $section_callback(
+ $wp_customize,
+ $config['name'],
+ $config
+ )
+ );
+
+ }
+
+ /**
+ * Register Customizer Sub Control.
+ *
+ * @param array $config Customize options configuration settings.
+ * @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager.
+ *
+ * @return void
+ */
+ public function register_sub_control_setting( $config, $wp_customize ) {
+
+ $sub_control_name = $config['name'];
+
+ if ( isset( $wp_customize->get_control( $sub_control_name )->id ) ) {
+ return;
+ }
+
+ $parent = $config['parent'];
+ $tab = ( isset( $config['tab'] ) ) ? $config['tab'] : '';
+
+ if ( empty( self::$group_configs[ $parent ] ) ) {
+ self::$group_configs[ $parent ] = array();
+ }
+
+ if ( array_key_exists( 'tab', $config ) ) {
+ self::$group_configs[ $parent ]['tabs'][ $tab ][] = $config;
+ } else {
+ self::$group_configs[ $parent ][] = $config;
+ }
+
+ // For adding settings.
+ $sanitize_callback = isset( $config['sanitize_callback'] ) ? $config['sanitize_callback'] : Radiate_Customize_Base_Control::get_sanitize_callback( $config['control'] );
+ $transport = isset( $config['transport'] ) ? $config['transport'] : 'refresh';
+ $customize_config = array(
+ 'name' => $sub_control_name,
+ 'datastore_type' => apply_filters( 'radiate_customize_datastore_type', 'theme_mod' ),
+ 'control' => 'radiate-hidden',
+ 'section' => $config['section'],
+ 'default' => $config['default'],
+ 'transport' => $transport,
+ 'sanitize_callback' => $sanitize_callback,
+ );
+
+ $wp_customize->add_setting(
+ $customize_config['name'],
+ array(
+ 'default' => $customize_config['default'],
+ 'type' => $customize_config['datastore_type'],
+ 'transport' => $customize_config['transport'],
+ 'sanitize_callback' => $customize_config['sanitize_callback'],
+ )
+ );
+
+ // For adding controls.
+ $control_type = Radiate_Customize_Base_Control::get_control_instance( $customize_config['control'] );
+
+ if ( false !== $control_type ) {
+ $wp_customize->add_control(
+ new $control_type(
+ $wp_customize,
+ $customize_config['name'],
+ $customize_config
+ )
+ );
+ } else {
+ $wp_customize->add_control(
+ $customize_config['name'],
+ $customize_config
+ );
+ }
+
+ }
+
+ /**
+ * Register Customizer Control.
+ *
+ * @param array $config Customize options configuration settings.
+ * @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager.
+ *
+ * @return void
+ */
+ public function register_setting_control( $config, $wp_customize ) {
+
+ // For adding settings.
+ $sanitize_callback = isset( $config['sanitize_callback'] ) ? $config['sanitize_callback'] : Radiate_Customize_Base_Control::get_sanitize_callback( $config['control'] );
+ $transport = isset( $config['transport'] ) ? $config['transport'] : 'refresh';
+
+ if ( 'radiate-group' === $config['control'] ) {
+ $sanitize_callback = false;
+ }
+
+ $wp_customize->add_setting(
+ $config['name'],
+ array(
+ 'default' => $config['default'],
+ 'type' => $config['datastore_type'],
+ 'transport' => $transport,
+ 'sanitize_callback' => $sanitize_callback,
+ )
+ );
+
+ // For adding controls.
+ $control_type = Radiate_Customize_Base_Control::get_control_instance( $config['control'] );
+ $config['type'] = $config['control'];
+
+ if ( false !== $control_type ) {
+ $wp_customize->add_control(
+ new $control_type(
+ $wp_customize,
+ $config['name'],
+ $config
+ )
+ );
+ } else {
+ $wp_customize->add_control(
+ $config['name'],
+ $config
+ );
+ }
+
+ // For adding selective refresh.
+ $selective_refresh = isset( $config['partial'] ) ? true : false;
+ $render_callback = isset( $config['partial']['render_callback'] ) ? $config['partial']['render_callback'] : '';
+
+ if ( $selective_refresh ) {
+
+ if ( isset( $wp_customize->selective_refresh ) ) {
+ $wp_customize->selective_refresh->add_partial(
+ $config['name'],
+ array(
+ 'selector' => $config['partial']['selector'],
+ 'render_callback' => $render_callback,
+ )
+ );
+ }
+ }
+
+ // For dependency array.
+ if ( isset( $config['dependency'] ) ) {
+ $this->update_dependency_array( $config['name'], $config['dependency'] );
+ }
+
+ }
+
+ /**
+ * Update dependency in the dependency array for controls and sections.
+ *
+ * @param string $key Name of the Setting/Control for which the dependency is added.
+ * @param array $dependency Dependency of the $name Setting/Control.
+ *
+ * @return void
+ */
+ private function update_dependency_array( $key, $dependency ) {
+ self::$dependency_array[ $key ] = $dependency;
+ }
+
+ /**
+ * Get dependency array.
+ *
+ * @return array Dependencies discovered when registering controls and settings.
+ */
+ private function get_dependency_array() {
+ return self::$dependency_array;
+ }
+
+ /**
+ * Include the required customizer sanitization, callbacks and partials file.
+ */
+ public function customize_sanitize_callback_include() {
+
+ require dirname(__FILE__) . '/class-radiate-customizer-sanitizes.php';
+ require dirname(__FILE__) . '/class-radiate-customizer-callbacks.php';
+
+ }
+
+ /**
+ * Enqueue custom scripts for customize panels, sections and controls.
+ */
+ public function enqueue_customize_controls() {
+
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
+
+ /**
+ * Enqueue required Customize Controls CSS files.
+ */
+ // Extend customizer CSS file.
+ wp_enqueue_style(
+ 'radiate-extend-customizer',
+ $this->get_assets_url() . '/assets/css/extend-customizer' . $suffix . '.css',
+ array(),
+ RADIATE_THEME_VERSION
+ );
+ wp_style_add_data( 'radiate-extend-customizer', 'rtl', 'replace' );
+
+ /**
+ * Enqueue required Customize Controls JS files.
+ */
+ // Extend customizer JS file.
+ wp_enqueue_script(
+ 'radiate-extend-customizer',
+ $this->get_assets_url() . '/assets/js/extend-customizer' . $suffix . '.js',
+ array(
+ 'jquery',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // Customizer controls toggle JS file.
+ wp_enqueue_script(
+ 'radiate-customizer-controls-toggle',
+ $this->get_assets_url() . '/assets/js/customizer-controls-toggle' . $suffix . '.js',
+ array(),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // Customizer controls JS file.
+ wp_enqueue_script(
+ 'radiate-customizer-controls',
+ $this->get_assets_url() . '/assets/js/customizer-controls' . $suffix . '.js',
+ array(
+ 'radiate-customizer-controls-toggle',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // Customizer dependency control JS file.
+ wp_enqueue_script(
+ 'radiate-customizer-dependency',
+ $this->get_assets_url() . '/assets/js/customizer-dependency' . $suffix . '.js',
+ array(
+ 'radiate-customizer-controls-toggle',
+ 'radiate-customizer-controls',
+ 'radiate-extend-customizer',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // Localize for customizer controls toggle.
+ wp_localize_script(
+ 'radiate-customizer-controls-toggle',
+ 'RadiateCustomizerControlsToggle',
+ $this->get_dependency_array()
+ );
+
+ }
+
+ /**
+ * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
+ *
+ * @since Radiate 3.0.0
+ */
+ public function customize_preview_js() {
+
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
+
+ wp_enqueue_script(
+ 'radiate-customizer',
+ $this->get_assets_url() . '/assets/js/customize-preview' . $suffix . '.js',
+ array(
+ 'customize-preview',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ }
+
+ public function get_assets_url() {
+ // Get correct URL and path to wp-content.
+ $content_url = untrailingslashit( dirname( dirname( get_stylesheet_directory_uri() ) ) );
+ $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
+
+ $url = str_replace( $content_dir, $content_url, wp_normalize_path( __DIR__ ) );
+ $url = set_url_scheme( $url );
+
+ return $url;
+ }
+
+}
+
+return new Radiate_Customizer_FrameWork();
diff --git a/inc/customizer/core/class-radiate-customizer-sanitizes.php b/inc/customizer/core/class-radiate-customizer-sanitizes.php
new file mode 100644
index 0000000..98fed23
--- /dev/null
+++ b/inc/customizer/core/class-radiate-customizer-sanitizes.php
@@ -0,0 +1,577 @@
+default );
+
+ }
+
+ /**
+ * Sanitize the strings enabling HTML tags set within customizer controls.
+ *
+ * @param string $input Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_html( $input ) {
+
+ return wp_kses_post( $input );
+
+ }
+
+ /**
+ * Sanitize the strings disabling the HTML tags set within customizer controls.
+ *
+ * @param string $input Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_nohtml( $input ) {
+
+ return wp_filter_nohtml_kses( $input );
+
+ }
+
+ /**
+ * Sanitize the key values set within customizer controls.
+ *
+ * @param string $input Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_key( $input ) {
+
+ return sanitize_key( $input );
+
+ }
+
+ /**
+ * Sanitize the text fields set within customizer controls.
+ *
+ * @param string $input Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_text_field( $input ) {
+
+ return sanitize_text_field( $input );
+
+ }
+
+ /**
+ * Sanitize the radio as well as select options set within customizer controls.
+ *
+ * @param string $input Input from the customize controls.
+ * @param WP_Customize_Setting $setting Setting instance.
+ *
+ * @return string
+ */
+ public static function sanitize_radio_select( $input, $setting ) {
+
+ // Ensuring that the input is a slug.
+ $input = sanitize_text_field( $input );
+
+ // Get the list of choices from the control associated with the setting.
+ $choices = $setting->manager->get_control( $setting->id )->choices;
+
+ // If the input is a valid key, return it, else, return the default.
+ return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
+
+ }
+
+ /**
+ * Sanitize the hex color set within customizer controls.
+ *
+ * @param string $color Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_hex_color( $color ) {
+
+ if ( '' === $color ) {
+ return '';
+ }
+
+ // 3 or 6 hex digits, or the empty string.
+ if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
+ return $color;
+ }
+
+ }
+
+ /**
+ * Sanitize the alpha color set within customizer controls.
+ *
+ * @param string $color Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_alpha_color( $color ) {
+
+ if ( '' === $color ) {
+ return '';
+ }
+
+ // Hex sanitize if no rgba color option is chosen.
+ if ( false === strpos( $color, 'rgba' ) ) {
+ return self::sanitize_hex_color( $color );
+ }
+
+ // Sanitize the rgba color provided via customize option.
+ $color = str_replace( ' ', '', $color );
+ sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
+
+ return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
+
+ }
+
+ /**
+ * Sanitize false values within customizer controls, which user does not have to input by their own.
+ *
+ * @return bool
+ */
+ public static function sanitize_false_values() {
+
+ return false;
+
+ }
+
+ /**
+ * Sanitize the slider value set within customizer controls.
+ *
+ * @param number $val Customizer setting input number.
+ * @param object $setting Setting object.
+ *
+ * @return int
+ */
+ public static function sanitize_number( $val, $setting ) {
+
+ $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs;
+
+ if ( isset( $input_attrs ) ) {
+
+ $input_attrs['min'] = isset( $input_attrs['min'] ) ? $input_attrs['min'] : 0;
+ $input_attrs['step'] = isset( $input_attrs['step'] ) ? $input_attrs['step'] : 1;
+
+ if ( isset( $input_attrs['max'] ) && $val > $input_attrs['max'] ) {
+ $val = $input_attrs['max'];
+ } elseif ( $val < $input_attrs['min'] ) {
+ $val = $input_attrs['min'];
+ }
+
+ if ( $val ) {
+ $val = (int) $val;
+ }
+ }
+
+ return is_numeric( $val ) ? $val : $setting->default;
+
+ }
+
+ /**
+ * Sanitize the email value set within customizer controls.
+ *
+ * @param string $email Input from the customize controls.
+ * @param object $setting Setting object.
+ *
+ * @return string
+ */
+ public static function sanitize_email( $email, $setting ) {
+
+ // Strips out all characters that are not allowable in an email address.
+ $email = sanitize_email( $email );
+
+ // If $email is a valid email, return it, otherwise, return the default.
+ return ( ! is_null( $email ) ? $email : $setting->default );
+
+ }
+
+ /**
+ * Sanitize the url value set within customizer controls.
+ *
+ * @param string $url Input from the customize controls.
+ *
+ * @return string
+ */
+ public static function sanitize_url( $url ) {
+
+ return esc_url_raw( $url );
+
+ }
+
+ /**
+ * Sanitize the dropdown categories value set within customizer controls.
+ *
+ * @param number $cat_id Customizer setting input category id.
+ * @param object $setting Setting object.
+ *
+ * @return int
+ */
+ public static function sanitize_dropdown_categories( $cat_id, $setting ) {
+
+ // Ensure input is an absolute integer.
+ $cat_id = absint( $cat_id );
+
+ // If $cat_id is an ID of a published category, return it, otherwise, return the default value.
+ return ( term_exists( $cat_id, 'category' ) ? $cat_id : $setting->default );
+
+ }
+
+ /**
+ * Sanitize the dropdown pages value set within customizer controls.
+ *
+ * @param number $page_id Customizer setting input page id.
+ * @param object $setting Setting object.
+ *
+ * @return int
+ */
+ public static function sanitize_dropdown_pages( $page_id, $setting ) {
+
+ // Ensure input is an absolute integer.
+ $page_id = absint( $page_id );
+
+ // If $page_id is an ID of a published page, return it, otherwise, return the default value.
+ return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default );
+
+ }
+
+ /**
+ * Sanitize the image value set within customizer controls.
+ *
+ * @param number $image Customizer setting input image filename.
+ * @param object $setting Setting object.
+ *
+ * @return int
+ */
+ public static function sanitize_image_upload( $image, $setting ) {
+
+ /**
+ * Array of valid image file types.
+ *
+ * The array includes image mime types that are included in wp_get_mime_types()
+ */
+ $mimes = array(
+ 'jpg|jpeg|jpe' => 'image/jpeg',
+ 'gif' => 'image/gif',
+ 'png' => 'image/png',
+ 'bmp' => 'image/bmp',
+ 'tiff|tif' => 'image/tiff',
+ 'ico' => 'image/x-icon',
+ );
+
+ // Return an array with file extension and mime_type.
+ $file = wp_check_filetype( $image, $mimes );
+
+ // If $image has a valid mime_type, return it, otherwise, return the empty value.
+ return ( $file['ext'] ? $image : '' );
+
+ }
+
+ /**
+ * Sanitize the background value set within customizer controls.
+ *
+ * @param number $background_args Customizer setting input background arguments.
+ * @param object $setting Setting object.
+ *
+ * @return mixed
+ */
+ public static function sanitize_background( $background_args, $setting ) {
+
+ if ( ! is_array( $background_args ) ) {
+ return array();
+ }
+
+ $output = array();
+
+ // Sanitizing the alpha color option.
+ if ( isset( $background_args['background-color'] ) ) {
+ $output['background-color'] = self::sanitize_alpha_color( $background_args['background-color'] );
+ }
+
+ // Sanitizing the background image option.
+ if ( isset( $background_args['background-image'] ) ) {
+ $output['background-image'] = self::sanitize_image_upload( $background_args['background-image'], $setting );
+ }
+
+ // Sanitizing the background repeat option.
+ if ( isset( $background_args['background-repeat'] ) ) {
+ $output['background-repeat'] = self::sanitize_text_field( $background_args['background-repeat'] );
+ }
+
+ // Sanitizing the background position option.
+ if ( isset( $background_args['background-position'] ) ) {
+ $output['background-position'] = self::sanitize_text_field( $background_args['background-position'] );
+ }
+
+ // Sanitizing the background size option.
+ if ( isset( $background_args['background-size'] ) ) {
+ $output['background-size'] = self::sanitize_text_field( $background_args['background-size'] );
+ }
+
+ // Sanitizing the background attachment option.
+ if ( isset( $background_args['background-attachment'] ) ) {
+ $output['background-attachment'] = self::sanitize_text_field( $background_args['background-attachment'] );
+ }
+
+ return $output;
+
+ }
+
+ /**
+ * Sanitize the typography value set within customizer controls.
+ *
+ * @param number $typography_args Customizer setting input typography arguments.
+ * @param object $setting Setting object.
+ *
+ * @return mixed
+ */
+ public static function sanitize_typography( $typography_args, $setting ) {
+
+ if ( ! is_array( $typography_args ) ) {
+ return array();
+ }
+
+ $output = array();
+
+ // Sanitizing the font family option.
+ if ( isset( $typography_args['font-family'] ) ) {
+
+ $standard_fonts = Radiate_Fonts::get_system_fonts();
+ $google_fonts = Radiate_Fonts::get_google_fonts();
+ $custom_fonts = Radiate_Fonts::get_custom_fonts();
+ $valid_keys = array_merge( $standard_fonts, $google_fonts );
+
+ // If custom fonts is available, merge it to `$valid_keys` array to make those fonts ready for sanitization.
+ if ( ! empty( $custom_fonts ) ) {
+ $valid_keys = array_merge( $custom_fonts, $valid_keys );
+ }
+
+ if ( array_key_exists( $typography_args['font-family'], $valid_keys ) ) {
+ $output['font-family'] = self::sanitize_text_field( $typography_args['font-family'] );
+ }
+ }
+
+ // Sanitizing the font weight option.
+ if ( isset( $typography_args['font-weight'] ) ) {
+
+ $font_variants = Radiate_Fonts::get_font_variants();
+
+ if ( array_key_exists( $typography_args['font-weight'], $font_variants ) ) {
+ $output['font-weight'] = self::sanitize_key( $typography_args['font-weight'] );
+ }
+ }
+
+ // Sanitizing the subsets option.
+ if ( isset( $typography_args['subsets'] ) ) {
+
+ $subsets = Radiate_Fonts::get_google_font_subsets();
+ $subsets_values = array();
+
+ if ( is_array( $typography_args['subsets'] ) ) {
+
+ foreach ( $typography_args['subsets'] as $key => $value ) {
+
+ if ( array_key_exists( $value, $subsets ) ) {
+ $subsets_values[] = self::sanitize_key( $value );
+ }
+ }
+
+ $output['subsets'] = $subsets_values;
+ }
+ }
+
+ // Sanitizing the font style option.
+ if ( isset( $typography_args['font-style'] ) ) {
+ $output['font-style'] = self::sanitize_key( $typography_args['font-style'] );
+ }
+
+ // Sanitizing the text transform option.
+ if ( isset( $typography_args['text-transform'] ) ) {
+ $output['text-transform'] = self::sanitize_key( $typography_args['text-transform'] );
+ }
+
+ // Sanitizing the text decoration option.
+ if ( isset( $typography_args['text-decoration'] ) ) {
+ $output['text-decoration'] = self::sanitize_key( $typography_args['text-decoration'] );
+ }
+
+ // Sanitizing the font size option.
+ if ( isset( $typography_args['font-size'] ) && is_array( $typography_args['font-size'] ) ) {
+
+ $font_size_values = array();
+
+ $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs;
+
+ foreach ( $typography_args['font-size'] as $key => $value ) {
+
+ if ( isset( $key ) && ! empty( $value ) ) {
+
+ if ( isset( $input_attrs ) && ! empty( $input_attrs ) ) {
+
+ foreach ( $input_attrs as $input_key => $input_value ) {
+
+ $input_value['font-size']['min'] = isset( $input_value['font-size']['min'] ) ? $input_value['font-size']['min'] : 0;
+ $input_value['font-size']['step'] = isset( $input_value['font-size']['step'] ) ? $input_value['font-size']['step'] : 1;
+
+ if ( isset( $input_value['font-size']['max'] ) && $value > $input_value['font-size']['max'] ) {
+ $font_size_values[ $key ] = self::sanitize_text_field( $input_value['font-size']['max'] );
+ } elseif ( $value < $input_value['font-size']['min'] ) {
+ $font_size_values[ $key ] = self::sanitize_text_field( $input_value['font-size']['min'] );
+ } else {
+ $font_size_values[ $key ] = self::sanitize_text_field( $value );
+ }
+ }
+ } else {
+ $font_size_values[ $key ] = self::sanitize_text_field( $value );
+ }
+ }
+
+ $output['font-size'] = $font_size_values;
+
+ }
+ }
+
+ // Sanitizing the line height option.
+ if ( isset( $typography_args['line-height'] ) && is_array( $typography_args['line-height'] ) ) {
+
+ $line_height_values = array();
+
+ $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs;
+
+ foreach ( $typography_args['line-height'] as $key => $value ) {
+
+ if ( isset( $key ) && ! empty( $value ) ) {
+
+ if ( isset( $input_attrs ) && ! empty( $input_attrs ) ) {
+
+ foreach ( $input_attrs as $input_key => $input_value ) {
+
+ $input_value['line-height']['min'] = isset( $input_value['line-height']['min'] ) ? $input_value['line-height']['min'] : 0;
+ $input_value['line-height']['step'] = isset( $input_value['line-height']['step'] ) ? $input_value['line-height']['step'] : 1;
+
+ if ( isset( $input_value['line-height']['max'] ) && $value > $input_value['line-height']['max'] ) {
+ $line_height_values[ $key ] = self::sanitize_text_field( $input_value['line-height']['max'] );
+ } elseif ( $value < $input_value['line-height']['min'] ) {
+ $line_height_values[ $key ] = self::sanitize_text_field( $input_value['line-height']['min'] );
+ } else {
+ $line_height_values[ $key ] = self::sanitize_text_field( $value );
+ }
+ }
+ } else {
+ $line_height_values[ $key ] = self::sanitize_text_field( $value );
+ }
+ }
+
+ $output['line-height'] = $line_height_values;
+
+ }
+ }
+
+ // Sanitizing the letter spacing option.
+ if ( isset( $typography_args['letter-spacing'] ) && is_array( $typography_args['letter-spacing'] ) ) {
+
+ $letter_spacing_values = array();
+
+ $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs;
+
+ foreach ( $typography_args['letter-spacing'] as $key => $value ) {
+
+ if ( isset( $key ) && ! empty( $value ) ) {
+
+ if ( isset( $input_attrs ) && ! empty( $input_attrs ) ) {
+
+ foreach ( $input_attrs as $input_key => $input_value ) {
+
+ $input_value['letter-spacing']['min'] = isset( $input_value['letter-spacing']['min'] ) ? $input_value['letter-spacing']['min'] : 0;
+ $input_value['letter-spacing']['step'] = isset( $input_value['letter-spacing']['step'] ) ? $input_value['letter-spacing']['step'] : 1;
+
+ if ( isset( $input_value['letter-spacing']['max'] ) && $value > $input_value['letter-spacing']['max'] ) {
+ $letter_spacing_values[ $key ] = self::sanitize_text_field( $input_value['letter-spacing']['max'] );
+ } elseif ( $value < $input_value['letter-spacing']['min'] ) {
+ $letter_spacing_values[ $key ] = self::sanitize_text_field( $input_value['letter-spacing']['min'] );
+ } else {
+ $letter_spacing_values[ $key ] = self::sanitize_text_field( $value );
+ }
+ }
+ } else {
+ $letter_spacing_values[ $key ] = sanitize_text_field( $value );
+ }
+ }
+
+ $output['letter-spacing'] = $letter_spacing_values;
+
+ }
+ }
+
+ return $output;
+
+ }
+
+ /**
+ * Sanitize the sortable value set within customizer controls.
+ *
+ * @param number $input Customizer setting input sortable arguments.
+ * @param object $setting Setting object.
+ *
+ * @return mixed
+ */
+ public static function sanitize_sortable( $input, $setting ) {
+
+ // Get list of choices from the control associated with the setting.
+ $choices = $setting->manager->get_control( $setting->id )->choices;
+ $input_keys = $input;
+
+ foreach ( $input_keys as $key => $value ) {
+ if ( ! array_key_exists( $value, $choices ) ) {
+ unset( $input[ $key ] );
+ }
+ }
+
+ // If the input is a valid key, return it, otherwise, return the default.
+ return ( is_array( $input ) ? $input : $setting->default );
+
+ }
+
+}
diff --git a/inc/customizer/core/class-radiate-fonts.php b/inc/customizer/core/class-radiate-fonts.php
new file mode 100644
index 0000000..9f41186
--- /dev/null
+++ b/inc/customizer/core/class-radiate-fonts.php
@@ -0,0 +1,237 @@
+ array(
+ 'family' => 'default',
+ 'label' => 'Default',
+ ),
+ 'Georgia,Times,"Times New Roman",serif' => array(
+ 'family' => 'Georgia,Times,"Times New Roman",serif',
+ 'label' => 'serif',
+ ),
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif' => array(
+ 'family' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif',
+ 'label' => 'sans-serif',
+ ),
+ 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace' => array(
+ 'family' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace',
+ 'label' => 'monospace',
+ ),
+
+ );
+
+ endif;
+
+ return apply_filters( 'radiate_system_fonts', self::$system_fonts );
+
+ }
+
+ /**
+ * Get Google fonts.
+ * It's array is generated from the google-fonts.json file.
+ *
+ * @return mixed|void
+ */
+ public static function get_google_fonts() {
+
+ if ( empty( self::$google_fonts ) ) :
+
+ global $wp_filesystem;
+ $google_fonts_file = apply_filters( 'radiate_google_fonts_json_file', dirname(__FILE__) . '/custom-controls/typography/google-fonts.json' );
+
+ if ( ! file_exists( dirname(__FILE__) . '/custom-controls/typography/google-fonts.json' ) ) {
+ return array();
+ }
+
+ // Require `file.php` file of WordPress to include filesystem check for getting the file contents.
+ if ( ! $wp_filesystem ) {
+ require_once ABSPATH . '/wp-admin/includes/file.php';
+ }
+
+ // Proceed only if the file is readable.
+ if ( is_readable( $google_fonts_file ) ) {
+ WP_Filesystem();
+
+ $file_contents = $wp_filesystem->get_contents( $google_fonts_file );
+ $google_fonts_json = json_decode( $file_contents, 1 );
+
+ foreach ( $google_fonts_json['items'] as $key => $font ) {
+
+ $google_fonts[ $font['family'] ] = array(
+ 'family' => $font['family'],
+ 'label' => $font['family'],
+ 'variants' => $font['variants'],
+ 'subsets' => $font['subsets'],
+ );
+
+ self::$google_fonts = $google_fonts;
+
+ }
+ }
+
+ endif;
+
+ return apply_filters( 'radiate_system_fonts', self::$google_fonts );
+
+ }
+
+ /**
+ * Get custom fonts.
+ *
+ * @return mixed|void
+ */
+ public static function get_custom_fonts() {
+
+ return apply_filters( 'radiate_custom_fonts', self::$custom_fonts );
+
+ }
+
+ /**
+ * Get font variants.
+ *
+ * @return mixed|void
+ */
+ public static function get_font_variants() {
+
+ if ( empty( self::$font_variants ) ) :
+
+ self::$font_variants = array(
+ '100' => esc_html__( 'Thin 100', 'radiate' ),
+ '100italic' => esc_html__( 'Thin 100 Italic', 'radiate' ),
+ '200' => esc_html__( 'Extra-Light 200', 'radiate' ),
+ '200italic' => esc_html__( 'Extra-Light 200 Italic', 'radiate' ),
+ '300' => esc_html__( 'Light 300', 'radiate' ),
+ '300italic' => esc_html__( 'Light 300 Italic', 'radiate' ),
+ 'regular' => esc_html__( 'Regular 400', 'radiate' ),
+ 'italic' => esc_html__( 'Regular 400 Italic', 'radiate' ),
+ '500' => esc_html__( 'Medium 500', 'radiate' ),
+ '500italic' => esc_html__( 'Medium 500 Italic', 'radiate' ),
+ '600' => esc_html__( 'Semi-Bold 600', 'radiate' ),
+ '600italic' => esc_html__( 'Semi-Bold 600 Italic', 'radiate' ),
+ '700' => esc_html__( 'Bold 700', 'radiate' ),
+ '700italic' => esc_html__( 'Bold 700 Italic', 'radiate' ),
+ '800' => esc_html__( 'Extra-Bold 800', 'radiate' ),
+ '800italic' => esc_html__( 'Extra-Bold 800 Italic', 'radiate' ),
+ '900' => esc_html__( 'Black 900', 'radiate' ),
+ '900italic' => esc_html__( 'Black 900 Italic', 'radiate' ),
+ );
+
+ endif;
+
+ return apply_filters( 'radiate_font_variants', self::$font_variants );
+
+ }
+
+ /**
+ * Get Google font subsets.
+ *
+ * @return mixed|void
+ */
+ public static function get_google_font_subsets() {
+
+ if ( empty( self::$google_font_subsets ) ) :
+
+ self::$google_font_subsets = array(
+ 'arabic' => esc_html__( 'Arabic', 'radiate' ),
+ 'bengali' => esc_html__( 'Bengali', 'radiate' ),
+ 'chinese-hongkong' => esc_html__( 'Chinese (Hong Kong)', 'radiate' ),
+ 'chinese-simplified' => esc_html__( 'Chinese (Simplified)', 'radiate' ),
+ 'chinese-traditional' => esc_html__( 'Chinese (Traditional)', 'radiate' ),
+ 'cyrillic' => esc_html__( 'Cyrillic', 'radiate' ),
+ 'cyrillic-ext' => esc_html__( 'Cyrillic Extended', 'radiate' ),
+ 'devanagari' => esc_html__( 'Devanagari', 'radiate' ),
+ 'greek' => esc_html__( 'Greek', 'radiate' ),
+ 'greek-ext' => esc_html__( 'Greek Extended', 'radiate' ),
+ 'gujarati' => esc_html__( 'Gujarati', 'radiate' ),
+ 'gurmukhi' => esc_html__( 'Gurmukhi', 'radiate' ),
+ 'hebrew' => esc_html__( 'Hebrew', 'radiate' ),
+ 'japanese' => esc_html__( 'Japanese', 'radiate' ),
+ 'kannada' => esc_html__( 'Kannada', 'radiate' ),
+ 'khmer' => esc_html__( 'Khmer', 'radiate' ),
+ 'korean' => esc_html__( 'Korean', 'radiate' ),
+ 'latin' => esc_html__( 'Latin', 'radiate' ),
+ 'latin-ext' => esc_html__( 'Latin Extended', 'radiate' ),
+ 'malayalam' => esc_html__( 'Malayalam', 'radiate' ),
+ 'myanmar' => esc_html__( 'Myanmar', 'radiate' ),
+ 'oriya' => esc_html__( 'Oriya', 'radiate' ),
+ 'sinhala' => esc_html__( 'Sinhala', 'radiate' ),
+ 'tamil' => esc_html__( 'Tamil', 'radiate' ),
+ 'telugu' => esc_html__( 'Telugu', 'radiate' ),
+ 'thai' => esc_html__( 'Thai', 'radiate' ),
+ 'tibetan' => esc_html__( 'Tibetan', 'radiate' ),
+ 'vietnamese' => esc_html__( 'Vietnamese', 'radiate' ),
+ );
+
+ endif;
+
+ return apply_filters( 'radiate_font_variants', self::$google_font_subsets );
+
+ }
+
+}
diff --git a/inc/customizer/core/class-radiate-generate-fonts.php b/inc/customizer/core/class-radiate-generate-fonts.php
new file mode 100644
index 0000000..447c898
--- /dev/null
+++ b/inc/customizer/core/class-radiate-generate-fonts.php
@@ -0,0 +1,164 @@
+ (array) $font_weight,
+ );
+ }
+
+ }
+
+ /**
+ * Get Fonts
+ */
+ public static function get_fonts() {
+
+ do_action( 'radiate_get_fonts' );
+
+ return apply_filters( 'radiate_add_fonts', self::$fonts );
+
+ }
+
+ /**
+ * Renders the tag for all fonts in the $fonts array.
+ *
+ * @return void
+ */
+ public static function render_fonts() {
+
+ $font_list = apply_filters( 'radiate_render_fonts', self::get_fonts() );
+
+ $google_fonts = array();
+ $font_subset = array();
+
+ $system_fonts = Radiate_Fonts::get_system_fonts();
+
+ foreach ( $font_list as $name => $font ) {
+ if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) {
+
+ // Add font variants.
+ $google_fonts[ $name ] = $font['font-weight'];
+
+ // Add Subset.
+ $subset = apply_filters( 'radiate_font_subset', '', $name );
+ if ( ! empty( $subset ) ) {
+ $font_subset = array_unique( $subset );
+ }
+ }
+ }
+
+ $google_font_url = self::google_fonts_url( $google_fonts, $font_subset );
+ wp_enqueue_style( 'radiate_googlefonts', $google_font_url, array(), RADIATE_THEME_VERSION, 'all' );
+
+ }
+
+ /**
+ * Google Font URL.
+ * Combine multiple google font in one URL.
+ *
+ * @param array $fonts Google Fonts array.
+ * @param array $subsets Font's Subsets array.
+ *
+ * @return string
+ */
+ public static function google_fonts_url( $fonts, $subsets = array() ) {
+
+ $base_url = '//fonts.googleapis.com/css';
+ $font_args = array();
+ $family = array();
+
+ $fonts = apply_filters( 'radiate_google_fonts_selected', $fonts );
+
+ /* Format Each Font Family in Array */
+ foreach ( $fonts as $font_name => $font_weight ) {
+ $font_name = str_replace( ' ', '+', $font_name );
+
+ if ( ! empty( $font_weight ) ) {
+ if ( is_array( $font_weight ) ) {
+ $font_weight = implode( ',', $font_weight );
+ }
+
+ $font_family = explode( ',', $font_name );
+ $font_family = str_replace( "'", '', $font_family[0] );
+ $family[] = trim( $font_family . ':' . rawurlencode( trim( $font_weight ) ) );
+ } else {
+ $family[] = trim( $font_name );
+ }
+ }
+
+ /* Only return URL if font family defined. */
+ if ( ! empty( $family ) ) {
+
+ /* Make Font Family a String */
+ $family = implode( '|', $family );
+
+ /* Add font family in args */
+ $font_args['family'] = $family;
+
+ /* Add font subsets in args */
+ if ( ! empty( $subsets ) ) {
+
+ /* format subsets to string */
+ if ( is_array( $subsets ) ) {
+ $subsets = implode( ',', $subsets );
+ }
+
+ $font_args['subset'] = rawurlencode( trim( $subsets ) );
+ }
+
+ return add_query_arg( $font_args, $base_url );
+ }
+
+ return '';
+ }
+
+}
diff --git a/inc/customizer/core/custom-controls/assets/css/customize-controls-rtl.css b/inc/customizer/core/custom-controls/assets/css/customize-controls-rtl.css
new file mode 100644
index 0000000..1c12ed4
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/customize-controls-rtl.css
@@ -0,0 +1,789 @@
+/**
+ * Background control CSS.
+ */
+.customize-control-radiate-background .customize-control-content > div {
+ margin-bottom: 15px;
+}
+
+/**
+ * Radio buttonset control CSS.
+ */
+.customize-control-radiate-buttonset .buttonset {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner {
+ -webkit-box-flex: 1;
+ -ms-flex: 1;
+ flex: 1;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner + .buttonset-inner {
+ border-right: 0;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset {
+ background: #ebebeb;
+ -webkit-box-shadow: inset 0 0 0 1px rgba(68, 68, 68, 0.1);
+ box-shadow: inset 0 0 0 1px rgba(68, 68, 68, 0.1);
+ color: #444444;
+ display: block;
+ padding: 5px 12px;
+ text-align: center;
+ -webkit-transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset:hover {
+ background: #ffffff;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input {
+ display: none;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked + label {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked + label:hover {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control .actions {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control .actions .button {
+ min-height: 34px;
+ width: calc(50% - 8px);
+}
+
+.customize-control .actions .button:last-of-type {
+ margin-left: 0px;
+}
+
+.customize-control-header button.random {
+ min-height: 34px;
+}
+
+input[type=checkbox]:checked {
+ border-radius: 2px;
+ -webkit-box-shadow: 0 0 0 1px #0073aa;
+ box-shadow: 0 0 0 1px #0073aa;
+}
+
+input[type=radio]:checked {
+ -webkit-box-shadow: 0 0 0 1px #0073aa;
+ box-shadow: 0 0 0 1px #0073aa;
+}
+
+input[type=range]:focus {
+ outline: none;
+}
+
+/**
+ * Alpha color control CSS.
+ */
+.customize-control-radiate-color .customizer-wrapper {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-orient: vertical;
+ -webkit-box-direction: normal;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-color .customizer-wrapper .customize-control-title {
+ display: block;
+ margin: 0 0 8px 0;
+}
+
+.wp-picker-container .wp-color-result.button {
+ background-color: #ebebeb !important;
+ background-image: none !important;
+ min-height: 34px;
+ border: 1px solid #ebebeb;
+}
+
+.wp-picker-container .wp-color-result.button::after {
+ border: 1px solid #ebebeb;
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==) !important;
+ border-radius: 100%;
+ content: "";
+ height: 22px;
+ right: 5px;
+ position: absolute;
+ top: 5px;
+ width: 22px;
+ z-index: 0;
+}
+
+.wp-picker-container .wp-color-result.button .wp-color-result-text {
+ background: none;
+ border: none;
+ line-height: 2.15384615;
+ padding: 0 6px 0 10px;
+}
+
+.wp-picker-container .wp-color-result.button .color-alpha {
+ border: 1px solid #ebebeb;
+ border-radius: 100% !important;
+ height: 22px !important;
+ right: 4px !important;
+ top: 4px !important;
+ width: 22px !important;
+ z-index: 1;
+}
+
+.wp-picker-container .wp-picker-input-wrap .wp-picker-default {
+ min-height: 34px !important;
+}
+
+.wp-picker-container .wp-picker-holder {
+ -webkit-box-shadow: 0 0px 20px 0px rgba(68, 68, 68, 0.3);
+ box-shadow: 0 0px 20px 0px rgba(68, 68, 68, 0.3);
+}
+
+.wp-picker-container .iris-picker {
+ border-color: #ebebeb;
+ margin-bottom: 5px;
+}
+
+.wp-picker-container .iris-picker .iris-alpha-slider {
+ margin-left: -1px;
+}
+
+.customize-control-radiate-divider {
+ padding: 0 !important;
+}
+
+/**
+ * Custom control CSS.
+ */
+.customize-control-radiate-custom .radiate-custom-info {
+ margin-bottom: 15px;
+}
+
+.customize-control-radiate-custom .radiate-custom-links li a {
+ background: #0073aa;
+ display: block;
+ text-align: center;
+ color: #ffffff;
+ padding: 8px 16px;
+ text-decoration: none;
+}
+
+/**
+ * Divider control CSS.
+ */
+.customize-control-radiate-divider hr {
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+
+.customize-control-radiate-divider .divider-placement-above + .radiate-control-tooltip {
+ top: 30px;
+}
+
+/**
+ * Editor control CSS.
+ */
+.customize-control-radiate-editor .wp-editor-tools .wp-editor-container textarea {
+ width: 100%;
+}
+
+/**
+ * Group control CSS.
+ */
+.customize-control-radiate-group .radiate-group-wrap > .customizer-text {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon {
+ background: #ebebeb;
+ border-radius: 100px;
+ color: rgba(68, 68, 68, 0.6);
+ cursor: pointer;
+ font-size: 20px;
+ padding: 5px;
+ position: relative;
+ left: 0;
+ top: 0px;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon:before {
+ content: "\f464";
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.open {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.open:before {
+ content: "\f158";
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.toggle-description {
+ left: 25px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal {
+ background-color: #ffffff;
+ border-radius: 5px;
+ -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
+ right: 0;
+ position: absolute;
+ left: 0;
+ z-index: 9999;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal:before {
+ border: 8px solid transparent;
+ border-bottom-color: #ffffff;
+ content: "";
+ pointer-events: none;
+ position: absolute;
+ left: 17px;
+ top: -15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-field-settings-wrap {
+ width: 100%;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-tabs,
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-tab-content {
+ position: relative;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ overflow: hidden;
+ padding: 15px 15px 0 15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:before, .customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:after {
+ border-collapse: collapse;
+ content: "";
+ display: table;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li {
+ border: 1px solid rgba(0, 0, 0, 0.1);
+ -webkit-box-flex: 1;
+ -ms-flex: 1 1 auto;
+ flex: 1 1 auto;
+ margin: 0;
+ padding: 0.5rem 0.5rem;
+ text-align: center;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:not(:first-child) {
+ border-right-width: 0;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:focus {
+ outline-style: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active {
+ background-color: #289dcc;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active a {
+ color: #ffffff;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a {
+ color: #555d66;
+ text-decoration: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a:focus {
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .customize-control {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 20px 15px 0 15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .customize-control:last-child {
+ margin-bottom: 15px;
+}
+
+/**
+ * Heading control CSS.
+ */
+.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-title {
+ color: #444444;
+ display: block;
+ font-size: 14px;
+ line-height: 1.2;
+ margin: 0;
+}
+
+.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-description {
+ margin-top: 10px;
+ padding: 0 12px;
+}
+
+.tool-tip {
+ display: inline-block;
+ position: relative;
+}
+
+.tool-tip .tooltip-text {
+ background-color: #444444;
+ border-radius: 4px;
+ bottom: 125%;
+ -webkit-box-shadow: 0 10px 20px 0px rgba(68, 68, 68, 0.2);
+ box-shadow: 0 10px 20px 0px rgba(68, 68, 68, 0.2);
+ color: #ffffff;
+ right: 0;
+ margin-right: calc(-120px / 2);
+ opacity: 0;
+ padding: 10px 10px;
+ position: absolute;
+ text-align: center;
+ -webkit-transition: opacity 0.3s;
+ transition: opacity 0.3s;
+ visibility: hidden;
+ width: 120px;
+ z-index: 1;
+}
+
+.tool-tip .tooltip-text::after {
+ border-color: #444444 transparent transparent transparent;
+ border-style: solid;
+ border-width: 5px;
+ content: "";
+ right: 50%;
+ margin-right: -5px;
+ position: absolute;
+ top: 100%;
+}
+
+.tool-tip:hover .tooltip-text {
+ opacity: 1;
+ visibility: visible;
+}
+
+#customize-theme-controls .customize-pane-child .accordion-section-content {
+ padding: 10px;
+}
+
+.customize-control .customize-control-radiate-color {
+ padding-bottom: 0;
+}
+
+li.customize-control.customize-control-radiate-hidden {
+ padding: 0;
+}
+
+/**
+ * Group control CSS.
+ */
+.customize-control-radiate-hidden.customize-control {
+ margin-top: 0;
+}
+
+/**
+ * Radio image control CSS.
+ */
+.customize-control-radiate-radio-image input {
+ display: none;
+}
+
+.customize-control-radiate-radio-image input:checked + label img {
+ background: #0073aa;
+ border: 2px solid #0073aa;
+ -webkit-box-shadow: 0 0 20px 0 rgba(0, 115, 170, 0.2);
+ box-shadow: 0 0 20px 0 rgba(0, 115, 170, 0.2);
+}
+
+.customize-control-radiate-radio-image label {
+ display: -webkit-inline-box;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ margin: 10px auto;
+ position: relative;
+}
+
+.customize-control-radiate-radio-image label > img {
+ background: #ebebeb;
+ border: 2px solid #ebebeb;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-radio-image .image-col-1:after,
+.customize-control-radiate-radio-image .image-col-2:after,
+.customize-control-radiate-radio-image .image-col-3:after,
+.customize-control-radiate-radio-image .image-col-4:after {
+ clear: both;
+ content: '';
+ display: block;
+}
+
+.customize-control-radiate-radio-image .image-col-1 label {
+ width: 100%;
+}
+
+.customize-control-radiate-radio-image .image-col-2 label {
+ width: calc((100% / 2) - 10px);
+}
+
+.customize-control-radiate-radio-image .image-col-3 label {
+ width: calc((100% / 3) - 8px);
+}
+
+.customize-control-radiate-radio-image .image-col-4 label {
+ margin-left: 5px;
+ width: calc((100% / 4) - 8px);
+}
+
+/**
+ * Slider control CSS.
+ */
+.customize-control-radiate-slider .slider-wrapper {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range] {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: rgba(0, 0, 0, 0.1);
+ cursor: pointer;
+ -webkit-box-flex: 1;
+ -ms-flex: 1;
+ flex: 1;
+ height: 5px;
+ padding: 0;
+ -webkit-transition: background 0.3s;
+ transition: background 0.3s;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-moz-range-thumb {
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-ms-thumb {
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ padding: 0 5px 0 0;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value input[type=number] {
+ font-size: 12px;
+ padding: 3px;
+ width: 60px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value .radiate-range-unit {
+ padding: 0 5px 0 0;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset {
+ color: rgba(0, 0, 0, 0.3);
+ cursor: pointer;
+ -webkit-transition: color 0.3s ease-in;
+ transition: color 0.3s ease-in;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset span {
+ font-size: 14px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:hover, .customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:focus {
+ color: #289dcc;
+}
+
+.customize-control-radiate-slider .slider-wrapper.slider-description .radiate-slider-reset span {
+ left: 20px;
+}
+
+/**
+ * Sortable control CSS.
+ */
+.customize-control-radiate-sortable ul.ui-sortable {
+ cursor: default;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable .dashicons-visibility {
+ cursor: pointer;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li {
+ padding: 5px 10px;
+ border: 1px solid #555555;
+ background: #ffffff;
+ cursor: move;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li .dashicons.dashicons-menu {
+ float: left;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li .dashicons.visibility {
+ margin-left: 10px;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li.invisible {
+ color: #aaaaaa;
+ border: 1px dashed #aaaaaa;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li.invisible .dashicons.visibility {
+ color: #aaaaaa;
+}
+
+/**
+ * Switch toggle control CSS.
+ */
+.customize-control-radiate-toggle {
+ display: -webkit-box !important;
+ display: -ms-flexbox !important;
+ display: flex !important;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-toggle label {
+ position: relative;
+ display: inline-block;
+ width: 30px;
+ height: 16px;
+ left: 0;
+ top: 4px;
+}
+
+.customize-control-radiate-toggle label.toggle-description {
+ left: 20px;
+}
+
+.customize-control-radiate-toggle label input {
+ display: none;
+}
+
+.customize-control-radiate-toggle label input:checked + .switch:before {
+ background: #ffffff;
+ border-color: #ffffff;
+ right: -6px;
+ -webkit-transform: translateX(-20px);
+ transform: translateX(-20px);
+}
+
+.customize-control-radiate-toggle label input:checked + .switch {
+ background-color: #0073aa;
+ border-color: #0073aa;
+}
+
+.customize-control-radiate-toggle label .switch {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ right: 0;
+ left: 0;
+ bottom: 0;
+ background: #ffffff;
+ border: 2px solid #444444;
+ border-radius: 100px;
+ -webkit-transition: all ease 0.3s;
+ transition: all ease 0.3s;
+}
+
+.customize-control-radiate-toggle label .switch:before {
+ position: absolute;
+ content: '';
+ height: 6px;
+ width: 6px;
+ right: 3px;
+ bottom: 1px;
+ border: 2px solid #444444;
+ background: #444444;
+ border-radius: 100%;
+ -webkit-transition: all ease 0.3s;
+ transition: all ease 0.3s;
+}
+
+/**
+ * Typography control CSS.
+ */
+.customize-control-radiate-typography .customize-control-content > div {
+ margin-bottom: 15px;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-size,
+.customize-control-radiate-typography .customize-control-content .line-height,
+.customize-control-radiate-typography .customize-control-content .letter-spacing {
+ position: relative;
+}
+
+.customize-control-radiate-typography .customize-control-content .control-wrap {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.customize-control-radiate-typography .customize-control-content .unit {
+ background: #ebebeb;
+ border-radius: 2px 0 0 2px;
+ font-weight: 500;
+ line-height: 34px;
+ padding: 0 12px;
+ text-transform: uppercase;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-style,
+.customize-control-radiate-typography .customize-control-content .font-family,
+.customize-control-radiate-typography .customize-control-content .font-weight,
+.customize-control-radiate-typography .customize-control-content .text-transform {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-style .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .font-family .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .font-weight .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .text-transform .radiate-field-content {
+ padding-top: 2px;
+ width: 180px;
+}
+
+span.select2-container.select2-container--default.select2-container--open {
+ z-index: 999999;
+}
+
+/**
+ * Title control CSS.
+ */
+.customize-control-radiate-title {
+ border-bottom: 1px solid #ebebeb;
+ margin-top: 15px;
+}
+
+.customize-control-radiate-title:nth-child(2) {
+ margin-top: 0;
+}
+
+.radiate-title-wrapper {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.radiate-title-wrapper .dashicons-editor-help {
+ color: rgba(68, 68, 68, 0.5);
+ margin-right: 5px;
+}
+
+.radiate-title-wrapper .dashicons-editor-help:hover {
+ color: #444444;
+}
+
+.radiate-title-wrapper .guide-tutorial > span {
+ border-left: 1px solid #eeeeee;
+ padding: 0 8px 0 5px;
+}
+
+.radiate-title-wrapper .guide-tutorial > span:first-child, .radiate-title-wrapper .guide-tutorial > span:last-of-type {
+ border-left: 0;
+ padding-left: 0;
+}
+
+.radiate-title-wrapper .guide-tutorial > span a {
+ font-weight: 500;
+ text-decoration: none;
+}
+
+.radiate-title-wrapper label.customizer-text {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+}
diff --git a/inc/customizer/core/custom-controls/assets/css/customize-controls.css b/inc/customizer/core/custom-controls/assets/css/customize-controls.css
new file mode 100644
index 0000000..d5fa9fb
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/customize-controls.css
@@ -0,0 +1,789 @@
+/**
+ * Background control CSS.
+ */
+.customize-control-radiate-background .customize-control-content > div {
+ margin-bottom: 15px;
+}
+
+/**
+ * Radio buttonset control CSS.
+ */
+.customize-control-radiate-buttonset .buttonset {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner {
+ -webkit-box-flex: 1;
+ -ms-flex: 1;
+ flex: 1;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner + .buttonset-inner {
+ border-left: 0;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset {
+ background: #ebebeb;
+ -webkit-box-shadow: inset 0 0 0 1px rgba(68, 68, 68, 0.1);
+ box-shadow: inset 0 0 0 1px rgba(68, 68, 68, 0.1);
+ color: #444444;
+ display: block;
+ padding: 5px 12px;
+ text-align: center;
+ -webkit-transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset:hover {
+ background: #ffffff;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input {
+ display: none;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked + label {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked + label:hover {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control .actions {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control .actions .button {
+ min-height: 34px;
+ width: calc(50% - 8px);
+}
+
+.customize-control .actions .button:last-of-type {
+ margin-right: 0px;
+}
+
+.customize-control-header button.random {
+ min-height: 34px;
+}
+
+input[type=checkbox]:checked {
+ border-radius: 2px;
+ -webkit-box-shadow: 0 0 0 1px #0073aa;
+ box-shadow: 0 0 0 1px #0073aa;
+}
+
+input[type=radio]:checked {
+ -webkit-box-shadow: 0 0 0 1px #0073aa;
+ box-shadow: 0 0 0 1px #0073aa;
+}
+
+input[type=range]:focus {
+ outline: none;
+}
+
+/**
+ * Alpha color control CSS.
+ */
+.customize-control-radiate-color .customizer-wrapper {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-orient: vertical;
+ -webkit-box-direction: normal;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-color .customizer-wrapper .customize-control-title {
+ display: block;
+ margin: 0 0 8px 0;
+}
+
+.wp-picker-container .wp-color-result.button {
+ background-color: #ebebeb !important;
+ background-image: none !important;
+ min-height: 34px;
+ border: 1px solid #ebebeb;
+}
+
+.wp-picker-container .wp-color-result.button::after {
+ border: 1px solid #ebebeb;
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==) !important;
+ border-radius: 100%;
+ content: "";
+ height: 22px;
+ left: 5px;
+ position: absolute;
+ top: 5px;
+ width: 22px;
+ z-index: 0;
+}
+
+.wp-picker-container .wp-color-result.button .wp-color-result-text {
+ background: none;
+ border: none;
+ line-height: 2.15384615;
+ padding: 0 10px 0 6px;
+}
+
+.wp-picker-container .wp-color-result.button .color-alpha {
+ border: 1px solid #ebebeb;
+ border-radius: 100% !important;
+ height: 22px !important;
+ left: 4px !important;
+ top: 4px !important;
+ width: 22px !important;
+ z-index: 1;
+}
+
+.wp-picker-container .wp-picker-input-wrap .wp-picker-default {
+ min-height: 34px !important;
+}
+
+.wp-picker-container .wp-picker-holder {
+ -webkit-box-shadow: 0 0px 20px 0px rgba(68, 68, 68, 0.3);
+ box-shadow: 0 0px 20px 0px rgba(68, 68, 68, 0.3);
+}
+
+.wp-picker-container .iris-picker {
+ border-color: #ebebeb;
+ margin-bottom: 5px;
+}
+
+.wp-picker-container .iris-picker .iris-alpha-slider {
+ margin-right: -1px;
+}
+
+.customize-control-radiate-divider {
+ padding: 0 !important;
+}
+
+/**
+ * Custom control CSS.
+ */
+.customize-control-radiate-custom .radiate-custom-info {
+ margin-bottom: 15px;
+}
+
+.customize-control-radiate-custom .radiate-custom-links li a {
+ background: #0073aa;
+ display: block;
+ text-align: center;
+ color: #ffffff;
+ padding: 8px 16px;
+ text-decoration: none;
+}
+
+/**
+ * Divider control CSS.
+ */
+.customize-control-radiate-divider hr {
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+
+.customize-control-radiate-divider .divider-placement-above + .radiate-control-tooltip {
+ top: 30px;
+}
+
+/**
+ * Editor control CSS.
+ */
+.customize-control-radiate-editor .wp-editor-tools .wp-editor-container textarea {
+ width: 100%;
+}
+
+/**
+ * Group control CSS.
+ */
+.customize-control-radiate-group .radiate-group-wrap > .customizer-text {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon {
+ background: #ebebeb;
+ border-radius: 100px;
+ color: rgba(68, 68, 68, 0.6);
+ cursor: pointer;
+ font-size: 20px;
+ padding: 5px;
+ position: relative;
+ right: 0;
+ top: 0px;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon:before {
+ content: "\f464";
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.open {
+ background: #0073aa;
+ color: #ffffff;
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.open:before {
+ content: "\f158";
+}
+
+.customize-control-radiate-group .radiate-group-toggle-icon.toggle-description {
+ right: 25px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal {
+ background-color: #ffffff;
+ border-radius: 5px;
+ -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
+ left: 0;
+ position: absolute;
+ right: 0;
+ z-index: 9999;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal:before {
+ border: 8px solid transparent;
+ border-bottom-color: #ffffff;
+ content: "";
+ pointer-events: none;
+ position: absolute;
+ right: 17px;
+ top: -15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-field-settings-wrap {
+ width: 100%;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-tabs,
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-tab-content {
+ position: relative;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ overflow: hidden;
+ padding: 15px 15px 0 15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:before, .customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:after {
+ border-collapse: collapse;
+ content: "";
+ display: table;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li {
+ border: 1px solid rgba(0, 0, 0, 0.1);
+ -webkit-box-flex: 1;
+ -ms-flex: 1 1 auto;
+ flex: 1 1 auto;
+ margin: 0;
+ padding: 0.5rem 0.5rem;
+ text-align: center;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:not(:first-child) {
+ border-left-width: 0;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:focus {
+ outline-style: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active {
+ background-color: #289dcc;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active a {
+ color: #ffffff;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a {
+ color: #555d66;
+ text-decoration: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a:focus {
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .customize-control {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 20px 15px 0 15px;
+}
+
+.customize-control-radiate-group .radiate-field-settings-modal .customize-control:last-child {
+ margin-bottom: 15px;
+}
+
+/**
+ * Heading control CSS.
+ */
+.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-title {
+ color: #444444;
+ display: block;
+ font-size: 14px;
+ line-height: 1.2;
+ margin: 0;
+}
+
+.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-description {
+ margin-top: 10px;
+ padding: 0 12px;
+}
+
+.tool-tip {
+ display: inline-block;
+ position: relative;
+}
+
+.tool-tip .tooltip-text {
+ background-color: #444444;
+ border-radius: 4px;
+ bottom: 125%;
+ -webkit-box-shadow: 0 10px 20px 0px rgba(68, 68, 68, 0.2);
+ box-shadow: 0 10px 20px 0px rgba(68, 68, 68, 0.2);
+ color: #ffffff;
+ left: 0;
+ margin-left: calc(-120px / 2);
+ opacity: 0;
+ padding: 10px 10px;
+ position: absolute;
+ text-align: center;
+ -webkit-transition: opacity 0.3s;
+ transition: opacity 0.3s;
+ visibility: hidden;
+ width: 120px;
+ z-index: 1;
+}
+
+.tool-tip .tooltip-text::after {
+ border-color: #444444 transparent transparent transparent;
+ border-style: solid;
+ border-width: 5px;
+ content: "";
+ left: 50%;
+ margin-left: -5px;
+ position: absolute;
+ top: 100%;
+}
+
+.tool-tip:hover .tooltip-text {
+ opacity: 1;
+ visibility: visible;
+}
+
+#customize-theme-controls .customize-pane-child .accordion-section-content {
+ padding: 10px;
+}
+
+.customize-control .customize-control-radiate-color {
+ padding-bottom: 0;
+}
+
+li.customize-control.customize-control-radiate-hidden {
+ padding: 0;
+}
+
+/**
+ * Group control CSS.
+ */
+.customize-control-radiate-hidden.customize-control {
+ margin-top: 0;
+}
+
+/**
+ * Radio image control CSS.
+ */
+.customize-control-radiate-radio-image input {
+ display: none;
+}
+
+.customize-control-radiate-radio-image input:checked + label img {
+ background: #0073aa;
+ border: 2px solid #0073aa;
+ -webkit-box-shadow: 0 0 20px 0 rgba(0, 115, 170, 0.2);
+ box-shadow: 0 0 20px 0 rgba(0, 115, 170, 0.2);
+}
+
+.customize-control-radiate-radio-image label {
+ display: -webkit-inline-box;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ margin: 10px auto;
+ position: relative;
+}
+
+.customize-control-radiate-radio-image label > img {
+ background: #ebebeb;
+ border: 2px solid #ebebeb;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-radio-image .image-col-1:after,
+.customize-control-radiate-radio-image .image-col-2:after,
+.customize-control-radiate-radio-image .image-col-3:after,
+.customize-control-radiate-radio-image .image-col-4:after {
+ clear: both;
+ content: '';
+ display: block;
+}
+
+.customize-control-radiate-radio-image .image-col-1 label {
+ width: 100%;
+}
+
+.customize-control-radiate-radio-image .image-col-2 label {
+ width: calc((100% / 2) - 10px);
+}
+
+.customize-control-radiate-radio-image .image-col-3 label {
+ width: calc((100% / 3) - 8px);
+}
+
+.customize-control-radiate-radio-image .image-col-4 label {
+ margin-right: 5px;
+ width: calc((100% / 4) - 8px);
+}
+
+/**
+ * Slider control CSS.
+ */
+.customize-control-radiate-slider .slider-wrapper {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range] {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: rgba(0, 0, 0, 0.1);
+ cursor: pointer;
+ -webkit-box-flex: 1;
+ -ms-flex: 1;
+ flex: 1;
+ height: 5px;
+ padding: 0;
+ -webkit-transition: background 0.3s;
+ transition: background 0.3s;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-moz-range-thumb {
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper input[type=range]::-ms-thumb {
+ background: #289dcc;
+ border-radius: 100%;
+ height: 16px;
+ width: 16px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ padding: 0 0 0 5px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value input[type=number] {
+ font-size: 12px;
+ padding: 3px;
+ width: 60px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-range-value .radiate-range-unit {
+ padding: 0 0 0 5px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset {
+ color: rgba(0, 0, 0, 0.3);
+ cursor: pointer;
+ -webkit-transition: color 0.3s ease-in;
+ transition: color 0.3s ease-in;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset span {
+ font-size: 14px;
+}
+
+.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:hover, .customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:focus {
+ color: #289dcc;
+}
+
+.customize-control-radiate-slider .slider-wrapper.slider-description .radiate-slider-reset span {
+ right: 20px;
+}
+
+/**
+ * Sortable control CSS.
+ */
+.customize-control-radiate-sortable ul.ui-sortable {
+ cursor: default;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable .dashicons-visibility {
+ cursor: pointer;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li {
+ padding: 5px 10px;
+ border: 1px solid #555555;
+ background: #ffffff;
+ cursor: move;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li .dashicons.dashicons-menu {
+ float: right;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li .dashicons.visibility {
+ margin-right: 10px;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li.invisible {
+ color: #aaaaaa;
+ border: 1px dashed #aaaaaa;
+}
+
+.customize-control-radiate-sortable ul.ui-sortable li.invisible .dashicons.visibility {
+ color: #aaaaaa;
+}
+
+/**
+ * Switch toggle control CSS.
+ */
+.customize-control-radiate-toggle {
+ display: -webkit-box !important;
+ display: -ms-flexbox !important;
+ display: flex !important;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-toggle label {
+ position: relative;
+ display: inline-block;
+ width: 30px;
+ height: 16px;
+ right: 0;
+ top: 4px;
+}
+
+.customize-control-radiate-toggle label.toggle-description {
+ right: 20px;
+}
+
+.customize-control-radiate-toggle label input {
+ display: none;
+}
+
+.customize-control-radiate-toggle label input:checked + .switch:before {
+ background: #ffffff;
+ border-color: #ffffff;
+ left: -6px;
+ -webkit-transform: translateX(20px);
+ transform: translateX(20px);
+}
+
+.customize-control-radiate-toggle label input:checked + .switch {
+ background-color: #0073aa;
+ border-color: #0073aa;
+}
+
+.customize-control-radiate-toggle label .switch {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #ffffff;
+ border: 2px solid #444444;
+ border-radius: 100px;
+ -webkit-transition: all ease 0.3s;
+ transition: all ease 0.3s;
+}
+
+.customize-control-radiate-toggle label .switch:before {
+ position: absolute;
+ content: '';
+ height: 6px;
+ width: 6px;
+ left: 3px;
+ bottom: 1px;
+ border: 2px solid #444444;
+ background: #444444;
+ border-radius: 100%;
+ -webkit-transition: all ease 0.3s;
+ transition: all ease 0.3s;
+}
+
+/**
+ * Typography control CSS.
+ */
+.customize-control-radiate-typography .customize-control-content > div {
+ margin-bottom: 15px;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-size,
+.customize-control-radiate-typography .customize-control-content .line-height,
+.customize-control-radiate-typography .customize-control-content .letter-spacing {
+ position: relative;
+}
+
+.customize-control-radiate-typography .customize-control-content .control-wrap {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.customize-control-radiate-typography .customize-control-content .unit {
+ background: #ebebeb;
+ border-radius: 0 2px 2px 0;
+ font-weight: 500;
+ line-height: 34px;
+ padding: 0 12px;
+ text-transform: uppercase;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-style,
+.customize-control-radiate-typography .customize-control-content .font-family,
+.customize-control-radiate-typography .customize-control-content .font-weight,
+.customize-control-radiate-typography .customize-control-content .text-transform {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.customize-control-radiate-typography .customize-control-content .font-style .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .font-family .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .font-weight .radiate-field-content,
+.customize-control-radiate-typography .customize-control-content .text-transform .radiate-field-content {
+ padding-top: 2px;
+ width: 180px;
+}
+
+span.select2-container.select2-container--default.select2-container--open {
+ z-index: 999999;
+}
+
+/**
+ * Title control CSS.
+ */
+.customize-control-radiate-title {
+ border-bottom: 1px solid #ebebeb;
+ margin-top: 15px;
+}
+
+.customize-control-radiate-title:nth-child(2) {
+ margin-top: 0;
+}
+
+.radiate-title-wrapper {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.radiate-title-wrapper .dashicons-editor-help {
+ color: rgba(68, 68, 68, 0.5);
+ margin-left: 5px;
+}
+
+.radiate-title-wrapper .dashicons-editor-help:hover {
+ color: #444444;
+}
+
+.radiate-title-wrapper .guide-tutorial > span {
+ border-right: 1px solid #eeeeee;
+ padding: 0 5px 0 8px;
+}
+
+.radiate-title-wrapper .guide-tutorial > span:first-child, .radiate-title-wrapper .guide-tutorial > span:last-of-type {
+ border-right: 0;
+ padding-right: 0;
+}
+
+.radiate-title-wrapper .guide-tutorial > span a {
+ font-weight: 500;
+ text-decoration: none;
+}
+
+.radiate-title-wrapper label.customizer-text {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+}
diff --git a/inc/customizer/core/custom-controls/assets/css/customize-controls.min-rtl.css b/inc/customizer/core/custom-controls/assets/css/customize-controls.min-rtl.css
new file mode 100644
index 0000000..d588f7a
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/customize-controls.min-rtl.css
@@ -0,0 +1 @@
+.customize-control-radiate-background .customize-control-content>div{margin-bottom:15px}.customize-control-radiate-buttonset .buttonset{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-buttonset .buttonset .buttonset-inner{-webkit-box-flex:1;-ms-flex:1;flex:1}.customize-control-radiate-buttonset .buttonset .buttonset-inner+.buttonset-inner{border-right:0}.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset{background:#ebebeb;-webkit-box-shadow:inset 0 0 0 1px rgba(68,68,68,0.1);box-shadow:inset 0 0 0 1px rgba(68,68,68,0.1);color:#444;display:block;padding:5px 12px;text-align:center;-webkit-transition:all .15s cubic-bezier(0.4,0,0.2,1);transition:all .15s cubic-bezier(0.4,0,0.2,1)}.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset:hover{background:#fff}.customize-control-radiate-buttonset .buttonset .buttonset-inner input{display:none}.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked+label{background:#0073aa;color:#fff}.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked+label:hover{background:#0073aa;color:#fff}.customize-control .actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control .actions .button{min-height:34px;width:calc(50% - 8px)}.customize-control .actions .button:last-of-type{margin-left:0}.customize-control-header button.random{min-height:34px}input[type=checkbox]:checked{border-radius:2px;-webkit-box-shadow:0 0 0 1px #0073aa;box-shadow:0 0 0 1px #0073aa}input[type=radio]:checked{-webkit-box-shadow:0 0 0 1px #0073aa;box-shadow:0 0 0 1px #0073aa}input[type=range]:focus{outline:0}.customize-control-radiate-color .customizer-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-color .customizer-wrapper .customize-control-title{display:block;margin:0 0 8px 0}.wp-picker-container .wp-color-result.button{background-color:#ebebeb !important;background-image:none !important;min-height:34px;border:1px solid #ebebeb}.wp-picker-container .wp-color-result.button::after{border:1px solid #ebebeb;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==) !important;border-radius:100%;content:"";height:22px;right:5px;position:absolute;top:5px;width:22px;z-index:0}.wp-picker-container .wp-color-result.button .wp-color-result-text{background:100%;border:0;line-height:2.15384615;padding:0 6px 0 10px}.wp-picker-container .wp-color-result.button .color-alpha{border:1px solid #ebebeb;border-radius:100% !important;height:22px !important;right:4px !important;top:4px !important;width:22px !important;z-index:1}.wp-picker-container .wp-picker-input-wrap .wp-picker-default{min-height:34px !important}.wp-picker-container .wp-picker-holder{-webkit-box-shadow:0 0 20px 0 rgba(68,68,68,0.3);box-shadow:0 0 20px 0 rgba(68,68,68,0.3)}.wp-picker-container .iris-picker{border-color:#ebebeb;margin-bottom:5px}.wp-picker-container .iris-picker .iris-alpha-slider{margin-left:-1px}.customize-control-radiate-divider{padding:0 !important}.customize-control-radiate-custom .radiate-custom-info{margin-bottom:15px}.customize-control-radiate-custom .radiate-custom-links li a{background:#0073aa;display:block;text-align:center;color:#fff;padding:8px 16px;text-decoration:none}.customize-control-radiate-divider hr{margin-top:10px;margin-bottom:10px}.customize-control-radiate-divider .divider-placement-above+.radiate-control-tooltip{top:30px}.customize-control-radiate-editor .wp-editor-tools .wp-editor-container textarea{width:100%}.customize-control-radiate-group .radiate-group-wrap>.customizer-text{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-group .radiate-group-toggle-icon{background:#ebebeb;border-radius:100px;color:rgba(68,68,68,0.6);cursor:pointer;font-size:20px;padding:5px;position:relative;left:0;top:0}.customize-control-radiate-group .radiate-group-toggle-icon:before{content:"\f464"}.customize-control-radiate-group .radiate-group-toggle-icon.open{background:#0073aa;color:#fff}.customize-control-radiate-group .radiate-group-toggle-icon.open:before{content:"\f158"}.customize-control-radiate-group .radiate-group-toggle-icon.toggle-description{left:25px}.customize-control-radiate-group .radiate-field-settings-modal{background-color:#fff;border-radius:5px;-webkit-box-shadow:0 2px 10px rgba(0,0,0,0.3);box-shadow:0 2px 10px rgba(0,0,0,0.3);right:0;position:absolute;left:0;z-index:9999}.customize-control-radiate-group .radiate-field-settings-modal:before{border:8px solid transparent;border-bottom-color:#fff;content:"";pointer-events:none;position:absolute;left:17px;top:-15px}.customize-control-radiate-group .radiate-field-settings-modal .radiate-field-settings-wrap{width:100%}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-tabs,.customize-control-radiate-group .radiate-field-settings-modal .radiate-tab-content{position:relative}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:hidden;padding:15px 15px 0 15px}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:before,.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:after{border-collapse:collapse;content:"";display:table}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li{border:1px solid rgba(0,0,0,0.1);-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;margin:0;padding:.5rem .5rem;text-align:center}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:not(:first-child){border-right-width:0}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:focus{outline-style:none}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active{background-color:#289dcc}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active a{color:#fff}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a{color:#555d66;text-decoration:none}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a:focus{-webkit-box-shadow:none;box-shadow:none}.customize-control-radiate-group .radiate-field-settings-modal .customize-control{-webkit-box-sizing:border-box;box-sizing:border-box;padding:20px 15px 0 15px}.customize-control-radiate-group .radiate-field-settings-modal .customize-control:last-child{margin-bottom:15px}.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-title{color:#444;display:block;font-size:14px;line-height:1.2;margin:0}.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-description{margin-top:10px;padding:0 12px}.tool-tip{display:inline-block;position:relative}.tool-tip .tooltip-text{background-color:#444;border-radius:4px;bottom:125%;-webkit-box-shadow:0 10px 20px 0 rgba(68,68,68,0.2);box-shadow:0 10px 20px 0 rgba(68,68,68,0.2);color:#fff;right:0;margin-right:calc(-120px / 2);opacity:0;padding:10px 10px;position:absolute;text-align:center;-webkit-transition:opacity .3s;transition:opacity .3s;visibility:hidden;width:120px;z-index:1}.tool-tip .tooltip-text::after{border-color:#444 transparent transparent transparent;border-style:solid;border-width:5px;content:"";right:50%;margin-right:-5px;position:absolute;top:100%}.tool-tip:hover .tooltip-text{opacity:1;visibility:visible}#customize-theme-controls .customize-pane-child .accordion-section-content{padding:10px}.customize-control .customize-control-radiate-color{padding-bottom:0}li.customize-control.customize-control-radiate-hidden{padding:0}.customize-control-radiate-hidden.customize-control{margin-top:0}.customize-control-radiate-radio-image input{display:none}.customize-control-radiate-radio-image input:checked+label img{background:#0073aa;border:2px solid #0073aa;-webkit-box-shadow:0 0 20px 0 rgba(0,115,170,0.2);box-shadow:0 0 20px 0 rgba(0,115,170,0.2)}.customize-control-radiate-radio-image label{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;margin:10px auto;position:relative}.customize-control-radiate-radio-image label>img{background:#ebebeb;border:2px solid #ebebeb;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-radio-image .image-col-1:after,.customize-control-radiate-radio-image .image-col-2:after,.customize-control-radiate-radio-image .image-col-3:after,.customize-control-radiate-radio-image .image-col-4:after{clear:both;content:'';display:block}.customize-control-radiate-radio-image .image-col-1 label{width:100%}.customize-control-radiate-radio-image .image-col-2 label{width:calc((100% / 2) - 10px)}.customize-control-radiate-radio-image .image-col-3 label{width:calc((100% / 3) - 8px)}.customize-control-radiate-radio-image .image-col-4 label{margin-left:5px;width:calc((100% / 4) - 8px)}.customize-control-radiate-slider .slider-wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-slider .slider-wrapper input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:rgba(0,0,0,0.1);cursor:pointer;-webkit-box-flex:1;-ms-flex:1;flex:1;height:5px;padding:0;-webkit-transition:background .3s;transition:background .3s}.customize-control-radiate-slider .slider-wrapper input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper input[type=range]::-moz-range-thumb{background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper input[type=range]::-ms-thumb{background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper .radiate-range-value{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0 5px 0 0}.customize-control-radiate-slider .slider-wrapper .radiate-range-value input[type=number]{font-size:12px;padding:3px;width:60px}.customize-control-radiate-slider .slider-wrapper .radiate-range-value .radiate-range-unit{padding:0 5px 0 0}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset{color:rgba(0,0,0,0.3);cursor:pointer;-webkit-transition:color .3s ease-in;transition:color .3s ease-in}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset span{font-size:14px}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:hover,.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:focus{color:#289dcc}.customize-control-radiate-slider .slider-wrapper.slider-description .radiate-slider-reset span{left:20px}.customize-control-radiate-sortable ul.ui-sortable{cursor:default}.customize-control-radiate-sortable ul.ui-sortable .dashicons-visibility{cursor:pointer}.customize-control-radiate-sortable ul.ui-sortable li{padding:5px 10px;border:1px solid #555;background:#fff;cursor:move}.customize-control-radiate-sortable ul.ui-sortable li .dashicons.dashicons-menu{float:left}.customize-control-radiate-sortable ul.ui-sortable li .dashicons.visibility{margin-left:10px}.customize-control-radiate-sortable ul.ui-sortable li.invisible{color:#aaa;border:1px dashed #aaa}.customize-control-radiate-sortable ul.ui-sortable li.invisible .dashicons.visibility{color:#aaa}.customize-control-radiate-toggle{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-toggle label{position:relative;display:inline-block;width:30px;height:16px;left:0;top:4px}.customize-control-radiate-toggle label.toggle-description{left:20px}.customize-control-radiate-toggle label input{display:none}.customize-control-radiate-toggle label input:checked+.switch:before{background:#fff;border-color:#fff;right:-6px;-webkit-transform:translateX(-20px);transform:translateX(-20px)}.customize-control-radiate-toggle label input:checked+.switch{background-color:#0073aa;border-color:#0073aa}.customize-control-radiate-toggle label .switch{position:absolute;cursor:pointer;top:0;right:0;left:0;bottom:0;background:#fff;border:2px solid #444;border-radius:100px;-webkit-transition:all ease .3s;transition:all ease .3s}.customize-control-radiate-toggle label .switch:before{position:absolute;content:'';height:6px;width:6px;right:3px;bottom:1px;border:2px solid #444;background:#444;border-radius:100%;-webkit-transition:all ease .3s;transition:all ease .3s}.customize-control-radiate-typography .customize-control-content>div{margin-bottom:15px}.customize-control-radiate-typography .customize-control-content .font-size,.customize-control-radiate-typography .customize-control-content .line-height,.customize-control-radiate-typography .customize-control-content .letter-spacing{position:relative}.customize-control-radiate-typography .customize-control-content .control-wrap{display:-webkit-box;display:-ms-flexbox;display:flex}.customize-control-radiate-typography .customize-control-content .unit{background:#ebebeb;border-radius:2px 0 0 2px;font-weight:500;line-height:34px;padding:0 12px;text-transform:uppercase}.customize-control-radiate-typography .customize-control-content .font-style,.customize-control-radiate-typography .customize-control-content .font-family,.customize-control-radiate-typography .customize-control-content .font-weight,.customize-control-radiate-typography .customize-control-content .text-transform{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-typography .customize-control-content .font-style .radiate-field-content,.customize-control-radiate-typography .customize-control-content .font-family .radiate-field-content,.customize-control-radiate-typography .customize-control-content .font-weight .radiate-field-content,.customize-control-radiate-typography .customize-control-content .text-transform .radiate-field-content{padding-top:2px;width:180px}span.select2-container.select2-container--default.select2-container--open{z-index:999999}.customize-control-radiate-title{border-bottom:1px solid #ebebeb;margin-top:15px}.customize-control-radiate-title:nth-child(2){margin-top:0}.radiate-title-wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.radiate-title-wrapper .dashicons-editor-help{color:rgba(68,68,68,0.5);margin-right:5px}.radiate-title-wrapper .dashicons-editor-help:hover{color:#444}.radiate-title-wrapper .guide-tutorial>span{border-left:1px solid #eee;padding:0 8px 0 5px}.radiate-title-wrapper .guide-tutorial>span:first-child,.radiate-title-wrapper .guide-tutorial>span:last-of-type{border-left:0;padding-left:0}.radiate-title-wrapper .guide-tutorial>span a{font-weight:500;text-decoration:none}.radiate-title-wrapper label.customizer-text{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}
\ No newline at end of file
diff --git a/inc/customizer/core/custom-controls/assets/css/customize-controls.min.css b/inc/customizer/core/custom-controls/assets/css/customize-controls.min.css
new file mode 100644
index 0000000..4cc5019
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/customize-controls.min.css
@@ -0,0 +1 @@
+.customize-control-radiate-background .customize-control-content>div{margin-bottom:15px}.customize-control-radiate-buttonset .buttonset{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-buttonset .buttonset .buttonset-inner{-webkit-box-flex:1;-ms-flex:1;flex:1}.customize-control-radiate-buttonset .buttonset .buttonset-inner+.buttonset-inner{border-left:0}.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset{background:#ebebeb;-webkit-box-shadow:inset 0 0 0 1px rgba(68,68,68,0.1);box-shadow:inset 0 0 0 1px rgba(68,68,68,0.1);color:#444;display:block;padding:5px 12px;text-align:center;-webkit-transition:all .15s cubic-bezier(0.4,0,0.2,1);transition:all .15s cubic-bezier(0.4,0,0.2,1)}.customize-control-radiate-buttonset .buttonset .buttonset-inner .radiate-buttonset:hover{background:#fff}.customize-control-radiate-buttonset .buttonset .buttonset-inner input{display:none}.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked+label{background:#0073aa;color:#fff}.customize-control-radiate-buttonset .buttonset .buttonset-inner input:checked+label:hover{background:#0073aa;color:#fff}.customize-control .actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control .actions .button{min-height:34px;width:calc(50% - 8px)}.customize-control .actions .button:last-of-type{margin-right:0}.customize-control-header button.random{min-height:34px}input[type=checkbox]:checked{border-radius:2px;-webkit-box-shadow:0 0 0 1px #0073aa;box-shadow:0 0 0 1px #0073aa}input[type=radio]:checked{-webkit-box-shadow:0 0 0 1px #0073aa;box-shadow:0 0 0 1px #0073aa}input[type=range]:focus{outline:0}.customize-control-radiate-color .customizer-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-color .customizer-wrapper .customize-control-title{display:block;margin:0 0 8px 0}.wp-picker-container .wp-color-result.button{background-color:#ebebeb !important;background-image:none !important;min-height:34px;border:1px solid #ebebeb}.wp-picker-container .wp-color-result.button::after{border:1px solid #ebebeb;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==) !important;border-radius:100%;content:"";height:22px;left:5px;position:absolute;top:5px;width:22px;z-index:0}.wp-picker-container .wp-color-result.button .wp-color-result-text{background:0;border:0;line-height:2.15384615;padding:0 10px 0 6px}.wp-picker-container .wp-color-result.button .color-alpha{border:1px solid #ebebeb;border-radius:100% !important;height:22px !important;left:4px !important;top:4px !important;width:22px !important;z-index:1}.wp-picker-container .wp-picker-input-wrap .wp-picker-default{min-height:34px !important}.wp-picker-container .wp-picker-holder{-webkit-box-shadow:0 0 20px 0 rgba(68,68,68,0.3);box-shadow:0 0 20px 0 rgba(68,68,68,0.3)}.wp-picker-container .iris-picker{border-color:#ebebeb;margin-bottom:5px}.wp-picker-container .iris-picker .iris-alpha-slider{margin-right:-1px}.customize-control-radiate-divider{padding:0 !important}.customize-control-radiate-custom .radiate-custom-info{margin-bottom:15px}.customize-control-radiate-custom .radiate-custom-links li a{background:#0073aa;display:block;text-align:center;color:#fff;padding:8px 16px;text-decoration:none}.customize-control-radiate-divider hr{margin-top:10px;margin-bottom:10px}.customize-control-radiate-divider .divider-placement-above+.radiate-control-tooltip{top:30px}.customize-control-radiate-editor .wp-editor-tools .wp-editor-container textarea{width:100%}.customize-control-radiate-group .radiate-group-wrap>.customizer-text{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-group .radiate-group-toggle-icon{background:#ebebeb;border-radius:100px;color:rgba(68,68,68,0.6);cursor:pointer;font-size:20px;padding:5px;position:relative;right:0;top:0}.customize-control-radiate-group .radiate-group-toggle-icon:before{content:"\f464"}.customize-control-radiate-group .radiate-group-toggle-icon.open{background:#0073aa;color:#fff}.customize-control-radiate-group .radiate-group-toggle-icon.open:before{content:"\f158"}.customize-control-radiate-group .radiate-group-toggle-icon.toggle-description{right:25px}.customize-control-radiate-group .radiate-field-settings-modal{background-color:#fff;border-radius:5px;-webkit-box-shadow:0 2px 10px rgba(0,0,0,0.3);box-shadow:0 2px 10px rgba(0,0,0,0.3);left:0;position:absolute;right:0;z-index:9999}.customize-control-radiate-group .radiate-field-settings-modal:before{border:8px solid transparent;border-bottom-color:#fff;content:"";pointer-events:none;position:absolute;right:17px;top:-15px}.customize-control-radiate-group .radiate-field-settings-modal .radiate-field-settings-wrap{width:100%}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-tabs,.customize-control-radiate-group .radiate-field-settings-modal .radiate-tab-content{position:relative}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:hidden;padding:15px 15px 0 15px}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:before,.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list:after{border-collapse:collapse;content:"";display:table}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li{border:1px solid rgba(0,0,0,0.1);-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;margin:0;padding:.5rem .5rem;text-align:center}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:not(:first-child){border-left-width:0}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li:focus{outline-style:none}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active{background-color:#289dcc}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li.ui-state-active a{color:#fff}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a{color:#555d66;text-decoration:none}.customize-control-radiate-group .radiate-field-settings-modal .radiate-group-list li a:focus{-webkit-box-shadow:none;box-shadow:none}.customize-control-radiate-group .radiate-field-settings-modal .customize-control{-webkit-box-sizing:border-box;box-sizing:border-box;padding:20px 15px 0 15px}.customize-control-radiate-group .radiate-field-settings-modal .customize-control:last-child{margin-bottom:15px}.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-title{color:#444;display:block;font-size:14px;line-height:1.2;margin:0}.customize-control-radiate-heading .radiate-heading-wrapper .customize-control-description{margin-top:10px;padding:0 12px}.tool-tip{display:inline-block;position:relative}.tool-tip .tooltip-text{background-color:#444;border-radius:4px;bottom:125%;-webkit-box-shadow:0 10px 20px 0 rgba(68,68,68,0.2);box-shadow:0 10px 20px 0 rgba(68,68,68,0.2);color:#fff;left:0;margin-left:calc(-120px / 2);opacity:0;padding:10px 10px;position:absolute;text-align:center;-webkit-transition:opacity .3s;transition:opacity .3s;visibility:hidden;width:120px;z-index:1}.tool-tip .tooltip-text::after{border-color:#444 transparent transparent transparent;border-style:solid;border-width:5px;content:"";left:50%;margin-left:-5px;position:absolute;top:100%}.tool-tip:hover .tooltip-text{opacity:1;visibility:visible}#customize-theme-controls .customize-pane-child .accordion-section-content{padding:10px}.customize-control .customize-control-radiate-color{padding-bottom:0}li.customize-control.customize-control-radiate-hidden{padding:0}.customize-control-radiate-hidden.customize-control{margin-top:0}.customize-control-radiate-radio-image input{display:none}.customize-control-radiate-radio-image input:checked+label img{background:#0073aa;border:2px solid #0073aa;-webkit-box-shadow:0 0 20px 0 rgba(0,115,170,0.2);box-shadow:0 0 20px 0 rgba(0,115,170,0.2)}.customize-control-radiate-radio-image label{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;margin:10px auto;position:relative}.customize-control-radiate-radio-image label>img{background:#ebebeb;border:2px solid #ebebeb;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-radio-image .image-col-1:after,.customize-control-radiate-radio-image .image-col-2:after,.customize-control-radiate-radio-image .image-col-3:after,.customize-control-radiate-radio-image .image-col-4:after{clear:both;content:'';display:block}.customize-control-radiate-radio-image .image-col-1 label{width:100%}.customize-control-radiate-radio-image .image-col-2 label{width:calc((100% / 2) - 10px)}.customize-control-radiate-radio-image .image-col-3 label{width:calc((100% / 3) - 8px)}.customize-control-radiate-radio-image .image-col-4 label{margin-right:5px;width:calc((100% / 4) - 8px)}.customize-control-radiate-slider .slider-wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.customize-control-radiate-slider .slider-wrapper input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:rgba(0,0,0,0.1);cursor:pointer;-webkit-box-flex:1;-ms-flex:1;flex:1;height:5px;padding:0;-webkit-transition:background .3s;transition:background .3s}.customize-control-radiate-slider .slider-wrapper input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper input[type=range]::-moz-range-thumb{background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper input[type=range]::-ms-thumb{background:#289dcc;border-radius:100%;height:16px;width:16px}.customize-control-radiate-slider .slider-wrapper .radiate-range-value{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0 0 0 5px}.customize-control-radiate-slider .slider-wrapper .radiate-range-value input[type=number]{font-size:12px;padding:3px;width:60px}.customize-control-radiate-slider .slider-wrapper .radiate-range-value .radiate-range-unit{padding:0 0 0 5px}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset{color:rgba(0,0,0,0.3);cursor:pointer;-webkit-transition:color .3s ease-in;transition:color .3s ease-in}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset span{font-size:14px}.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:hover,.customize-control-radiate-slider .slider-wrapper .radiate-slider-reset:focus{color:#289dcc}.customize-control-radiate-slider .slider-wrapper.slider-description .radiate-slider-reset span{right:20px}.customize-control-radiate-sortable ul.ui-sortable{cursor:default}.customize-control-radiate-sortable ul.ui-sortable .dashicons-visibility{cursor:pointer}.customize-control-radiate-sortable ul.ui-sortable li{padding:5px 10px;border:1px solid #555;background:#fff;cursor:move}.customize-control-radiate-sortable ul.ui-sortable li .dashicons.dashicons-menu{float:right}.customize-control-radiate-sortable ul.ui-sortable li .dashicons.visibility{margin-right:10px}.customize-control-radiate-sortable ul.ui-sortable li.invisible{color:#aaa;border:1px dashed #aaa}.customize-control-radiate-sortable ul.ui-sortable li.invisible .dashicons.visibility{color:#aaa}.customize-control-radiate-toggle{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-toggle label{position:relative;display:inline-block;width:30px;height:16px;right:0;top:4px}.customize-control-radiate-toggle label.toggle-description{right:20px}.customize-control-radiate-toggle label input{display:none}.customize-control-radiate-toggle label input:checked+.switch:before{background:#fff;border-color:#fff;left:-6px;-webkit-transform:translateX(20px);transform:translateX(20px)}.customize-control-radiate-toggle label input:checked+.switch{background-color:#0073aa;border-color:#0073aa}.customize-control-radiate-toggle label .switch{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#fff;border:2px solid #444;border-radius:100px;-webkit-transition:all ease .3s;transition:all ease .3s}.customize-control-radiate-toggle label .switch:before{position:absolute;content:'';height:6px;width:6px;left:3px;bottom:1px;border:2px solid #444;background:#444;border-radius:100%;-webkit-transition:all ease .3s;transition:all ease .3s}.customize-control-radiate-typography .customize-control-content>div{margin-bottom:15px}.customize-control-radiate-typography .customize-control-content .font-size,.customize-control-radiate-typography .customize-control-content .line-height,.customize-control-radiate-typography .customize-control-content .letter-spacing{position:relative}.customize-control-radiate-typography .customize-control-content .control-wrap{display:-webkit-box;display:-ms-flexbox;display:flex}.customize-control-radiate-typography .customize-control-content .unit{background:#ebebeb;border-radius:0 2px 2px 0;font-weight:500;line-height:34px;padding:0 12px;text-transform:uppercase}.customize-control-radiate-typography .customize-control-content .font-style,.customize-control-radiate-typography .customize-control-content .font-family,.customize-control-radiate-typography .customize-control-content .font-weight,.customize-control-radiate-typography .customize-control-content .text-transform{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.customize-control-radiate-typography .customize-control-content .font-style .radiate-field-content,.customize-control-radiate-typography .customize-control-content .font-family .radiate-field-content,.customize-control-radiate-typography .customize-control-content .font-weight .radiate-field-content,.customize-control-radiate-typography .customize-control-content .text-transform .radiate-field-content{padding-top:2px;width:180px}span.select2-container.select2-container--default.select2-container--open{z-index:999999}.customize-control-radiate-title{border-bottom:1px solid #ebebeb;margin-top:15px}.customize-control-radiate-title:nth-child(2){margin-top:0}.radiate-title-wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.radiate-title-wrapper .dashicons-editor-help{color:rgba(68,68,68,0.5);margin-left:5px}.radiate-title-wrapper .dashicons-editor-help:hover{color:#444}.radiate-title-wrapper .guide-tutorial>span{border-right:1px solid #eee;padding:0 5px 0 8px}.radiate-title-wrapper .guide-tutorial>span:first-child,.radiate-title-wrapper .guide-tutorial>span:last-of-type{border-right:0;padding-right:0}.radiate-title-wrapper .guide-tutorial>span a{font-weight:500;text-decoration:none}.radiate-title-wrapper label.customizer-text{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}
\ No newline at end of file
diff --git a/inc/customizer/core/custom-controls/assets/css/selectWoo.css b/inc/customizer/core/custom-controls/assets/css/selectWoo.css
new file mode 100644
index 0000000..6b4d251
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/selectWoo.css
@@ -0,0 +1,484 @@
+.select2-container {
+ box-sizing: border-box;
+ display: inline-block;
+ margin: 0;
+ position: relative;
+ vertical-align: middle; }
+ .select2-container .select2-selection--single {
+ box-sizing: border-box;
+ cursor: pointer;
+ display: block;
+ height: 28px;
+ user-select: none;
+ -webkit-user-select: none; }
+ .select2-container .select2-selection--single .select2-selection__rendered {
+ display: block;
+ padding-left: 8px;
+ padding-right: 20px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap; }
+ .select2-container .select2-selection--single .select2-selection__clear {
+ position: relative; }
+ .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
+ padding-right: 8px;
+ padding-left: 20px; }
+ .select2-container .select2-selection--multiple {
+ box-sizing: border-box;
+ cursor: pointer;
+ display: block;
+ min-height: 32px;
+ user-select: none;
+ -webkit-user-select: none; }
+ .select2-container .select2-selection--multiple .select2-selection__rendered {
+ display: inline-block;
+ overflow: hidden;
+ padding-left: 8px;
+ text-overflow: ellipsis;
+ white-space: nowrap; }
+ .select2-container .select2-search--inline {
+ float: left; }
+ .select2-container .select2-search--inline .select2-search__field {
+ box-sizing: border-box;
+ border: none;
+ font-size: 100%;
+ margin-top: 5px;
+ padding: 0; }
+ .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
+ -webkit-appearance: none; }
+
+.select2-dropdown {
+ background-color: white;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ box-sizing: border-box;
+ display: block;
+ position: absolute;
+ left: -100000px;
+ width: 100%;
+ z-index: 1051; }
+
+.select2-results {
+ display: block; }
+
+.select2-results__options {
+ list-style: none;
+ margin: 0;
+ padding: 0; }
+
+.select2-results__option {
+ padding: 6px;
+ user-select: none;
+ -webkit-user-select: none; }
+ .select2-results__option[data-selected] {
+ cursor: pointer; }
+
+.select2-container--open .select2-dropdown {
+ left: 0; }
+
+.select2-container--open .select2-dropdown--above {
+ border-bottom: none;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0; }
+
+.select2-container--open .select2-dropdown--below {
+ border-top: none;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0; }
+
+.select2-search--dropdown {
+ display: block;
+ padding: 4px; }
+ .select2-search--dropdown .select2-search__field {
+ padding: 4px;
+ width: 100%;
+ box-sizing: border-box; }
+ .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
+ -webkit-appearance: none; }
+ .select2-search--dropdown.select2-search--hide {
+ display: none; }
+
+.select2-close-mask {
+ border: 0;
+ margin: 0;
+ padding: 0;
+ display: block;
+ position: fixed;
+ left: 0;
+ top: 0;
+ min-height: 100%;
+ min-width: 100%;
+ height: auto;
+ width: auto;
+ opacity: 0;
+ z-index: 99;
+ background-color: #fff;
+ filter: alpha(opacity=0); }
+
+.select2-hidden-accessible {
+ border: 0 !important;
+ clip: rect(0 0 0 0) !important;
+ height: 1px !important;
+ margin: -1px !important;
+ overflow: hidden !important;
+ padding: 0 !important;
+ position: absolute !important;
+ width: 1px !important; }
+
+.select2-container--default .select2-selection--single {
+ background-color: #fff;
+ border: 1px solid #aaa;
+ border-radius: 4px; }
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
+ color: #444;
+ line-height: 28px; }
+ .select2-container--default .select2-selection--single .select2-selection__clear {
+ cursor: pointer;
+ float: right;
+ font-weight: bold; }
+ .select2-container--default .select2-selection--single .select2-selection__placeholder {
+ color: #999; }
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
+ height: 26px;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 20px; }
+ .select2-container--default .select2-selection--single .select2-selection__arrow b {
+ border-color: #888 transparent transparent transparent;
+ border-style: solid;
+ border-width: 5px 4px 0 4px;
+ height: 0;
+ left: 50%;
+ margin-left: -4px;
+ margin-top: -2px;
+ position: absolute;
+ top: 50%;
+ width: 0; }
+
+.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
+ float: left; }
+
+.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
+ left: 1px;
+ right: auto; }
+
+.select2-container--default.select2-container--disabled .select2-selection--single {
+ background-color: #eee;
+ cursor: default; }
+ .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
+ display: none; }
+
+.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
+ border-color: transparent transparent #888 transparent;
+ border-width: 0 4px 5px 4px; }
+
+.select2-container--default .select2-selection--multiple {
+ background-color: white;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ cursor: text; }
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered {
+ box-sizing: border-box;
+ list-style: none;
+ margin: 0;
+ padding: 0 5px;
+ width: 100%; }
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
+ list-style: none; }
+ .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
+ color: #999;
+ margin-top: 5px;
+ float: left; }
+ .select2-container--default .select2-selection--multiple .select2-selection__clear {
+ cursor: pointer;
+ float: right;
+ font-weight: bold;
+ margin-top: 5px;
+ margin-right: 10px; }
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
+ background-color: #e4e4e4;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ cursor: default;
+ float: left;
+ margin-right: 5px;
+ margin-top: 5px;
+ padding: 0 5px; }
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
+ color: #999;
+ cursor: pointer;
+ display: inline-block;
+ font-weight: bold;
+ margin-right: 2px; }
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
+ color: #333; }
+
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
+ float: right; }
+
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
+ margin-left: 5px;
+ margin-right: auto; }
+
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
+ margin-left: 2px;
+ margin-right: auto; }
+
+.select2-container--default.select2-container--focus .select2-selection--multiple {
+ border: solid black 1px;
+ outline: 0; }
+
+.select2-container--default.select2-container--disabled .select2-selection--multiple {
+ background-color: #eee;
+ cursor: default; }
+
+.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
+ display: none; }
+
+.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
+ border-top-left-radius: 0;
+ border-top-right-radius: 0; }
+
+.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0; }
+
+.select2-container--default .select2-search--dropdown .select2-search__field {
+ border: 1px solid #aaa; }
+
+.select2-container--default .select2-search--inline .select2-search__field {
+ background: transparent;
+ border: none;
+ outline: 0;
+ box-shadow: none;
+ -webkit-appearance: textfield; }
+
+.select2-container--default .select2-results > .select2-results__options {
+ max-height: 200px;
+ overflow-y: auto; }
+
+.select2-container--default .select2-results__option[role=group] {
+ padding: 0; }
+
+.select2-container--default .select2-results__option[aria-disabled=true] {
+ color: #999; }
+
+.select2-container--default .select2-results__option[data-selected=true] {
+ background-color: #ddd; }
+
+.select2-container--default .select2-results__option .select2-results__option {
+ padding-left: 1em; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
+ padding-left: 0; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
+ margin-left: -1em;
+ padding-left: 2em; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
+ margin-left: -2em;
+ padding-left: 3em; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
+ margin-left: -3em;
+ padding-left: 4em; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
+ margin-left: -4em;
+ padding-left: 5em; }
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
+ margin-left: -5em;
+ padding-left: 6em; }
+
+.select2-container--default .select2-results__option--highlighted[data-selected] {
+ background-color: #5897fb;
+ color: white; }
+
+.select2-container--default .select2-results__group {
+ cursor: default;
+ display: block;
+ padding: 6px; }
+
+.select2-container--classic .select2-selection--single {
+ background-color: #f7f7f7;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ outline: 0;
+ background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
+ background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
+ background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
+ .select2-container--classic .select2-selection--single:focus {
+ border: 1px solid #5897fb; }
+ .select2-container--classic .select2-selection--single .select2-selection__rendered {
+ color: #444;
+ line-height: 28px; }
+ .select2-container--classic .select2-selection--single .select2-selection__clear {
+ cursor: pointer;
+ float: right;
+ font-weight: bold;
+ margin-right: 10px; }
+ .select2-container--classic .select2-selection--single .select2-selection__placeholder {
+ color: #999; }
+ .select2-container--classic .select2-selection--single .select2-selection__arrow {
+ background-color: #ddd;
+ border: none;
+ border-left: 1px solid #aaa;
+ border-top-right-radius: 4px;
+ border-bottom-right-radius: 4px;
+ height: 26px;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 20px;
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
+ background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
+ background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
+ .select2-container--classic .select2-selection--single .select2-selection__arrow b {
+ border-color: #888 transparent transparent transparent;
+ border-style: solid;
+ border-width: 5px 4px 0 4px;
+ height: 0;
+ left: 50%;
+ margin-left: -4px;
+ margin-top: -2px;
+ position: absolute;
+ top: 50%;
+ width: 0; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
+ float: left; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
+ border: none;
+ border-right: 1px solid #aaa;
+ border-radius: 0;
+ border-top-left-radius: 4px;
+ border-bottom-left-radius: 4px;
+ left: 1px;
+ right: auto; }
+
+.select2-container--classic.select2-container--open .select2-selection--single {
+ border: 1px solid #5897fb; }
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
+ background: transparent;
+ border: none; }
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
+ border-color: transparent transparent #888 transparent;
+ border-width: 0 4px 5px 4px; }
+
+.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
+ border-top: none;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
+ background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
+ background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
+
+.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
+ border-bottom: none;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
+ background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
+ background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
+
+.select2-container--classic .select2-selection--multiple {
+ background-color: white;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ cursor: text;
+ outline: 0; }
+ .select2-container--classic .select2-selection--multiple:focus {
+ border: 1px solid #5897fb; }
+ .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
+ list-style: none;
+ margin: 0;
+ padding: 0 5px; }
+ .select2-container--classic .select2-selection--multiple .select2-selection__clear {
+ display: none; }
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice {
+ background-color: #e4e4e4;
+ border: 1px solid #aaa;
+ border-radius: 4px;
+ cursor: default;
+ float: left;
+ margin-right: 5px;
+ margin-top: 5px;
+ padding: 0 5px; }
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
+ color: #888;
+ cursor: pointer;
+ display: inline-block;
+ font-weight: bold;
+ margin-right: 2px; }
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
+ color: #555; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
+ float: right; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
+ margin-left: 5px;
+ margin-right: auto; }
+
+.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
+ margin-left: 2px;
+ margin-right: auto; }
+
+.select2-container--classic.select2-container--open .select2-selection--multiple {
+ border: 1px solid #5897fb; }
+
+.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
+ border-top: none;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0; }
+
+.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
+ border-bottom: none;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0; }
+
+.select2-container--classic .select2-search--dropdown .select2-search__field {
+ border: 1px solid #aaa;
+ outline: 0; }
+
+.select2-container--classic .select2-search--inline .select2-search__field {
+ outline: 0;
+ box-shadow: none; }
+
+.select2-container--classic .select2-dropdown {
+ background-color: white;
+ border: 1px solid transparent; }
+
+.select2-container--classic .select2-dropdown--above {
+ border-bottom: none; }
+
+.select2-container--classic .select2-dropdown--below {
+ border-top: none; }
+
+.select2-container--classic .select2-results > .select2-results__options {
+ max-height: 200px;
+ overflow-y: auto; }
+
+.select2-container--classic .select2-results__option[role=group] {
+ padding: 0; }
+
+.select2-container--classic .select2-results__option[aria-disabled=true] {
+ color: grey; }
+
+.select2-container--classic .select2-results__option--highlighted[data-selected] {
+ background-color: #3875d7;
+ color: white; }
+
+.select2-container--classic .select2-results__group {
+ cursor: default;
+ display: block;
+ padding: 6px; }
+
+.select2-container--classic.select2-container--open .select2-dropdown {
+ border-color: #5897fb; }
diff --git a/inc/customizer/core/custom-controls/assets/css/selectWoo.min.css b/inc/customizer/core/custom-controls/assets/css/selectWoo.min.css
new file mode 100644
index 0000000..f777f94
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/css/selectWoo.min.css
@@ -0,0 +1 @@
+.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:0;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[data-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:0;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:0;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[data-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[data-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top,white 50%,#eee 100%);background-image:-o-linear-gradient(top,white 50%,#eee 100%);background-image:linear-gradient(to bottom,white 50%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:0;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFCCCCCC',GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:0;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:0}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:0;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top,white 0,#eee 50%);background-image:-o-linear-gradient(top,white 0,#eee 50%);background-image:linear-gradient(to bottom,white 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',endColorstr='#FFEEEEEE',GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top,#eee 50%,white 100%);background-image:-o-linear-gradient(top,#eee 50%,white 100%);background-image:linear-gradient(to bottom,#eee 50%,white 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',endColorstr='#FFFFFFFF',GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:0;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:0}.select2-container--classic .select2-dropdown--below{border-top:0}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[data-selected]{background-color:#3875d7;color:white}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
\ No newline at end of file
diff --git a/inc/customizer/core/custom-controls/assets/js/customize-controls.js b/inc/customizer/core/custom-controls/assets/js/customize-controls.js
new file mode 100644
index 0000000..9ded563
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/js/customize-controls.js
@@ -0,0 +1,2042 @@
+/**
+ * Radio buttonset control JS to handle the toggle of radio buttonsets.
+ *
+ * File `buttonset.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor[ 'radiate-buttonset' ] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Change the value.
+ this.container.on( 'click', 'input', function () {
+ control.setting.set( jQuery( this ).val() );
+ } );
+
+ }
+
+} );
+
+/**
+ * Background image control JS to handle the background customize option.
+ *
+ * File `background.js`.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ $( window ).on( 'load', function () {
+ $( 'html' ).addClass( 'colorpicker-ready' );
+ } );
+
+ wp.customize.controlConstructor['radiate-background'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Init background control.
+ control.initRadiateBackgroundControl();
+
+ },
+
+ initRadiateBackgroundControl : function () {
+
+ var control = this,
+ value = control.setting._value,
+ colorpicker = control.container.find( '.radiate-color-picker-alpha' );
+
+ // Hide unnecessary controls by default and show only when background image is set.
+ if ( _.isUndefined( value['background-image'] ) || '' === value['background-image'] ) {
+ control.container.find( '.customize-control-content > .background-repeat' ).hide();
+ control.container.find( '.customize-control-content > .background-position' ).hide();
+ control.container.find( '.customize-control-content > .background-size' ).hide();
+ control.container.find( '.customize-control-content > .background-attachment' ).hide();
+ }
+
+ // Background color setting.
+ colorpicker.wpColorPicker( {
+
+ change : function () {
+ if ( jQuery( 'html' ).hasClass( 'colorpicker-ready' ) ) {
+ setTimeout(
+ function () {
+ control.saveValue( 'background-color', colorpicker.val() );
+ },
+ 100
+ );
+ }
+ },
+
+ clear : function ( event ) {
+ var element = jQuery( event.target ).closest( '.wp-picker-input-wrap' ).find( '.wp-color-picker' )[0];
+
+ if ( element ) {
+ control.saveValue( 'background-color', '' );
+ }
+ }
+
+ } );
+
+ // Background image setting.
+ control.container.on( 'click', '.background-image-upload-button, .thumbnail-image img', function ( e ) {
+ var image = wp.media( { multiple : false } ).open().on( 'select', function () {
+
+ // This will return the selected image from the Media Uploader, the result is an object.
+ var uploadedImage = image.state().get( 'selection' ).first(),
+ previewImage = uploadedImage.toJSON().sizes.full.url,
+ imageUrl,
+ imageID,
+ imageWidth,
+ imageHeight,
+ preview,
+ removeButton;
+
+ if ( ! _.isUndefined( uploadedImage.toJSON().sizes.medium ) ) {
+ previewImage = uploadedImage.toJSON().sizes.medium.url;
+ } else if ( ! _.isUndefined( uploadedImage.toJSON().sizes.thumbnail ) ) {
+ previewImage = uploadedImage.toJSON().sizes.thumbnail.url;
+ }
+
+ imageUrl = uploadedImage.toJSON().sizes.full.url;
+ imageID = uploadedImage.toJSON().id;
+ imageWidth = uploadedImage.toJSON().width;
+ imageHeight = uploadedImage.toJSON().height;
+
+ // Show extra controls if the value has an image.
+ if ( '' !== imageUrl ) {
+ control.container.find( '.customize-control-content > .background-repeat, .customize-control-content > .background-position, .customize-control-content > .background-size, .customize-control-content > .background-attachment' ).show();
+ }
+
+ control.saveValue( 'background-image', imageUrl );
+ preview = control.container.find( '.placeholder, .thumbnail' );
+ removeButton = control.container.find( '.background-image-upload-remove-button' );
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '' );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.show();
+ }
+ } );
+
+ e.preventDefault();
+ } );
+
+ control.container.on( 'click', '.background-image-upload-remove-button', function ( e ) {
+
+ var preview,
+ removeButton;
+
+ e.preventDefault();
+
+ control.saveValue( 'background-image', '' );
+
+ preview = control.container.find( '.placeholder, .thumbnail' );
+ removeButton = control.container.find( '.background-image-upload-remove-button' );
+
+ // Hide unnecessary controls.
+ control.container.find( '.customize-control-content > .background-repeat' ).hide();
+ control.container.find( '.customize-control-content > .background-position' ).hide();
+ control.container.find( '.customize-control-content > .background-size' ).hide();
+ control.container.find( '.customize-control-content > .background-attachment' ).hide();
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'placeholder' ).html( RadiateCustomizerControlBackground.placeholder );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.hide();
+ }
+ } );
+
+ // Background repeat setting.
+ control.container.on( 'change', '.background-repeat select', function () {
+ control.saveValue( 'background-repeat', jQuery( this ).val() );
+ } );
+
+ // Background position setting.
+ control.container.on( 'change', '.background-position select', function () {
+ control.saveValue( 'background-position', jQuery( this ).val() );
+ } );
+
+ // Background size setting.
+ control.container.on( 'change', '.background-size select', function () {
+ control.saveValue( 'background-size', jQuery( this ).val() );
+ } );
+
+ // Background attachment setting.
+ control.container.on( 'change', '.background-attachment select', function () {
+ control.saveValue( 'background-attachment', jQuery( this ).val() );
+ } );
+
+ },
+
+ /**
+ * Saves the value.
+ */
+ saveValue : function ( property, value ) {
+
+ var control = this,
+ input = jQuery( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .background-hidden-value' ),
+ val = control.setting._value;
+
+ val[property] = value;
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ }
+
+ } );
+
+ }
+)( jQuery );
+
+/**
+ * Color picker control JS to handle color picker rendering within customize control.
+ *
+ * File `color.js`.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ $( window ).on( 'load', function () {
+ $( 'html' ).addClass( 'colorpicker-ready' );
+ } );
+
+ wp.customize.controlConstructor[ 'radiate-color' ] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ this.container.find( '.radiate-color-picker-alpha' ).wpColorPicker( {
+
+ change : function ( event, ui ) {
+ var color = ui.color.toString();
+
+ if ( jQuery( 'html' ).hasClass( 'colorpicker-ready' ) ) {
+ control.setting.set( color );
+ }
+ }
+
+ } );
+
+ }
+
+ } );
+
+ }
+)( jQuery );
+
+/**
+ * Dropdown categories control JS to handle the dropdown categories customize control.
+ *
+ * File `dropdown-categorie.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor[ 'radiate-dropdown-categories' ] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Change the value.
+ this.container.on( 'change', 'select', function () {
+ control.setting.set( jQuery( this ).val() );
+ } );
+
+ }
+
+} );
+
+/**
+ * Editor control JS to handle the editor rendering within customize control.
+ *
+ * File `editor.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor[ 'radiate-editor' ] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this,
+ id = 'editor_' + control.id;
+
+ wp.editor.initialize( id, {
+ tinymce : {
+ wpautop : true
+ },
+ quicktags : true,
+ mediaButtons : true
+ } );
+
+ },
+
+ onChangeActive : function ( active, args ) {
+
+ 'use strict';
+
+ var control = this,
+ id = 'editor_' + control.id,
+ element = control.container.find( 'textarea' ),
+ editor;
+
+ editor = tinyMCE.get( id );
+
+ if ( editor ) {
+
+ editor.onChange.add( function ( ed ) {
+ var content;
+
+ ed.save();
+ content = editor.getContent();
+ element.val( content ).trigger( 'change' );
+ wp.customize.instance( control.id ).set( content );
+ } );
+
+ }
+
+ }
+
+} );
+
+/**
+ * Group control JS to handle the group customize option.
+ *
+ * File `group.js`.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ wp.customize.controlConstructor['radiate-group'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ control.registerToggleEvents();
+ this.container.on( 'radiate_settings_changed', control.onOptionChange );
+
+ },
+
+ registerToggleEvents : function () {
+
+ var control = this;
+
+ /* Close popup when click outside on customize sidebar area */
+ $( '.wp-full-overlay-sidebar-content' ).click(
+ function ( e ) {
+ if ( ! $( e.target ).closest( '.radiate-field-settings-modal' ).length ) {
+ $( '.radiate-group-toggle-icon.open' ).trigger( 'click' );
+ }
+ }
+ );
+
+ control.container.on(
+ 'click',
+ '.radiate-group-wrap .radiate-group-toggle-icon',
+ function ( e ) {
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ var $this = $( this ),
+ parent_wrap = $this.closest( '.customize-control-radiate-group' ),
+ is_loaded = parent_wrap.find( '.radiate-field-settings-modal' ).data( 'loaded' ),
+ parent_section = parent_wrap.parents( '.control-section' );
+
+ if ( $this.hasClass( 'open' ) ) {
+ parent_wrap.find( '.radiate-field-settings-modal' ).hide();
+ } else {
+
+ /* Close popup when another popup is clicked */
+ var get_open_popup = parent_section.find( '.radiate-group-toggle-icon.open' );
+ if ( get_open_popup.length > 0 ) {
+ get_open_popup.trigger( 'click' );
+ }
+
+ if ( is_loaded ) {
+ parent_wrap.find( '.radiate-field-settings-modal' ).show();
+ } else {
+
+ var fields = control.params.radiate_fields,
+ modal_wrap = $( RadiateCustomizerControlGroup.group_modal_tmpl ),
+ device = $( '#customize-footer-actions .active' ).attr( 'data-device' );
+
+ parent_wrap.find( '.radiate-field-settings-wrap' ).append( modal_wrap );
+ parent_wrap.find( '.radiate-fields-wrap' ).attr( 'data-control', control.params.name );
+ control.radiate_render_field( parent_wrap, fields, control );
+ parent_wrap.find( '.radiate-field-settings-modal' ).show();
+
+ if ( 'mobile' === device ) {
+ $( '.control-wrap.mobile' ).addClass( 'active' );
+ $( '.responsive-switchers .preview-mobile' ).addClass( 'active' );
+
+ $( '.control-wrap.tablet, .control-wrap.desktop' ).removeClass( 'active' );
+ $( '.responsive-switchers .preview-tablet, .responsive-switchers .preview-desktop' ).removeClass( 'active' );
+ } else if ( 'tablet' === device ) {
+ $( '.control-wrap.tablet' ).addClass( 'active' );
+ $( '.responsive-switchers .preview-tablet' ).addClass( 'active' );
+
+ $( '.control-wrap.mobile, .control-wrap.desktop' ).removeClass( 'active' );
+ $( '.responsive-switchers .preview-mobile, .responsive-switchers .preview-desktop' ).removeClass( 'active' );
+ } else {
+ $( '.control-wrap.desktop' ).addClass( 'active' );
+ $( '.responsive-switchers .preview-desktop' ).addClass( 'active' );
+
+ $( '.control-wrap.mobile, .control-wrap.tablet' ).removeClass( 'active' );
+ $( '.responsive-switchers .preview-mobile, .responsive-switchers .preview-tablet' ).removeClass( 'active' );
+ }
+
+ }
+
+ }
+
+ $this.toggleClass( 'open' );
+
+ }
+ );
+
+ control.container.on(
+ 'click',
+ '.radiate-group-wrap > .customizer-text',
+ function ( e ) {
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ $( this ).find( '.radiate-group-toggle-icon' ).trigger( 'click' );
+
+ }
+ );
+
+ },
+
+ radiate_render_field : function ( wrap, fields, control_element ) {
+
+ var control = this;
+ var radiate_field_wrap = wrap.find( '.radiate-fields-wrap' );
+ var fields_html = '';
+ var control_types = [];
+ var field_values = control.isJSONString( control_element.params.value ) ? JSON.parse( control_element.params.value ) : {};
+
+ if ( 'undefined' != typeof fields.tabs ) {
+
+ var counter = 0;
+ fields_html += '';
+
+ fields_html += '
';
+ _.each(
+ fields.tabs,
+ function ( value, key ) {
+ var li_class = '';
+
+ if ( 0 === counter ) {
+ li_class = "active";
+ }
+
+ fields_html += '- ' + key + '
';
+ counter ++;
+ }
+ );
+ fields_html += '
';
+
+ fields_html += '
';
+ _.each(
+ fields.tabs,
+ function ( fields_data, key ) {
+
+ var result = control.generateFieldHtml( fields_data, field_values );
+
+ fields_html += '
';
+ fields_html += result.html;
+
+ _.each(
+ result.controls,
+ function ( control_value, control_key ) {
+ control_types.push(
+ {
+ key : control_value.key,
+ value : control_value.value,
+ name : control_value.name
+ }
+ );
+ }
+ );
+
+ fields_html += '
';
+
+ }
+ );
+ fields_html += '
';
+
+ fields_html += '
';
+
+ radiate_field_wrap.html( fields_html );
+
+ $( '#' + control_element.params.name + '-tabs' ).tabs();
+
+ } else {
+
+ var result = control.generateFieldHtml( fields, field_values );
+
+ fields_html += result.html;
+
+ _.each(
+ result.controls,
+ function ( control_value, control_key ) {
+ control_types.push(
+ {
+ key : control_value.key,
+ value : control_value.value,
+ name : control_value.name
+ }
+ );
+ }
+ );
+
+ radiate_field_wrap.html( fields_html );
+
+ }
+
+ _.each(
+ control_types,
+ function ( control_type, index ) {
+
+ switch ( control_type.key ) {
+
+ case 'radiate-color':
+ control.initColorControl( radiate_field_wrap, control_element, control_type.name );
+ break;
+
+ case 'radiate-background':
+ control.initBackgroundControl( control_element, control_type, control_type.name );
+ break;
+
+ case 'radiate-typography':
+ control.initTypographyControl( control_element, control_type, control_type.name );
+ break;
+
+ }
+
+ }
+ );
+
+ wrap.find( '.radiate-field-settings-modal' ).data( 'loaded', true );
+
+ },
+
+ isJSONString : function ( string ) {
+
+ try {
+ JSON.parse( string );
+ } catch ( e ) {
+ return false;
+ }
+
+ return true;
+
+ },
+
+ generateFieldHtml : function ( fields_data, field_values ) {
+
+ var fields_html = '';
+ var control_types = [];
+
+ _.each(
+ fields_data,
+ function ( attr, index ) {
+
+ var new_value = (
+ wp.customize.control( attr.name ) ? wp.customize.control( attr.name ).params.value : ''
+ ),
+ control = attr.control,
+ template_id = 'customize-control-' + control + '-content',
+ template = wp.template( template_id ),
+ value = new_value || attr.default,
+ dataAtts = '',
+ input_attrs = '';
+
+ attr.value = value;
+ attr.title = attr.label;
+
+ // Data attributes.
+ _.each(
+ attr.data_attrs,
+ function ( value, name ) {
+ dataAtts += ' data-' + name + ' ="' + value + '"';
+ }
+ );
+
+ // Input attributes.
+ _.each(
+ attr.input_attrs,
+ function ( value, name ) {
+ input_attrs += name + ' ="' + value + '"';
+ }
+ );
+
+ attr.dataAttrs = dataAtts;
+ attr.inputAttrs = input_attrs;
+
+ control_types.push(
+ {
+ key : control,
+ value : value,
+ name : attr.name
+ }
+ );
+
+ var responsive_switchers = '',
+ controlsType = [
+ 'radiate-typography'
+ ];
+
+ if ( (
+ 'radiate-typography' === attr.control
+ ) && controlsType.includes( attr.control ) ) {
+ attr.languages = RadiateCustomizerControlTypographySubsets;
+ }
+
+ if ( controlsType.includes( attr.control ) ) {
+ responsive_switchers = 'has-responsive-switchers';
+ }
+
+ fields_html += '';
+ fields_html += template( attr );
+ fields_html += '';
+
+ }
+ );
+
+ var result = new Object();
+
+ result.controls = control_types;
+ result.html = fields_html;
+
+ return result;
+
+ },
+
+ onOptionChange : function ( e, control, element, value, name ) {
+
+ var control_id = $( '.hidden-field-' + name );
+ control_id.val( value );
+
+ var sub_control = wp.customize.control( name );
+ sub_control.setting.set( value );
+
+ },
+
+ initColorControl : function ( wrap, control_elem, name ) {
+
+ var control = this;
+ var colorpicker = wrap.find( '.customize-control-radiate-color .radiate-color-picker-alpha' );
+
+ colorpicker.wpColorPicker(
+ {
+ change : function ( event, ui ) {
+
+ if ( 'undefined' != typeof event.originalEvent || 'undefined' != typeof ui.color._alpha ) {
+ var element = $( event.target ).closest( '.wp-picker-input-wrap' ).find( '.wp-color-picker' )[0];
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ $( element ).val( ui.color.toString() );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ $( element ),
+ ui.color.toString(),
+ name
+ ]
+ );
+ }
+
+ },
+
+ clear : function ( event ) {
+
+ var element = $( event.target ).closest( '.wp-picker-input-wrap' ).find( '.wp-color-picker' )[0];
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ $( element ).val( '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ $( element ),
+ '',
+ name
+ ]
+ );
+
+ wp.customize.previewer.refresh();
+
+ }
+ }
+ );
+ },
+
+ initBackgroundControl : function ( control, control_atts, name ) {
+
+ var input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .background-hidden-value' ),
+ value = JSON.parse( input.val() ),
+ control_name = control_atts.name,
+ colorpicker = control.container.find( '.radiate-color-picker-alpha' ),
+ controlContainer = control.container.find( '#customize-control-' + control_name );
+
+ // Hide unnecessary controls if the value doesn't have an image.
+ if ( _.isUndefined( value['background-image'] ) || '' === value['background-image'] ) {
+ controlContainer.find( '.customize-control-content > .background-repeat' ).hide();
+ controlContainer.find( '.customize-control-content > .background-position' ).hide();
+ controlContainer.find( '.customize-control-content > .background-size' ).hide();
+ controlContainer.find( '.customize-control-content > .background-attachment' ).hide();
+ }
+
+ // Background color setting.
+ colorpicker.wpColorPicker(
+ {
+ change : function () {
+
+ if ( $( 'html' ).hasClass( 'colorpicker-ready' ) ) {
+ var $this = $( this );
+
+ setTimeout(
+ function () {
+ control.saveBackgroundValue( 'background-color', colorpicker.val(), $this, name );
+ },
+ 100
+ );
+ }
+
+ },
+
+ clear : function ( event ) {
+
+ var element = $( event.target ).closest( '.wp-picker-input-wrap' ).find( '.wp-color-picker' )[0];
+
+ if ( element ) {
+ control.saveBackgroundValue( 'background-color', '', $( element ), name );
+ }
+
+ wp.customize.previewer.refresh();
+
+ }
+ }
+ );
+
+ // Background image setting..
+ controlContainer.on( 'click', '.background-image-upload-button, .thumbnail-image img', function ( e ) {
+ var upload_img_btn = $( this );
+ var image = wp.media( { multiple : false } ).open().on( 'select', function () {
+
+ // This will return the selected image from the Media Uploader, the result is an object.
+ var uploadedImage = image.state().get( 'selection' ).first(),
+ previewImage = uploadedImage.toJSON().sizes.full.url,
+ imageUrl,
+ imageID,
+ imageWidth,
+ imageHeight,
+ preview,
+ removeButton;
+
+ if ( ! _.isUndefined( uploadedImage.toJSON().sizes.medium ) ) {
+ previewImage = uploadedImage.toJSON().sizes.medium.url;
+ } else if ( ! _.isUndefined( uploadedImage.toJSON().sizes.thumbnail ) ) {
+ previewImage = uploadedImage.toJSON().sizes.thumbnail.url;
+ }
+
+ imageUrl = uploadedImage.toJSON().sizes.full.url;
+ imageID = uploadedImage.toJSON().id;
+ imageWidth = uploadedImage.toJSON().width;
+ imageHeight = uploadedImage.toJSON().height;
+
+ // Show extra controls if the value has an image.
+ if ( '' !== imageUrl ) {
+ controlContainer.find( '.customize-control-content > .background-repeat, .customize-control-content > .background-position, .customize-control-content > .background-size, .customize-control-content > .background-attachment' ).show();
+ }
+
+ control.saveBackgroundValue( 'background-image', imageUrl, upload_img_btn, name );
+ preview = controlContainer.find( '.placeholder, .thumbnail' );
+ removeButton = controlContainer.find( '.background-image-upload-remove-button' );
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '' );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.show();
+ }
+ } );
+
+ e.preventDefault();
+ } );
+
+ controlContainer.on( 'click', '.background-image-upload-remove-button', function ( e ) {
+
+ var preview,
+ removeButton;
+
+ e.preventDefault();
+
+ control.saveBackgroundValue( 'background-image', '', $( this ) );
+
+ preview = controlContainer.find( '.placeholder, .thumbnail' );
+ removeButton = controlContainer.find( '.background-image-upload-remove-button' );
+
+ // Hide unnecessary controls.
+ controlContainer.find( '.customize-control-content > .background-repeat' ).hide();
+ controlContainer.find( '.customize-control-content > .background-position' ).hide();
+ controlContainer.find( '.customize-control-content > .background-size' ).hide();
+ controlContainer.find( '.customize-control-content > .background-attachment' ).hide();
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'placeholder' ).html( RadiateCustomizerControlBackground.placeholder );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.hide();
+ }
+ } );
+
+ // Background repeat setting.
+ controlContainer.on( 'change', '.background-repeat select', function () {
+ control.saveBackgroundValue( 'background-repeat', $( this ).val(), $( this ), name );
+ } );
+
+ // Background position setting.
+ controlContainer.on( 'change', '.background-position select', function () {
+ control.saveBackgroundValue( 'background-position', $( this ).val(), $( this ), name );
+ } );
+
+ // Background size setting.
+ controlContainer.on( 'change', '.background-size select', function () {
+ control.saveBackgroundValue( 'background-size', $( this ).val(), $( this ), name );
+ } );
+
+ // Background attachment setting.
+ controlContainer.on( 'change', '.background-attachment select', function () {
+ control.saveBackgroundValue( 'background-attachment', $( this ).val(), $( this ), name );
+ } );
+
+ },
+
+ saveBackgroundValue : function ( property, value, element, name ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .background-hidden-value' ),
+ val = JSON.parse( input.val() );
+
+ val[property] = value;
+
+ $( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ element,
+ val,
+ name
+ ]
+ );
+
+ },
+
+ initTypographyControl : function ( control, control_atts, name ) {
+
+ var value = control.setting._value,
+ control_name = control_atts.name,
+ controlContainer = control.container.find( '#customize-control-' + control_name );
+
+ // On customizer load, render the available font options.
+ control.renderTypographyFontSelector( $( this ), name, control_atts );
+ control.renderTypographyVariantSelector( $( this ), name, control_atts );
+ control.renderTypographySubsetSelector( $( this ), name, control_atts );
+
+ // Font style setting.
+ controlContainer.on( 'change', '.font-style select', function () {
+ control.saveTypographyValue( 'font-style', $( this ).val(), $( this ), name );
+ } );
+
+ // Text transform setting.
+ controlContainer.on( 'change', '.text-transform select', function () {
+ control.saveTypographyValue( 'text-transform', $( this ).val(), $( this ), name );
+ } );
+
+ // Text decoration setting.
+ controlContainer.on( 'change', '.text-decoration select', function () {
+ control.saveTypographyValue( 'text-decoration', $( this ).val(), $( this ), name );
+ } );
+
+ // Font size setting.
+ controlContainer.on( 'change keyup paste input', '.font-size input', function () {
+ control.saveTypographyFontSize( $( this ), name, control_atts );
+ } );
+
+ // Line height setting.
+ controlContainer.on( 'change keyup paste input', '.line-height input', function () {
+ control.saveTypographyLineHeight( $( this ), name, control_atts );
+ } );
+
+ // Letter spacing setting.
+ controlContainer.on( 'change keyup paste input', '.letter-spacing input', function () {
+ control.saveTypographyLetterSpacing( $( this ), name, control_atts );
+ } );
+
+ },
+
+ renderTypographyFontSelector : function ( element, name, control_atts ) {
+
+ var control = this,
+ selector = control.selector + ' .font-family select',
+ standardFonts = [],
+ googleFonts = [],
+ customFonts = [],
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ value = JSON.parse( input.val() ),
+ fonts = control.getTypographyFonts(),
+ fontSelect;
+
+ // Format standard fonts as an array.
+ if ( ! _.isUndefined( fonts.standard ) ) {
+ _.each(
+ fonts.standard,
+ function ( font ) {
+ standardFonts.push(
+ {
+ id : font.family.replace( /"/g, ''' ),
+ text : font.label
+ }
+ );
+ }
+ );
+ }
+
+ // Format Google fonts as an array.
+ if ( ! _.isUndefined( fonts.google ) ) {
+ _.each(
+ fonts.google,
+ function ( font ) {
+ googleFonts.push(
+ {
+ id : font.family,
+ text : font.label
+ }
+ );
+ }
+ );
+ }
+
+ // Combine fonts and build the final data.
+ data = [
+ {
+ text : fonts.standardfontslabel,
+ children : standardFonts
+ },
+ {
+ text : fonts.googlefontslabel,
+ children : googleFonts
+ }
+ ];
+
+ // Format custom fonts as an array.
+ if ( ! _.isUndefined( fonts.custom ) ) {
+ _.each(
+ fonts.custom,
+ function ( font ) {
+ customFonts.push(
+ {
+ id : font.family,
+ text : font.label
+ }
+ );
+ }
+ );
+
+ // Merge on `data` array.
+ data.push(
+ {
+ text : fonts.customfontslabel,
+ children : customFonts
+ }
+ );
+ }
+
+ // Instantiate selectWoo with the data.
+ fontSelect = $( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ // Set the initial value.
+ if ( value['font-family'] ) {
+ fontSelect.val( value['font-family'].replace( /'/g, '"' ) ).trigger( 'change' );
+ }
+
+ // When the font option value changes.
+ fontSelect.on(
+ 'change',
+ function () {
+
+ // Set the value.
+ control.saveTypographyValue( 'font-family', $( this ).val(), $( this ), name );
+
+ // Render new list of selected font options.
+ control.renderTypographyVariantSelector( $( this ), name, control_atts );
+ control.renderTypographySubsetSelector( $( this ), name, control_atts );
+
+ }
+ );
+
+ },
+
+ getTypographyFonts : function () {
+
+ var control = this;
+
+ if ( ! _.isUndefined( RadiateCustomizerControlTypography ) ) {
+ return RadiateCustomizerControlTypography;
+ }
+
+ return {
+ google : [],
+ standard : []
+ };
+
+ },
+
+ renderTypographyVariantSelector : function ( element, name, control_atts ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ value = JSON.parse( input.val() ),
+ fontFamily = value['font-family'],
+ variants = control.getTypographyVariants( fontFamily ),
+ selector = control.selector + ' .font-weight select',
+ data = [],
+ isValid = false,
+ variantSelector;
+
+ if ( false !== variants ) {
+
+ $( control.selector + ' .font-weight' ).show();
+ _.each(
+ variants,
+ function ( variant ) {
+ if ( value['font-weight'] === variant.id ) {
+ isValid = true;
+ }
+
+ data.push(
+ {
+ id : variant.id,
+ text : variant.label
+ }
+ );
+ }
+ );
+
+ if ( ! isValid ) {
+ value['font-weight'] = 'regular';
+ }
+
+ if ( $( selector ).hasClass( 'select2-hidden-accessible' ) ) {
+ $( selector ).selectWoo( 'destroy' );
+ $( selector ).empty();
+ }
+
+ // Instantiate selectWoo with the data.
+ variantSelector = $( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ variantSelector.val( value['font-weight'] ).trigger( 'change' );
+ variantSelector.on(
+ 'change',
+ function () {
+ control.saveTypographyValue( 'font-weight', $( this ).val(), $( this ), name );
+ }
+ );
+
+ } else {
+
+ $( control.selector + ' .font-weight' ).hide();
+
+ }
+
+ },
+
+ getTypographyVariants : function ( fontFamily ) {
+
+ var control = this,
+ fonts = control.getTypographyFonts();
+
+ var variants = false;
+ _.each(
+ fonts.standard,
+ function ( font ) {
+ if ( fontFamily && font.family === fontFamily.replace( /'/g, '"' ) ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+
+ _.each(
+ fonts.google,
+ function ( font ) {
+ if ( font.family === fontFamily ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+
+ // For custom fonts.
+ if ( ! _.isUndefined( fonts.custom ) ) {
+ _.each(
+ fonts.custom,
+ function ( font ) {
+ if ( font.custom === fontFamily ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+ }
+
+ return variants;
+
+ },
+
+ renderTypographySubsetSelector : function ( element, name, control_atts ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ value = JSON.parse( input.val() ),
+ fontFamily = value['font-family'],
+ subsets = control.getTypographySubsets( fontFamily ),
+ selector = control.selector + ' .subsets select',
+ data = [],
+ validValue = value.subsets,
+ subsetSelector;
+
+ if ( false !== subsets ) {
+
+ $( control.selector + ' .subsets' ).show();
+ _.each(
+ subsets,
+ function ( subset ) {
+ if ( _.isObject( validValue ) ) {
+ if ( - 1 === validValue.indexOf( subset.id ) ) {
+ validValue = _.reject(
+ validValue,
+ function ( subValue ) {
+ return subValue === subset.id;
+ }
+ );
+ }
+ }
+
+ data.push(
+ {
+ id : subset.id,
+ text : subset.label
+ }
+ );
+ }
+ );
+
+ } else {
+
+ $( control.selector + ' .subsets' ).hide();
+
+ }
+
+ if ( $( selector ).hasClass( 'select2-hidden-accessible' ) ) {
+ $( selector ).selectWoo( 'destroy' );
+ $( selector ).empty();
+ }
+
+ // Instantiate selectWoo with the data.
+ subsetSelector = $( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ subsetSelector.val( validValue ).trigger( 'change' );
+ subsetSelector.on(
+ 'change',
+ function () {
+ control.saveTypographyValue( 'subsets', $( this ).val(), $( this ), name );
+ }
+ );
+
+ },
+
+ getTypographySubsets : function ( fontFamily ) {
+
+ var control = this,
+ subsets = false,
+ fonts = control.getTypographyFonts();
+
+ _.each(
+ fonts.google,
+ function ( font ) {
+ if ( font.family === fontFamily ) {
+ subsets = font.subsets;
+
+ return subsets;
+ }
+ }
+ );
+
+ return subsets;
+
+ },
+
+ saveTypographyFontSize : function ( element, name, control_atts ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ val = JSON.parse( input.val() ),
+ control_name = control_atts.name,
+ controlContainer = control.container.find( '#customize-control-' + control_name ),
+ newValue = {
+ 'font-size' : {}
+ };
+
+ controlContainer.find( '.font-size .control-wrap' ).each(
+ function () {
+ var controlValue = $( this ).find( 'input' ).val();
+ var device = $( this ).find( 'input' ).data( 'device' );
+
+ newValue['font-size'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ $.extend( val, newValue );
+
+ $( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ element,
+ val,
+ name
+ ]
+ );
+
+ },
+
+ saveTypographyLineHeight : function ( element, name, control_atts ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ val = JSON.parse( input.val() ),
+ control_name = control_atts.name,
+ controlContainer = control.container.find( '#customize-control-' + control_name ),
+ newValue = {
+ 'line-height' : {}
+ };
+
+ controlContainer.find( '.line-height .control-wrap' ).each(
+ function () {
+ var controlValue = $( this ).find( 'input' ).val();
+ var device = $( this ).find( 'input' ).data( 'device' );
+
+ newValue['line-height'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ $.extend( val, newValue );
+
+ $( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ element,
+ val,
+ name
+ ]
+ );
+
+ },
+
+ saveTypographyLetterSpacing : function ( element, name, control_atts ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ val = JSON.parse( input.val() ),
+ control_name = control_atts.name,
+ controlContainer = control.container.find( '#customize-control-' + control_name ),
+ newValue = {
+ 'letter-spacing' : {}
+ };
+
+ controlContainer.find( '.letter-spacing .control-wrap' ).each(
+ function () {
+ var controlValue = $( this ).find( 'input' ).val();
+ var device = $( this ).find( 'input' ).data( 'device' );
+
+ newValue['letter-spacing'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ $.extend( val, newValue );
+
+ $( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ element,
+ val,
+ name
+ ]
+ );
+
+ },
+
+ saveTypographyValue : function ( property, value, element, name ) {
+
+ var control = this,
+ input = $( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .typography-hidden-value' ),
+ val = JSON.parse( input.val() );
+
+ val[property] = value;
+
+ $( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+
+ name = $( element ).parents( '.customize-control' ).attr( 'id' );
+ name = name.replace( 'customize-control-', '' );
+
+ control.container.trigger(
+ 'radiate_settings_changed',
+ [
+ control,
+ element,
+ val,
+ name
+ ]
+ );
+
+ },
+
+ } );
+
+ }
+)( jQuery );
+
+/**
+ * Radio image control JS to handle the toggle of radio images.
+ *
+ * File `radio-image.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor[ 'radiate-radio-image' ] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Change the value.
+ this.container.on( 'click', 'input', function () {
+ control.setting.set( jQuery( this ).val() );
+ } );
+
+ }
+
+} );
+
+/**
+ * Background image control JS to handle the navigate customize option.
+ *
+ * File `navigate.js`.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ $( window ).on( 'load', function () {
+
+ $( '.tg-navigate a' ).on( 'click', function ( e ) {
+ e.preventDefault();
+
+ var targetSection = $( this ).data( 'section' );
+
+ if ( targetSection ) {
+ wp.customize.section( targetSection ).focus();
+ }
+ } );
+
+ } );
+ }
+)( jQuery );
+
+/**
+ * Slider control JS to handle the range of the inputs.
+ *
+ * File `slider.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor['radiate-slider'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Update the text value.
+ this.container.find( 'input[type=range]' ).on( 'input change', function () {
+ var value = jQuery( this ).val(),
+ input_number = jQuery( this ).closest( '.slider-wrapper' ).find( '.radiate-range-value .value' );
+
+ input_number.val( value );
+ input_number.change();
+ } );
+
+ // Handle the reset button.
+ this.container.find( '.radiate-slider-reset' ).click( function () {
+ var wrapper = jQuery( this ).closest( '.slider-wrapper' ),
+ input_range = wrapper.find( 'input[type=range]' ),
+ input_number = wrapper.find( '.radiate-range-value .value' ),
+ default_value = input_range.data( 'reset_value' );
+
+ input_range.val( default_value );
+ input_number.val( default_value );
+ input_number.change();
+ } );
+
+ // Save changes.
+ this.container.on( 'input change', 'input[type=number]', function () {
+ var value = jQuery( this ).val();
+ jQuery( this ).closest( '.slider-wrapper' ).find( 'input[type=range]' ).val( value );
+ control.setting.set( value );
+ } );
+
+ }
+
+} );
+
+/**
+ * Sortable control JS to handle the sortable feature of custom customize controls.
+ *
+ * File `sortable.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor['radiate-sortable'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Set the sortable container.
+ control.sortableContainer = control.container.find( 'ul.sortable' ).first();
+
+ // Init sortable.
+ control.sortableContainer.sortable(
+ {
+ // Update value when we stop sorting.
+ stop : function () {
+ control.updateValue();
+ }
+ }
+ ).disableSelection().find( 'li' ).each(
+ function () {
+ // Enable/disable options when we click on the eye of Thundera.
+ jQuery( this ).find( 'i.visibility' ).click(
+ function () {
+ jQuery( this ).toggleClass( 'dashicons-visibility-faint' ).parents( 'li:eq(0)' ).toggleClass( 'invisible' );
+ }
+ );
+ }
+ ).click(
+ function () {
+ // Update value on click.
+ control.updateValue();
+ }
+ );
+
+ },
+
+ updateValue : function () {
+
+ 'use strict';
+
+ var control = this,
+ newValue = [];
+
+ this.sortableContainer.find( 'li' ).each(
+ function () {
+ if ( ! jQuery( this ).is( '.invisible' ) ) {
+ newValue.push( jQuery( this ).data( 'value' ) );
+ }
+ }
+ );
+
+ control.setting.set( newValue );
+
+ }
+
+} );
+
+/**
+ * Switch toggle control JS to handle the toggle of custom customize controls.
+ *
+ * File `toggle.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor['radiate-toggle'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this,
+ value = control.setting._value;
+
+ // Save the value.
+ this.container.on( 'change', 'input', function () {
+ value = jQuery( this ).is( ':checked' ) ? true : false;
+
+ control.setting.set( value );
+ } );
+
+ }
+
+} );
+
+/**
+ * Typography control JS to handle the typography customize option.
+ *
+ * File `typography.js`.
+ *
+ * @package Radiate
+ */
+wp.customize.controlConstructor['radiate-typography'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // On customizer load, render the available font options.
+ control.renderFontSelector();
+ control.renderVariantSelector();
+ control.renderSubsetSelector();
+
+ // Font style setting.
+ control.container.on( 'change', '.font-style select', function () {
+ control.saveValue( 'font-style', jQuery( this ).val() );
+ } );
+
+ // Text transform setting.
+ control.container.on( 'change', '.text-transform select', function () {
+ control.saveValue( 'text-transform', jQuery( this ).val() );
+ } );
+
+ // Text decoration setting.
+ control.container.on( 'change', '.text-decoration select', function () {
+ control.saveValue( 'text-decoration', jQuery( this ).val() );
+ } );
+
+ // Font size setting.
+ control.container.on( 'change keyup paste input', '.font-size input', function () {
+ control.updateFontSize();
+ } );
+
+ // Line height setting.
+ control.container.on( 'change keyup paste input', '.line-height input', function () {
+ control.updateLineHeight();
+ } );
+
+ // Letter spacing setting.
+ control.container.on( 'change keyup paste input', '.letter-spacing input', function () {
+ control.updateLetterSpacing();
+ } );
+
+ },
+
+ renderFontSelector : function () {
+
+ var control = this,
+ selector = control.selector + ' .font-family select',
+ standardFonts = [],
+ googleFonts = [],
+ customFonts = [],
+ value = control.setting._value,
+ fonts = control.getFonts(),
+ fontSelect;
+
+ // Format standard fonts as an array.
+ if ( ! _.isUndefined( fonts.standard ) ) {
+ _.each(
+ fonts.standard,
+ function ( font ) {
+ standardFonts.push(
+ {
+ id : font.family.replace( /"/g, ''' ),
+ text : font.label
+ }
+ );
+ }
+ );
+ }
+
+ // Format Google fonts as an array.
+ if ( ! _.isUndefined( fonts.google ) ) {
+ _.each(
+ fonts.google,
+ function ( font ) {
+ googleFonts.push(
+ {
+ id : font.family,
+ text : font.label
+ }
+ );
+ }
+ );
+ }
+
+ // Combine fonts and build the final data.
+ data = [
+ {
+ text : fonts.standardfontslabel,
+ children : standardFonts
+ },
+ {
+ text : fonts.googlefontslabel,
+ children : googleFonts
+ }
+ ];
+
+ // Format custom fonts as an array.
+ if ( ! _.isUndefined( fonts.custom ) ) {
+ _.each(
+ fonts.custom,
+ function ( font ) {
+ customFonts.push(
+ {
+ id : font.family,
+ text : font.label
+ }
+ );
+ }
+ );
+
+ // Merge on `data` array.
+ data.push(
+ {
+ text : fonts.customfontslabel,
+ children : customFonts
+ }
+ );
+ }
+
+ // Instantiate selectWoo with the data.
+ fontSelect = jQuery( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ // Set the initial value.
+ if ( value['font-family'] ) {
+ fontSelect.val( value['font-family'].replace( /'/g, '"' ) ).trigger( 'change' );
+ }
+
+ // When the font option value changes.
+ fontSelect.on(
+ 'change',
+ function () {
+
+ // Set the value.
+ control.saveValue( 'font-family', jQuery( this ).val() );
+
+ // Render new list of selected font options.
+ control.renderVariantSelector();
+ control.renderSubsetSelector();
+
+ }
+ );
+
+ },
+
+ getFonts : function () {
+
+ var control = this;
+
+ if ( ! _.isUndefined( RadiateCustomizerControlTypography ) ) {
+ return RadiateCustomizerControlTypography;
+ }
+
+ return {
+ google : [],
+ standard : []
+ };
+
+ },
+
+ renderVariantSelector : function () {
+
+ var control = this,
+ value = control.setting._value,
+ fontFamily = value['font-family'],
+ variants = control.getVariants( fontFamily ),
+ selector = control.selector + ' .font-weight select',
+ data = [],
+ isValid = false,
+ variantSelector;
+
+ if ( false !== variants ) {
+
+ jQuery( control.selector + ' .font-weight' ).show();
+ _.each(
+ variants,
+ function ( variant ) {
+ if ( value['font-weight'] === variant.id ) {
+ isValid = true;
+ }
+
+ data.push(
+ {
+ id : variant.id,
+ text : variant.label
+ }
+ );
+ }
+ );
+
+ if ( ! isValid ) {
+ value['font-weight'] = 'regular';
+ }
+
+ if ( jQuery( selector ).hasClass( 'select2-hidden-accessible' ) ) {
+ jQuery( selector ).selectWoo( 'destroy' );
+ jQuery( selector ).empty();
+ }
+
+ // Instantiate selectWoo with the data.
+ variantSelector = jQuery( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ variantSelector.val( value['font-weight'] ).trigger( 'change' );
+ variantSelector.on(
+ 'change',
+ function () {
+ control.saveValue( 'font-weight', jQuery( this ).val() );
+ }
+ );
+
+ } else {
+
+ jQuery( control.selector + ' .font-weight' ).hide();
+
+ }
+
+ },
+
+ getVariants : function ( fontFamily ) {
+
+ var control = this,
+ fonts = control.getFonts();
+
+ var variants = false;
+ _.each(
+ fonts.standard,
+ function ( font ) {
+ if ( fontFamily && font.family === fontFamily.replace( /'/g, '"' ) ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+
+ _.each(
+ fonts.google,
+ function ( font ) {
+ if ( font.family === fontFamily ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+
+ // For custom fonts.
+ if ( ! _.isUndefined( fonts.custom ) ) {
+ _.each(
+ fonts.custom,
+ function ( font ) {
+ if ( font.custom === fontFamily ) {
+ variants = font.variants;
+
+ return variants;
+ }
+ }
+ );
+ }
+
+ return variants;
+
+ },
+
+ renderSubsetSelector : function () {
+
+ var control = this,
+ value = control.setting._value,
+ fontFamily = value['font-family'],
+ subsets = control.getSubsets( fontFamily ),
+ selector = control.selector + ' .subsets select',
+ data = [],
+ validValue = value.subsets,
+ subsetSelector;
+
+ if ( false !== subsets ) {
+
+ jQuery( control.selector + ' .subsets' ).show();
+ _.each(
+ subsets,
+ function ( subset ) {
+ if ( _.isObject( validValue ) ) {
+ if ( - 1 === validValue.indexOf( subset.id ) ) {
+ validValue = _.reject(
+ validValue,
+ function ( subValue ) {
+ return subValue === subset.id;
+ }
+ );
+ }
+ }
+
+ data.push(
+ {
+ id : subset.id,
+ text : subset.label
+ }
+ );
+ }
+ );
+
+ } else {
+
+ jQuery( control.selector + ' .subsets' ).hide();
+
+ }
+
+ if ( jQuery( selector ).hasClass( 'select2-hidden-accessible' ) ) {
+ jQuery( selector ).selectWoo( 'destroy' );
+ jQuery( selector ).empty();
+ }
+
+ // Instantiate selectWoo with the data.
+ subsetSelector = jQuery( selector ).selectWoo(
+ {
+ data : data,
+ width : '100%'
+ }
+ );
+
+ subsetSelector.val( validValue ).trigger( 'change' );
+ subsetSelector.on(
+ 'change',
+ function () {
+ control.saveValue( 'subsets', jQuery( this ).val() );
+ }
+ );
+
+ },
+
+ getSubsets : function ( fontFamily ) {
+
+ var control = this,
+ subsets = false,
+ fonts = control.getFonts();
+
+ _.each(
+ fonts.google,
+ function ( font ) {
+ if ( font.family === fontFamily ) {
+ subsets = font.subsets;
+
+ return subsets;
+ }
+ }
+ );
+
+ return subsets;
+
+ },
+
+ saveValue : function ( property, value ) {
+
+ var control = this,
+ input = control.container.find( '.typography-hidden-value' ),
+ val = control.setting._value;
+
+ val[property] = value;
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ },
+
+ updateFontSize : function () {
+
+ var control = this,
+ val = control.setting._value,
+ input = control.container.find( '.typography-hidden-value' ),
+ newValue = {
+ 'font-size' : {}
+ };
+
+ control.container.find( '.font-size .control-wrap' ).each(
+ function () {
+ var controlValue = jQuery( this ).find( 'input' ).val();
+ var device = jQuery( this ).find( 'input' ).data( 'device' );
+
+ newValue['font-size'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ jQuery.extend( val, newValue );
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ },
+
+ updateLineHeight : function () {
+
+ var control = this,
+ val = control.setting._value,
+ input = control.container.find( '.typography-hidden-value' ),
+ newValue = {
+ 'line-height' : {}
+ };
+
+ control.container.find( '.line-height .control-wrap' ).each(
+ function () {
+ var controlValue = jQuery( this ).find( 'input' ).val();
+ var device = jQuery( this ).find( 'input' ).data( 'device' );
+
+ newValue['line-height'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ jQuery.extend( val, newValue );
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ },
+
+ updateLetterSpacing : function () {
+
+ var control = this,
+ val = control.setting._value,
+ input = control.container.find( '.typography-hidden-value' ),
+ newValue = {
+ 'letter-spacing' : {}
+ };
+
+ control.container.find( '.letter-spacing .control-wrap' ).each(
+ function () {
+ var controlValue = jQuery( this ).find( 'input' ).val();
+ var device = jQuery( this ).find( 'input' ).data( 'device' );
+
+ newValue['letter-spacing'][device] = controlValue;
+ }
+ );
+
+ // Extend/Update the `val` object to include `newValue`'s new data as an object.
+ jQuery.extend( val, newValue );
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ }
+
+} );
diff --git a/inc/customizer/core/custom-controls/assets/js/customize-controls.min.js b/inc/customizer/core/custom-controls/assets/js/customize-controls.min.js
new file mode 100644
index 0000000..9f04d8e
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/js/customize-controls.min.js
@@ -0,0 +1 @@
+wp.customize.controlConstructor["radiate-buttonset"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;this.container.on("click","input",function(){e.setting.set(jQuery(this).val())})}}),function(e){e(window).on("load",function(){e("html").addClass("colorpicker-ready")}),wp.customize.controlConstructor["radiate-background"]=wp.customize.Control.extend({ready:function(){"use strict";this.initRadiateBackgroundControl()},initRadiateBackgroundControl:function(){var i=this,e=i.setting._value,t=i.container.find(".radiate-color-picker-alpha");!_.isUndefined(e["background-image"])&&""!==e["background-image"]||(i.container.find(".customize-control-content > .background-repeat").hide(),i.container.find(".customize-control-content > .background-position").hide(),i.container.find(".customize-control-content > .background-size").hide(),i.container.find(".customize-control-content > .background-attachment").hide()),t.wpColorPicker({change:function(){jQuery("html").hasClass("colorpicker-ready")&&setTimeout(function(){i.saveValue("background-color",t.val())},100)},clear:function(e){jQuery(e.target).closest(".wp-picker-input-wrap").find(".wp-color-picker")[0]&&i.saveValue("background-color","")}}),i.container.on("click",".background-image-upload-button, .thumbnail-image img",function(e){var o=wp.media({multiple:!1}).open().on("select",function(){var e,t=o.state().get("selection").first(),n=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(n=t.toJSON().sizes.thumbnail.url):n=t.toJSON().sizes.medium.url,e=t.toJSON().sizes.full.url,t.toJSON().id,t.toJSON().width,t.toJSON().height,""!==e&&i.container.find(".customize-control-content > .background-repeat, .customize-control-content > .background-position, .customize-control-content > .background-size, .customize-control-content > .background-attachment").show(),i.saveValue("background-image",e),t=i.container.find(".placeholder, .thumbnail"),e=i.container.find(".background-image-upload-remove-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),e.length&&e.show()});e.preventDefault()}),i.container.on("click",".background-image-upload-remove-button",function(e){var t;e.preventDefault(),i.saveValue("background-image",""),t=i.container.find(".placeholder, .thumbnail"),e=i.container.find(".background-image-upload-remove-button"),i.container.find(".customize-control-content > .background-repeat").hide(),i.container.find(".customize-control-content > .background-position").hide(),i.container.find(".customize-control-content > .background-size").hide(),i.container.find(".customize-control-content > .background-attachment").hide(),t.length&&t.removeClass().addClass("placeholder").html(RadiateCustomizerControlBackground.placeholder),e.length&&e.hide()}),i.container.on("change",".background-repeat select",function(){i.saveValue("background-repeat",jQuery(this).val())}),i.container.on("change",".background-position select",function(){i.saveValue("background-position",jQuery(this).val())}),i.container.on("change",".background-size select",function(){i.saveValue("background-size",jQuery(this).val())}),i.container.on("change",".background-attachment select",function(){i.saveValue("background-attachment",jQuery(this).val())})},saveValue:function(e,t){var n=this,o=jQuery("#customize-control-"+n.id.replace("[","-").replace("]","")+" .background-hidden-value"),i=n.setting._value;i[e]=t,jQuery(o).attr("value",JSON.stringify(i)).trigger("change"),n.setting.set(i)}})}(jQuery),function(e){e(window).on("load",function(){e("html").addClass("colorpicker-ready")}),wp.customize.controlConstructor["radiate-color"]=wp.customize.Control.extend({ready:function(){"use strict";var n=this;this.container.find(".radiate-color-picker-alpha").wpColorPicker({change:function(e,t){t=t.color.toString();jQuery("html").hasClass("colorpicker-ready")&&n.setting.set(t)}})}})}(jQuery),wp.customize.controlConstructor["radiate-dropdown-categories"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;this.container.on("change","select",function(){e.setting.set(jQuery(this).val())})}}),wp.customize.controlConstructor["radiate-editor"]=wp.customize.Control.extend({ready:function(){"use strict";var e="editor_"+this.id;wp.editor.initialize(e,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0})},onChangeActive:function(e,t){"use strict";var n=this,o="editor_"+n.id,i=n.container.find("textarea"),a=tinyMCE.get(o);a&&a.onChange.add(function(e){e.save(),e=a.getContent(),i.val(e).trigger("change"),wp.customize.instance(n.id).set(e)})}}),function(u){wp.customize.controlConstructor["radiate-group"]=wp.customize.Control.extend({ready:function(){"use strict";this.registerToggleEvents(),this.container.on("radiate_settings_changed",this.onOptionChange)},registerToggleEvents:function(){var a=this;u(".wp-full-overlay-sidebar-content").click(function(e){u(e.target).closest(".radiate-field-settings-modal").length||u(".radiate-group-toggle-icon.open").trigger("click")}),a.container.on("click",".radiate-group-wrap .radiate-group-toggle-icon",function(e){e.preventDefault(),e.stopPropagation();var t=u(this),n=t.closest(".customize-control-radiate-group"),o=n.find(".radiate-field-settings-modal").data("loaded"),i=n.parents(".control-section");t.hasClass("open")?n.find(".radiate-field-settings-modal").hide():(0<(e=i.find(".radiate-group-toggle-icon.open")).length&&e.trigger("click"),o?n.find(".radiate-field-settings-modal").show():(i=a.params.radiate_fields,e=u(RadiateCustomizerControlGroup.group_modal_tmpl),o=u("#customize-footer-actions .active").attr("data-device"),n.find(".radiate-field-settings-wrap").append(e),n.find(".radiate-fields-wrap").attr("data-control",a.params.name),a.radiate_render_field(n,i,a),n.find(".radiate-field-settings-modal").show(),"mobile"===o?(u(".control-wrap.mobile").addClass("active"),u(".responsive-switchers .preview-mobile").addClass("active"),u(".control-wrap.tablet, .control-wrap.desktop").removeClass("active"),u(".responsive-switchers .preview-tablet, .responsive-switchers .preview-desktop").removeClass("active")):"tablet"===o?(u(".control-wrap.tablet").addClass("active"),u(".responsive-switchers .preview-tablet").addClass("active"),u(".control-wrap.mobile, .control-wrap.desktop").removeClass("active"),u(".responsive-switchers .preview-mobile, .responsive-switchers .preview-desktop").removeClass("active")):(u(".control-wrap.desktop").addClass("active"),u(".responsive-switchers .preview-desktop").addClass("active"),u(".control-wrap.mobile, .control-wrap.tablet").removeClass("active"),u(".responsive-switchers .preview-mobile, .responsive-switchers .preview-tablet").removeClass("active")))),t.toggleClass("open")}),a.container.on("click",".radiate-group-wrap > .customizer-text",function(e){e.preventDefault(),e.stopPropagation(),u(this).find(".radiate-group-toggle-icon").trigger("click")})},radiate_render_field:function(e,t,n){var o,i=this,a=e.find(".radiate-fields-wrap"),r="",c=[],s=i.isJSONString(n.params.value)?JSON.parse(n.params.value):{};void 0!==t.tabs?(o=0,r+='',r+='
',_.each(t.tabs,function(e,t){r+='- '+t+"
",o++}),r+="
",r+='
',_.each(t.tabs,function(e,t){e=i.generateFieldHtml(e,s);r+='
',r+=e.html,_.each(e.controls,function(e,t){c.push({key:e.key,value:e.value,name:e.name})}),r+="
"}),r+="
",r+="
",a.html(r),u("#"+n.params.name+"-tabs").tabs()):(t=i.generateFieldHtml(t,s),r+=t.html,_.each(t.controls,function(e,t){c.push({key:e.key,value:e.value,name:e.name})}),a.html(r)),_.each(c,function(e,t){switch(e.key){case"radiate-color":i.initColorControl(a,n,e.name);break;case"radiate-background":i.initBackgroundControl(n,e,e.name);break;case"radiate-typography":i.initTypographyControl(n,e,e.name)}}),e.find(".radiate-field-settings-modal").data("loaded",!0)},isJSONString:function(e){try{JSON.parse(e)}catch(e){return!1}return!0},generateFieldHtml:function(e,t){var c="",s=[];_.each(e,function(e,t){var n=wp.customize.control(e.name)?wp.customize.control(e.name).params.value:"",o=e.control,i="customize-control-"+o+"-content",i=wp.template(i),n=n||e.default,a="",r="";e.value=n,e.title=e.label,_.each(e.data_attrs,function(e,t){a+=" data-"+t+' ="'+e+'"'}),_.each(e.input_attrs,function(e,t){r+=t+' ="'+e+'"'}),e.dataAttrs=a,e.inputAttrs=r,s.push({key:o,value:n,name:e.name});o="",n=["radiate-typography"];"radiate-typography"===e.control&&n.includes(e.control)&&(e.languages=RadiateCustomizerControlTypographySubsets),n.includes(e.control)&&(o="has-responsive-switchers"),c+='',c+=i(e),c+=""});e=new Object;return e.controls=s,e.html=c,e},onOptionChange:function(e,t,n,o,i){u(".hidden-field-"+i).val(o),wp.customize.control(i).setting.set(o)},initColorControl:function(e,t,n){var o=this;e.find(".customize-control-radiate-color .radiate-color-picker-alpha").wpColorPicker({change:function(e,t){void 0===e.originalEvent&&void 0===t.color._alpha||(e=u(e.target).closest(".wp-picker-input-wrap").find(".wp-color-picker")[0],n=(n=u(e).parents(".customize-control").attr("id")).replace("customize-control-",""),u(e).val(t.color.toString()),o.container.trigger("radiate_settings_changed",[o,u(e),t.color.toString(),n]))},clear:function(e){e=u(e.target).closest(".wp-picker-input-wrap").find(".wp-color-picker")[0];n=(n=u(e).parents(".customize-control").attr("id")).replace("customize-control-",""),u(e).val(""),o.container.trigger("radiate_settings_changed",[o,u(e),"",n]),wp.customize.previewer.refresh()}})},initBackgroundControl:function(a,e,r){var t=u("#customize-control-"+a.id.replace("[","-").replace("]","")+" .background-hidden-value"),t=JSON.parse(t.val()),e=e.name,n=a.container.find(".radiate-color-picker-alpha"),c=a.container.find("#customize-control-"+e);!_.isUndefined(t["background-image"])&&""!==t["background-image"]||(c.find(".customize-control-content > .background-repeat").hide(),c.find(".customize-control-content > .background-position").hide(),c.find(".customize-control-content > .background-size").hide(),c.find(".customize-control-content > .background-attachment").hide()),n.wpColorPicker({change:function(){var e;u("html").hasClass("colorpicker-ready")&&(e=u(this),setTimeout(function(){a.saveBackgroundValue("background-color",n.val(),e,r)},100))},clear:function(e){e=u(e.target).closest(".wp-picker-input-wrap").find(".wp-color-picker")[0];e&&a.saveBackgroundValue("background-color","",u(e),r),wp.customize.previewer.refresh()}}),c.on("click",".background-image-upload-button, .thumbnail-image img",function(e){var o=u(this),i=wp.media({multiple:!1}).open().on("select",function(){var e,t=i.state().get("selection").first(),n=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(n=t.toJSON().sizes.thumbnail.url):n=t.toJSON().sizes.medium.url,e=t.toJSON().sizes.full.url,t.toJSON().id,t.toJSON().width,t.toJSON().height,""!==e&&c.find(".customize-control-content > .background-repeat, .customize-control-content > .background-position, .customize-control-content > .background-size, .customize-control-content > .background-attachment").show(),a.saveBackgroundValue("background-image",e,o,r),t=c.find(".placeholder, .thumbnail"),e=c.find(".background-image-upload-remove-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),e.length&&e.show()});e.preventDefault()}),c.on("click",".background-image-upload-remove-button",function(e){var t;e.preventDefault(),a.saveBackgroundValue("background-image","",u(this)),t=c.find(".placeholder, .thumbnail"),e=c.find(".background-image-upload-remove-button"),c.find(".customize-control-content > .background-repeat").hide(),c.find(".customize-control-content > .background-position").hide(),c.find(".customize-control-content > .background-size").hide(),c.find(".customize-control-content > .background-attachment").hide(),t.length&&t.removeClass().addClass("placeholder").html(RadiateCustomizerControlBackground.placeholder),e.length&&e.hide()}),c.on("change",".background-repeat select",function(){a.saveBackgroundValue("background-repeat",u(this).val(),u(this),r)}),c.on("change",".background-position select",function(){a.saveBackgroundValue("background-position",u(this).val(),u(this),r)}),c.on("change",".background-size select",function(){a.saveBackgroundValue("background-size",u(this).val(),u(this),r)}),c.on("change",".background-attachment select",function(){a.saveBackgroundValue("background-attachment",u(this).val(),u(this),r)})},saveBackgroundValue:function(e,t,n,o){var i=u("#customize-control-"+this.id.replace("[","-").replace("]","")+" .background-hidden-value"),a=JSON.parse(i.val());a[e]=t,u(i).attr("value",JSON.stringify(a)).trigger("change"),o=(o=u(n).parents(".customize-control").attr("id")).replace("customize-control-",""),this.container.trigger("radiate_settings_changed",[this,n,a,o])},initTypographyControl:function(e,t,n){e.setting._value;var o=t.name,o=e.container.find("#customize-control-"+o);e.renderTypographyFontSelector(u(this),n,t),e.renderTypographyVariantSelector(u(this),n,t),e.renderTypographySubsetSelector(u(this),n,t),o.on("change",".font-style select",function(){e.saveTypographyValue("font-style",u(this).val(),u(this),n)}),o.on("change",".text-transform select",function(){e.saveTypographyValue("text-transform",u(this).val(),u(this),n)}),o.on("change",".text-decoration select",function(){e.saveTypographyValue("text-decoration",u(this).val(),u(this),n)}),o.on("change keyup paste input",".font-size input",function(){e.saveTypographyFontSize(u(this),n,t)}),o.on("change keyup paste input",".line-height input",function(){e.saveTypographyLineHeight(u(this),n,t)}),o.on("change keyup paste input",".letter-spacing input",function(){e.saveTypographyLetterSpacing(u(this),n,t)})},renderTypographyFontSelector:function(e,t,n){var o=this,i=o.selector+" .font-family select",a=[],r=[],c=[],s=u("#customize-control-"+o.id.replace("[","-").replace("]","")+" .typography-hidden-value"),l=JSON.parse(s.val()),s=o.getTypographyFonts();_.isUndefined(s.standard)||_.each(s.standard,function(e){a.push({id:e.family.replace(/"/g,"'"),text:e.label})}),_.isUndefined(s.google)||_.each(s.google,function(e){r.push({id:e.family,text:e.label})}),data=[{text:s.standardfontslabel,children:a},{text:s.googlefontslabel,children:r}],_.isUndefined(s.custom)||(_.each(s.custom,function(e){c.push({id:e.family,text:e.label})}),data.push({text:s.customfontslabel,children:c})),i=u(i).selectWoo({data:data,width:"100%"}),l["font-family"]&&i.val(l["font-family"].replace(/'/g,'"')).trigger("change"),i.on("change",function(){o.saveTypographyValue("font-family",u(this).val(),u(this),t),o.renderTypographyVariantSelector(u(this),t,n),o.renderTypographySubsetSelector(u(this),t,n)})},getTypographyFonts:function(){return _.isUndefined(RadiateCustomizerControlTypography)?{google:[],standard:[]}:RadiateCustomizerControlTypography},renderTypographyVariantSelector:function(e,t,n){var o=this,i=u("#customize-control-"+o.id.replace("[","-").replace("]","")+" .typography-hidden-value"),a=JSON.parse(i.val()),r=a["font-family"],i=o.getTypographyVariants(r),r=o.selector+" .font-weight select",c=[],s=!1;!1!==i?(u(o.selector+" .font-weight").show(),_.each(i,function(e){a["font-weight"]===e.id&&(s=!0),c.push({id:e.id,text:e.label})}),s||(a["font-weight"]="regular"),u(r).hasClass("select2-hidden-accessible")&&(u(r).selectWoo("destroy"),u(r).empty()),(r=u(r).selectWoo({data:c,width:"100%"})).val(a["font-weight"]).trigger("change"),r.on("change",function(){o.saveTypographyValue("font-weight",u(this).val(),u(this),t)})):u(o.selector+" .font-weight").hide()},getTypographyVariants:function(t){var e=this.getTypographyFonts(),n=!1;return _.each(e.standard,function(e){if(t&&e.family===t.replace(/'/g,'"'))return n=e.variants}),_.each(e.google,function(e){if(e.family===t)return n=e.variants}),_.isUndefined(e.custom)||_.each(e.custom,function(e){if(e.custom===t)return n=e.variants}),n},renderTypographySubsetSelector:function(e,t,n){var o=this,i=u("#customize-control-"+o.id.replace("[","-").replace("]","")+" .typography-hidden-value"),a=JSON.parse(i.val()),r=a["font-family"],i=o.getTypographySubsets(r),r=o.selector+" .subsets select",c=[],s=a.subsets;!1!==i?(u(o.selector+" .subsets").show(),_.each(i,function(t){_.isObject(s)&&-1===s.indexOf(t.id)&&(s=_.reject(s,function(e){return e===t.id})),c.push({id:t.id,text:t.label})})):u(o.selector+" .subsets").hide(),u(r).hasClass("select2-hidden-accessible")&&(u(r).selectWoo("destroy"),u(r).empty()),(r=u(r).selectWoo({data:c,width:"100%"})).val(s).trigger("change"),r.on("change",function(){o.saveTypographyValue("subsets",u(this).val(),u(this),t)})},getTypographySubsets:function(t){var n=!1,e=this.getTypographyFonts();return _.each(e.google,function(e){if(e.family===t)return n=e.subsets}),n},saveTypographyFontSize:function(e,t,n){var o=u("#customize-control-"+this.id.replace("[","-").replace("]","")+" .typography-hidden-value"),i=JSON.parse(o.val()),n=n.name,n=this.container.find("#customize-control-"+n),a={"font-size":{}};n.find(".font-size .control-wrap").each(function(){var e=u(this).find("input").val(),t=u(this).find("input").data("device");a["font-size"][t]=e}),u.extend(i,a),u(o).attr("value",JSON.stringify(i)).trigger("change"),t=(t=u(e).parents(".customize-control").attr("id")).replace("customize-control-",""),this.container.trigger("radiate_settings_changed",[this,e,i,t])},saveTypographyLineHeight:function(e,t,n){var o=u("#customize-control-"+this.id.replace("[","-").replace("]","")+" .typography-hidden-value"),i=JSON.parse(o.val()),n=n.name,n=this.container.find("#customize-control-"+n),a={"line-height":{}};n.find(".line-height .control-wrap").each(function(){var e=u(this).find("input").val(),t=u(this).find("input").data("device");a["line-height"][t]=e}),u.extend(i,a),u(o).attr("value",JSON.stringify(i)).trigger("change"),t=(t=u(e).parents(".customize-control").attr("id")).replace("customize-control-",""),this.container.trigger("radiate_settings_changed",[this,e,i,t])},saveTypographyLetterSpacing:function(e,t,n){var o=u("#customize-control-"+this.id.replace("[","-").replace("]","")+" .typography-hidden-value"),i=JSON.parse(o.val()),n=n.name,n=this.container.find("#customize-control-"+n),a={"letter-spacing":{}};n.find(".letter-spacing .control-wrap").each(function(){var e=u(this).find("input").val(),t=u(this).find("input").data("device");a["letter-spacing"][t]=e}),u.extend(i,a),u(o).attr("value",JSON.stringify(i)).trigger("change"),t=(t=u(e).parents(".customize-control").attr("id")).replace("customize-control-",""),this.container.trigger("radiate_settings_changed",[this,e,i,t])},saveTypographyValue:function(e,t,n,o){var i=u("#customize-control-"+this.id.replace("[","-").replace("]","")+" .typography-hidden-value"),a=JSON.parse(i.val());a[e]=t,u(i).attr("value",JSON.stringify(a)).trigger("change"),o=(o=u(n).parents(".customize-control").attr("id")).replace("customize-control-",""),this.container.trigger("radiate_settings_changed",[this,n,a,o])}})}(jQuery),wp.customize.controlConstructor["radiate-radio-image"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;this.container.on("click","input",function(){e.setting.set(jQuery(this).val())})}}),function(t){t(window).on("load",function(){t(".tg-navigate a").on("click",function(e){e.preventDefault();e=t(this).data("section");e&&wp.customize.section(e).focus()})})}(jQuery),wp.customize.controlConstructor["radiate-slider"]=wp.customize.Control.extend({ready:function(){"use strict";var t=this;this.container.find("input[type=range]").on("input change",function(){var e=jQuery(this).val(),t=jQuery(this).closest(".slider-wrapper").find(".radiate-range-value .value");t.val(e),t.change()}),this.container.find(".radiate-slider-reset").click(function(){var e=jQuery(this).closest(".slider-wrapper"),t=e.find("input[type=range]"),n=e.find(".radiate-range-value .value"),e=t.data("reset_value");t.val(e),n.val(e),n.change()}),this.container.on("input change","input[type=number]",function(){var e=jQuery(this).val();jQuery(this).closest(".slider-wrapper").find("input[type=range]").val(e),t.setting.set(e)})}}),wp.customize.controlConstructor["radiate-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;e.sortableContainer=e.container.find("ul.sortable").first(),e.sortableContainer.sortable({stop:function(){e.updateValue()}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.updateValue()})},updateValue:function(){"use strict";var e=[];this.sortableContainer.find("li").each(function(){jQuery(this).is(".invisible")||e.push(jQuery(this).data("value"))}),this.setting.set(e)}}),wp.customize.controlConstructor["radiate-toggle"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["radiate-typography"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;e.renderFontSelector(),e.renderVariantSelector(),e.renderSubsetSelector(),e.container.on("change",".font-style select",function(){e.saveValue("font-style",jQuery(this).val())}),e.container.on("change",".text-transform select",function(){e.saveValue("text-transform",jQuery(this).val())}),e.container.on("change",".text-decoration select",function(){e.saveValue("text-decoration",jQuery(this).val())}),e.container.on("change keyup paste input",".font-size input",function(){e.updateFontSize()}),e.container.on("change keyup paste input",".line-height input",function(){e.updateLineHeight()}),e.container.on("change keyup paste input",".letter-spacing input",function(){e.updateLetterSpacing()})},renderFontSelector:function(){var e=this,t=e.selector+" .font-family select",n=[],o=[],i=[],a=e.setting._value,r=e.getFonts();_.isUndefined(r.standard)||_.each(r.standard,function(e){n.push({id:e.family.replace(/"/g,"'"),text:e.label})}),_.isUndefined(r.google)||_.each(r.google,function(e){o.push({id:e.family,text:e.label})}),data=[{text:r.standardfontslabel,children:n},{text:r.googlefontslabel,children:o}],_.isUndefined(r.custom)||(_.each(r.custom,function(e){i.push({id:e.family,text:e.label})}),data.push({text:r.customfontslabel,children:i})),t=jQuery(t).selectWoo({data:data,width:"100%"}),a["font-family"]&&t.val(a["font-family"].replace(/'/g,'"')).trigger("change"),t.on("change",function(){e.saveValue("font-family",jQuery(this).val()),e.renderVariantSelector(),e.renderSubsetSelector()})},getFonts:function(){return _.isUndefined(RadiateCustomizerControlTypography)?{google:[],standard:[]}:RadiateCustomizerControlTypography},renderVariantSelector:function(){var e=this,t=e.setting._value,n=t["font-family"],o=e.getVariants(n),n=e.selector+" .font-weight select",i=[],a=!1;!1!==o?(jQuery(e.selector+" .font-weight").show(),_.each(o,function(e){t["font-weight"]===e.id&&(a=!0),i.push({id:e.id,text:e.label})}),a||(t["font-weight"]="regular"),jQuery(n).hasClass("select2-hidden-accessible")&&(jQuery(n).selectWoo("destroy"),jQuery(n).empty()),(n=jQuery(n).selectWoo({data:i,width:"100%"})).val(t["font-weight"]).trigger("change"),n.on("change",function(){e.saveValue("font-weight",jQuery(this).val())})):jQuery(e.selector+" .font-weight").hide()},getVariants:function(t){var e=this.getFonts(),n=!1;return _.each(e.standard,function(e){if(t&&e.family===t.replace(/'/g,'"'))return n=e.variants}),_.each(e.google,function(e){if(e.family===t)return n=e.variants}),_.isUndefined(e.custom)||_.each(e.custom,function(e){if(e.custom===t)return n=e.variants}),n},renderSubsetSelector:function(){var e=this,t=e.setting._value,n=t["font-family"],o=e.getSubsets(n),n=e.selector+" .subsets select",i=[],a=t.subsets;!1!==o?(jQuery(e.selector+" .subsets").show(),_.each(o,function(t){_.isObject(a)&&-1===a.indexOf(t.id)&&(a=_.reject(a,function(e){return e===t.id})),i.push({id:t.id,text:t.label})})):jQuery(e.selector+" .subsets").hide(),jQuery(n).hasClass("select2-hidden-accessible")&&(jQuery(n).selectWoo("destroy"),jQuery(n).empty()),(n=jQuery(n).selectWoo({data:i,width:"100%"})).val(a).trigger("change"),n.on("change",function(){e.saveValue("subsets",jQuery(this).val())})},getSubsets:function(t){var n=!1,e=this.getFonts();return _.each(e.google,function(e){if(e.family===t)return n=e.subsets}),n},saveValue:function(e,t){var n=this.container.find(".typography-hidden-value"),o=this.setting._value;o[e]=t,jQuery(n).attr("value",JSON.stringify(o)).trigger("change"),this.setting.set(o)},updateFontSize:function(){var e=this.setting._value,t=this.container.find(".typography-hidden-value"),n={"font-size":{}};this.container.find(".font-size .control-wrap").each(function(){var e=jQuery(this).find("input").val(),t=jQuery(this).find("input").data("device");n["font-size"][t]=e}),jQuery.extend(e,n),jQuery(t).attr("value",JSON.stringify(e)).trigger("change"),this.setting.set(e)},updateLineHeight:function(){var e=this.setting._value,t=this.container.find(".typography-hidden-value"),n={"line-height":{}};this.container.find(".line-height .control-wrap").each(function(){var e=jQuery(this).find("input").val(),t=jQuery(this).find("input").data("device");n["line-height"][t]=e}),jQuery.extend(e,n),jQuery(t).attr("value",JSON.stringify(e)).trigger("change"),this.setting.set(e)},updateLetterSpacing:function(){var e=this.setting._value,t=this.container.find(".typography-hidden-value"),n={"letter-spacing":{}};this.container.find(".letter-spacing .control-wrap").each(function(){var e=jQuery(this).find("input").val(),t=jQuery(this).find("input").data("device");n["letter-spacing"][t]=e}),jQuery.extend(e,n),jQuery(t).attr("value",JSON.stringify(e)).trigger("change"),this.setting.set(e)}});
\ No newline at end of file
diff --git a/inc/customizer/core/custom-controls/assets/js/selectWoo.js b/inc/customizer/core/custom-controls/assets/js/selectWoo.js
new file mode 100644
index 0000000..6ca7983
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/js/selectWoo.js
@@ -0,0 +1,5874 @@
+/*!
+ * SelectWoo 1.0.5
+ * https://github.com/woocommerce/selectWoo
+ *
+ * Released under the MIT license
+ * https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
+ */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof module === 'object' && module.exports) {
+ // Node/CommonJS
+ module.exports = function (root, jQuery) {
+ if (jQuery === undefined) {
+ // require('jQuery') returns a factory that requires window to
+ // build a jQuery instance, we normalize how we use modules
+ // that require this pattern but the window provided is a noop
+ // if it's defined (how jquery works)
+ if (typeof window !== 'undefined') {
+ jQuery = require('jquery');
+ }
+ else {
+ jQuery = require('jquery')(root);
+ }
+ }
+ factory(jQuery);
+ return jQuery;
+ };
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+} (function (jQuery) {
+ // This is needed so we can catch the AMD loader configuration and use it
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
+ // returns the AMD loader references.
+ var S2 =(function () {
+ // Restore the Select2 AMD loader so it can be used
+ // Needed mostly in the language files, where the loader is not inserted
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
+ var S2 = jQuery.fn.select2.amd;
+ }
+var S2;(function () { if (!S2 || !S2.requirejs) {
+if (!S2) { S2 = {}; } else { require = S2; }
+/**
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
+ */
+//Going sloppy to avoid 'use strict' string cost, but strict practices should
+//be followed.
+/*global setTimeout: false */
+
+var requirejs, require, define;
+(function (undef) {
+ var main, req, makeMap, handlers,
+ defined = {},
+ waiting = {},
+ config = {},
+ defining = {},
+ hasOwn = Object.prototype.hasOwnProperty,
+ aps = [].slice,
+ jsSuffixRegExp = /\.js$/;
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName) {
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
+ baseParts = baseName && baseName.split("/"),
+ map = config.map,
+ starMap = (map && map['*']) || {};
+
+ //Adjust any relative paths.
+ if (name) {
+ name = name.split('/');
+ lastIndex = name.length - 1;
+
+ // If wanting node ID compatibility, strip .js from end
+ // of IDs. Have to do this here, and not in nameToUrl
+ // because node allows either .js or non .js to map
+ // to same file.
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
+ }
+
+ // Starts with a '.' so need the baseName
+ if (name[0].charAt(0) === '.' && baseParts) {
+ //Convert baseName to array, and lop off the last part,
+ //so that . matches that 'directory' and not name of the baseName's
+ //module. For instance, baseName of 'one/two/three', maps to
+ //'one/two/three.js', but we want the directory, 'one/two' for
+ //this normalization.
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
+ name = normalizedBaseParts.concat(name);
+ }
+
+ //start trimDots
+ for (i = 0; i < name.length; i++) {
+ part = name[i];
+ if (part === '.') {
+ name.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ // If at the start, or previous value is still ..,
+ // keep them so that when converted to a path it may
+ // still work when converted to a path, even though
+ // as an ID it is less than ideal. In larger point
+ // releases, may be better to just kick out an error.
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
+ continue;
+ } else if (i > 0) {
+ name.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ //end trimDots
+
+ name = name.join('/');
+ }
+
+ //Apply map config if available.
+ if ((baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join("/");
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
+ foundStarMap = starMap[nameSegment];
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function makeRequire(relName, forceSync) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0);
+
+ //If first arg is not require('string'), and there is only
+ //one arg, it is the array form without a callback. Insert
+ //a null so that the following concat is correct.
+ if (typeof args[0] !== 'string' && args.length === 1) {
+ args.push(null);
+ }
+ return req.apply(undef, args.concat([relName, forceSync]));
+ };
+ }
+
+ function makeNormalize(relName) {
+ return function (name) {
+ return normalize(name, relName);
+ };
+ }
+
+ function makeLoad(depName) {
+ return function (value) {
+ defined[depName] = value;
+ };
+ }
+
+ function callDep(name) {
+ if (hasProp(waiting, name)) {
+ var args = waiting[name];
+ delete waiting[name];
+ defining[name] = true;
+ main.apply(undef, args);
+ }
+
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
+ throw new Error('No ' + name);
+ }
+ return defined[name];
+ }
+
+ //Turns a plugin!resource to [plugin, resource]
+ //with the plugin being undefined if the name
+ //did not have a plugin prefix.
+ function splitPrefix(name) {
+ var prefix,
+ index = name ? name.indexOf('!') : -1;
+ if (index > -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+ return [prefix, name];
+ }
+
+ //Creates a parts array for a relName where first part is plugin ID,
+ //second part is resource ID. Assumes relName has already been normalized.
+ function makeRelParts(relName) {
+ return relName ? splitPrefix(relName) : [];
+ }
+
+ /**
+ * Makes a name map, normalizing the name, and using a plugin
+ * for normalization if necessary. Grabs a ref to plugin
+ * too, as an optimization.
+ */
+ makeMap = function (name, relParts) {
+ var plugin,
+ parts = splitPrefix(name),
+ prefix = parts[0],
+ relResourceName = relParts[1];
+
+ name = parts[1];
+
+ if (prefix) {
+ prefix = normalize(prefix, relResourceName);
+ plugin = callDep(prefix);
+ }
+
+ //Normalize according
+ if (prefix) {
+ if (plugin && plugin.normalize) {
+ name = plugin.normalize(name, makeNormalize(relResourceName));
+ } else {
+ name = normalize(name, relResourceName);
+ }
+ } else {
+ name = normalize(name, relResourceName);
+ parts = splitPrefix(name);
+ prefix = parts[0];
+ name = parts[1];
+ if (prefix) {
+ plugin = callDep(prefix);
+ }
+ }
+
+ //Using ridiculous property names for space reasons
+ return {
+ f: prefix ? prefix + '!' + name : name, //fullName
+ n: name,
+ pr: prefix,
+ p: plugin
+ };
+ };
+
+ function makeConfig(name) {
+ return function () {
+ return (config && config.config && config.config[name]) || {};
+ };
+ }
+
+ handlers = {
+ require: function (name) {
+ return makeRequire(name);
+ },
+ exports: function (name) {
+ var e = defined[name];
+ if (typeof e !== 'undefined') {
+ return e;
+ } else {
+ return (defined[name] = {});
+ }
+ },
+ module: function (name) {
+ return {
+ id: name,
+ uri: '',
+ exports: defined[name],
+ config: makeConfig(name)
+ };
+ }
+ };
+
+ main = function (name, deps, callback, relName) {
+ var cjsModule, depName, ret, map, i, relParts,
+ args = [],
+ callbackType = typeof callback,
+ usingExports;
+
+ //Use name if no relName
+ relName = relName || name;
+ relParts = makeRelParts(relName);
+
+ //Call the callback to define the module, if necessary.
+ if (callbackType === 'undefined' || callbackType === 'function') {
+ //Pull out the defined dependencies and pass the ordered
+ //values to the callback.
+ //Default to [require, exports, module] if no deps
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
+ for (i = 0; i < deps.length; i += 1) {
+ map = makeMap(deps[i], relParts);
+ depName = map.f;
+
+ //Fast path CommonJS standard dependencies.
+ if (depName === "require") {
+ args[i] = handlers.require(name);
+ } else if (depName === "exports") {
+ //CommonJS module spec 1.1
+ args[i] = handlers.exports(name);
+ usingExports = true;
+ } else if (depName === "module") {
+ //CommonJS module spec 1.1
+ cjsModule = args[i] = handlers.module(name);
+ } else if (hasProp(defined, depName) ||
+ hasProp(waiting, depName) ||
+ hasProp(defining, depName)) {
+ args[i] = callDep(depName);
+ } else if (map.p) {
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
+ args[i] = defined[depName];
+ } else {
+ throw new Error(name + ' missing ' + depName);
+ }
+ }
+
+ ret = callback ? callback.apply(defined[name], args) : undefined;
+
+ if (name) {
+ //If setting exports via "module" is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ if (cjsModule && cjsModule.exports !== undef &&
+ cjsModule.exports !== defined[name]) {
+ defined[name] = cjsModule.exports;
+ } else if (ret !== undef || !usingExports) {
+ //Use the return value from the function.
+ defined[name] = ret;
+ }
+ }
+ } else if (name) {
+ //May just be an object definition for the module. Only
+ //worry about defining if have a module name.
+ defined[name] = callback;
+ }
+ };
+
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
+ if (typeof deps === "string") {
+ if (handlers[deps]) {
+ //callback in this case is really relName
+ return handlers[deps](callback);
+ }
+ //Just return the module wanted. In this scenario, the
+ //deps arg is the module name, and second arg (if passed)
+ //is just the relName.
+ //Normalize module name, if it contains . or ..
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
+ } else if (!deps.splice) {
+ //deps is a config object, not an array.
+ config = deps;
+ if (config.deps) {
+ req(config.deps, config.callback);
+ }
+ if (!callback) {
+ return;
+ }
+
+ if (callback.splice) {
+ //callback is an array, which means it is a dependency list.
+ //Adjust args if there are dependencies
+ deps = callback;
+ callback = relName;
+ relName = null;
+ } else {
+ deps = undef;
+ }
+ }
+
+ //Support require(['a'])
+ callback = callback || function () {};
+
+ //If relName is a function, it is an errback handler,
+ //so remove it.
+ if (typeof relName === 'function') {
+ relName = forceSync;
+ forceSync = alt;
+ }
+
+ //Simulate async callback;
+ if (forceSync) {
+ main(undef, deps, callback, relName);
+ } else {
+ //Using a non-zero value because of concern for what old browsers
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
+ //If want a value immediately, use require('id') instead -- something
+ //that works in almond on the global level, but not guaranteed and
+ //unlikely to work in other AMD implementations.
+ setTimeout(function () {
+ main(undef, deps, callback, relName);
+ }, 4);
+ }
+
+ return req;
+ };
+
+ /**
+ * Just drops the config on the floor, but returns req in case
+ * the config return value is used.
+ */
+ req.config = function (cfg) {
+ return req(cfg);
+ };
+
+ /**
+ * Expose module registry for debugging and tooling
+ */
+ requirejs._defined = defined;
+
+ define = function (name, deps, callback) {
+ if (typeof name !== 'string') {
+ throw new Error('See almond README: incorrect module build, no module name');
+ }
+
+ //This module may not have dependencies
+ if (!deps.splice) {
+ //deps is not an array, so probably means
+ //an object literal or factory function for
+ //the value. Adjust args.
+ callback = deps;
+ deps = [];
+ }
+
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
+ waiting[name] = [name, deps, callback];
+ }
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+}());
+
+S2.requirejs = requirejs;S2.require = require;S2.define = define;
+}
+}());
+S2.define("almond", function(){});
+
+/* global jQuery:false, $:false */
+S2.define('jquery',[],function () {
+ var _$ = jQuery || $;
+
+ if (_$ == null && console && console.error) {
+ console.error(
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
+ 'web page.'
+ );
+ }
+
+ return _$;
+});
+
+S2.define('select2/utils',[
+ 'jquery'
+], function ($) {
+ var Utils = {};
+
+ Utils.Extend = function (ChildClass, SuperClass) {
+ var __hasProp = {}.hasOwnProperty;
+
+ function BaseConstructor () {
+ this.constructor = ChildClass;
+ }
+
+ for (var key in SuperClass) {
+ if (__hasProp.call(SuperClass, key)) {
+ ChildClass[key] = SuperClass[key];
+ }
+ }
+
+ BaseConstructor.prototype = SuperClass.prototype;
+ ChildClass.prototype = new BaseConstructor();
+ ChildClass.__super__ = SuperClass.prototype;
+
+ return ChildClass;
+ };
+
+ function getMethods (theClass) {
+ var proto = theClass.prototype;
+
+ var methods = [];
+
+ for (var methodName in proto) {
+ var m = proto[methodName];
+
+ if (typeof m !== 'function') {
+ continue;
+ }
+
+ if (methodName === 'constructor') {
+ continue;
+ }
+
+ methods.push(methodName);
+ }
+
+ return methods;
+ }
+
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
+ var decoratedMethods = getMethods(DecoratorClass);
+ var superMethods = getMethods(SuperClass);
+
+ function DecoratedClass () {
+ var unshift = Array.prototype.unshift;
+
+ var argCount = DecoratorClass.prototype.constructor.length;
+
+ var calledConstructor = SuperClass.prototype.constructor;
+
+ if (argCount > 0) {
+ unshift.call(arguments, SuperClass.prototype.constructor);
+
+ calledConstructor = DecoratorClass.prototype.constructor;
+ }
+
+ calledConstructor.apply(this, arguments);
+ }
+
+ DecoratorClass.displayName = SuperClass.displayName;
+
+ function ctr () {
+ this.constructor = DecoratedClass;
+ }
+
+ DecoratedClass.prototype = new ctr();
+
+ for (var m = 0; m < superMethods.length; m++) {
+ var superMethod = superMethods[m];
+
+ DecoratedClass.prototype[superMethod] =
+ SuperClass.prototype[superMethod];
+ }
+
+ var calledMethod = function (methodName) {
+ // Stub out the original method if it's not decorating an actual method
+ var originalMethod = function () {};
+
+ if (methodName in DecoratedClass.prototype) {
+ originalMethod = DecoratedClass.prototype[methodName];
+ }
+
+ var decoratedMethod = DecoratorClass.prototype[methodName];
+
+ return function () {
+ var unshift = Array.prototype.unshift;
+
+ unshift.call(arguments, originalMethod);
+
+ return decoratedMethod.apply(this, arguments);
+ };
+ };
+
+ for (var d = 0; d < decoratedMethods.length; d++) {
+ var decoratedMethod = decoratedMethods[d];
+
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
+ }
+
+ return DecoratedClass;
+ };
+
+ var Observable = function () {
+ this.listeners = {};
+ };
+
+ Observable.prototype.on = function (event, callback) {
+ this.listeners = this.listeners || {};
+
+ if (event in this.listeners) {
+ this.listeners[event].push(callback);
+ } else {
+ this.listeners[event] = [callback];
+ }
+ };
+
+ Observable.prototype.trigger = function (event) {
+ var slice = Array.prototype.slice;
+ var params = slice.call(arguments, 1);
+
+ this.listeners = this.listeners || {};
+
+ // Params should always come in as an array
+ if (params == null) {
+ params = [];
+ }
+
+ // If there are no arguments to the event, use a temporary object
+ if (params.length === 0) {
+ params.push({});
+ }
+
+ // Set the `_type` of the first object to the event
+ params[0]._type = event;
+
+ if (event in this.listeners) {
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
+ }
+
+ if ('*' in this.listeners) {
+ this.invoke(this.listeners['*'], arguments);
+ }
+ };
+
+ Observable.prototype.invoke = function (listeners, params) {
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ listeners[i].apply(this, params);
+ }
+ };
+
+ Utils.Observable = Observable;
+
+ Utils.generateChars = function (length) {
+ var chars = '';
+
+ for (var i = 0; i < length; i++) {
+ var randomChar = Math.floor(Math.random() * 36);
+ chars += randomChar.toString(36);
+ }
+
+ return chars;
+ };
+
+ Utils.bind = function (func, context) {
+ return function () {
+ func.apply(context, arguments);
+ };
+ };
+
+ Utils._convertData = function (data) {
+ for (var originalKey in data) {
+ var keys = originalKey.split('-');
+
+ var dataLevel = data;
+
+ if (keys.length === 1) {
+ continue;
+ }
+
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k];
+
+ // Lowercase the first letter
+ // By default, dash-separated becomes camelCase
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
+
+ if (!(key in dataLevel)) {
+ dataLevel[key] = {};
+ }
+
+ if (k == keys.length - 1) {
+ dataLevel[key] = data[originalKey];
+ }
+
+ dataLevel = dataLevel[key];
+ }
+
+ delete data[originalKey];
+ }
+
+ return data;
+ };
+
+ Utils.hasScroll = function (index, el) {
+ // Adapted from the function created by @ShadowScripter
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
+ // The original code can be found at
+ // http://codereview.stackexchange.com/q/13338
+ // and was designed to be used with the Sizzle selector engine.
+
+ var $el = $(el);
+ var overflowX = el.style.overflowX;
+ var overflowY = el.style.overflowY;
+
+ //Check both x and y declarations
+ if (overflowX === overflowY &&
+ (overflowY === 'hidden' || overflowY === 'visible')) {
+ return false;
+ }
+
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
+ return true;
+ }
+
+ return ($el.innerHeight() < el.scrollHeight ||
+ $el.innerWidth() < el.scrollWidth);
+ };
+
+ Utils.escapeMarkup = function (markup) {
+ var replaceMap = {
+ '\\': '\',
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '/': '/'
+ };
+
+ // Do not try to escape the markup if it's not a string
+ if (typeof markup !== 'string') {
+ return markup;
+ }
+
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
+ return replaceMap[match];
+ });
+ };
+
+ // Append an array of jQuery nodes to a given element.
+ Utils.appendMany = function ($element, $nodes) {
+ // jQuery 1.7.x does not support $.fn.append() with an array
+ // Fall back to a jQuery object collection using $.fn.add()
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
+ var $jqNodes = $();
+
+ $.map($nodes, function (node) {
+ $jqNodes = $jqNodes.add(node);
+ });
+
+ $nodes = $jqNodes;
+ }
+
+ $element.append($nodes);
+ };
+
+ // Determine whether the browser is on a touchscreen device.
+ Utils.isTouchscreen = function() {
+ if ('undefined' === typeof Utils._isTouchscreenCache) {
+ Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
+ }
+ return Utils._isTouchscreenCache;
+ }
+
+ return Utils;
+});
+
+S2.define('select2/results',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Results ($element, options, dataAdapter) {
+ this.$element = $element;
+ this.data = dataAdapter;
+ this.options = options;
+
+ Results.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Results, Utils.Observable);
+
+ Results.prototype.render = function () {
+ var $results = $(
+ ''
+ );
+
+ if (this.options.get('multiple')) {
+ $results.attr('aria-multiselectable', 'true');
+ }
+
+ this.$results = $results;
+
+ return $results;
+ };
+
+ Results.prototype.clear = function () {
+ this.$results.empty();
+ };
+
+ Results.prototype.displayMessage = function (params) {
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ this.clear();
+ this.hideLoading();
+
+ var $message = $(
+ ''
+ );
+
+ var message = this.options.get('translations').get(params.message);
+
+ $message.append(
+ escapeMarkup(
+ message(params.args)
+ )
+ );
+
+ $message[0].className += ' select2-results__message';
+
+ this.$results.append($message);
+ };
+
+ Results.prototype.hideMessages = function () {
+ this.$results.find('.select2-results__message').remove();
+ };
+
+ Results.prototype.append = function (data) {
+ this.hideLoading();
+
+ var $options = [];
+
+ if (data.results == null || data.results.length === 0) {
+ if (this.$results.children().length === 0) {
+ this.trigger('results:message', {
+ message: 'noResults'
+ });
+ }
+
+ return;
+ }
+
+ data.results = this.sort(data.results);
+
+ for (var d = 0; d < data.results.length; d++) {
+ var item = data.results[d];
+
+ var $option = this.option(item);
+
+ $options.push($option);
+ }
+
+ this.$results.append($options);
+ };
+
+ Results.prototype.position = function ($results, $dropdown) {
+ var $resultsContainer = $dropdown.find('.select2-results');
+ $resultsContainer.append($results);
+ };
+
+ Results.prototype.sort = function (data) {
+ var sorter = this.options.get('sorter');
+
+ return sorter(data);
+ };
+
+ Results.prototype.highlightFirstItem = function () {
+ var $options = this.$results
+ .find('.select2-results__option[data-selected]');
+
+ var $selected = $options.filter('[data-selected=true]');
+
+ // Check if there are any selected options
+ if ($selected.length > 0) {
+ // If there are selected options, highlight the first
+ $selected.first().trigger('mouseenter');
+ } else {
+ // If there are no selected options, highlight the first option
+ // in the dropdown
+ $options.first().trigger('mouseenter');
+ }
+
+ this.ensureHighlightVisible();
+ };
+
+ Results.prototype.setClasses = function () {
+ var self = this;
+
+ this.data.current(function (selected) {
+ var selectedIds = $.map(selected, function (s) {
+ return s.id.toString();
+ });
+
+ var $options = self.$results
+ .find('.select2-results__option[data-selected]');
+
+ $options.each(function () {
+ var $option = $(this);
+
+ var item = $.data(this, 'data');
+
+ // id needs to be converted to a string when comparing
+ var id = '' + item.id;
+
+ if ((item.element != null && item.element.selected) ||
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
+ $option.attr('data-selected', 'true');
+ } else {
+ $option.attr('data-selected', 'false');
+ }
+ });
+
+ });
+ };
+
+ Results.prototype.showLoading = function (params) {
+ this.hideLoading();
+
+ var loadingMore = this.options.get('translations').get('searching');
+
+ var loading = {
+ disabled: true,
+ loading: true,
+ text: loadingMore(params)
+ };
+ var $loading = this.option(loading);
+ $loading.className += ' loading-results';
+
+ this.$results.prepend($loading);
+ };
+
+ Results.prototype.hideLoading = function () {
+ this.$results.find('.loading-results').remove();
+ };
+
+ Results.prototype.option = function (data) {
+ var option = document.createElement('li');
+ option.className = 'select2-results__option';
+
+ var attrs = {
+ 'role': 'option',
+ 'data-selected': 'false',
+ 'tabindex': -1
+ };
+
+ if (data.disabled) {
+ delete attrs['data-selected'];
+ attrs['aria-disabled'] = 'true';
+ }
+
+ if (data.id == null) {
+ delete attrs['data-selected'];
+ }
+
+ if (data._resultId != null) {
+ option.id = data._resultId;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ if (data.children) {
+ attrs['aria-label'] = data.text;
+ delete attrs['data-selected'];
+ }
+
+ for (var attr in attrs) {
+ var val = attrs[attr];
+
+ option.setAttribute(attr, val);
+ }
+
+ if (data.children) {
+ var $option = $(option);
+
+ var label = document.createElement('strong');
+ label.className = 'select2-results__group';
+
+ var $label = $(label);
+ this.template(data, label);
+ $label.attr('role', 'presentation');
+
+ var $children = [];
+
+ for (var c = 0; c < data.children.length; c++) {
+ var child = data.children[c];
+
+ var $child = this.option(child);
+
+ $children.push($child);
+ }
+
+ var $childrenContainer = $('', {
+ 'class': 'select2-results__options select2-results__options--nested',
+ 'role': 'listbox'
+ });
+ $childrenContainer.append($children);
+ $option.attr('role', 'list');
+
+ $option.append(label);
+ $option.append($childrenContainer);
+ } else {
+ this.template(data, option);
+ }
+
+ $.data(option, 'data', data);
+
+ return option;
+ };
+
+ Results.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-results';
+
+ this.$results.attr('id', id);
+
+ container.on('results:all', function (params) {
+ self.clear();
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ self.highlightFirstItem();
+ }
+ });
+
+ container.on('results:append', function (params) {
+ self.append(params.data);
+
+ if (container.isOpen()) {
+ self.setClasses();
+ }
+ });
+
+ container.on('query', function (params) {
+ self.hideMessages();
+ self.showLoading(params);
+ });
+
+ container.on('select', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('unselect', function () {
+ if (!container.isOpen()) {
+ return;
+ }
+
+ self.setClasses();
+ self.highlightFirstItem();
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expended="true"
+ self.$results.attr('aria-expanded', 'true');
+ self.$results.attr('aria-hidden', 'false');
+
+ self.setClasses();
+ self.ensureHighlightVisible();
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expended="false"
+ self.$results.attr('aria-expanded', 'false');
+ self.$results.attr('aria-hidden', 'true');
+ self.$results.removeAttr('aria-activedescendant');
+ });
+
+ container.on('results:toggle', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ $highlighted.trigger('mouseup');
+ });
+
+ container.on('results:select', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var data = $highlighted.data('data');
+
+ if ($highlighted.attr('data-selected') == 'true') {
+ self.trigger('close', {});
+ } else {
+ self.trigger('select', {
+ data: data
+ });
+ }
+ });
+
+ container.on('results:previous', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[data-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ // If we are already at te top, don't move further
+ if (currentIndex === 0) {
+ return;
+ }
+
+ var nextIndex = currentIndex - 1;
+
+ // If none are highlighted, highlight the first
+ if ($highlighted.length === 0) {
+ nextIndex = 0;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top;
+ var nextTop = $next.offset().top;
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextTop - currentOffset < 0) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:next', function () {
+ var $highlighted = self.getHighlightedResults();
+
+ var $options = self.$results.find('[data-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var nextIndex = currentIndex + 1;
+
+ // If we are at the last option, stay there
+ if (nextIndex >= $options.length) {
+ return;
+ }
+
+ var $next = $options.eq(nextIndex);
+
+ $next.trigger('mouseenter');
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
+
+ if (nextIndex === 0) {
+ self.$results.scrollTop(0);
+ } else if (nextBottom > currentOffset) {
+ self.$results.scrollTop(nextOffset);
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ params.element.addClass('select2-results__option--highlighted').attr('aria-selected', 'true');
+ self.$results.attr('aria-activedescendant', params.element.attr('id'));
+ });
+
+ container.on('results:message', function (params) {
+ self.displayMessage(params);
+ });
+
+ if ($.fn.mousewheel) {
+ this.$results.on('mousewheel', function (e) {
+ var top = self.$results.scrollTop();
+
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
+
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
+
+ if (isAtTop) {
+ self.$results.scrollTop(0);
+
+ e.preventDefault();
+ e.stopPropagation();
+ } else if (isAtBottom) {
+ self.$results.scrollTop(
+ self.$results.get(0).scrollHeight - self.$results.height()
+ );
+
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ });
+ }
+
+ this.$results.on('mouseup', '.select2-results__option[data-selected]',
+ function (evt) {
+ var $this = $(this);
+
+ var data = $this.data('data');
+
+ if ($this.attr('data-selected') === 'true') {
+ if (self.options.get('multiple')) {
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ } else {
+ self.trigger('close', {});
+ }
+
+ return;
+ }
+
+ self.trigger('select', {
+ originalEvent: evt,
+ data: data
+ });
+ });
+
+ this.$results.on('mouseenter', '.select2-results__option[data-selected]',
+ function (evt) {
+ var data = $(this).data('data');
+
+ self.getHighlightedResults()
+ .removeClass('select2-results__option--highlighted')
+ .attr('aria-selected', 'false');
+
+ self.trigger('results:focus', {
+ data: data,
+ element: $(this)
+ });
+ });
+ };
+
+ Results.prototype.getHighlightedResults = function () {
+ var $highlighted = this.$results
+ .find('.select2-results__option--highlighted');
+
+ return $highlighted;
+ };
+
+ Results.prototype.destroy = function () {
+ this.$results.remove();
+ };
+
+ Results.prototype.ensureHighlightVisible = function () {
+ var $highlighted = this.getHighlightedResults();
+
+ if ($highlighted.length === 0) {
+ return;
+ }
+
+ var $options = this.$results.find('[data-selected]');
+
+ var currentIndex = $options.index($highlighted);
+
+ var currentOffset = this.$results.offset().top;
+ var nextTop = $highlighted.offset().top;
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
+
+ var offsetDelta = nextTop - currentOffset;
+ nextOffset -= $highlighted.outerHeight(false) * 2;
+
+ if (currentIndex <= 2) {
+ this.$results.scrollTop(0);
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
+ this.$results.scrollTop(nextOffset);
+ }
+ };
+
+ Results.prototype.template = function (result, container) {
+ var template = this.options.get('templateResult');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ var content = template(result, container);
+
+ if (content == null) {
+ container.style.display = 'none';
+ } else if (typeof content === 'string') {
+ container.innerHTML = escapeMarkup(content);
+ } else {
+ $(container).append(content);
+ }
+ };
+
+ return Results;
+});
+
+S2.define('select2/keys',[
+
+], function () {
+ var KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ ENTER: 13,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
+ ESC: 27,
+ SPACE: 32,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ END: 35,
+ HOME: 36,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DELETE: 46
+ };
+
+ return KEYS;
+});
+
+S2.define('select2/selection/base',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function BaseSelection ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ BaseSelection.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseSelection, Utils.Observable);
+
+ BaseSelection.prototype.render = function () {
+ var $selection = $(
+ '' +
+ ''
+ );
+
+ this._tabindex = 0;
+
+ if (this.$element.data('old-tabindex') != null) {
+ this._tabindex = this.$element.data('old-tabindex');
+ } else if (this.$element.attr('tabindex') != null) {
+ this._tabindex = this.$element.attr('tabindex');
+ }
+
+ $selection.attr('title', this.$element.attr('title'));
+ $selection.attr('tabindex', this._tabindex);
+
+ this.$selection = $selection;
+
+ return $selection;
+ };
+
+ BaseSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ var id = container.id + '-container';
+ var resultsId = container.id + '-results';
+ var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
+
+ this.container = container;
+
+ this.$selection.on('focus', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('blur', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ if (evt.which === KEYS.SPACE) {
+ evt.preventDefault();
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+
+ container.on('open', function () {
+ // When the dropdown is open, aria-expanded="true"
+ self.$selection.attr('aria-expanded', 'true');
+ self.$selection.attr('aria-owns', resultsId);
+
+ self._attachCloseHandler(container);
+ });
+
+ container.on('close', function () {
+ // When the dropdown is closed, aria-expanded="false"
+ self.$selection.attr('aria-expanded', 'false');
+ self.$selection.removeAttr('aria-activedescendant');
+ self.$selection.removeAttr('aria-owns');
+
+ // This needs to be delayed as the active element is the body when the
+ // key is pressed.
+ window.setTimeout(function () {
+ self.$selection.focus();
+ }, 1);
+
+ self._detachCloseHandler(container);
+ });
+
+ container.on('enable', function () {
+ self.$selection.attr('tabindex', self._tabindex);
+ });
+
+ container.on('disable', function () {
+ self.$selection.attr('tabindex', '-1');
+ });
+ };
+
+ BaseSelection.prototype._handleBlur = function (evt) {
+ var self = this;
+
+ // This needs to be delayed as the active element is the body when the tab
+ // key is pressed, possibly along with others.
+ window.setTimeout(function () {
+ // Don't trigger `blur` if the focus is still in the selection
+ if (
+ (document.activeElement == self.$selection[0]) ||
+ ($.contains(self.$selection[0], document.activeElement))
+ ) {
+ return;
+ }
+
+ self.trigger('blur', evt);
+ }, 1);
+ };
+
+ BaseSelection.prototype._attachCloseHandler = function (container) {
+ var self = this;
+
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
+ var $target = $(e.target);
+
+ var $select = $target.closest('.select2');
+
+ var $all = $('.select2.select2-container--open');
+
+ $all.each(function () {
+ var $this = $(this);
+
+ if (this == $select[0]) {
+ return;
+ }
+
+ var $element = $this.data('element');
+ $element.select2('close');
+
+ // Remove any focus when dropdown is closed by clicking outside the select area.
+ // Timeout of 1 required for close to finish wrapping up.
+ setTimeout(function(){
+ $this.find('*:focus').blur();
+ $target.focus();
+ }, 1);
+ });
+ });
+ };
+
+ BaseSelection.prototype._detachCloseHandler = function (container) {
+ $(document.body).off('mousedown.select2.' + container.id);
+ };
+
+ BaseSelection.prototype.position = function ($selection, $container) {
+ var $selectionContainer = $container.find('.selection');
+ $selectionContainer.append($selection);
+ };
+
+ BaseSelection.prototype.destroy = function () {
+ this._detachCloseHandler(this.container);
+ };
+
+ BaseSelection.prototype.update = function (data) {
+ throw new Error('The `update` method must be defined in child classes.');
+ };
+
+ return BaseSelection;
+});
+
+S2.define('select2/selection/single',[
+ 'jquery',
+ './base',
+ '../utils',
+ '../keys'
+], function ($, BaseSelection, Utils, KEYS) {
+ function SingleSelection () {
+ SingleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(SingleSelection, BaseSelection);
+
+ SingleSelection.prototype.render = function () {
+ var $selection = SingleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--single');
+
+ $selection.html(
+ '' +
+ '' +
+ '' +
+ ''
+ );
+
+ return $selection;
+ };
+
+ SingleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ SingleSelection.__super__.bind.apply(this, arguments);
+
+ var id = container.id + '-container';
+
+ this.$selection.find('.select2-selection__rendered')
+ .attr('id', id)
+ .attr('role', 'textbox')
+ .attr('aria-readonly', 'true');
+ this.$selection.attr('aria-labelledby', id);
+
+ // This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
+ this.$selection.attr('role', 'combobox');
+
+ this.$selection.on('mousedown', function (evt) {
+ // Only respond to left clicks
+ if (evt.which !== 1) {
+ return;
+ }
+
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on('focus', function (evt) {
+ // User focuses on the container
+ });
+
+ this.$selection.on('keydown', function (evt) {
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
+ container.open();
+ }
+ });
+
+ this.$selection.on('blur', function (evt) {
+ // User exits the container
+ });
+
+ container.on('focus', function (evt) {
+ if (!container.isOpen()) {
+ self.$selection.focus();
+ }
+ });
+
+ container.on('selection:update', function (params) {
+ self.update(params.data);
+ });
+ };
+
+ SingleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ SingleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ SingleSelection.prototype.selectionContainer = function () {
+ return $('');
+ };
+
+ SingleSelection.prototype.update = function (data) {
+ if (data.length === 0) {
+ this.clear();
+ return;
+ }
+
+ var selection = data[0];
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ var formatted = this.display(selection, $rendered);
+
+ $rendered.empty().text(formatted);
+ $rendered.prop('title', selection.title || selection.text);
+ };
+
+ return SingleSelection;
+});
+
+S2.define('select2/selection/multiple',[
+ 'jquery',
+ './base',
+ '../utils'
+], function ($, BaseSelection, Utils) {
+ function MultipleSelection ($element, options) {
+ MultipleSelection.__super__.constructor.apply(this, arguments);
+ }
+
+ Utils.Extend(MultipleSelection, BaseSelection);
+
+ MultipleSelection.prototype.render = function () {
+ var $selection = MultipleSelection.__super__.render.call(this);
+
+ $selection.addClass('select2-selection--multiple');
+
+ $selection.html(
+ ''
+ );
+
+ return $selection;
+ };
+
+ MultipleSelection.prototype.bind = function (container, $container) {
+ var self = this;
+
+ MultipleSelection.__super__.bind.apply(this, arguments);
+
+ this.$selection.on('click', function (evt) {
+ self.trigger('toggle', {
+ originalEvent: evt
+ });
+ });
+
+ this.$selection.on(
+ 'click',
+ '.select2-selection__choice__remove',
+ function (evt) {
+ // Ignore the event if it is disabled
+ if (self.options.get('disabled')) {
+ return;
+ }
+
+ var $remove = $(this);
+ var $selection = $remove.parent();
+
+ var data = $selection.data('data');
+
+ self.trigger('unselect', {
+ originalEvent: evt,
+ data: data
+ });
+ }
+ );
+
+ this.$selection.on('keydown', function (evt) {
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
+ container.open();
+ }
+ });
+
+ // Focus on the search field when the container is focused instead of the main container.
+ container.on( 'focus', function(){
+ self.focusOnSearch();
+ });
+ };
+
+ MultipleSelection.prototype.clear = function () {
+ this.$selection.find('.select2-selection__rendered').empty();
+ };
+
+ MultipleSelection.prototype.display = function (data, container) {
+ var template = this.options.get('templateSelection');
+ var escapeMarkup = this.options.get('escapeMarkup');
+
+ return escapeMarkup(template(data, container));
+ };
+
+ MultipleSelection.prototype.selectionContainer = function () {
+ var $container = $(
+ '' +
+ '' +
+ '×' +
+ '' +
+ ''
+ );
+
+ return $container;
+ };
+
+ /**
+ * Focus on the search field instead of the main multiselect container.
+ */
+ MultipleSelection.prototype.focusOnSearch = function() {
+ var self = this;
+
+ if ('undefined' !== typeof self.$search) {
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
+ setTimeout(function(){
+ // Prevent the dropdown opening again when focused from this.
+ // This gets reset automatically when focus is triggered.
+ self._keyUpPrevented = true;
+
+ self.$search.focus();
+ }, 1);
+ }
+ }
+
+ MultipleSelection.prototype.update = function (data) {
+ this.clear();
+
+ if (data.length === 0) {
+ return;
+ }
+
+ var $selections = [];
+
+ for (var d = 0; d < data.length; d++) {
+ var selection = data[d];
+
+ var $selection = this.selectionContainer();
+ var formatted = this.display(selection, $selection);
+ if ('string' === typeof formatted) {
+ formatted = formatted.trim();
+ }
+
+ $selection.append(formatted);
+ $selection.prop('title', selection.title || selection.text);
+
+ $selection.data('data', selection);
+
+ $selections.push($selection);
+ }
+
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+
+ Utils.appendMany($rendered, $selections);
+ };
+
+ return MultipleSelection;
+});
+
+S2.define('select2/selection/placeholder',[
+ '../utils'
+], function (Utils) {
+ function Placeholder (decorated, $element, options) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options);
+ }
+
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
+ var $placeholder = this.selectionContainer();
+
+ $placeholder.html(this.display(placeholder));
+ $placeholder.addClass('select2-selection__placeholder')
+ .removeClass('select2-selection__choice');
+
+ return $placeholder;
+ };
+
+ Placeholder.prototype.update = function (decorated, data) {
+ var singlePlaceholder = (
+ data.length == 1 && data[0].id != this.placeholder.id
+ );
+ var multipleSelections = data.length > 1;
+
+ if (multipleSelections || singlePlaceholder) {
+ return decorated.call(this, data);
+ }
+
+ this.clear();
+
+ var $placeholder = this.createPlaceholder(this.placeholder);
+
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
+ };
+
+ return Placeholder;
+});
+
+S2.define('select2/selection/allowClear',[
+ 'jquery',
+ '../keys'
+], function ($, KEYS) {
+ function AllowClear () { }
+
+ AllowClear.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ if (this.placeholder == null) {
+ if (this.options.get('debug') && window.console && console.error) {
+ console.error(
+ 'Select2: The `allowClear` option should be used in combination ' +
+ 'with the `placeholder` option.'
+ );
+ }
+ }
+
+ this.$selection.on('mousedown', '.select2-selection__clear',
+ function (evt) {
+ self._handleClear(evt);
+ });
+
+ container.on('keypress', function (evt) {
+ self._handleKeyboardClear(evt, container);
+ });
+ };
+
+ AllowClear.prototype._handleClear = function (_, evt) {
+ // Ignore the event if it is disabled
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ var $clear = this.$selection.find('.select2-selection__clear');
+
+ // Ignore the event if nothing has been selected
+ if ($clear.length === 0) {
+ return;
+ }
+
+ evt.stopPropagation();
+
+ var data = $clear.data('data');
+
+ for (var d = 0; d < data.length; d++) {
+ var unselectData = {
+ data: data[d]
+ };
+
+ // Trigger the `unselect` event, so people can prevent it from being
+ // cleared.
+ this.trigger('unselect', unselectData);
+
+ // If the event was prevented, don't clear it out.
+ if (unselectData.prevented) {
+ return;
+ }
+ }
+
+ this.$element.val(this.placeholder.id).trigger('change');
+
+ this.trigger('toggle', {});
+ };
+
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
+ if (container.isOpen()) {
+ return;
+ }
+
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
+ this._handleClear(evt);
+ }
+ };
+
+ AllowClear.prototype.update = function (decorated, data) {
+ decorated.call(this, data);
+
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
+ data.length === 0) {
+ return;
+ }
+
+ var $remove = $(
+ '' +
+ '×' +
+ ''
+ );
+ $remove.data('data', data);
+
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
+ };
+
+ return AllowClear;
+});
+
+S2.define('select2/selection/search',[
+ 'jquery',
+ '../utils',
+ '../keys'
+], function ($, Utils, KEYS) {
+ function Search (decorated, $element, options) {
+ decorated.call(this, $element, options);
+ }
+
+ Search.prototype.render = function (decorated) {
+ var $search = $(
+ '' +
+ '' +
+ ''
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ var $rendered = decorated.call(this);
+
+ this._transferTabIndex();
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+ var resultsId = container.id + '-results';
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self.$search.attr('aria-owns', resultsId);
+ self.$search.trigger('focus');
+ });
+
+ container.on('close', function () {
+ self.$search.val('');
+ self.$search.removeAttr('aria-activedescendant');
+ self.$search.removeAttr('aria-owns');
+ self.$search.trigger('focus');
+ });
+
+ container.on('enable', function () {
+ self.$search.prop('disabled', false);
+
+ self._transferTabIndex();
+ });
+
+ container.on('disable', function () {
+ self.$search.prop('disabled', true);
+ });
+
+ container.on('focus', function (evt) {
+ self.$search.trigger('focus');
+ });
+
+ container.on('results:focus', function (params) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ });
+
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
+ self._handleBlur(evt);
+ });
+
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
+ evt.stopPropagation();
+
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+
+ var key = evt.which;
+
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
+ var $previousChoice = self.$searchContainer
+ .prev('.select2-selection__choice');
+
+ if ($previousChoice.length > 0) {
+ var item = $previousChoice.data('data');
+
+ self.searchRemoveChoice(item);
+
+ evt.preventDefault();
+ }
+ } else if (evt.which === KEYS.ENTER) {
+ container.open();
+ evt.preventDefault();
+ }
+ });
+
+ // Try to detect the IE version should the `documentMode` property that
+ // is stored on the document. This is only implemented in IE and is
+ // slightly cleaner than doing a user agent check.
+ // This property is not available in Edge, but Edge also doesn't have
+ // this bug.
+ var msie = document.documentMode;
+ var disableInputEvents = msie && msie <= 11;
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$selection.on(
+ 'input.searchcheck',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents) {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ // Unbind the duplicated `keyup` event
+ self.$selection.off('keyup.search');
+ }
+ );
+
+ this.$selection.on(
+ 'keyup.search input.search',
+ '.select2-search--inline',
+ function (evt) {
+ // IE will trigger the `input` event when a placeholder is used on a
+ // search box. To get around this issue, we are forced to ignore all
+ // `input` events in IE and keep using `keyup`.
+ if (disableInputEvents && evt.type === 'input') {
+ self.$selection.off('input.search input.searchcheck');
+ return;
+ }
+
+ var key = evt.which;
+
+ // We can freely ignore events from modifier keys
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
+ return;
+ }
+
+ // Tabbing will be handled during the `keydown` phase
+ if (key == KEYS.TAB) {
+ return;
+ }
+
+ self.handleSearch(evt);
+ }
+ );
+ };
+
+ /**
+ * This method will transfer the tabindex attribute from the rendered
+ * selection to the search box. This allows for the search box to be used as
+ * the primary focus instead of the selection container.
+ *
+ * @private
+ */
+ Search.prototype._transferTabIndex = function (decorated) {
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
+ this.$selection.attr('tabindex', '-1');
+ };
+
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
+ this.$search.attr('placeholder', placeholder.text);
+ };
+
+ Search.prototype.update = function (decorated, data) {
+ var searchHadFocus = this.$search[0] == document.activeElement;
+
+ this.$search.attr('placeholder', '');
+
+ decorated.call(this, data);
+
+ this.$selection.find('.select2-selection__rendered')
+ .append(this.$searchContainer);
+
+ this.resizeSearch();
+ if (searchHadFocus) {
+ this.$search.focus();
+ }
+ };
+
+ Search.prototype.handleSearch = function () {
+ this.resizeSearch();
+
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
+ this.trigger('unselect', {
+ data: item
+ });
+
+ this.$search.val(item.text);
+ this.handleSearch();
+ };
+
+ Search.prototype.resizeSearch = function () {
+ this.$search.css('width', '25px');
+
+ var width = '';
+
+ if (this.$search.attr('placeholder') !== '') {
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
+ } else {
+ var minimumWidth = this.$search.val().length + 1;
+
+ width = (minimumWidth * 0.75) + 'em';
+ }
+
+ this.$search.css('width', width);
+ };
+
+ return Search;
+});
+
+S2.define('select2/selection/eventRelay',[
+ 'jquery'
+], function ($) {
+ function EventRelay () { }
+
+ EventRelay.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+ var relayEvents = [
+ 'open', 'opening',
+ 'close', 'closing',
+ 'select', 'selecting',
+ 'unselect', 'unselecting'
+ ];
+
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
+
+ decorated.call(this, container, $container);
+
+ container.on('*', function (name, params) {
+ // Ignore events that should not be relayed
+ if ($.inArray(name, relayEvents) === -1) {
+ return;
+ }
+
+ // The parameters should always be an object
+ params = params || {};
+
+ // Generate the jQuery event for the Select2 event
+ var evt = $.Event('select2:' + name, {
+ params: params
+ });
+
+ self.$element.trigger(evt);
+
+ // Only handle preventable events if it was one
+ if ($.inArray(name, preventableEvents) === -1) {
+ return;
+ }
+
+ params.prevented = evt.isDefaultPrevented();
+ });
+ };
+
+ return EventRelay;
+});
+
+S2.define('select2/translation',[
+ 'jquery',
+ 'require'
+], function ($, require) {
+ function Translation (dict) {
+ this.dict = dict || {};
+ }
+
+ Translation.prototype.all = function () {
+ return this.dict;
+ };
+
+ Translation.prototype.get = function (key) {
+ return this.dict[key];
+ };
+
+ Translation.prototype.extend = function (translation) {
+ this.dict = $.extend({}, translation.all(), this.dict);
+ };
+
+ // Static functions
+
+ Translation._cache = {};
+
+ Translation.loadPath = function (path) {
+ if (!(path in Translation._cache)) {
+ var translations = require(path);
+
+ Translation._cache[path] = translations;
+ }
+
+ return new Translation(Translation._cache[path]);
+ };
+
+ return Translation;
+});
+
+S2.define('select2/diacritics',[
+
+], function () {
+ var diacritics = {
+ '\u24B6': 'A',
+ '\uFF21': 'A',
+ '\u00C0': 'A',
+ '\u00C1': 'A',
+ '\u00C2': 'A',
+ '\u1EA6': 'A',
+ '\u1EA4': 'A',
+ '\u1EAA': 'A',
+ '\u1EA8': 'A',
+ '\u00C3': 'A',
+ '\u0100': 'A',
+ '\u0102': 'A',
+ '\u1EB0': 'A',
+ '\u1EAE': 'A',
+ '\u1EB4': 'A',
+ '\u1EB2': 'A',
+ '\u0226': 'A',
+ '\u01E0': 'A',
+ '\u00C4': 'A',
+ '\u01DE': 'A',
+ '\u1EA2': 'A',
+ '\u00C5': 'A',
+ '\u01FA': 'A',
+ '\u01CD': 'A',
+ '\u0200': 'A',
+ '\u0202': 'A',
+ '\u1EA0': 'A',
+ '\u1EAC': 'A',
+ '\u1EB6': 'A',
+ '\u1E00': 'A',
+ '\u0104': 'A',
+ '\u023A': 'A',
+ '\u2C6F': 'A',
+ '\uA732': 'AA',
+ '\u00C6': 'AE',
+ '\u01FC': 'AE',
+ '\u01E2': 'AE',
+ '\uA734': 'AO',
+ '\uA736': 'AU',
+ '\uA738': 'AV',
+ '\uA73A': 'AV',
+ '\uA73C': 'AY',
+ '\u24B7': 'B',
+ '\uFF22': 'B',
+ '\u1E02': 'B',
+ '\u1E04': 'B',
+ '\u1E06': 'B',
+ '\u0243': 'B',
+ '\u0182': 'B',
+ '\u0181': 'B',
+ '\u24B8': 'C',
+ '\uFF23': 'C',
+ '\u0106': 'C',
+ '\u0108': 'C',
+ '\u010A': 'C',
+ '\u010C': 'C',
+ '\u00C7': 'C',
+ '\u1E08': 'C',
+ '\u0187': 'C',
+ '\u023B': 'C',
+ '\uA73E': 'C',
+ '\u24B9': 'D',
+ '\uFF24': 'D',
+ '\u1E0A': 'D',
+ '\u010E': 'D',
+ '\u1E0C': 'D',
+ '\u1E10': 'D',
+ '\u1E12': 'D',
+ '\u1E0E': 'D',
+ '\u0110': 'D',
+ '\u018B': 'D',
+ '\u018A': 'D',
+ '\u0189': 'D',
+ '\uA779': 'D',
+ '\u01F1': 'DZ',
+ '\u01C4': 'DZ',
+ '\u01F2': 'Dz',
+ '\u01C5': 'Dz',
+ '\u24BA': 'E',
+ '\uFF25': 'E',
+ '\u00C8': 'E',
+ '\u00C9': 'E',
+ '\u00CA': 'E',
+ '\u1EC0': 'E',
+ '\u1EBE': 'E',
+ '\u1EC4': 'E',
+ '\u1EC2': 'E',
+ '\u1EBC': 'E',
+ '\u0112': 'E',
+ '\u1E14': 'E',
+ '\u1E16': 'E',
+ '\u0114': 'E',
+ '\u0116': 'E',
+ '\u00CB': 'E',
+ '\u1EBA': 'E',
+ '\u011A': 'E',
+ '\u0204': 'E',
+ '\u0206': 'E',
+ '\u1EB8': 'E',
+ '\u1EC6': 'E',
+ '\u0228': 'E',
+ '\u1E1C': 'E',
+ '\u0118': 'E',
+ '\u1E18': 'E',
+ '\u1E1A': 'E',
+ '\u0190': 'E',
+ '\u018E': 'E',
+ '\u24BB': 'F',
+ '\uFF26': 'F',
+ '\u1E1E': 'F',
+ '\u0191': 'F',
+ '\uA77B': 'F',
+ '\u24BC': 'G',
+ '\uFF27': 'G',
+ '\u01F4': 'G',
+ '\u011C': 'G',
+ '\u1E20': 'G',
+ '\u011E': 'G',
+ '\u0120': 'G',
+ '\u01E6': 'G',
+ '\u0122': 'G',
+ '\u01E4': 'G',
+ '\u0193': 'G',
+ '\uA7A0': 'G',
+ '\uA77D': 'G',
+ '\uA77E': 'G',
+ '\u24BD': 'H',
+ '\uFF28': 'H',
+ '\u0124': 'H',
+ '\u1E22': 'H',
+ '\u1E26': 'H',
+ '\u021E': 'H',
+ '\u1E24': 'H',
+ '\u1E28': 'H',
+ '\u1E2A': 'H',
+ '\u0126': 'H',
+ '\u2C67': 'H',
+ '\u2C75': 'H',
+ '\uA78D': 'H',
+ '\u24BE': 'I',
+ '\uFF29': 'I',
+ '\u00CC': 'I',
+ '\u00CD': 'I',
+ '\u00CE': 'I',
+ '\u0128': 'I',
+ '\u012A': 'I',
+ '\u012C': 'I',
+ '\u0130': 'I',
+ '\u00CF': 'I',
+ '\u1E2E': 'I',
+ '\u1EC8': 'I',
+ '\u01CF': 'I',
+ '\u0208': 'I',
+ '\u020A': 'I',
+ '\u1ECA': 'I',
+ '\u012E': 'I',
+ '\u1E2C': 'I',
+ '\u0197': 'I',
+ '\u24BF': 'J',
+ '\uFF2A': 'J',
+ '\u0134': 'J',
+ '\u0248': 'J',
+ '\u24C0': 'K',
+ '\uFF2B': 'K',
+ '\u1E30': 'K',
+ '\u01E8': 'K',
+ '\u1E32': 'K',
+ '\u0136': 'K',
+ '\u1E34': 'K',
+ '\u0198': 'K',
+ '\u2C69': 'K',
+ '\uA740': 'K',
+ '\uA742': 'K',
+ '\uA744': 'K',
+ '\uA7A2': 'K',
+ '\u24C1': 'L',
+ '\uFF2C': 'L',
+ '\u013F': 'L',
+ '\u0139': 'L',
+ '\u013D': 'L',
+ '\u1E36': 'L',
+ '\u1E38': 'L',
+ '\u013B': 'L',
+ '\u1E3C': 'L',
+ '\u1E3A': 'L',
+ '\u0141': 'L',
+ '\u023D': 'L',
+ '\u2C62': 'L',
+ '\u2C60': 'L',
+ '\uA748': 'L',
+ '\uA746': 'L',
+ '\uA780': 'L',
+ '\u01C7': 'LJ',
+ '\u01C8': 'Lj',
+ '\u24C2': 'M',
+ '\uFF2D': 'M',
+ '\u1E3E': 'M',
+ '\u1E40': 'M',
+ '\u1E42': 'M',
+ '\u2C6E': 'M',
+ '\u019C': 'M',
+ '\u24C3': 'N',
+ '\uFF2E': 'N',
+ '\u01F8': 'N',
+ '\u0143': 'N',
+ '\u00D1': 'N',
+ '\u1E44': 'N',
+ '\u0147': 'N',
+ '\u1E46': 'N',
+ '\u0145': 'N',
+ '\u1E4A': 'N',
+ '\u1E48': 'N',
+ '\u0220': 'N',
+ '\u019D': 'N',
+ '\uA790': 'N',
+ '\uA7A4': 'N',
+ '\u01CA': 'NJ',
+ '\u01CB': 'Nj',
+ '\u24C4': 'O',
+ '\uFF2F': 'O',
+ '\u00D2': 'O',
+ '\u00D3': 'O',
+ '\u00D4': 'O',
+ '\u1ED2': 'O',
+ '\u1ED0': 'O',
+ '\u1ED6': 'O',
+ '\u1ED4': 'O',
+ '\u00D5': 'O',
+ '\u1E4C': 'O',
+ '\u022C': 'O',
+ '\u1E4E': 'O',
+ '\u014C': 'O',
+ '\u1E50': 'O',
+ '\u1E52': 'O',
+ '\u014E': 'O',
+ '\u022E': 'O',
+ '\u0230': 'O',
+ '\u00D6': 'O',
+ '\u022A': 'O',
+ '\u1ECE': 'O',
+ '\u0150': 'O',
+ '\u01D1': 'O',
+ '\u020C': 'O',
+ '\u020E': 'O',
+ '\u01A0': 'O',
+ '\u1EDC': 'O',
+ '\u1EDA': 'O',
+ '\u1EE0': 'O',
+ '\u1EDE': 'O',
+ '\u1EE2': 'O',
+ '\u1ECC': 'O',
+ '\u1ED8': 'O',
+ '\u01EA': 'O',
+ '\u01EC': 'O',
+ '\u00D8': 'O',
+ '\u01FE': 'O',
+ '\u0186': 'O',
+ '\u019F': 'O',
+ '\uA74A': 'O',
+ '\uA74C': 'O',
+ '\u01A2': 'OI',
+ '\uA74E': 'OO',
+ '\u0222': 'OU',
+ '\u24C5': 'P',
+ '\uFF30': 'P',
+ '\u1E54': 'P',
+ '\u1E56': 'P',
+ '\u01A4': 'P',
+ '\u2C63': 'P',
+ '\uA750': 'P',
+ '\uA752': 'P',
+ '\uA754': 'P',
+ '\u24C6': 'Q',
+ '\uFF31': 'Q',
+ '\uA756': 'Q',
+ '\uA758': 'Q',
+ '\u024A': 'Q',
+ '\u24C7': 'R',
+ '\uFF32': 'R',
+ '\u0154': 'R',
+ '\u1E58': 'R',
+ '\u0158': 'R',
+ '\u0210': 'R',
+ '\u0212': 'R',
+ '\u1E5A': 'R',
+ '\u1E5C': 'R',
+ '\u0156': 'R',
+ '\u1E5E': 'R',
+ '\u024C': 'R',
+ '\u2C64': 'R',
+ '\uA75A': 'R',
+ '\uA7A6': 'R',
+ '\uA782': 'R',
+ '\u24C8': 'S',
+ '\uFF33': 'S',
+ '\u1E9E': 'S',
+ '\u015A': 'S',
+ '\u1E64': 'S',
+ '\u015C': 'S',
+ '\u1E60': 'S',
+ '\u0160': 'S',
+ '\u1E66': 'S',
+ '\u1E62': 'S',
+ '\u1E68': 'S',
+ '\u0218': 'S',
+ '\u015E': 'S',
+ '\u2C7E': 'S',
+ '\uA7A8': 'S',
+ '\uA784': 'S',
+ '\u24C9': 'T',
+ '\uFF34': 'T',
+ '\u1E6A': 'T',
+ '\u0164': 'T',
+ '\u1E6C': 'T',
+ '\u021A': 'T',
+ '\u0162': 'T',
+ '\u1E70': 'T',
+ '\u1E6E': 'T',
+ '\u0166': 'T',
+ '\u01AC': 'T',
+ '\u01AE': 'T',
+ '\u023E': 'T',
+ '\uA786': 'T',
+ '\uA728': 'TZ',
+ '\u24CA': 'U',
+ '\uFF35': 'U',
+ '\u00D9': 'U',
+ '\u00DA': 'U',
+ '\u00DB': 'U',
+ '\u0168': 'U',
+ '\u1E78': 'U',
+ '\u016A': 'U',
+ '\u1E7A': 'U',
+ '\u016C': 'U',
+ '\u00DC': 'U',
+ '\u01DB': 'U',
+ '\u01D7': 'U',
+ '\u01D5': 'U',
+ '\u01D9': 'U',
+ '\u1EE6': 'U',
+ '\u016E': 'U',
+ '\u0170': 'U',
+ '\u01D3': 'U',
+ '\u0214': 'U',
+ '\u0216': 'U',
+ '\u01AF': 'U',
+ '\u1EEA': 'U',
+ '\u1EE8': 'U',
+ '\u1EEE': 'U',
+ '\u1EEC': 'U',
+ '\u1EF0': 'U',
+ '\u1EE4': 'U',
+ '\u1E72': 'U',
+ '\u0172': 'U',
+ '\u1E76': 'U',
+ '\u1E74': 'U',
+ '\u0244': 'U',
+ '\u24CB': 'V',
+ '\uFF36': 'V',
+ '\u1E7C': 'V',
+ '\u1E7E': 'V',
+ '\u01B2': 'V',
+ '\uA75E': 'V',
+ '\u0245': 'V',
+ '\uA760': 'VY',
+ '\u24CC': 'W',
+ '\uFF37': 'W',
+ '\u1E80': 'W',
+ '\u1E82': 'W',
+ '\u0174': 'W',
+ '\u1E86': 'W',
+ '\u1E84': 'W',
+ '\u1E88': 'W',
+ '\u2C72': 'W',
+ '\u24CD': 'X',
+ '\uFF38': 'X',
+ '\u1E8A': 'X',
+ '\u1E8C': 'X',
+ '\u24CE': 'Y',
+ '\uFF39': 'Y',
+ '\u1EF2': 'Y',
+ '\u00DD': 'Y',
+ '\u0176': 'Y',
+ '\u1EF8': 'Y',
+ '\u0232': 'Y',
+ '\u1E8E': 'Y',
+ '\u0178': 'Y',
+ '\u1EF6': 'Y',
+ '\u1EF4': 'Y',
+ '\u01B3': 'Y',
+ '\u024E': 'Y',
+ '\u1EFE': 'Y',
+ '\u24CF': 'Z',
+ '\uFF3A': 'Z',
+ '\u0179': 'Z',
+ '\u1E90': 'Z',
+ '\u017B': 'Z',
+ '\u017D': 'Z',
+ '\u1E92': 'Z',
+ '\u1E94': 'Z',
+ '\u01B5': 'Z',
+ '\u0224': 'Z',
+ '\u2C7F': 'Z',
+ '\u2C6B': 'Z',
+ '\uA762': 'Z',
+ '\u24D0': 'a',
+ '\uFF41': 'a',
+ '\u1E9A': 'a',
+ '\u00E0': 'a',
+ '\u00E1': 'a',
+ '\u00E2': 'a',
+ '\u1EA7': 'a',
+ '\u1EA5': 'a',
+ '\u1EAB': 'a',
+ '\u1EA9': 'a',
+ '\u00E3': 'a',
+ '\u0101': 'a',
+ '\u0103': 'a',
+ '\u1EB1': 'a',
+ '\u1EAF': 'a',
+ '\u1EB5': 'a',
+ '\u1EB3': 'a',
+ '\u0227': 'a',
+ '\u01E1': 'a',
+ '\u00E4': 'a',
+ '\u01DF': 'a',
+ '\u1EA3': 'a',
+ '\u00E5': 'a',
+ '\u01FB': 'a',
+ '\u01CE': 'a',
+ '\u0201': 'a',
+ '\u0203': 'a',
+ '\u1EA1': 'a',
+ '\u1EAD': 'a',
+ '\u1EB7': 'a',
+ '\u1E01': 'a',
+ '\u0105': 'a',
+ '\u2C65': 'a',
+ '\u0250': 'a',
+ '\uA733': 'aa',
+ '\u00E6': 'ae',
+ '\u01FD': 'ae',
+ '\u01E3': 'ae',
+ '\uA735': 'ao',
+ '\uA737': 'au',
+ '\uA739': 'av',
+ '\uA73B': 'av',
+ '\uA73D': 'ay',
+ '\u24D1': 'b',
+ '\uFF42': 'b',
+ '\u1E03': 'b',
+ '\u1E05': 'b',
+ '\u1E07': 'b',
+ '\u0180': 'b',
+ '\u0183': 'b',
+ '\u0253': 'b',
+ '\u24D2': 'c',
+ '\uFF43': 'c',
+ '\u0107': 'c',
+ '\u0109': 'c',
+ '\u010B': 'c',
+ '\u010D': 'c',
+ '\u00E7': 'c',
+ '\u1E09': 'c',
+ '\u0188': 'c',
+ '\u023C': 'c',
+ '\uA73F': 'c',
+ '\u2184': 'c',
+ '\u24D3': 'd',
+ '\uFF44': 'd',
+ '\u1E0B': 'd',
+ '\u010F': 'd',
+ '\u1E0D': 'd',
+ '\u1E11': 'd',
+ '\u1E13': 'd',
+ '\u1E0F': 'd',
+ '\u0111': 'd',
+ '\u018C': 'd',
+ '\u0256': 'd',
+ '\u0257': 'd',
+ '\uA77A': 'd',
+ '\u01F3': 'dz',
+ '\u01C6': 'dz',
+ '\u24D4': 'e',
+ '\uFF45': 'e',
+ '\u00E8': 'e',
+ '\u00E9': 'e',
+ '\u00EA': 'e',
+ '\u1EC1': 'e',
+ '\u1EBF': 'e',
+ '\u1EC5': 'e',
+ '\u1EC3': 'e',
+ '\u1EBD': 'e',
+ '\u0113': 'e',
+ '\u1E15': 'e',
+ '\u1E17': 'e',
+ '\u0115': 'e',
+ '\u0117': 'e',
+ '\u00EB': 'e',
+ '\u1EBB': 'e',
+ '\u011B': 'e',
+ '\u0205': 'e',
+ '\u0207': 'e',
+ '\u1EB9': 'e',
+ '\u1EC7': 'e',
+ '\u0229': 'e',
+ '\u1E1D': 'e',
+ '\u0119': 'e',
+ '\u1E19': 'e',
+ '\u1E1B': 'e',
+ '\u0247': 'e',
+ '\u025B': 'e',
+ '\u01DD': 'e',
+ '\u24D5': 'f',
+ '\uFF46': 'f',
+ '\u1E1F': 'f',
+ '\u0192': 'f',
+ '\uA77C': 'f',
+ '\u24D6': 'g',
+ '\uFF47': 'g',
+ '\u01F5': 'g',
+ '\u011D': 'g',
+ '\u1E21': 'g',
+ '\u011F': 'g',
+ '\u0121': 'g',
+ '\u01E7': 'g',
+ '\u0123': 'g',
+ '\u01E5': 'g',
+ '\u0260': 'g',
+ '\uA7A1': 'g',
+ '\u1D79': 'g',
+ '\uA77F': 'g',
+ '\u24D7': 'h',
+ '\uFF48': 'h',
+ '\u0125': 'h',
+ '\u1E23': 'h',
+ '\u1E27': 'h',
+ '\u021F': 'h',
+ '\u1E25': 'h',
+ '\u1E29': 'h',
+ '\u1E2B': 'h',
+ '\u1E96': 'h',
+ '\u0127': 'h',
+ '\u2C68': 'h',
+ '\u2C76': 'h',
+ '\u0265': 'h',
+ '\u0195': 'hv',
+ '\u24D8': 'i',
+ '\uFF49': 'i',
+ '\u00EC': 'i',
+ '\u00ED': 'i',
+ '\u00EE': 'i',
+ '\u0129': 'i',
+ '\u012B': 'i',
+ '\u012D': 'i',
+ '\u00EF': 'i',
+ '\u1E2F': 'i',
+ '\u1EC9': 'i',
+ '\u01D0': 'i',
+ '\u0209': 'i',
+ '\u020B': 'i',
+ '\u1ECB': 'i',
+ '\u012F': 'i',
+ '\u1E2D': 'i',
+ '\u0268': 'i',
+ '\u0131': 'i',
+ '\u24D9': 'j',
+ '\uFF4A': 'j',
+ '\u0135': 'j',
+ '\u01F0': 'j',
+ '\u0249': 'j',
+ '\u24DA': 'k',
+ '\uFF4B': 'k',
+ '\u1E31': 'k',
+ '\u01E9': 'k',
+ '\u1E33': 'k',
+ '\u0137': 'k',
+ '\u1E35': 'k',
+ '\u0199': 'k',
+ '\u2C6A': 'k',
+ '\uA741': 'k',
+ '\uA743': 'k',
+ '\uA745': 'k',
+ '\uA7A3': 'k',
+ '\u24DB': 'l',
+ '\uFF4C': 'l',
+ '\u0140': 'l',
+ '\u013A': 'l',
+ '\u013E': 'l',
+ '\u1E37': 'l',
+ '\u1E39': 'l',
+ '\u013C': 'l',
+ '\u1E3D': 'l',
+ '\u1E3B': 'l',
+ '\u017F': 'l',
+ '\u0142': 'l',
+ '\u019A': 'l',
+ '\u026B': 'l',
+ '\u2C61': 'l',
+ '\uA749': 'l',
+ '\uA781': 'l',
+ '\uA747': 'l',
+ '\u01C9': 'lj',
+ '\u24DC': 'm',
+ '\uFF4D': 'm',
+ '\u1E3F': 'm',
+ '\u1E41': 'm',
+ '\u1E43': 'm',
+ '\u0271': 'm',
+ '\u026F': 'm',
+ '\u24DD': 'n',
+ '\uFF4E': 'n',
+ '\u01F9': 'n',
+ '\u0144': 'n',
+ '\u00F1': 'n',
+ '\u1E45': 'n',
+ '\u0148': 'n',
+ '\u1E47': 'n',
+ '\u0146': 'n',
+ '\u1E4B': 'n',
+ '\u1E49': 'n',
+ '\u019E': 'n',
+ '\u0272': 'n',
+ '\u0149': 'n',
+ '\uA791': 'n',
+ '\uA7A5': 'n',
+ '\u01CC': 'nj',
+ '\u24DE': 'o',
+ '\uFF4F': 'o',
+ '\u00F2': 'o',
+ '\u00F3': 'o',
+ '\u00F4': 'o',
+ '\u1ED3': 'o',
+ '\u1ED1': 'o',
+ '\u1ED7': 'o',
+ '\u1ED5': 'o',
+ '\u00F5': 'o',
+ '\u1E4D': 'o',
+ '\u022D': 'o',
+ '\u1E4F': 'o',
+ '\u014D': 'o',
+ '\u1E51': 'o',
+ '\u1E53': 'o',
+ '\u014F': 'o',
+ '\u022F': 'o',
+ '\u0231': 'o',
+ '\u00F6': 'o',
+ '\u022B': 'o',
+ '\u1ECF': 'o',
+ '\u0151': 'o',
+ '\u01D2': 'o',
+ '\u020D': 'o',
+ '\u020F': 'o',
+ '\u01A1': 'o',
+ '\u1EDD': 'o',
+ '\u1EDB': 'o',
+ '\u1EE1': 'o',
+ '\u1EDF': 'o',
+ '\u1EE3': 'o',
+ '\u1ECD': 'o',
+ '\u1ED9': 'o',
+ '\u01EB': 'o',
+ '\u01ED': 'o',
+ '\u00F8': 'o',
+ '\u01FF': 'o',
+ '\u0254': 'o',
+ '\uA74B': 'o',
+ '\uA74D': 'o',
+ '\u0275': 'o',
+ '\u01A3': 'oi',
+ '\u0223': 'ou',
+ '\uA74F': 'oo',
+ '\u24DF': 'p',
+ '\uFF50': 'p',
+ '\u1E55': 'p',
+ '\u1E57': 'p',
+ '\u01A5': 'p',
+ '\u1D7D': 'p',
+ '\uA751': 'p',
+ '\uA753': 'p',
+ '\uA755': 'p',
+ '\u24E0': 'q',
+ '\uFF51': 'q',
+ '\u024B': 'q',
+ '\uA757': 'q',
+ '\uA759': 'q',
+ '\u24E1': 'r',
+ '\uFF52': 'r',
+ '\u0155': 'r',
+ '\u1E59': 'r',
+ '\u0159': 'r',
+ '\u0211': 'r',
+ '\u0213': 'r',
+ '\u1E5B': 'r',
+ '\u1E5D': 'r',
+ '\u0157': 'r',
+ '\u1E5F': 'r',
+ '\u024D': 'r',
+ '\u027D': 'r',
+ '\uA75B': 'r',
+ '\uA7A7': 'r',
+ '\uA783': 'r',
+ '\u24E2': 's',
+ '\uFF53': 's',
+ '\u00DF': 's',
+ '\u015B': 's',
+ '\u1E65': 's',
+ '\u015D': 's',
+ '\u1E61': 's',
+ '\u0161': 's',
+ '\u1E67': 's',
+ '\u1E63': 's',
+ '\u1E69': 's',
+ '\u0219': 's',
+ '\u015F': 's',
+ '\u023F': 's',
+ '\uA7A9': 's',
+ '\uA785': 's',
+ '\u1E9B': 's',
+ '\u24E3': 't',
+ '\uFF54': 't',
+ '\u1E6B': 't',
+ '\u1E97': 't',
+ '\u0165': 't',
+ '\u1E6D': 't',
+ '\u021B': 't',
+ '\u0163': 't',
+ '\u1E71': 't',
+ '\u1E6F': 't',
+ '\u0167': 't',
+ '\u01AD': 't',
+ '\u0288': 't',
+ '\u2C66': 't',
+ '\uA787': 't',
+ '\uA729': 'tz',
+ '\u24E4': 'u',
+ '\uFF55': 'u',
+ '\u00F9': 'u',
+ '\u00FA': 'u',
+ '\u00FB': 'u',
+ '\u0169': 'u',
+ '\u1E79': 'u',
+ '\u016B': 'u',
+ '\u1E7B': 'u',
+ '\u016D': 'u',
+ '\u00FC': 'u',
+ '\u01DC': 'u',
+ '\u01D8': 'u',
+ '\u01D6': 'u',
+ '\u01DA': 'u',
+ '\u1EE7': 'u',
+ '\u016F': 'u',
+ '\u0171': 'u',
+ '\u01D4': 'u',
+ '\u0215': 'u',
+ '\u0217': 'u',
+ '\u01B0': 'u',
+ '\u1EEB': 'u',
+ '\u1EE9': 'u',
+ '\u1EEF': 'u',
+ '\u1EED': 'u',
+ '\u1EF1': 'u',
+ '\u1EE5': 'u',
+ '\u1E73': 'u',
+ '\u0173': 'u',
+ '\u1E77': 'u',
+ '\u1E75': 'u',
+ '\u0289': 'u',
+ '\u24E5': 'v',
+ '\uFF56': 'v',
+ '\u1E7D': 'v',
+ '\u1E7F': 'v',
+ '\u028B': 'v',
+ '\uA75F': 'v',
+ '\u028C': 'v',
+ '\uA761': 'vy',
+ '\u24E6': 'w',
+ '\uFF57': 'w',
+ '\u1E81': 'w',
+ '\u1E83': 'w',
+ '\u0175': 'w',
+ '\u1E87': 'w',
+ '\u1E85': 'w',
+ '\u1E98': 'w',
+ '\u1E89': 'w',
+ '\u2C73': 'w',
+ '\u24E7': 'x',
+ '\uFF58': 'x',
+ '\u1E8B': 'x',
+ '\u1E8D': 'x',
+ '\u24E8': 'y',
+ '\uFF59': 'y',
+ '\u1EF3': 'y',
+ '\u00FD': 'y',
+ '\u0177': 'y',
+ '\u1EF9': 'y',
+ '\u0233': 'y',
+ '\u1E8F': 'y',
+ '\u00FF': 'y',
+ '\u1EF7': 'y',
+ '\u1E99': 'y',
+ '\u1EF5': 'y',
+ '\u01B4': 'y',
+ '\u024F': 'y',
+ '\u1EFF': 'y',
+ '\u24E9': 'z',
+ '\uFF5A': 'z',
+ '\u017A': 'z',
+ '\u1E91': 'z',
+ '\u017C': 'z',
+ '\u017E': 'z',
+ '\u1E93': 'z',
+ '\u1E95': 'z',
+ '\u01B6': 'z',
+ '\u0225': 'z',
+ '\u0240': 'z',
+ '\u2C6C': 'z',
+ '\uA763': 'z',
+ '\u0386': '\u0391',
+ '\u0388': '\u0395',
+ '\u0389': '\u0397',
+ '\u038A': '\u0399',
+ '\u03AA': '\u0399',
+ '\u038C': '\u039F',
+ '\u038E': '\u03A5',
+ '\u03AB': '\u03A5',
+ '\u038F': '\u03A9',
+ '\u03AC': '\u03B1',
+ '\u03AD': '\u03B5',
+ '\u03AE': '\u03B7',
+ '\u03AF': '\u03B9',
+ '\u03CA': '\u03B9',
+ '\u0390': '\u03B9',
+ '\u03CC': '\u03BF',
+ '\u03CD': '\u03C5',
+ '\u03CB': '\u03C5',
+ '\u03B0': '\u03C5',
+ '\u03C9': '\u03C9',
+ '\u03C2': '\u03C3'
+ };
+
+ return diacritics;
+});
+
+S2.define('select2/data/base',[
+ '../utils'
+], function (Utils) {
+ function BaseAdapter ($element, options) {
+ BaseAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(BaseAdapter, Utils.Observable);
+
+ BaseAdapter.prototype.current = function (callback) {
+ throw new Error('The `current` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.query = function (params, callback) {
+ throw new Error('The `query` method must be defined in child classes.');
+ };
+
+ BaseAdapter.prototype.bind = function (container, $container) {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.destroy = function () {
+ // Can be implemented in subclasses
+ };
+
+ BaseAdapter.prototype.generateResultId = function (container, data) {
+ var id = '';
+
+ if (container != null) {
+ id += container.id
+ } else {
+ id += Utils.generateChars(4);
+ }
+
+ id += '-result-';
+ id += Utils.generateChars(4);
+
+ if (data.id != null) {
+ id += '-' + data.id.toString();
+ } else {
+ id += '-' + Utils.generateChars(4);
+ }
+ return id;
+ };
+
+ return BaseAdapter;
+});
+
+S2.define('select2/data/select',[
+ './base',
+ '../utils',
+ 'jquery'
+], function (BaseAdapter, Utils, $) {
+ function SelectAdapter ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ SelectAdapter.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(SelectAdapter, BaseAdapter);
+
+ SelectAdapter.prototype.current = function (callback) {
+ var data = [];
+ var self = this;
+
+ this.$element.find(':selected').each(function () {
+ var $option = $(this);
+
+ var option = self.item($option);
+
+ data.push(option);
+ });
+
+ callback(data);
+ };
+
+ SelectAdapter.prototype.select = function (data) {
+ var self = this;
+
+ data.selected = true;
+
+ // If data.element is a DOM node, use it instead
+ if ($(data.element).is('option')) {
+ data.element.selected = true;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ if (this.$element.prop('multiple')) {
+ this.current(function (currentData) {
+ var val = [];
+
+ data = [data];
+ data.push.apply(data, currentData);
+
+ for (var d = 0; d < data.length; d++) {
+ var id = data[d].id;
+
+ if ($.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+ self.$element.trigger('change');
+ });
+ } else {
+ var val = data.id;
+
+ this.$element.val(val);
+ this.$element.trigger('change');
+ }
+ };
+
+ SelectAdapter.prototype.unselect = function (data) {
+ var self = this;
+
+ if (!this.$element.prop('multiple')) {
+ return;
+ }
+
+ data.selected = false;
+
+ if ($(data.element).is('option')) {
+ data.element.selected = false;
+
+ this.$element.trigger('change');
+
+ return;
+ }
+
+ this.current(function (currentData) {
+ var val = [];
+
+ for (var d = 0; d < currentData.length; d++) {
+ var id = currentData[d].id;
+
+ if (id !== data.id && $.inArray(id, val) === -1) {
+ val.push(id);
+ }
+ }
+
+ self.$element.val(val);
+
+ self.$element.trigger('change');
+ });
+ };
+
+ SelectAdapter.prototype.bind = function (container, $container) {
+ var self = this;
+
+ this.container = container;
+
+ container.on('select', function (params) {
+ self.select(params.data);
+ });
+
+ container.on('unselect', function (params) {
+ self.unselect(params.data);
+ });
+ };
+
+ SelectAdapter.prototype.destroy = function () {
+ // Remove anything added to child elements
+ this.$element.find('*').each(function () {
+ // Remove any custom data set by Select2
+ $.removeData(this, 'data');
+ });
+ };
+
+ SelectAdapter.prototype.query = function (params, callback) {
+ var data = [];
+ var self = this;
+
+ var $options = this.$element.children();
+
+ $options.each(function () {
+ var $option = $(this);
+
+ if (!$option.is('option') && !$option.is('optgroup')) {
+ return;
+ }
+
+ var option = self.item($option);
+
+ var matches = self.matches(params, option);
+
+ if (matches !== null) {
+ data.push(matches);
+ }
+ });
+
+ callback({
+ results: data
+ });
+ };
+
+ SelectAdapter.prototype.addOptions = function ($options) {
+ Utils.appendMany(this.$element, $options);
+ };
+
+ SelectAdapter.prototype.option = function (data) {
+ var option;
+
+ if (data.children) {
+ option = document.createElement('optgroup');
+ option.label = data.text;
+ } else {
+ option = document.createElement('option');
+
+ if (option.textContent !== undefined) {
+ option.textContent = data.text;
+ } else {
+ option.innerText = data.text;
+ }
+ }
+
+ if (data.id !== undefined) {
+ option.value = data.id;
+ }
+
+ if (data.disabled) {
+ option.disabled = true;
+ }
+
+ if (data.selected) {
+ option.selected = true;
+ }
+
+ if (data.title) {
+ option.title = data.title;
+ }
+
+ var $option = $(option);
+
+ var normalizedData = this._normalizeItem(data);
+ normalizedData.element = option;
+
+ // Override the option's data with the combined data
+ $.data(option, 'data', normalizedData);
+
+ return $option;
+ };
+
+ SelectAdapter.prototype.item = function ($option) {
+ var data = {};
+
+ data = $.data($option[0], 'data');
+
+ if (data != null) {
+ return data;
+ }
+
+ if ($option.is('option')) {
+ data = {
+ id: $option.val(),
+ text: $option.text(),
+ disabled: $option.prop('disabled'),
+ selected: $option.prop('selected'),
+ title: $option.prop('title')
+ };
+ } else if ($option.is('optgroup')) {
+ data = {
+ text: $option.prop('label'),
+ children: [],
+ title: $option.prop('title')
+ };
+
+ var $children = $option.children('option');
+ var children = [];
+
+ for (var c = 0; c < $children.length; c++) {
+ var $child = $($children[c]);
+
+ var child = this.item($child);
+
+ children.push(child);
+ }
+
+ data.children = children;
+ }
+
+ data = this._normalizeItem(data);
+ data.element = $option[0];
+
+ $.data($option[0], 'data', data);
+
+ return data;
+ };
+
+ SelectAdapter.prototype._normalizeItem = function (item) {
+ if (!$.isPlainObject(item)) {
+ item = {
+ id: item,
+ text: item
+ };
+ }
+
+ item = $.extend({}, {
+ text: ''
+ }, item);
+
+ var defaults = {
+ selected: false,
+ disabled: false
+ };
+
+ if (item.id != null) {
+ item.id = item.id.toString();
+ }
+
+ if (item.text != null) {
+ item.text = item.text.toString();
+ }
+
+ if (item._resultId == null && item.id) {
+ item._resultId = this.generateResultId(this.container, item);
+ }
+
+ return $.extend({}, defaults, item);
+ };
+
+ SelectAdapter.prototype.matches = function (params, data) {
+ var matcher = this.options.get('matcher');
+
+ return matcher(params, data);
+ };
+
+ return SelectAdapter;
+});
+
+S2.define('select2/data/array',[
+ './select',
+ '../utils',
+ 'jquery'
+], function (SelectAdapter, Utils, $) {
+ function ArrayAdapter ($element, options) {
+ var data = options.get('data') || [];
+
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
+
+ this.addOptions(this.convertToOptions(data));
+ }
+
+ Utils.Extend(ArrayAdapter, SelectAdapter);
+
+ ArrayAdapter.prototype.select = function (data) {
+ var $option = this.$element.find('option').filter(function (i, elm) {
+ return elm.value == data.id.toString();
+ });
+
+ if ($option.length === 0) {
+ $option = this.option(data);
+
+ this.addOptions($option);
+ }
+
+ ArrayAdapter.__super__.select.call(this, data);
+ };
+
+ ArrayAdapter.prototype.convertToOptions = function (data) {
+ var self = this;
+
+ var $existing = this.$element.find('option');
+ var existingIds = $existing.map(function () {
+ return self.item($(this)).id;
+ }).get();
+
+ var $options = [];
+
+ // Filter out all items except for the one passed in the argument
+ function onlyItem (item) {
+ return function () {
+ return $(this).val() == item.id;
+ };
+ }
+
+ for (var d = 0; d < data.length; d++) {
+ var item = this._normalizeItem(data[d]);
+
+ // Skip items which were pre-loaded, only merge the data
+ if ($.inArray(item.id, existingIds) >= 0) {
+ var $existingOption = $existing.filter(onlyItem(item));
+
+ var existingData = this.item($existingOption);
+ var newData = $.extend(true, {}, item, existingData);
+
+ var $newOption = this.option(newData);
+
+ $existingOption.replaceWith($newOption);
+
+ continue;
+ }
+
+ var $option = this.option(item);
+
+ if (item.children) {
+ var $children = this.convertToOptions(item.children);
+
+ Utils.appendMany($option, $children);
+ }
+
+ $options.push($option);
+ }
+
+ return $options;
+ };
+
+ return ArrayAdapter;
+});
+
+S2.define('select2/data/ajax',[
+ './array',
+ '../utils',
+ 'jquery'
+], function (ArrayAdapter, Utils, $) {
+ function AjaxAdapter ($element, options) {
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
+
+ if (this.ajaxOptions.processResults != null) {
+ this.processResults = this.ajaxOptions.processResults;
+ }
+
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
+ }
+
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
+
+ AjaxAdapter.prototype._applyDefaults = function (options) {
+ var defaults = {
+ data: function (params) {
+ return $.extend({}, params, {
+ q: params.term
+ });
+ },
+ transport: function (params, success, failure) {
+ var $request = $.ajax(params);
+
+ $request.then(success);
+ $request.fail(failure);
+
+ return $request;
+ }
+ };
+
+ return $.extend({}, defaults, options, true);
+ };
+
+ AjaxAdapter.prototype.processResults = function (results) {
+ return results;
+ };
+
+ AjaxAdapter.prototype.query = function (params, callback) {
+ var matches = [];
+ var self = this;
+
+ if (this._request != null) {
+ // JSONP requests cannot always be aborted
+ if ($.isFunction(this._request.abort)) {
+ this._request.abort();
+ }
+
+ this._request = null;
+ }
+
+ var options = $.extend({
+ type: 'GET'
+ }, this.ajaxOptions);
+
+ if (typeof options.url === 'function') {
+ options.url = options.url.call(this.$element, params);
+ }
+
+ if (typeof options.data === 'function') {
+ options.data = options.data.call(this.$element, params);
+ }
+
+ function request () {
+ var $request = options.transport(options, function (data) {
+ var results = self.processResults(data, params);
+
+ if (self.options.get('debug') && window.console && console.error) {
+ // Check to make sure that the response included a `results` key.
+ if (!results || !results.results || !$.isArray(results.results)) {
+ console.error(
+ 'Select2: The AJAX results did not return an array in the ' +
+ '`results` key of the response.'
+ );
+ }
+ }
+
+ callback(results);
+ self.container.focusOnActiveElement();
+ }, function () {
+ // Attempt to detect if a request was aborted
+ // Only works if the transport exposes a status property
+ if ($request.status && $request.status === '0') {
+ return;
+ }
+
+ self.trigger('results:message', {
+ message: 'errorLoading'
+ });
+ });
+
+ self._request = $request;
+ }
+
+ if (this.ajaxOptions.delay && params.term != null) {
+ if (this._queryTimeout) {
+ window.clearTimeout(this._queryTimeout);
+ }
+
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
+ } else {
+ request();
+ }
+ };
+
+ return AjaxAdapter;
+});
+
+S2.define('select2/data/tags',[
+ 'jquery'
+], function ($) {
+ function Tags (decorated, $element, options) {
+ var tags = options.get('tags');
+
+ var createTag = options.get('createTag');
+
+ if (createTag !== undefined) {
+ this.createTag = createTag;
+ }
+
+ var insertTag = options.get('insertTag');
+
+ if (insertTag !== undefined) {
+ this.insertTag = insertTag;
+ }
+
+ decorated.call(this, $element, options);
+
+ if ($.isArray(tags)) {
+ for (var t = 0; t < tags.length; t++) {
+ var tag = tags[t];
+ var item = this._normalizeItem(tag);
+
+ var $option = this.option(item);
+
+ this.$element.append($option);
+ }
+ }
+ }
+
+ Tags.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ this._removeOldTags();
+
+ if (params.term == null || params.page != null) {
+ decorated.call(this, params, callback);
+ return;
+ }
+
+ function wrapper (obj, child) {
+ var data = obj.results;
+
+ for (var i = 0; i < data.length; i++) {
+ var option = data[i];
+
+ var checkChildren = (
+ option.children != null &&
+ !wrapper({
+ results: option.children
+ }, true)
+ );
+
+ var optionText = (option.text || '').toUpperCase();
+ var paramsTerm = (params.term || '').toUpperCase();
+
+ var checkText = optionText === paramsTerm;
+
+ if (checkText || checkChildren) {
+ if (child) {
+ return false;
+ }
+
+ obj.data = data;
+ callback(obj);
+
+ return;
+ }
+ }
+
+ if (child) {
+ return true;
+ }
+
+ var tag = self.createTag(params);
+
+ if (tag != null) {
+ var $option = self.option(tag);
+ $option.attr('data-select2-tag', true);
+
+ self.addOptions([$option]);
+
+ self.insertTag(data, tag);
+ }
+
+ obj.results = data;
+
+ callback(obj);
+ }
+
+ decorated.call(this, params, wrapper);
+ };
+
+ Tags.prototype.createTag = function (decorated, params) {
+ var term = $.trim(params.term);
+
+ if (term === '') {
+ return null;
+ }
+
+ return {
+ id: term,
+ text: term
+ };
+ };
+
+ Tags.prototype.insertTag = function (_, data, tag) {
+ data.unshift(tag);
+ };
+
+ Tags.prototype._removeOldTags = function (_) {
+ var tag = this._lastTag;
+
+ var $options = this.$element.find('option[data-select2-tag]');
+
+ $options.each(function () {
+ if (this.selected) {
+ return;
+ }
+
+ $(this).remove();
+ });
+ };
+
+ return Tags;
+});
+
+S2.define('select2/data/tokenizer',[
+ 'jquery'
+], function ($) {
+ function Tokenizer (decorated, $element, options) {
+ var tokenizer = options.get('tokenizer');
+
+ if (tokenizer !== undefined) {
+ this.tokenizer = tokenizer;
+ }
+
+ decorated.call(this, $element, options);
+ }
+
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
+ decorated.call(this, container, $container);
+
+ this.$search = container.dropdown.$search || container.selection.$search ||
+ $container.find('.select2-search__field');
+ };
+
+ Tokenizer.prototype.query = function (decorated, params, callback) {
+ var self = this;
+
+ function createAndSelect (data) {
+ // Normalize the data object so we can use it for checks
+ var item = self._normalizeItem(data);
+
+ // Check if the data object already exists as a tag
+ // Select it if it doesn't
+ var $existingOptions = self.$element.find('option').filter(function () {
+ return $(this).val() === item.id;
+ });
+
+ // If an existing option wasn't found for it, create the option
+ if (!$existingOptions.length) {
+ var $option = self.option(item);
+ $option.attr('data-select2-tag', true);
+
+ self._removeOldTags();
+ self.addOptions([$option]);
+ }
+
+ // Select the item, now that we know there is an option for it
+ select(item);
+ }
+
+ function select (data) {
+ self.trigger('select', {
+ data: data
+ });
+ }
+
+ params.term = params.term || '';
+
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
+
+ if (tokenData.term !== params.term) {
+ // Replace the search term if we have the search box
+ if (this.$search.length) {
+ this.$search.val(tokenData.term);
+ this.$search.focus();
+ }
+
+ params.term = tokenData.term;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
+ var separators = options.get('tokenSeparators') || [];
+ var term = params.term;
+ var i = 0;
+
+ var createTag = this.createTag || function (params) {
+ return {
+ id: params.term,
+ text: params.term
+ };
+ };
+
+ while (i < term.length) {
+ var termChar = term[i];
+
+ if ($.inArray(termChar, separators) === -1) {
+ i++;
+
+ continue;
+ }
+
+ var part = term.substr(0, i);
+ var partParams = $.extend({}, params, {
+ term: part
+ });
+
+ var data = createTag(partParams);
+
+ if (data == null) {
+ i++;
+ continue;
+ }
+
+ callback(data);
+
+ // Reset the term to not include the tokenized portion
+ term = term.substr(i + 1) || '';
+ i = 0;
+ }
+
+ return {
+ term: term
+ };
+ };
+
+ return Tokenizer;
+});
+
+S2.define('select2/data/minimumInputLength',[
+
+], function () {
+ function MinimumInputLength (decorated, $e, options) {
+ this.minimumInputLength = options.get('minimumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (params.term.length < this.minimumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooShort',
+ args: {
+ minimum: this.minimumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MinimumInputLength;
+});
+
+S2.define('select2/data/maximumInputLength',[
+
+], function () {
+ function MaximumInputLength (decorated, $e, options) {
+ this.maximumInputLength = options.get('maximumInputLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
+ params.term = params.term || '';
+
+ if (this.maximumInputLength > 0 &&
+ params.term.length > this.maximumInputLength) {
+ this.trigger('results:message', {
+ message: 'inputTooLong',
+ args: {
+ maximum: this.maximumInputLength,
+ input: params.term,
+ params: params
+ }
+ });
+
+ return;
+ }
+
+ decorated.call(this, params, callback);
+ };
+
+ return MaximumInputLength;
+});
+
+S2.define('select2/data/maximumSelectionLength',[
+
+], function (){
+ function MaximumSelectionLength (decorated, $e, options) {
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
+
+ decorated.call(this, $e, options);
+ }
+
+ MaximumSelectionLength.prototype.query =
+ function (decorated, params, callback) {
+ var self = this;
+
+ this.current(function (currentData) {
+ var count = currentData != null ? currentData.length : 0;
+ if (self.maximumSelectionLength > 0 &&
+ count >= self.maximumSelectionLength) {
+ self.trigger('results:message', {
+ message: 'maximumSelected',
+ args: {
+ maximum: self.maximumSelectionLength
+ }
+ });
+ return;
+ }
+ decorated.call(self, params, callback);
+ });
+ };
+
+ return MaximumSelectionLength;
+});
+
+S2.define('select2/dropdown',[
+ 'jquery',
+ './utils'
+], function ($, Utils) {
+ function Dropdown ($element, options) {
+ this.$element = $element;
+ this.options = options;
+
+ Dropdown.__super__.constructor.call(this);
+ }
+
+ Utils.Extend(Dropdown, Utils.Observable);
+
+ Dropdown.prototype.render = function () {
+ var $dropdown = $(
+ '' +
+ '' +
+ ''
+ );
+
+ $dropdown.attr('dir', this.options.get('dir'));
+
+ this.$dropdown = $dropdown;
+
+ return $dropdown;
+ };
+
+ Dropdown.prototype.bind = function () {
+ // Should be implemented in subclasses
+ };
+
+ Dropdown.prototype.position = function ($dropdown, $container) {
+ // Should be implmented in subclasses
+ };
+
+ Dropdown.prototype.destroy = function () {
+ // Remove the dropdown from the DOM
+ this.$dropdown.remove();
+ };
+
+ return Dropdown;
+});
+
+S2.define('select2/dropdown/search',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function Search () { }
+
+ Search.prototype.render = function (decorated) {
+ var $rendered = decorated.call(this);
+
+ var $search = $(
+ '' +
+ '' +
+ ''
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+
+ $rendered.prepend($search);
+
+ return $rendered;
+ };
+
+ Search.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+ var resultsId = container.id + '-results';
+
+ decorated.call(this, container, $container);
+
+ this.$search.on('keydown', function (evt) {
+ self.trigger('keypress', evt);
+
+ self._keyUpPrevented = evt.isDefaultPrevented();
+ });
+
+ // Workaround for browsers which do not support the `input` event
+ // This will prevent double-triggering of events for browsers which support
+ // both the `keyup` and `input` events.
+ this.$search.on('input', function (evt) {
+ // Unbind the duplicated `keyup` event
+ $(this).off('keyup');
+ });
+
+ this.$search.on('keyup input', function (evt) {
+ self.handleSearch(evt);
+ });
+
+ container.on('open', function () {
+ self.$search.attr('tabindex', 0);
+ self.$search.attr('aria-owns', resultsId);
+ self.$search.focus();
+
+ window.setTimeout(function () {
+ self.$search.focus();
+ }, 0);
+ });
+
+ container.on('close', function () {
+ self.$search.attr('tabindex', -1);
+ self.$search.removeAttr('aria-activedescendant');
+ self.$search.removeAttr('aria-owns');
+ self.$search.val('');
+ });
+
+ container.on('focus', function () {
+ if (!container.isOpen()) {
+ self.$search.focus();
+ }
+ });
+
+ container.on('results:all', function (params) {
+ if (params.query.term == null || params.query.term === '') {
+ var showSearch = self.showSearch(params);
+
+ if (showSearch) {
+ self.$searchContainer.removeClass('select2-search--hide');
+ } else {
+ self.$searchContainer.addClass('select2-search--hide');
+ }
+ }
+ });
+
+ container.on('results:focus', function (params) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ });
+ };
+
+ Search.prototype.handleSearch = function (evt) {
+ if (!this._keyUpPrevented) {
+ var input = this.$search.val();
+
+ this.trigger('query', {
+ term: input
+ });
+ }
+
+ this._keyUpPrevented = false;
+ };
+
+ Search.prototype.showSearch = function (_, params) {
+ return true;
+ };
+
+ return Search;
+});
+
+S2.define('select2/dropdown/hidePlaceholder',[
+
+], function () {
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ HidePlaceholder.prototype.append = function (decorated, data) {
+ data.results = this.removePlaceholder(data.results);
+
+ decorated.call(this, data);
+ };
+
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
+ if (typeof placeholder === 'string') {
+ placeholder = {
+ id: '',
+ text: placeholder
+ };
+ }
+
+ return placeholder;
+ };
+
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
+ var modifiedData = data.slice(0);
+
+ for (var d = data.length - 1; d >= 0; d--) {
+ var item = data[d];
+
+ if (this.placeholder.id === item.id) {
+ modifiedData.splice(d, 1);
+ }
+ }
+
+ return modifiedData;
+ };
+
+ return HidePlaceholder;
+});
+
+S2.define('select2/dropdown/infiniteScroll',[
+ 'jquery'
+], function ($) {
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
+ this.lastParams = {};
+
+ decorated.call(this, $element, options, dataAdapter);
+
+ this.$loadingMore = this.createLoadingMore();
+ this.loading = false;
+ }
+
+ InfiniteScroll.prototype.append = function (decorated, data) {
+ this.$loadingMore.remove();
+ this.loading = false;
+
+ decorated.call(this, data);
+
+ if (this.showLoadingMore(data)) {
+ this.$results.append(this.$loadingMore);
+ }
+ };
+
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('query', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ container.on('query:append', function (params) {
+ self.lastParams = params;
+ self.loading = true;
+ });
+
+ this.$results.on('scroll', function () {
+ var isLoadMoreVisible = $.contains(
+ document.documentElement,
+ self.$loadingMore[0]
+ );
+
+ if (self.loading || !isLoadMoreVisible) {
+ return;
+ }
+
+ var currentOffset = self.$results.offset().top +
+ self.$results.outerHeight(false);
+ var loadingMoreOffset = self.$loadingMore.offset().top +
+ self.$loadingMore.outerHeight(false);
+
+ if (currentOffset + 50 >= loadingMoreOffset) {
+ self.loadMore();
+ }
+ });
+ };
+
+ InfiniteScroll.prototype.loadMore = function () {
+ this.loading = true;
+
+ var params = $.extend({}, {page: 1}, this.lastParams);
+
+ params.page++;
+
+ this.trigger('query:append', params);
+ };
+
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
+ return data.pagination && data.pagination.more;
+ };
+
+ InfiniteScroll.prototype.createLoadingMore = function () {
+ var $option = $(
+ ''
+ );
+
+ var message = this.options.get('translations').get('loadingMore');
+
+ $option.html(message(this.lastParams));
+
+ return $option;
+ };
+
+ return InfiniteScroll;
+});
+
+S2.define('select2/dropdown/attachBody',[
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
+ function AttachBody (decorated, $element, options) {
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
+
+ decorated.call(this, $element, options);
+ }
+
+ AttachBody.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ var setupResultsEvents = false;
+
+ decorated.call(this, container, $container);
+
+ container.on('open', function () {
+ self._showDropdown();
+ self._attachPositioningHandler(container);
+
+ if (!setupResultsEvents) {
+ setupResultsEvents = true;
+
+ container.on('results:all', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:append', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ }
+ });
+
+ container.on('close', function () {
+ self._hideDropdown();
+ self._detachPositioningHandler(container);
+ });
+
+ this.$dropdownContainer.on('mousedown', function (evt) {
+ evt.stopPropagation();
+ });
+ };
+
+ AttachBody.prototype.destroy = function (decorated) {
+ decorated.call(this);
+
+ this.$dropdownContainer.remove();
+ };
+
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
+ // Clone all of the container classes
+ $dropdown.attr('class', $container.attr('class'));
+
+ $dropdown.removeClass('select2');
+ $dropdown.addClass('select2-container--open');
+
+ $dropdown.css({
+ position: 'absolute',
+ top: -999999
+ });
+
+ this.$container = $container;
+ };
+
+ AttachBody.prototype.render = function (decorated) {
+ var $container = $('');
+
+ var $dropdown = decorated.call(this);
+ $container.append($dropdown);
+
+ this.$dropdownContainer = $container;
+
+ return $container;
+ };
+
+ AttachBody.prototype._hideDropdown = function (decorated) {
+ this.$dropdownContainer.detach();
+ };
+
+ AttachBody.prototype._attachPositioningHandler =
+ function (decorated, container) {
+ var self = this;
+
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.each(function () {
+ $(this).data('select2-scroll-position', {
+ x: $(this).scrollLeft(),
+ y: $(this).scrollTop()
+ });
+ });
+
+ $watchers.on(scrollEvent, function (ev) {
+ var position = $(this).data('select2-scroll-position');
+ $(this).scrollTop(position.y);
+ });
+
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
+ function (e) {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+ };
+
+ AttachBody.prototype._detachPositioningHandler =
+ function (decorated, container) {
+ var scrollEvent = 'scroll.select2.' + container.id;
+ var resizeEvent = 'resize.select2.' + container.id;
+ var orientationEvent = 'orientationchange.select2.' + container.id;
+
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
+ $watchers.off(scrollEvent);
+
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
+ };
+
+ AttachBody.prototype._positionDropdown = function () {
+ var $window = $(window);
+
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
+
+ var newDirection = null;
+
+ var offset = this.$container.offset();
+
+ offset.bottom = offset.top + this.$container.outerHeight(false);
+
+ var container = {
+ height: this.$container.outerHeight(false)
+ };
+
+ container.top = offset.top;
+ container.bottom = offset.top + container.height;
+
+ var dropdown = {
+ height: this.$dropdown.outerHeight(false)
+ };
+
+ var viewport = {
+ top: $window.scrollTop(),
+ bottom: $window.scrollTop() + $window.height()
+ };
+
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
+
+ var css = {
+ left: offset.left,
+ top: container.bottom
+ };
+
+ // Determine what the parent element is to use for calciulating the offset
+ var $offsetParent = this.$dropdownParent;
+
+ // For statically positoned elements, we need to get the element
+ // that is determining the offset
+ if ($offsetParent.css('position') === 'static') {
+ $offsetParent = $offsetParent.offsetParent();
+ }
+
+ var parentOffset = $offsetParent.offset();
+
+ css.top -= parentOffset.top;
+ css.left -= parentOffset.left;
+
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
+ newDirection = 'below';
+ }
+
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
+ newDirection = 'above';
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
+ newDirection = 'below';
+ }
+
+ if (newDirection == 'above' ||
+ (isCurrentlyAbove && newDirection !== 'below')) {
+ css.top = container.top - parentOffset.top - dropdown.height;
+ }
+
+ if (newDirection != null) {
+ this.$dropdown
+ .removeClass('select2-dropdown--below select2-dropdown--above')
+ .addClass('select2-dropdown--' + newDirection);
+ this.$container
+ .removeClass('select2-container--below select2-container--above')
+ .addClass('select2-container--' + newDirection);
+ }
+
+ this.$dropdownContainer.css(css);
+ };
+
+ AttachBody.prototype._resizeDropdown = function () {
+ var css = {
+ width: this.$container.outerWidth(false) + 'px'
+ };
+
+ if (this.options.get('dropdownAutoWidth')) {
+ css.minWidth = css.width;
+ css.position = 'relative';
+ css.width = 'auto';
+ }
+
+ this.$dropdown.css(css);
+ };
+
+ AttachBody.prototype._showDropdown = function (decorated) {
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
+
+ this._positionDropdown();
+ this._resizeDropdown();
+ };
+
+ return AttachBody;
+});
+
+S2.define('select2/dropdown/minimumResultsForSearch',[
+
+], function () {
+ function countResults (data) {
+ var count = 0;
+
+ for (var d = 0; d < data.length; d++) {
+ var item = data[d];
+
+ if (item.children) {
+ count += countResults(item.children);
+ } else {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
+
+ if (this.minimumResultsForSearch < 0) {
+ this.minimumResultsForSearch = Infinity;
+ }
+
+ decorated.call(this, $element, options, dataAdapter);
+ }
+
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
+ return false;
+ }
+
+ return decorated.call(this, params);
+ };
+
+ return MinimumResultsForSearch;
+});
+
+S2.define('select2/dropdown/selectOnClose',[
+
+], function () {
+ function SelectOnClose () { }
+
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('close', function (params) {
+ self._handleSelectOnClose(params);
+ });
+ };
+
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
+ if (params && params.originalSelect2Event != null) {
+ var event = params.originalSelect2Event;
+
+ // Don't select an item if the close event was triggered from a select or
+ // unselect event
+ if (event._type === 'select' || event._type === 'unselect') {
+ return;
+ }
+ }
+
+ var $highlightedResults = this.getHighlightedResults();
+
+ // Only select highlighted results
+ if ($highlightedResults.length < 1) {
+ return;
+ }
+
+ var data = $highlightedResults.data('data');
+
+ // Don't re-select already selected resulte
+ if (
+ (data.element != null && data.element.selected) ||
+ (data.element == null && data.selected)
+ ) {
+ return;
+ }
+
+ this.trigger('select', {
+ data: data
+ });
+ };
+
+ return SelectOnClose;
+});
+
+S2.define('select2/dropdown/closeOnSelect',[
+
+], function () {
+ function CloseOnSelect () { }
+
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('select', function (evt) {
+ self._selectTriggered(evt);
+ });
+
+ container.on('unselect', function (evt) {
+ self._selectTriggered(evt);
+ });
+ };
+
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
+ var originalEvent = evt.originalEvent;
+
+ // Don't close if the control key is being held
+ if (originalEvent && originalEvent.ctrlKey) {
+ return;
+ }
+
+ this.trigger('close', {
+ originalEvent: originalEvent,
+ originalSelect2Event: evt
+ });
+ };
+
+ return CloseOnSelect;
+});
+
+S2.define('select2/i18n/en',[],function () {
+ // English
+ return {
+ errorLoading: function () {
+ return 'The results could not be loaded.';
+ },
+ inputTooLong: function (args) {
+ var overChars = args.input.length - args.maximum;
+
+ var message = 'Please delete ' + overChars + ' character';
+
+ if (overChars != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ inputTooShort: function (args) {
+ var remainingChars = args.minimum - args.input.length;
+
+ var message = 'Please enter ' + remainingChars + ' or more characters';
+
+ return message;
+ },
+ loadingMore: function () {
+ return 'Loading more results…';
+ },
+ maximumSelected: function (args) {
+ var message = 'You can only select ' + args.maximum + ' item';
+
+ if (args.maximum != 1) {
+ message += 's';
+ }
+
+ return message;
+ },
+ noResults: function () {
+ return 'No results found';
+ },
+ searching: function () {
+ return 'Searching…';
+ }
+ };
+});
+
+S2.define('select2/defaults',[
+ 'jquery',
+ 'require',
+
+ './results',
+
+ './selection/single',
+ './selection/multiple',
+ './selection/placeholder',
+ './selection/allowClear',
+ './selection/search',
+ './selection/eventRelay',
+
+ './utils',
+ './translation',
+ './diacritics',
+
+ './data/select',
+ './data/array',
+ './data/ajax',
+ './data/tags',
+ './data/tokenizer',
+ './data/minimumInputLength',
+ './data/maximumInputLength',
+ './data/maximumSelectionLength',
+
+ './dropdown',
+ './dropdown/search',
+ './dropdown/hidePlaceholder',
+ './dropdown/infiniteScroll',
+ './dropdown/attachBody',
+ './dropdown/minimumResultsForSearch',
+ './dropdown/selectOnClose',
+ './dropdown/closeOnSelect',
+
+ './i18n/en'
+], function ($, require,
+
+ ResultsList,
+
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
+ SelectionSearch, EventRelay,
+
+ Utils, Translation, DIACRITICS,
+
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
+
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
+
+ EnglishTranslation) {
+ function Defaults () {
+ this.reset();
+ }
+
+ Defaults.prototype.apply = function (options) {
+ options = $.extend(true, {}, this.defaults, options);
+
+ if (options.dataAdapter == null) {
+ if (options.ajax != null) {
+ options.dataAdapter = AjaxData;
+ } else if (options.data != null) {
+ options.dataAdapter = ArrayData;
+ } else {
+ options.dataAdapter = SelectData;
+ }
+
+ if (options.minimumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MinimumInputLength
+ );
+ }
+
+ if (options.maximumInputLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumInputLength
+ );
+ }
+
+ if (options.maximumSelectionLength > 0) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ MaximumSelectionLength
+ );
+ }
+
+ if (options.tags) {
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
+ }
+
+ if (options.tokenSeparators != null || options.tokenizer != null) {
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Tokenizer
+ );
+ }
+
+ if (options.query != null) {
+ var Query = require(options.amdBase + 'compat/query');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ Query
+ );
+ }
+
+ if (options.initSelection != null) {
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
+
+ options.dataAdapter = Utils.Decorate(
+ options.dataAdapter,
+ InitSelection
+ );
+ }
+ }
+
+ if (options.resultsAdapter == null) {
+ options.resultsAdapter = ResultsList;
+
+ if (options.ajax != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ InfiniteScroll
+ );
+ }
+
+ if (options.placeholder != null) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ HidePlaceholder
+ );
+ }
+
+ if (options.selectOnClose) {
+ options.resultsAdapter = Utils.Decorate(
+ options.resultsAdapter,
+ SelectOnClose
+ );
+ }
+ }
+
+ if (options.dropdownAdapter == null) {
+ if (options.multiple) {
+ options.dropdownAdapter = Dropdown;
+ } else {
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
+
+ options.dropdownAdapter = SearchableDropdown;
+ }
+
+ if (options.minimumResultsForSearch !== 0) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ MinimumResultsForSearch
+ );
+ }
+
+ if (options.closeOnSelect) {
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ CloseOnSelect
+ );
+ }
+
+ if (
+ options.dropdownCssClass != null ||
+ options.dropdownCss != null ||
+ options.adaptDropdownCssClass != null
+ ) {
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ DropdownCSS
+ );
+ }
+
+ options.dropdownAdapter = Utils.Decorate(
+ options.dropdownAdapter,
+ AttachBody
+ );
+ }
+
+ if (options.selectionAdapter == null) {
+ if (options.multiple) {
+ options.selectionAdapter = MultipleSelection;
+ } else {
+ options.selectionAdapter = SingleSelection;
+ }
+
+ // Add the placeholder mixin if a placeholder was specified
+ if (options.placeholder != null) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ Placeholder
+ );
+ }
+
+ if (options.allowClear) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ AllowClear
+ );
+ }
+
+ if (options.multiple) {
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ SelectionSearch
+ );
+ }
+
+ if (
+ options.containerCssClass != null ||
+ options.containerCss != null ||
+ options.adaptContainerCssClass != null
+ ) {
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ ContainerCSS
+ );
+ }
+
+ options.selectionAdapter = Utils.Decorate(
+ options.selectionAdapter,
+ EventRelay
+ );
+ }
+
+ if (typeof options.language === 'string') {
+ // Check if the language is specified with a region
+ if (options.language.indexOf('-') > 0) {
+ // Extract the region information if it is included
+ var languageParts = options.language.split('-');
+ var baseLanguage = languageParts[0];
+
+ options.language = [options.language, baseLanguage];
+ } else {
+ options.language = [options.language];
+ }
+ }
+
+ if ($.isArray(options.language)) {
+ var languages = new Translation();
+ options.language.push('en');
+
+ var languageNames = options.language;
+
+ for (var l = 0; l < languageNames.length; l++) {
+ var name = languageNames[l];
+ var language = {};
+
+ try {
+ // Try to load it with the original name
+ language = Translation.loadPath(name);
+ } catch (e) {
+ try {
+ // If we couldn't load it, check if it wasn't the full path
+ name = this.defaults.amdLanguageBase + name;
+ language = Translation.loadPath(name);
+ } catch (ex) {
+ // The translation could not be loaded at all. Sometimes this is
+ // because of a configuration problem, other times this can be
+ // because of how Select2 helps load all possible translation files.
+ if (options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The language file for "' + name + '" could not be ' +
+ 'automatically loaded. A fallback will be used instead.'
+ );
+ }
+
+ continue;
+ }
+ }
+
+ languages.extend(language);
+ }
+
+ options.translations = languages;
+ } else {
+ var baseTranslation = Translation.loadPath(
+ this.defaults.amdLanguageBase + 'en'
+ );
+ var customTranslation = new Translation(options.language);
+
+ customTranslation.extend(baseTranslation);
+
+ options.translations = customTranslation;
+ }
+
+ return options;
+ };
+
+ Defaults.prototype.reset = function () {
+ function stripDiacritics (text) {
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
+ function match(a) {
+ return DIACRITICS[a] || a;
+ }
+
+ return text.replace(/[^\u0000-\u007E]/g, match);
+ }
+
+ function matcher (params, data) {
+ // Always return the object if there is nothing to compare
+ if ($.trim(params.term) === '') {
+ return data;
+ }
+
+ // Do a recursive check for options with children
+ if (data.children && data.children.length > 0) {
+ // Clone the data object if there are children
+ // This is required as we modify the object to remove any non-matches
+ var match = $.extend(true, {}, data);
+
+ // Check each child of the option
+ for (var c = data.children.length - 1; c >= 0; c--) {
+ var child = data.children[c];
+
+ var matches = matcher(params, child);
+
+ // If there wasn't a match, remove the object in the array
+ if (matches == null) {
+ match.children.splice(c, 1);
+ }
+ }
+
+ // If any children matched, return the new object
+ if (match.children.length > 0) {
+ return match;
+ }
+
+ // If there were no matching children, check just the plain object
+ return matcher(params, match);
+ }
+
+ var original = stripDiacritics(data.text).toUpperCase();
+ var term = stripDiacritics(params.term).toUpperCase();
+
+ // Check if the text contains the term
+ if (original.indexOf(term) > -1) {
+ return data;
+ }
+
+ // If it doesn't contain the term, don't return anything
+ return null;
+ }
+
+ this.defaults = {
+ amdBase: './',
+ amdLanguageBase: './i18n/',
+ closeOnSelect: true,
+ debug: false,
+ dropdownAutoWidth: false,
+ escapeMarkup: Utils.escapeMarkup,
+ language: EnglishTranslation,
+ matcher: matcher,
+ minimumInputLength: 0,
+ maximumInputLength: 0,
+ maximumSelectionLength: 0,
+ minimumResultsForSearch: 0,
+ selectOnClose: false,
+ sorter: function (data) {
+ return data;
+ },
+ templateResult: function (result) {
+ return result.text;
+ },
+ templateSelection: function (selection) {
+ return selection.text;
+ },
+ theme: 'default',
+ width: 'resolve'
+ };
+ };
+
+ Defaults.prototype.set = function (key, value) {
+ var camelKey = $.camelCase(key);
+
+ var data = {};
+ data[camelKey] = value;
+
+ var convertedData = Utils._convertData(data);
+
+ $.extend(this.defaults, convertedData);
+ };
+
+ var defaults = new Defaults();
+
+ return defaults;
+});
+
+S2.define('select2/options',[
+ 'require',
+ 'jquery',
+ './defaults',
+ './utils'
+], function (require, $, Defaults, Utils) {
+ function Options (options, $element) {
+ this.options = options;
+
+ if ($element != null) {
+ this.fromElement($element);
+ }
+
+ this.options = Defaults.apply(this.options);
+
+ if ($element && $element.is('input')) {
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
+
+ this.options.dataAdapter = Utils.Decorate(
+ this.options.dataAdapter,
+ InputCompat
+ );
+ }
+ }
+
+ Options.prototype.fromElement = function ($e) {
+ var excludedData = ['select2'];
+
+ if (this.options.multiple == null) {
+ this.options.multiple = $e.prop('multiple');
+ }
+
+ if (this.options.disabled == null) {
+ this.options.disabled = $e.prop('disabled');
+ }
+
+ if (this.options.language == null) {
+ if ($e.prop('lang')) {
+ this.options.language = $e.prop('lang').toLowerCase();
+ } else if ($e.closest('[lang]').prop('lang')) {
+ this.options.language = $e.closest('[lang]').prop('lang');
+ }
+ }
+
+ if (this.options.dir == null) {
+ if ($e.prop('dir')) {
+ this.options.dir = $e.prop('dir');
+ } else if ($e.closest('[dir]').prop('dir')) {
+ this.options.dir = $e.closest('[dir]').prop('dir');
+ } else {
+ this.options.dir = 'ltr';
+ }
+ }
+
+ $e.prop('disabled', this.options.disabled);
+ $e.prop('multiple', this.options.multiple);
+
+ if ($e.data('select2Tags')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
+ 'removed in future versions of Select2.'
+ );
+ }
+
+ $e.data('data', $e.data('select2Tags'));
+ $e.data('tags', true);
+ }
+
+ if ($e.data('ajaxUrl')) {
+ if (this.options.debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
+ '`data-ajax--url` and support for the old attribute will be removed' +
+ ' in future versions of Select2.'
+ );
+ }
+
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
+ $e.data('ajax--url', $e.data('ajaxUrl'));
+ }
+
+ var dataset = {};
+
+ // Prefer the element's `dataset` attribute if it exists
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
+ } else {
+ dataset = $e.data();
+ }
+
+ var data = $.extend(true, {}, dataset);
+
+ data = Utils._convertData(data);
+
+ for (var key in data) {
+ if ($.inArray(key, excludedData) > -1) {
+ continue;
+ }
+
+ if ($.isPlainObject(this.options[key])) {
+ $.extend(this.options[key], data[key]);
+ } else {
+ this.options[key] = data[key];
+ }
+ }
+
+ return this;
+ };
+
+ Options.prototype.get = function (key) {
+ return this.options[key];
+ };
+
+ Options.prototype.set = function (key, val) {
+ this.options[key] = val;
+ };
+
+ return Options;
+});
+
+S2.define('select2/core',[
+ 'jquery',
+ './options',
+ './utils',
+ './keys'
+], function ($, Options, Utils, KEYS) {
+ var Select2 = function ($element, options) {
+ if ($element.data('select2') != null) {
+ $element.data('select2').destroy();
+ }
+
+ this.$element = $element;
+
+ this.id = this._generateId($element);
+
+ options = options || {};
+
+ this.options = new Options(options, $element);
+
+ Select2.__super__.constructor.call(this);
+
+ // Set up the tabindex
+
+ var tabindex = $element.attr('tabindex') || 0;
+ $element.data('old-tabindex', tabindex);
+ $element.attr('tabindex', '-1');
+
+ // Set up containers and adapters
+
+ var DataAdapter = this.options.get('dataAdapter');
+ this.dataAdapter = new DataAdapter($element, this.options);
+
+ var $container = this.render();
+
+ this._placeContainer($container);
+
+ var SelectionAdapter = this.options.get('selectionAdapter');
+ this.selection = new SelectionAdapter($element, this.options);
+ this.$selection = this.selection.render();
+
+ this.selection.position(this.$selection, $container);
+
+ var DropdownAdapter = this.options.get('dropdownAdapter');
+ this.dropdown = new DropdownAdapter($element, this.options);
+ this.$dropdown = this.dropdown.render();
+
+ this.dropdown.position(this.$dropdown, $container);
+
+ var ResultsAdapter = this.options.get('resultsAdapter');
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
+ this.$results = this.results.render();
+
+ this.results.position(this.$results, this.$dropdown);
+
+ // Bind events
+
+ var self = this;
+
+ // Bind the container to all of the adapters
+ this._bindAdapters();
+
+ // Register any DOM event handlers
+ this._registerDomEvents();
+
+ // Register any internal event handlers
+ this._registerDataEvents();
+ this._registerSelectionEvents();
+ this._registerDropdownEvents();
+ this._registerResultsEvents();
+ this._registerEvents();
+
+ // Set the initial state
+ this.dataAdapter.current(function (initialData) {
+ self.trigger('selection:update', {
+ data: initialData
+ });
+ });
+
+ // Hide the original select
+ $element.addClass('select2-hidden-accessible');
+ $element.attr('aria-hidden', 'true');
+
+ // Synchronize any monitored attributes
+ this._syncAttributes();
+
+ $element.data('select2', this);
+ };
+
+ Utils.Extend(Select2, Utils.Observable);
+
+ Select2.prototype._generateId = function ($element) {
+ var id = '';
+
+ if ($element.attr('id') != null) {
+ id = $element.attr('id');
+ } else if ($element.attr('name') != null) {
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
+ } else {
+ id = Utils.generateChars(4);
+ }
+
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
+ id = 'select2-' + id;
+
+ return id;
+ };
+
+ Select2.prototype._placeContainer = function ($container) {
+ $container.insertAfter(this.$element);
+
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
+
+ if (width != null) {
+ $container.css('width', width);
+ }
+ };
+
+ Select2.prototype._resolveWidth = function ($element, method) {
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
+
+ if (method == 'resolve') {
+ var styleWidth = this._resolveWidth($element, 'style');
+
+ if (styleWidth != null) {
+ return styleWidth;
+ }
+
+ return this._resolveWidth($element, 'element');
+ }
+
+ if (method == 'element') {
+ var elementWidth = $element.outerWidth(false);
+
+ if (elementWidth <= 0) {
+ return 'auto';
+ }
+
+ return elementWidth + 'px';
+ }
+
+ if (method == 'style') {
+ var style = $element.attr('style');
+
+ if (typeof(style) !== 'string') {
+ return null;
+ }
+
+ var attrs = style.split(';');
+
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
+ var attr = attrs[i].replace(/\s/g, '');
+ var matches = attr.match(WIDTH);
+
+ if (matches !== null && matches.length >= 1) {
+ return matches[1];
+ }
+ }
+
+ return null;
+ }
+
+ return method;
+ };
+
+ Select2.prototype._bindAdapters = function () {
+ this.dataAdapter.bind(this, this.$container);
+ this.selection.bind(this, this.$container);
+
+ this.dropdown.bind(this, this.$container);
+ this.results.bind(this, this.$container);
+ };
+
+ Select2.prototype._registerDomEvents = function () {
+ var self = this;
+
+ this.$element.on('change.select2', function () {
+ self.dataAdapter.current(function (data) {
+ self.trigger('selection:update', {
+ data: data
+ });
+ });
+ });
+
+ this.$element.on('focus.select2', function (evt) {
+ self.trigger('focus', evt);
+ });
+
+ this._syncA = Utils.bind(this._syncAttributes, this);
+ this._syncS = Utils.bind(this._syncSubtree, this);
+
+ if (this.$element[0].attachEvent) {
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
+ }
+
+ var observer = window.MutationObserver ||
+ window.WebKitMutationObserver ||
+ window.MozMutationObserver
+ ;
+
+ if (observer != null) {
+ this._observer = new observer(function (mutations) {
+ $.each(mutations, self._syncA);
+ $.each(mutations, self._syncS);
+ });
+ this._observer.observe(this.$element[0], {
+ attributes: true,
+ childList: true,
+ subtree: false
+ });
+ } else if (this.$element[0].addEventListener) {
+ this.$element[0].addEventListener(
+ 'DOMAttrModified',
+ self._syncA,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeInserted',
+ self._syncS,
+ false
+ );
+ this.$element[0].addEventListener(
+ 'DOMNodeRemoved',
+ self._syncS,
+ false
+ );
+ }
+ };
+
+ Select2.prototype._registerDataEvents = function () {
+ var self = this;
+
+ this.dataAdapter.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerSelectionEvents = function () {
+ var self = this;
+ var nonRelayEvents = ['toggle', 'focus'];
+
+ this.selection.on('toggle', function () {
+ self.toggleDropdown();
+ });
+
+ this.selection.on('focus', function (params) {
+ self.focus(params);
+ });
+
+ this.selection.on('*', function (name, params) {
+ if ($.inArray(name, nonRelayEvents) !== -1) {
+ return;
+ }
+
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerDropdownEvents = function () {
+ var self = this;
+
+ this.dropdown.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerResultsEvents = function () {
+ var self = this;
+
+ this.results.on('*', function (name, params) {
+ self.trigger(name, params);
+ });
+ };
+
+ Select2.prototype._registerEvents = function () {
+ var self = this;
+
+ this.on('open', function () {
+ self.$container.addClass('select2-container--open');
+ });
+
+ this.on('close', function () {
+ self.$container.removeClass('select2-container--open');
+ });
+
+ this.on('enable', function () {
+ self.$container.removeClass('select2-container--disabled');
+ });
+
+ this.on('disable', function () {
+ self.$container.addClass('select2-container--disabled');
+ });
+
+ this.on('blur', function () {
+ self.$container.removeClass('select2-container--focus');
+ });
+
+ this.on('query', function (params) {
+ if (!self.isOpen()) {
+ self.trigger('open', {});
+ }
+
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:all', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('query:append', function (params) {
+ this.dataAdapter.query(params, function (data) {
+ self.trigger('results:append', {
+ data: data,
+ query: params
+ });
+ });
+ });
+
+ this.on('open', function(){
+ // Focus on the active element when opening dropdown.
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
+ setTimeout(function(){
+ self.focusOnActiveElement();
+ }, 1);
+ });
+
+ $(document).on('keydown', function (evt) {
+ var key = evt.which;
+ if (self.isOpen()) {
+ if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
+ self.close();
+
+ evt.preventDefault();
+ } else if (key === KEYS.ENTER || key === KEYS.TAB) {
+ self.trigger('results:select', {});
+
+ evt.preventDefault();
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
+ self.trigger('results:toggle', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.UP) {
+ self.trigger('results:previous', {});
+
+ evt.preventDefault();
+ } else if (key === KEYS.DOWN) {
+ self.trigger('results:next', {});
+
+ evt.preventDefault();
+ }
+
+ var $searchField = self.$dropdown.find('.select2-search__field');
+ if (! $searchField.length) {
+ $searchField = self.$container.find('.select2-search__field');
+ }
+
+ // Move the focus to the selected element on keyboard navigation.
+ // Required for screen readers to work properly.
+ if (key === KEYS.DOWN || key === KEYS.UP) {
+ self.focusOnActiveElement();
+ } else {
+ // Focus on the search if user starts typing.
+ $searchField.focus();
+ // Focus back to active selection when finished typing.
+ // Small delay so typed character can be read by screen reader.
+ setTimeout(function(){
+ self.focusOnActiveElement();
+ }, 1000);
+ }
+ } else if (self.hasFocus()) {
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
+ key === KEYS.DOWN) {
+ self.open();
+ evt.preventDefault();
+ }
+ }
+ });
+ };
+
+ Select2.prototype.focusOnActiveElement = function () {
+ // Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
+ if (this.isOpen() && ! Utils.isTouchscreen()) {
+ this.$results.find('li.select2-results__option--highlighted').focus();
+ }
+ };
+
+ Select2.prototype._syncAttributes = function () {
+ this.options.set('disabled', this.$element.prop('disabled'));
+
+ if (this.options.get('disabled')) {
+ if (this.isOpen()) {
+ this.close();
+ }
+
+ this.trigger('disable', {});
+ } else {
+ this.trigger('enable', {});
+ }
+ };
+
+ Select2.prototype._syncSubtree = function (evt, mutations) {
+ var changed = false;
+ var self = this;
+
+ // Ignore any mutation events raised for elements that aren't options or
+ // optgroups. This handles the case when the select element is destroyed
+ if (
+ evt && evt.target && (
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
+ )
+ ) {
+ return;
+ }
+
+ if (!mutations) {
+ // If mutation events aren't supported, then we can only assume that the
+ // change affected the selections
+ changed = true;
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
+ var node = mutations.addedNodes[n];
+
+ if (node.selected) {
+ changed = true;
+ }
+ }
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
+ changed = true;
+ }
+
+ // Only re-pull the data if we think there is a change
+ if (changed) {
+ this.dataAdapter.current(function (currentData) {
+ self.trigger('selection:update', {
+ data: currentData
+ });
+ });
+ }
+ };
+
+ /**
+ * Override the trigger method to automatically trigger pre-events when
+ * there are events that can be prevented.
+ */
+ Select2.prototype.trigger = function (name, args) {
+ var actualTrigger = Select2.__super__.trigger;
+ var preTriggerMap = {
+ 'open': 'opening',
+ 'close': 'closing',
+ 'select': 'selecting',
+ 'unselect': 'unselecting'
+ };
+
+ if (args === undefined) {
+ args = {};
+ }
+
+ if (name in preTriggerMap) {
+ var preTriggerName = preTriggerMap[name];
+ var preTriggerArgs = {
+ prevented: false,
+ name: name,
+ args: args
+ };
+
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
+
+ if (preTriggerArgs.prevented) {
+ args.prevented = true;
+
+ return;
+ }
+ }
+
+ actualTrigger.call(this, name, args);
+ };
+
+ Select2.prototype.toggleDropdown = function () {
+ if (this.options.get('disabled')) {
+ return;
+ }
+
+ if (this.isOpen()) {
+ this.close();
+ } else {
+ this.open();
+ }
+ };
+
+ Select2.prototype.open = function () {
+ if (this.isOpen()) {
+ return;
+ }
+
+ this.trigger('query', {});
+ };
+
+ Select2.prototype.close = function () {
+ if (!this.isOpen()) {
+ return;
+ }
+
+ this.trigger('close', {});
+ };
+
+ Select2.prototype.isOpen = function () {
+ return this.$container.hasClass('select2-container--open');
+ };
+
+ Select2.prototype.hasFocus = function () {
+ return this.$container.hasClass('select2-container--focus');
+ };
+
+ Select2.prototype.focus = function (data) {
+ // No need to re-trigger focus events if we are already focused
+ if (this.hasFocus()) {
+ return;
+ }
+
+ this.$container.addClass('select2-container--focus');
+ this.trigger('focus', {});
+ };
+
+ Select2.prototype.enable = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
+ ' instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ args = [true];
+ }
+
+ var disabled = !args[0];
+
+ this.$element.prop('disabled', disabled);
+ };
+
+ Select2.prototype.data = function () {
+ if (this.options.get('debug') &&
+ arguments.length > 0 && window.console && console.warn) {
+ console.warn(
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
+ 'should consider setting the value instead using `$element.val()`.'
+ );
+ }
+
+ var data = [];
+
+ this.dataAdapter.current(function (currentData) {
+ data = currentData;
+ });
+
+ return data;
+ };
+
+ Select2.prototype.val = function (args) {
+ if (this.options.get('debug') && window.console && console.warn) {
+ console.warn(
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
+ ' removed in later Select2 versions. Use $element.val() instead.'
+ );
+ }
+
+ if (args == null || args.length === 0) {
+ return this.$element.val();
+ }
+
+ var newVal = args[0];
+
+ if ($.isArray(newVal)) {
+ newVal = $.map(newVal, function (obj) {
+ return obj.toString();
+ });
+ }
+
+ this.$element.val(newVal).trigger('change');
+ };
+
+ Select2.prototype.destroy = function () {
+ this.$container.remove();
+
+ if (this.$element[0].detachEvent) {
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
+ }
+
+ if (this._observer != null) {
+ this._observer.disconnect();
+ this._observer = null;
+ } else if (this.$element[0].removeEventListener) {
+ this.$element[0]
+ .removeEventListener('DOMAttrModified', this._syncA, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
+ this.$element[0]
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
+ }
+
+ this._syncA = null;
+ this._syncS = null;
+
+ this.$element.off('.select2');
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
+
+ this.$element.removeClass('select2-hidden-accessible');
+ this.$element.attr('aria-hidden', 'false');
+ this.$element.removeData('select2');
+
+ this.dataAdapter.destroy();
+ this.selection.destroy();
+ this.dropdown.destroy();
+ this.results.destroy();
+
+ this.dataAdapter = null;
+ this.selection = null;
+ this.dropdown = null;
+ this.results = null;
+ };
+
+ Select2.prototype.render = function () {
+ var $container = $(
+ '' +
+ '' +
+ '' +
+ ''
+ );
+
+ $container.attr('dir', this.options.get('dir'));
+
+ this.$container = $container;
+
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
+
+ $container.data('element', this.$element);
+
+ return $container;
+ };
+
+ return Select2;
+});
+
+S2.define('jquery-mousewheel',[
+ 'jquery'
+], function ($) {
+ // Used to shim jQuery.mousewheel for non-full builds.
+ return $;
+});
+
+S2.define('jquery.select2',[
+ 'jquery',
+ 'jquery-mousewheel',
+
+ './select2/core',
+ './select2/defaults'
+], function ($, _, Select2, Defaults) {
+ if ($.fn.selectWoo == null) {
+ // All methods that should return the element
+ var thisMethods = ['open', 'close', 'destroy'];
+
+ $.fn.selectWoo = function (options) {
+ options = options || {};
+
+ if (typeof options === 'object') {
+ this.each(function () {
+ var instanceOptions = $.extend(true, {}, options);
+
+ var instance = new Select2($(this), instanceOptions);
+ });
+
+ return this;
+ } else if (typeof options === 'string') {
+ var ret;
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ this.each(function () {
+ var instance = $(this).data('select2');
+
+ if (instance == null && window.console && console.error) {
+ console.error(
+ 'The select2(\'' + options + '\') method was called on an ' +
+ 'element that is not using Select2.'
+ );
+ }
+
+ ret = instance[options].apply(instance, args);
+ });
+
+ // Check if we should be returning `this`
+ if ($.inArray(options, thisMethods) > -1) {
+ return this;
+ }
+
+ return ret;
+ } else {
+ throw new Error('Invalid arguments for Select2: ' + options);
+ }
+ };
+ }
+
+ if ($.fn.select2 != null && $.fn.select2.defaults != null) {
+ $.fn.selectWoo.defaults = $.fn.select2.defaults;
+ }
+
+ if ($.fn.selectWoo.defaults == null) {
+ $.fn.selectWoo.defaults = Defaults;
+ }
+
+ // Also register selectWoo under select2 if select2 is not already present.
+ $.fn.select2 = $.fn.select2 || $.fn.selectWoo;
+
+ return Select2;
+});
+
+ // Return the AMD loader configuration so it can be used outside of this file
+ return {
+ define: S2.define,
+ require: S2.require
+ };
+}());
+
+ // Autoload the jQuery bindings
+ // We know that all of the modules exist above this, so we're safe
+ var select2 = S2.require('jquery.select2');
+
+ // Hold the AMD module references on the jQuery function that was just loaded
+ // This allows Select2 to use the internal loader outside of this file, such
+ // as in the language files.
+ jQuery.fn.select2.amd = S2;
+ jQuery.fn.selectWoo.amd = S2;
+
+ // Return the Select2 instance for anyone who is importing it.
+ return select2;
+}));
diff --git a/inc/customizer/core/custom-controls/assets/js/selectWoo.min.js b/inc/customizer/core/custom-controls/assets/js/selectWoo.min.js
new file mode 100644
index 0000000..321224d
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/js/selectWoo.min.js
@@ -0,0 +1 @@
+!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(t){var e,n,o,p,s,r,h,f,g,m,y,v,i,a,_,o=(t&&t.fn&&t.fn.select2&&t.fn.select2.amd&&(u=t.fn.select2.amd),u&&u.requirejs||(u?n=u:u={},g={},m={},y={},v={},i=Object.prototype.hasOwnProperty,a=[].slice,_=/\.js$/,h=function(e,t){var n,o,i=c(e),s=i[0],t=t[1];return e=i[1],s&&(n=A(s=l(s,t))),s?e=n&&n.normalize?n.normalize(e,(o=t,function(e){return l(e,o)})):l(e,t):(s=(i=c(e=l(e,t)))[0],e=i[1],s&&(n=A(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},f={require:function(e){return b(e)},exports:function(e){var t=g[e];return void 0!==t?t:g[e]={}},module:function(e){return{id:e,uri:"",exports:g[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},s=function(e,t,n,o){var i,s,r,a,l,c=[],u=typeof n,d=x(o=o||e);if("undefined"==u||"function"==u){for(t=!t.length&&n.length?["require","exports","module"]:t,a=0;a":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},e.appendMany=function(e,t){var n;"1.7"===s.fn.jquery.substr(0,3)&&(n=s(),s.map(t,function(e){n=n.add(e)}),t=n),e.append(t)},e.isTouchscreen=function(){return void 0===e._isTouchscreenCache&&(e._isTouchscreenCache="ontouchstart"in document.documentElement),e._isTouchscreenCache},e}),u.define("select2/results",["jquery","./utils"],function(d,e){function o(e,t,n){this.$element=e,this.data=n,this.options=t,o.__super__.constructor.call(this)}return e.Extend(o,e.Observable),o.prototype.render=function(){var e=d('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},o.prototype.clear=function(){this.$results.empty()},o.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=d(''),o=this.options.get("translations").get(e.message);n.append(t(o(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},o.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},o.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested",role:"listbox"});a.append(l),s.attr("role","list"),s.append(r),s.append(a)}else this.template(e,t);return d.data(t,"data",e),t},o.prototype.bind=function(t,e){var i=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){i.clear(),i.append(e.data),t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("results:append",function(e){i.append(e.data),t.isOpen()&&i.setClasses()}),t.on("query",function(e){i.hideMessages(),i.showLoading(e)}),t.on("select",function(){t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("open",function(){i.$results.attr("aria-expanded","true"),i.$results.attr("aria-hidden","false"),i.setClasses(),i.ensureHighlightVisible()}),t.on("close",function(){i.$results.attr("aria-expanded","false"),i.$results.attr("aria-hidden","true"),i.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=i.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=i.getHighlightedResults();0!==t.length&&(e=t.data("data"),"true"==t.attr("data-selected")?i.trigger("close",{}):i.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t=i.getHighlightedResults(),n=i.$results.find("[data-selected]"),o=n.index(t);0!==o&&(e=o-1,0===t.length&&(e=0),(o=n.eq(e)).trigger("mouseenter"),t=i.$results.offset().top,n=o.offset().top,o=i.$results.scrollTop()+(n-t),0===e?i.$results.scrollTop(0):n-t<0&&i.$results.scrollTop(o))}),t.on("results:next",function(){var e,t=i.getHighlightedResults(),n=i.$results.find("[data-selected]"),o=n.index(t)+1;o>=n.length||((e=n.eq(o)).trigger("mouseenter"),t=i.$results.offset().top+i.$results.outerHeight(!1),n=e.offset().top+e.outerHeight(!1),e=i.$results.scrollTop()+n-t,0===o?i.$results.scrollTop(0):tthis.$results.outerHeight()||o<0)&&this.$results.scrollTop(n))},o.prototype.template=function(e,t){var n=this.options.get("templateResult"),o=this.options.get("escapeMarkup"),e=n(e,t);null==e?t.style.display="none":"string"==typeof e?t.innerHTML=o(e):d(t).append(e)},o}),u.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),u.define("select2/selection/base",["jquery","../utils","../keys"],function(o,e,i){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=o('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),this.$selection=e},n.prototype.bind=function(e,t){var n=this,o=(e.id,e.id+"-results");this.options.get("minimumResultsForSearch");this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",o),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),window.setTimeout(function(){n.$selection.focus()},1),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||o.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},n.prototype._attachCloseHandler=function(e){o(document.body).on("mousedown.select2."+e.id,function(e){var t=o(e.target),n=t.closest(".select2");o(".select2.select2-container--open").each(function(){var e=o(this);this!=n[0]&&(e.data("element").select2("close"),setTimeout(function(){e.find("*:focus").blur(),t.focus()},1))})})},n.prototype._detachCloseHandler=function(e){o(document.body).off("mousedown.select2."+e.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),u.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,o){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(''),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var o=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",o).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",o),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.focus()}),t.on("selection:update",function(e){n.update(e.data)})},i.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("")},i.prototype.update=function(e){var t,n;0!==e.length?(t=e[0],n=this.$selection.find(".select2-selection__rendered"),e=this.display(t,n),n.empty().text(e),n.prop("title",t.title||t.text)):this.clear()},i}),u.define("select2/selection/multiple",["jquery","./base","../utils"],function(o,e,a){function i(e,t){i.__super__.constructor.apply(this,arguments)}return a.Extend(i,e),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t;n.options.get("disabled")||(t=o(this).parent().data("data"),n.trigger("unselect",{originalEvent:e,data:t}))}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),t.on("focus",function(){n.focusOnSearch()})},i.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return o('×')},i.prototype.focusOnSearch=function(){var e=this;void 0!==e.$search&&setTimeout(function(){e._keyUpPrevented=!0,e.$search.focus()},1)},i.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×')).data("data",t),this.$selection.find(".select2-selection__rendered").prepend(e))},e}),u.define("select2/selection/search",["jquery","../utils","../keys"],function(n,e,r){function t(e,t,n){e.call(this,t,n)}return t.prototype.render=function(e){var t=n('');this.$searchContainer=t,this.$search=t.find("input");e=e.call(this);return this._transferTabIndex(),e},t.prototype.bind=function(e,n,t){var o=this,i=n.id+"-results";e.call(this,n,t),n.on("open",function(){o.$search.attr("aria-owns",i),o.$search.trigger("focus")}),n.on("close",function(){o.$search.val(""),o.$search.removeAttr("aria-activedescendant"),o.$search.removeAttr("aria-owns"),o.$search.trigger("focus")}),n.on("enable",function(){o.$search.prop("disabled",!1),o._transferTabIndex()}),n.on("disable",function(){o.$search.prop("disabled",!0)}),n.on("focus",function(e){o.$search.trigger("focus")}),n.on("results:focus",function(e){o.$search.attr("aria-activedescendant",e.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(e){o.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){o._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t;e.stopPropagation(),o.trigger("keypress",e),o._keyUpPrevented=e.isDefaultPrevented(),e.which===r.BACKSPACE&&""===o.$search.val()?0<(t=o.$searchContainer.prev(".select2-selection__choice")).length&&(t=t.data("data"),o.searchRemoveChoice(t),e.preventDefault()):e.which===r.ENTER&&(n.open(),e.preventDefault())});var t=document.documentMode,s=t&&t<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?o.$selection.off("input.search input.searchcheck"):o.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;s&&"input"===e.type?o.$selection.off("input.search input.searchcheck"):(t=e.which)!=r.SHIFT&&t!=r.CTRL&&t!=r.ALT&&t!=r.TAB&&o.handleSearch(e)})},t.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},t.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},t.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.focus()},t.prototype.handleSearch=function(){var e;this.resizeSearch(),this._keyUpPrevented||(e=this.$search.val(),this.trigger("query",{term:e})),this._keyUpPrevented=!1},t.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},t.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";e=""!==this.$search.attr("placeholder")?this.$selection.find(".select2-selection__rendered").innerWidth():.75*(this.$search.val().length+1)+"em",this.$search.css("width",e)},t}),u.define("select2/selection/eventRelay",["jquery"],function(r){function e(){}return e.prototype.bind=function(e,t,n){var o=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting"],s=["opening","closing","selecting","unselecting"];e.call(this,t,n),t.on("*",function(e,t){var n;-1!==r.inArray(e,i)&&(t=t||{},n=r.Event("select2:"+e,{params:t}),o.$element.trigger(n),-1!==r.inArray(e,s)&&(t.prevented=n.isDefaultPrevented()))})},e}),u.define("select2/translation",["jquery","require"],function(t,n){function o(e){this.dict=e||{}}return o.prototype.all=function(){return this.dict},o.prototype.get=function(e){return this.dict[e]},o.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},o._cache={},o.loadPath=function(e){var t;return e in o._cache||(t=n(e),o._cache[e]=t),new o(o._cache[e])},o}),u.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),u.define("select2/data/base",["../utils"],function(o){function n(e,t){n.__super__.constructor.call(this)}return o.Extend(n,o.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n="";return n+=null!=e?e.id:o.generateChars(4),n+="-result-",n+=o.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+o.generateChars(4),n},n}),u.define("select2/data/select",["./base","../utils","jquery"],function(e,t,r){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,e),n.prototype.current=function(e){var t=[],n=this;this.$element.find(":selected").each(function(){var e=r(this),e=n.item(e);t.push(e)}),e(t)},n.prototype.select=function(i){var e,s=this;if(i.selected=!0,r(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("change");this.$element.prop("multiple")?this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;nthis.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),u.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(t,n,o){var i=this;this.current(function(e){e=null!=e?e.length:0;0=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):t.call(i,n,o)})},e}),u.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),u.define("select2/dropdown/search",["jquery","../utils"],function(s,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),e=s('');return this.$searchContainer=e,this.$search=e.find("input"),t.prepend(e),t},t.prototype.bind=function(e,t,n){var o=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){o.trigger("keypress",e),o._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){s(this).off("keyup")}),this.$search.on("keyup input",function(e){o.handleSearch(e)}),t.on("open",function(){o.$search.attr("tabindex",0),o.$search.attr("aria-owns",i),o.$search.focus(),window.setTimeout(function(){o.$search.focus()},0)}),t.on("close",function(){o.$search.attr("tabindex",-1),o.$search.removeAttr("aria-activedescendant"),o.$search.removeAttr("aria-owns"),o.$search.val("")}),t.on("focus",function(){t.isOpen()||o.$search.focus()}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(o.showSearch(e)?o.$searchContainer.removeClass("select2-search--hide"):o.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){o.$search.attr("aria-activedescendant",e.data._resultId)})},t.prototype.handleSearch=function(e){var t;this._keyUpPrevented||(t=this.$search.val(),this.trigger("query",{term:t})),this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),u.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,o){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,o)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),o=t.length-1;0<=o;o--){var i=t[o];this.placeholder.id===i.id&&n.splice(o,1)}return n},e}),u.define("select2/dropdown/infiniteScroll",["jquery"],function(i){function e(e,t,n,o){this.lastParams={},e.call(this,t,n,o),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},e.prototype.bind=function(e,t,n){var o=this;e.call(this,t,n),t.on("query",function(e){o.lastParams=e,o.loading=!0}),t.on("query:append",function(e){o.lastParams=e,o.loading=!0}),this.$results.on("scroll",function(){var e=i.contains(document.documentElement,o.$loadingMore[0]);!o.loading&&e&&(e=o.$results.offset().top+o.$results.outerHeight(!1),o.$loadingMore.offset().top+o.$loadingMore.outerHeight(!1)<=e+50&&o.loadMore())})},e.prototype.loadMore=function(){this.loading=!0;var e=i.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=i(''),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),u.define("select2/dropdown/attachBody",["jquery","../utils"],function(c,r){function e(e,t,n){this.$dropdownParent=n.get("dropdownParent")||c(document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var o=this,i=!1;e.call(this,t,n),t.on("open",function(){o._showDropdown(),o._attachPositioningHandler(t),i||(i=!0,t.on("results:all",function(){o._positionDropdown(),o._resizeDropdown()}),t.on("results:append",function(){o._positionDropdown(),o._resizeDropdown()}))}),t.on("close",function(){o._hideDropdown(),o._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=c(""),e=e.call(this);return t.append(e),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._attachPositioningHandler=function(e,t){var n=this,o="scroll.select2."+t.id,i="resize.select2."+t.id,s="orientationchange.select2."+t.id,t=this.$container.parents().filter(r.hasScroll);t.each(function(){c(this).data("select2-scroll-position",{x:c(this).scrollLeft(),y:c(this).scrollTop()})}),t.on(o,function(e){var t=c(this).data("select2-scroll-position");c(this).scrollTop(t.y)}),c(window).on(o+" "+i+" "+s,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,o="resize.select2."+t.id,t="orientationchange.select2."+t.id;this.$container.parents().filter(r.hasScroll).off(n),c(window).off(n+" "+o+" "+t)},e.prototype._positionDropdown=function(){var e=c(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),o=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=i.top,s.bottom=i.top+s.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),e=ai.bottom+r,l={left:i.left,top:s.bottom},i=this.$dropdownParent;"static"===i.css("position")&&(i=i.offsetParent());i=i.offset();l.top-=i.top,l.left-=i.left,t||n||(o="below"),a||!e||t?!e&&a&&t&&(o="below"):o="above",("above"==o||t&&"below"!==o)&&(l.top=s.top-i.top-r),null!=o&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+o),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+o)),this.$dropdownContainer.css(l)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),u.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,o){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,o)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,o=0;o');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),e.data("element",this.$element),e},a}),u.define("jquery-mousewheel",["jquery"],function(e){return e}),u.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(i,e,s,t){var r;return null==i.fn.selectWoo&&(r=["open","close","destroy"],i.fn.selectWoo=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new s(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,o=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=i(this).data("select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,o)}),-1' ).after( self.button );
+ } else {
+ // Wrap the wrapping label in its wrapper and append the Clear/Default button.
+ self.wrappingLabel
+ .wrap( '' )
+ .after( self.button );
+
+ /*
+ * The input wrapper now contains the label+input+Clear/Default button.
+ * Store a reference to the input wrapper: we'll use this to toggle
+ * the controls visibility.
+ */
+ self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
+ }
+
+ el.iris( {
+ target: self.pickerContainer,
+ hide: self.options.hide,
+ width: self.options.width,
+ mode: self.options.mode,
+ palettes: self.options.palettes,
+ /**
+ * @summary Handles the onChange event if one has been defined in the options.
+ *
+ * Handles the onChange event if one has been defined in the options and additionally
+ * sets the background color for the toggler element.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ * @param {HTMLElement} ui The HTMLElement containing the color picker.
+ *
+ * @returns {void}
+ */
+ change: function( event, ui ) {
+ if ( self.options.alpha ) {
+ self.toggler.css( { 'background-image' : 'url(' + image + ')' } );
+ if ( _deprecated ) {
+ self.toggler.html( '' );
+ } else {
+ self.toggler.css( {
+ 'position' : 'relative'
+ } );
+ if ( self.toggler.find('span.color-alpha').length == 0 ) {
+ self.toggler.append('');
+ }
+ }
+
+ self.toggler.find( 'span.color-alpha' ).css( {
+ 'width' : '30px',
+ 'height' : '24px',
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'border-top-left-radius' : '2px',
+ 'border-bottom-left-radius' : '2px',
+ 'background' : ui.color.toString()
+ } );
+ } else {
+ self.toggler.css( { backgroundColor : ui.color.toString() } );
+ }
+
+ if ( $.isFunction( self.options.change ) ) {
+ self.options.change.call( this, event, ui );
+ }
+ }
+ } );
+
+ el.val( self.initialValue );
+ self._addListeners();
+
+ // Force the color picker to always be closed on initial load.
+ if ( ! self.options.hide ) {
+ self.toggler.click();
+ }
+ },
+ /**
+ * @summary Binds event listeners to the color picker.
+ *
+ * @since 3.5.0
+ *
+ * @access private
+ *
+ * @returns {void}
+ */
+ _addListeners: function() {
+ var self = this;
+
+ /**
+ * @summary Prevent any clicks inside this widget from leaking to the top and closing it.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returs {void}
+ */
+ self.wrap.on( 'click.wpcolorpicker', function( event ) {
+ event.stopPropagation();
+ });
+
+ /**
+ * @summary Open or close the color picker depending on the class.
+ *
+ * @since 3.5
+ */
+ self.toggler.click( function(){
+ if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
+ self.close();
+ } else {
+ self.open();
+ }
+ });
+
+ /**
+ * @summary Checks if value is empty when changing the color in the color picker.
+ *
+ * Checks if value is empty when changing the color in the color picker.
+ * If so, the background color is cleared.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returns {void}
+ */
+ self.element.on( 'change', function( event ) {
+ // Empty or Error = clear
+ if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
+ if ( self.options.alpha ) {
+ if ( _deprecated ) {
+ self.toggler.removeAttr( 'style' );
+ }
+ self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
+ } else {
+ self.toggler.css( 'backgroundColor', '' );
+ }
+
+ // fire clear callback if we have one
+ if ( $.isFunction( self.options.clear ) )
+ self.options.clear.call( this, event );
+ }
+ } );
+
+ /**
+ * @summary Enables the user to clear or revert the color in the color picker.
+ *
+ * Enables the user to either clear the color in the color picker or revert back to the default color.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returns {void}
+ */
+ self.button.on( 'click', function( event ) {
+ if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
+ self.element.val( '' );
+ if ( self.options.alpha ) {
+ if ( _deprecated ) {
+ self.toggler.removeAttr( 'style' );
+ }
+ self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
+ } else {
+ self.toggler.css( 'backgroundColor', '' );
+ }
+
+ if ( $.isFunction( self.options.clear ) )
+ self.options.clear.call( this, event );
+
+ self.element.trigger( 'change' );
+ } else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
+ self.element.val( self.options.defaultColor ).change();
+ }
+ });
+ },
+ });
+
+ /**
+ * Overwrite iris
+ */
+ $.widget( 'a8c.iris', $.a8c.iris, {
+ _create: function() {
+ this._super();
+
+ // Global option for check is mode rbga is enabled
+ this.options.alpha = this.element.data( 'alpha' ) || false;
+
+ // Is not input disabled
+ if ( ! this.element.is( ':input' ) )
+ this.options.alpha = false;
+
+ if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
+ var self = this,
+ el = self.element,
+ _html = '',
+ aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
+ aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
+ controls = {
+ aContainer : aContainer,
+ aSlider : aSlider
+ };
+
+ if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
+ self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
+ } else {
+ self.options.customWidth = 100;
+ }
+
+ // Set default width for input reset
+ self.options.defaultWidth = el.width();
+
+ // Update width for input
+ if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
+ el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
+
+ // Push new controls
+ $.each( controls, function( k, v ) {
+ self.controls[k] = v;
+ } );
+
+ // Change size strip and add margin for sliders
+ self.controls.square.css( { 'margin-right': '0' } );
+ var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
+ stripsMargin = ( emptyWidth / 6 ),
+ stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin );
+
+ $.each( [ 'aContainer', 'strip' ], function( k, v ) {
+ self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
+ } );
+
+ // Add new slider
+ self._initControls();
+
+ // For updated widget
+ self._change();
+ }
+ },
+ _initControls: function() {
+ this._super();
+
+ if ( this.options.alpha ) {
+ var self = this,
+ controls = self.controls;
+
+ controls.aSlider.slider({
+ orientation : 'vertical',
+ min : 0,
+ max : 100,
+ step : 1,
+ value : parseInt( self._color._alpha * 100 ),
+ slide : function( event, ui ) {
+ // Update alpha value
+ self._color._alpha = parseFloat( ui.value / 100 );
+ self._change.apply( self, arguments );
+ }
+ });
+ }
+ },
+ _change: function() {
+ this._super();
+
+ var self = this,
+ el = self.element;
+
+ if ( this.options.alpha ) {
+ var controls = self.controls,
+ alpha = parseInt( self._color._alpha * 100 ),
+ color = self._color.toRgb(),
+ gradient = [
+ 'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
+ 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
+ ],
+ defaultWidth = self.options.defaultWidth,
+ customWidth = self.options.customWidth,
+ target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
+
+ // Generate background slider alpha, only for CSS3 old browser fuck!! :)
+ controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
+
+ if ( target.hasClass( 'wp-picker-open' ) ) {
+ // Update alpha value
+ controls.aSlider.slider( 'value', alpha );
+
+ /**
+ * Disabled change opacity in default slider Saturation ( only is alpha enabled )
+ * and change input width for view all value
+ */
+ if ( self._color._alpha < 1 ) {
+ controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
+ el.width( parseInt( defaultWidth + customWidth ) );
+ } else {
+ el.width( defaultWidth );
+ }
+ }
+ }
+
+ var reset = el.data( 'reset-alpha' ) || false;
+
+ if ( reset ) {
+ self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
+ self._color._alpha = 1;
+ self.active = 'external';
+ self._change();
+ } );
+ }
+ el.trigger( 'change' );
+ },
+ _addInputListeners: function( input ) {
+ var self = this,
+ debounceTimeout = 100,
+ callback = function( event ) {
+ var color = new Color( input.val() ),
+ val = input.val();
+
+ input.removeClass( 'iris-error' );
+ // we gave a bad color
+ if ( color.error ) {
+ // don't error on an empty input
+ if ( val !== '' )
+ input.addClass( 'iris-error' );
+ } else {
+ if ( color.toString() !== self._color.toString() ) {
+ // let's not do this on keyup for hex shortcodes
+ if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
+ self._setOption( 'color', color.toString() );
+ }
+ }
+ };
+
+ input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
+
+ // If we initialized hidden, show on first focus. The rest is up to you.
+ if ( self.options.hide ) {
+ input.on( 'focus', function() {
+ self.show();
+ } );
+ }
+ }
+ } );
+}( jQuery ) );
+
+// Auto Call plugin is class is color-picker
+jQuery( document ).ready( function( $ ) {
+ $( '.color-picker' ).wpColorPicker();
+} );
diff --git a/inc/customizer/core/custom-controls/assets/js/wp-color-picker-alpha.min.js b/inc/customizer/core/custom-controls/assets/js/wp-color-picker-alpha.min.js
new file mode 100644
index 0000000..a0ed9c2
--- /dev/null
+++ b/inc/customizer/core/custom-controls/assets/js/wp-color-picker-alpha.min.js
@@ -0,0 +1 @@
+!function(n){var s,o,e,a,i,l,p,c;n.wp.wpColorPicker.prototype._hasAlpha||(s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",o='',e='',a='',(i=void 0!==wpColorPickerL10n.current)?l='':(l='',p="",c=''),Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},n.widget("wp.wpColorPicker",n.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(n.support.iris){var r=this,t=r.element;if(n.extend(r.options,t.data()),"hue"===r.options.type)return r._createHueOnly();r.close=n.proxy(r.close,r),r.initialValue=t.val(),t.addClass("wp-color-picker"),i?(t.hide().wrap(e),r.wrap=t.parent(),r.toggler=n(l).insertBefore(t).css({backgroundColor:r.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),r.pickerContainer=n(o).insertAfter(t),r.button=n(a).addClass("hidden")):(t.parent("label").length||(t.wrap(p),r.wrappingLabelText=n(c).insertBefore(t).text(wpColorPickerL10n.defaultLabel)),r.wrappingLabel=t.parent(),r.wrappingLabel.wrap(e),r.wrap=r.wrappingLabel.parent(),r.toggler=n(l).insertBefore(r.wrappingLabel).css({backgroundColor:r.initialValue}),r.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),r.pickerContainer=n(o).insertAfter(r.wrappingLabel),r.button=n(a)),r.options.defaultColor?(r.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||r.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(r.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||r.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?t.wrap('').after(r.button):(r.wrappingLabel.wrap('').after(r.button),r.inputWrapper=t.closest(".wp-picker-input-wrap")),t.iris({target:r.pickerContainer,hide:r.options.hide,width:r.options.width,mode:r.options.mode,palettes:r.options.palettes,change:function(t,o){r.options.alpha?(r.toggler.css({"background-image":"url("+s+")"}),i?r.toggler.html(''):(r.toggler.css({position:"relative"}),0==r.toggler.find("span.color-alpha").length&&r.toggler.append('')),r.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:o.color.toString()})):r.toggler.css({backgroundColor:o.color.toString()}),n.isFunction(r.options.change)&&r.options.change.call(this,t,o)}}),t.val(r.initialValue),r._addListeners(),r.options.hide||r.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(t){""!==n(this).val()&&!o.element.hasClass("iris-error")||(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),n.isFunction(o.options.clear)&&o.options.clear.call(this,t))}),o.button.on("click",function(t){n(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),n.isFunction(o.options.clear)&&o.options.clear.call(this,t),o.element.trigger("change")):n(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),n.widget("a8c.iris",n.a8c.iris,{_create:function(){var r,t,o,e,a,i;this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha&&(t=(r=this).element,e=(o=n('').appendTo(r.picker.find(".iris-picker-inner"))).find(".iris-slider-offset-alpha"),e={aContainer:o,aSlider:e},void 0!==t.data("custom-width")?r.options.customWidth=parseInt(t.data("custom-width"))||0:r.options.customWidth=100,r.options.defaultWidth=t.width(),(r._color._alpha<1||-1!=r._color.toString().indexOf("rgb"))&&t.width(parseInt(r.options.defaultWidth+r.options.customWidth)),n.each(e,function(t,o){r.controls[t]=o}),r.controls.square.css({"margin-right":"0"}),e=r.picker.width()-r.controls.square.width()-20,i=e/2-(a=e/6),n.each(["aContainer","strip"],function(t,o){r.controls[o].width(i).css({"margin-left":a+"px"})}),r._initControls(),r._change())},_initControls:function(){var r;this._super(),this.options.alpha&&(r=this).controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*r._color._alpha),slide:function(t,o){r._color._alpha=parseFloat(o.value/100),r._change.apply(r,arguments)}})},_change:function(){this._super();var t,o,r,e,a,i,n=this,l=n.element;this.options.alpha&&(t=n.controls,o=parseInt(100*n._color._alpha),r=["rgb("+(i=n._color.toRgb()).r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],e=n.options.defaultWidth,a=n.options.customWidth,i=n.picker.closest(".wp-picker-container").find(".wp-color-result"),t.aContainer.css({background:"linear-gradient(to bottom, "+r.join(", ")+"), url("+s+")"}),i.hasClass("wp-picker-open")&&(t.aSlider.slider("value",o),n._color._alpha<1?(t.strip.attr("style",t.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),l.width(parseInt(e+a))):l.width(e))),l.data("reset-alpha")&&n.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){n._color._alpha=1,n.active="external",n._change()}),l.trigger("change")},_addInputListeners:function(e){function t(t){var o=new Color(e.val()),r=e.val();e.removeClass("iris-error"),o.error?""!==r&&e.addClass("iris-error"):o.toString()!==a._color.toString()&&("keyup"===t.type&&r.match(/^[0-9a-fA-F]{3}$/)||a._setOption("color",o.toString()))}var a=this;e.on("change",t).on("keyup",a._debounce(t,100)),a.options.hide&&e.on("focus",function(){a.show()})}}))}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
\ No newline at end of file
diff --git a/inc/customizer/core/custom-controls/background/background.js b/inc/customizer/core/custom-controls/background/background.js
new file mode 100644
index 0000000..0589792
--- /dev/null
+++ b/inc/customizer/core/custom-controls/background/background.js
@@ -0,0 +1,180 @@
+/**
+ * Background image control JS to handle the background customize option.
+ *
+ * File `background.js`.
+ *
+ * @package Radiate
+ */
+(
+ function ( $ ) {
+
+ $( window ).on( 'load', function () {
+ $( 'html' ).addClass( 'colorpicker-ready' );
+ } );
+
+ wp.customize.controlConstructor['radiate-background'] = wp.customize.Control.extend( {
+
+ ready : function () {
+
+ 'use strict';
+
+ var control = this;
+
+ // Init background control.
+ control.initRadiateBackgroundControl();
+
+ },
+
+ initRadiateBackgroundControl : function () {
+
+ var control = this,
+ value = control.setting._value,
+ colorpicker = control.container.find( '.radiate-color-picker-alpha' );
+
+ // Hide unnecessary controls by default and show only when background image is set.
+ if ( _.isUndefined( value['background-image'] ) || '' === value['background-image'] ) {
+ control.container.find( '.customize-control-content > .background-repeat' ).hide();
+ control.container.find( '.customize-control-content > .background-position' ).hide();
+ control.container.find( '.customize-control-content > .background-size' ).hide();
+ control.container.find( '.customize-control-content > .background-attachment' ).hide();
+ }
+
+ // Background color setting.
+ colorpicker.wpColorPicker( {
+
+ change : function () {
+ if ( jQuery( 'html' ).hasClass( 'colorpicker-ready' ) ) {
+ setTimeout(
+ function () {
+ control.saveValue( 'background-color', colorpicker.val() );
+ },
+ 100
+ );
+ }
+ },
+
+ clear : function ( event ) {
+ var element = jQuery( event.target ).closest( '.wp-picker-input-wrap' ).find( '.wp-color-picker' )[0];
+
+ if ( element ) {
+ control.saveValue( 'background-color', '' );
+ }
+ }
+
+ } );
+
+ // Background image setting.
+ control.container.on( 'click', '.background-image-upload-button, .thumbnail-image img', function ( e ) {
+ var image = wp.media( { multiple : false } ).open().on( 'select', function () {
+
+ // This will return the selected image from the Media Uploader, the result is an object.
+ var uploadedImage = image.state().get( 'selection' ).first(),
+ previewImage = uploadedImage.toJSON().sizes.full.url,
+ imageUrl,
+ imageID,
+ imageWidth,
+ imageHeight,
+ preview,
+ removeButton;
+
+ if ( ! _.isUndefined( uploadedImage.toJSON().sizes.medium ) ) {
+ previewImage = uploadedImage.toJSON().sizes.medium.url;
+ } else if ( ! _.isUndefined( uploadedImage.toJSON().sizes.thumbnail ) ) {
+ previewImage = uploadedImage.toJSON().sizes.thumbnail.url;
+ }
+
+ imageUrl = uploadedImage.toJSON().sizes.full.url;
+ imageID = uploadedImage.toJSON().id;
+ imageWidth = uploadedImage.toJSON().width;
+ imageHeight = uploadedImage.toJSON().height;
+
+ // Show extra controls if the value has an image.
+ if ( '' !== imageUrl ) {
+ control.container.find( '.customize-control-content > .background-repeat, .customize-control-content > .background-position, .customize-control-content > .background-size, .customize-control-content > .background-attachment' ).show();
+ }
+
+ control.saveValue( 'background-image', imageUrl );
+ preview = control.container.find( '.placeholder, .thumbnail' );
+ removeButton = control.container.find( '.background-image-upload-remove-button' );
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '' );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.show();
+ }
+ } );
+
+ e.preventDefault();
+ } );
+
+ control.container.on( 'click', '.background-image-upload-remove-button', function ( e ) {
+
+ var preview,
+ removeButton;
+
+ e.preventDefault();
+
+ control.saveValue( 'background-image', '' );
+
+ preview = control.container.find( '.placeholder, .thumbnail' );
+ removeButton = control.container.find( '.background-image-upload-remove-button' );
+
+ // Hide unnecessary controls.
+ control.container.find( '.customize-control-content > .background-repeat' ).hide();
+ control.container.find( '.customize-control-content > .background-position' ).hide();
+ control.container.find( '.customize-control-content > .background-size' ).hide();
+ control.container.find( '.customize-control-content > .background-attachment' ).hide();
+
+ if ( preview.length ) {
+ preview.removeClass().addClass( 'placeholder' ).html( RadiateCustomizerControlBackground.placeholder );
+ }
+
+ if ( removeButton.length ) {
+ removeButton.hide();
+ }
+ } );
+
+ // Background repeat setting.
+ control.container.on( 'change', '.background-repeat select', function () {
+ control.saveValue( 'background-repeat', jQuery( this ).val() );
+ } );
+
+ // Background position setting.
+ control.container.on( 'change', '.background-position select', function () {
+ control.saveValue( 'background-position', jQuery( this ).val() );
+ } );
+
+ // Background size setting.
+ control.container.on( 'change', '.background-size select', function () {
+ control.saveValue( 'background-size', jQuery( this ).val() );
+ } );
+
+ // Background attachment setting.
+ control.container.on( 'change', '.background-attachment select', function () {
+ control.saveValue( 'background-attachment', jQuery( this ).val() );
+ } );
+
+ },
+
+ /**
+ * Saves the value.
+ */
+ saveValue : function ( property, value ) {
+
+ var control = this,
+ input = jQuery( '#customize-control-' + control.id.replace( '[', '-' ).replace( ']', '' ) + ' .background-hidden-value' ),
+ val = control.setting._value;
+
+ val[property] = value;
+
+ jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' );
+ control.setting.set( val );
+
+ }
+
+ } );
+
+ }
+)( jQuery );
diff --git a/inc/customizer/core/custom-controls/background/class-radiate-background-control.php b/inc/customizer/core/custom-controls/background/class-radiate-background-control.php
new file mode 100644
index 0000000..ad2bb89
--- /dev/null
+++ b/inc/customizer/core/custom-controls/background/class-radiate-background-control.php
@@ -0,0 +1,228 @@
+ esc_html__( 'No file selected', 'radiate' ),
+ )
+ );
+
+ }
+
+ /**
+ * Refresh the parameters passed to the JavaScript via JSON.
+ *
+ * @see WP_Customize_Control::to_json()
+ */
+ public function to_json() {
+
+ parent::to_json();
+
+ $this->json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ $this->json['choices'] = $this->choices;
+
+ $this->json['inputAttrs'] = '';
+ foreach ( $this->input_attrs as $attr => $value ) {
+ $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
+ }
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+
+
+ get_assets_url() . '/assets/css/selectWoo' . $suffix . '.css',
+ array(),
+ RADIATE_THEME_VERSION
+ );
+
+ // Main CSS file.
+ wp_enqueue_style(
+ 'radiate-customize-controls',
+ $this->get_assets_url() . '/assets/css/customize-controls' . $suffix . '.css',
+ array( 'wp-color-picker' ),
+ RADIATE_THEME_VERSION
+ );
+ wp_style_add_data( 'radiate-customize-controls', 'rtl', 'replace' );
+
+ /**
+ * Enqueue required Customize Controls JS files.
+ */
+ // SelectWoo JS library file.
+ wp_enqueue_script(
+ 'selectWoo',
+ $this->get_assets_url() . '/assets/js/selectWoo' . $suffix . '.js',
+ array(),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // WP Color Picker Alpha JS library file.
+ wp_enqueue_script(
+ 'wp-color-picker-alpha',
+ $this->get_assets_url() . '/assets/js/wp-color-picker-alpha' . $suffix . '.js',
+ array(
+ 'wp-color-picker',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ // Main JS file.
+ wp_enqueue_script(
+ 'radiate-customize-controls',
+ $this->get_assets_url() . '/assets/js/customize-controls' . $suffix . '.js',
+ array(
+ 'jquery',
+ ),
+ RADIATE_THEME_VERSION,
+ true
+ );
+
+ }
+
+ public function get_assets_url() {
+ // Get correct URL and path to wp-content.
+ $content_url = untrailingslashit( dirname( dirname( get_stylesheet_directory_uri() ) ) );
+ $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
+
+ $url = str_replace( $content_dir, $content_url, wp_normalize_path( __DIR__ ) );
+ $url = set_url_scheme( $url );
+
+ return $url;
+ }
+
+}
diff --git a/inc/customizer/core/custom-controls/class-radiate-customize-base-control.php b/inc/customizer/core/custom-controls/class-radiate-customize-base-control.php
new file mode 100644
index 0000000..4667eda
--- /dev/null
+++ b/inc/customizer/core/custom-controls/class-radiate-customize-base-control.php
@@ -0,0 +1,105 @@
+register_control_type( $attributes['callback'] );
+ }
+
+ }
+
+ /**
+ * Returns control instance.
+ *
+ * @param string $control_type Control type.
+ *
+ * @return string
+ */
+ public static function get_control_instance( $control_type ) {
+
+ $control_class = self::get_control( $control_type );
+
+ if ( isset( $control_class['callback'] ) ) {
+ return class_exists( $control_class['callback'] ) ? $control_class['callback'] : false;
+ }
+
+ return false;
+
+ }
+
+ /**
+ * Returns control and its attributes.
+ *
+ * @param string $control_type Control type.
+ *
+ * @return array
+ */
+ public static function get_control( $control_type ) {
+
+ if ( isset( self::$controls[ $control_type ] ) ) {
+ return self::$controls[ $control_type ];
+ }
+
+ return array();
+
+ }
+
+ /**
+ * Returns santize callback for control.
+ *
+ * @param string $control Control type for customize option.
+ *
+ * @return string
+ */
+ public static function get_sanitize_callback( $control ) {
+
+ if ( isset( self::$controls[ $control ]['sanitize_callback'] ) ) {
+ return self::$controls[ $control ]['sanitize_callback'];
+ }
+
+ return false;
+
+ }
+
+}
+
+return new Radiate_Customize_Base_Control();
diff --git a/inc/customizer/core/custom-controls/color/class-radiate-color-control.php b/inc/customizer/core/custom-controls/color/class-radiate-color-control.php
new file mode 100644
index 0000000..9e3e1d1
--- /dev/null
+++ b/inc/customizer/core/custom-controls/color/class-radiate-color-control.php
@@ -0,0 +1,121 @@
+=' ) ) {
+ wp_localize_script(
+ 'wp-color-picker',
+ 'wpColorPickerL10n',
+ array(
+ 'clear' => esc_html__( 'Clear', 'radiate' ),
+ 'clearAriaLabel' => esc_html__( 'Clear color', 'radiate' ),
+ 'defaultString' => esc_html__( 'Default', 'radiate' ),
+ 'defaultAriaLabel' => esc_html__( 'Select default color', 'radiate' ),
+ 'pick' => esc_html__( 'Select Color', 'radiate' ),
+ 'defaultLabel' => esc_html__( 'Color value', 'radiate' ),
+ )
+ );
+ }
+ }
+
+ /**
+ * Refresh the parameters passed to the JavaScript via JSON.
+ *
+ * @see WP_Customize_Control::to_json()
+ */
+ public function to_json() {
+
+ parent::to_json();
+
+ $this->json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+
+
+
+
+ json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ $this->json['info'] = $this->info;
+ $this->json['links'] = $this->links;
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+ <# if ( data.info ) { #>
+
+ {{{ data.info }}}
+
+ <# } #>
+
+ <# if ( data.links ) { #>
+
+ <# } #>
+
+ json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ $this->json['placement'] = $this->placement;
+
+ }
+
+ /**
+ * An Underscore (JS) template for this control's content (but not its container).
+ *
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+ *
+ * @see WP_Customize_Control::print_template()
+ *
+ * @access protected
+ */
+ protected function content_template() {
+ ?>
+
+
+ <# if ( data.placement == 'above' ) { #>
+
+ <# } #>
+
+
+ <# if ( data.label ) { #>
+ {{{ data.label }}}
+ <# } #>
+
+ <# if ( data.description ) { #>
+ {{{ data.description }}}
+ <# } #>
+
+
+ <# if ( data.placement == 'below' ) { #>
+
+ <# } #>
+
+
+ json['default'] = $this->setting->default;
+ if ( isset( $this->default ) ) {
+ $this->json['default'] = $this->default;
+ }
+ $this->json['value'] = $this->value();
+
+ $this->json['link'] = $this->get_link();
+ $this->json['id'] = $this->id;
+ $this->json['label'] = esc_html( $this->label );
+ $this->json['description'] = $this->description;
+
+ $dropdown = wp_dropdown_categories(
+ array(
+ 'echo' => false,
+ 'name' => '_customize-dropdown-categories-' . esc_attr( $this->id ),
+ 'show_option_none' => ' ',
+ 'option_none_value' => '-1',
+ 'selected' => esc_attr( $this->value() ),
+ )
+ );
+
+ // Add in the data link parameter for dropdown categories.
+ $dropdown = str_replace( '