home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Blogs / wordpress2.6.exe / wordpress2.6 / wp-admin / js / link.js < prev    next >
Encoding:
Text File  |  2008-05-31  |  1.7 KB  |  52 lines

  1. jQuery(document).ready( function() {
  2.     // close postboxes that should be closed
  3.     jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
  4.  
  5.     jQuery('#link_name').focus();
  6.     // postboxes
  7.     add_postbox_toggles('link');
  8.  
  9.     // category tabs
  10.     var categoryTabs = jQuery('#category-tabs').tabs();
  11.  
  12.     // Ajax Cat
  13.     var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
  14.     jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
  15.     var noSyncChecks = false; // prophylactic. necessary?
  16.     var syncChecks = function() {
  17.         if ( noSyncChecks )
  18.             return;
  19.         noSyncChecks = true;
  20.         var th = jQuery(this);
  21.         var c = th.is(':checked');
  22.         var id = th.val().toString();
  23.         jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
  24.         noSyncChecks = false;
  25.     };
  26.     var catAddAfter = function( r, s ) {
  27.         jQuery(s.what + ' response_data', r).each( function() {
  28.             var t = jQuery(jQuery(this).text());
  29.             t.find( 'label' ).each( function() {
  30.                 var th = jQuery(this);
  31.                 var val = th.find('input').val();
  32.                 var id = th.find('input')[0].id
  33.                 jQuery('#' + id).change( syncChecks );
  34.                 var name = jQuery.trim( th.text() );
  35.                 var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
  36.             } );
  37.         } );
  38.     };
  39.     jQuery('#categorychecklist').wpList( {
  40.         alt: '',
  41.         what: 'link-category',
  42.         response: 'category-ajax-response',
  43.         addAfter: catAddAfter
  44.     } );
  45.     jQuery('#category-add-toggle').click( function() {
  46.         jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
  47.         categoryTabs.tabsClick( 1 );
  48.         return false;
  49.     } );
  50.     jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
  51. });
  52.