tagBox = {
clean : function(tags) {
- return tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, '');
+ var comma = postL10n.comma;
+ if ( ',' !== comma )
+ tags = tags.replace(new RegExp(comma, 'g'), ',');
+ tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, '');
+ if ( ',' !== comma )
+ tags = tags.replace(/,/g, comma);
+ return tags;
},
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(','), new_tags = [];
+ var id = el.id, num = id.split('-check-num-')[1], taxbox = $(el).closest('.tagsdiv'),
+ thetags = taxbox.find('.the-tags'), comma = postL10n.comma,
+ current_tags = thetags.val().split(comma), new_tags = [];
delete current_tags[num];
$.each( current_tags, function(key, val) {
}
});
- thetags.val( this.clean( new_tags.join(',') ) );
+ thetags.val( this.clean( new_tags.join(comma) ) );
this.quickClicks(taxbox);
return false;
disabled = thetags.prop('disabled');
- current_tags = thetags.val().split(',');
+ current_tags = thetags.val().split(postL10n.comma);
tagchecklist.empty();
$.each( current_tags, function( key, val ) {
flushTags : function(el, a, f) {
a = a || false;
- var text, tags = $('.the-tags', el), newtag = $('input.newtag', el), newtags;
+ var tags = $('.the-tags', el),
+ newtag = $('input.newtag', el),
+ comma = postL10n.comma,
+ newtags, text;
text = a ? $(a).text() : newtag.val();
tagsval = tags.val();
- newtags = tagsval ? tagsval + ',' + text : text;
+ newtags = tagsval ? tagsval + comma + text : text;
newtags = this.clean( newtags );
- newtags = array_unique_noempty( newtags.split(',') ).join(',');
+ newtags = array_unique_noempty( newtags.split(comma) ).join(comma);
tags.val(newtags);
this.quickClicks(el);
get : function(id) {
var tax = id.substr(id.indexOf('-')+1);
- $.post(ajaxurl, {'action':'get-tagcloud','tax':tax}, function(r, stat) {
+ $.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
if ( 0 == r || 'success' != stat )
r = wpAjax.broken;
}
}).each(function(){
var tax = $(this).closest('div.tagsdiv').attr('id');
- $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: "," } );
+ $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: postL10n.comma + ' ' } );
});
// save tags on post save/publish
if ( commentsBox.st > commentsBox.total )
$('#show-comments').hide();
else
- $('#show-comments').html(postL10n.showcomm);
+ $('#show-comments').show().children('a').html(postL10n.showcomm);
+
return;
} else if ( 1 == r ) {
- $('#show-comments').parent().html(postL10n.endcomm);
+ $('#show-comments').html(postL10n.endcomm);
return;
}
if ( !$('#new'+taxonomy).val() )
return false;
s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();
+ $( '#' + taxonomy + '-add-submit' ).prop( 'disabled', true );
return s;
};
catAddAfter = function( r, s ) {
var sup, drop = $('#new'+taxonomy+'_parent');
+ $( '#' + taxonomy + '-add-submit' ).prop( 'disabled', false );
if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
drop.before(sup);
drop.remove();