Changeset 33821
- Timestamp:
- 08/31/2015 05:57:32 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-comments.php
r33589 r33821 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' ); -
trunk/src/wp-admin/js/edit-comments.js
r33692 r33821 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, 11 isDashboard = $('#dashboard_right_now').length; 10 12 11 13 totalInput = $('input[name="_total"]', '#comments-form'); … … 136 138 }; 137 139 140 updateHtmlTitle = function ( diff ) { 141 var newTitle, regExMatch, titleCount; 142 143 titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' ); 144 // count funcs operate on a $'d element 145 titleDiv = titleDiv || $( '<div />' ); 146 newTitle = adminTitle; 147 148 titleDiv.html( document.title ); 149 titleCount = getCount( titleDiv ) + diff; 150 if ( titleCount >= 1 ) { 151 updateCount( titleDiv, titleCount ); 152 regExMatch = titleRegEx.exec( document.title ); 153 if ( regExMatch ) { 154 newTitle = document.title.replace( regExMatch[0], 'Comments (' + titleDiv.text() + ') ' ); 155 } 156 } else { 157 regExMatch = titleRegEx.exec( newTitle ); 158 if ( regExMatch ) { 159 newTitle = newTitle.replace( regExMatch[0], 'Comments' ); 160 } 161 } 162 document.title = newTitle; 163 }; 164 138 165 updatePending = function( diff, commentPostId ) { 139 166 var postSelector = '.post-com-count-' + commentPostId, … … 143 170 pending, 144 171 noPending; 172 173 if ( ! isDashboard ) { 174 updateHtmlTitle( diff ); 175 } 145 176 146 177 $( 'span.pending-count' ).each(function() { … … 391 422 } 392 423 393 if ( ! $('#dashboard_right_now').length) {424 if ( ! isDashboard ) { 394 425 total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; 395 426 if ( $(settings.target).parent().is('span.undo') )
Note: See TracChangeset
for help on using the changeset viewer.