Default to having the menu open, not folded. Remember individual menu states when folding/unfolding.

git-svn-id: http://svn.automattic.com/wordpress/trunk@9381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-10-28 08:32:56 +00:00
parent ea002ede30
commit a3b0a3190d
1 changed files with 14 additions and 9 deletions

View File

@ -17,7 +17,14 @@ adminMenu = {
} }
}); });
if ( 'o' == getUserSetting( 'mfold' ) ) { if ( 'f' != getUserSetting( 'mfold' ) ) {
this.restoreMenuState();
} else {
this.fold();
}
},
restoreMenuState : function() {
$('#adminmenu li.wp-has-submenu').each(function(i, e) { $('#adminmenu li.wp-has-submenu').each(function(i, e) {
var v = getUserSetting( 'm'+i ); var v = getUserSetting( 'm'+i );
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
@ -25,9 +32,6 @@ adminMenu = {
if ( 'o' == v ) $(e).addClass('wp-menu-open'); if ( 'o' == v ) $(e).addClass('wp-menu-open');
else if ( 'c' == v ) $(e).removeClass('wp-menu-open'); else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
}); });
} else {
this.fold();
}
}, },
toggle : function(ul, effect) { toggle : function(ul, effect) {
@ -50,9 +54,10 @@ adminMenu = {
$('#wpbody-content').css('marginLeft', '180px'); $('#wpbody-content').css('marginLeft', '180px');
$('#adminmenu').removeClass('folded'); $('#adminmenu').removeClass('folded');
$('#adminmenu li.wp-submenu-head').hide(); $('#adminmenu li.wp-submenu-head').hide();
$('#adminmenu a.wp-has-submenu, #adminmenu div.wp-menu-toggle').show(); $('#adminmenu a.wp-has-submenu, #adminmenu .wp-menu-open .wp-submenu, #adminmenu div.wp-menu-toggle').show();
$('#adminmenu li.wp-has-submenu').unbind().css('width', ''); $('#adminmenu li.wp-has-submenu').unbind().css('width', '');
$('#adminmenu li.wp-has-submenu img.wp-menu-image').unbind().dblclick( function() { adminMenu.fold(); } ); $('#adminmenu li.wp-has-submenu img.wp-menu-image').unbind().dblclick( function() { adminMenu.fold(); } );
this.restoreMenuState();
} else { } else {
$('#adminmenu').addClass('folded'); $('#adminmenu').addClass('folded');
$('#adminmenu a.wp-has-submenu, #adminmenu .wp-submenu, #adminmenu div.wp-menu-toggle').hide(); $('#adminmenu a.wp-has-submenu, #adminmenu .wp-submenu, #adminmenu div.wp-menu-toggle').hide();