Changeset 27654
- Timestamp:
- 03/22/2014 09:21:36 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-widgets.js
r27653 r27654 224 224 // Sort widget controls to their new positions 225 225 widget_form_controls.sort( function ( a, b ) { 226 var a_index = new_widget_ids.indexOf(a.params.widget_id ),227 b_index = new_widget_ids.indexOf(b.params.widget_id );226 var a_index = _.indexOf( new_widget_ids, a.params.widget_id ), 227 b_index = _.indexOf( new_widget_ids, b.params.widget_id ); 228 228 if ( a_index === b_index ) { 229 229 return 0; … … 262 262 // Check if the widget is in another sidebar 263 263 wp.customize.each( function ( other_setting ) { 264 if ( other_setting.id === control.setting.id || 0 !== other_setting.id.indexOf('sidebars_widgets[' ) || other_setting.id === 'sidebars_widgets[wp_inactive_widgets]' ) {264 if ( other_setting.id === control.setting.id || 0 !== _.indexOf( other_setting.id, 'sidebars_widgets[' ) || other_setting.id === 'sidebars_widgets[wp_inactive_widgets]' ) { 265 265 return; 266 266 } 267 267 var other_sidebar_widgets = other_setting(), i; 268 268 269 i = other_sidebar_widgets.indexOf(removed_widget_id );269 i = _.indexOf( other_sidebar_widgets, removed_widget_id ); 270 270 if ( -1 !== i ) { 271 271 is_present_in_another_sidebar = true; … … 572 572 return; 573 573 } 574 if ( 0 !== other_setting.id.indexOf('sidebars_widgets[' ) ) {574 if ( 0 !== _.indexOf( other_setting.id, 'sidebars_widgets[' ) ) { 575 575 return; 576 576 } 577 577 var other_sidebar_widgets = other_setting().slice(), i; 578 i = other_sidebar_widgets.indexOf(widget_id );578 i = _.indexOf( other_sidebar_widgets, widget_id ); 579 579 if ( -1 !== i ) { 580 580 other_sidebar_widgets.splice( i ); … … 585 585 // Add widget to this sidebar 586 586 sidebar_widgets = control.setting().slice(); 587 if ( -1 === sidebar_widgets.indexOf(widget_id ) ) {587 if ( -1 === _.indexOf( sidebar_widgets, widget_id ) ) { 588 588 sidebar_widgets.push( widget_id ); 589 589 control.setting( sidebar_widgets ); … … 755 755 // Reposition whenever a sidebar's widgets are changed 756 756 wp.customize.each( function ( setting ) { 757 if ( 0 === setting.id.indexOf('sidebars_widgets[' ) ) {757 if ( 0 === _.indexOf( setting.id, 'sidebars_widgets[' ) ) { 758 758 setting.bind( function () { 759 759 if ( control.container.hasClass( 'expanded' ) ) { … … 1055 1055 } 1056 1056 sidebar_widget_ids = sidebars_widgets_control.setting().slice(); 1057 i = sidebar_widget_ids.indexOf(control.params.widget_id );1057 i = _.indexOf( sidebar_widget_ids, control.params.widget_id ); 1058 1058 if ( -1 === i ) { 1059 1059 throw new Error( 'Widget is not in sidebar' ); … … 1439 1439 1440 1440 sidebar_widget_ids = control.getSidebarWidgetsControl().setting(); 1441 position = sidebar_widget_ids.indexOf(control.params.widget_id );1441 position = _.indexOf( sidebar_widget_ids, control.params.widget_id ); 1442 1442 if ( position === -1 ) { 1443 1443 throw new Error( 'Widget was unexpectedly not present in the sidebar.' ); … … 1579 1579 // @todo this can use widget_id_to_setting_id(), then pass into wp.customize.control( x ).getSidebarWidgetsControl() 1580 1580 wp.customize.control.each( function ( control ) { 1581 if ( control.params.type === 'sidebar_widgets' && -1 !== control.setting().indexOf(widget_id ) ) {1581 if ( control.params.type === 'sidebar_widgets' && -1 !== _.indexOf( control.setting(), widget_id ) ) { 1582 1582 found_control = control; 1583 1583 }
Note: See TracChangeset
for help on using the changeset viewer.