From 9fb10451cac991ba97549bbcbddb2c90351fbae3 Mon Sep 17 00:00:00 2001 From: raducretu Date: Thu, 30 May 2019 21:58:42 +0300 Subject: [PATCH] v2.4.3 --- class.shortcodes.php | 118 +++++ class.sidebars.php | 319 ++++++++++++ curly-extension.php | 3 +- enqueue-admin/css/customizer.css | 203 ++++++++ enqueue-admin/css/customizer.scss | 270 ++++++++++ enqueue-admin/css/meta-boxes.css | 252 +++++++++ enqueue-admin/css/sidebars.css | 102 ++++ enqueue-admin/js/alpha-color-picker.js | 267 ++++++++++ enqueue-admin/js/customizer.js | 31 ++ enqueue-admin/js/hashTabber.js | 186 +++++++ enqueue-admin/js/ips.js | 102 ++++ enqueue-admin/js/live-customizer.js | 339 ++++++++++++ .../js/min/alpha-color-picker-min.js | 1 + enqueue-admin/js/min/customizer-min.js | 1 + enqueue-admin/js/min/ips-min.js | 1 + enqueue-admin/js/min/live-customizer-min.js | 1 + .../js/min/wp-color-picker-alpha-min.js | 1 + enqueue-admin/js/sidebars.js | 84 +++ enqueue-admin/js/wp-color-picker-alpha.js | 490 ++++++++++++++++++ 19 files changed, 2770 insertions(+), 1 deletion(-) create mode 100644 class.shortcodes.php create mode 100644 class.sidebars.php create mode 100644 enqueue-admin/css/customizer.css create mode 100644 enqueue-admin/css/customizer.scss create mode 100644 enqueue-admin/css/meta-boxes.css create mode 100644 enqueue-admin/css/sidebars.css create mode 100644 enqueue-admin/js/alpha-color-picker.js create mode 100644 enqueue-admin/js/customizer.js create mode 100755 enqueue-admin/js/hashTabber.js create mode 100644 enqueue-admin/js/ips.js create mode 100644 enqueue-admin/js/live-customizer.js create mode 100644 enqueue-admin/js/min/alpha-color-picker-min.js create mode 100644 enqueue-admin/js/min/customizer-min.js create mode 100644 enqueue-admin/js/min/ips-min.js create mode 100644 enqueue-admin/js/min/live-customizer-min.js create mode 100644 enqueue-admin/js/min/wp-color-picker-alpha-min.js create mode 100644 enqueue-admin/js/sidebars.js create mode 100755 enqueue-admin/js/wp-color-picker-alpha.js diff --git a/class.shortcodes.php b/class.shortcodes.php new file mode 100644 index 0000000..31b58ea --- /dev/null +++ b/class.shortcodes.php @@ -0,0 +1,118 @@ +'.$content.'

'; + } + + /** Dropcap Shortcode */ + function dropcap_shortcode( $atts, $content = null ) { + return ''.$content.''; + } + + /** Icon Shortcode */ + function icon_shortcode( $atts, $content = null ) { + + $css = $style = array(); + + /** Check for icon */ + if ( isset( $atts['icon'] ) ) { + + /** Set icon */ + if ( strpos( $atts['icon'] ,'fa-') !== false ){ + $icon = $atts['icon']; + } else { + $icon = 'fa-'.$atts['icon']; + } + + /** Set icon size */ + if ( isset( $atts['size'] ) ) { + switch ( strtolower( $atts['size'] ) ) { + case '2x' : $icon .= ' fa-2x'; break; + case '3x' : $icon .= ' fa-3x'; break; + case '4x' : $icon .= ' fa-4x'; break; + case '5x' : $icon .= ' fa-5x'; break; + case 'lg' : $icon .= ' fa-lg'; break; + } + } + + /** Display */ + if ( isset( $atts['display'] ) ) { + switch ( strtolower( $atts['display'] ) ) { + case 'inline' : $icon .= ' display-inline'; break; + case 'block' : $icon .= ' center-block'; break; + } + } + + /** Icon color */ + if ( isset( $atts['color'] ) ) { + array_push( $style, 'color: '.$atts['color'] ); + } + + /** Border */ + if ( isset( $atts['border'] ) ) { + array_push( $css, 'fa-bordered' ); + array_push( $style, 'border: '.$atts['border'] ); + } + if ( isset( $atts['border_color'] ) || isset( $atts['border_style'] ) || isset( $atts['border_size'] ) ) { + array_push( $css, 'fa-bordered' ); + if ( isset( $atts['border_color'] ) ) { + array_push( $style, 'border-color: '.$atts['border_color'] ); + } + if ( isset( $atts['border_style'] ) ) { + array_push( $style, 'border-style: '.$atts['border_style'] ); + } + if ( isset( $atts['border_size'] ) ) { + array_push( $style, 'border-width: '.$atts['border_size'] ); + } + } + + /** Style */ + if ( isset( $atts['boxed'] ) && $atts['boxed'] == 'yes' ) { + array_push( $css, 'fa-boxed' ); + } + + /** Background */ + if ( isset( $atts['background'] ) ) { + array_push( $css, 'fa-boxed' ); + array_push( $style, 'background-color: '.$atts['background'] ); + } + + } + + return isset( $atts['icon'] ) ? "" : null; + } +} + +new CurlyShortcodes(); +?> \ No newline at end of file diff --git a/class.sidebars.php b/class.sidebars.php new file mode 100644 index 0000000..060621f --- /dev/null +++ b/class.sidebars.php @@ -0,0 +1,319 @@ +id == 'appearance_page_sidebars' ) { + + global $_wp_admin_css_colors; + $admin_colors = $_wp_admin_css_colors; + $color_scheme = $admin_colors[get_user_option('admin_color')]->colors; + + wp_register_style( + 'curly-google-font-roboto', + '//fonts.googleapis.com/css?family=Roboto:400,300,700,900', + true + ); + wp_register_style( + 'curly-sidebars', + plugins_url('/enqueue-admin/css/sidebars.css', __FILE__ ), + null, + null, + null + ); + wp_register_script( + 'curly-sidebars', + plugins_url('/enqueue-admin/js/sidebars.js', __FILE__ ), + array('jquery'), + null, + true + ); + + if ( ! wp_script_is( 'curly-google-font-roboto', 'enqueued' ) ) { + wp_enqueue_style( 'curly-google-font-roboto' ); + } + + if ( ! wp_script_is( 'curly-google-font-roboto', 'enqueued' ) ) { + wp_enqueue_style( 'curly-sidebars' ); + } + + if ( ! wp_script_is( 'curly-google-font-roboto', 'enqueued' ) ) { + wp_enqueue_script( 'curly-sidebars' ); + } + + $js_data = array( + __('Remove','whitelabel'), + __('Are you sure you want to delete this sidebar?','whitelabel'), + __('Sidebar name cannot be empty. Please provide a valid name for your sidebar.','whitelabel'), + __('You already have a sidebar with that name. Please provide a valid name for your sidebar.','whitelabel'), + __('Your sidebar has been succesfully created.','whitelabel'), + __('You currently have no sidebars created.
Use the form above to create your first sidebar.','whitelabel') + ); + + wp_localize_script('curly-sidebars', 'js_data', $js_data); + + $color_scheme = ' + #sidebars-wrapper input[type=submit], + #sidebar-list li a:hover{ + background-color: '.$color_scheme[3].'; + color: #fff; + }'; + + wp_add_inline_style('curly-sidebars', $color_scheme); + } + } + + function update_sidebars() { + + $name = sanitize_text_field( $_POST['name'] ); + $id = sanitize_text_field( $_POST['id'] ); + $method = sanitize_text_field( $_POST['method'] ); + + $sidebars = $this->get_sidebars(); + $count = $this->get_sidebars_count() + 1; + + if ( $method == 'update' ) { + + if ( !empty($name) ) { + + if ( !$sidebars ) { + + $sidebars = array( $count => $name ); + $sidebars = json_encode($sidebars); + update_option( $this->_prefix . '_sidebars_list' , $sidebars ); + update_option( $this->_prefix . '_sidebars_list_count' , $count ); + + echo json_encode( array( $count, $name ) ); + + } else { + + if ( !in_array( $name , $sidebars ) ) { + + $sidebars[$count] = $name ; + $sidebars = json_encode($sidebars); + update_option( $this->_prefix . '_sidebars_list' , $sidebars ); + update_option( $this->_prefix . '_sidebars_list_count' , $count ); + + echo json_encode( array( $count, $name ) ); + + } else { + echo 'duplicate'; + } + } + + } else { + echo 'empty'; + } + + } + + if ( $method == 'delete' ) { + unset( $sidebars[$id] ); + $sidebars = json_encode($sidebars); + update_option( $this->_prefix . '_sidebars_list' , $sidebars ); + echo 'success'; + } + + die(); + } + + function add_submenu_page(){ + add_theme_page( __('Sidebars', 'whitelabel'), __('Sidebars', 'whitelabel'), 'edit_theme_options', 'sidebars', array($this, 'add_submenu_page_cb')); + } + + function add_submenu_page_cb( $html = null ) { + + $sidebars = $this->get_sidebars(); + + $html .= ''; + + echo $html; + } + + function get_sidebars() { + $sidebars = get_option( $this->_prefix . '_sidebars_list' ); + $sidebars = json_decode( $sidebars , true); + + return $sidebars; + } + + function get_sidebars_count() { + $count = get_option( $this->_prefix . '_sidebars_list_count', 0 ); + + return $count; + } + + function create_sidebars() { + $sidebars = $this->get_sidebars(); + if ( $sidebars ) { + foreach ($sidebars as $id => $name) { + register_sidebar( array( + 'name' => $name, + 'id' => 'dynamic-sidebar-'.$id, + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + } + } + + } + + public static function sidebar( $default = null, $logic = false, $return = false ) { + + global $post; + + $sidebar = get_post_meta( $post->ID, 'white_dynamic_sidebar', true ); + + if( $return === true ){ + if ( $sidebar && is_active_sidebar( $sidebar ) ) return $sidebar; + elseif( is_active_sidebar( $default ) ) return $default; + else return; + } else { + if ( $logic === true ) { + if ( $sidebar && is_active_sidebar( $sidebar ) ) { + dynamic_sidebar( $sidebar ); + } elseif( is_active_sidebar( $default ) ) { + dynamic_sidebar( $default ); + } else { + return; + } + } else { + if ( $sidebar ) { + dynamic_sidebar( $sidebar ); + } else { + dynamic_sidebar( $default ); + } + } + } + } + + function sidebar_shortcode( $atts ) { + + ob_start(); + dynamic_sidebar( 'sidebar_'.$atts['id'] ); + $sidebar = ob_get_contents(); + ob_end_clean(); + + return $sidebar; + } + + public function meta_box() { + $screens = array( 'post', 'page' ); + + foreach ( $screens as $screen ) { + add_meta_box('sidebar_metabox', __( 'Sidebar', 'whitelabel' ), array($this, 'meta_box_callback'), $screen, 'side'); + } + + } + + public function meta_box_callback( $post ) { + + wp_nonce_field( 'sidebar_meta_box', 'sidebar_meta_box_nonce' ); + + $default_sidebar = get_post_meta( $post->ID, $this->_prefix . '_dynamic_sidebar', true ); + + global $wp_registered_sidebars; + + echo '

'; + echo ''; + echo '

'.__('Choose a custom sidebar for this page','whitelabel').'

