1/* 2Honeypot Antispam plugin 3No spam in comments. No captcha. 4wordpress.org/plugins/honeypot-antispam/ 5*/ 6 7"use strict"; 8(function() { 9 function anti_spam_init() { 10 11 var i, 12 len, 13 elements, 14 answer = '', 15 current_year = new Date().getFullYear(), 16 dynamic_control; 17 18 elements = document.querySelectorAll('.antispam-group'); 19 len = elements.length; 20 for (i = 0; i < len; i++) { // hide inputs from users 21 elements[i].style.display = 'none'; 22 } 23 24 elements = document.querySelectorAll('.antispam-control-a'); 25 if ((elements) && (elements.length > 0)) { // get the answer 26 answer = elements[0].value; 27 } 28 29 elements = document.querySelectorAll('.antispam-control-q'); 30 len = elements.length; 31 for (i = 0; i < len; i++) { // set answer into other input instead of user 32 elements[i].value = answer; 33 } 34 35 // clear value of the empty input because some themes are adding some value for all inputs 36 elements = document.querySelectorAll('.antispam-control-e'); 37 len = elements.length; 38 for (i = 0; i < len; i++) { 39 elements[i].value = ''; 40 } 41 42 //dynamic_control = '<input type="text" name="antspm-d" class="antispam-control antispam-control-d" value="' + current_year + '" />'; 43 dynamic_control = document.createElement('input'); 44 dynamic_control.setAttribute('type', 'hidden'); 45 dynamic_control.setAttribute('name', 'antspm-d'); 46 dynamic_control.setAttribute('class', 'antispam-control antispam-control-d'); 47 dynamic_control.setAttribute('value', current_year); 48 49 // add input for every comment form if there are more than 1 form with IDs: comments, respond or commentform 50 elements = document.querySelectorAll('form'); 51 len = elements.length; 52 for (i = 0; i < len; i++) { 53 if ( (elements[i].id === 'comments') || (elements[i].id === 'respond') || (elements[i].id === 'commentform') ) { 54 var class_index = elements[i].className.indexOf('anti-spam-form-processed'); 55 if ( class_index == -1 ) { // form is not yet js processed 56 elements[i].appendChild(dynamic_control); 57 elements[i].className = elements[i].className + ' anti-spam-form-processed'; 58 } 59 } 60 } 61 } 62 63 if (document.addEventListener) { 64 document.addEventListener('DOMContentLoaded', anti_spam_init, false); 65 } 66 67 // set 1 second timeout for having form loaded and adding support for browsers which does not support 'DOMContentLoaded' listener 68 setTimeout(function () { 69 anti_spam_init(); 70 }, 1000); 71 72})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.