<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12015] trunk: Add l10n thousands delimiter and decimal point to JS,
fix updating of comments numbers on the dashboard and keyboard shortcuts for comments moderation
(t = trash, z = restore/undo)</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12015">12015</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-10-09 09:02:22 +0000 (Fri, 09 Oct 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add l10n thousands delimiter and decimal point to JS, fix updating of comments numbers on the dashboard and keyboard shortcuts for comments moderation (t = trash, z = restore/undo)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminheaderphp">trunk/wp-admin/admin-header.php</a></li>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjseditcommentsdevjs">trunk/wp-admin/js/edit-comments.dev.js</a></li>
<li><a href="#trunkwpadminjseditcommentsjs">trunk/wp-admin/js/edit-comments.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-header.php (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-header.php        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-admin/admin-header.php        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> //<![CDATA[
</span><span class="cx"> addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
</span><span class="cx"> var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
</span><del>-var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>';
</del><ins>+var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>', thousandsSeparator = '<?php echo $wp_locale->number_format['thousands_sep']; ?>', decimalPoint = '<?php echo $wp_locale->number_format['decimal_point']; ?>';
</ins><span class="cx"> //]]>
</span><span class="cx"> </script>
</span><span class="cx"> <?php
</span></span></pre></div>
<a id="trunkwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/dashboard.php (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-admin/includes/dashboard.php        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">         */
</span><span class="cx">
</span><span class="cx">         // Total Comments
</span><del>-        $num = number_format_i18n($num_comm->total_comments);
</del><ins>+        $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
</ins><span class="cx">         $text = _n( 'Comment', 'Comments', $num_comm->total_comments );
</span><span class="cx">         if ( current_user_can( 'moderate_comments' ) ) {
</span><span class="cx">                 $num = "<a href='edit-comments.php'>$num</a>";
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx">         echo '<td class="t pages">' . $text . '</td>';
</span><span class="cx">
</span><span class="cx">         // Approved Comments
</span><del>-        $num = number_format_i18n($num_comm->approved);
</del><ins>+        $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
</ins><span class="cx">         $text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved );
</span><span class="cx">         if ( current_user_can( 'moderate_comments' ) ) {
</span><span class="cx">                 $num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
</span><span class="lines">@@ -280,10 +280,10 @@
</span><span class="cx">         echo '<td class="t cats">' . $text . '</td>';
</span><span class="cx">
</span><span class="cx">         // Pending Comments
</span><del>-        $num = number_format_i18n($num_comm->moderated);
</del><ins>+        $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
</ins><span class="cx">         $text = _n( 'Pending', 'Pending', $num_comm->moderated );
</span><span class="cx">         if ( current_user_can( 'moderate_comments' ) ) {
</span><del>-                $num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
</del><ins>+                $num = "<a href='edit-comments.php?comment_status=moderated'>$num</a>";
</ins><span class="cx">                 $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
</span><span class="cx">         }
</span><span class="cx">         echo '<td class="b b-waiting">' . $num . '</td>';
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-admin/includes/template.php        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -2158,7 +2158,7 @@
</span><span class="cx">
</span><span class="cx">                                 if ( $user_can ) {
</span><span class="cx">                                         if ( 'trash' == $the_comment_status ) {
</span><del>-                                                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>';
</del><ins>+                                                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
</ins><span class="cx">                                                 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
</span><span class="cx">                                         } else {
</span><span class="cx">                                                 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
</span></span></pre></div>
<a id="trunkwpadminjseditcommentsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/edit-comments.dev.js (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/edit-comments.dev.js        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-admin/js/edit-comments.dev.js        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -17,23 +17,22 @@
</span><span class="cx">                         c.find('div.comment_status').html('1')
</span><span class="cx">
</span><span class="cx">                 $('span.pending-count').each( function() {
</span><del>-                        var a = $(this), n;
-                        n = a.html().replace(/[ ,.]+/g, '');
</del><ins>+                        var a = $(this), n, dif;
+                        n = a.html().replace(/[^0-9]+/g, '');
</ins><span class="cx">                         n = parseInt(n,10);
</span><span class="cx">                         if ( isNaN(n) ) return;
</span><del>-                        n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
</del><ins>+                        dif = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
+                        n = n + dif;
</ins><span class="cx">                         if ( n < 0 ) { n = 0; }
</span><span class="cx">                         a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
</span><del>-                        n = n.toString();
-                        if ( n.length > 3 )
-                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                        a.html(n);
</del><ins>+                        updateCount(a, n);
+                        dashboardTotals();
</ins><span class="cx">                 });
</span><span class="cx">         };
</span><span class="cx">
</span><span class="cx">         // Send current total, page, per_page and url
</span><span class="cx">         delBefore = function( settings, list ) {
</span><del>-                var cl = $(settings.target).attr('className'), id, el, n, h, a, author;
</del><ins>+                var cl = $(settings.target).attr('className'), id, el, n, h, a, to, author;
</ins><span class="cx">
</span><span class="cx">                 settings.data._total = totalInput.val() || 0;
</span><span class="cx">                 settings.data._per_page = perPageInput.val() || 0;
</span><span class="lines">@@ -60,7 +59,7 @@
</span><span class="cx">                         $('strong', '#trashundo-' + id).html(author);
</span><span class="cx">                         a = $('a.undo-trash', '#trashundo-' + id);
</span><span class="cx">                         a.attr('href', 'comment.php?action=untrashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce);
</span><del>-                        a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-t vim-destructive');
</del><ins>+                        a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-z vim-destructive');
</ins><span class="cx">
</span><span class="cx">                         a.click(function(){
</span><span class="cx">                                 list.wpList.del(this);
</span><span class="lines">@@ -71,7 +70,7 @@
</span><span class="cx">                                 return false;
</span><span class="cx">                         });
</span><span class="cx">
</span><del>-                        window.setTimeout( function(){
</del><ins>+                        to = window.setTimeout( function(){
</ins><span class="cx">                                 $('#trashundo-' + id).fadeOut('slow', function(){ $(this).remove(); });
</span><span class="cx">                         }, 200000 );
</span><span class="cx">                 }
</span><span class="lines">@@ -81,31 +80,75 @@
</span><span class="cx">
</span><span class="cx">         // Updates the current total (as displayed visibly)
</span><span class="cx">         updateTotalCount = function( total, time, setConfidentTime ) {
</span><del>-                if ( time < lastConfidentTime ) {
</del><ins>+                if ( time < lastConfidentTime )
</ins><span class="cx">                         return;
</span><del>-                }
</del><ins>+
+                if ( setConfidentTime )
+                        lastConfidentTime = time;
+
</ins><span class="cx">                 totalInput.val( total.toString() );
</span><del>-                if ( setConfidentTime ) {
-                        lastConfidentTime = time;
-                }
</del><span class="cx">                 $('span.total-type-count').each( function() {
</span><del>-                        var a = $(this), n;
-                        n = totalInput.val().toString();
-                        if ( n.length > 3 )
-                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                        a.html(n);
</del><ins>+                        updateCount( $(this), total );
</ins><span class="cx">                 });
</span><span class="cx">         };
</span><span class="cx">
</span><ins>+        function dashboardTotals(n) {
+                var dash = $('#dashboard_right_now'), total, appr, totalN, apprN;
+
+                n = n || 0;
+                if ( isNaN(n) || !dash.length )
+                        return;
+
+                total = $('span.total-count', dash);
+                appr = $('span.approved-count', dash);
+                totalN = getCount(total);
+                apprN = getCount(appr);
+
+                if ( totalN ) {
+                        totalN = totalN + n;
+                        apprN = totalN - getCount( $('span.pending-count', dash) );
+                        updateCount(total, totalN);
+                        updateCount(appr, apprN);
+                }
+        }
+
+        function getCount(el) {
+                var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );
+                if ( isNaN(n) )
+                        return 0;
+                return n;
+        }
+
+        function updateCount(el, n) {
+                if ( isNaN(n) )
+                        return;
+                n = n < 1 ? '0' : n.toString();
+                if ( n.length > 3 )
+                        n = n.substr(0, n.length-3) + thousandsSeparator + n.substr(-3);
+                el.html(n);
+        }
+
</ins><span class="cx">         // In admin-ajax.php, we send back the unix time stamp instead of 1 on success
</span><span class="cx">         delAfter = function( r, settings ) {
</span><del>-                var total, pageLinks, untrash = $(settings.target).parent().is('span.untrash');
</del><ins>+                var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), spam, trash;
</ins><span class="cx">
</span><ins>+                function getUpdate(s) {
+                        if ( $(settings.target).parent().is('span.' + s) )
+                                return 1;
+                        else if ( $('#' + settings.element).is('.' + s) )
+                                return -1;
+
+                        return 0;
+                }
+                spam = getUpdate('spam');
+                trash = getUpdate('trash');
+
+                if ( untrash )
+                        trash = -1;
+
</ins><span class="cx">                 $('span.pending-count').each( function() {
</span><del>-                        var a = $(this), n, unapproved = $('#' + settings.element).is('.unapproved');
-                        n = a.html().replace(/[ ,.]+/g, '');
-                        n = parseInt(n,10);
-                        if ( isNaN(n) ) return;
</del><ins>+                        var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved');
+
</ins><span class="cx">                         if ( $(settings.target).parent().is('span.unapprove') || ( untrash && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
</span><span class="cx">                                 n = n + 1;
</span><span class="cx">                         } else if ( unapproved ) { // we deleted a formerly unapproved comment
</span><span class="lines">@@ -113,65 +156,41 @@
</span><span class="cx">                         }
</span><span class="cx">                         if ( n < 0 ) { n = 0; }
</span><span class="cx">                         a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
</span><del>-                        n = n.toString();
-                        if ( n.length > 3 )
-                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                        a.html(n);
</del><ins>+                        updateCount(a, n);
+                        dashboardTotals();
</ins><span class="cx">                 });
</span><span class="cx">
</span><span class="cx">                 $('span.spam-count').each( function() {
</span><del>-                        var a = $(this), n;
-                        n = a.html().replace(/[ ,.]+/g, '');
-                        n = parseInt(n,10);
-                        if ( isNaN(n) ) return;
-                        if ( $(settings.target).parent().is( 'span.spam' ) ) { // we marked a comment as spam
-                                n = n + 1;
-                        } else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam
-                                n = n - 1;
-                        }
-                        if ( n < 0 ) { n = 0; }
-                        n = n.toString();
-                        if ( n.length > 3 )
-                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                        a.html(n);
</del><ins>+                        var a = $(this), n = getCount(a) + spam;
+                        updateCount(a, n);
</ins><span class="cx">                 });
</span><span class="cx">
</span><span class="cx">                 $('span.trash-count').each( function() {
</span><del>-                        var a = $(this), n;
-                        n = a.html().replace(/[ ,.]+/g, '');
-                        n = parseInt(n,10);
-                        if ( isNaN(n) ) return;
-                        if ( $(settings.target).parent().is( 'span.trash' ) ) { // we trashed a comment
-                                n = n + 1;
-                        } else if ( $('#' + settings.element).is('.trash') || untrash ) { // we deleted or untrashed a trash comment
-                                n = n - 1;
-                        }
-                        if ( n < 0 ) { n = 0; }
-                        n = n.toString();
-                        if ( n.length > 3 )
-                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                        a.html(n);
</del><ins>+                        var a = $(this), n = getCount(a) + trash;
+                        updateCount(a, n);
</ins><span class="cx">                 });
</span><span class="cx">
</span><del>-                // XML response
-                if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
-                        // Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links)
-                        total = settings.parsed.responses[0].supplemental.total || false;
-                        pageLinks = settings.parsed.responses[0].supplemental.pageLinks || false;
-
-                        if ( total && pageLinks ) {
-                                updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true );
-                                if ( $.trim( pageLinks ) ) {
</del><ins>+                if ( $('#dashboard_right_now').length ) {
+                        N = spam || trash || 0;
+                        if ( N > 0 )
+                                dashboardTotals(-1);
+                        else if ( N < 0 )
+                                dashboardTotals(1);
+                } else {
+                        // XML response
+                        if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
+                                pageLinks = settings.parsed.responses[0].supplemental.pageLinks || '';
+                                if ( $.trim( pageLinks ) )
</ins><span class="cx">                                         $('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( pageLinks ) );
</span><del>-                                } else {
</del><ins>+                                else
</ins><span class="cx">                                         $('.tablenav-pages').find( '.page-numbers' ).remove();
</span><del>-                                }
</del><span class="cx">                         }
</span><del>-                } else {
-                        // Decrement the total
</del><ins>+
</ins><span class="cx">                         total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
</span><del>-                        if ( total-- < 0 )
</del><ins>+                        total = total - spam - trash;
+                        if ( total < 0 )
</ins><span class="cx">                                 total = 0;
</span><ins>+
</ins><span class="cx">                         updateTotalCount( total, r, false );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -420,26 +439,33 @@
</span><span class="cx">                                         window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
</span><span class="cx">                         }
</span><span class="cx">                 };
</span><ins>+
</ins><span class="cx">                 edit_comment = function(event, current_row) {
</span><span class="cx">                         window.location = $('span.edit a', current_row).attr('href');
</span><span class="cx">                 };
</span><ins>+
</ins><span class="cx">                 toggle_all = function() {
</span><span class="cx">                         toggleWithKeyboard = true;
</span><del>-                        $('#comments-form thead #cb input:checkbox').click().attr('checked', '');
</del><ins>+                        $('input:checkbox', '#cb').click().attr('checked', '');
</ins><span class="cx">                         toggleWithKeyboard = false;
</span><del>-                }
</del><ins>+                };
+
</ins><span class="cx">                 make_bulk = function(value) {
</span><del>-                        return function(event, _) {
-                                $('option[value='+value+']').attr('selected', 'selected');
-                                $('form#comments-form')[0].submit();
</del><ins>+                        return function() {
+                                var scope = $('select[name="action"]');
+                                $('option[value='+value+']', scope).attr('selected', 'selected');
+                                $('#comments-form').submit();
</ins><span class="cx">                         }
</span><span class="cx">                 };
</span><del>-                $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment],
-                                ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
-                                ['shift+d', make_bulk('delete')], ['shift+x', toggle_all],
-                                ['shift+u', make_bulk('unapprove')]],
-                                {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
-                                prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
</del><ins>+
+                $.table_hotkeys(
+                        $('table.widefat'),
+                        ['a', 'u', 's', 'd', 'r', 'q', 't', 'z', ['e', edit_comment], ['shift+x', toggle_all],
+                        ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
+                        ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')],
+                        ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]],
+                        { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
+                        prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') }
</ins><span class="cx">                 );
</span><span class="cx">         }
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkwpadminjseditcommentsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/edit-comments.js (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/edit-comments.js        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-admin/js/edit-comments.js        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('.tablenav input[name="_total"]',"#comments-form");i=a('.tablenav input[name="_per_page"]',"#comments-form");h=a('.tablenav input[name="_page"]',"#comments-form");c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.closest("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(m,q){var s=a(m.target).attr("className"),j,k,l,p,r,o;m.data._total=g.val()||0;m.data._per_page=i.val()||0;m.data._page=h.val()||0;m.data._url=document.location.href;if(s.indexOf(":trash=1")!=-1){j=s.replace(/.*?comment-([0-9]+).*/,"$1");k=a("#comment-"+j);note=a("#undo-holder").html();if(k.is("tr")){l=k.children(":visible").length;o=a(".author strong",k).html();p=a('<tr id="trashundo-'+j+'" style="display:none;"><td class="trash-undo" colspan="'+l+'">'+note+"</td></tr>")}else{o=a(".comment-author",k).html();p=a('<div id="trashundo-'+j+'" style="display:none;" class="trash-undo">'+note+"</div>")}k.before(p);p.fadeIn(400);a("strong","#trashundo-"+j).html(o);r=a("a.undo-trash","#trashundo-"+j);r.attr("href","comment.php?action=untrashcomment&c="+j+"&_ajax_nonce="+m.data._ajax_nonce);r.attr("className","delete:the-comment-list:comment-"+j+"::untrash=1 vim-t vim-destructive");r.click(function(){q.wpList.del(this);a("#trashundo-"+j).fadeOut(250,function(){a(this).remove();a("#comment-"+j).css("backgroundColor","").fadeIn(400)});return false});window.setTimeout(function(){a("#trashundo-"+j).fadeOut("slow",function(){a(this).remove()})},200000)}return m};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(m,k){var l,n,j=a(k.target).parent().is("span.untrash");a("span.pending-count").each(function(){var o=a(this),q,p=a("#"+k.element).is(".unapproved");q=o.html().replace(/[ ,.]+/g,"");q=parseInt(q,10);if(isNaN(q)){return}if(a(k.target).parent().is("span.unapprove")||(j&&p)){q=q+1}else{if(p){q=q-1}}if(q<0){q=0}o.closest("#awaiting-mod")[0==q?"addClass":"removeClass"]("count-0");q=q.toString();if(q.length>3){q=q.substr(0,q.length-3)+" "+q.substr(-3)}o.html(q)});a("span.spam-count").each(function(){var o=a(this),p;p=o.html().replace(/[ ,.]+/g,"");p=parseInt(p,10);if(isNaN(p)){return}if(a(k.target).parent().is("span.spam")){p=p+1}else{if(a("#"+k.element).is(".spam")){p=p-1}}if(p<0){p=0}p=p.toString();if(p.length>3){p=p.substr(0,p.length-3)+" "+p.substr(-3)}o.html(p)});a("span.trash-count").each(function(){var o=a(this),p;p=o.html().replace(/[ ,.]+/g,"");p=parseInt(p,10);if(isNaN(p)){return}if(a(k.target).parent().is("span.trash")){p=p+1}else{if(a("#"+k.element).is(".trash")||j){p=p-1}}if(p<0){p=0}p=p.toString();if(p.length>3){p=p.substr(0,p.length-3)+" "+p.substr(-3)}o.html(p)});if(("object"==typeof m)&&f<k.parsed.responses[0].supplemental.time){l=k.parsed.responses[0].supplemental.total||false;n=k.parsed.responses[0].supplemental.pageLinks||false;if(l&&n){d(l,k.parsed.responses[0].supplemental.time,true);if(a.trim(n)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(n))}else{a(".tablenav-pages").find(".page-numbers").remove()}}}else{l=g.val()?parseInt(g.val(),10):0;if(l--<0){l=0}d(l,m,false)}if(theExtraList.size()==0||theExtraList.children().size()==0||j){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var c,e,h,l=0,g,i,d,k;c=a('.tablenav input[name="_total"]',"#comments-form");e=a('.tablenav input[name="_per_page"]',"#comments-form");h=a('.tablenav input[name="_page"]',"#comments-form");g=function(n,m){var o=a("#"+m.element);if(o.is(".unapproved")){o.find("div.comment_status").html("0")}else{o.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var p=a(this),r,q;r=p.html().replace(/[^0-9]+/g,"");r=parseInt(r,10);if(isNaN(r)){return}q=a("#"+m.element).is("."+m.dimClass)?1:-1;r=r+q;if(r<0){r=0}p.closest("#awaiting-mod")[0==r?"addClass":"removeClass"]("count-0");f(p,r);j()})};i=function(q,t){var w=a(q.target).attr("className"),m,o,p,s,u,v,r;q.data._total=c.val()||0;q.data._per_page=e.val()||0;q.data._page=h.val()||0;q.data._url=document.location.href;if(w.indexOf(":trash=1")!=-1){m=w.replace(/.*?comment-([0-9]+).*/,"$1");o=a("#comment-"+m);note=a("#undo-holder").html();if(o.is("tr")){p=o.children(":visible").length;r=a(".author strong",o).html();s=a('<tr id="trashundo-'+m+'" style="display:none;"><td class="trash-undo" colspan="'+p+'">'+note+"</td></tr>")}else{r=a(".comment-author",o).html();s=a('<div id="trashundo-'+m+'" style="display:none;" class="trash-undo">'+note+"</div>")}o.before(s);s.fadeIn(400);a("strong","#trashundo-"+m).html(r);u=a("a.undo-trash","#trashundo-"+m);u.attr("href","comment.php?action=untrashcomment&c="+m+"&_ajax_nonce="+q.data._ajax_nonce);u.attr("className","delete:the-comment-list:comment-"+m+"::untrash=1 vim-z vim-destructive");u.click(function(){t.wpList.del(this);a("#trashundo-"+m).fadeOut(250,function(){a(this).remove();a("#comment-"+m).css("backgroundColor","").fadeIn(400)});return false});v=window.setTimeout(function(){a("#trashundo-"+m).fadeOut("slow",function(){a(this).remove()})},200000)}return q};d=function(m,n,o){if(n<l){return}if(o){l=n}c.val(m.toString());a("span.total-type-count").each(function(){f(a(this),m)})};function j(s){var r=a("#dashboard_right_now"),o,q,p,m;s=s||0;if(isNaN(s)||!r.length){return}o=a("span.total-count",r);q=a("span.approved-count",r);p=b(o);m=b(q);if(p){p=p+s;m=p-b(a("span.pending-count",r));f(o,p);f(q,m)}}function b(m){var o=parseInt(m.html().replace(/[^0-9]+/g,""),10);if(isNaN(o)){return 0}return o}function f(m,o){if(isNaN(o)){return}o=o<1?"0":o.toString();if(o.length>3){o=o.substr(0,o.length-3)+thousandsSeparator+o.substr(-3)}m.html(o)}k=function(m,n){var q,o,p,u=a(n.target).parent().is("span.untrash"),t,s;function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}a("span.pending-count").each(function(){var r=a(this),x=b(r),w=a("#"+n.element).is(".unapproved");if(a(n.target).parent().is("span.unapprove")||(u&&w)){x=x+1}else{if(w){x=x-1}}if(x<0){x=0}r.closest("#awaiting-mod")[0==x?"addClass":"removeClass"]("count-0");f(r,x);j()});a("span.spam-count").each(function(){var r=a(this),w=b(r)+t;f(r,w)});a("span.trash-count").each(function(){var r=a(this),w=b(r)+s;f(r,w)});if(a("#dashboard_right_now").length){p=t||s||0;if(p>0){j(-1)}else{if(p<0){j(1)}}}else{if(("object"==typeof m)&&l<n.parsed.responses[0].supplemental.time){o=n.parsed.responses[0].supplemental.pageLinks||"";if(a.trim(o)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(o))}else{a(".tablenav-pages").find(".page-numbers").remove()}}q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}d(q,m,false)}if(theExtraList.size()==0||theExtraList.children().size()==0||u){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:i,dimAfter:g,delAfter:k,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a("option[value="+f+"]",g).attr("selected","selected");a("#comments-form").submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","t","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12014 => 12015)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-10-08 21:51:34 UTC (rev 12014)
+++ trunk/wp-includes/script-loader.php        2009-10-09 09:02:22 UTC (rev 12015)
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx">                 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
</span><span class="cx">                 $scripts->add_data( 'user-profile', 'group', 1 );
</span><span class="cx">
</span><del>-                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091007' );
</del><ins>+                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091008' );
</ins><span class="cx">                 $scripts->add_data( 'admin-comments', 'group', 1 );
</span><span class="cx">                 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
</span><span class="cx">                         'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
</span></span></pre>
</div>
</div>
</body>
</html>