Ticket #25979: 25979.2.diff
| File 25979.2.diff, 5.9 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/js/edit-comments.js
1 var theList, theExtraList, toggleWithKeyboard = false; 1 /* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax, commentReply */ 2 var setCommentsList, theList, theExtraList, toggleWithKeyboard = false; 2 3 3 4 (function($) { 4 5 var getCount, updateCount, updatePending, dashboardTotals; 5 6 6 7 setCommentsList = function() { 7 var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList ;8 var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff; 8 9 9 10 totalInput = $('input[name="_total"]', '#comments-form'); 10 11 perPageInput = $('input[name="_per_page"]', '#comments-form'); … … 29 30 c.find('div.comment_status').html('1'); 30 31 } 31 32 32 vardiff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;33 diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1; 33 34 updatePending( diff ); 34 35 }; 35 36 36 37 // Send current total, page, per_page and url 37 38 delBefore = function( settings, list ) { 38 var wpListsData = $(settings.target).attr('data-wp-lists'), id, el, n, h, a, author, action = false;39 var note, wpListsData = $(settings.target).attr('data-wp-lists'), id, el, n, h, a, author, action = false; 39 40 40 41 settings.data._total = totalInput.val() || 0; 41 42 settings.data._per_page = perPageInput.val() || 0; … … 80 81 list.wpList.del(this); 81 82 $('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){ 82 83 $(this).remove(); 83 $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() });84 $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show(); }); 84 85 }); 85 86 return false; 86 87 }); … … 144 145 var a = $(this), n = getCount(a) + diff; 145 146 if ( n < 1 ) 146 147 n = 0; 147 a.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');148 a.closest('.awaiting-mod')[ 0 === n ? 'addClass' : 'removeClass' ]('count-0'); 148 149 updateCount( a, n ); 149 150 }); 150 151 … … 153 154 154 155 // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 155 156 delAfter = function( r, settings ) { 156 var total , N, spam, trash, pending,157 var total_items_i18n, total, N, spam, trash, pending, 157 158 untrash = $(settings.target).parent().is('span.untrash'), 158 159 unspam = $(settings.target).parent().is('span.unspam'), 159 160 unapproved = $('#' + settings.element).is('.unapproved'); … … 225 226 } 226 227 } 227 228 228 if ( ! theExtraList || theExtraList.size() == 0 || theExtraList.children().size()== 0 || untrash || unspam ) {229 if ( ! theExtraList || theExtraList.size() === 0 || theExtraList.children().size() === 0 || untrash || unspam ) { 229 230 return; 230 231 } 231 232 … … 283 284 var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, ''); 284 285 285 286 if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.indexOf(':spam=1') != -1 ) 286 $('#undo-' + id).fadeIn(300, function(){ $(this).show() });287 $('#undo-' + id).fadeIn(300, function(){ $(this).show(); }); 287 288 }); 288 289 }; 289 290 … … 309 310 commentReply.toggle($(this).parent()); 310 311 }); 311 312 312 $('#doaction, #doaction2, #post-query-submit').click(function( e){313 $('#doaction, #doaction2, #post-query-submit').click(function(){ 313 314 if ( $('#the-comment-list #replyrow').length > 0 ) 314 315 commentReply.close(); 315 316 }); … … 355 356 356 357 if ( this.cid && this.act == 'edit-comment' ) { 357 358 c = $('#comment-' + this.cid); 358 c.fadeIn(300, function(){ c.show() }).css('backgroundColor', '');359 c.fadeIn(300, function(){ c.show(); }).css('backgroundColor', ''); 359 360 } 360 361 361 362 // reset the Quicktags buttons … … 403 404 $('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide(); 404 405 405 406 c.after( editRow ).fadeOut('fast', function(){ 406 $('#replyrow').fadeIn(300, function(){ $(this).show() });407 $('#replyrow').fadeIn(300, function(){ $(this).show(); }); 407 408 }); 408 409 } else if ( action == 'add' ) { 409 410 $('#addhead, #addbtn', editRow).show(); 410 411 $('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide(); 411 412 $('#the-comment-list').prepend(editRow); 412 413 $('#replyrow').fadeIn(300); 413 } else {414 replyButton = $('#replybtn', editRow);414 } else { 415 replyButton = $('#replybtn', editRow); 415 416 $('#edithead, #savebtn, #addhead, #addbtn', editRow).hide(); 416 417 $('#replyhead, #replybtn', editRow).show(); 417 418 c.after(editRow); … … 422 423 replyButton.text(adminCommentsL10n.reply); 423 424 } 424 425 425 $('#replyrow').fadeIn(300, function(){ $(this).show() });426 $('#replyrow').fadeIn(300, function(){ $(this).show(); }); 426 427 } 427 428 428 429 setTimeout(function() { … … 431 432 rtop = $('#replyrow').offset().top; 432 433 rbottom = rtop + $('#replyrow').height(); 433 434 scrollTop = window.pageYOffset || document.documentElement.scrollTop; 434 vp = document.documentElement.clientHeight || self.innerHeight || 0;435 vp = document.documentElement.clientHeight || window.innerHeight || 0; 435 436 scrollBottom = scrollTop + vp; 436 437 437 438 if ( scrollBottom - 20 < rbottom ) … … 513 514 } 514 515 515 516 c = $.trim(r.data); // Trim leading whitespaces 516 $(c).hide() 517 $(c).hide(); 517 518 $('#replyrow').after(c); 518 519 519 520 id = $(id); … … 572 573 l = $('.tablenav-pages .'+which+'-page:not(.disabled)'); 573 574 if (l.length) 574 575 window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1'; 575 } 576 }; 576 577 }; 577 578 578 579 edit_comment = function(event, current_row) { … … 590 591 var scope = $('select[name="action"]'); 591 592 $('option[value="' + value + '"]', scope).prop('selected', true); 592 593 $('#doaction').click(); 593 } 594 }; 594 595 }; 595 596 596 597 $.table_hotkeys(