diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 77c32b05ed..ccb8aa7939 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -347,8 +347,21 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; // JS didn't send us everything we need to know. Just die with success message - if ( !$total || !$per_page || !$page || !$url ) - wp_die( time() ); + if ( ! $total || ! $per_page || ! $page || ! $url ) { + $time = time(); + $comment = get_comment( $comment_id ); + + $x = new WP_Ajax_Response( array( + 'what' => 'comment', + // Here for completeness - not used. + 'id' => $comment_id, + 'supplemental' => array( + 'status' => $comment ? $comment->comment_approved : '', + 'time' => $time + ) + ) ); + $x->send(); + } $total += $delta; if ( $total < 0 ) @@ -377,12 +390,14 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { // The time since the last comment count. $time = time(); + $comment = get_comment( $comment_id ); $x = new WP_Ajax_Response( array( 'what' => 'comment', // Here for completeness - not used. 'id' => $comment_id, 'supplemental' => array( + 'status' => $comment ? $comment->comment_approved : '', 'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ), 'total_pages' => ceil( $total / $per_page ), 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index fcfcd1e36b..52d3f50ba6 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -198,7 +198,7 @@ class WP_Comments_List_Table extends WP_List_Table { $stati = array( 'all' => _nx_noop('All', 'All', 'comments'), // singular not used 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'), - 'approved' => _n_noop('Approved', 'Approved'), // singular not used + 'approved' => _n_noop('Approved (%s)', 'Approved (%s)'), 'spam' => _n_noop('Spam (%s)', 'Spam (%s)'), 'trash' => _n_noop('Trash (%s)', 'Trash (%s)') ); diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index bea253cec0..6a8bb24d5b 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -12,6 +12,7 @@ setCommentsList = function() { perPageInput = $('input[name="_per_page"]', '#comments-form'); pageInput = $('input[name="_page"]', '#comments-form'); + // this fires when viewing "All" dimAfter = function( r, settings ) { var editRow, replyID, replyButton, c = $( '#' + settings.element ); @@ -34,6 +35,7 @@ setCommentsList = function() { diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1; updatePending( diff ); + updateCountText( 'span.approved-count', -1 * diff ); }; // Send current total, page, per_page and url @@ -137,53 +139,166 @@ setCommentsList = function() { }); }; + updateCountText = function( selector, diff ) { + $( selector ).each(function() { + var a = $(this), n = getCount(a) + diff; + if ( n < 1 ) { + n = 0; + } + updateCount( a, n ); + }); + }; + // In admin-ajax.php, we send back the unix time stamp instead of 1 on success delAfter = function( r, settings ) { - var total_items_i18n, total, spam, trash, pending, - untrash = $(settings.target).parent().is('span.untrash'), - unspam = $(settings.target).parent().is('span.unspam'), - unapproved = $('#' + settings.element).is('.unapproved'); + var total_items_i18n, total, + response = true === settings.parsed ? {} : settings.parsed.responses[0], + commentStatus = true === settings.parsed ? '' : response.supplemental.status, - function getUpdate(s) { - if ( $(settings.target).parent().is('span.' + s) ) - return 1; - else if ( $('#' + settings.element).is('.' + s) ) - return -1; + targetParent = $( settings.target ).parent(), + commentRow = $('#' + settings.element), - return 0; + spamDiff, trashDiff, pendingDiff, approvedDiff, + + approved = commentRow.hasClass( 'approved' ), + unapproved = commentRow.hasClass( 'unapproved' ), + spammed = commentRow.hasClass( 'spam' ), + trashed = commentRow.hasClass( 'trash' ); + + // the order of these checks is important + // .unspam can also have .approve or .unapprove + // .untrash can also have .approve or .unapprove + + if ( targetParent.is( 'span.undo' ) ) { + // the comment was spammed + if ( targetParent.hasClass( 'unspam' ) ) { + spamDiff = -1; + + if ( 'trash' === commentStatus ) { + trashDiff = 1; + } else if ( '1' === commentStatus ) { + approvedDiff = 1; + } else if ( '0' === commentStatus ) { + pendingDiff = 1; + } + + // the comment was trashed + } else if ( targetParent.hasClass( 'untrash' ) ) { + trashDiff = -1; + + if ( 'spam' === commentStatus ) { + spamDiff = 1; + } else if ( '1' === commentStatus ) { + approvedDiff = 1; + } else if ( '0' === commentStatus ) { + pendingDiff = 1; + } + } + + // user clicked "Spam" + } else if ( targetParent.is( 'span.spam' ) ) { + // the comment is currently approved + if ( approved ) { + approvedDiff = -1; + // the comment is currently pending + } else if ( unapproved ) { + pendingDiff = -1; + // the comment was in the trash + } else if ( trashed ) { + trashDiff = -1; + } + // you can't spam an item on the spam screen + spamDiff = 1; + + // user clicked "Unspam" + } else if ( targetParent.is( 'span.unspam' ) ) { + if ( approved ) { + pendingDiff = 1; + } else if ( unapproved ) { + approvedDiff = 1; + } else if ( trashed ) { + // the comment was previously approved + if ( targetParent.hasClass( 'approve' ) ) { + approvedDiff = 1; + // the comment was previously pending + } else if ( targetParent.hasClass( 'unapprove' ) ) { + pendingDiff = 1; + } + } else if ( spammed ) { + if ( targetParent.hasClass( 'approve' ) ) { + approvedDiff = 1; + + } else if ( targetParent.hasClass( 'unapprove' ) ) { + pendingDiff = 1; + } + } + // you can Unspam an item on the spam screen + spamDiff = -1; + + // user clicked "Trash" + } else if ( targetParent.is( 'span.trash' ) ) { + if ( approved ) { + approvedDiff = -1; + } else if ( unapproved ) { + pendingDiff = -1; + // the comment was in the spam queue + } else if ( spammed ) { + spamDiff = -1; + } + // you can't trash an item on the trash screen + trashDiff = 1; + + // user clicked "Restore" + } else if ( targetParent.is( 'span.untrash' ) ) { + if ( approved ) { + pendingDiff = 1; + } else if ( unapproved ) { + approvedDiff = 1; + } else if ( trashed ) { + if ( targetParent.hasClass( 'approve' ) ) { + approvedDiff = 1; + } else if ( targetParent.hasClass( 'unapprove' ) ) { + pendingDiff = 1; + } + } + // you can't go from trash to spam + // you can untrash on the trash screen + trashDiff = -1; + + // User clicked "Approve" + } else if ( targetParent.is( 'span.approve:not(.unspam):not(.untrash)' ) ) { + approvedDiff = 1; + pendingDiff = -1; + + // User clicked "Unapprove" + } else if ( targetParent.is( 'span.unapprove:not(.unspam):not(.untrash)' ) ) { + approvedDiff = -1; + pendingDiff = 1; + + // User clicked "Delete Permanently" + } else if ( targetParent.is( 'span.delete' ) ) { + if ( spammed ) { + spamDiff = -1; + } else if ( trashed ) { + trashDiff = -1; + } } - if ( untrash ) - trash = -1; - else - trash = getUpdate('trash'); - - if ( unspam ) - spam = -1; - else - spam = getUpdate('spam'); - - if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) { - // a comment was 'deleted' from another list (e.g. approved, spam, trash) and moved to pending, - // or a trash/spam of a pending comment was undone - pending = 1; - } else if ( unapproved ) { - // a pending comment was trashed/spammed/approved - pending = -1; + if ( pendingDiff ) { + updatePending( pendingDiff ); } - if ( pending ) - updatePending(pending); + if ( approvedDiff ) { + updateCountText( 'span.approved-count', approvedDiff ); + } - $('span.spam-count').each( function() { - var a = $(this), n = getCount(a) + spam; - updateCount(a, n); - }); + if ( spamDiff ) { + updateCountText( 'span.spam-count', spamDiff ); + } - $('span.trash-count').each( function() { - var a = $(this), n = getCount(a) + trash; - updateCount(a, n); - }); + if ( trashDiff ) { + updateCountText( 'span.trash-count', trashDiff ); + } if ( ! $('#dashboard_right_now').length ) { total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; @@ -195,20 +310,24 @@ setCommentsList = function() { if ( total < 0 ) total = 0; - if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { - total_items_i18n = settings.parsed.responses[0].supplemental.total_items_i18n || ''; - if ( total_items_i18n ) { - $('.displaying-num').text( total_items_i18n ); - $('.total-pages').text( settings.parsed.responses[0].supplemental.total_pages_i18n ); - $('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', settings.parsed.responses[0].supplemental.total_pages == $('.current-page').val()); + if ( 'object' === typeof r ) { + if ( response.supplemental.total_items_i18n && lastConfidentTime < response.supplemental.time ) { + total_items_i18n = response.supplemental.total_items_i18n || ''; + if ( total_items_i18n ) { + $('.displaying-num').text( total_items_i18n ); + $('.total-pages').text( response.supplemental.total_pages_i18n ); + $('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', response.supplemental.total_pages == $('.current-page').val()); + } + updateTotalCount( total, response.supplemental.time, true ); + } else if ( response.supplemental.time ) { + updateTotalCount( total, response.supplemental.time, false ); } - updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true ); } else { updateTotalCount( total, r, false ); } } - if ( ! theExtraList || theExtraList.size() === 0 || theExtraList.children().size() === 0 || untrash || unspam ) { + if ( ! theExtraList || theExtraList.size() === 0 || theExtraList.children().size() === 0 ) { return; } diff --git a/wp-admin/js/edit-comments.min.js b/wp-admin/js/edit-comments.min.js index e0c609ed02..041c30679c 100644 --- a/wp-admin/js/edit-comments.min.js +++ b/wp-admin/js/edit-comments.min.js @@ -1 +1 @@ -var setCommentsList,theList,theExtraList,commentReply;!function(a){var b,c,d;setCommentsList=function(){var e,f,g,h,i,j,k,l,m,n=0;e=a('input[name="_total"]',"#comments-form"),f=a('input[name="_per_page"]',"#comments-form"),g=a('input[name="_page"]',"#comments-form"),h=function(b,c){var e,f,g,h=a("#"+c.element);e=a("#replyrow"),f=a("#comment_ID",e).val(),g=a("#replybtn",e),h.is(".unapproved")?(c.data.id==f&&g.text(adminCommentsL10n.replyApprove),h.find("div.comment_status").html("0")):(c.data.id==f&&g.text(adminCommentsL10n.reply),h.find("div.comment_status").html("1")),m=a("#"+c.element).is("."+c.dimClass)?1:-1,d(m)},i=function(b,c){var d,h,i,j,k,l,m,n=!1,o=a(b.target).attr("data-wp-lists");return b.data._total=e.val()||0,b.data._per_page=f.val()||0,b.data._page=g.val()||0,b.data._url=document.location.href,b.data.comment_status=a('input[name="comment_status"]',"#comments-form").val(),-1!=o.indexOf(":trash=1")?n="trash":-1!=o.indexOf(":spam=1")&&(n="spam"),n&&(h=o.replace(/.*?comment-([0-9]+).*/,"$1"),i=a("#comment-"+h),d=a("#"+n+"-undo-holder").html(),i.find(".check-column :checkbox").prop("checked",!1),i.siblings("#replyrow").length&&commentReply.cid==h&&commentReply.close(),i.is("tr")?(j=i.children(":visible").length,m=a(".author strong",i).text(),k=a(''+d+"")):(m=a(".comment-author",i).text(),k=a('")),i.before(k),a("strong","#undo-"+h).text(m),l=a(".undo a","#undo-"+h),l.attr("href","comment.php?action=un"+n+"comment&c="+h+"&_wpnonce="+b.data._ajax_nonce),l.attr("data-wp-lists","delete:the-comment-list:comment-"+h+"::un"+n+"=1"),l.attr("class","vim-z vim-destructive"),a(".avatar",i).first().clone().prependTo("#undo-"+h+" ."+n+"-undo-inside"),l.click(function(){return c.wpList.del(this),a("#undo-"+h).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove(),a("#comment-"+h).css("backgroundColor","").fadeIn(300,function(){a(this).show()})}),!1})),b},j=function(a,b,c){n>b||(c&&(n=b),e.val(a.toString()))},b=function(a){var b=parseInt(a.html().replace(/[^0-9]+/g,""),10);return isNaN(b)?0:b},c=function(a,b){var c="";if(!isNaN(b)){if(b=1>b?"0":b.toString(),b.length>3){for(;b.length>3;)c=thousandsSeparator+b.substr(b.length-3)+c,b=b.substr(0,b.length-3);b+=c}a.html(b)}},d=function(d){a("span.pending-count").each(function(){var e=a(this),f=b(e)+d;1>f&&(f=0),e.closest(".awaiting-mod")[0===f?"addClass":"removeClass"]("count-0"),c(e,f)})},k=function(f,g){function h(b){return a(g.target).parent().is("span."+b)?1:a("#"+g.element).is("."+b)?-1:0}var i,k,m,o,p,q=a(g.target).parent().is("span.untrash"),r=a(g.target).parent().is("span.unspam"),s=a("#"+g.element).is(".unapproved");o=q?-1:h("trash"),m=r?-1:h("spam"),a(g.target).parent().is("span.unapprove")||(q||r)&&s?p=1:s&&(p=-1),p&&d(p),a("span.spam-count").each(function(){var d=a(this),e=b(d)+m;c(d,e)}),a("span.trash-count").each(function(){var d=a(this),e=b(d)+o;c(d,e)}),a("#dashboard_right_now").length||(k=e.val()?parseInt(e.val(),10):0,a(g.target).parent().is("span.undo")?k++:k--,0>k&&(k=0),"object"==typeof f&&nd||(b?(theExtraList.empty(),c.number=Math.min(8,e)):(c.number=1,c.offset=Math.min(8,e)-1),c.no_placeholder=!0,c.paged++,!0===c.comment_type&&(c.comment_type=""),c=a.extend(c,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()}),a.ajax({url:ajaxurl,global:!1,dataType:"json",data:c,success:function(a){theExtraList.get(0).wpList.add(a.rows)}}))},theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),theList=a("#the-comment-list").wpList({alt:"",delBefore:i,dimAfter:h,delAfter:k,addColor:"none"}).bind("wpListDelEnd",function(b,c){var d=a(c.target).attr("data-wp-lists"),e=c.element.replace(/[^0-9]+/g,"");(-1!=d.indexOf(":trash=1")||-1!=d.indexOf(":spam=1"))&&a("#undo-"+e).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(a){return 13==a.which?(commentReply.send(),a.preventDefault(),!1):void 0}),a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())}),a("#doaction, #doaction2, #post-query-submit").click(function(){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){"none"!==a(b).css("display")&&(a("#replyrow").parent().is("#com-reply")||window.confirm(adminCommentsL10n.warnQuickEdit))&&a(b).find("a.vim-q").click()},revert:function(){return a("#the-comment-list #replyrow").length<1?!1:(a("#replyrow").fadeOut("fast",function(){commentReply.close()}),!1)},close:function(){var b,c=a("#replyrow");c.parent().is("#com-reply")||(this.cid&&"edit-comment"==this.act&&(b=a("#comment-"+this.cid),b.fadeIn(300,function(){b.show()}).css("backgroundColor","")),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),a("#add-new-comment").css("display",""),c.hide(),a("#com-reply").append(c),a("#replycontent").css("height","").val(""),a("#edithead input").val(""),a(".error",c).empty().hide(),a(".spinner",c).removeClass("is-active"),this.cid="")},open:function(b,c,d){var e,f,g,h,i,j=this,k=a("#comment-"+b),l=k.height();return j.close(),j.cid=b,e=a("#replyrow"),f=a("#inline-"+b),d=d||"replyto",g="edit"==d?"edit":"replyto",g=j.act=g+"-comment",a("#action",e).val(g),a("#comment_post_ID",e).val(c),a("#comment_ID",e).val(b),"edit"==d?(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, #addhead, #addbtn",e).hide(),l>120&&(i=l>500?500:l,a("#replycontent",e).css("height",i+"px")),k.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})):"add"==d?(a("#addhead, #addbtn",e).show(),a("#replyhead, #replybtn, #edithead, #savebtn",e).hide(),a("#the-comment-list").prepend(e),a("#replyrow").fadeIn(300)):(h=a("#replybtn",e),a("#edithead, #savebtn, #addhead, #addbtn",e).hide(),a("#replyhead, #replybtn",e).show(),k.after(e),k.hasClass("unapproved")?h.text(adminCommentsL10n.replyApprove):h.text(adminCommentsL10n.reply),a("#replyrow").fadeIn(300,function(){a(this).show()})),setTimeout(function(){var b,c,d,e,f;b=a("#replyrow").offset().top,c=b+a("#replyrow").height(),d=window.pageYOffset||document.documentElement.scrollTop,e=document.documentElement.clientHeight||window.innerHeight||0,f=d+e,c>f-20?window.scroll(0,c-e+35):d>b-20&&window.scroll(0,b-35),a("#replycontent").focus().keyup(function(a){27==a.which&&commentReply.revert()})},600),!1},send:function(){var b={};return a("#replysubmit .error").hide(),a("#replysubmit .spinner").addClass("is-active"),a("#replyrow input").not(":button").each(function(){var c=a(this);b[c.attr("name")]=c.val()}),b.content=a("#replycontent").val(),b.id=b.comment_post_ID,b.comments_listing=this.comments_listing,b.p=a('[name="p"]').val(),a("#comment-"+a("#comment_ID").val()).hasClass("unapproved")&&(b.approve_parent=1),a.ajax({type:"POST",url:ajaxurl,data:b,success:function(a){commentReply.show(a)},error:function(a){commentReply.error(a)}}),!1},show:function(b){var c,e,f,g,h,i=this;return"string"==typeof b?(i.error({responseText:b}),!1):(c=wpAjax.parseAjaxResponse(b),c.errors?(i.error({responseText:wpAjax.broken}),!1):(i.revert(),c=c.responses[0],f="#comment-"+c.id,"edit-comment"==i.act&&a(f).remove(),c.supplemental.parent_approved&&(h=a("#comment-"+c.supplemental.parent_approved),d(-1),"moderated"==this.comments_listing)?void h.animate({backgroundColor:"#CCEEBB"},400,function(){h.fadeOut()}):(e=a.trim(c.data),a(e).hide(),a("#replyrow").after(e),f=a(f),i.addEvents(f),g=f.hasClass("unapproved")?"#FFFFE0":f.closest(".widefat, .postbox").css("backgroundColor"),void f.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:g},300,function(){h&&h.length&&h.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:g},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}))))},error:function(b){var c=b.statusText;a("#replysubmit .spinner").removeClass("is-active"),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#replysubmit .error").html(c).show()},addcomment:function(b){var c=this;a("#add-new-comment").fadeOut(200,function(){c.open(0,b,"add"),a("table.comments-box").css("display",""),a("#no-comments").remove()})}},a(document).ready(function(){var b,c,d,e;setCommentsList(),commentReply.init(),a(document).delegate("span.delete a.delete","click",function(){return!1}),"undefined"!=typeof a.table_hotkeys&&(b=function(b){return function(){var c,d;c="next"==b?"first":"last",d=a(".tablenav-pages ."+b+"-page:not(.disabled)"),d.length&&(window.location=d[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+c+"=1")}},c=function(b,c){window.location=a("span.edit a",c).attr("href")},d=function(){a("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},e=function(b){return function(){var c=a('select[name="action"]');a('option[value="'+b+'"]',c).prop("selected",!0),a("#doaction").click()}},a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",c],["shift+x",d],["shift+a",e("approve")],["shift+s",e("spam")],["shift+d",e("delete")],["shift+t",e("trash")],["shift+z",e("untrash")],["shift+u",e("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:b("prev"),next_page_link_cb:b("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),a("#the-comment-list").on("click",".comment-inline",function(b){b.preventDefault();var c=a(this),d="replyto";"undefined"!=typeof c.data("action")&&(d=c.data("action")),commentReply.open(c.data("commentId"),c.data("postId"),d)})})}(jQuery); \ No newline at end of file +var setCommentsList,theList,theExtraList,commentReply;!function(a){var b,c,d;setCommentsList=function(){var e,f,g,h,i,j,k,l,m,n=0;e=a('input[name="_total"]',"#comments-form"),f=a('input[name="_per_page"]',"#comments-form"),g=a('input[name="_page"]',"#comments-form"),h=function(b,c){var e,f,g,h=a("#"+c.element);e=a("#replyrow"),f=a("#comment_ID",e).val(),g=a("#replybtn",e),h.is(".unapproved")?(c.data.id==f&&g.text(adminCommentsL10n.replyApprove),h.find("div.comment_status").html("0")):(c.data.id==f&&g.text(adminCommentsL10n.reply),h.find("div.comment_status").html("1")),m=a("#"+c.element).is("."+c.dimClass)?1:-1,d(m),updateCountText("span.approved-count",-1*m)},i=function(b,c){var d,h,i,j,k,l,m,n=!1,o=a(b.target).attr("data-wp-lists");return b.data._total=e.val()||0,b.data._per_page=f.val()||0,b.data._page=g.val()||0,b.data._url=document.location.href,b.data.comment_status=a('input[name="comment_status"]',"#comments-form").val(),-1!=o.indexOf(":trash=1")?n="trash":-1!=o.indexOf(":spam=1")&&(n="spam"),n&&(h=o.replace(/.*?comment-([0-9]+).*/,"$1"),i=a("#comment-"+h),d=a("#"+n+"-undo-holder").html(),i.find(".check-column :checkbox").prop("checked",!1),i.siblings("#replyrow").length&&commentReply.cid==h&&commentReply.close(),i.is("tr")?(j=i.children(":visible").length,m=a(".author strong",i).text(),k=a(''+d+"")):(m=a(".comment-author",i).text(),k=a('")),i.before(k),a("strong","#undo-"+h).text(m),l=a(".undo a","#undo-"+h),l.attr("href","comment.php?action=un"+n+"comment&c="+h+"&_wpnonce="+b.data._ajax_nonce),l.attr("data-wp-lists","delete:the-comment-list:comment-"+h+"::un"+n+"=1"),l.attr("class","vim-z vim-destructive"),a(".avatar",i).first().clone().prependTo("#undo-"+h+" ."+n+"-undo-inside"),l.click(function(){return c.wpList.del(this),a("#undo-"+h).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove(),a("#comment-"+h).css("backgroundColor","").fadeIn(300,function(){a(this).show()})}),!1})),b},j=function(a,b,c){n>b||(c&&(n=b),e.val(a.toString()))},b=function(a){var b=parseInt(a.html().replace(/[^0-9]+/g,""),10);return isNaN(b)?0:b},c=function(a,b){var c="";if(!isNaN(b)){if(b=1>b?"0":b.toString(),b.length>3){for(;b.length>3;)c=thousandsSeparator+b.substr(b.length-3)+c,b=b.substr(0,b.length-3);b+=c}a.html(b)}},d=function(d){a("span.pending-count").each(function(){var e=a(this),f=b(e)+d;1>f&&(f=0),e.closest(".awaiting-mod")[0===f?"addClass":"removeClass"]("count-0"),c(e,f)})},updateCountText=function(d,e){a(d).each(function(){var d=a(this),f=b(d)+e;1>f&&(f=0),c(d,f)})},k=function(b,c){var f,g,h,i,k,m,o=!0===c.parsed?{}:c.parsed.responses[0],p=!0===c.parsed?"":o.supplemental.status,q=a(c.target).parent(),r=a("#"+c.element),s=r.hasClass("approved"),t=r.hasClass("unapproved"),u=r.hasClass("spam"),v=r.hasClass("trash");q.is("span.undo")?q.hasClass("unspam")?(h=-1,"trash"===p?i=1:"1"===p?m=1:"0"===p&&(k=1)):q.hasClass("untrash")&&(i=-1,"spam"===p?h=1:"1"===p?m=1:"0"===p&&(k=1)):q.is("span.spam")?(s?m=-1:t?k=-1:v&&(i=-1),h=1):q.is("span.unspam")?(s?k=1:t?m=1:v?q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1):u&&(q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1)),h=-1):q.is("span.trash")?(s?m=-1:t?k=-1:u&&(h=-1),i=1):q.is("span.untrash")?(s?k=1:t?m=1:v&&(q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1)),i=-1):q.is("span.approve:not(.unspam):not(.untrash)")?(m=1,k=-1):q.is("span.unapprove:not(.unspam):not(.untrash)")?(m=-1,k=1):q.is("span.delete")&&(u?h=-1:v&&(i=-1)),k&&d(k),m&&updateCountText("span.approved-count",m),h&&updateCountText("span.spam-count",h),i&&updateCountText("span.trash-count",i),a("#dashboard_right_now").length||(g=e.val()?parseInt(e.val(),10):0,a(c.target).parent().is("span.undo")?g++:g--,0>g&&(g=0),"object"==typeof b?o.supplemental.total_items_i18n&&nd||(b?(theExtraList.empty(),c.number=Math.min(8,e)):(c.number=1,c.offset=Math.min(8,e)-1),c.no_placeholder=!0,c.paged++,!0===c.comment_type&&(c.comment_type=""),c=a.extend(c,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()}),a.ajax({url:ajaxurl,global:!1,dataType:"json",data:c,success:function(a){theExtraList.get(0).wpList.add(a.rows)}}))},theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),theList=a("#the-comment-list").wpList({alt:"",delBefore:i,dimAfter:h,delAfter:k,addColor:"none"}).bind("wpListDelEnd",function(b,c){var d=a(c.target).attr("data-wp-lists"),e=c.element.replace(/[^0-9]+/g,"");(-1!=d.indexOf(":trash=1")||-1!=d.indexOf(":spam=1"))&&a("#undo-"+e).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(a){return 13==a.which?(commentReply.send(),a.preventDefault(),!1):void 0}),a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())}),a("#doaction, #doaction2, #post-query-submit").click(function(){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){"none"!==a(b).css("display")&&(a("#replyrow").parent().is("#com-reply")||window.confirm(adminCommentsL10n.warnQuickEdit))&&a(b).find("a.vim-q").click()},revert:function(){return a("#the-comment-list #replyrow").length<1?!1:(a("#replyrow").fadeOut("fast",function(){commentReply.close()}),!1)},close:function(){var b,c=a("#replyrow");c.parent().is("#com-reply")||(this.cid&&"edit-comment"==this.act&&(b=a("#comment-"+this.cid),b.fadeIn(300,function(){b.show()}).css("backgroundColor","")),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),a("#add-new-comment").css("display",""),c.hide(),a("#com-reply").append(c),a("#replycontent").css("height","").val(""),a("#edithead input").val(""),a(".error",c).empty().hide(),a(".spinner",c).removeClass("is-active"),this.cid="")},open:function(b,c,d){var e,f,g,h,i,j=this,k=a("#comment-"+b),l=k.height();return j.close(),j.cid=b,e=a("#replyrow"),f=a("#inline-"+b),d=d||"replyto",g="edit"==d?"edit":"replyto",g=j.act=g+"-comment",a("#action",e).val(g),a("#comment_post_ID",e).val(c),a("#comment_ID",e).val(b),"edit"==d?(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, #addhead, #addbtn",e).hide(),l>120&&(i=l>500?500:l,a("#replycontent",e).css("height",i+"px")),k.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})):"add"==d?(a("#addhead, #addbtn",e).show(),a("#replyhead, #replybtn, #edithead, #savebtn",e).hide(),a("#the-comment-list").prepend(e),a("#replyrow").fadeIn(300)):(h=a("#replybtn",e),a("#edithead, #savebtn, #addhead, #addbtn",e).hide(),a("#replyhead, #replybtn",e).show(),k.after(e),k.hasClass("unapproved")?h.text(adminCommentsL10n.replyApprove):h.text(adminCommentsL10n.reply),a("#replyrow").fadeIn(300,function(){a(this).show()})),setTimeout(function(){var b,c,d,e,f;b=a("#replyrow").offset().top,c=b+a("#replyrow").height(),d=window.pageYOffset||document.documentElement.scrollTop,e=document.documentElement.clientHeight||window.innerHeight||0,f=d+e,c>f-20?window.scroll(0,c-e+35):d>b-20&&window.scroll(0,b-35),a("#replycontent").focus().keyup(function(a){27==a.which&&commentReply.revert()})},600),!1},send:function(){var b={};return a("#replysubmit .error").hide(),a("#replysubmit .spinner").addClass("is-active"),a("#replyrow input").not(":button").each(function(){var c=a(this);b[c.attr("name")]=c.val()}),b.content=a("#replycontent").val(),b.id=b.comment_post_ID,b.comments_listing=this.comments_listing,b.p=a('[name="p"]').val(),a("#comment-"+a("#comment_ID").val()).hasClass("unapproved")&&(b.approve_parent=1),a.ajax({type:"POST",url:ajaxurl,data:b,success:function(a){commentReply.show(a)},error:function(a){commentReply.error(a)}}),!1},show:function(b){var c,e,f,g,h,i=this;return"string"==typeof b?(i.error({responseText:b}),!1):(c=wpAjax.parseAjaxResponse(b),c.errors?(i.error({responseText:wpAjax.broken}),!1):(i.revert(),c=c.responses[0],f="#comment-"+c.id,"edit-comment"==i.act&&a(f).remove(),c.supplemental.parent_approved&&(h=a("#comment-"+c.supplemental.parent_approved),d(-1),"moderated"==this.comments_listing)?void h.animate({backgroundColor:"#CCEEBB"},400,function(){h.fadeOut()}):(e=a.trim(c.data),a(e).hide(),a("#replyrow").after(e),f=a(f),i.addEvents(f),g=f.hasClass("unapproved")?"#FFFFE0":f.closest(".widefat, .postbox").css("backgroundColor"),void f.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:g},300,function(){h&&h.length&&h.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:g},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}))))},error:function(b){var c=b.statusText;a("#replysubmit .spinner").removeClass("is-active"),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#replysubmit .error").html(c).show()},addcomment:function(b){var c=this;a("#add-new-comment").fadeOut(200,function(){c.open(0,b,"add"),a("table.comments-box").css("display",""),a("#no-comments").remove()})}},a(document).ready(function(){var b,c,d,e;setCommentsList(),commentReply.init(),a(document).delegate("span.delete a.delete","click",function(){return!1}),"undefined"!=typeof a.table_hotkeys&&(b=function(b){return function(){var c,d;c="next"==b?"first":"last",d=a(".tablenav-pages ."+b+"-page:not(.disabled)"),d.length&&(window.location=d[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+c+"=1")}},c=function(b,c){window.location=a("span.edit a",c).attr("href")},d=function(){a("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},e=function(b){return function(){var c=a('select[name="action"]');a('option[value="'+b+'"]',c).prop("selected",!0),a("#doaction").click()}},a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",c],["shift+x",d],["shift+a",e("approve")],["shift+s",e("spam")],["shift+d",e("delete")],["shift+t",e("trash")],["shift+z",e("untrash")],["shift+u",e("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:b("prev"),next_page_link_cb:b("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),a("#the-comment-list").on("click",".comment-inline",function(b){b.preventDefault();var c=a(this),d="replyto";"undefined"!=typeof c.data("action")&&(d=c.data("action")),commentReply.open(c.data("commentId"),c.data("postId"),d)})})}(jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index b60c872793..ea8702df43 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33654'; +$wp_version = '4.4-alpha-33655'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.