summaryrefslogtreecommitdiff
blob: 100fb22b7cc5a69249263abbd06c49a924afe985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* global ajaxurl */
jQuery( function( $ ) {
	$( document ).on( 'click', '#jetpack-check-feedback-spam:not(.button-disabled)', function( e ) {
		e.preventDefault();

		$( '#jetpack-check-feedback-spam:not(.button-disabled)' ).addClass( 'button-disabled' );
		$( '.jetpack-check-feedback-spam-spinner' )
			.addClass( 'spinner' )
			.show();
		grunion_check_for_spam( 0, 100 );
	} );

	function grunion_check_for_spam( offset, limit ) {
		$.post(
			ajaxurl,
			{
				action: 'grunion_recheck_queue',
				offset: offset,
				limit: limit,
			},
			function( result ) {
				if ( result.processed < limit ) {
					window.location.reload();
				} else {
					grunion_check_for_spam( offset + limit, limit );
				}
			}
		);
	}
} );