updated plugin GP Premium
version 2.0.3
This commit is contained in:
@ -1,34 +1,31 @@
|
||||
( function( api ) {
|
||||
|
||||
api.controlConstructor['gp-background-images'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor[ 'gp-background-images' ] = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this;
|
||||
|
||||
|
||||
control.container.on( 'change', '.generatepress-backgrounds-repeat select',
|
||||
function() {
|
||||
control.settings['repeat'].set( jQuery( this ).val() );
|
||||
control.settings.repeat.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
control.container.on( 'change', '.generatepress-backgrounds-size select',
|
||||
function() {
|
||||
control.settings['size'].set( jQuery( this ).val() );
|
||||
control.settings.size.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-backgrounds-attachment select',
|
||||
function() {
|
||||
control.settings['attachment'].set( jQuery( this ).val() );
|
||||
control.settings.attachment.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'input', '.generatepress-backgrounds-position input',
|
||||
function() {
|
||||
control.settings['position'].set( jQuery( this ).val() );
|
||||
control.settings.position.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
} );
|
||||
|
||||
} )( wp.customize );
|
||||
}( wp.customize ) );
|
||||
|
@ -1,7 +1,8 @@
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
jQuery( function( $ ) {
|
||||
$( '[data-type="overlay_design"]' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
// eslint-disable-next-line no-alert
|
||||
if ( ! confirm( gpButtonActions.warning ) ) {
|
||||
return;
|
||||
}
|
||||
@ -23,11 +24,9 @@ jQuery( document ).ready( function( $ ) {
|
||||
api.instance( 'generate_settings[slideout_font_size]' ).set( gpButtonActions.styling.fontSize );
|
||||
|
||||
$( '.wp-color-picker' ).wpColorPicker().change();
|
||||
|
||||
}( wp.customize ) );
|
||||
} );
|
||||
|
||||
|
||||
$( '[data-type="regenerate_external_css"]' ).on( 'click', function( e ) {
|
||||
var $thisButton = $( this ); // eslint-disable-line no-var
|
||||
e.preventDefault();
|
||||
|
@ -1,4 +1,4 @@
|
||||
jQuery( document ).ready( function($) {
|
||||
jQuery( function( $ ) {
|
||||
$( '.generatepress-control-toggles' ).each( function() {
|
||||
$( this ).find( 'button' ).first().addClass( 'active' );
|
||||
} );
|
||||
@ -7,7 +7,7 @@ jQuery( document ).ready( function($) {
|
||||
e.preventDefault();
|
||||
var button = $( this ),
|
||||
target = button.data( 'target' ),
|
||||
other_targets = button.siblings();
|
||||
otherTargets = button.siblings();
|
||||
|
||||
button.addClass( 'active' );
|
||||
button.siblings().removeClass( 'active' );
|
||||
@ -20,9 +20,10 @@ jQuery( document ).ready( function($) {
|
||||
overflow: '',
|
||||
} );
|
||||
|
||||
$.each( other_targets, function( index, value ) {
|
||||
var other_target = $( this ).data( 'target' );
|
||||
$( 'li[data-control-section="' + other_target + '"]' ).css( {
|
||||
$.each( otherTargets, function() {
|
||||
var otherTarget = $( this ).data( 'target' );
|
||||
|
||||
$( 'li[data-control-section="' + otherTarget + '"]' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
@ -31,4 +32,4 @@ jQuery( document ).ready( function($) {
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
});
|
||||
} );
|
||||
|
@ -1,12 +1,12 @@
|
||||
( function( $, api ) {
|
||||
api.controlConstructor['gp-copyright'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor[ 'gp-copyright' ] = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this;
|
||||
$( '.gp-copyright-area', control.container ).on( 'change keyup',
|
||||
function() {
|
||||
control.setting.set( $( this ).val() );
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
} );
|
||||
} )( jQuery, wp.customize );
|
||||
}( jQuery, wp.customize ) );
|
||||
|
@ -1,10 +1,9 @@
|
||||
( function( $, api ) {
|
||||
|
||||
/**
|
||||
* Set some controls when we're using the navigation as a header.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
*/
|
||||
api( 'generate_menu_plus_settings[navigation_as_header]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var navAlignmentSetting = api.instance( 'generate_settings[nav_alignment_setting]' ),
|
||||
@ -67,13 +66,12 @@
|
||||
} );
|
||||
|
||||
var showRegularHeader,
|
||||
showRegularHeaderCallback,
|
||||
showNavHeader;
|
||||
showRegularHeaderCallback;
|
||||
|
||||
/**
|
||||
* Determine whether we should display our header controls.
|
||||
*
|
||||
* @returns {boolean}
|
||||
* @return {boolean} Whether we should show the regular header.
|
||||
*/
|
||||
showRegularHeader = function() {
|
||||
if ( value.get() ) {
|
||||
@ -83,23 +81,10 @@
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether our navigation is our header.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
showNavHeader = function() {
|
||||
if ( value.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation as header option.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
* @param {wp.customize.Control} control The current control.
|
||||
*/
|
||||
showRegularHeaderCallback = function( control ) {
|
||||
var setActiveState = function() {
|
||||
@ -131,7 +116,7 @@
|
||||
* Set the navigation branding font size label on mobile header branding change.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
*/
|
||||
api( 'generate_menu_plus_settings[mobile_header_branding]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( api.instance( 'generate_settings[mobile_site_title_font_size]' ) && 'title' === newval ) {
|
||||
@ -144,7 +129,7 @@
|
||||
* Set the navigation branding font size label on mobile header change.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
*/
|
||||
api( 'generate_menu_plus_settings[mobile_header]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var mobileSiteTitleFontSizeSetting = api.instance( 'generate_settings[mobile_site_title_font_size]' ),
|
||||
@ -163,5 +148,4 @@
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
} )( jQuery, wp.customize );
|
||||
}( jQuery, wp.customize ) );
|
||||
|
@ -1,4 +1,4 @@
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
jQuery( function( $ ) {
|
||||
$( '.generatepress-shortcuts a' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
var section = $( this ).attr( 'data-section' ),
|
||||
@ -14,7 +14,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
}
|
||||
} );
|
||||
|
||||
$( '.return-shortcut .dashicons' ).on( 'click', function( e ) {
|
||||
$( '.return-shortcut .dashicons' ).on( 'click', function() {
|
||||
var container = $( this ).closest( '.generatepress-shortcuts' );
|
||||
|
||||
container.find( '.show-shortcuts' ).show();
|
||||
|
@ -1,134 +1,137 @@
|
||||
wp.customize.controlConstructor['generatepress-pro-range-slider'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
wp.customize.controlConstructor[ 'generatepress-pro-range-slider' ] = wp.customize.Control.extend( {
|
||||
ready() {
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
value,
|
||||
thisInput,
|
||||
inputDefault,
|
||||
changeAction,
|
||||
value,
|
||||
controlClass = '.customize-control-generatepress-pro-range-slider',
|
||||
footerActions = jQuery( '#customize-footer-actions' );
|
||||
|
||||
|
||||
// Set up the sliders
|
||||
jQuery( '.generatepress-slider' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
var _input = _this.closest( 'label' ).find( 'input[type="number"]' );
|
||||
var _text = _input.next( '.value' );
|
||||
_this.slider({
|
||||
|
||||
_this.slider( {
|
||||
value: _input.val(),
|
||||
min: _this.data( 'min' ),
|
||||
max: _this.data( 'max' ),
|
||||
step: _this.data( 'step' ),
|
||||
slide: function( event, ui ) {
|
||||
slide( event, ui ) {
|
||||
_input.val( ui.value ).change();
|
||||
_text.text( ui.value );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
} );
|
||||
} );
|
||||
|
||||
// Update the range value based on the input value
|
||||
jQuery( controlClass + ' .gp_range_value input[type=number]' ).on( 'input', function() {
|
||||
value = jQuery( this ).attr( 'value' );
|
||||
|
||||
if ( '' == value ) {
|
||||
value = -1;
|
||||
}
|
||||
jQuery( this ).closest( 'label' ).find( '.generatepress-slider' ).slider( 'value', parseFloat(value)).change();
|
||||
});
|
||||
|
||||
jQuery( this ).closest( 'label' ).find( '.generatepress-slider' ).slider( 'value', parseFloat( value ) ).change();
|
||||
} );
|
||||
|
||||
// Handle the reset button
|
||||
jQuery( controlClass + ' .generatepress-reset' ).on( 'click', function() {
|
||||
var icon = jQuery( this ),
|
||||
visible_area = icon.closest( '.gp-range-title-area' ).next( '.gp-range-slider-areas' ).children( 'label:visible' ),
|
||||
input = visible_area.find( 'input[type=number]' ),
|
||||
slider_value = visible_area.find( '.generatepress-slider' ),
|
||||
visual_value = visible_area.find( '.gp_range_value' ),
|
||||
reset_value = input.attr( 'data-reset_value' );
|
||||
|
||||
input.val( reset_value ).change();
|
||||
visual_value.find( 'input' ).val( reset_value );
|
||||
visual_value.find( '.value' ).text( reset_value );
|
||||
|
||||
if ( '' == reset_value ) {
|
||||
reset_value = -1;
|
||||
visibleArea = icon.closest( '.gp-range-title-area' ).next( '.gp-range-slider-areas' ).children( 'label:visible' ),
|
||||
input = visibleArea.find( 'input[type=number]' ),
|
||||
sliderValue = visibleArea.find( '.generatepress-slider' ),
|
||||
visualValue = visibleArea.find( '.gp_range_value' ),
|
||||
resetValue = input.attr( 'data-reset_value' );
|
||||
|
||||
input.val( resetValue ).change();
|
||||
visualValue.find( 'input' ).val( resetValue );
|
||||
visualValue.find( '.value' ).text( resetValue );
|
||||
|
||||
if ( '' == resetValue ) {
|
||||
resetValue = -1;
|
||||
}
|
||||
|
||||
slider_value.slider( 'value', parseFloat( reset_value ) );
|
||||
});
|
||||
|
||||
|
||||
sliderValue.slider( 'value', parseFloat( resetValue ) );
|
||||
} );
|
||||
|
||||
// Figure out which device icon to make active on load
|
||||
jQuery( controlClass + ' .generatepress-range-slider-control' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
|
||||
_this.find( '.gp-device-controls' ).children( 'span:first-child' ).addClass( 'selected' );
|
||||
_this.find( '.range-option-area:first-child' ).show();
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
// Do stuff when device icons are clicked
|
||||
jQuery( controlClass + ' .gp-device-controls > span' ).on( 'click', function( event ) {
|
||||
var device = jQuery( this ).data( 'option' );
|
||||
|
||||
|
||||
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.addClass( 'selected' );
|
||||
_this.siblings().removeClass( 'selected' );
|
||||
}
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
jQuery( controlClass + ' .gp-range-slider-areas label' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.show();
|
||||
_this.siblings().hide();
|
||||
}
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
// Set the device we're currently viewing
|
||||
wp.customize.previewedDevice.set( jQuery( event.currentTarget ).data( 'option' ) );
|
||||
} );
|
||||
|
||||
|
||||
// Set the selected devices in our control when the Customizer devices are clicked
|
||||
footerActions.find( '.devices button' ).on( 'click', function() {
|
||||
var device = jQuery( this ).data( 'device' );
|
||||
|
||||
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.addClass( 'selected' );
|
||||
_this.siblings().removeClass( 'selected' );
|
||||
}
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
jQuery( controlClass + ' .gp-range-slider-areas label' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.show();
|
||||
_this.siblings().hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
// Apply changes when desktop slider is changed
|
||||
control.container.on( 'input change', '.desktop-range',
|
||||
function() {
|
||||
control.settings['desktop'].set( jQuery( this ).val() );
|
||||
control.settings.desktop.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Apply changes when tablet slider is changed
|
||||
control.container.on( 'input change', '.tablet-range',
|
||||
function() {
|
||||
control.settings['tablet'].set( jQuery( this ).val() );
|
||||
control.settings.tablet.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Apply changes when mobile slider is changed
|
||||
control.container.on( 'input change', '.mobile-range',
|
||||
function() {
|
||||
control.settings['mobile'].set( jQuery( this ).val() );
|
||||
control.settings.mobile.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
} );
|
||||
|
@ -1,30 +1,30 @@
|
||||
( function( $, api ) {
|
||||
// No longer needed as of 1.2.95
|
||||
// Keeping it here just in case
|
||||
api.controlConstructor['spacing'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor.spacing = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this;
|
||||
$( '.generate-number-control', control.container ).on( 'change keyup',
|
||||
function() {
|
||||
control.setting.set( $( this ).val() );
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
} );
|
||||
|
||||
api.controlConstructor['gp-spacing-slider'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor[ 'gp-spacing-slider' ] = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this;
|
||||
$( '.slider-input', control.container ).on( 'change keyup',
|
||||
function() {
|
||||
control.setting.set( $( this ).val() );
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
} );
|
||||
|
||||
api.controlConstructor['generatepress-spacing'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor[ 'generatepress-spacing' ] = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this,
|
||||
controlClass = '.customize-control-generatepress-spacing',
|
||||
footerActions = jQuery( '#customize-footer-actions' );
|
||||
@ -34,7 +34,7 @@
|
||||
var _this = jQuery( this );
|
||||
_this.find( '.gp-device-controls' ).children( 'span:first-child' ).addClass( 'selected' );
|
||||
_this.find( '.spacing-values-area:first-child' ).show();
|
||||
});
|
||||
} );
|
||||
|
||||
// Do stuff when device icons are clicked
|
||||
jQuery( controlClass + ' .gp-device-controls > span' ).on( 'click', function( event ) {
|
||||
@ -42,19 +42,21 @@
|
||||
|
||||
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.addClass( 'selected' );
|
||||
_this.siblings().removeClass( 'selected' );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
jQuery( controlClass + ' .spacing-values-container .spacing-values-area' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.show();
|
||||
_this.siblings().hide();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
// Set the device we're currently viewing
|
||||
wp.customize.previewedDevice.set( jQuery( event.currentTarget ).data( 'option' ) );
|
||||
@ -65,125 +67,127 @@
|
||||
var device = jQuery( this ).data( 'device' );
|
||||
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.addClass( 'selected' );
|
||||
_this.siblings().removeClass( 'selected' );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
jQuery( controlClass + ' .spacing-values-container .spacing-values-area' ).each( function() {
|
||||
var _this = jQuery( this );
|
||||
if ( device == _this.attr( 'data-option' ) ) {
|
||||
|
||||
if ( device === _this.attr( 'data-option' ) ) {
|
||||
_this.show();
|
||||
_this.siblings().hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
} );
|
||||
} );
|
||||
|
||||
control.container.on( 'change keyup', '.spacing-top',
|
||||
function() {
|
||||
control.settings['desktop_top'].set( jQuery( this ).val() );
|
||||
control.settings.desktop_top.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.spacing-right',
|
||||
function() {
|
||||
control.settings['desktop_right'].set( jQuery( this ).val() );
|
||||
control.settings.desktop_right.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.spacing-bottom',
|
||||
function() {
|
||||
control.settings['desktop_bottom'].set( jQuery( this ).val() );
|
||||
control.settings.desktop_bottom.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.spacing-left',
|
||||
function() {
|
||||
control.settings['desktop_left'].set( jQuery( this ).val() );
|
||||
control.settings.desktop_left.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.tablet-spacing-top',
|
||||
function() {
|
||||
control.settings['tablet_top'].set( jQuery( this ).val() );
|
||||
control.settings.tablet_top.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.tablet-spacing-right',
|
||||
function() {
|
||||
control.settings['tablet_right'].set( jQuery( this ).val() );
|
||||
control.settings.tablet_right.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.tablet-spacing-bottom',
|
||||
function() {
|
||||
control.settings['tablet_bottom'].set( jQuery( this ).val() );
|
||||
control.settings.tablet_bottom.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.tablet-spacing-left',
|
||||
function() {
|
||||
control.settings['tablet_left'].set( jQuery( this ).val() );
|
||||
control.settings.tablet_left.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.mobile-spacing-top',
|
||||
function() {
|
||||
control.settings['mobile_top'].set( jQuery( this ).val() );
|
||||
control.settings.mobile_top.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.mobile-spacing-right',
|
||||
function() {
|
||||
control.settings['mobile_right'].set( jQuery( this ).val() );
|
||||
control.settings.mobile_right.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.mobile-spacing-bottom',
|
||||
function() {
|
||||
control.settings['mobile_bottom'].set( jQuery( this ).val() );
|
||||
control.settings.mobile_bottom.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change keyup', '.mobile-spacing-left',
|
||||
function() {
|
||||
control.settings['mobile_left'].set( jQuery( this ).val() );
|
||||
control.settings.mobile_left.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
} );
|
||||
} )( jQuery, wp.customize );
|
||||
}( jQuery, wp.customize ) );
|
||||
|
||||
jQuery( document ).ready( function($) {
|
||||
$( '.gp-link-spacing' ).on( 'click', function(e) {
|
||||
jQuery( function( $ ) {
|
||||
$( '.gp-link-spacing' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
// Set up variables
|
||||
var _this = $( this ),
|
||||
element = _this.data( 'element' );
|
||||
element = _this.data( 'element' );
|
||||
|
||||
// Add our linked-values class to the next 4 elements
|
||||
_this.parent( '.gp-spacing-section' ).prevAll().slice(0,4).find( 'input' ).addClass( 'linked-values' ).attr( 'data-element', element );
|
||||
_this.parent( '.gp-spacing-section' ).prevAll().slice( 0, 4 ).find( 'input' ).addClass( 'linked-values' ).attr( 'data-element', element );
|
||||
|
||||
// Change our link icon class
|
||||
_this.hide();
|
||||
_this.next( 'span' ).show();
|
||||
});
|
||||
} );
|
||||
|
||||
$( '.gp-unlink-spacing' ).on( 'click', function(e) {
|
||||
$( '.gp-unlink-spacing' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
// Set up variables
|
||||
var _this = $( this );
|
||||
|
||||
// Remove our linked-values class to the next 4 elements
|
||||
_this.parent( '.gp-spacing-section' ).prevAll().slice(0,4).find( 'input' ).removeClass( 'linked-values' ).attr( 'data-element', '' );
|
||||
_this.parent( '.gp-spacing-section' ).prevAll().slice( 0, 4 ).find( 'input' ).removeClass( 'linked-values' ).attr( 'data-element', '' );
|
||||
|
||||
// Change our link icon class
|
||||
_this.hide();
|
||||
_this.prev( 'span' ).show();
|
||||
});
|
||||
} );
|
||||
|
||||
$( '.gp-spacing-section' ).on( 'input', '.linked-values', function() {
|
||||
var _this = $( this ),
|
||||
@ -191,10 +195,9 @@ jQuery( document ).ready( function($) {
|
||||
val = _this.val(),
|
||||
targetElements = _this.closest( '.spacing-values-area' ).find( '.linked-values[ data-element="' + data + '" ]' );
|
||||
|
||||
|
||||
targetElements.each( function( key, value ) {
|
||||
targetElements.each( function() {
|
||||
var element = $( this );
|
||||
element.val( val ).change();
|
||||
});
|
||||
});
|
||||
});
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
@ -1,7 +1,6 @@
|
||||
( function( api ) {
|
||||
|
||||
api.controlConstructor['gp-pro-customizer-typography'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
api.controlConstructor[ 'gp-pro-customizer-typography' ] = api.Control.extend( {
|
||||
ready() {
|
||||
var control = this;
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-family select',
|
||||
@ -12,35 +11,34 @@
|
||||
_variantsID = _this.attr( 'data-variants' );
|
||||
|
||||
// Set our font family
|
||||
control.settings['family'].set( _this.val() );
|
||||
control.settings.family.set( _this.val() );
|
||||
|
||||
// Bail if our controls don't exist
|
||||
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
|
||||
if ( 'undefined' === typeof control.settings.category || 'undefined' === typeof control.settings.variant ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout( function() {
|
||||
// Send our request to the generate_get_all_google_fonts_ajax function
|
||||
var response = jQuery.getJSON({
|
||||
var response = jQuery.getJSON( {
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'generate_get_all_google_fonts_ajax',
|
||||
gp_customize_nonce: gp_customize.nonce
|
||||
gp_customize_nonce: gp_customize.nonce,
|
||||
},
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
});
|
||||
} );
|
||||
|
||||
// Get our response
|
||||
var fonts = response.responseJSON;
|
||||
|
||||
// Create an ID from our selected font
|
||||
var id = _value.split(' ').join('_').toLowerCase();
|
||||
var id = _value.split( ' ' ).join( '_' ).toLowerCase();
|
||||
|
||||
// Set our values if we have them
|
||||
if ( id in fonts ) {
|
||||
|
||||
// Get existing variants if this font is already selected
|
||||
var got_variants = false;
|
||||
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
|
||||
@ -67,18 +65,18 @@
|
||||
|
||||
// Set our variants
|
||||
if ( ! got_variants ) {
|
||||
control.settings[ 'variant' ].set( fonts[ id ].variants );
|
||||
control.settings.variant.set( fonts[ id ].variants );
|
||||
} else {
|
||||
control.settings[ 'variant' ].set( updated_variants );
|
||||
control.settings.variant.set( updated_variants );
|
||||
}
|
||||
|
||||
// Set our font category
|
||||
control.settings[ 'category' ].set( fonts[ id ].category );
|
||||
control.settings.category.set( fonts[ id ].category );
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
|
||||
} else {
|
||||
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
|
||||
control.settings[ 'category' ].set( '' )
|
||||
control.settings[ 'variant' ].set( '' )
|
||||
control.settings.category.set( '' );
|
||||
control.settings.variant.set( '' );
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
|
||||
}
|
||||
@ -91,16 +89,16 @@
|
||||
var _this = jQuery( this );
|
||||
var variants = _this.val();
|
||||
|
||||
control.settings['variant'].set( variants );
|
||||
control.settings.variant.set( variants );
|
||||
|
||||
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
|
||||
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
|
||||
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
|
||||
var font_val = api.control( this_control ).settings['family'].get();
|
||||
var font_val = api.control( this_control ).settings.family.get();
|
||||
|
||||
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
|
||||
if ( font_val == control.settings.family.get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
|
||||
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
|
||||
api.control( this_control ).settings['variant'].set( variants );
|
||||
api.control( this_control ).settings.variant.set( variants );
|
||||
}
|
||||
} );
|
||||
}
|
||||
@ -108,44 +106,43 @@
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-category input',
|
||||
function() {
|
||||
control.settings['category'].set( jQuery( this ).val() );
|
||||
control.settings.category.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-weight select',
|
||||
function() {
|
||||
control.settings['weight'].set( jQuery( this ).val() );
|
||||
control.settings.weight.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-transform select',
|
||||
function() {
|
||||
control.settings['transform'].set( jQuery( this ).val() );
|
||||
control.settings.transform.set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
} );
|
||||
}( wp.customize ) );
|
||||
|
||||
} )( wp.customize );
|
||||
|
||||
jQuery( document ).ready( function($) {
|
||||
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
jQuery( '.generatepress-font-family select' ).selectWoo();
|
||||
jQuery( '.generatepress-font-variant' ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
var value = _this.data( 'saved-value' );
|
||||
value = _this.data( 'saved-value' );
|
||||
|
||||
if ( value ) {
|
||||
value = value.toString().split( ',' );
|
||||
}
|
||||
|
||||
_this.find( 'select' ).selectWoo().val( value ).trigger( 'change.select2' );
|
||||
} );
|
||||
|
||||
$( ".generatepress-font-family" ).each( function( key, value ) {
|
||||
$( '.generatepress-font-family' ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
|
||||
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
|
||||
_this.next( '.generatepress-font-variant' ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
} );
|
||||
} );
|
||||
|
Reference in New Issue
Block a user