]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/common.js
WordPress 3.7-scripts
[autoinstalls/wordpress.git] / wp-admin / js / common.js
index b1327f9973dd2fad6f41cb5d8dadb7b8e90b764e..822af979da8ac6db6e21cc98165f560c9afc22da 100644 (file)
@@ -160,7 +160,7 @@ $('.contextual-help-tabs').delegate('a', 'click focus', function(e) {
 });
 
 $(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
@@ -185,15 +185,15 @@ $(document).ready( function() {
                        if ( body.hasClass('auto-fold') ) {
                                body.removeClass('auto-fold').removeClass('folded');
                                setUserSetting('unfold', 1);
-                               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');
@@ -286,7 +286,8 @@ $(document).ready( function() {
                        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;
 
@@ -333,6 +334,20 @@ $(document).ready( function() {
                });
        });
 
+       // 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();
@@ -395,6 +410,10 @@ $(document).ready( function() {
                });
        }
 
+       $('.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 )