From 450babca5905d7c3d5520554d847e2af6163b76c Mon Sep 17 00:00:00 2001 From: azaozz Date: Sat, 30 Aug 2008 07:16:16 +0000 Subject: [PATCH] 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 --- wp-admin/edit-pages.php | 4 +++- wp-admin/edit.php | 4 +++- wp-admin/js/edit-comments.js | 3 ++- wp-admin/post.php | 1 + wp-admin/upload.php | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index ef07045161..a328dcf134 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -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'); diff --git a/wp-admin/edit.php b/wp-admin/edit.php index e0d9965bd1..03a728d04c 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -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'); diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 1144b83ef5..cf00e39b83 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -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); diff --git a/wp-admin/post.php b/wp-admin/post.php index 346b276a03..3ee28fa194 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -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 ) ) { diff --git a/wp-admin/upload.php b/wp-admin/upload.php index a7946fb12a..ee95f6674e 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -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');