mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 01:57:53 +01:00
072293c36b
git-svn-id: http://svn.automattic.com/wordpress/trunk@9703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
58 lines
1.9 KiB
JavaScript
58 lines
1.9 KiB
JavaScript
jQuery(document).ready( function($) {
|
|
// close postboxes that should be closed
|
|
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
|
|
|
jQuery('#link_name').focus();
|
|
// postboxes
|
|
postboxes.add_postbox_toggles('link');
|
|
|
|
// category tabs
|
|
var categoryTabs = jQuery('#category-tabs').tabs();
|
|
|
|
// Ajax Cat
|
|
var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
|
jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
|
|
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: '',
|
|
what: 'link-category',
|
|
response: 'category-ajax-response',
|
|
addAfter: catAddAfter
|
|
} );
|
|
|
|
$('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();
|
|
|
|
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();
|
|
});
|