]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/common.dev.js
WordPress 3.4
[autoinstalls/wordpress.git] / wp-admin / js / common.dev.js
index 4918f1f77bda71c06e8cfdeef6d7f8322243a807..4c87a877fada057be4035999f1267b2d12f35680 100644 (file)
@@ -1,4 +1,4 @@
-var showNotice, adminMenu, columns, validateForm, screenMeta, autofold_menu;
+var showNotice, adminMenu, columns, validateForm, screenMeta;
 (function($){
 // Removed in 3.3.
 // (perhaps) needed for back-compat
@@ -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'),
-               pageInput = $('input.current-page'), currentPage = pageInput.val(), folded, refresh;
+               pageInput = $('input.current-page'), currentPage = pageInput.val(), refresh;
 
        // admin menu
        refresh = function(i, el){ // force the browser to refresh the tabbing index
@@ -172,6 +172,9 @@ $(document).ready( function() {
        $('#collapse-menu', menu).click(function(){
                var body = $(document.body);
 
+               // reset any compensation for submenus near the bottom of the screen
+               $('#adminmenu div.wp-submenu').css('margin-top', '');
+
                if ( body.hasClass('folded') ) {
                        body.removeClass('folded');
                        setUserSetting('mfold', 'o');
@@ -186,7 +189,7 @@ $(document).ready( function() {
                over: function(e){
                        var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop;
 
-                       if ( !$(document.body).hasClass('folded') && $(this).hasClass('wp-menu-open') )
+                       if ( m.is(':visible') )
                                return;
 
                        menutop = $(this).offset().top;
@@ -205,9 +208,9 @@ $(document).ready( function() {
                                o = maxtop;
 
                        if ( o > 1 )
-                               m.css({'marginTop':'-'+o+'px'});
-                       else if ( m.css('marginTop') )
-                               m.css({'marginTop':''});
+                               m.css('margin-top', '-'+o+'px');
+                       else
+                               m.css('margin-top', '');
 
                        menu.find('.wp-submenu').removeClass('sub-open');
                        m.addClass('sub-open');
@@ -317,7 +320,7 @@ $(document).ready( function() {
                var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
 
                try {
-                       this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event.  See blur handler below.
+                       this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below.
                } catch(err) {}
 
                if ( document.selection ) {
@@ -351,28 +354,6 @@ $(document).ready( function() {
                });
        }
 
-       // auto-fold the menu when screen is under 800px
-       $(window).bind('resize.autofold', function(){
-               if ( getUserSetting('mfold') == 'f' )
-                       return;
-
-               var width = $(window).width();
-
-               // fold admin menu
-               if ( width <= 800 ) {
-                       if ( !folded ) {
-                               $(document.body).addClass('folded');
-                               folded = true;
-                       }
-               } else {
-                       if ( folded ) {
-                               $(document.body).removeClass('folded');
-                               folded = false;
-                       }
-               }
-
-       }).triggerHandler('resize');
-
 });
 
 // internal use