WordPress.org

Make WordPress Core

Changeset 12015


Ignore:
Timestamp:
10/09/09 09:02:22 (5 years ago)
Author:
azaozz
Message:

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)

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r11508 r12015  
    4242addLoadEvent = 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();}}}; 
    4343var 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() ?>'}; 
    44 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>'; 
     44var 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']; ?>'; 
    4545//]]> 
    4646</script> 
  • trunk/wp-admin/includes/dashboard.php

    r12008 r12015  
    237237 
    238238    // Total Comments 
    239     $num = number_format_i18n($num_comm->total_comments); 
     239    $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>'; 
    240240    $text = _n( 'Comment', 'Comments', $num_comm->total_comments ); 
    241241    if ( current_user_can( 'moderate_comments' ) ) { 
     
    259259 
    260260    // Approved Comments 
    261     $num = number_format_i18n($num_comm->approved); 
     261    $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>'; 
    262262    $text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved ); 
    263263    if ( current_user_can( 'moderate_comments' ) ) { 
     
    281281 
    282282    // Pending Comments 
    283     $num = number_format_i18n($num_comm->moderated); 
     283    $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>'; 
    284284    $text = _n( 'Pending', 'Pending', $num_comm->moderated ); 
    285285    if ( current_user_can( 'moderate_comments' ) ) { 
    286         $num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>"; 
     286        $num = "<a href='edit-comments.php?comment_status=moderated'>$num</a>"; 
    287287        $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>"; 
    288288    } 
  • trunk/wp-admin/includes/template.php

    r12008 r12015  
    21592159                if ( $user_can ) { 
    21602160                    if ( 'trash' == $the_comment_status ) { 
    2161                         $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>'; 
     2161                        $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; 
    21622162                        $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>'; 
    21632163                    } else { 
  • trunk/wp-admin/js/edit-comments.dev.js

    r12008 r12015  
    1818 
    1919        $('span.pending-count').each( function() { 
    20             var a = $(this), n; 
    21             n = a.html().replace(/[ ,.]+/g, ''); 
     20            var a = $(this), n, dif; 
     21            n = a.html().replace(/[^0-9]+/g, ''); 
    2222            n = parseInt(n,10); 
    2323            if ( isNaN(n) ) return; 
    24             n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); 
     24            dif = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1; 
     25            n = n + dif; 
    2526            if ( n < 0 ) { n = 0; } 
    2627            a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 
    27             n = n.toString(); 
    28             if ( n.length > 3 ) 
    29                 n = n.substr(0, n.length-3)+' '+n.substr(-3); 
    30             a.html(n); 
     28            updateCount(a, n); 
     29            dashboardTotals(); 
    3130        }); 
    3231    }; 
     
    3433    // Send current total, page, per_page and url 
    3534    delBefore = function( settings, list ) { 
    36         var cl = $(settings.target).attr('className'), id, el, n, h, a, author; 
     35        var cl = $(settings.target).attr('className'), id, el, n, h, a, to, author; 
    3736 
    3837        settings.data._total = totalInput.val() || 0; 
     
    6160            a = $('a.undo-trash', '#trashundo-' + id); 
    6261            a.attr('href', 'comment.php?action=untrashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce); 
    63             a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-t vim-destructive'); 
     62            a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-z vim-destructive'); 
    6463 
    6564            a.click(function(){ 
     
    7271            }); 
    7372 
    74             window.setTimeout( function(){ 
     73            to = window.setTimeout( function(){ 
    7574                $('#trashundo-' + id).fadeOut('slow', function(){ $(this).remove(); }); 
    7675            }, 200000 ); 
     
    8281    // Updates the current total (as displayed visibly) 
    8382    updateTotalCount = function( total, time, setConfidentTime ) { 
    84         if ( time < lastConfidentTime ) { 
     83        if ( time < lastConfidentTime ) 
    8584            return; 
    86         } 
     85 
     86        if ( setConfidentTime ) 
     87            lastConfidentTime = time; 
     88 
    8789        totalInput.val( total.toString() ); 
    88         if ( setConfidentTime ) { 
    89             lastConfidentTime = time; 
    90         } 
    9190        $('span.total-type-count').each( function() { 
    92             var a = $(this), n; 
    93             n = totalInput.val().toString(); 
    94             if ( n.length > 3 ) 
    95                 n = n.substr(0, n.length-3)+' '+n.substr(-3); 
    96             a.html(n); 
     91            updateCount( $(this), total ); 
    9792        }); 
    9893    }; 
     94 
     95    function dashboardTotals(n) { 
     96        var dash = $('#dashboard_right_now'), total, appr, totalN, apprN; 
     97 
     98        n = n || 0; 
     99        if ( isNaN(n) || !dash.length ) 
     100            return; 
     101 
     102        total = $('span.total-count', dash); 
     103        appr = $('span.approved-count', dash); 
     104        totalN = getCount(total); 
     105        apprN = getCount(appr); 
     106 
     107        if ( totalN ) { 
     108            totalN = totalN + n; 
     109            apprN = totalN - getCount( $('span.pending-count', dash) ); 
     110            updateCount(total, totalN); 
     111            updateCount(appr, apprN); 
     112        } 
     113    } 
     114 
     115    function getCount(el) { 
     116        var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 ); 
     117        if ( isNaN(n) ) 
     118            return 0; 
     119        return n; 
     120    } 
     121 
     122    function updateCount(el, n) { 
     123        if ( isNaN(n) ) 
     124            return; 
     125        n = n < 1 ? '0' : n.toString(); 
     126        if ( n.length > 3 ) 
     127            n = n.substr(0, n.length-3) + thousandsSeparator + n.substr(-3); 
     128        el.html(n); 
     129    } 
    99130 
    100131    // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 
    101132    delAfter = function( r, settings ) { 
    102         var total, pageLinks, untrash = $(settings.target).parent().is('span.untrash'); 
     133        var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), spam, trash; 
     134 
     135        function getUpdate(s) { 
     136            if ( $(settings.target).parent().is('span.' + s) ) 
     137                return 1; 
     138            else if ( $('#' + settings.element).is('.' + s) ) 
     139                return -1; 
     140 
     141            return 0; 
     142        } 
     143        spam = getUpdate('spam'); 
     144        trash = getUpdate('trash'); 
     145 
     146        if ( untrash ) 
     147            trash = -1; 
    103148 
    104149        $('span.pending-count').each( function() { 
    105             var a = $(this), n, unapproved = $('#' + settings.element).is('.unapproved'); 
    106             n = a.html().replace(/[ ,.]+/g, ''); 
    107             n = parseInt(n,10); 
    108             if ( isNaN(n) ) return; 
     150            var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved'); 
     151 
    109152            if ( $(settings.target).parent().is('span.unapprove') || ( untrash && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" 
    110153                n = n + 1; 
     
    114157            if ( n < 0 ) { n = 0; } 
    115158            a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 
    116             n = n.toString(); 
    117             if ( n.length > 3 ) 
    118                 n = n.substr(0, n.length-3)+' '+n.substr(-3); 
    119             a.html(n); 
     159            updateCount(a, n); 
     160            dashboardTotals(); 
    120161        }); 
    121162 
    122163        $('span.spam-count').each( function() { 
    123             var a = $(this), n; 
    124             n = a.html().replace(/[ ,.]+/g, ''); 
    125             n = parseInt(n,10); 
    126             if ( isNaN(n) ) return; 
    127             if ( $(settings.target).parent().is( 'span.spam' ) ) { // we marked a comment as spam 
    128                 n = n + 1; 
    129             } else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam 
    130                 n = n - 1; 
    131             } 
    132             if ( n < 0 ) { n = 0; } 
    133             n = n.toString(); 
    134             if ( n.length > 3 ) 
    135                 n = n.substr(0, n.length-3)+' '+n.substr(-3); 
    136             a.html(n); 
     164            var a = $(this), n = getCount(a) + spam; 
     165            updateCount(a, n); 
    137166        }); 
    138167 
    139168        $('span.trash-count').each( function() { 
    140             var a = $(this), n; 
    141             n = a.html().replace(/[ ,.]+/g, ''); 
    142             n = parseInt(n,10); 
    143             if ( isNaN(n) ) return; 
    144             if ( $(settings.target).parent().is( 'span.trash' ) ) { // we trashed a comment 
    145                 n = n + 1; 
    146             } else if ( $('#' + settings.element).is('.trash') || untrash ) { // we deleted or untrashed a trash comment 
    147                 n = n - 1; 
    148             } 
    149             if ( n < 0 ) { n = 0; } 
    150             n = n.toString(); 
    151             if ( n.length > 3 ) 
    152                 n = n.substr(0, n.length-3)+' '+n.substr(-3); 
    153             a.html(n); 
    154         }); 
    155  
    156         // XML response 
    157         if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { 
    158             // 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) 
    159             total = settings.parsed.responses[0].supplemental.total || false; 
    160             pageLinks = settings.parsed.responses[0].supplemental.pageLinks || false; 
    161  
    162             if ( total && pageLinks ) { 
    163                 updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true ); 
    164                 if ( $.trim( pageLinks ) ) { 
     169            var a = $(this), n = getCount(a) + trash; 
     170            updateCount(a, n); 
     171        }); 
     172 
     173        if ( $('#dashboard_right_now').length ) { 
     174            N = spam || trash || 0; 
     175            if ( N > 0 ) 
     176                dashboardTotals(-1); 
     177            else if ( N < 0 ) 
     178                dashboardTotals(1); 
     179        } else { 
     180            // XML response 
     181            if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { 
     182                pageLinks = settings.parsed.responses[0].supplemental.pageLinks || ''; 
     183                if ( $.trim( pageLinks ) ) 
    165184                    $('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( pageLinks ) ); 
    166                 } else { 
     185                else 
    167186                    $('.tablenav-pages').find( '.page-numbers' ).remove(); 
    168                 } 
    169             } 
    170         } else { 
    171             // Decrement the total 
     187            } 
     188 
    172189            total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; 
    173             if ( total-- < 0 ) 
     190            total = total - spam - trash; 
     191            if ( total < 0 ) 
    174192                total = 0; 
     193 
    175194            updateTotalCount( total, r, false ); 
    176195        } 
     
    421440            } 
    422441        }; 
     442 
    423443        edit_comment = function(event, current_row) { 
    424444            window.location = $('span.edit a', current_row).attr('href'); 
    425445        }; 
     446 
    426447        toggle_all = function() { 
    427448            toggleWithKeyboard = true; 
    428             $('#comments-form thead #cb input:checkbox').click().attr('checked', ''); 
     449            $('input:checkbox', '#cb').click().attr('checked', ''); 
    429450            toggleWithKeyboard = false; 
    430         } 
     451        }; 
     452 
    431453        make_bulk = function(value) { 
    432             return function(event, _) { 
    433                 $('option[value='+value+']').attr('selected', 'selected'); 
    434                 $('form#comments-form')[0].submit(); 
     454            return function() { 
     455                var scope = $('select[name="action"]'); 
     456                $('option[value='+value+']', scope).attr('selected', 'selected'); 
     457                $('#comments-form').submit(); 
    435458            } 
    436459        }; 
    437         $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment], 
    438                 ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')], 
    439                 ['shift+d', make_bulk('delete')], ['shift+x', toggle_all], 
    440                 ['shift+u', make_bulk('unapprove')]], 
    441                 {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, 
    442                 prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')} 
     460 
     461        $.table_hotkeys( 
     462            $('table.widefat'), 
     463            ['a', 'u', 's', 'd', 'r', 'q', 't', 'z', ['e', edit_comment], ['shift+x', toggle_all], 
     464            ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')], 
     465            ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')], 
     466            ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]], 
     467            { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, 
     468            prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') } 
    443469        ); 
    444470    } 
  • trunk/wp-admin/js/edit-comments.js

    r12008 r12015  
    1 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); 
     1var 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); 
  • trunk/wp-includes/script-loader.php

    r12008 r12015  
    257257        $scripts->add_data( 'user-profile', 'group', 1 ); 
    258258 
    259         $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091007' ); 
     259        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091008' ); 
    260260        $scripts->add_data( 'admin-comments', 'group', 1 ); 
    261261        $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 
Note: See TracChangeset for help on using the changeset viewer.