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:
parent
ea002ede30
commit
a3b0a3190d
|
@ -17,19 +17,23 @@ adminMenu = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( 'o' == getUserSetting( 'mfold' ) ) {
|
if ( 'f' != getUserSetting( 'mfold' ) ) {
|
||||||
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
|
this.restoreMenuState();
|
||||||
var v = getUserSetting( 'm'+i );
|
|
||||||
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
|
|
||||||
|
|
||||||
if ( 'o' == v ) $(e).addClass('wp-menu-open');
|
|
||||||
else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.fold();
|
this.fold();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
restoreMenuState : function() {
|
||||||
|
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
|
||||||
|
var v = getUserSetting( 'm'+i );
|
||||||
|
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
|
||||||
|
|
||||||
|
if ( 'o' == v ) $(e).addClass('wp-menu-open');
|
||||||
|
else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
toggle : function(ul, effect) {
|
toggle : function(ul, effect) {
|
||||||
if ( !effect )
|
if ( !effect )
|
||||||
effect = 'slideToggle';
|
effect = 'slideToggle';
|
||||||
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue