2008-10-14 01:10:16 -04:00
|
|
|
(function($){
|
|
|
|
|
|
|
|
adminMenu = {
|
|
|
|
|
|
|
|
init : function() {
|
2008-10-15 02:54:25 -04:00
|
|
|
$('#adminmenu a').attr('tabindex', '10');
|
2008-10-14 01:10:16 -04:00
|
|
|
$('#adminmenu a.wp-has-submenu').click( function() { return adminMenu.toggle( $(this).siblings('ul') ); } );
|
2008-10-16 06:32:26 -04:00
|
|
|
$('#adminmenu li.wp-has-submenu img.wp-menu-image').dblclick( function() { window.location = $(this).siblings('a.wp-has-submenu')[0].href; } );
|
2008-10-14 01:10:16 -04:00
|
|
|
|
|
|
|
var li = document.createElement('li'); // temp
|
|
|
|
$(li).attr('id', 'menu-toggle').html('««').click(function(){
|
|
|
|
if ( 'o' == getUserSetting( 'mfold' ) ) {
|
|
|
|
adminMenu.fold();
|
|
|
|
setUserSetting( 'mfold', 'f' );
|
|
|
|
$(this).html('»»');
|
|
|
|
} else {
|
|
|
|
adminMenu.fold(1);
|
|
|
|
setUserSetting( 'mfold', 'o' );
|
|
|
|
$(this).html('««');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#adminmenu').prepend(li);
|
|
|
|
|
|
|
|
if ( 'o' == getUserSetting( 'mfold' ) ) {
|
|
|
|
$('#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');
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.fold();
|
|
|
|
$('#menu-toggle').html('»»');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle : function(ul, effect) {
|
|
|
|
if ( !effect )
|
|
|
|
effect = 'slideToggle';
|
|
|
|
|
|
|
|
ul[effect](150).parent().toggleClass( 'wp-menu-open' );
|
|
|
|
|
|
|
|
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
|
|
|
|
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
|
|
|
|
setUserSetting( 'm'+i, v );
|
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
fold : function(off) {
|
|
|
|
if (off) {
|
2008-10-22 18:08:58 -04:00
|
|
|
if ( $.browser.msie && $.browser.version.charAt(0) == 6 )
|
|
|
|
$('#wpbody-content').css('marginLeft', '140px');
|
2008-10-14 01:10:16 -04:00
|
|
|
$('#adminmenu').removeClass('folded');
|
2008-10-16 06:32:26 -04:00
|
|
|
$('#adminmenu li.wp-submenu-head').hide();
|
2008-10-15 02:54:25 -04:00
|
|
|
$('#adminmenu a.wp-has-submenu').show();
|
|
|
|
$('#adminmenu li.wp-has-submenu').unbind().css('width', '');
|
2008-10-14 01:10:16 -04:00
|
|
|
} else {
|
|
|
|
$('#adminmenu').addClass('folded');
|
2008-10-16 06:32:26 -04:00
|
|
|
$('#adminmenu a.wp-has-submenu, #adminmenu .wp-submenu').hide();
|
|
|
|
$('#adminmenu li.wp-submenu-head').show();
|
2008-10-22 18:08:58 -04:00
|
|
|
if ( $.browser.msie && $.browser.version.charAt(0) == 6 )
|
|
|
|
$('#wpbody-content').css('marginLeft', '40px');
|
2008-10-14 01:10:16 -04:00
|
|
|
$('#adminmenu li.wp-has-submenu').css({'width':'24px'}).hoverIntent({
|
2008-10-15 02:54:25 -04:00
|
|
|
over: function(){ $(this).find('.wp-submenu').show(); },
|
|
|
|
out: function(){ $(this).find('.wp-submenu').hide(); },
|
|
|
|
timeout: 220,
|
|
|
|
sensitivity: 8,
|
2008-10-14 01:10:16 -04:00
|
|
|
interval: 100
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-10-18 12:54:14 -04:00
|
|
|
$(document).ready(function(){
|
|
|
|
adminMenu.init();
|
|
|
|
|
2008-10-22 18:08:58 -04:00
|
|
|
$('#favorite-inside').width($('#favorite-actions').width()-4);
|
2008-10-18 12:54:14 -04:00
|
|
|
$('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );
|
2008-10-14 01:10:16 -04:00
|
|
|
|
2008-10-18 12:54:14 -04:00
|
|
|
$('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
|
|
|
|
});
|
|
|
|
})(jQuery);
|