at path๏ผ
ROOT
/
wp-admin
/
js
/
tags-box.js
run๏ผ
R
W
Run
widgets
DIR
2026-01-20 02:08:46
R
W
Run
accordion.js
2.86 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
accordion.min.js
758 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
application-passwords.js
6.24 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
application-passwords.min.js
2.95 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
auth-app.js
5.66 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
auth-app.min.js
2.04 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
code-editor.js
11.32 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
code-editor.min.js
3.01 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
color-picker.js
9.54 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
color-picker.min.js
3.4 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
comment.js
2.85 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
comment.min.js
1.28 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
common.js
61.15 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
common.min.js
23.12 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
custom-background.js
3.35 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
custom-background.min.js
1.18 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
custom-header.js
1.98 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-controls.js
287.36 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-controls.min.js
109.14 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-nav-menus.js
111.13 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-nav-menus.min.js
46.93 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-widgets.js
70.05 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
customize-widgets.min.js
27.41 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
dashboard.js
27.02 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
dashboard.min.js
8.65 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
edit-comments.js
37.12 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
edit-comments.min.js
15.13 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
editor-expand.js
41.61 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
editor-expand.min.js
13.14 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
editor.js
43.98 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
editor.min.js
12.76 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
farbtastic.js
7.67 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
gallery.js
5.41 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
gallery.min.js
3.65 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
image-edit.js
39.98 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
image-edit.min.js
15.15 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
inline-edit-post.js
20.17 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
inline-edit-post.min.js
9.41 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
inline-edit-tax.js
7.61 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
inline-edit-tax.min.js
2.93 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
iris.min.js
23.09 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
language-chooser.js
890 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
language-chooser.min.js
423 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
link.js
3.89 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
link.min.js
1.7 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media-gallery.js
1.27 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media-gallery.min.js
611 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media-upload.js
3.38 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media-upload.min.js
1.13 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media.js
6.61 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
media.min.js
2.38 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
nav-menu.js
60.72 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
nav-menu.min.js
29.85 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
password-strength-meter.js
4.14 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
password-strength-meter.min.js
1.1 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
password-toggle.js
1.31 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
password-toggle.min.js
847 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
plugin-install.js
6.92 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
plugin-install.min.js
2.35 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
post.js
38.68 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
post.min.js
18.4 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
postbox.js
18.49 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
postbox.min.js
6.6 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
privacy-tools.js
10.67 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
privacy-tools.min.js
5.03 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
revisions.js
33.92 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
revisions.min.js
17.97 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
set-post-thumbnail.js
876 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
set-post-thumbnail.min.js
620 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
site-health.js
13.15 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
site-health.min.js
6.13 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
site-icon.js
6.1 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
site-icon.min.js
2.2 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
svg-painter.js
3.2 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
svg-painter.min.js
1.53 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags-box.js
10.88 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags-box.min.js
3 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags-suggest.js
5.64 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags-suggest.min.js
2.22 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags.js
4.85 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
tags.min.js
2.04 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
theme-plugin-editor.js
24.77 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
theme-plugin-editor.min.js
11.43 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
theme.js
54.67 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
theme.min.js
26.42 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
updates.js
109.33 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
updates.min.js
47.27 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
user-profile.js
15 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
user-profile.min.js
6.7 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
user-suggest.js
2.25 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
user-suggest.min.js
676 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
widgets.js
22.56 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
widgets.min.js
12.31 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
word-count.js
7.52 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
word-count.min.js
1.49 KB
2025-10-18 22:56:58
R
W
Run
Delete
Rename
xfn.js
740 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
xfn.min.js
458 By
2025-10-18 22:56:58
R
W
Run
Delete
Rename
error_log
up
๐
tags-box.js
Save
/** * @output wp-admin/js/tags-box.js */ /* jshint curly: false, eqeqeq: false */ /* global ajaxurl, tagBox, array_unique_noempty */ ( function( $ ) { var tagDelimiter = wp.i18n._x( ',', 'tag delimiter' ) || ','; /** * Filters unique items and returns a new array. * * Filters all items from an array into a new array containing only the unique * items. This also excludes whitespace or empty values. * * @since 2.8.0 * * @global * * @param {Array} array The array to filter through. * * @return {Array} A new array containing only the unique items. */ window.array_unique_noempty = function( array ) { var out = []; // Trim the values and ensure they are unique. $.each( array, function( key, val ) { val = val || ''; val = val.trim(); if ( val && $.inArray( val, out ) === -1 ) { out.push( val ); } } ); return out; }; /** * The TagBox object. * * Contains functions to create and manage tags that can be associated with a * post. * * @since 2.9.0 * * @global */ window.tagBox = { /** * Cleans up tags by removing redundant characters. * * @since 2.9.0 * * @memberOf tagBox * * @param {string} tags Comma separated tags that need to be cleaned up. * * @return {string} The cleaned up tags. */ clean : function( tags ) { if ( ',' !== tagDelimiter ) { tags = tags.replace( new RegExp( tagDelimiter, 'g' ), ',' ); } tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, ''); if ( ',' !== tagDelimiter ) { tags = tags.replace( /,/g, tagDelimiter ); } return tags; }, /** * Parses tags and makes them editable. * * @since 2.9.0 * * @memberOf tagBox * * @param {Object} el The tag element to retrieve the ID from. * * @return {boolean} Always returns false. */ parseTags : function(el) { var id = el.id, num = id.split('-check-num-')[1], taxbox = $(el).closest('.tagsdiv'), thetags = taxbox.find('.the-tags'), current_tags = thetags.val().split( tagDelimiter ), new_tags = []; delete current_tags[num]; // Sanitize the current tags and push them as if they're new tags. $.each( current_tags, function( key, val ) { val = val || ''; val = val.trim(); if ( val ) { new_tags.push( val ); } }); thetags.val( this.clean( new_tags.join( tagDelimiter ) ) ); this.quickClicks( taxbox ); return false; }, /** * Creates clickable links, buttons and fields for adding or editing tags. * * @since 2.9.0 * * @memberOf tagBox * * @param {Object} el The container HTML element. * * @return {void} */ quickClicks : function( el ) { var thetags = $('.the-tags', el), tagchecklist = $('.tagchecklist', el), id = $(el).attr('id'), current_tags, disabled; if ( ! thetags.length ) return; disabled = thetags.prop('disabled'); current_tags = thetags.val().split( tagDelimiter ); tagchecklist.empty(); /** * Creates a delete button if tag editing is enabled, before adding it to the tag list. * * @since 2.5.0 * * @memberOf tagBox * * @param {string} key The index of the current tag. * @param {string} val The value of the current tag. * * @return {void} */ $.each( current_tags, function( key, val ) { var listItem, xbutton; val = val || ''; val = val.trim(); if ( ! val ) return; // Create a new list item, and ensure the text is properly escaped. listItem = $( '<li />' ).text( val ); // If tags editing isn't disabled, create the X button. if ( ! disabled ) { /* * Build the X buttons, hide the X icon with aria-hidden and * use visually hidden text for screen readers. */ xbutton = $( '<button type="button" id="' + id + '-check-num-' + key + '" class="ntdelbutton">' + '<span class="remove-tag-icon" aria-hidden="true"></span>' + '<span class="screen-reader-text">' + wp.i18n.__( 'Remove term:' ) + ' ' + listItem.html() + '</span>' + '</button>' ); /** * Handles the click and keypress event of the tag remove button. * * Makes sure the focus ends up in the tag input field when using * the keyboard to delete the tag. * * @since 4.2.0 * * @param {Event} e The click or keypress event to handle. * * @return {void} */ xbutton.on( 'click keypress', function( e ) { // On click or when using the Enter/Spacebar keys. if ( 'click' === e.type || 13 === e.keyCode || 32 === e.keyCode ) { /* * When using the keyboard, move focus back to the * add new tag field. Note: when releasing the pressed * key this will fire the `keyup` event on the input. */ if ( 13 === e.keyCode || 32 === e.keyCode ) { $( this ).closest( '.tagsdiv' ).find( 'input.newtag' ).trigger( 'focus' ); } tagBox.userAction = 'remove'; tagBox.parseTags( this ); } }); listItem.prepend( ' ' ).prepend( xbutton ); } // Append the list item to the tag list. tagchecklist.append( listItem ); }); // The buttons list is built now, give feedback to screen reader users. tagBox.screenReadersMessage(); }, /** * Adds a new tag. * * Also ensures that the quick links are properly generated. * * @since 2.9.0 * * @memberOf tagBox * * @param {Object} el The container HTML element. * @param {Object|boolean} a When this is an HTML element the text of that * element will be used for the new tag. * @param {number|boolean} f If this value is not passed then the tag input * field is focused. * * @return {boolean} Always returns false. */ flushTags : function( el, a, f ) { var tagsval, newtags, text, tags = $( '.the-tags', el ), newtag = $( 'input.newtag', el ); a = a || false; text = a ? $(a).text() : newtag.val(); /* * Return if there's no new tag or if the input field is empty. * Note: when using the keyboard to add tags, focus is moved back to * the input field and the `keyup` event attached on this field will * fire when releasing the pressed key. Checking also for the field * emptiness avoids to set the tags and call quickClicks() again. */ if ( 'undefined' == typeof( text ) || '' === text ) { return false; } tagsval = tags.val(); newtags = tagsval ? tagsval + tagDelimiter + text : text; newtags = this.clean( newtags ); newtags = array_unique_noempty( newtags.split( tagDelimiter ) ).join( tagDelimiter ); tags.val( newtags ); this.quickClicks( el ); if ( ! a ) newtag.val(''); if ( 'undefined' == typeof( f ) ) newtag.trigger( 'focus' ); return false; }, /** * Retrieves the available tags and creates a tagcloud. * * Retrieves the available tags from the database and creates an interactive * tagcloud. Clicking a tag will add it. * * @since 2.9.0 * * @memberOf tagBox * * @param {string} id The ID to extract the taxonomy from. * * @return {void} */ get : function( id ) { var tax = id.substr( id.indexOf('-') + 1 ); /** * Puts a received tag cloud into a DOM element. * * The tag cloud HTML is generated on the server. * * @since 2.9.0 * * @param {number|string} r The response message from the Ajax call. * @param {string} stat The status of the Ajax request. * * @return {void} */ $.post( ajaxurl, { 'action': 'get-tagcloud', 'tax': tax }, function( r, stat ) { if ( 0 === r || 'success' != stat ) { return; } r = $( '<div id="tagcloud-' + tax + '" class="the-tagcloud">' + r + '</div>' ); /** * Adds a new tag when a tag in the tagcloud is clicked. * * @since 2.9.0 * * @return {boolean} Returns false to prevent the default action. */ $( 'a', r ).on( 'click', function() { tagBox.userAction = 'add'; tagBox.flushTags( $( '#' + tax ), this ); return false; }); $( '#' + id ).after( r ); }); }, /** * Track the user's last action. * * @since 4.7.0 */ userAction: '', /** * Dispatches an audible message to screen readers. * * This will inform the user when a tag has been added or removed. * * @since 4.7.0 * * @return {void} */ screenReadersMessage: function() { var message; switch ( this.userAction ) { case 'remove': message = wp.i18n.__( 'Term removed.' ); break; case 'add': message = wp.i18n.__( 'Term added.' ); break; default: return; } window.wp.a11y.speak( message, 'assertive' ); }, /** * Initializes the tags box by setting up the links, buttons. Sets up event * handling. * * This includes handling of pressing the enter key in the input field and the * retrieval of tag suggestions. * * @since 2.9.0 * * @memberOf tagBox * * @return {void} */ init : function() { var ajaxtag = $('div.ajaxtag'); $('.tagsdiv').each( function() { tagBox.quickClicks( this ); }); $( '.tagadd', ajaxtag ).on( 'click', function() { tagBox.userAction = 'add'; tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); }); /** * Handles pressing enter on the new tag input field. * * Prevents submitting the post edit form. Uses `keypress` to take * into account Input Method Editor (IME) converters. * * @since 2.9.0 * * @param {Event} event The keypress event that occurred. * * @return {void} */ $( 'input.newtag', ajaxtag ).on( 'keypress', function( event ) { if ( 13 == event.which ) { tagBox.userAction = 'add'; tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); event.preventDefault(); event.stopPropagation(); } }).each( function( i, element ) { $( element ).wpTagsSuggest(); }); /** * Before a post is saved the value currently in the new tag input field will be * added as a tag. * * @since 2.9.0 * * @return {void} */ $('#post').on( 'submit', function(){ $('div.tagsdiv').each( function() { tagBox.flushTags(this, false, 1); }); }); /** * Handles clicking on the tag cloud link. * * Makes sure the ARIA attributes are set correctly. * * @since 2.9.0 * * @return {void} */ $('.tagcloud-link').on( 'click', function(){ // On the first click, fetch the tag cloud and insert it in the DOM. tagBox.get( $( this ).attr( 'id' ) ); // Update button state, remove previous click event and attach a new one to toggle the cloud. $( this ) .attr( 'aria-expanded', 'true' ) .off() .on( 'click', function() { $( this ) .attr( 'aria-expanded', 'false' === $( this ).attr( 'aria-expanded' ) ? 'true' : 'false' ) .siblings( '.the-tagcloud' ).toggle(); }); }); } }; }( jQuery ));