wp/wp-content/plugins/akismet/_inc/akismet.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
--- a/wp/wp-content/plugins/akismet/_inc/akismet.js	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-content/plugins/akismet/_inc/akismet.js	Mon Oct 14 18:28:13 2019 +0200
@@ -146,10 +146,15 @@
 		} );
 	} );
 
-	$('.checkforspam:not(.button-disabled)').click( function(e) {
+	$( '.checkforspam' ).click( function( e ) {
 		e.preventDefault();
 
-		$('.checkforspam:not(.button-disabled)').addClass('button-disabled');
+		if ( $( this ).hasClass( 'button-disabled' ) ) {
+			window.location.href = $( this ).data( 'success-url' ).replace( '__recheck_count__', 0 ).replace( '__spam_count__', 0 );
+			return;
+		}
+
+		$('.checkforspam').addClass('button-disabled').addClass( 'checking' );
 		$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
 
 		// Update the label on the "Check for Spam" button to use the active "Checking for Spam" language.
@@ -282,4 +287,22 @@
                         url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
 		});
 	});
+
+	$( ".akismet-could-be-primary" ).each( function () {
+		var form = $( this ).closest( 'form' );
+
+		form.data( 'initial-state', form.serialize() );
+
+		form.on( 'change keyup', function () {
+			var self = $( this );
+			var submit_button = self.find( ".akismet-could-be-primary" );
+
+			if ( self.serialize() != self.data( 'initial-state' ) ) {
+				submit_button.addClass( "akismet-is-primary" );
+			}
+			else {
+				submit_button.removeClass( "akismet-is-primary" );
+			}
+		} );
+	} );
 });