1 var showNotice, adminMenu, columns;
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') ); });
16 $('a.separator').click(function(){
17 if ( $('body').hasClass('folded') ) {
19 deleteUserSetting( 'mfold' );
22 setUserSetting( 'mfold', 'f' );
27 if ( $('body').hasClass('folded') ) {
30 this.restoreMenuState();
33 restoreMenuState : function() {
34 $('#adminmenu li.wp-has-submenu').each(function(i, e) {
35 var v = getUserSetting( 'm'+i );
36 if ( $(e).hasClass('wp-has-current-submenu') ) 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');
43 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 );
55 fold : function(off) {
57 $('body').removeClass('folded');
58 $('#adminmenu li.wp-has-submenu').unbind();
60 $('body').addClass('folded');
61 $('#adminmenu li.wp-has-submenu').hoverIntent({
64 m = $(this).find('.wp-submenu');
65 b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
66 h = $('#wpwrap').height(); // Height of the entire page
68 f = $(window).height() + $('body').scrollTop() - 15; // The fold
73 m.css({'marginTop':'-'+o+'px'});
74 } else if ( m.css('marginTop') ) {
75 m.css({'marginTop':''});
77 m.addClass('sub-open');
79 out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
88 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) } );
96 $(document).ready(function(){adminMenu.init();});
98 // show/hide/save table columns
101 $('.hide-column-tog').click( function() {
102 var column = $(this).val(), show = $(this).attr('checked');
104 $('.column-' + column).show();
106 $('.column-' + column).hide();
108 columns.save_manage_columns_state();
112 save_manage_columns_state : function() {
113 var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
115 action: 'hidden-columns',
117 screenoptionnonce: $('#screenoptionnonce').val(),
123 $(document).ready(function(){columns.init();});
127 // stub for doing better warnings
130 var msg = commonL10n.warnDelete || '';
131 if ( confirm(msg) ) {
138 note : function(text) {
143 jQuery(document).ready( function($) {
144 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 // 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();
160 // screen settings tab
161 $('#show-settings-link').click(function () {
162 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
163 $('#contextual-help-link-wrap').css('visibility', 'hidden');
165 $('#screen-options-wrap').slideToggle('fast', function(){
166 if ( $(this).hasClass('screen-options-open') ) {
167 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
168 $('#contextual-help-link-wrap').css('visibility', '');
169 $(this).removeClass('screen-options-open');
171 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
172 $(this).addClass('screen-options-open');
179 $('#contextual-help-link').click(function () {
180 if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
181 $('#screen-options-link-wrap').css('visibility', 'hidden');
183 $('#contextual-help-wrap').slideToggle('fast', function(){
184 if ( $(this).hasClass('contextual-help-open') ) {
185 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
186 $('#screen-options-link-wrap').css('visibility', '');
187 $(this).removeClass('contextual-help-open');
189 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
190 $(this).addClass('contextual-help-open');
195 $('#contextual-help-link-wrap, #screen-options-link-wrap').show();
197 // check all checkboxes
198 $( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
199 if ( 'undefined' == e.shiftKey ) { return true; }
201 if ( !lastClicked ) { return true; }
202 checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
203 first = checks.index( lastClicked );
204 last = checks.index( this );
205 checked = $(this).attr('checked');
206 if ( 0 < first && 0 < last && first != last ) {
207 checks.slice( first, last ).attr( 'checked', function(){
208 if ( $(this).parents('tr').is(':visible') )
209 return checked ? 'checked' : '';
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') )
226 return $(this).attr( 'checked' ) ? '' : 'checked';
231 $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
239 $('#default-password-nag-no').click( function() {
240 setUserSetting('default_password_nag', 'hide');
241 $('div.default-password-nag').hide();
248 jQuery(document).ready( function($){
249 var turboNag = $('.turbo-nag');
251 if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) )
254 if ( 'undefined' != typeof GearsFactory ) {
258 if ( ( 'undefined' != typeof window.ActiveXObject && ActiveXObject('Gears.Factory') ) ||
259 ( 'undefined' != typeof navigator.mimeTypes && navigator.mimeTypes['application/x-googlegears'] ) ) {