[ Index ] |
WordPress Cross Reference |
[Summary view] [Print] [Text view]
1 /* global postboxes, deleteUserSetting, setUserSetting, getUserSetting */ 2 3 jQuery(document).ready( function($) { 4 5 var newCat, noSyncChecks = false, syncChecks, catAddAfter; 6 7 $('#link_name').focus(); 8 // postboxes 9 postboxes.add_postbox_toggles('link'); 10 11 // category tabs 12 $('#category-tabs a').click(function(){ 13 var t = $(this).attr('href'); 14 $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); 15 $('.tabs-panel').hide(); 16 $(t).show(); 17 if ( '#categories-all' == t ) 18 deleteUserSetting('cats'); 19 else 20 setUserSetting('cats','pop'); 21 return false; 22 }); 23 if ( getUserSetting('cats') ) 24 $('#category-tabs a[href="#categories-pop"]').click(); 25 26 // Ajax Cat 27 newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ); } ); 28 $('#link-category-add-submit').click( function() { newCat.focus(); } ); 29 syncChecks = function() { 30 if ( noSyncChecks ) 31 return; 32 noSyncChecks = true; 33 var th = $(this), c = th.is(':checked'), id = th.val().toString(); 34 $('#in-link-category-' + id + ', #in-popular-link_category-' + id).prop( 'checked', c ); 35 noSyncChecks = false; 36 }; 37 38 catAddAfter = function( r, s ) { 39 $(s.what + ' response_data', r).each( function() { 40 var t = $($(this).text()); 41 t.find( 'label' ).each( function() { 42 var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; 43 $('#' + id).change( syncChecks ); 44 o = $( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 45 } ); 46 } ); 47 }; 48 49 $('#categorychecklist').wpList( { 50 alt: '', 51 what: 'link-category', 52 response: 'category-ajax-response', 53 addAfter: catAddAfter 54 } ); 55 56 $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); 57 $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); 58 if ( 'pop' == getUserSetting('cats') ) 59 $('a[href="#categories-pop"]').click(); 60 61 $('#category-add-toggle').click( function() { 62 $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); 63 $('#category-tabs a[href="#categories-all"]').click(); 64 $('#newcategory').focus(); 65 return false; 66 } ); 67 68 $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); 69 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |