});
$(document).ready( function() {
- var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'), mobileEvent,
+ var lastClicked = false, checks, first, last, checked, sliced, menu = $('#adminmenu'), mobileEvent,
pageInput = $('input.current-page'), currentPage = pageInput.val();
// when the menu is folded, make the fly-out submenu header clickable
});
$('#collapse-menu').on('click.collapse-menu', function(e){
- var body = $(document.body);
+ var body = $( document.body ), respWidth;
// reset any compensation for submenus near the bottom of the screen
$('#adminmenu div.wp-submenu').css('margin-top', '');
- if ( $(window).width() < 900 ) {
+ // WebKit excludes the width of the vertical scrollbar when applying the CSS "@media screen and (max-width: ...)"
+ // and matches $(window).width().
+ // Firefox and IE > 8 include the scrollbar width, so after the jQuery normalization
+ // $(window).width() is 884px but window.innerWidth is 900px.
+ // (using window.innerWidth also excludes IE < 9)
+ respWidth = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $(window).width() : window.innerWidth;
+
+ if ( respWidth && respWidth < 900 ) {
if ( body.hasClass('auto-fold') ) {
- body.removeClass('auto-fold');
+ body.removeClass('auto-fold').removeClass('folded');
setUserSetting('unfold', 1);
- body.removeClass('folded');
- deleteUserSetting('mfold');
+ setUserSetting('mfold', 'o');
} else {
body.addClass('auto-fold');
- deleteUserSetting('unfold');
+ setUserSetting('unfold', 0);
}
} else {
if ( body.hasClass('folded') ) {
body.removeClass('folded');
- deleteUserSetting('mfold');
+ setUserSetting('mfold', 'o');
} else {
body.addClass('folded');
setUserSetting('mfold', 'f');
last = checks.index( this );
checked = $(this).prop('checked');
if ( 0 < first && 0 < last && first != last ) {
- checks.slice( first, last ).prop( 'checked', function(){
+ sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
+ sliced.prop( 'checked', function() {
if ( $(this).closest('tr').is(':visible') )
return checked;
$(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
.children().children('.check-column').find(':checkbox')
.prop('checked', function() {
- if ( $(this).closest('tr').is(':hidden') )
+ if ( $(this).is(':hidden') )
return false;
if ( toggle )
return $(this).prop( 'checked' );
});
});
+ // Show row actions on keyboard focus of its parent container element or any other elements contained within
+ var transitionTimeout, focusedRowActions;
+ $( 'td.post-title, td.title, td.comment, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap' ).focusin(function(){
+ clearTimeout( transitionTimeout );
+ focusedRowActions = $(this).find( '.row-actions' );
+ focusedRowActions.addClass( 'visible' );
+ }).focusout(function(){
+ // Tabbing between post title and .row-actions links needs a brief pause, otherwise
+ // the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
+ transitionTimeout = setTimeout(function(){
+ focusedRowActions.removeClass( 'visible' );
+ }, 30);
+ });
+
$('#default-password-nag-no').click( function() {
setUserSetting('default_password_nag', 'hide');
$('div.default-password-nag').hide();
});
}
+ $('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
+ $('select[name^="action"]').val('-1');
+ });
+
// Scroll into view when focused
$('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
if ( e.target.scrollIntoView )