PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
/* jshint curly: false, eqeqeq: false */
|
2015-02-25 05:17:27 +01:00
|
|
|
/* global ajaxurl */
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
var tagBox, array_unique_noempty;
|
|
|
|
|
|
|
|
( function( $ ) {
|
2016-10-15 00:40:28 +02:00
|
|
|
var tagDelimiter = ( window.tagsSuggestL10n && window.tagsSuggestL10n.tagDelimiter ) || ',';
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
// Return an array with any duplicate, whitespace or empty values removed
|
|
|
|
array_unique_noempty = function( array ) {
|
|
|
|
var out = [];
|
|
|
|
|
|
|
|
$.each( array, function( key, val ) {
|
|
|
|
val = $.trim( val );
|
|
|
|
|
|
|
|
if ( val && $.inArray( val, out ) === -1 ) {
|
|
|
|
out.push( val );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
return out;
|
2015-02-25 05:17:27 +01:00
|
|
|
};
|
2015-02-27 03:50:25 +01:00
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tagBox = {
|
2016-10-15 00:40:28 +02:00
|
|
|
clean : function( tags ) {
|
|
|
|
if ( ',' !== tagDelimiter ) {
|
|
|
|
tags = tags.replace( new RegExp( tagDelimiter, 'g' ), ',' );
|
|
|
|
}
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, '');
|
2016-10-15 00:40:28 +02:00
|
|
|
|
|
|
|
if ( ',' !== tagDelimiter ) {
|
|
|
|
tags = tags.replace( /,/g, tagDelimiter );
|
|
|
|
}
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
return tags;
|
|
|
|
},
|
|
|
|
|
|
|
|
parseTags : function(el) {
|
|
|
|
var id = el.id,
|
|
|
|
num = id.split('-check-num-')[1],
|
|
|
|
taxbox = $(el).closest('.tagsdiv'),
|
|
|
|
thetags = taxbox.find('.the-tags'),
|
2016-10-15 00:40:28 +02:00
|
|
|
current_tags = thetags.val().split( tagDelimiter ),
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
new_tags = [];
|
|
|
|
|
|
|
|
delete current_tags[num];
|
|
|
|
|
|
|
|
$.each( current_tags, function( key, val ) {
|
|
|
|
val = $.trim( val );
|
|
|
|
if ( val ) {
|
|
|
|
new_tags.push( val );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-10-15 00:40:28 +02:00
|
|
|
thetags.val( this.clean( new_tags.join( tagDelimiter ) ) );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
this.quickClicks( taxbox );
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
2016-10-15 00:40:28 +02:00
|
|
|
current_tags = thetags.val().split( tagDelimiter );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tagchecklist.empty();
|
|
|
|
|
|
|
|
$.each( current_tags, function( key, val ) {
|
2017-09-22 13:28:44 +02:00
|
|
|
var listItem, xbutton;
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
val = $.trim( val );
|
|
|
|
|
|
|
|
if ( ! val )
|
|
|
|
return;
|
|
|
|
|
2017-09-22 13:28:44 +02:00
|
|
|
// Create a new list item, and ensure the text is properly escaped.
|
|
|
|
listItem = $( '<li />' ).text( val );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
// If tags editing isn't disabled, create the X button.
|
|
|
|
if ( ! disabled ) {
|
2016-10-23 20:16:42 +02:00
|
|
|
/*
|
|
|
|
* 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>' +
|
2017-09-22 13:28:44 +02:00
|
|
|
'<span class="screen-reader-text">' + window.tagsSuggestL10n.removeTerm + ' ' + listItem.html() + '</span>' +
|
2016-10-23 20:16:42 +02:00
|
|
|
'</button>' );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
xbutton.on( 'click keypress', function( e ) {
|
2016-10-23 20:16:42 +02:00
|
|
|
// 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' ).focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
tagBox.userAction = 'remove';
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tagBox.parseTags( this );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-09-22 13:28:44 +02:00
|
|
|
listItem.prepend( ' ' ).prepend( xbutton );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-22 13:28:44 +02:00
|
|
|
// Append the list item to the tag list.
|
|
|
|
tagchecklist.append( listItem );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
});
|
2016-10-23 20:16:42 +02:00
|
|
|
// The buttons list is built now, give feedback to screen reader users.
|
|
|
|
tagBox.screenReadersMessage();
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
flushTags : function( el, a, f ) {
|
|
|
|
var tagsval, newtags, text,
|
|
|
|
tags = $( '.the-tags', el ),
|
2016-10-15 00:40:28 +02:00
|
|
|
newtag = $( 'input.newtag', el );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
a = a || false;
|
|
|
|
|
|
|
|
text = a ? $(a).text() : newtag.val();
|
2015-03-26 02:23:28 +01:00
|
|
|
|
2016-10-23 20:16:42 +02:00
|
|
|
/*
|
|
|
|
* 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 ) {
|
2015-03-26 02:23:28 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tagsval = tags.val();
|
2016-10-15 00:40:28 +02:00
|
|
|
newtags = tagsval ? tagsval + tagDelimiter + text : text;
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
newtags = this.clean( newtags );
|
2016-10-15 00:40:28 +02:00
|
|
|
newtags = array_unique_noempty( newtags.split( tagDelimiter ) ).join( tagDelimiter );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tags.val( newtags );
|
|
|
|
this.quickClicks( el );
|
|
|
|
|
|
|
|
if ( ! a )
|
|
|
|
newtag.val('');
|
|
|
|
if ( 'undefined' == typeof( f ) )
|
|
|
|
newtag.focus();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
get : function( id ) {
|
|
|
|
var tax = id.substr( id.indexOf('-') + 1 );
|
|
|
|
|
|
|
|
$.post( ajaxurl, { 'action': 'get-tagcloud', 'tax': tax }, function( r, stat ) {
|
|
|
|
if ( 0 === r || 'success' != stat ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-09-22 13:28:44 +02:00
|
|
|
r = $( '<div id="tagcloud-' + tax + '" class="the-tagcloud">' + r + '</div>' );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
$( 'a', r ).click( function() {
|
2016-10-23 20:16:42 +02:00
|
|
|
tagBox.userAction = 'add';
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
tagBox.flushTags( $( '#' + tax ), this );
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$( '#' + id ).after( r );
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-10-23 20:16:42 +02:00
|
|
|
/**
|
|
|
|
* Track the user's last action.
|
|
|
|
*
|
|
|
|
* @since 4.7.0
|
|
|
|
*/
|
|
|
|
userAction: '',
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch an audible message to screen readers.
|
|
|
|
*
|
|
|
|
* @since 4.7.0
|
|
|
|
*/
|
|
|
|
screenReadersMessage: function() {
|
|
|
|
var message;
|
|
|
|
|
|
|
|
switch ( this.userAction ) {
|
|
|
|
case 'remove':
|
|
|
|
message = window.tagsSuggestL10n.termRemoved;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'add':
|
|
|
|
message = window.tagsSuggestL10n.termAdded;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window.wp.a11y.speak( message, 'assertive' );
|
|
|
|
},
|
|
|
|
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
init : function() {
|
2016-10-15 00:40:28 +02:00
|
|
|
var ajaxtag = $('div.ajaxtag');
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
|
|
|
|
$('.tagsdiv').each( function() {
|
2016-10-15 00:40:28 +02:00
|
|
|
tagBox.quickClicks( this );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
});
|
|
|
|
|
2016-10-15 00:40:28 +02:00
|
|
|
$( '.tagadd', ajaxtag ).click( function() {
|
2016-10-23 20:16:42 +02:00
|
|
|
tagBox.userAction = 'add';
|
2016-10-15 00:40:28 +02:00
|
|
|
tagBox.flushTags( $( this ).closest( '.tagsdiv' ) );
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
});
|
|
|
|
|
2017-10-24 13:30:49 +02:00
|
|
|
$( 'input.newtag', ajaxtag ).keypress( function( event ) {
|
2016-10-15 00:40:28 +02:00
|
|
|
if ( 13 == event.which ) {
|
2016-10-23 20:16:42 +02:00
|
|
|
tagBox.userAction = 'add';
|
2016-10-15 00:40:28 +02:00
|
|
|
tagBox.flushTags( $( this ).closest( '.tagsdiv' ) );
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
}
|
2016-10-15 00:40:28 +02:00
|
|
|
}).keypress( function( event ) {
|
|
|
|
if ( 13 == event.which ) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
}
|
2016-10-15 00:40:28 +02:00
|
|
|
}).each( function( i, element ) {
|
|
|
|
$( element ).wpTagsSuggest();
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// save tags on post save/publish
|
|
|
|
$('#post').submit(function(){
|
|
|
|
$('div.tagsdiv').each( function() {
|
|
|
|
tagBox.flushTags(this, false, 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-10-23 20:16:42 +02:00
|
|
|
// Fetch and toggle the Tag cloud.
|
2015-02-27 03:50:25 +01:00
|
|
|
$('.tagcloud-link').click(function(){
|
2016-10-23 20:16:42 +02:00
|
|
|
// 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' )
|
|
|
|
.unbind()
|
|
|
|
.click( function() {
|
|
|
|
$( this )
|
|
|
|
.attr( 'aria-expanded', 'false' === $( this ).attr( 'aria-expanded' ) ? 'true' : 'false' )
|
|
|
|
.siblings( '.the-tagcloud' ).toggle();
|
|
|
|
});
|
PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534
git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 02:50:26 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}( jQuery ));
|