1
var showNotice, adminMenu, columns;
1
var showNotice, adminMenu, columns, validateForm;
3
3
// sidebar admin menu
7
$('#adminmenu div.wp-menu-toggle').each( function() {
8
if ( $(this).siblings('.wp-submenu').length )
9
$(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
6
var menu = $('#adminmenu');
8
$('.wp-menu-toggle', menu).each( function() {
9
var t = $(this), sub = t.siblings('.wp-submenu');
11
t.click(function(){ adminMenu.toggle( sub ); });
16
$('a.separator').click(function(){
18
$('.separator', menu).click(function(){
17
19
if ( $('body').hasClass('folded') ) {
19
21
deleteUserSetting( 'mfold' );
27
if ( $('body').hasClass('folded') ) {
29
if ( $('body').hasClass('folded') )
30
32
this.restoreMenuState();
33
35
restoreMenuState : function() {
34
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
36
$('li.wp-has-submenu', '#adminmenu').each(function(i, e) {
35
37
var v = getUserSetting( 'm'+i );
36
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
38
if ( $(e).hasClass('wp-has-current-submenu') )
39
return true; // leave the current parent open
38
if ( 'o' == v ) $(e).addClass('wp-menu-open');
39
else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
42
$(e).addClass('wp-menu-open');
44
$(e).removeClass('wp-menu-open');
43
48
toggle : function(el) {
45
el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
47
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
48
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
49
setUserSetting( 'm'+i, v );
49
var id = el.slideToggle(150, function() {
51
}).parent().toggleClass( 'wp-menu-open' ).attr('id');
54
$('li.wp-has-submenu', '#adminmenu').each(function(i, e) {
56
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
57
setUserSetting( 'm'+i, v );
64
74
m = $(this).find('.wp-submenu');
65
b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
75
b = $(this).offset().top + m.height() + 1; // Bottom offset of the menu
66
76
h = $('#wpwrap').height(); // Height of the entire page
68
f = $(window).height() + $('body').scrollTop() - 15; // The fold
78
f = $(window).height() + $(window).scrollTop() - 15; // The fold
73
83
m.css({'marginTop':'-'+o+'px'});
74
84
} else if ( m.css('marginTop') ) {
75
85
m.css({'marginTop':''});
88
98
favorites : function() {
89
$('#favorite-inside').width($('#favorite-actions').width()-4);
90
$('#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) } );
92
$('#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) } );
99
$('#favorite-inside').width( $('#favorite-actions').width() - 4 );
100
$('#favorite-toggle, #favorite-inside').bind('mouseenter', function() {
101
$('#favorite-inside').removeClass('slideUp').addClass('slideDown');
102
setTimeout(function() {
103
if ( $('#favorite-inside').hasClass('slideDown') ) {
104
$('#favorite-inside').slideDown(100);
105
$('#favorite-first').addClass('slide-down');
108
}).bind('mouseleave', function() {
109
$('#favorite-inside').removeClass('slideDown').addClass('slideUp');
110
setTimeout(function() {
111
if ( $('#favorite-inside').hasClass('slideUp') ) {
112
$('#favorite-inside').slideUp(100, function() {
113
$('#favorite-first').removeClass('slide-down');
96
$(document).ready(function(){adminMenu.init();});
121
$(document).ready(function(){ adminMenu.init(); });
98
123
// show/hide/save table columns
100
125
init : function() {
101
$('.hide-column-tog').click( function() {
102
var column = $(this).val(), show = $(this).attr('checked');
126
$('.hide-column-tog', '#adv-settings').click( function() {
127
var column = $(this).val();
128
if ( $(this).attr('checked') )
104
129
$('.column-' + column).show();
106
131
$('.column-' + column).hide();
108
133
columns.save_manage_columns_state();
112
137
save_manage_columns_state : function() {
123
148
$(document).ready(function(){columns.init();});
150
validateForm = function( form ) {
151
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();
127
156
// stub for doing better warnings
143
172
jQuery(document).ready( function($) {
144
173
var lastClicked = false, checks, first, last, checked;
147
$('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
149
175
// Move .updated and .error alert boxes
150
$('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
151
$('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
154
$('#doaction, #doaction2').click(function(){
155
if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) {
156
return showNotice.warn();
176
$('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
177
$('div.updated, div.error').not('.below-h2').insertAfter( $('div.wrap h2:first') );
160
179
// screen settings tab
161
180
$('#show-settings-link').click(function () {
162
if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
181
if ( ! $('#screen-options-wrap').hasClass('screen-options-open') )
163
182
$('#contextual-help-link-wrap').css('visibility', 'hidden');
165
184
$('#screen-options-wrap').slideToggle('fast', function(){
166
185
if ( $(this).hasClass('screen-options-open') ) {
167
186
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
179
198
$('#contextual-help-link').click(function () {
180
if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
199
if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') )
181
200
$('#screen-options-link-wrap').css('visibility', 'hidden');
183
$('#contextual-help-wrap').slideToggle('fast', function(){
202
$('#contextual-help-wrap').slideToggle('fast', function() {
184
203
if ( $(this).hasClass('contextual-help-open') ) {
185
204
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
186
205
$('#screen-options-link-wrap').css('visibility', '');
195
$('#contextual-help-link-wrap, #screen-options-link-wrap').show();
197
215
// check all checkboxes
198
$( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
216
$('tbody').children().children('.check-column').find(':checkbox').click( function(e) {
199
217
if ( 'undefined' == e.shiftKey ) { return true; }
200
218
if ( e.shiftKey ) {
201
219
if ( !lastClicked ) { return true; }
202
checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
220
checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' );
203
221
first = checks.index( lastClicked );
204
222
last = checks.index( this );
205
223
checked = $(this).attr('checked');
206
224
if ( 0 < first && 0 < last && first != last ) {
207
225
checks.slice( first, last ).attr( 'checked', function(){
208
if ( $(this).parents('tr').is(':visible') )
226
if ( $(this).closest('tr').is(':visible') )
209
227
return checked ? 'checked' : '';
215
233
lastClicked = this;
218
$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
219
var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle;
222
$(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column :checkbox' ).attr( 'checked', function() {
223
if ( $(this).parents('tr').is(':hidden') )
237
$('thead, tfoot').find(':checkbox').click( function(e) {
238
var c = $(this).attr('checked'),
239
kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
240
toggle = e.shiftKey || kbtoggle;
242
$(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
243
.children().children('.check-column').find(':checkbox')
244
.attr('checked', function() {
245
if ( $(this).closest('tr').is(':hidden') )
226
248
return $(this).attr( 'checked' ) ? '' : 'checked';
228
250
return 'checked';
231
$(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
254
$(this).closest('table').children('thead, tfoot').filter(':visible')
255
.children().children('.check-column').find(':checkbox')
256
.attr('checked', function() {
239
265
$('#default-password-nag-no').click( function() {
240
266
setUserSetting('default_password_nag', 'hide');
241
267
$('div.default-password-nag').hide();
248
272
jQuery(document).ready( function($){
249
var turboNag = $('.turbo-nag');
273
var turboNag = $('span.turbo-nag', '#user_info');
251
275
if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) )