Changeset 27891
- Timestamp:
- 04/01/2014 12:37:43 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/js/customize-widgets.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-widgets.js
r27890 r27891 140 140 */ 141 141 self.init = function () { 142 this.showFirstSidebarIfRequested();143 142 this.availableWidgetsPanel.setup(); 144 143 }; … … 146 145 self.init(); 147 146 } ); 148 149 /**150 * Listen for updates to which sidebars are rendered in the preview and toggle151 * the customizer sections accordingly.152 */153 self.showFirstSidebarIfRequested = function () {154 if ( ! /widget-customizer=open/.test( location.search ) ) {155 return;156 }157 158 var show_first_visible_sidebar = function () {159 self.registered_sidebars.off( 'change:is_rendered', show_first_visible_sidebar );160 var section, first_rendered_sidebar = self.registered_sidebars.find( function ( sidebar ) {161 return sidebar.get( 'is_rendered' );162 } );163 if ( ! first_rendered_sidebar ) {164 return;165 }166 section = $( '#accordion-section-sidebar-widgets-' + first_rendered_sidebar.get( 'id' ) );167 if ( ! section.hasClass( 'open' ) ) {168 section.find( '.accordion-section-title' ).trigger( 'click' );169 }170 section[0].scrollIntoView();171 };172 show_first_visible_sidebar = _.debounce( show_first_visible_sidebar, 100 ); // so only fires when all updated at end173 self.registered_sidebars.on( 'change:is_rendered', show_first_visible_sidebar );174 };175 147 176 148 /**
Note: See TracChangeset
for help on using the changeset viewer.