Changeset 43352
- Timestamp:
- 06/16/2018 10:11:57 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/link.js
r43347 r43352 13 13 postboxes.add_postbox_toggles('link'); 14 14 15 // category tabs 15 /** 16 * Adds event that opens a particular category tab. 17 * 18 * @ignore 19 * 20 * @return {boolean} Always returns false to prevent the default behavior. 21 */ 16 22 $('#category-tabs a').click(function(){ 17 23 var t = $(this).attr('href'); … … 30 36 // Ajax Cat 31 37 newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ); } ); 38 39 /** 40 * After adding a new category, focus on the category add input field. 41 * 42 * @return {void} 43 */ 32 44 $('#link-category-add-submit').click( function() { newCat.focus(); } ); 45 46 /** 47 * Synchronize category checkboxes. 48 * 49 * This function makes sure that the checkboxes are synced between the all 50 * categories tab and the most used categories tab. 51 * 52 * @since 2.5.0 53 * 54 * @return {void} 55 */ 33 56 syncChecks = function() { 34 57 if ( noSyncChecks ) … … 40 63 }; 41 64 65 /** 66 * Adds event listeners to an added category. 67 * 68 * This is run on the addAfter event to make sure the correct event listeners 69 * are bound to the DOM elements. 70 * 71 * @since 2.5.0 72 * 73 * @param {string} r Raw XML response returned from the server after adding a 74 * category. 75 * @param {Object} s List manager configuration object; settings for the Ajax 76 * request. 77 * 78 * @return {void} 79 */ 42 80 catAddAfter = function( r, s ) { 43 81 $(s.what + ' response_data', r).each( function() { … … 51 89 }; 52 90 91 /* 92 * Instantiates the list manager. 93 * 94 * @see js/_enqueues/lib/lists.js 95 */ 53 96 $('#categorychecklist').wpList( { 97 // CSS class name for alternate styling. 54 98 alt: '', 99 100 // The type of list. 55 101 what: 'link-category', 102 103 // ID of the element the parsed Ajax response will be stored in. 56 104 response: 'category-ajax-response', 105 106 // Callback that's run after an item got added to the list. 57 107 addAfter: catAddAfter 58 108 } ); 59 109 110 // All categories is the default tab, so we delete the user setting. 60 111 $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); 112 113 // Set a preference for the popular categories to cookies. 61 114 $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); 115 62 116 if ( 'pop' == getUserSetting('cats') ) 63 117 $('a[href="#categories-pop"]').click(); 64 118 119 /** 120 * Adds event handler that shows the interface controls to add a new category. 121 * 122 * @ignore 123 * 124 * @param {Event} event The event object. 125 * @returns {boolean} Always returns false to prevent regular link 126 * functionality. 127 */ 65 128 $('#category-add-toggle').click( function() { 66 129 $(this).parents('div:first').toggleClass( 'wp-hidden-children' );
Note: See TracChangeset
for help on using the changeset viewer.