芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/timucuy.com/wp-content/themes/hestia/assets/js/admin/src/customizer-controls.js
/** * File customizer-controls.js * * The file for generic customizer controls. * * @package Hestia */ /* global imageObject */ jQuery( document ).ready( function () { 'use strict'; jQuery.aboutBackground = { init: function () { this.updateBackgroundControl(); this.updateBackgroundControlBuffer(); this.focusMenu(); this.updateEditorLink(); }, updateBackgroundControl: function () { wp.customize( 'page_on_front', function( value ) { value.bind( function( newval ) { jQuery.ajax({ type: 'POST', data: { action: 'update_image_buffer', pid: newval, nonce: imageObject.imagenonce }, url: imageObject.ajaxurl, success: function (result) { var image = result.data; var html; if (image !== '' && image !== 'undefined') { html = '
' + '
About background
' + '
' + '
' + '
' + '
' + '
' + '
' + '
Remove
' + '
Change Image
' + '
' + '
' + '
'; } else { html = '
About background
' + '
' + '
\n' + '
' + 'No image selected' + '
' + '
' + '
Default
' + '
Select image
' + '
' + '
'; } wp.customize.control( 'hestia_feature_thumbnail' ).container['0'].innerHTML = html; wp.customize.instance( 'hestia_feature_thumbnail' ).previewer.refresh(); } }); } ); } ); }, updateBackgroundControlBuffer: function () { /** * Update the buffer for about background. */ wp.customize( 'hestia_feature_thumbnail', function ( value ) { value.bind( function ( newval ) { jQuery.ajax({ type: 'POST', url: imageObject.ajaxurl, data: { action: 'update_image_buffer', value: newval, nonce: imageObject.imagenonce, } }); }); }); }, /** * Focus menu when the user clicks on customizer shortcut of the menu. */ focusMenu: function () { wp.customize.previewer.bind( 'trigger-focus-menu', function() { wp.customize.section( 'menu_locations' ).focus(); } ); }, updateEditorLink: function () { wp.customize( 'page_on_front', function( value ) { value.bind( function( newval ) { if( typeof wp.customize.control( 'hestia_shortcut_editor' ) !== 'undefined' ){ var newLink = wp.customize.control( 'hestia_shortcut_editor' ).container['0'].innerHTML .replace(/(post=).*?(&)/,'$1' + newval + '$2'); wp.customize.control( 'hestia_shortcut_editor' ).container['0'].innerHTML = newLink; } } ); } ); } }; jQuery.aboutBackground.init(); wp.customize( 'hestia_team_content', function ( value ) { value.bind( function () { var authors_values; var result = ''; if ( jQuery.isFunction( wp.customize._value.hestia_authors_on_blog ) ) { authors_values = wp.customize._value.hestia_authors_on_blog(); } jQuery( '#customize-control-hestia_team_content .customizer-repeater-general-control-repeater-container' ).each( function () { var title = jQuery( this ).find( '.customizer-repeater-title-control' ).val(); var id = jQuery( this ).find( '.social-repeater-box-id' ).val(); if ( typeof (title) !== 'undefined' && title !== '' && typeof (id) !== 'undefined' && id !== '' ) { result += '
' + title + '
'; } } ); jQuery( '#customize-control-hestia_authors_on_blog .repeater-multiselect-team' ).html( result ); } ); } ); /* Move controls to Widgets sections. Used for sidebar placeholders */ if ( typeof wp.customize.control( 'hestia_placeholder_sidebar_1' ) !== 'undefined' ) { wp.customize.control( 'hestia_placeholder_sidebar_1' ).section( 'sidebar-widgets-sidebar-1' ); } if ( typeof wp.customize.control( 'hestia_placeholder_sidebar_woocommerce' ) !== 'undefined' ) { wp.customize.control( 'hestia_placeholder_sidebar_woocommerce' ).section( 'sidebar-widgets-sidebar-woocommerce' ); } jQuery(document).on( 'click', '.quick-links a', function(e) { e.preventDefault(); e.stopPropagation(); var control = jQuery( this ).data( 'control-focus' ); if ( control ){ wp.customize.control( control ).focus(); jQuery( 'label.' + control ).click(); } var section = jQuery( this ).data( 'section-focus' ); if( section ){ wp.customize.section( section ).focus(); } } ); jQuery( '.focus-customizer-header-image' ).on( 'click', function ( e ) { e.preventDefault(); wp.customize.section( 'header_image' ).focus(); } ); /** * Toggle section user clicks on customizer shortcut. */ var customize = wp.customize; if( typeof customize !== 'undefined' && customize.hasOwnProperty('previewer') ) { customize.previewer.bind( 'hestia-customize-disable-section', function ( data ) { jQuery( '[data-customize-setting-link=' + data + ']' ).trigger( 'click' ); } ); customize.previewer.bind( 'hestia-customize-focus-control', function ( data ) { wp.customize.control( data ).focus(); } ); } // Toggle visibility of Header Video notice when active state change. customize.control( 'header_video', function( headerVideoControl ) { headerVideoControl.deferred.embedded.done( function() { var toggleNotice = function() { var section = customize.section( headerVideoControl.section() ), noticeCode = 'video_header_not_available'; section.notifications.remove( noticeCode ); }; toggleNotice(); headerVideoControl.active.bind( toggleNotice ); } ); } ); } );