1var ct_date = new Date(), 2 ctTimeMs = new Date().getTime(), 3 ctMouseEventTimerFlag = true, //Reading interval flag 4 ctMouseData = [], 5 ctMouseDataCounter = 0; 6 7function ctSetCookieSec(c_name, value) { 8 document.cookie = c_name + "=" + encodeURIComponent(value) + "; path=/; samesite=lax"; 9} 10 11function apbct_attach_event_handler(elem, event, callback){ 12 if(typeof window.addEventListener == "function") elem.addEventListener(event, callback); 13 else elem.attachEvent(event, callback); 14} 15 16function apbct_remove_event_handler(elem, event, callback){ 17 if(typeof window.removeEventListener == "function") elem.removeEventListener(event, callback); 18 else elem.detachEvent(event, callback); 19} 20 21ctSetCookieSec("apbct_ps_timestamp", Math.floor(new Date().getTime()/1000)); 22ctSetCookieSec("apbct_fkp_timestamp", "0"); 23ctSetCookieSec("apbct_pointer_data", "0"); 24ctSetCookieSec("apbct_timezone", "0"); 25 26setTimeout(function(){ 27 ctSetCookieSec("apbct_timezone", ct_date.getTimezoneOffset()/60*(-1)); 28},1000); 29 30//Writing first key press timestamp 31var ctFunctionFirstKey = function output(event){ 32 var KeyTimestamp = Math.floor(new Date().getTime()/1000); 33 ctSetCookieSec("ct_fkp_timestamp", KeyTimestamp); 34 ctKeyStopStopListening(); 35} 36 37//Reading interval 38var ctMouseReadInterval = setInterval(function(){ 39 ctMouseEventTimerFlag = true; 40}, 150); 41 42//Writting interval 43var ctMouseWriteDataInterval = setInterval(function(){ 44 ctSetCookieSec("apbct_pointer_data", JSON.stringify(ctMouseData)); 45}, 1200); 46 47//Logging mouse position each 150 ms 48var ctFunctionMouseMove = function output(event){ 49 if(ctMouseEventTimerFlag == true){ 50 51 ctMouseData.push([ 52 Math.round(event.pageY), 53 Math.round(event.pageX), 54 Math.round(new Date().getTime() - ctTimeMs) 55 ]); 56 57 ctMouseDataCounter++; 58 ctMouseEventTimerFlag = false; 59 if(ctMouseDataCounter >= 50){ 60 ctMouseStopData(); 61 } 62 } 63} 64 65//Stop mouse observing function 66function ctMouseStopData(){ 67 apbct_remove_event_handler(window, "mousemove", ctFunctionMouseMove); 68 clearInterval(ctMouseReadInterval); 69 clearInterval(ctMouseWriteDataInterval); 70} 71 72//Stop key listening function 73function ctKeyStopStopListening(){ 74 apbct_remove_event_handler(window, "mousedown", ctFunctionFirstKey); 75 apbct_remove_event_handler(window, "keydown", ctFunctionFirstKey); 76} 77 78apbct_attach_event_handler(window, "mousemove", ctFunctionMouseMove); 79apbct_attach_event_handler(window, "mousedown", ctFunctionFirstKey); 80apbct_attach_event_handler(window, "keydown", ctFunctionFirstKey); 81 82// Ready function 83function apbct_ready(){ 84 ctSetCookieSec("apbct_visible_fields", 0); 85 ctSetCookieSec("apbct_visible_fields_count", 0); 86 if (document.getElementById("ct_checkjs")) 87 document.getElementById("ct_checkjs").value = ct_date.getFullYear(); 88 89 for(var i = 0; i < document.getElementsByClassName('ct_checkjs').length; i++){ 90 console.log(document.getElementsByClassName('ct_checkjs')[i]); 91 document.getElementsByClassName('ct_checkjs')[i].value = ct_date.getFullYear(); 92 } 93 94 setTimeout(function(){ 95 96 for(var i = 0; i < document.forms.length; i++){ 97 var form = document.forms[i]; 98 99 //Exclusion for forms 100 if ( 101 form.classList.contains('slp_search_form') || //StoreLocatorPlus form 102 form.parentElement.classList.contains('mec-booking') || 103 form.action.toString().indexOf('activehosted.com') || // Active Campaign 104 (form.id && form.id === 'caspioform') || //Caspio Form 105 form.elements.ct_checkjs === 'undefined' // The form does not contain the ct_ field, skip this 106 ) 107 continue; 108 109 form.onsubmit_prev = form.onsubmit; 110 form.onsubmit = function (event) { 111 112 event.preventDefault(); 113 114 apbct_collect_visible_fields_and_set_cookie(this); 115 116 // Call previous submit action 117 if (event.target.onsubmit_prev instanceof Function) { 118 setTimeout(function () { 119 event.target.onsubmit_prev.call(event.target, event); 120 }, 500); 121 } 122 }; 123 } 124 }, 1000); 125} 126apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready); 127 128// Include JS checking code to ajax requests 129jQuery(document).ajaxSend(function(event, xhr, settings) { 130 if( undefined !== settings.data ) { 131 if( settings.data.includes( 'account=register' ) ) { 132 settings.data += '&ct_checkjs=' + $('#ct_checkjs').val(); 133 } 134 } 135}); 136 137function apbct_collect_visible_fields_and_set_cookie(form ) { 138 139 // Get only fields 140 var inputs = [], 141 inputs_visible = '', 142 inputs_visible_count = 0, 143 inputs_with_duplicate_names = []; 144 145 for(var key in form.elements){ 146 if(!isNaN(+key)) 147 inputs[key] = form.elements[key]; 148 } 149 150 // Filter fields
151 inputs = inputs.filter(function(elem){ 152 153 // Filter fields 154 if( getComputedStyle(elem).display === "none" || // hidden 155 getComputedStyle(elem).visibility === "hidden" || // hidden 156 getComputedStyle(elem).opacity === "0" || // hidden 157 elem.getAttribute("type") === "hidden" || // type == hidden 158 elem.getAttribute("type") === "submit" || // type == submit 159 elem.value === "" || // empty value 160 elem.getAttribute('name') === null || 161 inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added 162 ){ 163 return false; 164 } 165 166 // Visible fields count 167 inputs_visible_count++; 168 169 // Filter inputs with same names for type == radio 170 if( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute("type") )){ 171 inputs_with_duplicate_names.push( elem.getAttribute('name') ); 172 return false; 173 } 174 175 return true; 176 }); 177 178 // Visible fields 179 inputs.forEach(function(elem, i, elements){ 180 inputs_visible += " " + elem.getAttribute("name"); 181 }); 182 inputs_visible = inputs_visible.trim(); 183 184 ctSetCookieSec("apbct_visible_fields", inputs_visible); 185 ctSetCookieSec("apbct_visible_fields_count", inputs_visible_count); 186 187}
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.