| [ Index ] |
PHP Cross Reference of Wordpress 2.9.1 |
[Summary view] [Print] [Text view]
1 var showNotice, adminMenu, columns, validateForm; 2 (function($){ 3 // sidebar admin menu 4 adminMenu = { 5 init : function() { 6 var menu = $('#adminmenu'); 7 8 $('.wp-menu-toggle', menu).each( function() { 9 var t = $(this), sub = t.siblings('.wp-submenu'); 10 if ( sub.length ) 11 t.click(function(){ adminMenu.toggle( sub ); }); 12 else 13 t.hide(); 14 }); 15 16 this.favorites(); 17 18 $('.separator', menu).click(function(){ 19 if ( $('body').hasClass('folded') ) { 20 adminMenu.fold(1); 21 deleteUserSetting( 'mfold' ); 22 } else { 23 adminMenu.fold(); 24 setUserSetting( 'mfold', 'f' ); 25 } 26 return false; 27 }); 28 29 if ( $('body').hasClass('folded') ) 30 this.fold(); 31 32 this.restoreMenuState(); 33 }, 34 35 restoreMenuState : function() { 36 $('li.wp-has-submenu', '#adminmenu').each(function(i, e) { 37 var v = getUserSetting( 'm'+i ); 38 if ( $(e).hasClass('wp-has-current-submenu') ) 39 return true; // leave the current parent open 40 41 if ( 'o' == v ) 42 $(e).addClass('wp-menu-open'); 43 else if ( 'c' == v ) 44 $(e).removeClass('wp-menu-open'); 45 }); 46 }, 47 48 toggle : function(el) { 49 var id = el.slideToggle(150, function() { 50 el.css('display',''); 51 }).parent().toggleClass( 'wp-menu-open' ).attr('id'); 52 53 if ( id ) { 54 $('li.wp-has-submenu', '#adminmenu').each(function(i, e) { 55 if ( id == e.id ) { 56 var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c'; 57 setUserSetting( 'm'+i, v ); 58 } 59 }); 60 } 61 62 return false; 63 }, 64 65 fold : function(off) { 66 if (off) { 67 $('body').removeClass('folded'); 68 $('#adminmenu li.wp-has-submenu').unbind(); 69 } else { 70 $('body').addClass('folded'); 71 $('#adminmenu li.wp-has-submenu').hoverIntent({ 72 over: function(e){ 73 var m, b, h, o, f; 74 m = $(this).find('.wp-submenu'); 75 b = $(this).offset().top + m.height() + 1; // Bottom offset of the menu 76 h = $('#wpwrap').height(); // Height of the entire page 77 o = 60 + b - h; 78 f = $(window).height() + $(window).scrollTop() - 15; // The fold 79 if ( f < (b - o) ) { 80 o = b - f; 81 } 82 if ( o > 1 ) { 83 m.css({'marginTop':'-'+o+'px'}); 84 } else if ( m.css('marginTop') ) { 85 m.css({'marginTop':''}); 86 } 87 m.addClass('sub-open'); 88 }, 89 out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); }, 90 timeout: 220, 91 sensitivity: 8, 92 interval: 100 93 }); 94 95 } 96 }, 97 98 favorites : function() { 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'); 106 } 107 }, 200); 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'); 114 }); 115 } 116 }, 300); 117 }); 118 } 119 }; 120 121 $(document).ready(function(){ adminMenu.init(); }); 122 123 // show/hide/save table columns 124 columns = { 125 init : function() { 126 $('.hide-column-tog', '#adv-settings').click( function() { 127 var column = $(this).val(); 128 if ( $(this).attr('checked') ) 129 $('.column-' + column).show(); 130 else 131 $('.column-' + column).hide(); 132 133 columns.save_manage_columns_state(); 134 }); 135 }, 136 137 save_manage_columns_state : function() { 138 var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(','); 139 $.post(ajaxurl, { 140 action: 'hidden-columns', 141 hidden: hidden, 142 screenoptionnonce: $('#screenoptionnonce').val(), 143 page: pagenow 144 }); 145 } 146 } 147 148 $(document).ready(function(){columns.init();}); 149 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(); 152 } 153 154 })(jQuery); 155 156 // stub for doing better warnings 157 showNotice = { 158 warn : function() { 159 var msg = commonL10n.warnDelete || ''; 160 if ( confirm(msg) ) { 161 return true; 162 } 163 164 return false; 165 }, 166 167 note : function(text) { 168 alert(text); 169 } 170 }; 171 172 jQuery(document).ready( function($) { 173 var lastClicked = false, checks, first, last, checked; 174 175 // Move .updated and .error alert boxes 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') ); 178 179 // screen settings tab 180 $('#show-settings-link').click(function () { 181 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) 182 $('#contextual-help-link-wrap').css('visibility', 'hidden'); 183 184 $('#screen-options-wrap').slideToggle('fast', function(){ 185 if ( $(this).hasClass('screen-options-open') ) { 186 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'}); 187 $('#contextual-help-link-wrap').css('visibility', ''); 188 $(this).removeClass('screen-options-open'); 189 } else { 190 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'}); 191 $(this).addClass('screen-options-open'); 192 } 193 }); 194 return false; 195 }); 196 197 // help tab 198 $('#contextual-help-link').click(function () { 199 if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) 200 $('#screen-options-link-wrap').css('visibility', 'hidden'); 201 202 $('#contextual-help-wrap').slideToggle('fast', function() { 203 if ( $(this).hasClass('contextual-help-open') ) { 204 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'}); 205 $('#screen-options-link-wrap').css('visibility', ''); 206 $(this).removeClass('contextual-help-open'); 207 } else { 208 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'}); 209 $(this).addClass('contextual-help-open'); 210 } 211 }); 212 return false; 213 }); 214 215 // check all checkboxes 216 $('tbody').children().children('.check-column').find(':checkbox').click( function(e) { 217 if ( 'undefined' == e.shiftKey ) { return true; } 218 if ( e.shiftKey ) { 219 if ( !lastClicked ) { return true; } 220 checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ); 221 first = checks.index( lastClicked ); 222 last = checks.index( this ); 223 checked = $(this).attr('checked'); 224 if ( 0 < first && 0 < last && first != last ) { 225 checks.slice( first, last ).attr( 'checked', function(){ 226 if ( $(this).closest('tr').is(':visible') ) 227 return checked ? 'checked' : ''; 228 229 return ''; 230 }); 231 } 232 } 233 lastClicked = this; 234 return true; 235 }); 236 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; 241 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') ) 246 return ''; 247 if ( toggle ) 248 return $(this).attr( 'checked' ) ? '' : 'checked'; 249 else if (c) 250 return 'checked'; 251 return ''; 252 }); 253 254 $(this).closest('table').children('thead, tfoot').filter(':visible') 255 .children().children('.check-column').find(':checkbox') 256 .attr('checked', function() { 257 if ( toggle ) 258 return ''; 259 else if (c) 260 return 'checked'; 261 return ''; 262 }); 263 }); 264 265 $('#default-password-nag-no').click( function() { 266 setUserSetting('default_password_nag', 'hide'); 267 $('div.default-password-nag').hide(); 268 return false; 269 }); 270 }); 271 272 jQuery(document).ready( function($){ 273 var turboNag = $('span.turbo-nag', '#user_info'); 274 275 if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) ) 276 return; 277 278 if ( 'undefined' != typeof GearsFactory ) { 279 return; 280 } else { 281 try { 282 if ( ( 'undefined' != typeof window.ActiveXObject && ActiveXObject('Gears.Factory') ) || 283 ( 'undefined' != typeof navigator.mimeTypes && navigator.mimeTypes['application/x-googlegears'] ) ) { 284 return; 285 } 286 } catch(e){} 287 } 288 289 turboNag.show(); 290 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 8 00:19:48 2010 | Cross-referenced by PHPXref 0.7 |