Changeset 26390
- Timestamp:
- 11/26/2013 04:37:27 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/dashboard.js
r26372 r26390 3 3 4 4 jQuery(document).ready( function($) { 5 /* Dashboard Welcome Panel */6 var welcomePanel = $('#welcome-panel'),5 var $window = $( window ), 6 welcomePanel = $( '#welcome-panel' ), 7 7 welcomePanelHide = $('#wp_welcome_panel-hide'), 8 updateWelcomePanel = function( visible ) { 9 $.post( ajaxurl, { 10 action: 'update-welcome-panel', 11 visible: visible, 12 welcomepanelnonce: $('#welcomepanelnonce').val() 13 }); 14 }; 8 updateWelcomePanel, 9 metaboxHolder = $( '.metabox-holder' ), 10 updateColumnCount; 11 12 updateWelcomePanel = function( visible ) { 13 $.post( ajaxurl, { 14 action: 'update-welcome-panel', 15 visible: visible, 16 welcomepanelnonce: $( '#welcomepanelnonce' ).val() 17 }); 18 }; 15 19 16 20 if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') ) { … … 129 133 }); 130 134 131 // Dashboard columns 132 jQuery(document).ready(function () { 133 // Update main column count on load 134 updateColumnCount(); 135 }); 136 137 jQuery(window).resize( _.debounce( function(){ 138 updateColumnCount(); 139 }, 30) ); 140 141 function updateColumnCount() { 135 updateColumnCount = function( $window, $holder ) { 142 136 var cols = 1, 143 windowWidth = parseInt( jQuery(window).width(), 10);137 windowWidth = parseInt( $window.width(), 10 ); 144 138 145 139 if (799 < windowWidth && 1299 > windowWidth) { … … 154 148 cols = 4; 155 149 } 156 jQuery('.metabox-holder').attr('class', jQuery('.metabox-holder').attr('class').replace(/columns-\d+/, 'columns-' + cols)); 157 } 150 151 $holder.attr( 'class', $holder.attr( 'class' ).replace( /columns-\d+/, 'columns-' + cols ) ); 152 }; 153 154 // Update main column count on load 155 updateColumnCount( $window, metaboxHolder ); 156 157 $window.on( 'resize', _.debounce(function() { 158 updateColumnCount( $window, metaboxHolder ); 159 }, 30 ) ); 158 160 159 161 } );
Note: See TracChangeset
for help on using the changeset viewer.