Move postbox to postbox.js. Don't load cat and tag js for pages.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8f6920d116
commit
d5973814b7
|
@ -1,4 +1,4 @@
|
|||
// this file shoudl contain all the scripts used in the post/edit page
|
||||
// this file contains all the scripts used in the post/edit page
|
||||
|
||||
function new_tag_remove_tag() {
|
||||
var id = jQuery( this ).attr( 'id' );
|
||||
|
@ -52,19 +52,6 @@ function tag_press_key( e ) {
|
|||
}
|
||||
}
|
||||
|
||||
function add_postbox_toggles() {
|
||||
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
||||
jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state(); } );
|
||||
}
|
||||
|
||||
function save_postboxes_state() {
|
||||
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
|
||||
jQuery.post(postL10n.requestFile, {
|
||||
action: 'closed-postboxes',
|
||||
closed: closed,
|
||||
cookie: document.cookie});
|
||||
}
|
||||
|
||||
function edit_permalink(post_id) {
|
||||
var i, c = 0;
|
||||
var e = jQuery('#editable-post-name');
|
||||
|
@ -112,6 +99,17 @@ function make_slugedit_clickable() {
|
|||
}
|
||||
|
||||
addLoadEvent( function() {
|
||||
// postboxes
|
||||
add_postbox_toggles();
|
||||
|
||||
// If no tags on the page, skip the tag and category stuff.
|
||||
if ( !jQuery('#tags-input').size() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Editable slugs
|
||||
make_slugedit_clickable();
|
||||
|
||||
jQuery('#tags-input').hide();
|
||||
tag_update_quickclicks();
|
||||
// add the quickadd form
|
||||
|
@ -130,9 +128,6 @@ addLoadEvent( function() {
|
|||
jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
|
||||
jQuery('#newtag').keypress( tag_press_key );
|
||||
|
||||
// postboxes
|
||||
add_postbox_toggles();
|
||||
|
||||
// category tabs
|
||||
var categoryTabs =jQuery('#category-tabs').tabs();
|
||||
|
||||
|
@ -182,6 +177,4 @@ addLoadEvent( function() {
|
|||
return false;
|
||||
} );
|
||||
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
|
||||
|
||||
make_slugedit_clickable();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
function add_postbox_toggles() {
|
||||
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
||||
jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state(); } );
|
||||
}
|
||||
|
||||
function save_postboxes_state() {
|
||||
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
|
||||
jQuery.post(postL10n.requestFile, {
|
||||
action: 'closed-postboxes',
|
||||
closed: closed,
|
||||
cookie: document.cookie});
|
||||
}
|
|
@ -131,7 +131,8 @@ class WP_Scripts {
|
|||
$this->add( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' );
|
||||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists'), '20080128' );
|
||||
$this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
|
||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox'), '20080128' );
|
||||
$this->localize( 'post', 'postL10n', array(
|
||||
'tagsUsed' => __('Tags used on this post:'),
|
||||
'add' => attribute_escape(__('Add')),
|
||||
|
|
Loading…
Reference in New Issue