responsive/responsive.scss 0000666 00000003170 15214273034 0012041 0 ustar 00 .ast-responsive-btns { display: inline-block; float: right; line-height: 1; margin-top: 6px; > li { margin-bottom: 0; display: none; &.active { display: inline-block; } } button[type="button"] { padding: 0; cursor: pointer; background: none; border: none; opacity: .75; outline: none; > i { width: 15px; height: 15px; font-size: 15px; } } } .ast-field-settings-modal { .ast-responsive-btns { margin-top: 6px; } } .customize-control-ast-responsive .input-wrapper { overflow: hidden; input { display: none; width: 82%; float: none; &.active { display: block; } } .ast-responsive-select { width: 50px; margin: 0; display: none; padding: .1em; margin-left: 2px; float: none; } .ast-responsive-input.active + .ast-responsive-select { display: block; width: 17%; float: none; } .ast-non-reponsive { &.ast-responsive-input { display: inline-block; &.active { display: inline-block; } } &.ast-responsive-select { display: inline-block; } } } #customize-control-astra-settings-font-size-body.customize-control-ast-responsive .input-wrapper { display: inline-block; .ast-responsive-select { display: none; } .ast-responsive-input { width: 100%; } } .input-wrapper.ast-responsive-wrapper { display: inline-flex; justify-content: space-between; margin-right: 0; align-items: flex-start; flex: 0 1; width: 100%; } responsive/index.php 0000666 00000000157 15214273034 0010571 0 ustar 00 json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $val = maybe_unserialize( $this->value() ); if ( ! is_array( $val ) || is_numeric( $val ) ) { $val = array( 'desktop' => $val, 'tablet' => '', 'mobile' => '', 'desktop-unit' => '', 'tablet-unit' => '', 'mobile-unit' => '', ); } $this->json['value'] = $val; $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['units'] = $this->units; $this->json['responsive'] = $this->responsive; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> li.' + 'desktop' ).addClass( 'active' ); }, /** * Updates the sorting list */ updateValue: function() { 'use strict'; var control = this, newValue = {}; // Set the spacing container. control.responsiveContainer = control.container.find( '.ast-responsive-wrapper' ).first(); control.responsiveContainer.find( 'input.ast-responsive-input' ).each( function() { var responsive_input = jQuery( this ), item = responsive_input.data( 'id' ), item_value = responsive_input.val(); newValue[item] = item_value; }); control.responsiveContainer.find( 'select.ast-responsive-select' ).each( function() { var responsive_input = jQuery( this ), item = responsive_input.data( 'id' ), item_value = responsive_input.val(); newValue[item] = item_value; }); control.setting.set( newValue ); }, astResponsiveInit : function() { 'use strict'; this.container.find( '.ast-responsive-btns button' ).on( 'click', function( event ) { var device = jQuery(this).attr('data-device'); if( 'desktop' == device ) { device = 'tablet'; } else if( 'tablet' == device ) { device = 'mobile'; } else { device = 'desktop'; } jQuery( '.wp-full-overlay-footer .devices button[data-device="' + device + '"]' ).trigger( 'click' ); }); }, }); jQuery(' .wp-full-overlay-footer .devices button ').on('click', function() { var device = jQuery(this).attr('data-device'); jQuery( '.customize-control-ast-responsive .input-wrapper input, .customize-control .ast-responsive-btns > li' ).removeClass( 'active' ); jQuery( '.customize-control-ast-responsive .input-wrapper input.' + device + ', .customize-control .ast-responsive-btns > li.' + device ).addClass( 'active' ); }); })(jQuery); responsive-color/responsive-color.js 0000666 00000006254 15214273034 0013740 0 ustar 00 ( function( $ ) { jQuery(window).on("load", function() { jQuery('html').addClass('responsive-background-color-ready'); }); /** * File responsive-color.js * * Handles the responsive color * * @package Astra */ wp.customize.controlConstructor['ast-responsive-color'] = wp.customize.Control.extend({ // When we're finished loading continue processing ready: function() { 'use strict'; var control = this; // Init the control. control.initAstBgControl(); }, initAstBgControl: function() { var control = this, value = control.setting._value, picker = control.container.find( '.ast-responsive-color' ); // Color. picker.wpColorPicker({ change: function(event, ui) { if ( jQuery('html').hasClass('responsive-background-color-ready') ) { var stored = control.setting.get(); var device = jQuery( this ).data( 'id' ); var newValue = { 'desktop' : stored['desktop'], 'tablet' : stored['tablet'], 'mobile' : stored['mobile'], }; if ( 'desktop' === device ) { newValue['desktop'] = ui.color.toString(); } if ( 'tablet' === device ) { newValue['tablet'] = ui.color.toString(); } if ( 'mobile' === device ) { newValue['mobile'] = ui.color.toString(); } control.setting.set( newValue ); } }, /** * @param {Event} event - standard jQuery event, produced by "Clear" * button. */ clear: function (event) { var element = jQuery(event.target).closest('.wp-picker-input-wrap').find('.wp-color-picker')[0], device = jQuery( this ).closest('.wp-picker-input-wrap').find('.wp-color-picker').data( 'id' ); var stored = control.setting.get(); var newValue = { 'desktop' : stored['desktop'], 'tablet' : stored['tablet'], 'mobile' : stored['mobile'], }; if ( element ) { if ( 'desktop' === device ) { newValue['desktop'] = ''; } if ( 'tablet' === device ) { newValue['tablet'] = ''; } if ( 'mobile' === device ) { newValue['mobile'] = ''; } control.setting.set( newValue ); } } }); this.container.find( '.ast-responsive-btns button' ).on( 'click', function( event ) { var device = jQuery(this).attr('data-device'); if( 'desktop' == device ) { device = 'tablet'; } else if( 'tablet' == device ) { device = 'mobile'; } else { device = 'desktop'; } jQuery( '.wp-full-overlay-footer .devices button[data-device="' + device + '"]' ).trigger( 'click' ); }); jQuery( '.customize-control-ast-responsive-color .customize-control-content .ast-responsive-color.desktop' ).parents( '.wp-picker-container' ).addClass( 'active' ); } }); jQuery('.wp-full-overlay-footer .devices button').on('click', function() { var device = jQuery(this).attr('data-device'); jQuery( '.customize-control-ast-responsive-color .customize-control-content .wp-picker-container' ).removeClass( 'active' ); jQuery( '.customize-control-ast-responsive-color .customize-control-content .ast-responsive-color.' + device ).parents( '.wp-picker-container' ).addClass( 'active' ); }); })(jQuery); responsive-color/class-astra-control-responsive-color.php 0000666 00000011771 15214273034 0020004 0 ustar 00 json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $val = maybe_unserialize( $this->value() ); if ( ! is_array( $val ) || is_numeric( $val ) ) { $val = array( 'desktop' => $val, 'tablet' => '', 'mobile' => '', ); } $this->json['value'] = $val; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['suffix'] = $this->suffix; $this->json['responsive'] = $this->responsive; $this->json['rgba'] = $this->rgba; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> <# var defaultValue = '#RRGGBB', defaultValueAttr = ''; if ( data.defaultValue ) { if ( '#' !== data.defaultValue.substring( 0, 1 ) ) { defaultValue = '#' + data.defaultValue; } else { defaultValue = data.defaultValue; } defaultValueAttr = ' data-default-color=' + defaultValue; // Quotes added automatically. } #> <# if ( data.responsive ) { #>