]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-content/plugins/akismet/_inc/form.js
WordPress 3.9.2
[autoinstalls/wordpress.git] / wp-content / plugins / akismet / _inc / form.js
index ec5e56e7187e41291a54fc97dd531a7808ade7d4..3a5be8af02203eef6449c0b2c37ff914aaa6a4dd 100644 (file)
@@ -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 = $( '<input type="hidden" id="ak_js" name="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