grunion-admin.js 941 B

1234567891011121314151617181920212223242526272829
  1. /* global ajaxurl */
  2. jQuery( function ( $ ) {
  3. $( document ).on( 'click', '#jetpack-check-feedback-spam:not(.button-disabled)', function( e ) {
  4. e.preventDefault();
  5. $( '#jetpack-check-feedback-spam:not(.button-disabled)' ).addClass( 'button-disabled' );
  6. $( '.jetpack-check-feedback-spam-spinner' ).addClass( 'spinner' ).show();
  7. grunion_check_for_spam( 0, 100 );
  8. } );
  9. function grunion_check_for_spam( offset, limit ) {
  10. $.post(
  11. ajaxurl,
  12. {
  13. 'action' : 'grunion_recheck_queue',
  14. 'offset' : offset,
  15. 'limit' : limit
  16. },
  17. function ( result ) {
  18. if ( result.processed < limit ) {
  19. window.location.reload();
  20. }
  21. else {
  22. grunion_check_for_spam( offset + limit, limit );
  23. }
  24. }
  25. );
  26. }
  27. } );