2008-08-27 15:49:08 -04:00
|
|
|
jQuery(document).ready( function($) {
|
2008-05-30 17:16:33 -04:00
|
|
|
|
2008-03-03 16:12:17 -05:00
|
|
|
jQuery('#link_name').focus();
|
2008-01-31 15:04:54 -05:00
|
|
|
// postboxes
|
2008-08-20 17:42:31 -04:00
|
|
|
postboxes.add_postbox_toggles('link');
|
2008-01-31 15:04:54 -05:00
|
|
|
|
|
|
|
// category tabs
|
|
|
|
var categoryTabs = jQuery('#category-tabs').tabs();
|
|
|
|
|
|
|
|
// Ajax Cat
|
|
|
|
var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
2008-12-30 12:41:07 -05:00
|
|
|
jQuery('#category-add-submit').click( function() { newCat.focus(); } );
|
2008-01-31 15:04:54 -05:00
|
|
|
var noSyncChecks = false; // prophylactic. necessary?
|
|
|
|
var syncChecks = function() {
|
|
|
|
if ( noSyncChecks )
|
|
|
|
return;
|
|
|
|
noSyncChecks = true;
|
|
|
|
var th = jQuery(this);
|
|
|
|
var c = th.is(':checked');
|
|
|
|
var id = th.val().toString();
|
|
|
|
jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
|
|
|
|
noSyncChecks = false;
|
|
|
|
};
|
|
|
|
var catAddAfter = function( r, s ) {
|
|
|
|
jQuery(s.what + ' response_data', r).each( function() {
|
|
|
|
var t = jQuery(jQuery(this).text());
|
|
|
|
t.find( 'label' ).each( function() {
|
|
|
|
var th = jQuery(this);
|
|
|
|
var val = th.find('input').val();
|
|
|
|
var id = th.find('input')[0].id
|
|
|
|
jQuery('#' + id).change( syncChecks );
|
|
|
|
var name = jQuery.trim( th.text() );
|
|
|
|
var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
};
|
|
|
|
jQuery('#categorychecklist').wpList( {
|
|
|
|
alt: '',
|
2008-02-10 01:49:46 -05:00
|
|
|
what: 'link-category',
|
2008-01-31 15:04:54 -05:00
|
|
|
response: 'category-ajax-response',
|
|
|
|
addAfter: catAddAfter
|
|
|
|
} );
|
2008-11-14 18:58:17 -05:00
|
|
|
|
|
|
|
$('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
|
|
|
|
$('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
|
|
|
|
if ( 'pop' == getUserSetting('cats') )
|
|
|
|
$('a[href="#categories-pop"]').click();
|
|
|
|
|
2008-01-31 15:04:54 -05:00
|
|
|
jQuery('#category-add-toggle').click( function() {
|
|
|
|
jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
|
|
|
|
categoryTabs.tabsClick( 1 );
|
|
|
|
return false;
|
|
|
|
} );
|
|
|
|
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
|
2008-02-08 14:57:50 -05:00
|
|
|
});
|