]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/customize-widgets.js
WordPress 4.5
[autoinstalls/wordpress.git] / wp-admin / js / customize-widgets.js
index 820e8e3cab6abac50f780651a4023bdecbd04011..fee74cfe341d489e3c94f2569ae085ffcd84695a 100644 (file)
@@ -34,7 +34,7 @@
                multi_number: null,
                name: null,
                id_base: null,
-               transport: 'refresh',
+               transport: null,
                params: [],
                width: null,
                height: null,
                 */
                _setupReorderUI: function() {
                        var self = this, selectSidebarItem, $moveWidgetArea,
-                               $reorderNav, updateAvailableSidebars;
+                               $reorderNav, updateAvailableSidebars, template;
 
                        /**
                         * select the provided sidebar list item in the move widget area
                         * Add the widget reordering elements to the widget control
                         */
                        this.container.find( '.widget-title-action' ).after( $( api.Widgets.data.tpl.widgetReorderNav ) );
-                       $moveWidgetArea = $(
-                               _.template( api.Widgets.data.tpl.moveWidgetArea, {
+
+
+                       template = _.template( api.Widgets.data.tpl.moveWidgetArea );
+                       $moveWidgetArea = $( template( {
                                        sidebars: _( api.Widgets.registeredSidebars.toArray() ).pluck( 'attributes' )
                                } )
                        );
                 * comparing the loaded form with the sanitized form, whose fields will
                 * be aligned to copy the sanitized over. The elements returned by this
                 * are passed into this._getInputsSignature(), and they are iterated
-                * over when copying sanitized values over to the the form loaded.
+                * over when copying sanitized values over to the form loaded.
                 *
                 * @param {jQuery} container element in which to look for inputs
                 * @returns {jQuery} inputs
                        params = {};
                        params.action = 'update-widget';
                        params.wp_customize = 'on';
-                       params.nonce = api.Widgets.data.nonce;
+                       params.nonce = api.settings.nonce['update-widget'];
                        params.theme = api.settings.theme.stylesheet;
                        params.customized = wp.customize.previewer.query().customized;
 
                                }
                        });
 
-                       if ( ! widgetControls.length ) {
+                       if ( 0 === widgetControls.length || ( 1 === api.Widgets.registeredSidebars.length && widgetControls.length <= 1 ) ) {
                                this.container.find( '.reorder-toggle' ).hide();
                                return;
                        } else {
                        isExistingWidget = api.has( settingId );
                        if ( ! isExistingWidget ) {
                                settingArgs = {
-                                       transport: 'refresh',
+                                       transport: api.Widgets.data.selectiveRefreshableWidgets[ widget.get( 'id_base' ) ] ? 'postMessage' : 'refresh',
                                        previewer: this.setting.previewer
                                };
                                setting = api.create( settingId, settingId, '', settingArgs );
                sidebar_widgets: api.Widgets.SidebarControl
        });
 
-       // Refresh the nonce if login sends updated nonces over.
-       api.bind( 'nonce-refresh', function( nonces ) {
-               api.Widgets.data.nonce = nonces['update-widget'];
-       });
-
        /**
         * Init Customizer for widgets.
         */