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