Add hotkeys.js to all pages that list comments and prevent error if not loaded, see #7643

git-svn-id: http://svn.automattic.com/wordpress/trunk@8780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-08-30 07:16:16 +00:00
parent 4493a6b110
commit 450babca59
5 changed files with 12 additions and 4 deletions

View File

@ -66,8 +66,10 @@ $query_str = "post_type=page&orderby=menu_order title&what_to_show=posts$post_st
$query_str = apply_filters('manage_pages_query', $query_str);
wp($query_str);
if ( is_singular() )
if ( is_singular() ) {
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script( 'jquery-table-hotkeys' );
}
require_once('admin-header.php');

View File

@ -53,8 +53,10 @@ wp_enqueue_script('admin-forms');
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
if ( 1 == count($posts) && is_singular() )
if ( 1 == count($posts) && is_singular() ) {
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script( 'jquery-table-hotkeys' );
}
require_once('admin-header.php');

View File

@ -235,7 +235,8 @@ commentReply = {
$(document).ready(function(){
if ( typeof QTags != 'undefined' )
ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
jQuery.table_hotkeys(jQuery('table.widefat'), ['a', 'u', 's', 'd', 'r']);
if ( typeof $.table_hotkeys != 'undefined' )
$.table_hotkeys($('table.widefat'), ['a', 'u', 's', 'd', 'r']);
});
})(jQuery);

View File

@ -131,6 +131,7 @@ case 'edit':
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script( 'jquery-table-hotkeys' );
if ( current_user_can('edit_post', $post_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) {

View File

@ -51,8 +51,10 @@ wp_enqueue_script( 'admin-forms' );
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
if ( is_singular() )
if ( is_singular() ) {
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script( 'jquery-table-hotkeys' );
}
require_once('admin-header.php');