wp/wp-content/plugins/akismet/_inc/akismet.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
   144 				$( this ).data( 'akismet-mshot-preloaded', true );
   144 				$( this ).data( 'akismet-mshot-preloaded', true );
   145 			}
   145 			}
   146 		} );
   146 		} );
   147 	} );
   147 	} );
   148 
   148 
   149 	$('.checkforspam:not(.button-disabled)').click( function(e) {
   149 	$( '.checkforspam' ).click( function( e ) {
   150 		e.preventDefault();
   150 		e.preventDefault();
   151 
   151 
   152 		$('.checkforspam:not(.button-disabled)').addClass('button-disabled');
   152 		if ( $( this ).hasClass( 'button-disabled' ) ) {
       
   153 			window.location.href = $( this ).data( 'success-url' ).replace( '__recheck_count__', 0 ).replace( '__spam_count__', 0 );
       
   154 			return;
       
   155 		}
       
   156 
       
   157 		$('.checkforspam').addClass('button-disabled').addClass( 'checking' );
   153 		$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
   158 		$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
   154 
   159 
   155 		// Update the label on the "Check for Spam" button to use the active "Checking for Spam" language.
   160 		// Update the label on the "Check for Spam" button to use the active "Checking for Spam" language.
   156 		$( '.checkforspam .akismet-label' ).text( $( '.checkforspam' ).data( 'active-label' ) );
   161 		$( '.checkforspam .akismet-label' ).text( $( '.checkforspam' ).data( 'active-label' ) );
   157 
   162 
   280 	$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function(){
   285 	$( '#akismet-privacy-notice-admin-notice' ).on( 'click', '.notice-dismiss', function(){
   281 		$.ajax({
   286 		$.ajax({
   282                         url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
   287                         url: './options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide',
   283 		});
   288 		});
   284 	});
   289 	});
       
   290 
       
   291 	$( ".akismet-could-be-primary" ).each( function () {
       
   292 		var form = $( this ).closest( 'form' );
       
   293 
       
   294 		form.data( 'initial-state', form.serialize() );
       
   295 
       
   296 		form.on( 'change keyup', function () {
       
   297 			var self = $( this );
       
   298 			var submit_button = self.find( ".akismet-could-be-primary" );
       
   299 
       
   300 			if ( self.serialize() != self.data( 'initial-state' ) ) {
       
   301 				submit_button.addClass( "akismet-is-primary" );
       
   302 			}
       
   303 			else {
       
   304 				submit_button.removeClass( "akismet-is-primary" );
       
   305 			}
       
   306 		} );
       
   307 	} );
   285 });
   308 });