'; + } + + public function save_meta_box_data( $post_id ) { + + if ( ! isset( $_POST['sidebar_meta_box_nonce'] ) ) { + return; + } + + if ( ! wp_verify_nonce( $_POST['sidebar_meta_box_nonce'], 'sidebar_meta_box' ) ) { + return; + } + + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { + return; + } + + if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { + + if ( ! current_user_can( 'edit_page', $post_id ) ) { + return; + } + + } else { + + if ( ! current_user_can( 'edit_post', $post_id ) ) { + return; + } + } + + if ( ! isset( $_POST['sidebar'] ) ) { + return; + } + + $data = sanitize_text_field( $_POST['sidebar'] ); + update_post_meta( $post_id, $this->_prefix . '_dynamic_sidebar', $data ); + } + } + + $sidebars = new WhitelabelSidebars(); + +} +?> diff --git a/curly-extension.php b/curly-extension.php index 689dcce..7965ac2 100644 --- a/curly-extension.php +++ b/curly-extension.php @@ -3,7 +3,7 @@ Plugin Name: Curly Themes Extension Plugin URI: http://demo.curlythemes.com Description: Curly Themes Extension is a collection of Shortcodes, Widgets and Plugins. This plugin exclusive for Curly Themes -Version: 2.4.2 +Version: 2.4.3 Author: Curly Themes Author URI: http://www.curlythemes.com */ @@ -275,5 +275,6 @@ function load_shortcodes_admin_scripts() { $builder = new CurlyThemesShortcodeBuilder('eque'); require_once( 'class.vc.php' ); +require_once( 'class.shortcodes.php' ); ?> diff --git a/enqueue-admin/css/customizer.css b/enqueue-admin/css/customizer.css new file mode 100644 index 0000000..bdd4986 --- /dev/null +++ b/enqueue-admin/css/customizer.css @@ -0,0 +1,203 @@ +.customize-control { + margin-bottom: 20px; + /** Colors */ + /** Checkbox Control */ + /** Range Control */ } + .customize-control .wp-picker-input-wrap .wp-picker-default, + .customize-control .wp-picker-input-wrap .wp-picker-clear { + margin-left: 5px; } + .customize-control.customize-control-images .image { + display: inline-block; + min-width: 30px; + min-width: 30px; + vertical-align: middle; + text-align: center; + border: 1px solid rgba(0, 0, 0, 0.1); } + .customize-control.customize-control-images input[type=radio] { + display: none; } + .customize-control.customize-control-checkbox { + margin-bottom: 5px; } + .customize-control.customize-control-checkbox + .customize-control:not(.customize-control-checkbox) { + margin-top: 15px; } + .customize-control.customize-control-checkbox label { + font-weight: 600; } + .customize-control.customize-control-slider { + margin-bottom: 25px; } + .customize-control.customize-control-slider > label { + display: block; } + .customize-control.customize-control-slider .customize-control-title { + margin-bottom: 5px; } + .customize-control.customize-control-slider .ui-slider { + -webkit-appearance: none; + width: 100%; + height: 10px; + border-radius: 5px; + background: #F5F5F5; + outline: none; + box-sizing: border-box; + padding-right: 0; + padding-left: 0; + margin-top: 3px; + position: relative; } + .customize-control.customize-control-slider .ui-slider-handle { + display: block; + width: 20px; + height: 20px; + border-radius: 100%; + background: #555555; + -webkit-transition: opacity .15s ease-in-out; + transition: opacity .15s ease-in-out; + position: absolute; + box-sizing: border-box; + margin: -5px 0 0 -10px; } + .customize-control.customize-control-slider .ui-slider-handle:hover { + opacity: 0.85; } + .customize-control.customize-control-slider .ui-slider-handle:active { + opacity: 0.85; } + .customize-control.customize-control-slider .range-value { + display: inline-block; + float: right; + opacity: .75; + font-size: .9em; + margin-left: 10px; } + .customize-control.customize-control-text input[type=text] { + border-radius: 2px; + padding: 5px 10px; } + .customize-control.customize-control-radio label { + line-height: 25px; } + .customize-control .customize-control-title { + margin-bottom: 0px; } + +.customize-section-description-container { + margin-bottom: 20px; } + .customize-section-description-container .description { + font-size: 0.85em; } + .customize-section-description-container .description::before { + content: 'INFO:'; + display: inline-block; + margin-right: 5px; + font-weight: bold; } + +.customize-control-content .customizer-section-intro { + font-size: 0.85em; + margin-bottom: 20px; } + .customize-control-content .customizer-section-intro::before { + content: 'INFO:'; + display: inline-block; + margin-right: 5px; + font-weight: bold; } + +.description.customize-control-description { + font-size: 0.9em; + opacity: 0.75; + font-weight: normal; } + +#customize-controls .description { + font-style: normal; } +#customize-controls select { + width: 100%; } + +/** + * Alpha Color Picker CSS + */ +.customize-control-alpha-color .wp-picker-container .iris-picker { + border-bottom: none; } + +.customize-control-alpha-color .wp-picker-container { + max-width: 257px; } + +.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap { + width: 100%; } + +.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + float: left; + width: 195px; } + +.customize-control-alpha-color .wp-picker-input-wrap .button { + margin-left: 0; + float: right; } + +.wp-picker-container .wp-picker-open ~ .wp-picker-holder .alpha-color-picker-container { + display: block; } + +.alpha-color-picker-container { + border: 1px solid #dfdfdf; + border-top: none; + display: none; + background: #FFF; + padding: 0 11px 10px; + position: relative; } + +.alpha-color-picker-container .ui-widget-content, +.alpha-color-picker-container .ui-widget-header, +.alpha-color-picker-wrap .ui-state-focus { + background: transparent; + border: none; } + +.alpha-color-picker-wrap a.iris-square-value:focus { + -webkit-box-shadow: none; + box-shadow: none; } + +.alpha-color-picker-container .ui-slider { + position: relative; + z-index: 1; + height: 24px; + text-align: center; + margin: 0 auto; + width: 88%; + width: calc( 100% - 28px ); } + +.alpha-color-picker-container .ui-slider-handle, +.alpha-color-picker-container .ui-widget-content .ui-state-default { + color: #777; + background-color: #FFF; + text-shadow: 0 1px 0 #FFF; + text-decoration: none; + position: absolute; + z-index: 2; + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + margin-top: -2px; + top: -4px; + height: 26px; + width: 26px; + cursor: ew-resize; + font-size: 0; + padding: 4px; + line-height: 27px; + margin-left: -14px; } + +.alpha-color-picker-container .ui-slider-handle.show-opacity { + font-size: 12px; } + +.alpha-color-picker-container .click-zone { + width: 14px; + height: 24px; + display: block; + position: absolute; + left: 10px; } + +.alpha-color-picker-container .max-click-zone { + right: 10px; + left: auto; } + +.alpha-color-picker-container .transparency { + height: 24px; + width: 100%; + background-color: #FFF; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + padding: 0; + margin-top: -24px; } + +@media only screen and (max-width: 782px) { + .customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + width: 184px; } } +@media only screen and (max-width: 640px) { + .customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + width: 172px; + height: 33px; } } diff --git a/enqueue-admin/css/customizer.scss b/enqueue-admin/css/customizer.scss new file mode 100644 index 0000000..4e0eec0 --- /dev/null +++ b/enqueue-admin/css/customizer.scss @@ -0,0 +1,270 @@ +.customize-control{ + margin-bottom: 20px; + + .wp-picker-input-wrap{ + .wp-picker-default, + .wp-picker-clear{ + margin-left: 5px; + } + } + + /** Colors */ + &.customize-control-images{ + .image{ + display: inline-block; + min-width: 30px; + min-width: 30px; + vertical-align: middle; + text-align: center; + border: 1px solid rgba(0,0,0, 0.1); + } + input[type=radio]{ + display: none + } + } + + /** Checkbox Control */ + &.customize-control-checkbox{ + margin-bottom: 5px; + + + .customize-control:not(.customize-control-checkbox){ + margin-top: 15px; + } + label{ + font-weight: 600; + } + } + + /** Range Control */ + &.customize-control-slider{ + margin-bottom: 25px; + + > label{ + display: block; + } + .customize-control-title{ + margin-bottom: 5px; + } + .ui-slider{ + -webkit-appearance: none; + width: 100%; + height: 10px; + border-radius: 5px; + background: #F5F5F5; + outline: none; + box-sizing: border-box; + padding-right: 0; + padding-left: 0; + margin-top: 3px; + position: relative; + } + .ui-slider-handle { + display: block; + width: 20px; + height: 20px; + border-radius: 100%; + background: #555555; + -webkit-transition: opacity .15s ease-in-out; + transition: opacity .15s ease-in-out; + position: absolute; + box-sizing: border-box; + margin: -5px 0 0 -10px; + + &:hover { + opacity: .85 + } + &:active{ + opacity: .85 + } + } + .range-value { + display: inline-block; + float: right; + opacity: .75; + font-size: .9em; + margin-left: 10px; + } + } + &.customize-control-text{ + input[type=text]{ + border-radius: 2px; + padding: 5px 10px; + } + } + &.customize-control-radio{ + label{ + line-height: 25px; + } + } + .customize-control-title{ + margin-bottom: 0px; + } +} +.customize-section-description-container{ + margin-bottom: 20px; + + .description{ + font-size: 0.85em; + + &::before{ + content: 'INFO:'; + display: inline-block; + margin-right: 5px; + font-weight: bold; + } + } +} +.customize-control-content{ + .customizer-section-intro{ + font-size: 0.85em; + margin-bottom: 20px; + + &::before{ + content: 'INFO:'; + display: inline-block; + margin-right: 5px; + font-weight: bold; + } + } +} +.description.customize-control-description{ + font-size: 0.9em; + opacity: 0.75; + font-weight: normal; +} +#customize-controls{ + .description{ + font-style: normal; + } + select{ + width: 100%; + } +} + + +/** + * Alpha Color Picker CSS + */ + +.customize-control-alpha-color .wp-picker-container .iris-picker { + border-bottom:none; +} + +.customize-control-alpha-color .wp-picker-container { + max-width: 257px; +} + +.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap { + width: 100%; +} + +.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + float: left; + width: 195px; +} + +.customize-control-alpha-color .wp-picker-input-wrap .button { + margin-left: 0; + float: right; +} + +.wp-picker-container .wp-picker-open ~ .wp-picker-holder .alpha-color-picker-container { + display: block; +} + +.alpha-color-picker-container { + border: 1px solid #dfdfdf; + border-top: none; + display: none; + background: #FFF; + padding: 0 11px 10px; + position: relative; +} + +.alpha-color-picker-container .ui-widget-content, +.alpha-color-picker-container .ui-widget-header, +.alpha-color-picker-wrap .ui-state-focus { + background: transparent; + border: none; +} + +.alpha-color-picker-wrap a.iris-square-value:focus { + -webkit-box-shadow: none; + box-shadow: none; +} + +.alpha-color-picker-container .ui-slider { + position: relative; + z-index: 1; + height: 24px; + text-align: center; + margin: 0 auto; + width: 88%; + width: calc( 100% - 28px ); +} + +.alpha-color-picker-container .ui-slider-handle, +.alpha-color-picker-container .ui-widget-content .ui-state-default { + color: #777; + background-color: #FFF; + text-shadow: 0 1px 0 #FFF; + text-decoration: none; + position: absolute; + z-index: 2; + box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.2); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + margin-top: -2px; + top: -4px; + height: 26px; + width: 26px; + cursor: ew-resize; + font-size: 0; + padding: 4px; + line-height: 27px; + margin-left: -14px; +} + +.alpha-color-picker-container .ui-slider-handle.show-opacity { + font-size: 12px; +} + +.alpha-color-picker-container .click-zone { + width: 14px; + height: 24px; + display: block; + position: absolute; + left: 10px; +} + +.alpha-color-picker-container .max-click-zone { + right: 10px; + left: auto; +} + +.alpha-color-picker-container .transparency { + height: 24px; + width: 100%; + background-color: #FFF; + + box-shadow: 0 0 5px rgba(0,0,0,0.4) inset; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + padding: 0; + margin-top: -24px; +} + +@media only screen and (max-width: 782px) { + .customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + width: 184px; + } +} + +@media only screen and (max-width: 640px) { + .customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control { + width: 172px; + height: 33px; + } +} diff --git a/enqueue-admin/css/meta-boxes.css b/enqueue-admin/css/meta-boxes.css new file mode 100644 index 0000000..ea3eb4f --- /dev/null +++ b/enqueue-admin/css/meta-boxes.css @@ -0,0 +1,252 @@ +#individual-page-settings *{ + outline: none; +} +#individual-page-settings .pull-right{ + float: right; +} +#individual-page-settings .inside{ + padding: 0; + margin: 0; + background: #F5F5F5; +} +#individual-page-settings-wrapper { + overflow: auto; + position: relative; + border: none; + padding: 0; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; +} + +/* Tab List */ +.hashTabber-nav{ + float: left; + width: 180px; + position: absolute; + height: 100%; + z-index: 1; + background: #F5F5F5; + margin: 0; + padding: 0; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; +} +.hashTabber-nav > li{ + padding: 0; + margin: 0; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; + float: none; + border: none; + color: inherit; + background: transparent; +} +.hashTabber-nav > li > a{ + text-decoration: none; + outline: none; + text-decoration: none; + display: block; + padding: 10px 0 10px 20px; + line-height: 20px; + border-bottom: 1px solid #E5E5E5; + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; + float: none; +} +.hashTabber-nav > li.active > a{ + background: #fff; + position: relative; + z-index: 2; + box-shadow: 0px 2px 2px -1px rgba(0, 0, 0, .07); +} +.hashTabber-nav::after{ + content: ' '; + display: block; + height: 100%; + position: absolute; + right: 0; + border-left: 1px solid #E5E5E5; + top: 0; + bottom: 0; +} + +/* Tabs */ +.hashTabber-data{ + float: left; + width: 100%; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding-left: 180px; + position: relative; + height: 100%; + min-height: 289px; + background: #fff; + margin: 0; +} +.hashTabber-data > li{ + display: none; + box-sizing: border-box; + padding: 0 30px; + width: 100%; +} +.hashTabber-data > li.active{ + display: table; +} + +/* Form Elements */ +#individual-page-settings .form-control { + overflow: hidden; + display: block; + margin-bottom: 30px; + max-width: 550px; +} +#individual-page-settings .form-control .name{ + display: block; + margin: 10px 0 5px; + font-weight: bold; + line-height: 20px; +} +#individual-page-settings .form-control:last-child .name, +#individual-page-settings .form-control:last-child > div{ + border-bottom: none; +} +#individual-page-settings .form-control > div{ + display: block; +} +#individual-page-settings .form-control .description{ + display: block; + color: #95a5a6; + font-style: normal; + line-height: 1.4em; +} +#individual-page-settings .form-control .slider_value + .description{ + padding-right: 100px; +} +#individual-page-settings .form-control.checkbox .description{ + display: inline-block; + line-height: 27px; +} +#individual-page-settings .form-control .description strong.red{ + color: #c0392b; +} +#individual-page-settings .form-control .text-field{ + width: 100%; + box-sizing: border-box; + margin: 0; + margin-bottom: 3px; + padding: 0 10px; + min-height: 27px; + line-height: 27px; + font-family: inherit; + font-size: 13px; + line-height: 27px; +} +#individual-page-settings .form-control .textarea{ + width: 100%; + height: 70px; + margin-bottom: 3px; + padding: 5px 10px; + font-family: inherit; + font-size: 13px; + line-height: 1.4em; +} +#individual-page-settings .form-control .select{ + min-width: 25%; + margin-bottom: 3px; + font-family: inherit; + font-size: 13px; + line-height: 1.4em; +} +#individual-page-settings .form-control.image-field .button{ + margin: 5px 5px 5px 0; +} +#individual-page-settings .form-control .image-preview{ + margin: 10px 0; + max-width: 100%; + height: auto; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + display: block; +} +#individual-page-settings .form-control .slider_value{ + position: absolute; + line-height: 1.4em; + font-weight: bold; + top: 20px; + right: 0; + font-size: 14px; + color: #7f8c8d; +} +#individual-page-settings .form-control .slider.ui-slider{ + position: relative; + background:rgba(189, 195, 199,0.35); + height: 6px; + border-radius: 100px; + margin: 15px 0; +} +#individual-page-settings .form-control .slider.ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + width: 20px; + height: 20px; + cursor: default; + background: #e74c3c; + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + text-decoration: none; + outline: none; + border-radius: 100px; + margin-left: -12px; + margin-top: -8px; + cursor: pointer; + top: auto; + box-shadow: none; + border: none; +} + +#individual-page-settings .form-control.radio > div > label{ + padding-right: 20px; + line-height: 27px; + display: inline-block; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + min-width: 25%; +} +#individual-page-settings .form-control.radio > div > label:last-of-type{ + padding-right: 0; +} +#individual-page-settings .form-control > div > label input{ + margin-right: 10px; +} + + +/* Mobile */ +@media only screen and (max-width : 782px) { + #individual-page-settings-wrapper > ul > li{ + width: auto; + } + #individual-page-settings-wrapper > ul.hashTabber-nav{ + float: none; + width: 100%; + position: static; + } + #individual-page-settings-wrapper > ul.hashTabber-data{ + float: none; + padding-left: 0; + } +} \ No newline at end of file diff --git a/enqueue-admin/css/sidebars.css b/enqueue-admin/css/sidebars.css new file mode 100644 index 0000000..7301ac8 --- /dev/null +++ b/enqueue-admin/css/sidebars.css @@ -0,0 +1,102 @@ +#sidebars-wrapper{ + font-family: 'Roboto'; + padding: 40px 0px 40px 40px; + max-width: 450px; + position: relative; + -webkit-transition: all 150ms ease-in; + -moz-transition: all 150ms ease-in; + -ms-transition: all 150ms ease-in; + -o-transition: all 150ms ease-in; + transition: all 150ms ease-in; + text-decoration: none; +} +#sidebars-wrapper h1, +#sidebars-wrapper h3{ + color: #444; +} +#sidebars-wrapper h3{ + margin-top: 80px; +} +#sidebars-wrapper input[type=text]{ + width: 100%; + box-shadow: none; + height: 34px; + line-height: 34px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + padding: 0 10px; + margin: 0; + font-size: 14px; +} +#sidebars-wrapper input[type=submit]{ + display: inline-block; + background: #DDD; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + color: #5E5E5E; + border: none; + height: 34px; + line-height: 34px; + outline: none; + padding: 0 30px; + margin: 8px 8px 0 0; + cursor: pointer; + text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.15); + font-size: 14px; + font-weight: bold; +} +#sidebars-wrapper form{ + position: relative; +} +#sidebars-wrapper #messages p{ + background: rgba(0, 0, 0, .055); + font-size: 12px; + padding: 10px 15px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + margin: 10px 0 0 0; + position: relative; +} +#sidebar-list{ + border-top: 1px solid #DDD; + border-bottom: 1px solid #FAFAFA; +} +#sidebar-list li{ + border-top: 1px solid #FAFAFA; + border-bottom: 1px solid #DDD; + padding: 8px 0; + margin: 0; + position: relative; +} +#sidebar-list li a{ + float: right; + display: inline-block; + background: #DDD; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border: none; + height: 18px; + line-height: 18px; + outline: none; + padding: 0 10px; + cursor: pointer; + font-size: 11px; + text-decoration: none; + color: #444; +} +#sidebar-list li a:hover{ + background: #444; + color: #fff; +} +#sidebar-list code{ + background: none; + font-size: 11px; + padding: 0; + margin: 0; + position: absolute; + right: 80px; +} \ No newline at end of file diff --git a/enqueue-admin/js/alpha-color-picker.js b/enqueue-admin/js/alpha-color-picker.js new file mode 100644 index 0000000..24c6cf6 --- /dev/null +++ b/enqueue-admin/js/alpha-color-picker.js @@ -0,0 +1,267 @@ +/** + * Alpha Color Picker JS + * + * This file includes several helper functions and the core control JS. + */ + +/** + * Override the stock color.js toString() method to add support for + * outputting RGBa or Hex. + */ +Color.prototype.toString = function( flag ) { + + // If our no-alpha flag has been passed in, output RGBa value with 100% opacity. + // This is used to set the background color on the opacity slider during color changes. + if ( 'no-alpha' == flag ) { + return this.toCSS( 'rgba', '1' ).replace( /\s+/g, '' ); + } + + // If we have a proper opacity value, output RGBa. + if ( 1 > this._alpha ) { + return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' ); + } + + // Proceed with stock color.js hex output. + var hex = parseInt( this._color, 10 ).toString( 16 ); + if ( this.error ) { return ''; } + if ( hex.length < 6 ) { + for ( var i = 6 - hex.length - 1; i >= 0; i-- ) { + hex = '0' + hex; + } + } + + return '#' + hex; +}; + +/** + * Given an RGBa, RGB, or hex color value, return the alpha channel value. + */ +function acp_get_alpha_value_from_color( value ) { + var alphaVal; + + // Remove all spaces from the passed in value to help our RGBa regex. + value = value.replace( / /g, '' ); + + if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) { + alphaVal = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[1] ).toFixed(2) * 100; + alphaVal = parseInt( alphaVal ); + } else { + alphaVal = 100; + } + + return alphaVal; +} + +/** + * Force update the alpha value of the color picker object and maybe the alpha slider. + */ + function acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, update_slider ) { + var iris, colorPicker, color; + + iris = $control.data( 'a8cIris' ); + colorPicker = $control.data( 'wpWpColorPicker' ); + + // Set the alpha value on the Iris object. + iris._color._alpha = alpha; + + // Store the new color value. + color = iris._color.toString(); + + // Set the value of the input. + $control.val( color ); + + // Update the background color of the color picker. + colorPicker.toggler.css({ + 'background-color': color + }); + + // Maybe update the alpha slider itself. + if ( update_slider ) { + acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ); + } + + // Update the color value of the color picker object. + $control.wpColorPicker( 'color', color ); +} + +/** + * Update the slider handle position and label. + */ +function acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ) { + $alphaSlider.slider( 'value', alpha ); + $alphaSlider.find( '.ui-slider-handle' ).text( alpha.toString() ); +} + +/** + * Initialization trigger. + */ +jQuery( document ).ready( function( $ ) { + + // Loop over each control and transform it into our color picker. + $( '.alpha-color-control' ).each( function() { + + // Scope the vars. + var $control, startingColor, paletteInput, showOpacity, defaultColor, palette, + colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions; + + // Store the control instance. + $control = $( this ); + + // Get a clean starting value for the option. + startingColor = $control.val().replace( /\s+/g, '' ); + + // Get some data off the control. + paletteInput = $control.attr( 'data-palette' ); + showOpacity = $control.attr( 'data-show-opacity' ); + defaultColor = $control.attr( 'data-default-color' ); + + // Process the palette. + if ( paletteInput.indexOf( '|' ) !== -1 ) { + palette = paletteInput.split( '|' ); + } else if ( 'false' == paletteInput ) { + palette = false; + } else { + palette = true; + } + + // Set up the options that we'll pass to wpColorPicker(). + colorPickerOptions = { + change: function( event, ui ) { + var key, value, alpha, $transparency; + + key = $control.attr( 'data-customize-setting-link' ); + value = $control.wpColorPicker( 'color' ); + + // Set the opacity value on the slider handle when the default color button is clicked. + if ( defaultColor == value ) { + alpha = acp_get_alpha_value_from_color( value ); + $alphaSlider.find( '.ui-slider-handle' ).text( alpha ); + } + + // Send ajax request to wp.customize to trigger the Save action. + wp.customize( key, function( obj ) { + obj.set( value ); + }); + + $transparency = $container.find( '.transparency' ); + + // Always show the background color of the opacity slider at 100% opacity. + $transparency.css( 'background-color', ui.color.toString( 'no-alpha' ) ); + }, + palettes: palette // Use the passed in palette. + }; + + // Create the colorpicker. + $control.wpColorPicker( colorPickerOptions ); + + $container = $control.parents( '.wp-picker-container:first' ); + + // Insert our opacity slider. + $( '
' + + '
' + + '
' + + '
' + + '
' + + '
' ).appendTo( $container.find( '.wp-picker-holder' ) ); + + $alphaSlider = $container.find( '.alpha-slider' ); + + // If starting value is in format RGBa, grab the alpha channel. + alphaVal = acp_get_alpha_value_from_color( startingColor ); + + // Set up jQuery UI slider() options. + sliderOptions = { + create: function( event, ui ) { + var value = $( this ).slider( 'value' ); + + // Set up initial values. + $( this ).find( '.ui-slider-handle' ).text( value ); + $( this ).siblings( '.transparency ').css( 'background-color', startingColor ); + }, + value: alphaVal, + range: 'max', + step: 1, + min: 0, + max: 100, + animate: 300 + }; + + // Initialize jQuery UI slider with our options. + $alphaSlider.slider( sliderOptions ); + + // Maybe show the opacity on the handle. + if ( 'true' == showOpacity ) { + $alphaSlider.find( '.ui-slider-handle' ).addClass( 'show-opacity' ); + } + + // Bind event handlers for the click zones. + $container.find( '.min-click-zone' ).on( 'click', function() { + acp_update_alpha_value_on_color_control( 0, $control, $alphaSlider, true ); + }); + $container.find( '.max-click-zone' ).on( 'click', function() { + acp_update_alpha_value_on_color_control( 100, $control, $alphaSlider, true ); + }); + + // Bind event handler for clicking on a palette color. + $container.find( '.iris-palette' ).on( 'click', function() { + var color, alpha; + + color = $( this ).css( 'background-color' ); + alpha = acp_get_alpha_value_from_color( color ); + + acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ); + + // Sometimes Iris doesn't set a perfect background-color on the palette, + // for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039). + // To compensante for this we round the opacity value on RGBa colors here + // and save it a second time to the color picker object. + if ( alpha != 100 ) { + color = color.replace( /[^,]+(?=\))/, ( alpha / 100 ).toFixed( 2 ) ); + } + + $control.wpColorPicker( 'color', color ); + }); + + // Bind event handler for clicking on the 'Clear' button. + $container.find( '.button.wp-picker-clear' ).on( 'click', function() { + var key = $control.attr( 'data-customize-setting-link' ); + + // The #fff color is delibrate here. This sets the color picker to white instead of the + // defult black, which puts the color picker in a better place to visually represent empty. + $control.wpColorPicker( 'color', '#ffffff' ); + + // Set the actual option value to empty string. + wp.customize( key, function( obj ) { + obj.set( '' ); + }); + + acp_update_alpha_value_on_alpha_slider( 100, $alphaSlider ); + }); + + // Bind event handler for clicking on the 'Default' button. + $container.find( '.button.wp-picker-default' ).on( 'click', function() { + var alpha = acp_get_alpha_value_from_color( defaultColor ); + + acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ); + }); + + // Bind event handler for typing or pasting into the input. + $control.on( 'input', function() { + var value = $( this ).val(); + var alpha = acp_get_alpha_value_from_color( value ); + + acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ); + }); + + // Update all the things when the slider is interacted with. + $alphaSlider.slider().on( 'slide', function( event, ui ) { + var alpha = parseFloat( ui.value ) / 100.0; + + acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, false ); + + // Change value shown on slider handle. + $( this ).find( '.ui-slider-handle' ).text( ui.value ); + }); + + }); +}); diff --git a/enqueue-admin/js/customizer.js b/enqueue-admin/js/customizer.js new file mode 100644 index 0000000..953d014 --- /dev/null +++ b/enqueue-admin/js/customizer.js @@ -0,0 +1,31 @@ +(function($) { + "use strict"; + + /** Allow JS */ + wp.customize( 'custom_js_check', function( value ) { + value.bind( function( ) { + $('#customize-control-custom_js').toggle(); + } ); + } ); + + /** Check Boxed Content */ + wp.customize( 'footer_style', function( value ) { + value.bind( function( newval ) { + if( newval === '2' ) { + wp.customize.control( 'footer_bg' ).activate(); + wp.customize.control( 'footer_bg_repeat' ).activate(); + wp.customize.control( 'footer_bg_position' ).activate(); + } else { + wp.customize.control( 'footer_bg' ).deactivate(); + wp.customize.control( 'footer_bg_repeat' ).deactivate(); + wp.customize.control( 'footer_bg_position' ).deactivate(); + } + } ); + } ); + + $(function() { + $('option[value^=rev_]', '#customize-control-header_slider' ).first().before(''); + $('option[value^=layer_]', '#customize-control-header_slider' ).first().before(''); + }); + +})(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/hashTabber.js b/enqueue-admin/js/hashTabber.js new file mode 100755 index 0000000..c655a3c --- /dev/null +++ b/enqueue-admin/js/hashTabber.js @@ -0,0 +1,186 @@ +// -------------------------------------------------- +// HashTabber v2.1 by smutnyleszek@gmail.com +// http://hashtabber.smutnyleszek.com +// License CC0 1.0 +// -------------------------------------------------- + + +// -------------------------------------------------- +// Class managing helper functions +// -------------------------------------------------- + +function hasClass(el, cl) { + return el.className && new RegExp('(\\s|^)' + cl + '(\\s|$)').test(el.className); +} +function addClass(el, cl) { + if (!hasClass(el, cl)) { el.className += ' ' + cl; } +} +function removeClass(el, cl) { + var reg = new RegExp('(\\s|^)' + cl + '(\\s|$)'); + el.className = el.className.replace(reg, ' ').replace(/(^\s*)|(\s*$)/g, ''); +} +function toggleClass(el, cl) { + if (hasClass(el, cl)) { removeClass(el, cl); } else { addClass(el, cl); } +} + + +// -------------------------------------------------- +// main HashTabber creator function +// -------------------------------------------------- + +function HashTabber(customOptions) { + this.options = { + classActive: 'active', + classData: 'hashTabber-data', + classNav: 'hashTabber-nav', + dataDefault: 'data-hashtabber-default', + dataId: 'data-hashtabber-id', + dataPair: 'data-hashtabber-pair' + }; + // check if there are any custom options + if (customOptions) { + // go through all the options and set new values if provided + if (customOptions.classActive) { this.options.classActive = customOptions.classActive; } + if (customOptions.classData) { this.options.classData = customOptions.classData; } + if (customOptions.classNav) { this.options.classNav = customOptions.classNav; } + if (customOptions.dataDefault) { this.options.dataDefault = customOptions.dataDefault; } + if (customOptions.dataId) { this.options.dataId = customOptions.dataId; } + if (customOptions.dataPair) { this.options.dataPair = customOptions.dataPair; } + } + this.helpers = { + hashProber: function () { + // get hash from window location and remove # character + var hash = String(window.location.hash.replace('#', '')); + var outcome = false; + // if hash not empty + // split it to array of parameters by "=" and "&" + if (hash.length !== 0) { + outcome = hash.split(/\=|&/); + } + return outcome; + }, + idsGiver: function (options) { + var a, b, c, d; + var tabberId; + var tabberDefault; + var tabName; + var navList; + var navLiChildren; + var dataList; + var tabbers = document.querySelectorAll('.' + options.classNav); + // loop through every instance of hashTabber (nav) + for (a = 0; a < tabbers.length; a += 1) { + // get current tabber id and default tab + tabberId = tabbers[a].getAttribute(options.dataId); + tabberDefault = '0'; + tabName = ''; + // check if -default html data is set + if (tabbers[a].getAttribute(options.dataDefault)) { + tabberDefault = tabbers[a].getAttribute(options.dataDefault); + } + // loop through every nav element of current tabber + navList = tabbers[a].querySelectorAll('.' + options.classNav + '>li'); + for (b = 0; b < navList.length; b += 1) { + // set current item name to loop index + // or custom -pair name if given + tabName = String(b); + if (navList[b].getAttribute(options.dataPair)) { + tabName = navList[b].getAttribute(options.dataPair); + } + // loop through all child nodes of li + // check for the first a node and add #link to it + navLiChildren = navList[b].childNodes; + for (c = 0; c < navLiChildren.length; c += 1) { + if (navLiChildren[c].nodeName === 'A') { + navLiChildren[c].setAttribute('href', '#' + tabberId + '=' + tabName); + } + } + // set default to active + if (tabName === tabberDefault) { + addClass(navList[b], options.classActive); + } + } + // find corresponding data element and lopp through its children + dataList = document.querySelectorAll('.' + options.classData + '[' + options.dataId + '="' + tabberId + '"]' + '>li'); + for (d = 0; d < dataList.length; d += 1) { + // set current item name to loop index + // or custom -pair name if given + tabName = String(d); + if (dataList[d].getAttribute(options.dataPair)) { + tabName = dataList[d].getAttribute(options.dataPair); + } + // set default to active + if (tabName === tabberDefault) { + addClass(dataList[d], options.classActive); + } + } + } + return true; + }, + tabSwiper: function (options, hashArray) { + var a, b, c; + var parameter; + var value; + var tabName; + var tabberNavList; + var tabberDataList; + // loop through all hash parameters (every second item) + for (a = 0; a < hashArray.length; a += 2) { + // set the parameter and value + parameter = hashArray[a]; + value = hashArray[a + 1]; + tabName = ''; + // check if hashlink exists in nav element + if (document.querySelectorAll('.' + options.classNav + ' a[href="#' + parameter + '=' + value + '"]').length > 0) { + // get the current tabber nav and data lists + tabberNavList = document.querySelectorAll('.' + options.classNav + '[' + options.dataId + '="' + parameter + '"]' + '>li'); + tabberDataList = document.querySelectorAll('.' + options.classData + '[' + options.dataId + '="' + parameter + '"]' + '>li'); + // clear active class of all nav elements and give it to the target one + for (b = 0; b < tabberNavList.length; b += 1) { + // set current item name to loop index + // or custom -pair name if given + tabName = String(b); + if (tabberNavList[b].getAttribute(options.dataPair)) { + tabName = tabberNavList[b].getAttribute(options.dataPair); + } + // change classes + if (tabName === value) { + addClass(tabberNavList[b], options.classActive); + } else { + removeClass(tabberNavList[b], options.classActive); + } + } + // clear active class of all data elements and give it to the target one + for (c = 0; c < tabberDataList.length; c += 1) { + // set current item name to loop index + // or custom -pair name if given + tabName = String(c); + if (tabberDataList[c].getAttribute(options.dataPair)) { + tabName = tabberDataList[c].getAttribute(options.dataPair); + } + // change classes + if (tabName === value) { + addClass(tabberDataList[c], options.classActive); + } else { + removeClass(tabberDataList[c], options.classActive); + } + } + } + } + return true; + } + }; + this.run = function () { + var that = this; + // create ids for every link element in hashTabber navigation + that.helpers.idsGiver(that.options); + // run for the first time on page load + that.helpers.tabSwiper(that.options, that.helpers.hashProber()); + // add listener to hash change + window.onhashchange = function () { + that.helpers.tabSwiper(that.options, that.helpers.hashProber()); + }; + return true; + }; + return true; +} \ No newline at end of file diff --git a/enqueue-admin/js/ips.js b/enqueue-admin/js/ips.js new file mode 100644 index 0000000..c911578 --- /dev/null +++ b/enqueue-admin/js/ips.js @@ -0,0 +1,102 @@ +(function($) { + "use strict"; + + // Document Ready + $(document).ready( function() { + + // Clear Buttons + $('.image-clear-button').click( function (e) { + $(this).siblings('input[type=text]').val(null); + $(this).siblings('input[type=hidden]').val(null).trigger('change'); + $(this).siblings('.image-preview').remove(); + e.preventDefault(); + }); + + // Clear Buttons + $('.video-clear-button').click( function (e) { + $(this).siblings('input[type=text]').val(null); + e.preventDefault(); + }); + + // Tabs + var tabber = new HashTabber(); + tabber.run(); + + // Color Picker + $('.color-picker').wpColorPicker(); + + // Panels Height + var list_height = 100; + $('#individual-page-settings-wrapper > ul > li[role*=tab]').each(function () { + list_height += $(this).outerHeight(); + }); + + $('#individual-page-settings-wrapper div.ui-tabs-panel').each(function () { + var existing_style = $(this).attr('style'); + var new_style = ( existing_style ) ? (existing_style + ' min-height: ' + list_height + 'px;') : 'min-height: ' + list_height + 'px;'; + $(this).attr('style', new_style); + }); + + // Image Field + call_image_field(); + call_video_field(); + + function call_image_field() { + // Function Upload Media + $('.image-upload-button').click(function (e) { + var el = $(this).parent(); + var button = $(this); + e.preventDefault(); + var uploader = wp.media({ + title : button.data('upload-title'), + button : { + text : button.data('upload-button') + }, + multiple : false + }) + .on('select', function () { + var selection = uploader.state().get('selection'); + var attachment = selection.first().toJSON(); + $('input[type=text]', el).val(attachment.url); + $('input[type=hidden]', el).val(attachment.id).trigger('change'); + if (!el.hasClass('upload_file')) { + if ($('img', el).length > 0) { + $('.image-preview', el).attr('src', attachment.url); + } else { + $('').insertBefore($(':last-child', el)); + $('.image-clear-button', el).attr('style', 'display:inline-block'); + } + } + }) + .open(); + }); + } + + function call_video_field() { + // Function Upload Media + $('.video-upload-button').click(function (e) { + var el = $(this).parent(); + var button = $(this); + e.preventDefault(); + var uploader = wp.media({ + title : button.data('upload-title'), + button : { + text : button.data('upload-button') + }, + multiple : false + }) + .on('select', function () { + var selection = uploader.state().get('selection'); + var attachment = selection.first().toJSON(); + $('input[type=text]', el).val(attachment.url); + if (!el.hasClass('upload_file')) { + $('.video-clear-button', el).attr('style', 'display:inline-block'); + } + }) + .open(); + }); + } + + }); + +})(jQuery); diff --git a/enqueue-admin/js/live-customizer.js b/enqueue-admin/js/live-customizer.js new file mode 100644 index 0000000..03d5c6b --- /dev/null +++ b/enqueue-admin/js/live-customizer.js @@ -0,0 +1,339 @@ +(function($) { + "use strict"; + + function hextorgb(hex, opacity) { + + hex = hex.trim(); + + if( hex === 'transparent' ){ + return 'transparent'; + } else if( hex.substr(0, 4) === 'rgb(' ){ + opacity = opacity ? opacity : 1; + hex = hex.substr(5, -1); + return 'rgba( '+ hex +' , '+ opacity +' )'; + } else if( hex.substr(0, 4) === 'rgba' ){ + hex = hex.substr(5, -1); + hex = hex.split(','); + opacity = opacity ? opacity : hex[3]; + return 'rgba( '+ hex[0] +' , '+ hex[1]+' , '+ hex[2] +' , '+ opacity +' )'; + } else { + opacity = opacity ? opacity : 1; + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + result = result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; + + return 'rgba( ' + result.r + ',' + result.g + ',' + result.b + ',' + opacity + ' )'; + } + } + + // Background Color + wp.customize( 'background_color_body', function( value ) { + value.bind( function( newval ) { + $('#site').css('background-color', newval ); + } ); + } ); + + // Navigation Color + wp.customize( 'header_navigation', function( value ) { + value.bind( function( newval ) { + $('#main-nav').css('background-color', newval ); + } ); + } ); + + /** Boxed Color */ + wp.customize( 'background_color_box', function( value ) { + value.bind( function( newval ) { + $('#content').css( 'background', newval ); + } ); + } ); + + // Shading Color + wp.customize( 'header_shading_color', function( value ) { + value.bind( function( newval ) { + $('.header-row').css('background-color', newval ); + } ); + } ); + + // Header Text Color + wp.customize( 'header_text_color', function( value ) { + value.bind( function( newval ) { + $('.header-row, .absolute-header a').css('color', newval ); + $('#secondary-nav .menu > .menu-item > a, #secondary-nav .sub-menu').css({ 'color' : newval, 'border-color': newval } ); + } ); + } ); + + // Navigation Color + wp.customize( 'header_navigation_text', function( value ) { + value.bind( function( newval ) { + if( curly_navigation_text_color( newval ) === false ){ + $('#main-nav .sub-menu').css({ 'color' : '', 'border-color': '' } ); + $('#main-nav .menu > .menu-item > a, #main-nav .menu > .page_item > a, #main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a, #main-nav .menu > .current-menu-item, #main-nav .menu > .current-menu-ancestor, #main-nav .menu > .current_page_parent, #main-nav div.menu > ul > .current_page_item, #main-nav div.menu > ul > .current_page_parent, #main-nav div.menu > ul > .current_page_ancestor, #search-form, #search-form .search-field, #search-form .close-search, #search-form-inline .search-field, #custom-search-form, #search-form .search-field').css('color', '' ); + } else { + $('#main-nav .sub-menu').css({ 'color' : newval, 'border-color': newval } ); + $('#main-nav .menu > .menu-item > a, #main-nav .menu > .page_item > a, #search-form, #search-form .search-field, #search-form .close-search, #search-form-inline .search-field, #custom-search-form, #search-form .search-field').css('color', newval ); + $('#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a, #main-nav .menu > .current-menu-item, #main-nav .menu > .current-menu-ancestor, #main-nav .menu > .current_page_parent, #main-nav div.menu > ul > .current_page_item, #main-nav div.menu > ul > .current_page_parent, #main-nav div.menu > ul > .current_page_ancestor').css( 'color', hextorgb( newval, 0.75) ); + } + } ); + } ); + + // Footer Backgrund Color + wp.customize( 'footer_color_bg', function( value ) { + value.bind( function( newval ) { + $('#footer').css('background-color', newval ); + } ); + } ); + + // Footer Text Color + wp.customize( 'footer_color_text', function( value ) { + value.bind( function( newval ) { + $('#footer').css('color', newval ); + $('#footer abbr').css( 'border-bottom-color', hextorgb( newval, 0.65 ) ); + } ); + } ); + + // Footer Link Color + wp.customize( 'footer_color_links', function( value ) { + value.bind( function( newval ) { + $('#footer a, #footer abbr[title]').css('color', newval ); + $('#footer abbr[title]').css('border-bottom-color', newval ); + } ); + } ); + + // Footer Titles Color + wp.customize( 'footer_color_titles', function( value ) { + value.bind( function( newval ) { + $('#footer .widget-title').css('color', newval ); + $('#main-footer + #absolute-footer .widget').css( 'border-top-color', hextorgb( newval, 0.1 ) ); + } ); + } ); + + // H1 Color + wp.customize( 'color_h1', function( value ) { + value.bind( function( newval ) { + $('h1, h1 small').css('color', newval ); + } ); + } ); + + // H2 Color + wp.customize( 'color_h2', function( value ) { + value.bind( function( newval ) { + $('h2, h2 small').css('color', newval ); + } ); + } ); + + // H3 Color + wp.customize( 'color_h3', function( value ) { + value.bind( function( newval ) { + $('h3, h3 small').css('color', newval ); + } ); + } ); + + // H4 Color + wp.customize( 'color_h4', function( value ) { + value.bind( function( newval ) { + $('h4, h4 small').css('color', newval ); + } ); + } ); + + // H5 Color + wp.customize( 'color_h5', function( value ) { + value.bind( function( newval ) { + $('h5, h5 small').css('color', newval ); + } ); + } ); + + // H6 Color + wp.customize( 'color_h6', function( value ) { + value.bind( function( newval ) { + $('h6, h6 small').css('color', newval ); + } ); + } ); + + + // Link Color + wp.customize( 'link_color', function( value ) { + value.bind( function( newval ) { + if( curly_navigation_text_color( wp.customize.instance('header_navigation_text').get() ) === true ){ + $('#content a:not(.btn-primary), blockquote p, .pullquote, .btn.btn-link, .btn.btn-default, .panel-default > .panel-heading .accordion-toggle.collapsed, #footer a:hover, #footer .widget-title, .owl-theme .owl-controls .owl-nav [class*=owl-], #search-form .close-search, .sidebar-widget h5, .room.dark h4').css('color', newval ); + $('.embed-responsive').css('border-color', newval ); + $('.fa-boxed:not(.fa-facebook, .fa-twitter, .fa-rss, .fa-pinterest)').css( 'background-color', newval ); + $('.btn.btn-default').css( 'border-color', hextorgb( newval, 0.5 ) ); + $('.btn.btn-default:hover, .services-carousel .item:hover .item-content, .pricing-table .content-column').css( 'background-color', hextorgb( newval, 0.1 ) ); + } else { + $('#main-nav li:not(.current-menu-item) a, #content a:not(.btn-primary), blockquote p, .pullquote, .btn.btn-link, .btn.btn-default, .panel-default > .panel-heading .accordion-toggle.collapsed, #footer a:hover, #footer .widget-title, .owl-theme .owl-controls .owl-nav [class*=owl-], #search-form .close-search, .sidebar-widget h5, #custom-search-form, .room.dark h4').css('color', newval ); + $('.embed-responsive').css('border-color', newval ); + $('.fa-boxed:not(.fa-facebook, .fa-twitter, .fa-rss, .fa-pinterest)').css( 'background-color', newval ); + $('#main-nav .menu > .menu-item:not(.current-menu-item):hover > a, .btn.btn-default').css( 'border-color', hextorgb( newval, 0.5 ) ); + $('.btn.btn-default:hover, .services-carousel .item:hover .item-content, .pricing-table .content-column').css( 'background-color', hextorgb( newval, 0.1 ) ); + } + } ); + } ); + + // Text Color + wp.customize( 'text_color', function( value ) { + value.bind( function( newval ) { + $('html, body, a:hover, h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .btn.btn-link:hover, #site, #main-nav, #map-description .col-lg-4 > div, .panel-default > .panel-heading .accordion-toggle.collapsed:hover, #goog-wm-qt, #main-nav .sub-menu .menu-item:hover > a, .form-control, #footer, #footer a').css('color', newval ); + $('.panel.panel-default, #goog-wm-qt, .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, #isotope .item-content, .nav-tabs > li > a, .tab-pane, .nav-tabs, .form-control').css( 'border-color' , hextorgb( newval, 0.25 ) ); + $('.panel-default > .panel-heading .accordion-toggle.collapsed, #main-nav .sub-menu .menu-item:hover > a, #isotope .item:hover .item-content, .nav-tabs > li > a, .nav-tabs > li > a:hover').css( 'background-color' , hextorgb( newval, 0.25 ) ); + $('.pullquote.pull-left').css( 'border-right', '3px solid '+hextorgb( newval, 0.25 ) ); + $('.pullquote.pull-right').css( 'border-left', '3px solid '+hextorgb( newval, 0.25 ) ); + $('#search-form-inline').css( 'border-top', '1px solid '+hextorgb( newval, 0.25 ) ); + $('.comments > ul > li > ul').css( 'border-left', '1px solid '+hextorgb( newval, 0.25 ) ); + $('.comments h6').css( 'border-bottom', '1px solid '+hextorgb( newval, 0.25 ) ); + $('.form-control:focus').css( 'border-color', hextorgb( newval, 0.65 ) ); + $('#main-footer + #absolute-footer .widget').css( 'border-color', hextorgb( newval, 0.1 ) ); + $('#secondary-nav .sub-menu').css( 'background-color', hextorgb( newval, 0.1 ) ); + } ); + } ); + + // Primary Color + wp.customize( 'primary_color', function( value ) { + value.bind( function( newval ) { + $('#main-nav .menu > .current-menu-item > a, .btn.btn-link:hover::before').css('color', newval ).css('border-top-color', newval ); + $('#main-nav .sub-menu, .btn.btn-primary:hover').css('color', newval ).css('border-color', newval ); + $('h5:not(.widget-title)').css('color', newval ); + $('blockquote').css('color', newval ); + $('.list-bullet li::before, .list-square li::before, .list-center li::before, .list-center li::after').css('color', newval ); + $('.list-pointer li::before').css('border-color', 'transparent transparent transparent' + newval ); + $('.btn.btn-primary, #commentform input[type="submit"]').css('background-color', newval ).css('border-color', newval ); + $('.btn.btn-link::before').css('color', newval ); + $('.panel-default > .panel-heading .accordion-toggle').css('color', newval ); + $('.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus').css('color', newval ); + $('.owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span').css('color', newval ); + $('.owl-theme .owl-controls .owl-nav .owl-next:after, .owl-theme .owl-controls .owl-nav .owl-prev:before').css('color', newval ); + $('.form-group[data-required]::before, div[data-required]::before').css('color', newval ); + $('#goog-wm-sb').css('background', newval ).css('border-color', newval ); + $('.entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small').css('color', newval ); + $('.meta .fa').css('color', newval ); + $('.entry-meta, .entry-meta a, .entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small').css('color', newval ); + $('.comments .comment-author h6').css('border-bottom-color', newval ); + $('#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .sub-menu, h5:not(.widget-title), blockquote, .list-bullet li::before, .list-square li::before, .list-center li::before, .list-center li::after, .btn.btn-link::before, .panel-default > .panel-heading .accordion-toggle, .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, .owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span, .owl-theme .owl-controls .owl-nav .owl-next:after, .owl-theme .owl-controls .owl-nav .owl-prev:before, .form-group[data-required]::before, div[data-required]::before, .entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small, .meta .fa, .list-center li::before, .list-center li::after, hr').css( 'color', newval ); + $('#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .sub-menu').css( 'border-color', newval ); + } ); + } ); + + /** Box Background Color */ + wp.customize( 'background_color_box', function( value ) { + value.bind( function( newval ) { + $('#content').css( 'background-color', newval ); + } ); + } ); + + // Layout Size + wp.customize( 'layout_size', function( value ) { + value.bind( function( newval ) { + $('#site').css( 'max-width', newval ); + } ); + } ); + + + // Footer Columns + wp.customize( 'footer_columns', function( value ) { + value.bind( function( newval ) { + + var css = null; + + switch ( newval ) { + case '1' : css = 'col-sm-12 col-md-12'; break; + case '2' : css = 'col-sm-6 col-md-6'; break; + case '3' : css = 'col-sm-4 col-md-4'; break; + case '4' : css = 'col-sm-4 col-md-3'; break; + case '6' : css = 'col-sm-4 col-md-2'; break; + } + $('#main-footer > aside').each(function () { + $(this) + .removeClass('col-sm-2 col-sm-3 col-sm-4 col-sm-6 col-sm-12 col-md-2 col-md-3 col-md-4 col-md-6 col-md-12 col-lg-2 col-lg-3 col-lg-4 col-lg-6 col-lg-12') + .addClass(css); + }); + } ); + } ); + + // Copyright + wp.customize( 'footer_copyright', function( value ) { + value.bind( function( newval ) { + if ( newval === 0 ) { + $('#absolute-footer').hide(); + } else { + $('#absolute-footer').show(); + $('.widget > p', '#absolute-footer').html( newval ); + } + } ); + } ); + + // Header Color + wp.customize( 'header_bg_color', function( value ) { + value.bind( function( newval ) { + $('#header').css( 'background-color', newval ); + } ); + } ); + + /** Menu Height */ + wp.customize( 'header_height', function( value ) { + value.bind( function( newval ) { + $('#main-nav ul.menu > .menu-item > a, #main-nav div.menu > ul > .page_item > a, #logo') + .css({ 'height': newval + 'px', 'line-height': newval + 'px' }); + $('#main-nav ul.menu > .current-menu-item > a, #main-nav ul.menu > .current-menu-ancestor > a, #main-nav ul.menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a') + .css({ 'height': newval + 'px', 'line-height': newval - 6 + 'px' }); + $('.sticky-wrapper #main-nav.stuck ul.menu > .menu-item > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .page_item > a, .stuck #logo') + .css({ 'height': Math.floor( newval / 1.333333333 ) + 'px', 'line-height': Math.floor( newval / 1.333333333 ) + 'px' }); + $('.sticky-wrapper #main-nav.stuck ul.menu > .current-menu-item > a, .sticky-wrapper #main-nav.stuck ul.menu > .current-menu-ancestor > a, .sticky-wrapper #main-nav.stuck ul.menu > .current_page_parent > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_item > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_parent > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_ancestor > a') + .css({ 'height': Math.floor( newval / 1.333333333 ) + 'px', 'line-height': Math.floor( newval / 1.333333333 ) - 6 + 'px' }); + $('#search-form .search-field').css( 'height', newval + 'px' ); + $('#search-form .close-search').css( 'line-height', newval + 'px' ); + $('.sticky-wrapper #main-nav.stuck #search-form .search-field').css( 'height', Math.floor( newval / 1.333333333 ) + 'px' ); + $('.stuck #search-form .close-search').css( 'line-height', Math.floor( newval / 1.333333333 ) + 'px' ); + $('.sticky-wrapper').css( 'min-height', newval + 'px' ); + } ); + } ); + + /** Menu Search */ + wp.customize( 'search_menu', function( value ) { + value.bind( function( newval ) { + if( newval === true ) { + $('.search-button').show(); + } else{ + $('.search-button').hide(); + } + } ); + } ); + + /** Header Align */ + wp.customize( 'header_alignment', function( value ) { + value.bind( function( newval ) { + switch ( newval ) { + case 'right' : + $('#main-nav ul.menu, #main-nav div.menu > ul').css( 'float', 'right' ); + break; + case 'left' : + $('#main-nav ul.menu, #main-nav div.menu > ul').css({ 'float' : 'left', 'margin-left' : '2.8rem' }); + break; + } + } ); + } ); + + /** Layout Size */ + wp.customize( 'layout_size', function( value ) { + value.bind( function( newval ) { + if( newval === '100%' ){ + $('#site, .sticky-wrapper #main-nav.stuck').css( 'max-width', newval ); + $('#content').css( 'background', 'transparent' ); + } else { + $('#site, .sticky-wrapper #main-nav.stuck').css( 'max-width', newval ); + $('#content').css( 'background', wp.customize.instance('background_color_box').get() ); + } + } ); + } ); + + /** Function Box Color */ + function curly_navigation_text_color( check ){ + if( check === null || check === '' || check === 'transparent' || check === 'none' || ! check ){ + return false; + } else { + return true; + } + } + +})(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/min/alpha-color-picker-min.js b/enqueue-admin/js/min/alpha-color-picker-min.js new file mode 100644 index 0000000..c553ff4 --- /dev/null +++ b/enqueue-admin/js/min/alpha-color-picker-min.js @@ -0,0 +1 @@ +function acp_get_alpha_value_from_color(a){var o;return a=a.replace(/ /g,""),a.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)?(o=100*parseFloat(a.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]).toFixed(2),o=parseInt(o)):o=100,o}function acp_update_alpha_value_on_color_control(a,o,l,e){var r,t,i;r=o.data("a8cIris"),t=o.data("wpWpColorPicker"),r._color._alpha=a,i=r._color.toString(),o.val(i),t.toggler.css({"background-color":i}),e&&acp_update_alpha_value_on_alpha_slider(a,l),o.wpColorPicker("color",i)}function acp_update_alpha_value_on_alpha_slider(a,o){o.slider("value",a),o.find(".ui-slider-handle").text(a.toString())}Color.prototype.toString=function(a){if("no-alpha"==a)return this.toCSS("rgba","1").replace(/\s+/g,"");if(1>this._alpha)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var o=parseInt(this._color,10).toString(16);if(this.error)return"";if(o.length<6)for(var l=6-o.length-1;l>=0;l--)o="0"+o;return"#"+o},jQuery(document).ready(function($){$(".alpha-color-control").each(function(){var a,o,l,e,r,t,i,c,n,p,_;a=$(this),o=a.val().replace(/\s+/g,""),l=a.attr("data-palette"),e=a.attr("data-show-opacity"),r=a.attr("data-default-color"),t=l.indexOf("|")!==-1?l.split("|"):"false"!=l,i={change:function(o,l){var e,t,i,p;e=a.attr("data-customize-setting-link"),t=a.wpColorPicker("color"),r==t&&(i=acp_get_alpha_value_from_color(t),n.find(".ui-slider-handle").text(i)),wp.customize(e,function(a){a.set(t)}),p=c.find(".transparency"),p.css("background-color",l.color.toString("no-alpha"))},palettes:t},a.wpColorPicker(i),c=a.parents(".wp-picker-container:first"),$('
').appendTo(c.find(".wp-picker-holder")),n=c.find(".alpha-slider"),p=acp_get_alpha_value_from_color(o),_={create:function(a,l){var e=$(this).slider("value");$(this).find(".ui-slider-handle").text(e),$(this).siblings(".transparency ").css("background-color",o)},value:p,range:"max",step:1,min:0,max:100,animate:300},n.slider(_),"true"==e&&n.find(".ui-slider-handle").addClass("show-opacity"),c.find(".min-click-zone").on("click",function(){acp_update_alpha_value_on_color_control(0,a,n,!0)}),c.find(".max-click-zone").on("click",function(){acp_update_alpha_value_on_color_control(100,a,n,!0)}),c.find(".iris-palette").on("click",function(){var o,l;o=$(this).css("background-color"),l=acp_get_alpha_value_from_color(o),acp_update_alpha_value_on_alpha_slider(l,n),100!=l&&(o=o.replace(/[^,]+(?=\))/,(l/100).toFixed(2))),a.wpColorPicker("color",o)}),c.find(".button.wp-picker-clear").on("click",function(){var o=a.attr("data-customize-setting-link");a.wpColorPicker("color","#ffffff"),wp.customize(o,function(a){a.set("")}),acp_update_alpha_value_on_alpha_slider(100,n)}),c.find(".button.wp-picker-default").on("click",function(){var a=acp_get_alpha_value_from_color(r);acp_update_alpha_value_on_alpha_slider(a,n)}),a.on("input",function(){var a=$(this).val(),o=acp_get_alpha_value_from_color(a);acp_update_alpha_value_on_alpha_slider(o,n)}),n.slider().on("slide",function(o,l){var e=parseFloat(l.value)/100;acp_update_alpha_value_on_color_control(e,a,n,!1),$(this).find(".ui-slider-handle").text(l.value)})})}); \ No newline at end of file diff --git a/enqueue-admin/js/min/customizer-min.js b/enqueue-admin/js/min/customizer-min.js new file mode 100644 index 0000000..c7f842f --- /dev/null +++ b/enqueue-admin/js/min/customizer-min.js @@ -0,0 +1 @@ +!function($){"use strict";wp.customize("custom_js_check",function(o){o.bind(function(){$("#customize-control-custom_js").toggle()})}),wp.customize("footer_style",function(o){o.bind(function(o){"2"===o?(wp.customize.control("footer_bg").activate(),wp.customize.control("footer_bg_repeat").activate(),wp.customize.control("footer_bg_position").activate()):(wp.customize.control("footer_bg").deactivate(),wp.customize.control("footer_bg_repeat").deactivate(),wp.customize.control("footer_bg_position").deactivate())})}),$(function(){$("option[value^=rev_]","#customize-control-header_slider").first().before(""),$("option[value^=layer_]","#customize-control-header_slider").first().before("")})}(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/min/ips-min.js b/enqueue-admin/js/min/ips-min.js new file mode 100644 index 0000000..3794bd1 --- /dev/null +++ b/enqueue-admin/js/min/ips-min.js @@ -0,0 +1 @@ +!function($){"use strict";$(document).ready(function(){function t(){$(".image-upload-button").click(function(t){var e=$(this).parent(),i=$(this);t.preventDefault();var a=wp.media({title:i.data("upload-title"),button:{text:i.data("upload-button")},multiple:!1}).on("select",function(){var t=a.state().get("selection"),i=t.first().toJSON();$("input[type=text]",e).val(i.url),$("input[type=hidden]",e).val(i.id).trigger("change"),e.hasClass("upload_file")||($("img",e).length>0?$(".image-preview",e).attr("src",i.url):($('').insertBefore($(":last-child",e)),$(".image-clear-button",e).attr("style","display:inline-block")))}).open()})}function e(){$(".video-upload-button").click(function(t){var e=$(this).parent(),i=$(this);t.preventDefault();var a=wp.media({title:i.data("upload-title"),button:{text:i.data("upload-button")},multiple:!1}).on("select",function(){var t=a.state().get("selection"),i=t.first().toJSON();$("input[type=text]",e).val(i.url),e.hasClass("upload_file")||$(".video-clear-button",e).attr("style","display:inline-block")}).open()})}$(".image-clear-button").click(function(t){$(this).siblings("input[type=text]").val(null),$(this).siblings("input[type=hidden]").val(null).trigger("change"),$(this).siblings(".image-preview").remove(),t.preventDefault()}),$(".video-clear-button").click(function(t){$(this).siblings("input[type=text]").val(null),t.preventDefault()});var i=new HashTabber;i.run(),$(".color-picker").wpColorPicker();var a=100;$("#individual-page-settings-wrapper > ul > li[role*=tab]").each(function(){a+=$(this).outerHeight()}),$("#individual-page-settings-wrapper div.ui-tabs-panel").each(function(){var t=$(this).attr("style"),e=t?t+" min-height: "+a+"px;":"min-height: "+a+"px;";$(this).attr("style",e)}),t(),e()})}(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/min/live-customizer-min.js b/enqueue-admin/js/min/live-customizer-min.js new file mode 100644 index 0000000..da497fa --- /dev/null +++ b/enqueue-admin/js/min/live-customizer-min.js @@ -0,0 +1 @@ +!function($){"use strict";function e(e,o){if(e=e.trim(),"transparent"===e)return"transparent";if("rgb("===e.substr(0,4))return o=o?o:1,e=e.substr(5,-1),"rgba( "+e+" , "+o+" )";if("rgba"===e.substr(0,4))return e=e.substr(5,-1),e=e.split(","),o=o?o:e[3],"rgba( "+e[0]+" , "+e[1]+" , "+e[2]+" , "+o+" )";o=o?o:1;var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n=n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null,"rgba( "+n.r+","+n.g+","+n.b+","+o+" )"}function o(e){return null!==e&&""!==e&&"transparent"!==e&&"none"!==e&&e?!0:!1}wp.customize("background_color_body",function(e){e.bind(function(e){$("#site").css("background-color",e)})}),wp.customize("header_navigation",function(e){e.bind(function(e){$("#main-nav").css("background-color",e)})}),wp.customize("background_color_box",function(e){e.bind(function(e){$("#content").css("background",e)})}),wp.customize("header_shading_color",function(e){e.bind(function(e){$(".header-row").css("background-color",e)})}),wp.customize("header_text_color",function(e){e.bind(function(e){$(".header-row, .absolute-header a").css("color",e),$("#secondary-nav .menu > .menu-item > a, #secondary-nav .sub-menu").css({color:e,"border-color":e})})}),wp.customize("header_navigation_text",function(n){n.bind(function(n){o(n)===!1?($("#main-nav .sub-menu").css({color:"","border-color":""}),$("#main-nav .menu > .menu-item > a, #main-nav .menu > .page_item > a, #main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a, #main-nav .menu > .current-menu-item, #main-nav .menu > .current-menu-ancestor, #main-nav .menu > .current_page_parent, #main-nav div.menu > ul > .current_page_item, #main-nav div.menu > ul > .current_page_parent, #main-nav div.menu > ul > .current_page_ancestor, #search-form, #search-form .search-field, #search-form .close-search, #search-form-inline .search-field, #custom-search-form, #search-form .search-field").css("color","")):($("#main-nav .sub-menu").css({color:n,"border-color":n}),$("#main-nav .menu > .menu-item > a, #main-nav .menu > .page_item > a, #search-form, #search-form .search-field, #search-form .close-search, #search-form-inline .search-field, #custom-search-form, #search-form .search-field").css("color",n),$("#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a, #main-nav .menu > .current-menu-item, #main-nav .menu > .current-menu-ancestor, #main-nav .menu > .current_page_parent, #main-nav div.menu > ul > .current_page_item, #main-nav div.menu > ul > .current_page_parent, #main-nav div.menu > ul > .current_page_ancestor").css("color",e(n,.75)))})}),wp.customize("footer_color_bg",function(e){e.bind(function(e){$("#footer").css("background-color",e)})}),wp.customize("footer_color_text",function(o){o.bind(function(o){$("#footer").css("color",o),$("#footer abbr").css("border-bottom-color",e(o,.65))})}),wp.customize("footer_color_links",function(e){e.bind(function(e){$("#footer a, #footer abbr[title]").css("color",e),$("#footer abbr[title]").css("border-bottom-color",e)})}),wp.customize("footer_color_titles",function(o){o.bind(function(o){$("#footer .widget-title").css("color",o),$("#main-footer + #absolute-footer .widget").css("border-top-color",e(o,.1))})}),wp.customize("color_h1",function(e){e.bind(function(e){$("h1, h1 small").css("color",e)})}),wp.customize("color_h2",function(e){e.bind(function(e){$("h2, h2 small").css("color",e)})}),wp.customize("color_h3",function(e){e.bind(function(e){$("h3, h3 small").css("color",e)})}),wp.customize("color_h4",function(e){e.bind(function(e){$("h4, h4 small").css("color",e)})}),wp.customize("color_h5",function(e){e.bind(function(e){$("h5, h5 small").css("color",e)})}),wp.customize("color_h6",function(e){e.bind(function(e){$("h6, h6 small").css("color",e)})}),wp.customize("link_color",function(n){n.bind(function(n){o(wp.customize.instance("header_navigation_text").get())===!0?($("#content a:not(.btn-primary), blockquote p, .pullquote, .btn.btn-link, .btn.btn-default, .panel-default > .panel-heading .accordion-toggle.collapsed, #footer a:hover, #footer .widget-title, .owl-theme .owl-controls .owl-nav [class*=owl-], #search-form .close-search, .sidebar-widget h5, .room.dark h4").css("color",n),$(".embed-responsive").css("border-color",n),$(".fa-boxed:not(.fa-facebook, .fa-twitter, .fa-rss, .fa-pinterest)").css("background-color",n),$(".btn.btn-default").css("border-color",e(n,.5)),$(".btn.btn-default:hover, .services-carousel .item:hover .item-content, .pricing-table .content-column").css("background-color",e(n,.1))):($("#main-nav li:not(.current-menu-item) a, #content a:not(.btn-primary), blockquote p, .pullquote, .btn.btn-link, .btn.btn-default, .panel-default > .panel-heading .accordion-toggle.collapsed, #footer a:hover, #footer .widget-title, .owl-theme .owl-controls .owl-nav [class*=owl-], #search-form .close-search, .sidebar-widget h5, #custom-search-form, .room.dark h4").css("color",n),$(".embed-responsive").css("border-color",n),$(".fa-boxed:not(.fa-facebook, .fa-twitter, .fa-rss, .fa-pinterest)").css("background-color",n),$("#main-nav .menu > .menu-item:not(.current-menu-item):hover > a, .btn.btn-default").css("border-color",e(n,.5)),$(".btn.btn-default:hover, .services-carousel .item:hover .item-content, .pricing-table .content-column").css("background-color",e(n,.1)))})}),wp.customize("text_color",function(o){o.bind(function(o){$("html, body, a:hover, h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .btn.btn-link:hover, #site, #main-nav, #map-description .col-lg-4 > div, .panel-default > .panel-heading .accordion-toggle.collapsed:hover, #goog-wm-qt, #main-nav .sub-menu .menu-item:hover > a, .form-control, #footer, #footer a").css("color",o),$(".panel.panel-default, #goog-wm-qt, .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, #isotope .item-content, .nav-tabs > li > a, .tab-pane, .nav-tabs, .form-control").css("border-color",e(o,.25)),$(".panel-default > .panel-heading .accordion-toggle.collapsed, #main-nav .sub-menu .menu-item:hover > a, #isotope .item:hover .item-content, .nav-tabs > li > a, .nav-tabs > li > a:hover").css("background-color",e(o,.25)),$(".pullquote.pull-left").css("border-right","3px solid "+e(o,.25)),$(".pullquote.pull-right").css("border-left","3px solid "+e(o,.25)),$("#search-form-inline").css("border-top","1px solid "+e(o,.25)),$(".comments > ul > li > ul").css("border-left","1px solid "+e(o,.25)),$(".comments h6").css("border-bottom","1px solid "+e(o,.25)),$(".form-control:focus").css("border-color",e(o,.65)),$("#main-footer + #absolute-footer .widget").css("border-color",e(o,.1)),$("#secondary-nav .sub-menu").css("background-color",e(o,.1))})}),wp.customize("primary_color",function(e){e.bind(function(e){$("#main-nav .menu > .current-menu-item > a, .btn.btn-link:hover::before").css("color",e).css("border-top-color",e),$("#main-nav .sub-menu, .btn.btn-primary:hover").css("color",e).css("border-color",e),$("h5:not(.widget-title)").css("color",e),$("blockquote").css("color",e),$(".list-bullet li::before, .list-square li::before, .list-center li::before, .list-center li::after").css("color",e),$(".list-pointer li::before").css("border-color","transparent transparent transparent"+e),$('.btn.btn-primary, #commentform input[type="submit"]').css("background-color",e).css("border-color",e),$(".btn.btn-link::before").css("color",e),$(".panel-default > .panel-heading .accordion-toggle").css("color",e),$(".nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus").css("color",e),$(".owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span").css("color",e),$(".owl-theme .owl-controls .owl-nav .owl-next:after, .owl-theme .owl-controls .owl-nav .owl-prev:before").css("color",e),$(".form-group[data-required]::before, div[data-required]::before").css("color",e),$("#goog-wm-sb").css("background",e).css("border-color",e),$(".entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small").css("color",e),$(".meta .fa").css("color",e),$(".entry-meta, .entry-meta a, .entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small").css("color",e),$(".comments .comment-author h6").css("border-bottom-color",e),$("#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .sub-menu, h5:not(.widget-title), blockquote, .list-bullet li::before, .list-square li::before, .list-center li::before, .list-center li::after, .btn.btn-link::before, .panel-default > .panel-heading .accordion-toggle, .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, .owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span, .owl-theme .owl-controls .owl-nav .owl-next:after, .owl-theme .owl-controls .owl-nav .owl-prev:before, .form-group[data-required]::before, div[data-required]::before, .entry h1 > small, .entry h2 > small, .entry h3 > small, .entry.quote blockquote > small, .meta .fa, .list-center li::before, .list-center li::after, hr").css("color",e),$("#main-nav .menu > .current-menu-item > a, #main-nav .menu > .current-menu-ancestor > a, #main-nav .sub-menu").css("border-color",e)})}),wp.customize("background_color_box",function(e){e.bind(function(e){$("#content").css("background-color",e)})}),wp.customize("layout_size",function(e){e.bind(function(e){$("#site").css("max-width",e)})}),wp.customize("footer_columns",function(e){e.bind(function(e){var o=null;switch(e){case"1":o="col-sm-12 col-md-12";break;case"2":o="col-sm-6 col-md-6";break;case"3":o="col-sm-4 col-md-4";break;case"4":o="col-sm-4 col-md-3";break;case"6":o="col-sm-4 col-md-2"}$("#main-footer > aside").each(function(){$(this).removeClass("col-sm-2 col-sm-3 col-sm-4 col-sm-6 col-sm-12 col-md-2 col-md-3 col-md-4 col-md-6 col-md-12 col-lg-2 col-lg-3 col-lg-4 col-lg-6 col-lg-12").addClass(o)})})}),wp.customize("footer_copyright",function(e){e.bind(function(e){0===e?$("#absolute-footer").hide():($("#absolute-footer").show(),$(".widget > p","#absolute-footer").html(e))})}),wp.customize("header_bg_color",function(e){e.bind(function(e){$("#header").css("background-color",e)})}),wp.customize("header_height",function(e){e.bind(function(e){$("#main-nav ul.menu > .menu-item > a, #main-nav div.menu > ul > .page_item > a, #logo").css({height:e+"px","line-height":e+"px"}),$("#main-nav ul.menu > .current-menu-item > a, #main-nav ul.menu > .current-menu-ancestor > a, #main-nav ul.menu > .current_page_parent > a, #main-nav div.menu > ul > .current_page_item > a, #main-nav div.menu > ul > .current_page_parent > a, #main-nav div.menu > ul > .current_page_ancestor > a").css({height:e+"px","line-height":e-6+"px"}),$(".sticky-wrapper #main-nav.stuck ul.menu > .menu-item > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .page_item > a, .stuck #logo").css({height:Math.floor(e/1.333333333)+"px","line-height":Math.floor(e/1.333333333)+"px"}),$(".sticky-wrapper #main-nav.stuck ul.menu > .current-menu-item > a, .sticky-wrapper #main-nav.stuck ul.menu > .current-menu-ancestor > a, .sticky-wrapper #main-nav.stuck ul.menu > .current_page_parent > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_item > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_parent > a, .sticky-wrapper #main-nav.stuck div.menu > ul > .current_page_ancestor > a").css({height:Math.floor(e/1.333333333)+"px","line-height":Math.floor(e/1.333333333)-6+"px"}),$("#search-form .search-field").css("height",e+"px"),$("#search-form .close-search").css("line-height",e+"px"),$(".sticky-wrapper #main-nav.stuck #search-form .search-field").css("height",Math.floor(e/1.333333333)+"px"),$(".stuck #search-form .close-search").css("line-height",Math.floor(e/1.333333333)+"px"),$(".sticky-wrapper").css("min-height",e+"px")})}),wp.customize("search_menu",function(e){e.bind(function(e){e===!0?$(".search-button").show():$(".search-button").hide()})}),wp.customize("header_alignment",function(e){e.bind(function(e){switch(e){case"right":$("#main-nav ul.menu, #main-nav div.menu > ul").css("float","right");break;case"left":$("#main-nav ul.menu, #main-nav div.menu > ul").css({"float":"left","margin-left":"2.8rem"})}})}),wp.customize("layout_size",function(e){e.bind(function(e){"100%"===e?($("#site, .sticky-wrapper #main-nav.stuck").css("max-width",e),$("#content").css("background","transparent")):($("#site, .sticky-wrapper #main-nav.stuck").css("max-width",e),$("#content").css("background",wp.customize.instance("background_color_box").get()))})})}(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/min/wp-color-picker-alpha-min.js b/enqueue-admin/js/min/wp-color-picker-alpha-min.js new file mode 100644 index 0000000..8209807 --- /dev/null +++ b/enqueue-admin/js/min/wp-color-picker-alpha-min.js @@ -0,0 +1 @@ +!function($){var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",o='
',r='
',e='',i=void 0!==wpColorPickerL10n.current;if(i)var a='';else var a='',n="",l='';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)},$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{_create:function(){if($.support.iris){var s=this,p=s.element;if($.extend(s.options,p.data()),"hue"===s.options.type)return s._createHueOnly();s.close=$.proxy(s.close,s),s.initialValue=p.val(),p.addClass("wp-color-picker"),i?(p.hide().wrap(r),s.wrap=p.parent(),s.toggler=$(a).insertBefore(p).css({backgroundColor:s.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),s.pickerContainer=$(o).insertAfter(p),s.button=$(e).addClass("hidden")):(p.parent("label").length||(p.wrap(n),s.wrappingLabelText=$(l).insertBefore(p).text(wpColorPickerL10n.defaultLabel)),s.wrappingLabel=p.parent(),s.wrappingLabel.wrap(r),s.wrap=s.wrappingLabel.parent(),s.toggler=$(a).insertBefore(s.wrappingLabel).css({backgroundColor:s.initialValue}),s.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),s.pickerContainer=$(o).insertAfter(s.wrappingLabel),s.button=$(e)),s.options.defaultColor?(s.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||s.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(s.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||s.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?p.wrap('').after(s.button):(s.wrappingLabel.wrap('
  • ' + response_obj[1] + '[dynamic-sidebar id="' + response_obj[0] + '"] ' + js_data[0] + '
  • '); + $('a[data-sidebar-id]').off('click').on('click', remove_sidebar); + $('#add-sidebar-field').val(null); + + $('#messages').append('

    ' + js_data[4] + '

    '); + + } + + setTimeout(function(){ $('#messages > p').fadeOut(); }, 4000); + } + ); + }); + + + function remove_sidebar() { + + var sidebar = $(this); + + if ( confirm( js_data[1] ) == true ) { + + jQuery.post( + ajaxurl, + { + 'action': 'update_sidebars', + 'name' : '', + 'id' : sidebar.data('sidebar-id'), + 'method': 'delete' + }, + function(response){ + + if ( response == 'success' ) { + + if ( sidebar.parents('#sidebar-list').children().length == 1 ) { + $('#sidebar-list').append('
  • ' + js_data[5] + '
  • '); + } + + sidebar.parent().remove(); + + } + } + ); + } + + return false; + + } + +})(jQuery); \ No newline at end of file diff --git a/enqueue-admin/js/wp-color-picker-alpha.js b/enqueue-admin/js/wp-color-picker-alpha.js new file mode 100755 index 0000000..77a5600 --- /dev/null +++ b/enqueue-admin/js/wp-color-picker-alpha.js @@ -0,0 +1,490 @@ +/**! + * wp-color-picker-alpha + * + * Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker + * Only run in input and is defined data alpha in true + * + * Version: 2.1.2 + * https://github.com/kallookoo/wp-color-picker-alpha + * Licensed under the GPLv2 license. + */ +( function( $ ) { + // Variable for some backgrounds ( grid ) + var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==', + // html stuff for wpColorPicker copy of the original color-picker.js + _after = '
    ', + _wrap = '
    ', + _button = '', + // Prevent CSS issues in < WordPress 4.9 + _deprecated = ( wpColorPickerL10n.current !== undefined ); + // Declare some global variables when is deprecated or not + if ( _deprecated ) { + var _before = ''; + } else { + var _before = '', + _wrappingLabel = '', + _wrappingLabelText = ''; + } + /** + * Overwrite Color + * for enable support rbga + */ + Color.fn.toString = function() { + if ( this._alpha < 1 ) + return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' ); + + var hex = parseInt( this._color, 10 ).toString( 16 ); + + if ( this.error ) + return ''; + + if ( hex.length < 6 ) + hex = ( '00000' + hex ).substr( -6 ); + + return '#' + hex; + }; + + /** + * Overwrite wpColorPicker + */ + $.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, { + /** + * @summary Creates the color picker. + * + * Creates the color picker, sets default values, css classes and wraps it all in HTML. + * + * @since 3.5.0 + * + * @access private + * + * @returns {void} + */ + _create: function() { + // Return early if Iris support is missing. + if ( ! $.support.iris ) { + return; + } + + var self = this, + el = self.element; + + // Override default options with options bound to the element. + $.extend( self.options, el.data() ); + + // Create a color picker which only allows adjustments to the hue. + if ( self.options.type === 'hue' ) { + return self._createHueOnly(); + } + + // Bind the close event. + self.close = $.proxy( self.close, self ); + + self.initialValue = el.val(); + + // Add a CSS class to the input field. + el.addClass( 'wp-color-picker' ); + + if ( _deprecated ) { + el.hide().wrap( _wrap ); + self.wrap = el.parent(); + self.toggler = $( _before ) + .insertBefore( el ) + .css( { backgroundColor : self.initialValue } ) + .attr( 'title', wpColorPickerL10n.pick ) + .attr( 'data-current', wpColorPickerL10n.current ); + self.pickerContainer = $( _after ).insertAfter( el ); + self.button = $( _button ).addClass('hidden'); + } else { + /* + * Check if there's already a wrapping label, e.g. in the Customizer. + * If there's no label, add a default one to match the Customizer template. + */ + if ( ! el.parent( 'label' ).length ) { + // Wrap the input field in the default label. + el.wrap( _wrappingLabel ); + // Insert the default label text. + self.wrappingLabelText = $( _wrappingLabelText ) + .insertBefore( el ) + .text( wpColorPickerL10n.defaultLabel ); + } + + /* + * At this point, either it's the standalone version or the Customizer + * one, we have a wrapping label to use as hook in the DOM, let's store it. + */ + self.wrappingLabel = el.parent(); + + // Wrap the label in the main wrapper. + self.wrappingLabel.wrap( _wrap ); + // Store a reference to the main wrapper. + self.wrap = self.wrappingLabel.parent(); + // Set up the toggle button and insert it before the wrapping label. + self.toggler = $( _before ) + .insertBefore( self.wrappingLabel ) + .css( { backgroundColor: self.initialValue } ); + // Set the toggle button span element text. + self.toggler.find( '.wp-color-result-text' ).text( wpColorPickerL10n.pick ); + // Set up the Iris container and insert it after the wrapping label. + self.pickerContainer = $( _after ).insertAfter( self.wrappingLabel ); + // Store a reference to the Clear/Default button. + self.button = $( _button ); + } + + // Set up the Clear/Default button. + if ( self.options.defaultColor ) { + self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString ); + if ( ! _deprecated ) { + self.button.attr( 'aria-label', wpColorPickerL10n.defaultAriaLabel ); + } + } else { + self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear ); + if ( ! _deprecated ) { + self.button.attr( 'aria-label', wpColorPickerL10n.clearAriaLabel ); + } + } + + if ( _deprecated ) { + el.wrap( '' ).after( self.button ); + } else { + // Wrap the wrapping label in its wrapper and append the Clear/Default button. + self.wrappingLabel + .wrap( '