updated plugin GP Premium
version 1.12.2
This commit is contained in:
@ -0,0 +1,518 @@
|
||||
/**!
|
||||
* 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.4
|
||||
* https://github.com/kallookoo/wp-color-picker-alpha
|
||||
* Licensed under the GPLv2 license or later.
|
||||
*/
|
||||
( function( $ ) {
|
||||
// Prevent double-init.
|
||||
if ( $.wp.wpColorPicker.prototype._hasAlpha ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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 = '<div class="wp-picker-holder" />',
|
||||
_wrap = '<div class="wp-picker-container" />',
|
||||
_button = '<input type="button" class="button button-small" />',
|
||||
_before = '<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>',
|
||||
_wrappingLabel = '<label></label>',
|
||||
_wrappingLabelText = '<span class="screen-reader-text"></span>',
|
||||
_deprecated = false;
|
||||
|
||||
if ( 'undefined' !== typeof wp.i18n ) {
|
||||
var __ = wp.i18n.__,
|
||||
_colorValue = __( 'Color value' ),
|
||||
_selectColor = __( 'Select Color' ),
|
||||
_defaultString = __( 'Default' ),
|
||||
_defaultAriaLabel = __( 'Select default color' ),
|
||||
_clearString = __( 'Clear' ),
|
||||
_clearAriaLabel = __( 'Clear color' );
|
||||
} else if ( typeof wpColorPickerL10n !== "undefined" ) {
|
||||
// wpColorPickerL10n is defined in <= WordPress 5.4
|
||||
// Prevent CSS issues in < WordPress 4.9. current can only be checked if we know wpColorPickerL10n is defined
|
||||
_deprecated = ( typeof wpColorPickerL10n.current !== "undefined" );
|
||||
if ( _deprecated ) {
|
||||
// Update _before if wpColorPickerL10n.current is defined (< WP 4.9)
|
||||
_before = '<a tabindex="0" class="wp-color-result" />';
|
||||
}
|
||||
|
||||
var _colorValue = wpColorPickerL10n.defaultLabel,
|
||||
_selectColor = wpColorPickerL10n.pick,
|
||||
_defaultString = wpColorPickerL10n.defaultString,
|
||||
_defaultAriaLabel = wpColorPickerL10n.defaultAriaLabel,
|
||||
_clearString = wpColorPickerL10n.clear,
|
||||
_clearAriaLabel = wpColorPickerL10n.clearAriaLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, {
|
||||
_hasAlpha: true,
|
||||
/**
|
||||
* @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', _selectColor )
|
||||
.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( _colorValue );
|
||||
}
|
||||
|
||||
/*
|
||||
* 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( _selectColor );
|
||||
// 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( _defaultString );
|
||||
if ( ! _deprecated ) {
|
||||
self.button.attr( 'aria-label', _defaultAriaLabel );
|
||||
}
|
||||
} else {
|
||||
self.button.addClass( 'wp-picker-clear' ).val( _clearString );
|
||||
if ( ! _deprecated ) {
|
||||
self.button.attr( 'aria-label', _clearAriaLabel );
|
||||
}
|
||||
}
|
||||
|
||||
if ( _deprecated ) {
|
||||
el.wrap( '<span class="wp-picker-input-wrap" />' ).after( self.button );
|
||||
} else {
|
||||
// Wrap the wrapping label in its wrapper and append the Clear/Default button.
|
||||
self.wrappingLabel
|
||||
.wrap( '<span class="wp-picker-input-wrap hidden" />' )
|
||||
.after( self.button );
|
||||
|
||||
/*
|
||||
* The input wrapper now contains the label+input+Clear/Default button.
|
||||
* Store a reference to the input wrapper: we'll use this to toggle
|
||||
* the controls visibility.
|
||||
*/
|
||||
self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
|
||||
}
|
||||
|
||||
el.iris( {
|
||||
target: self.pickerContainer,
|
||||
hide: self.options.hide,
|
||||
width: self.options.width,
|
||||
mode: self.options.mode,
|
||||
palettes: self.options.palettes,
|
||||
/**
|
||||
* @summary Handles the onChange event if one has been defined in the options.
|
||||
*
|
||||
* Handles the onChange event if one has been defined in the options and additionally
|
||||
* sets the background color for the toggler element.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {Event} event The event that's being called.
|
||||
* @param {HTMLElement} ui The HTMLElement containing the color picker.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
change: function( event, ui ) {
|
||||
if ( self.options.alpha ) {
|
||||
self.toggler.css( { 'background-image' : 'url(' + image + ')' } );
|
||||
if ( _deprecated ) {
|
||||
self.toggler.html( '<span class="color-alpha" />' );
|
||||
} else {
|
||||
self.toggler.css( {
|
||||
'position' : 'relative'
|
||||
} );
|
||||
if ( self.toggler.find('span.color-alpha').length == 0 ) {
|
||||
self.toggler.append('<span class="color-alpha" />');
|
||||
}
|
||||
}
|
||||
|
||||
self.toggler.find( 'span.color-alpha' ).css( {
|
||||
'width' : '30px',
|
||||
'height' : '100%',
|
||||
'position' : 'absolute',
|
||||
'top' : 0,
|
||||
'left' : 0,
|
||||
'border-top-left-radius' : '2px',
|
||||
'border-bottom-left-radius' : '2px',
|
||||
'background' : ui.color.toString()
|
||||
} );
|
||||
} else {
|
||||
self.toggler.css( { backgroundColor : ui.color.toString() } );
|
||||
}
|
||||
|
||||
if ( $.isFunction( self.options.change ) ) {
|
||||
self.options.change.call( this, event, ui );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
el.val( self.initialValue );
|
||||
self._addListeners();
|
||||
|
||||
// Force the color picker to always be closed on initial load.
|
||||
if ( ! self.options.hide ) {
|
||||
self.toggler.click();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @summary Binds event listeners to the color picker.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
_addListeners: function() {
|
||||
var self = this;
|
||||
|
||||
/**
|
||||
* @summary Prevent any clicks inside this widget from leaking to the top and closing it.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {Event} event The event that's being called.
|
||||
*
|
||||
* @returs {void}
|
||||
*/
|
||||
self.wrap.on( 'click.wpcolorpicker', function( event ) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Open or close the color picker depending on the class.
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
self.toggler.click( function(){
|
||||
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
|
||||
self.close();
|
||||
} else {
|
||||
self.open();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Checks if value is empty when changing the color in the color picker.
|
||||
*
|
||||
* Checks if value is empty when changing the color in the color picker.
|
||||
* If so, the background color is cleared.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {Event} event The event that's being called.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
self.element.on( 'change', function( event ) {
|
||||
// Empty or Error = clear
|
||||
if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
|
||||
if ( self.options.alpha ) {
|
||||
if ( _deprecated ) {
|
||||
self.toggler.removeAttr( 'style' );
|
||||
}
|
||||
self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
|
||||
} else {
|
||||
self.toggler.css( 'backgroundColor', '' );
|
||||
}
|
||||
|
||||
// fire clear callback if we have one
|
||||
if ( $.isFunction( self.options.clear ) )
|
||||
self.options.clear.call( this, event );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* @summary Enables the user to clear or revert the color in the color picker.
|
||||
*
|
||||
* Enables the user to either clear the color in the color picker or revert back to the default color.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {Event} event The event that's being called.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
self.button.on( 'click', function( event ) {
|
||||
if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
|
||||
self.element.val( '' );
|
||||
if ( self.options.alpha ) {
|
||||
if ( _deprecated ) {
|
||||
self.toggler.removeAttr( 'style' );
|
||||
}
|
||||
self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
|
||||
} else {
|
||||
self.toggler.css( 'backgroundColor', '' );
|
||||
}
|
||||
|
||||
if ( $.isFunction( self.options.clear ) )
|
||||
self.options.clear.call( this, event );
|
||||
|
||||
self.element.trigger( 'change' );
|
||||
} else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
|
||||
self.element.val( self.options.defaultColor ).change();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Overwrite iris
|
||||
*/
|
||||
$.widget( 'a8c.iris', $.a8c.iris, {
|
||||
_create: function() {
|
||||
this._super();
|
||||
|
||||
// Global option for check is mode rbga is enabled
|
||||
this.options.alpha = this.element.data( 'alpha' ) || false;
|
||||
|
||||
// Is not input disabled
|
||||
if ( ! this.element.is( ':input' ) )
|
||||
this.options.alpha = false;
|
||||
|
||||
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
|
||||
var self = this,
|
||||
el = self.element,
|
||||
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
|
||||
aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
|
||||
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
|
||||
controls = {
|
||||
aContainer : aContainer,
|
||||
aSlider : aSlider
|
||||
};
|
||||
|
||||
if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
|
||||
self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
|
||||
} else {
|
||||
self.options.customWidth = 100;
|
||||
}
|
||||
|
||||
// Set default width for input reset
|
||||
self.options.defaultWidth = el.width();
|
||||
|
||||
// Update width for input
|
||||
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
|
||||
el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
|
||||
|
||||
// Push new controls
|
||||
$.each( controls, function( k, v ) {
|
||||
self.controls[k] = v;
|
||||
} );
|
||||
|
||||
// Change size strip and add margin for sliders
|
||||
self.controls.square.css( { 'margin-right': '0' } );
|
||||
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
|
||||
stripsMargin = ( emptyWidth / 6 ),
|
||||
stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin ) - 1;
|
||||
|
||||
$.each( [ 'aContainer', 'strip' ], function( k, v ) {
|
||||
self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
|
||||
} );
|
||||
|
||||
// Add new slider
|
||||
self._initControls();
|
||||
|
||||
// For updated widget
|
||||
self._change();
|
||||
}
|
||||
},
|
||||
_initControls: function() {
|
||||
this._super();
|
||||
|
||||
if ( this.options.alpha ) {
|
||||
var self = this,
|
||||
controls = self.controls;
|
||||
|
||||
controls.aSlider.slider({
|
||||
orientation : 'vertical',
|
||||
min : 0,
|
||||
max : 100,
|
||||
step : 1,
|
||||
value : parseInt( self._color._alpha * 100 ),
|
||||
slide : function( event, ui ) {
|
||||
// Update alpha value
|
||||
self._color._alpha = parseFloat( ui.value / 100 );
|
||||
self._change.apply( self, arguments );
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
_change: function() {
|
||||
this._super();
|
||||
|
||||
var self = this,
|
||||
el = self.element;
|
||||
|
||||
if ( this.options.alpha ) {
|
||||
var controls = self.controls,
|
||||
alpha = parseInt( self._color._alpha * 100 ),
|
||||
color = self._color.toRgb(),
|
||||
gradient = [
|
||||
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
|
||||
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
|
||||
],
|
||||
defaultWidth = self.options.defaultWidth,
|
||||
customWidth = self.options.customWidth,
|
||||
target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
|
||||
|
||||
// Generate background slider alpha, only for CSS3 old browser fuck!! :)
|
||||
controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
|
||||
|
||||
if ( target.hasClass( 'wp-picker-open' ) ) {
|
||||
// Update alpha value
|
||||
controls.aSlider.slider( 'value', alpha );
|
||||
|
||||
/**
|
||||
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
|
||||
* and change input width for view all value
|
||||
*/
|
||||
if ( self._color._alpha < 1 ) {
|
||||
controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
|
||||
el.width( parseInt( defaultWidth + customWidth ) );
|
||||
} else {
|
||||
el.width( defaultWidth );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var reset = el.data( 'reset-alpha' ) || false;
|
||||
|
||||
if ( reset ) {
|
||||
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
|
||||
self._color._alpha = 1;
|
||||
self.active = 'external';
|
||||
self._change();
|
||||
} );
|
||||
}
|
||||
el.trigger( 'change' );
|
||||
},
|
||||
_addInputListeners: function( input ) {
|
||||
var self = this,
|
||||
debounceTimeout = 100,
|
||||
callback = function( event ) {
|
||||
var color = new Color( input.val() ),
|
||||
val = input.val();
|
||||
|
||||
input.removeClass( 'iris-error' );
|
||||
// we gave a bad color
|
||||
if ( color.error ) {
|
||||
// don't error on an empty input
|
||||
if ( val !== '' )
|
||||
input.addClass( 'iris-error' );
|
||||
} else {
|
||||
if ( color.toString() !== self._color.toString() ) {
|
||||
// let's not do this on keyup for hex shortcodes
|
||||
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
|
||||
self._setOption( 'color', color.toString() );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
|
||||
|
||||
// If we initialized hidden, show on first focus. The rest is up to you.
|
||||
if ( self.options.hide ) {
|
||||
input.on( 'focus', function() {
|
||||
self.show();
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}( jQuery ) );
|
||||
|
||||
// Auto Call plugin is class is color-picker
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
$( '.color-picker' ).wpColorPicker();
|
||||
} );
|
1
wp-content/plugins/gp-premium/library/alpha-color-picker/wp-color-picker-alpha.min.js
vendored
Normal file
1
wp-content/plugins/gp-premium/library/alpha-color-picker/wp-color-picker-alpha.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ if ( ! class_exists( 'GeneratePress_Pro_CSS' ) ) :
|
||||
* Modified by Tom Usborne for GeneratePress
|
||||
*/
|
||||
class GeneratePress_Pro_CSS {
|
||||
|
||||
|
||||
/**
|
||||
* The css selector that you're currently adding rules to
|
||||
*
|
||||
@ -17,7 +17,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores the final css output with all of its rules for the current selector.
|
||||
*
|
||||
@ -25,7 +25,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector_output = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores all of the rules that will be added to the selector
|
||||
*
|
||||
@ -33,7 +33,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_css = '';
|
||||
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output
|
||||
*
|
||||
@ -41,14 +41,14 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_output = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores media queries
|
||||
*
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
protected $_media_query = null;
|
||||
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output inside of the media query
|
||||
*
|
||||
@ -62,7 +62,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @param string $selector - the css identifier of the html that you wish to target
|
||||
* @return $this
|
||||
*/
|
||||
@ -80,7 +80,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @param string $property - the css property
|
||||
* @param string $value - the value to be placed with the property
|
||||
* @param string $og_default - check to see if the value matches the default
|
||||
@ -95,15 +95,15 @@ class GeneratePress_Pro_CSS {
|
||||
$og_default = $og_default . $unit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we don't have a value or our value is the same as our og default, bail
|
||||
if ( empty( $value ) || $og_default == $value )
|
||||
return false;
|
||||
|
||||
|
||||
$this->_css .= $property . ':' . $value . ';';
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets a media query in the class
|
||||
*
|
||||
@ -114,17 +114,17 @@ class GeneratePress_Pro_CSS {
|
||||
public function start_media_query( $value ) {
|
||||
// Add the current rules to the output
|
||||
$this->add_selector_rules_to_output();
|
||||
|
||||
|
||||
// Add any previous media queries to the output
|
||||
if ( ! empty( $this->_media_query ) ) {
|
||||
$this->add_media_query_rules_to_output();
|
||||
}
|
||||
|
||||
|
||||
// Set the new media query
|
||||
$this->_media_query = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stops using a media query.
|
||||
*
|
||||
@ -136,7 +136,7 @@ class GeneratePress_Pro_CSS {
|
||||
public function stop_media_query() {
|
||||
return $this->start_media_query( null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the current media query's rules to the class' output variable
|
||||
*
|
||||
@ -146,13 +146,13 @@ class GeneratePress_Pro_CSS {
|
||||
private function add_media_query_rules_to_output() {
|
||||
if( !empty( $this->_media_query_output ) ) {
|
||||
$this->_output .= sprintf( '@media %1$s{%2$s}', $this->_media_query, $this->_media_query_output );
|
||||
|
||||
|
||||
// Reset the media query output string
|
||||
$this->_media_query_output = '';
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the current selector rules to the output variable
|
||||
*
|
||||
@ -165,7 +165,7 @@ class GeneratePress_Pro_CSS {
|
||||
if( !empty( $this->_css ) ) {
|
||||
$this->_selector_output = $this->_selector;
|
||||
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
|
||||
|
||||
|
||||
// Add our CSS to the output
|
||||
if ( ! empty( $this->_media_query ) ) {
|
||||
$this->_media_query_output .= $selector_output;
|
||||
@ -186,7 +186,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function css_output()
|
||||
@ -199,4 +199,4 @@ class GeneratePress_Pro_CSS {
|
||||
}
|
||||
|
||||
}
|
||||
endif;
|
||||
endif;
|
||||
|
@ -85,7 +85,7 @@ function generate_premium_control_inline_scripts() {
|
||||
$color_defaults = generate_get_color_defaults();
|
||||
|
||||
$controls_a11y['navigationTextColor'] = $color_defaults['navigation_text_color'];
|
||||
$controls_a11y['headerTextColor'] = $color_defaults['header_text_color'];
|
||||
$controls_a11y['siteTitleTextColor'] = $color_defaults['site_title_color'];
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_get_defaults' ) ) {
|
||||
|
@ -16,8 +16,8 @@
|
||||
mobileHeader = api.instance( 'generate_menu_plus_settings[mobile_header]' ).get(),
|
||||
navTextColorSetting = api.instance( 'generate_settings[navigation_text_color]' ),
|
||||
navTextColor = gpControls.navigationTextColor,
|
||||
headerTextColorSetting = api.instance( 'generate_settings[header_text_color]' ),
|
||||
headerTextColor = gpControls.headerTextColor;
|
||||
siteTitleTextColorSetting = api.instance( 'generate_settings[site_title_color]' ),
|
||||
siteTitleTextColor = gpControls.siteTitleTextColor;
|
||||
|
||||
if ( siteTitleFontSizeSetting && ! siteTitleFontSizeSetting._dirty && 25 !== siteTitleFontSizeSetting.get() ) {
|
||||
siteTitleFontSize = siteTitleFontSizeSetting.get();
|
||||
@ -31,8 +31,8 @@
|
||||
navTextColor = navTextColorSetting.get();
|
||||
}
|
||||
|
||||
if ( headerTextColorSetting && ! headerTextColorSetting._dirty ) {
|
||||
headerTextColor = headerTextColorSetting.get();
|
||||
if ( siteTitleTextColorSetting && ! siteTitleTextColorSetting._dirty ) {
|
||||
siteTitleTextColor = siteTitleTextColorSetting.get();
|
||||
}
|
||||
|
||||
if ( newval ) {
|
||||
@ -57,7 +57,7 @@
|
||||
}
|
||||
|
||||
if ( api.instance( 'generate_settings[site_title_color]' ) ) {
|
||||
api.instance( 'generate_settings[site_title_color]' ).set( headerTextColor );
|
||||
api.instance( 'generate_settings[site_title_color]' ).set( siteTitleTextColor );
|
||||
}
|
||||
|
||||
if ( mobileSiteTitleFontSizeSetting && 'enable' !== mobileHeader ) {
|
||||
@ -68,8 +68,7 @@
|
||||
|
||||
var showRegularHeader,
|
||||
showRegularHeaderCallback,
|
||||
showNavHeader,
|
||||
showNavHeaderCallback;
|
||||
showNavHeader;
|
||||
|
||||
/**
|
||||
* Determine whether we should display our header controls.
|
||||
@ -112,21 +111,6 @@
|
||||
value.bind( setActiveState );
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation as header option.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
showNavHeaderCallback = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( showNavHeader() );
|
||||
};
|
||||
|
||||
control.active.validate = showNavHeader;
|
||||
setActiveState();
|
||||
value.bind( setActiveState );
|
||||
};
|
||||
|
||||
api.control( 'generate_header_helper', showRegularHeaderCallback );
|
||||
api.control( 'generate_settings[header_layout_setting]', showRegularHeaderCallback );
|
||||
api.control( 'generate_settings[header_inner_width]', showRegularHeaderCallback );
|
||||
|
Reference in New Issue
Block a user