diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 2cf77fb239..66599380d9 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -188,20 +188,15 @@ function dropdown_categories( $default = 0, $parent = 0 ) {
}
function wp_popular_categories_checklist( $default = 0, $number = 10 ) {
- global $checked_categories;
-
- wp_set_checked_post_categories( $default );
-
$categories = get_categories( array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) );
foreach ( (array) $categories as $category ) {
$id = "popular-category-$category->term_id";
- $checked = in_array( $category->term_id, $checked_categories ) ? ' checked="checked"' : '';
?>
diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js
index 12c1b4ee5c..15d4676062 100644
--- a/wp-admin/js/common.js
+++ b/wp-admin/js/common.js
@@ -1,4 +1,6 @@
addLoadEvent( function() {
// pulse
jQuery('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
-});
\ No newline at end of file
+
+ jQuery('.wp-no-js-hidden').removeClass( 'wp-no-js-hidden' );
+});
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index 0cb44c49ba..28b78f0c6a 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -95,6 +95,17 @@ addLoadEvent( function() {
jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
var newCatParent = false;
var newCatParentOption = false;
+ var noSyncChecks = false; // prophylactic. necessary?
+ var syncChecks = function() {
+ if ( noSyncChecks )
+ return;
+ noSyncChecks = true;
+ var th = jQuery(this);
+ var c = th.is(':checked');
+ var id = th.val().toString();
+ jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+ noSyncChecks = false;
+ };
var catAddAfter = function( r, s ) {
if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
@@ -102,14 +113,16 @@ addLoadEvent( function() {
var t = jQuery(jQuery(this).text());
t.find( 'label' ).each( function() {
var th = jQuery(this);
- var id = th.find('input').val();
- if ( newCatParent.find( 'option[value=' + id + ']' ).size() )
+ var val = th.find('input').val();
+ var id = th.find('input')[0].id
+ jQuery('#' + id).change( syncChecks );
+ if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
return;
var name = jQuery.trim( th.text() );
- var o = jQuery( '
' ).text( name );
+ var o = jQuery( '
' ).text( name );
newCatParent.prepend( o );
- newCatParentOption.attr( 'selected', true );
} );
+ newCatParentOption.attr( 'selected', true );
} );
};
jQuery('#categorychecklist').wpList( {
@@ -122,4 +135,5 @@ addLoadEvent( function() {
categoryTabs.tabsClick( 1 );
return false;
} );
+ jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
});
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index f46d741d06..cd34bcb587 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -1237,6 +1237,10 @@ a.view-comment-post-link {
width: 30%;
}
+#category-add input#category-add-sumbit {
+ width: auto;
+}
+
#categorydiv ul#category-tabs {
float: left;
width: 120px;
@@ -1279,5 +1283,6 @@ ul.categorychecklist li {
/* Global classes */
.wp-hidden-children .wp-hidden-child { display: none; }
+.wp-no-js-hidden { display: none; }
.ui-tabs-hide { display: none; }
.form-input-tip { color: #999; }