Created
July 1, 2014 22:23
-
-
Save thomasmb/1fb584da3bd09c61faa0 to your computer and use it in GitHub Desktop.
Replacement for the Akismet jQuery code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function(event) { | |
var ak_js = document.getElementById( 'ak_js' ); | |
if( !ak_js ){ | |
ak_js = document.createElement( 'input' ); | |
ak_js.type = 'hidden'; | |
ak_js.name = ak_js.id = 'ak_js'; | |
} | |
else { | |
ak_js.parentNode.removeChild( ak_js ); | |
} | |
ak_js.value = ( new Date() ).getTime(); | |
var el; | |
var destinations = []; | |
if( el = document.getElementById( 'commentform' ) ){ | |
destinations.push( el ); | |
} | |
if( ( el = document.getElementById( 'replyrow' ) ) && ( el = el.getElementsByTagName('td') ) ){ | |
destinations.push( el.item(0) ); | |
} | |
for( var i = 0, j = destinations.length; i < j; i++ ){ | |
destinations[i].appendChild( ak_js ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment