2009-07-01 10:12:39 +02:00
|
|
|
var showNotice, adminMenu, columns, validateForm;
|
2009-01-12 14:43:17 +01:00
|
|
|
(function($){
|
|
|
|
// sidebar admin menu
|
|
|
|
adminMenu = {
|
|
|
|
init : function() {
|
2009-08-18 11:53:37 +02:00
|
|
|
var menu = $('#adminmenu');
|
|
|
|
|
|
|
|
$('.wp-menu-toggle', menu).each( function() {
|
|
|
|
var t = $(this), sub = t.siblings('.wp-submenu');
|
|
|
|
if ( sub.length )
|
|
|
|
t.click(function(){ adminMenu.toggle( sub ); });
|
2009-01-12 14:43:17 +01:00
|
|
|
else
|
2009-08-18 11:53:37 +02:00
|
|
|
t.hide();
|
2009-01-12 14:43:17 +01:00
|
|
|
});
|
2009-08-18 11:53:37 +02:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
this.favorites();
|
2009-08-18 11:53:37 +02:00
|
|
|
|
|
|
|
$('.separator', menu).click(function(){
|
2009-04-04 19:07:31 +02:00
|
|
|
if ( $('body').hasClass('folded') ) {
|
2009-01-12 14:43:17 +01:00
|
|
|
adminMenu.fold(1);
|
2009-04-29 07:43:03 +02:00
|
|
|
deleteUserSetting( 'mfold' );
|
2009-01-12 14:43:17 +01:00
|
|
|
} else {
|
|
|
|
adminMenu.fold();
|
|
|
|
setUserSetting( 'mfold', 'f' );
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
2009-04-29 07:43:03 +02:00
|
|
|
return false;
|
2009-01-12 14:43:17 +01:00
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( $('body').hasClass('folded') )
|
2009-01-12 14:43:17 +01:00
|
|
|
this.fold();
|
2009-08-18 11:53:37 +02:00
|
|
|
|
2009-05-29 09:42:55 +02:00
|
|
|
this.restoreMenuState();
|
2009-01-02 16:08:58 +01:00
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
restoreMenuState : function() {
|
2009-08-18 11:53:37 +02:00
|
|
|
$('li.wp-has-submenu', '#adminmenu').each(function(i, e) {
|
2009-01-12 14:43:17 +01:00
|
|
|
var v = getUserSetting( 'm'+i );
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( $(e).hasClass('wp-has-current-submenu') )
|
|
|
|
return true; // leave the current parent open
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( 'o' == v )
|
|
|
|
$(e).addClass('wp-menu-open');
|
|
|
|
else if ( 'c' == v )
|
|
|
|
$(e).removeClass('wp-menu-open');
|
2009-01-02 16:08:58 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
toggle : function(el) {
|
2009-08-18 11:53:37 +02:00
|
|
|
el['slideToggle'](150, function() {
|
|
|
|
el.css('display','');
|
|
|
|
}).parent().toggleClass( 'wp-menu-open' );
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-08-18 11:53:37 +02:00
|
|
|
$('.wp-has-submenu', '#adminmenu').each(function(i, e) {
|
2009-01-12 14:43:17 +01:00
|
|
|
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
|
|
|
|
setUserSetting( 'm'+i, v );
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
return false;
|
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
fold : function(off) {
|
|
|
|
if (off) {
|
2009-04-04 19:07:31 +02:00
|
|
|
$('body').removeClass('folded');
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu').unbind();
|
|
|
|
} else {
|
2009-04-04 19:07:31 +02:00
|
|
|
$('body').addClass('folded');
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu').hoverIntent({
|
|
|
|
over: function(e){
|
2009-05-29 09:42:55 +02:00
|
|
|
var m, b, h, o, f;
|
|
|
|
m = $(this).find('.wp-submenu');
|
2009-08-18 11:53:37 +02:00
|
|
|
b = $(this).offset().top + m.height() + 1; // Bottom offset of the menu
|
2009-05-29 09:42:55 +02:00
|
|
|
h = $('#wpwrap').height(); // Height of the entire page
|
|
|
|
o = 60 + b - h;
|
2009-08-18 11:53:37 +02:00
|
|
|
f = $(window).height() + $(window).scrollTop() - 15; // The fold
|
|
|
|
if ( f < (b - o) ) {
|
2009-05-29 09:42:55 +02:00
|
|
|
o = b - f;
|
|
|
|
}
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( o > 1 ) {
|
2009-01-12 14:43:17 +01:00
|
|
|
m.css({'marginTop':'-'+o+'px'});
|
|
|
|
} else if ( m.css('marginTop') ) {
|
|
|
|
m.css({'marginTop':''});
|
|
|
|
}
|
|
|
|
m.addClass('sub-open');
|
|
|
|
},
|
|
|
|
out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
|
|
|
|
timeout: 220,
|
|
|
|
sensitivity: 8,
|
|
|
|
interval: 100
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
favorites : function() {
|
2009-08-18 11:53:37 +02:00
|
|
|
$('#favorite-inside').width( $('#favorite-actions').width() - 4 );
|
|
|
|
$('#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);
|
|
|
|
}).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);
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-08-18 11:53:37 +02:00
|
|
|
$(document).ready(function(){ adminMenu.init(); });
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
// show/hide/save table columns
|
|
|
|
columns = {
|
|
|
|
init : function() {
|
2009-08-18 11:53:37 +02:00
|
|
|
$('.hide-column-tog', '#adv-settings').click( function() {
|
|
|
|
var column = $(this).val();
|
|
|
|
if ( $(this).attr('checked') )
|
2009-01-12 14:43:17 +01:00
|
|
|
$('.column-' + column).show();
|
2009-08-18 11:53:37 +02:00
|
|
|
else
|
2009-01-12 14:43:17 +01:00
|
|
|
$('.column-' + column).hide();
|
2009-08-18 11:53:37 +02:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
columns.save_manage_columns_state();
|
2009-08-18 11:53:37 +02:00
|
|
|
});
|
2009-01-12 14:43:17 +01:00
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
save_manage_columns_state : function() {
|
|
|
|
var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
|
|
|
|
$.post(ajaxurl, {
|
|
|
|
action: 'hidden-columns',
|
|
|
|
hidden: hidden,
|
2009-04-05 10:25:10 +02:00
|
|
|
screenoptionnonce: $('#screenoptionnonce').val(),
|
2009-01-12 14:43:17 +01:00
|
|
|
page: pagenow
|
|
|
|
});
|
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
2009-03-27 23:47:47 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$(document).ready(function(){columns.init();});
|
2009-03-27 23:47:47 +01:00
|
|
|
|
2009-07-01 10:12:39 +02:00
|
|
|
validateForm = function( form ) {
|
2009-11-19 11:24:14 +01:00
|
|
|
return !$( form ).find('.form-required').filter( function() { return $('input:visible', this).val() == ''; } ).addClass( 'form-invalid' ).find('input:visible').change( function() { $(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ).size();
|
2009-07-01 10:12:39 +02:00
|
|
|
}
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
})(jQuery);
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
// stub for doing better warnings
|
|
|
|
showNotice = {
|
|
|
|
warn : function() {
|
|
|
|
var msg = commonL10n.warnDelete || '';
|
|
|
|
if ( confirm(msg) ) {
|
|
|
|
return true;
|
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
return false;
|
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
note : function(text) {
|
|
|
|
alert(text);
|
|
|
|
}
|
|
|
|
};
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
jQuery(document).ready( function($) {
|
|
|
|
var lastClicked = false, checks, first, last, checked;
|
2009-05-25 01:47:49 +02:00
|
|
|
|
2009-01-02 16:08:58 +01:00
|
|
|
// pulse
|
2009-08-18 11:53:37 +02:00
|
|
|
$('div.fade').animate( { opacity: .5 }, 400)
|
|
|
|
.animate( { opacity: 1 }, 400)
|
|
|
|
.animate( { opacity: .5 }, 400)
|
|
|
|
.animate( { opacity: 1 }, 400);
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
// Move .updated and .error alert boxes
|
2009-08-21 03:03:26 +02:00
|
|
|
$('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
|
|
|
|
$('div.updated, div.error').not('.below-h2').insertAfter( $('div.wrap h2:first') );
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
// screen settings tab
|
|
|
|
$('#show-settings-link').click(function () {
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( ! $('#screen-options-wrap').hasClass('screen-options-open') )
|
2009-05-18 07:10:50 +02:00
|
|
|
$('#contextual-help-link-wrap').css('visibility', 'hidden');
|
2009-08-18 11:53:37 +02:00
|
|
|
|
2009-01-02 16:08:58 +01:00
|
|
|
$('#screen-options-wrap').slideToggle('fast', function(){
|
|
|
|
if ( $(this).hasClass('screen-options-open') ) {
|
|
|
|
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
|
2009-05-18 07:10:50 +02:00
|
|
|
$('#contextual-help-link-wrap').css('visibility', '');
|
2009-01-02 16:08:58 +01:00
|
|
|
$(this).removeClass('screen-options-open');
|
|
|
|
} else {
|
|
|
|
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
|
|
|
|
$(this).addClass('screen-options-open');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
// help tab
|
|
|
|
$('#contextual-help-link').click(function () {
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') )
|
2009-05-18 07:10:50 +02:00
|
|
|
$('#screen-options-link-wrap').css('visibility', 'hidden');
|
2009-08-18 11:53:37 +02:00
|
|
|
|
|
|
|
$('#contextual-help-wrap').slideToggle('fast', function() {
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( $(this).hasClass('contextual-help-open') ) {
|
|
|
|
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
|
2009-05-18 07:10:50 +02:00
|
|
|
$('#screen-options-link-wrap').css('visibility', '');
|
2009-01-02 16:08:58 +01:00
|
|
|
$(this).removeClass('contextual-help-open');
|
|
|
|
} else {
|
|
|
|
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
|
|
|
|
$(this).addClass('contextual-help-open');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
// check all checkboxes
|
2009-08-18 11:53:37 +02:00
|
|
|
$('tbody').children().children('.check-column').find(':checkbox').click( function(e) {
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( 'undefined' == e.shiftKey ) { return true; }
|
|
|
|
if ( e.shiftKey ) {
|
|
|
|
if ( !lastClicked ) { return true; }
|
2009-08-18 11:53:37 +02:00
|
|
|
checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' );
|
2009-01-02 16:08:58 +01:00
|
|
|
first = checks.index( lastClicked );
|
|
|
|
last = checks.index( this );
|
|
|
|
checked = $(this).attr('checked');
|
|
|
|
if ( 0 < first && 0 < last && first != last ) {
|
|
|
|
checks.slice( first, last ).attr( 'checked', function(){
|
2009-08-18 11:53:37 +02:00
|
|
|
if ( $(this).closest('tr').is(':visible') )
|
2009-01-02 16:08:58 +01:00
|
|
|
return checked ? 'checked' : '';
|
|
|
|
|
|
|
|
return '';
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lastClicked = this;
|
|
|
|
return true;
|
2009-08-18 11:53:37 +02:00
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-08-18 11:53:37 +02:00
|
|
|
$('thead, tfoot').find(':checkbox').click( function(e) {
|
|
|
|
var c = $(this).attr('checked'),
|
|
|
|
kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
|
|
|
|
toggle = e.shiftKey || kbtoggle;
|
|
|
|
|
|
|
|
$(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
|
|
|
|
.children().children('.check-column').find(':checkbox')
|
|
|
|
.attr('checked', function() {
|
|
|
|
if ( $(this).closest('tr').is(':hidden') )
|
2009-01-02 16:08:58 +01:00
|
|
|
return '';
|
|
|
|
if ( toggle )
|
|
|
|
return $(this).attr( 'checked' ) ? '' : 'checked';
|
|
|
|
else if (c)
|
|
|
|
return 'checked';
|
|
|
|
return '';
|
|
|
|
});
|
2009-08-18 11:53:37 +02:00
|
|
|
|
|
|
|
$(this).closest('table').children('thead, tfoot').filter(':visible')
|
|
|
|
.children().children('.check-column').find(':checkbox')
|
|
|
|
.attr('checked', function() {
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( toggle )
|
|
|
|
return '';
|
|
|
|
else if (c)
|
|
|
|
return 'checked';
|
|
|
|
return '';
|
|
|
|
});
|
|
|
|
});
|
2009-08-18 11:53:37 +02:00
|
|
|
|
2009-05-03 19:06:29 +02:00
|
|
|
$('#default-password-nag-no').click( function() {
|
|
|
|
setUserSetting('default_password_nag', 'hide');
|
|
|
|
$('div.default-password-nag').hide();
|
|
|
|
return false;
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
});
|
|
|
|
|
2009-06-10 04:52:16 +02:00
|
|
|
jQuery(document).ready( function($){
|
2009-08-18 11:53:37 +02:00
|
|
|
var turboNag = $('span.turbo-nag', '#user_info');
|
2009-06-10 04:52:16 +02:00
|
|
|
|
|
|
|
if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) )
|
|
|
|
return;
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
if ( 'undefined' != typeof GearsFactory ) {
|
2009-06-10 04:52:16 +02:00
|
|
|
return;
|
2009-01-02 16:08:58 +01:00
|
|
|
} else {
|
|
|
|
try {
|
2009-06-10 04:52:16 +02:00
|
|
|
if ( ( 'undefined' != typeof window.ActiveXObject && ActiveXObject('Gears.Factory') ) ||
|
|
|
|
( 'undefined' != typeof navigator.mimeTypes && navigator.mimeTypes['application/x-googlegears'] ) ) {
|
|
|
|
return;
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
2009-05-14 19:01:04 +02:00
|
|
|
} catch(e){}
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
|
|
|
|
2009-06-10 04:52:16 +02:00
|
|
|
turboNag.show();
|
|
|
|
});
|