2008-10-14 07:10:16 +02:00
|
|
|
(function($){
|
|
|
|
|
|
|
|
adminMenu = {
|
|
|
|
|
|
|
|
init : function() {
|
2008-10-15 08:54:25 +02:00
|
|
|
$('#adminmenu a').attr('tabindex', '10');
|
2008-10-24 00:19:19 +02:00
|
|
|
$('#adminmenu div.wp-menu-toggle').click( function() { return adminMenu.toggle( $(this).siblings('ul') ); } );
|
2008-10-29 04:22:42 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu img.wp-menu-image').dblclick( function() { window.location = $(this).siblings('a.wp-has-submenu')[0].href; } );
|
2008-10-24 00:19:19 +02:00
|
|
|
|
|
|
|
$('.wp-menu-separator').click(function(){
|
|
|
|
if ( $('#adminmenu').hasClass('folded') ) {
|
2008-10-14 07:10:16 +02:00
|
|
|
adminMenu.fold(1);
|
|
|
|
setUserSetting( 'mfold', 'o' );
|
2008-10-24 00:19:19 +02:00
|
|
|
} else {
|
|
|
|
adminMenu.fold();
|
|
|
|
setUserSetting( 'mfold', 'f' );
|
2008-10-14 07:10:16 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-10-28 09:32:56 +01:00
|
|
|
if ( 'f' != getUserSetting( 'mfold' ) ) {
|
|
|
|
this.restoreMenuState();
|
2008-10-14 07:10:16 +02:00
|
|
|
} else {
|
|
|
|
this.fold();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2008-10-28 09:32:56 +01:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2008-10-14 07:10:16 +02:00
|
|
|
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) {
|
|
|
|
$('#adminmenu').removeClass('folded');
|
2008-10-16 12:32:26 +02:00
|
|
|
$('#adminmenu li.wp-submenu-head').hide();
|
2008-10-28 09:32:56 +01:00
|
|
|
$('#adminmenu a.wp-has-submenu, #adminmenu .wp-menu-open .wp-submenu, #adminmenu div.wp-menu-toggle').show();
|
2008-10-15 08:54:25 +02:00
|
|
|
$('#adminmenu li.wp-has-submenu').unbind().css('width', '');
|
2008-10-28 09:32:56 +01:00
|
|
|
this.restoreMenuState();
|
2008-10-14 07:10:16 +02:00
|
|
|
} else {
|
|
|
|
$('#adminmenu').addClass('folded');
|
2008-10-24 00:19:19 +02:00
|
|
|
$('#adminmenu a.wp-has-submenu, #adminmenu .wp-submenu, #adminmenu div.wp-menu-toggle').hide();
|
2008-10-16 12:32:26 +02:00
|
|
|
$('#adminmenu li.wp-submenu-head').show();
|
2008-10-24 00:19:19 +02:00
|
|
|
$('#adminmenu li.wp-has-submenu').css({'width':'28px'}).hoverIntent({
|
2008-10-30 10:52:20 +01:00
|
|
|
over: function(e){
|
|
|
|
var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;
|
|
|
|
|
|
|
|
if ( (t+h+10) > H ) {
|
|
|
|
o = (t+h+10) - H;
|
|
|
|
m.css({'marginTop':'-'+o+'px'})
|
|
|
|
}
|
|
|
|
m.show();
|
|
|
|
},
|
2008-10-15 08:54:25 +02:00
|
|
|
out: function(){ $(this).find('.wp-submenu').hide(); },
|
|
|
|
timeout: 220,
|
|
|
|
sensitivity: 8,
|
2008-10-14 07:10:16 +02:00
|
|
|
interval: 100
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-10-18 18:54:14 +02:00
|
|
|
$(document).ready(function(){
|
|
|
|
adminMenu.init();
|
|
|
|
|
2008-10-23 00:08:58 +02:00
|
|
|
$('#favorite-inside').width($('#favorite-actions').width()-4);
|
2008-10-18 18:54:14 +02: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 07:10:16 +02:00
|
|
|
|
2008-10-18 18:54:14 +02: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);
|