Ticket #33414: 33414.4.diff
File 33414.4.diff, 3.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-comments.php
104 104 wp_enqueue_script('admin-comments'); 105 105 enqueue_comment_hotkeys_js(); 106 106 107 if ( $post_id ) 108 $title = sprintf( __( 'Comments on “%s”' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) ); 109 else 110 $title = __('Comments'); 107 if ( $post_id ) { 108 $comments_count = wp_count_comments( $post_id ); 109 $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ); 110 if ( $comments_count->moderated > 0 ) { 111 $title = sprintf( 112 __( 'Comments (%s) on “%s”' ), 113 number_format_i18n( $comments_count->moderated ), 114 $draft_or_post_title 115 ); 116 } else { 117 $title = sprintf( __( 'Comments on “%s”' ), $draft_or_post_title ); 118 } 119 } else { 120 $comments_count = wp_count_comments(); 121 if ( $comments_count->moderated > 0 ) { 122 $title = sprintf( 123 __( 'Comments (%s)' ), 124 number_format_i18n( $comments_count->moderated ) 125 ); 126 } else { 127 $title = __( 'Comments' ); 128 } 129 } 111 130 112 131 add_screen_option( 'per_page' ); 113 132 -
src/wp-admin/js/edit-comments.js
2 2 var setCommentsList, theList, theExtraList, commentReply; 3 3 4 4 (function($) { 5 var getCount, updateCount, updateCountText, updatePending, updateApproved; 5 var getCount, updateCount, updateCountText, updatePending, updateApproved, 6 updateHtmlTitle, adminTitle = document.title; 6 7 7 8 setCommentsList = function() { 8 9 var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff, 9 lastConfidentTime = 0 ;10 lastConfidentTime = 0, titleDiv, titleRegEx; 10 11 11 12 totalInput = $('input[name="_total"]', '#comments-form'); 12 13 perPageInput = $('input[name="_per_page"]', '#comments-form'); … … 135 136 el.html(n); 136 137 }; 137 138 139 updateHtmlTitle = function ( diff ) { 140 var newTitle, regexMatch, titleCount; 141 142 titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' ); 143 // count funcs operate on a $'d element 144 titleDiv = titleDiv || $( '<div />' ); 145 newTitle = adminTitle; 146 147 titleDiv.html( document.title ); 148 titleCount = getCount( titleDiv ) + diff; 149 if ( titleCount >= 1 ) { 150 updateCount( titleDiv, titleCount ); 151 regexMatch = titleRegEx.exec( document.title ); 152 if ( regexMatch ) { 153 newTitle = document.title.replace( regexMatch[0], 'Comments (' + titleDiv.text() + ') ' ); 154 } 155 } else { 156 regexMatch = titleRegEx.exec( newTitle ); 157 if ( regexMatch ) { 158 newTitle = newTitle.replace( regexMatch[0], 'Comments' ); 159 } 160 } 161 document.title = newTitle; 162 }; 163 138 164 updatePending = function( diff, commentPostId ) { 139 165 var postSelector = '.post-com-count-' + commentPostId, 140 166 noClass = 'comment-count-no-pending', … … 143 169 pending, 144 170 noPending; 145 171 172 updateHtmlTitle( diff ); 173 146 174 $( 'span.pending-count' ).each(function() { 147 175 var a = $(this), n = getCount(a) + diff; 148 176 if ( n < 1 )