2010-08-25 03:59:13 +02:00
|
|
|
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,u){var w=a(q.target).attr("className"),m,o,p,t,v,s,r=false;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){r="trash"}else{if(w.indexOf(":spam=1")!=-1){r="spam"}}if(r){m=w.replace(/.*?comment-([0-9]+).*/,"$1");o=a("#comment-"+m);note=a("#"+r+"-undo-holder").html();o.find(".check-column :checkbox").attr("checked","");if(o.siblings("#replyrow").length&&commentReply.cid==m){commentReply.close()}if(o.is("tr")){p=o.children(":visible").length;s=a(".author strong",o).text();t=a('<tr id="undo-'+m+'" class="undo un'+r+'" style="display:none;"><td colspan="'+p+'">'+note+"</td></tr>")}else{s=a(".comment-author",o).text();t=a('<div id="undo-'+m+'" style="display:none;" class="undo un'+r+'">'+note+"</div>")}o.before(t);a("strong","#undo-"+m).text(s+" ");v=a(".undo a","#undo-"+m);v.attr("href","comment.php?action=un"+r+"comment&c="+m+"&_wpnonce="+q.data._ajax_nonce);v.attr("className","delete:the-comment-list:comment-"+m+"::un"+r+"=1 vim-z vim-destructive");a(".avatar",o).clone().prependTo("#undo-"+m+" ."+r+"-undo-inside");v.click(function(){u.wpList.del(this);a("#undo-"+m).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+m).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}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);p=p+s;m=p-b(a("span.pending-count",r))-b(a("span.spam-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(o,p){var m="";if(isNaN(p)){return}p=p<1?"0":p.toString();if(p.length>3){while(p.length>3){m=thousandsSeparator+p.substr(p.length-3)+m;p=p.substr(0,p.length-3)}p=p+m}o.html(p)}k=function(m,o){var u,p,q,w=a(o.target).parent().is("span.untrash"),n=a(o.target).parent().is("span.unspam"),v,t;function x(r){if(a(o.target).parent().is("span."+r)){return 1}else{if(a("#"+o.element).is("."+r)){return -1}}return 0}v=x("spam");t=x("trash");if(w){t=-1}if(n){v=-1}a("span.pending-count").each(function(){var r=a(this),z=b(r),y=a("#"+o.element).is(".unapproved");if(a(o.target).parent().is("span.unapprove")||((w||n)&&y)){z=z+1}else{if(y){z=z-1}}if(z<0){z=0}r.closest("#awaiting-mod")[0==z?"addClass":"removeClass"]("count-0");f(r,z);j()});a("span.spam-count").each(function(){var r=a(this),y=b(r)+v;f(r,y)});a("span.trash-count").each(function(){var r=a(this),y=b(r)+t;f(r,y)});if(a("#dashboard_right_now").length){q=t?-1*t:0;j(q)}else{u=c.val()?parseInt(c.val(),10):0;u=u-v-t;if(u<0){u=0}if(("object"==typeof m)&&l<o.parsed.responses[0].supplemental.time){p=o.parsed.responses[0].supplemental.pageLinks||"";if(a.trim(p)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(p))}else{a(".tablenav-pages").find(".page-numbers").remove()}d(u,o.parsed.responses[0].supplemental.time,true)}else{d(u,m,false)}}if(theExtraList.size()==0||theExtraList.children().size()==0||w){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());var s=a.query.get();s.number=1;s.paged++;listTable.fetch_list(s,function(r){theExtraList.get(0).wpList.add(r.rows)})
|