WordPress.org

Make WordPress Core

Ticket #19905: 19905.patch

File 19905.patch, 24.8 KB (added by ericlewis, 2 years ago)

basic fix.

  • wp-admin/js/edit-comments.js

     
    1 var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a('<tr id="undo-'+k+'" class="undo un'+p+'" style="display:none;"><td colspan="'+m+'">'+note+"</td></tr>")}else{q=a(".comment-author",l).text();r=a('<div id="undo-'+k+'" style="display:none;" class="undo un'+p+'">'+note+"</div>")}l.before(r);a("strong","#undo-"+k).text(q);t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l<j){return}if(m){j=l}c.val(k.toString())};dashboardTotals=function(q){var p=a("#dashboard_right_now"),l,o,m,k;q=q||0;if(isNaN(q)||!p.length){return}l=a("span.total-count",p);o=a("span.approved-count",p);m=getCount(l);m=m+q;k=m-getCount(a("span.pending-count",p))-getCount(a("span.spam-count",p));updateCount(l,m);updateCount(o,k)};getCount=function(k){var l=parseInt(k.html().replace(/[^0-9]+/g,""),10);if(isNaN(l)){return 0}return l};updateCount=function(l,m){var k="";if(isNaN(m)){return}m=m<1?"0":m.toString();if(m.length>3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,t,s,l,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}if(u){s=-1}else{s=v("trash")}if(m){t=-1}else{t=v("spam")}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;if(a(n.target).parent().is("span.undo")){q++}else{q--}if(q<0){q=0}if(("object"==typeof k)&&j<n.parsed.responses[0].supplemental.time){total_items_i18n=n.parsed.responses[0].supplemental.total_items_i18n||"";if(total_items_i18n){a(".displaying-num").text(total_items_i18n);a(".total-pages").text(n.parsed.responses[0].supplemental.total_pages_i18n);a(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",n.parsed.responses[0].supplemental.total_pages==a(".current-page").val())}d(q,n.parsed.responses[0].supplemental.time,true)}else{d(q,k,false)}}if(!theExtraList||theExtraList.size()==0||theExtraList.children().size()==0||u||m){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());b()};b=function(n){var l=a.query.get(),k=a(".total-pages").text(),m=a('input[name="_per_page"]',"#comments-form").val();if(!l.paged){l.paged=1}if(l.paged>k){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",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(){var b;if(this.cid){b=a("#comment-"+this.cid);if(typeof QTags!="undefined"){QTags.closeAllTags("replycontent")}if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();a("#replycontent").css("height","");this.cid=""}},open:function(b,d,k){var m=this,e,f,i,j=a("#comment-"+b),g=j.height(),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(g>120){a("#replycontent",e).css("height",(35+g)+"px")}if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20<h){window.scroll(0,h-c+35)}else{if(o-20<p){window.scroll(0,o-35)}}a("#replycontent").focus().keyup(function(q){if(q.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .error").hide();a("#replysubmit .waiting").show();a("#replyrow input").not(":button").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;b.p=a('[name="p"]').val();if(a("#comment-"+a("#comment_ID").val()).hasClass("unapproved")){b.approve_parent=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(d){var f=this,g,i,h,e,b;if(typeof(d)=="string"){f.error({responseText:d});return false}g=wpAjax.parseAjaxResponse(d);if(g.errors){f.error({responseText:wpAjax.broken});return false}f.revert();g=g.responses[0];i=g.data;h="#comment-"+g.id;if("edit-comment"==f.act){a(h).remove()}if(g.supplemental.parent_approved){b=a("#comment-"+g.supplemental.parent_approved);updatePending(getCount(a("span.pending-count").eq(0))-1);if(this.comments_listing=="moderated"){b.animate({backgroundColor:"#CCEEBB"},400,function(){b.fadeOut()});return}}a(i).hide();a("#replyrow").after(i);h=a(h);f.addEvents(h);e=h.hasClass("unapproved")?"#FFFFE0":h.closest(".widefat, .postbox").css("backgroundColor");h.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300,function(){if(b&&b.length){b.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}})},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(document).delegate("span.delete a.delete","click",function(){return false});if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");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().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["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); 
    2  No newline at end of file 
     1var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(b){setCommentsList=function(){var q,o,m,a=0,n,l,p,k,r;q=b('input[name="_total"]',"#comments-form");o=b('input[name="_per_page"]',"#comments-form");m=b('input[name="_page"]',"#comments-form");n=function(h,d){var f=b("#"+d.element),e,g,c;e=b("#replyrow");g=b("#comment_ID",e).val();c=b("#replybtn",e);if(f.is(".unapproved")){if(d.data.id==g){c.text(adminCommentsL10n.replyApprove)}f.find("div.comment_status").html("0")}else{if(d.data.id==g){c.text(adminCommentsL10n.reply)}f.find("div.comment_status").html("1")}b("span.pending-count").each(function(){var t=b(this),i,j;i=t.html().replace(/[^0-9]+/g,"");i=parseInt(i,10);if(isNaN(i)){return}j=b("#"+d.element).is("."+d.dimClass)?1:-1;i=i+j;if(i<0){i=0}t.closest(".awaiting-mod")[0==i?"addClass":"removeClass"]("count-0");updateCount(t,i);dashboardTotals()})};l=function(f,w){var j=b(f.target).attr("class"),i,h,g,c,v,d,e=false;f.data._total=q.val()||0;f.data._per_page=o.val()||0;f.data._page=m.val()||0;f.data._url=document.location.href;f.data.comment_status=b('input[name="comment_status"]',"#comments-form").val();if(j.indexOf(":trash=1")!=-1){e="trash"}else{if(j.indexOf(":spam=1")!=-1){e="spam"}}if(e){i=j.replace(/.*?comment-([0-9]+).*/,"$1");h=b("#comment-"+i);note=b("#"+e+"-undo-holder").html();h.find(".check-column :checkbox").prop("checked",false);if(h.siblings("#replyrow").length&&commentReply.cid==i){commentReply.close()}if(h.is("tr")){g=h.children(":visible").length;d=b(".author strong",h).text();c=b('<tr id="undo-'+i+'" class="undo un'+e+'" style="display:none;"><td colspan="'+g+'">'+note+"</td></tr>")}else{d=b(".comment-author",h).text();c=b('<div id="undo-'+i+'" style="display:none;" class="undo un'+e+'">'+note+"</div>")}h.before(c);b("strong","#undo-"+i).text(d);v=b(".undo a","#undo-"+i);v.attr("href","comment.php?action=un"+e+"comment&c="+i+"&_wpnonce="+f.data._ajax_nonce);v.attr("class","delete:the-comment-list:comment-"+i+"::un"+e+"=1 vim-z vim-destructive");b(".avatar",h).clone().prependTo("#undo-"+i+" ."+e+"-undo-inside");v.click(function(){w.wpList.del(this);b("#undo-"+i).css({backgroundColor:"#ceb"}).fadeOut(350,function(){b(this).remove();b("#comment-"+i).css("backgroundColor","").fadeIn(300,function(){b(this).show()})});return false})}return f};p=function(e,d,c){if(d<a){return}if(c){a=d}q.val(e.toString())};dashboardTotals=function(f){var g=b("#dashboard_right_now"),d,h,c,e;f=f||0;if(isNaN(f)||!g.length){return}d=b("span.total-count",g);h=b("span.approved-count",g);c=getCount(d);c=c+f;e=c-getCount(b("span.pending-count",g))-getCount(b("span.spam-count",g));updateCount(d,c);updateCount(h,e)};getCount=function(d){var c=parseInt(d.html().replace(/[^0-9]+/g,""),10);if(isNaN(c)){return 0}return c};updateCount=function(d,c){var e="";if(isNaN(c)){return}c=c<1?"0":c.toString();if(c.length>3){while(c.length>3){e=thousandsSeparator+c.substr(c.length-3)+e;c=c.substr(0,c.length-3)}c=c+e}d.html(c)};updatePending=function(d,c){if(c<0){c=0}d.closest(".awaiting-mod")[0==c?"addClass":"removeClass"]("count-0");updateCount(d,c);dashboardTotals()};k=function(i,f){var c,e,x,y,h,w=b(f.target).parent().is("span.untrash"),g=b(f.target).parent().is("span.unspam"),d=b("#"+f.element).is(".unapproved");function j(s){if(b(f.target).parent().is("span."+s)){return 1}else{if(b("#"+f.element).is("."+s)){return -1}}return 0}if(w){y=-1}else{y=j("trash")}if(g){x=-1}else{x=j("spam")}b("span.pending-count").each(function(){var t=b(this),s=getCount(t);if(b(f.target).parent().is("span.unapprove")||((w||g)&&d)){s=s+1}else{if(d){s=s-1}}updatePending(t,s)});b("span.spam-count").each(function(){var t=b(this),s=getCount(t)+x;updateCount(t,s)});b("span.trash-count").each(function(){var t=b(this),s=getCount(t)+y;updateCount(t,s)});if(b("#dashboard_right_now").length){e=y?-1*y:0;dashboardTotals(e)}else{c=q.val()?parseInt(q.val(),10):0;if(b(f.target).parent().is("span.undo")){c++}else{c--}if(c<0){c=0}if(("object"==typeof i)&&a<f.parsed.responses[0].supplemental.time){total_items_i18n=f.parsed.responses[0].supplemental.total_items_i18n||"";if(total_items_i18n){b(".displaying-num").text(total_items_i18n);b(".total-pages").text(f.parsed.responses[0].supplemental.total_pages_i18n);b(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",f.parsed.responses[0].supplemental.total_pages==b(".current-page").val())}p(c,f.parsed.responses[0].supplemental.time,true)}else{p(c,i,false)}}if(!theExtraList||theExtraList.size()==0||theExtraList.children().size()==0||w||g){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());r()};r=function(f){var d=b.query.get(),e=b(".total-pages").text(),c=b('input[name="_per_page"]',"#comments-form").val();if(!d.paged){d.paged=1}if(d.paged>e){return}if(f){theExtraList.empty();d.number=Math.min(8,c)}else{d.number=1;d.offset=Math.min(8,c)-1}d.no_placeholder=true;d.paged++;if(true===d.comment_type){d.comment_type=""}d=b.extend(d,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:b("#_ajax_fetch_list_nonce").val()});b.ajax({url:ajaxurl,global:false,dataType:"json",data:d,success:function(g){theExtraList.get(0).wpList.add(g.rows)}})};theExtraList=b("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=b("#the-comment-list").wpList({alt:"",delBefore:l,dimAfter:n,delAfter:k,addColor:"none"}).bind("wpListDelEnd",function(d,e){var c=e.element.replace(/[^0-9]+/g,"");if(e.target.className.indexOf(":trash=1")!=-1||e.target.className.indexOf(":spam=1")!=-1){b("#undo-"+c).fadeIn(300,function(){b(this).show()})}})};commentReply={cid:"",act:"",init:function(){var a=b("#replyrow");b("a.cancel",a).click(function(){return commentReply.revert()});b("a.save",a).click(function(){return commentReply.send()});b("input#author, input#author-email, input#author-url",a).keypress(function(d){if(d.which==13){commentReply.send();d.preventDefault();return false}});b("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(b(this).parent())});b("#doaction, #doaction2, #post-query-submit").click(function(d){if(b("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=b('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(a){a.each(function(){b(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(b(this).parent())})})},toggle:function(a){if(b(a).css("display")!="none"){b(a).find("a.vim-q").click()}},revert:function(){if(b("#the-comment-list #replyrow").length<1){return false}b("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var a;if(this.cid){a=b("#comment-"+this.cid);if(typeof QTags!="undefined"){QTags.closeAllTags("replycontent")}if(this.act=="edit-comment"){a.fadeIn(300,function(){a.show()}).css("backgroundColor","")}b("#replyrow").hide();b("#com-reply").append(b("#replyrow"));b("#replycontent").val("");b("input","#edithead").val("");b(".error","#replysubmit").html("").hide();b(".waiting","#replysubmit").hide();b("#replycontent").css("height","");this.cid=""}},open:function(t,s,h){var a=this,r,q,o,n=b("#comment-"+t),p=n.height(),c;a.close();a.cid=t;r=b("#replyrow");q=b("#inline-"+t);o=a.act=(h=="edit")?"edit-comment":"replyto-comment";b("#action",r).val(o);b("#comment_post_ID",r).val(s);b("#comment_ID",r).val(t);if(p>120){b("#replycontent",r).css("height",(35+p)+"px")}if(h=="edit"){b("#author",r).val(b("div.author",q).text());b("#author-email",r).val(b("div.author-email",q).text());b("#author-url",r).val(b("div.author-url",q).text());b("#status",r).val(b("div.comment_status",q).text());b("#replycontent",r).val(b("textarea.comment",q).val());b("#edithead, #savebtn",r).show();b("#replyhead, #replybtn",r).hide();n.after(r).fadeOut("fast",function(){b("#replyrow").fadeIn(300,function(){b(this).show()})})}else{c=b("#replybtn",r);b("#edithead, #savebtn",r).hide();b("#replyhead, #replybtn",r).show();n.after(r);if(n.hasClass("unapproved")){c.text(adminCommentsL10n.replyApprove)}else{c.text(adminCommentsL10n.reply)}b("#replyrow").fadeIn(300,function(){b(this).show()})}setTimeout(function(){var f,d,e,i,g;f=b("#replyrow").offset().top;d=f+b("#replyrow").height();e=window.pageYOffset||document.documentElement.scrollTop;i=document.documentElement.clientHeight||self.innerHeight||0;g=e+i;if(g-20<d){window.scroll(0,d-i+35)}else{if(f-20<e){window.scroll(0,f-35)}}b("#replycontent").focus().keyup(function(j){if(j.which==27){commentReply.revert()}})},600);return false},send:function(){var a={};b("#replysubmit .error").hide();b("#replysubmit .waiting").show();b("#replyrow input").not(":button").each(function(){a[b(this).attr("name")]=b(this).val()});a.content=b("#replycontent").val();a.id=a.comment_post_ID;a.comments_listing=this.comments_listing;a.p=b('[name="p"]').val();if(b("#comment-"+b("#comment_ID").val()).hasClass("unapproved")){a.approve_parent=1}b.ajax({type:"POST",url:ajaxurl,data:a,success:function(d){commentReply.show(d)},error:function(d){commentReply.error(d)}});return false},show:function(n){var l=this,k,c,j,m,a;if(typeof(n)=="string"){l.error({responseText:n});return false}k=wpAjax.parseAjaxResponse(n);if(k.errors){l.error({responseText:wpAjax.broken});return false}l.revert();k=k.responses[0];c=k.data;j="#comment-"+k.id;if("edit-comment"==l.act){b(j).remove()}if(k.supplemental.parent_approved){a=b("#comment-"+k.supplemental.parent_approved);updatePending(b("span.pending-count").eq(0),getCount(b("span.pending-count").eq(0))-1);if(this.comments_listing=="moderated"){a.animate({backgroundColor:"#CCEEBB"},400,function(){a.fadeOut()});return}}b(c).hide();b("#replyrow").after(c);j=b(j);l.addEvents(j);m=j.hasClass("unapproved")?"#FFFFE0":j.closest(".widefat, .postbox").css("backgroundColor");j.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:m},300,function(){if(a&&a.length){a.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:m},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}})},error:function(a){var d=a.statusText;b("#replysubmit .waiting").hide();if(a.responseText){d=a.responseText.replace(/<.[^<>]*?>/g,"")}if(d){b("#replysubmit .error").html(d).show()}}};b(document).ready(function(){var f,a,h,g;setCommentsList();commentReply.init();b(document).delegate("span.delete a.delete","click",function(){return false});if(typeof b.table_hotkeys!="undefined"){f=function(c){return function(){var d,e;d="next"==c?"first":"last";e=b(".tablenav-pages ."+c+"-page:not(.disabled)");if(e.length){window.location=e[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+d+"=1"}}};a=function(c,d){window.location=b("span.edit a",d).attr("href")};h=function(){toggleWithKeyboard=true;b("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};g=function(c){return function(){var d=b('select[name="action"]');b('option[value="'+c+'"]',d).prop("selected",true);b("#doaction").click()}};b.table_hotkeys(b("table.widefat"),["a","u","s","d","r","q","z",["e",a],["shift+x",h],["shift+a",g("approve")],["shift+s",g("spam")],["shift+d",g("delete")],["shift+t",g("trash")],["shift+z",g("untrash")],["shift+u",g("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:f("prev"),next_page_link_cb:f("next")})}})})(jQuery); 
     2 No newline at end of file 
  • wp-admin/js/edit-comments.dev.js

     
    154154                el.html(n); 
    155155        }; 
    156156 
    157         updatePending = function(n) { 
    158                 $('span.pending-count').each( function() { 
    159                         var a = $(this); 
     157        updatePending = function(el, n) { 
     158                if ( n < 0 ) 
     159                        n = 0; 
    160160 
    161                         if ( n < 0 ) 
    162                                 n = 0; 
    163  
    164                         a.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 
    165                         updateCount(a, n); 
    166                         dashboardTotals(); 
    167                 }); 
     161                el.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 
     162                updateCount(el, n); 
     163                dashboardTotals(); 
    168164        }; 
    169165 
    170166        // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 
     
    192188                        spam = -1; 
    193189                else 
    194190                        spam = getUpdate('spam'); 
     191                         
     192                $('span.pending-count').each(function() { 
     193                        var a = $(this), pending = getCount(a); 
     194                        if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" 
     195                                pending = pending + 1; 
     196                        } else if ( unapproved ) { // we deleted a formerly unapproved comment 
     197                                pending = pending - 1; 
     198                        } 
     199                        updatePending( a, pending ); 
     200                }); 
    195201 
    196                 pending = getCount( $('span.pending-count').eq(0) ); 
    197  
    198                 if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" 
    199                         pending = pending + 1; 
    200                 } else if ( unapproved ) { // we deleted a formerly unapproved comment 
    201                         pending = pending - 1; 
    202                 } 
    203  
    204                 updatePending(pending); 
    205  
    206202                $('span.spam-count').each( function() { 
    207203                        var a = $(this), n = getCount(a) + spam; 
    208204                        updateCount(a, n); 
     
    504500 
    505501                if ( r.supplemental.parent_approved ) { 
    506502                        pid = $('#comment-' + r.supplemental.parent_approved); 
    507                         updatePending( getCount( $('span.pending-count').eq(0) ) - 1 ); 
     503                        updatePending( $('span.pending-count').eq(0), getCount( $('span.pending-count').eq(0) ) - 1 ); 
    508504 
    509505                        if ( this.comments_listing == 'moderated' ) { 
    510506                                pid.animate( { 'backgroundColor':'#CCEEBB' }, 400, function(){