Ticket #15898: 15898-example-js.patch
File 15898-example-js.patch, 2.1 KB (added by , 14 years ago) |
---|
-
wp-admin/js/edit-comments.dev.js
1 var theList, theExtraList, toggleWithKeyboard = false ;1 var theList, theExtraList, toggleWithKeyboard = false, getCount, updateCount; 2 2 (function($) { 3 3 4 4 setCommentsList = function() { … … 117 117 118 118 } 119 119 120 function getCount(el) {120 getCount = function(el) { 121 121 var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 ); 122 122 if ( isNaN(n) ) 123 123 return 0; 124 124 return n; 125 125 } 126 126 127 function updateCount(el, n) {127 updateCount = function(el, n) { 128 128 var n1 = ''; 129 129 if ( isNaN(n) ) 130 130 return; … … 453 453 }, 454 454 455 455 show : function(xml) { 456 var r, c, id, bg;456 var t = this, r, c, id, bg, el, pid; 457 457 458 458 if ( typeof(xml) == 'string' ) { 459 t his.error({'responseText': xml});459 t.error({'responseText': xml}); 460 460 return false; 461 461 } 462 462 463 463 r = wpAjax.parseAjaxResponse(xml); 464 464 if ( r.errors ) { 465 t his.error({'responseText': wpAjax.broken});465 t.error({'responseText': wpAjax.broken}); 466 466 return false; 467 467 } 468 468 … … 475 475 $(c).hide() 476 476 $('#replyrow').after(c); 477 477 478 this.revert(); 479 this.addEvents($(id)); 480 bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff'; 478 if ( r.supplemental.parrent_approved ) { 479 el = $('span.pending-count'); 480 pid = '#comment-' + r.supplemental.parrent_approved; 481 updateCount( el, 1 + getCount(el) ); 482 } 481 483 484 t.revert(); 485 t.addEvents($(id)); 486 bg = $(id).hasClass('unapproved') ? '#FFFFE0' : '#FFFFFF'; 487 482 488 $(id) 483 489 .animate( { 'backgroundColor':'#CCEEBB' }, 600 ) 484 .animate( { 'backgroundColor': bg }, 600 ); 490 .animate( { 'backgroundColor': bg }, 600, function(){ 491 if ( pid ) { 492 pid = $(pid) 493 .animate( { 'backgroundColor':'#CCEEBB' }, 600 ) 494 .animate( { 'backgroundColor': '#FFFFFF' }, 600 ); 485 495 486 // $.fn.wpList.process($(id)); 496 pid.find('.row-actions .approve').hide(); 497 pid.find('.row-actions .unapprove').show(); 498 } 499 }); 487 500 }, 488 501 489 502 error : function(r) {