if ( !thetags.length )
return;
+ var disabled = thetags.attr('disabled');
+
current_tags = thetags.val().split(',');
tagchecklist.empty();
val = $.trim(val);
if ( !val.match(/^\s+$/) && '' != val ) {
button_id = id + '-check-num-' + key;
- txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a> ' + val + '</span> ';
+ if ( disabled )
+ txt = '<span>' + val + '</span> ';
+ else
+ txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a> ' + val + '</span> ';
tagchecklist.append(txt);
- $( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
+ if ( ! disabled )
+ $( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
}
});
},
});
$('div.taghint', ajaxtag).click(function(){
- $(this).css('visibility', 'hidden').siblings('.newtag').focus();
+ $(this).css('visibility', 'hidden').parent().siblings('.newtag').focus();
});
$('input.newtag', ajaxtag).blur(function() {
if ( this.value == '' )
- $(this).siblings('.taghint').css('visibility', '');
+ $(this).parent().siblings('.taghint').css('visibility', '');
}).focus(function(){
- $(this).siblings('.taghint').css('visibility', 'hidden');
+ $(this).parent().siblings('.taghint').css('visibility', 'hidden');
}).keyup(function(e){
if ( 13 == e.which ) {
tagBox.flushTags( $(this).closest('.tagsdiv') );
}
}).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: "," } );
});
// save tags on post save/publish
}
};
-WPRemoveThumbnail = function(){
+WPRemoveThumbnail = function(nonce){
$.post(ajaxurl, {
- action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, cookie: encodeURIComponent(document.cookie)
+ action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
}, function(str){
if ( str == '0' ) {
alert( setPostThumbnailL10n.error );
})(jQuery);
jQuery(document).ready( function($) {
- var catAddAfter, stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
+ var stamp, visibility, sticky = '';
- // postboxes
- if ( post )
- postboxes.add_postbox_toggles('post');
- else if ( page )
- postboxes.add_postbox_toggles('page');
+ postboxes.add_postbox_toggles(pagenow);
// multi-taxonomies
if ( $('#tagsdiv-post_tag').length ) {
}
// categories
- if ( $('#categorydiv').length ) {
+ $('.categorydiv').each( function(){
+ var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, taxonomyParts, taxonomy, settingName;
+
+ taxonomyParts = this_id.split('-');
+ taxonomyParts.shift();
+ taxonomy = taxonomyParts.join('-');
+ settingName = taxonomy + '_tab';
+ if ( taxonomy == 'category' )
+ settingName = 'cats';
+
// TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.dev.js
- $('a', '#category-tabs').click(function(){
+ $('a', '#' + taxonomy + '-tabs').click( function(){
var t = $(this).attr('href');
$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
- $('#category-tabs').siblings('.tabs-panel').hide();
+ $('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
$(t).show();
- if ( '#categories-all' == t )
- deleteUserSetting('cats');
+ if ( '#' + taxonomy + '-all' == t )
+ deleteUserSetting(settingName);
else
- setUserSetting('cats','pop');
+ setUserSetting(settingName, 'pop');
return false;
});
- if ( getUserSetting('cats') )
- $('a[href="#categories-pop"]', '#category-tabs').click();
+
+ if ( getUserSetting(settingName) )
+ $('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
// Ajax Cat
- $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
- $('#category-add-sumbit').click( function(){ $('#newcat').focus(); } );
+ $('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+ $('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); });
+
+ syncChecks = function() {
+ if ( noSyncChecks )
+ return;
+ noSyncChecks = true;
+ var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
+ $('#in-' + taxonomy + '-' + id + ', #in-' + taxonomy + '-category-' + id).attr( 'checked', c );
+ noSyncChecks = false;
+ };
catAddBefore = function( s ) {
- if ( !$('#newcat').val() )
+ if ( !$('#new'+taxonomy).val() )
return false;
- s.data += '&' + $( ':checked', '#categorychecklist' ).serialize();
+ s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();
return s;
};
catAddAfter = function( r, s ) {
- var sup, drop = $('#newcat_parent');
+ var sup, drop = $('#new'+taxonomy+'_parent');
if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
drop.before(sup);
}
};
- $('#categorychecklist').wpList({
+ $('#' + taxonomy + 'checklist').wpList({
alt: '',
- response: 'category-ajax-response',
+ response: taxonomy + '-ajax-response',
addBefore: catAddBefore,
addAfter: catAddAfter
});
- $('#category-add-toggle').click( function() {
- $('#category-adder').toggleClass( 'wp-hidden-children' );
- $('a[href="#categories-all"]', '#category-tabs').click();
+ $('#' + taxonomy + '-add-toggle').click( function() {
+ $('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
+ $('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
+ $('#new'+taxonomy).focus();
return false;
});
- $('#categorychecklist').children('li.popular-category').add( $('#categorychecklist-pop').children() ).find(':checkbox').live( 'click', function(){
+ $('#' + taxonomy + 'checklist li.popular-category :checkbox, #' + taxonomy + 'checklist-pop :checkbox').live( 'click', function(){
var t = $(this), c = t.is(':checked'), id = t.val();
- $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+ if ( id && t.parents('#taxonomy-'+taxonomy).length )
+ $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).attr( 'checked', c );
});
- } // end cats
+ }); // end cats
// Custom Fields
if ( $('#postcustom').length ) {
$('#the-list').wpList( { addAfter: function( xml, s ) {
$('table#list-table').show();
- if ( typeof( autosave_update_post_ID ) != 'undefined' ) {
- autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
- }
}, addBefore: function( s ) {
s.data += '&post_id=' + $('#post_ID').val();
return s;
}
function updateText() {
- var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'),
- optPublish = $('option[value=publish]', postStatus), aa = $('#aa').val(),
+ var attemptedDate, originalDate, currentDate, publishOn, page = 'page' == pagenow || 'page-new' == pagenow,
+ postStatus = $('#post_status'), optPublish = $('option[value=publish]', postStatus), aa = $('#aa').val(),
mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
attemptedDate = new Date( aa, mm - 1, jj, hh, mn );
if ( $('input:radio:checked', pvSelect).val() != 'public' ) {
$('#sticky').attr('checked', false);
- }
+ } // WEAPON LOCKED
if ( true == $('#sticky').attr('checked') ) {
sticky = 'Sticky';
// permalink
if ( $('#edit-slug-box').length ) {
editPermalink = function(post_id) {
- var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.html(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
+ var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
$('#view-post-btn').hide();
b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
}
makeSlugeditClickable();
}
+
+ if ( $('#title').val() == '' )
+ $('#title').siblings('#title-prompt-text').css('visibility', '');
+ $('#title-prompt-text').click(function(){
+ $(this).css('visibility', 'hidden').siblings('#title').focus();
+ });
+ $('#title').blur(function(){
+ if (this.value == '')
+ $(this).siblings('#title-prompt-text').css('visibility', '');
+ }).focus(function(){
+ $(this).siblings('#title-prompt-text').css('visibility', 'hidden');
+ }).keydown(function(e){
+ $(this).siblings('#title-prompt-text').css('visibility', 'hidden');
+ $(this).unbind(e);
+ });
});