X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..refs/tags/wordpress-3.9.2:/wp-content/plugins/akismet/_inc/form.js diff --git a/wp-content/plugins/akismet/_inc/form.js b/wp-content/plugins/akismet/_inc/form.js index ec5e56e7..3a5be8af 100644 --- a/wp-content/plugins/akismet/_inc/form.js +++ b/wp-content/plugins/akismet/_inc/form.js @@ -1,17 +1,30 @@ -jQuery( function ( $ ) { - var ak_js = $( '#ak_js' ); +var ak_js = document.getElementById( "ak_js" ); - // If the form field already exists just use that - if ( ak_js.length == 0 ) { - ak_js = $( '' ); - } - else { - ak_js.remove(); - } +if ( ! ak_js ) { + ak_js = document.createElement( 'input' ); + ak_js.setAttribute( 'id', 'ak_js' ); + ak_js.setAttribute( 'name', 'ak_js' ); + ak_js.setAttribute( 'type', 'hidden' ); +} +else { + ak_js.parentNode.removeChild( ak_js ); +} + +ak_js.setAttribute( 'value', ( new Date() ).getTime() ); - ak_js.val( ( new Date() ).getTime() ); +var commentForm = document.getElementById( 'commentform' ); - // single page, front-end comment form - // inline comment reply, wp-admin - $( '#commentform, #replyrow td:first' ).append( ak_js ); -} ); +if ( commentForm ) { + commentForm.appendChild( ak_js ); +} +else { + var replyRowContainer = document.getElementById( 'replyrow' ); + + if ( replyRowContainer ) { + var children = replyRowContainer.getElementsByTagName( 'td' ); + + if ( children.length > 0 ) { + children[0].appendChild( ak_js ); + } + } +} \ No newline at end of file