1apbctLocalStorage = { 2 get : function(key, property) { 3 if ( typeof property === 'undefined' ) { 4 property = 'value'; 5 } 6 const storageValue = localStorage.getItem(key); 7 if ( storageValue !== null ) { 8 try { 9 const json = JSON.parse(storageValue); 10 return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json; 11 } catch (e) { 12 return storageValue; 13 } 14 } 15 return false; 16 }, 17 set : function(key, value, is_json = true) { 18 if (is_json){ 19 let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)}; 20 localStorage.setItem(key, JSON.stringify(objToSave)); 21 } else { 22 localStorage.setItem(key, value); 23 } 24 }, 25 isAlive : function(key, maxLifetime) { 26 if ( typeof maxLifetime === 'undefined' ) { 27 maxLifetime = 86400; 28 } 29 const keyTimestamp = this.get(key, 'timestamp'); 30 return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000); 31 }, 32 isSet : function(key) { 33 return localStorage.getItem(key) !== null; 34 }, 35 delete : function (key) { 36 localStorage.removeItem(key); 37 }, 38 getCleanTalkData : function () { 39 let data = {} 40 for(let i=0; i<localStorage.length; i++) { 41 let key = localStorage.key(i); 42 if (key.indexOf('ct_') !==-1 || key.indexOf('apbct_') !==-1){ 43 data[key.toString()] = apbctLocalStorage.get(key) 44 } 45 } 46 return data 47 }, 48 49 } 50 51function ctSetCookie(c_name, value) { 52 if (typeof ct_setcookie !== "undefined" && ct_setcookie) { 53 document.cookie = c_name + "=" + encodeURIComponent(value) + "; path=/"; 54 } 55} 56 57ct_attach_event_handler(window, "DOMContentLoaded", ct_ready); 58 59//Stop observing function 60function ctMouseStopData(){ 61 if(typeof window.addEventListener == "function") 62 window.removeEventListener("mousemove", ctFunctionMouseMove); 63 else 64 window.detachEvent("onmousemove", ctFunctionMouseMove); 65 clearInterval(ctMouseReadInterval); 66 clearInterval(ctMouseWriteDataInterval); 67} 68 69//Stop key listening function 70function ctKeyStopStopListening(){ 71 if(typeof window.addEventListener == "function"){ 72 window.removeEventListener("mousedown", ctFunctionFirstKey); 73 window.removeEventListener("keydown", ctFunctionFirstKey); 74 }else{ 75 window.detachEvent("mousedown", ctFunctionFirstKey); 76 window.detachEvent("keydown", ctFunctionFirstKey); 77 } 78} 79 80var d = new Date(), 81 ctTimeMs = new Date().getTime(), 82 ctMouseEventTimerFlag = true, //Reading interval flag 83 ctMouseData = "[", 84 ctMouseDataCounter = 0; 85 86//Reading interval 87var ctMouseReadInterval = setInterval(function(){ 88 ctMouseEventTimerFlag = true; 89 }, 150); 90 91//Writting interval 92var ctMouseWriteDataInterval = setInterval(function(){ 93 var ctMouseDataToSend = ctMouseData.slice(0,-1).concat("]"); 94 ctSetCookie("ct_pointer_data", ctMouseDataToSend); 95 }, 1200); 96 97//Logging mouse position each 300 ms 98var ctFunctionMouseMove = function output(event){ 99 if(ctMouseEventTimerFlag == true){ 100 var mouseDate = new Date(); 101 ctMouseData += "[" + event.pageY + "," + event.pageX + "," + (mouseDate.getTime() - ctTimeMs) + "],"; 102 ctMouseDataCounter++; 103 ctMouseEventTimerFlag = false; 104 if(ctMouseDataCounter >= 100) 105 ctMouseStopData(); 106 } 107} 108//Writing first key press timestamp 109var ctFunctionFirstKey = function output(event){ 110 var KeyTimestamp = Math.floor(new Date().getTime()/1000); 111 ctSetCookie("ct_fkp_timestamp", KeyTimestamp); 112 ctKeyStopStopListening(); 113} 114 115if(typeof window.addEventListener == "function"){ 116 window.addEventListener("mousemove", ctFunctionMouseMove); 117 window.addEventListener("mousedown", ctFunctionFirstKey); 118 window.addEventListener("keydown", ctFunctionFirstKey); 119}else{ 120 window.attachEvent("onmousemove", ctFunctionMouseMove); 121 window.attachEvent("mousedown", ctFunctionFirstKey); 122 window.attachEvent("keydown", ctFunctionFirstKey); 123} 124// Ready function 125function ct_ready(){ 126 if (!ct_attach_event_token()){ 127 console.table('APBCT error: can not set event token',) 128 } 129 ctSetCookie("ct_ps_timestamp", Math.floor(new Date().getTime()/1000)); 130 ctSetCookie("ct_fkp_timestamp", "0"); 131 ctSetCookie("ct_pointer_data", "0"); 132 ctSetCookie("ct_timezone", new Date().getTimezoneOffset()/60*(-1)); 133 ctSetCookie("ct_visible_fields", 0); 134 ctSetCookie("ct_visible_fields_count", 0); 135 setTimeout(function(){ 136 for(var i = 0; i < document.forms.length; i++){ 137 var form = document.forms[i]; 138 139 if (!form.name && !form.id) { 140 continue; 141 } 142 143 form.addEventListener('submit', function () { 144 // Get only fields 145 var elements = []; 146 for(var key in this.elements){ 147 if(!isNaN(+key)) 148 elements[key] = this.elements[key]; 149 } 150 151 // Filter fields 152 elements = elements.filter(function(elem){ 153 154 var pass = true; 155 156 // Filter fields 157 if( getComputedStyle(elem).display === "none" || // hidden 158 getComputedStyle(elem).visibility === "hidden" || // hidden 159 getComputedStyle(elem).opacity === "0" || // hidden 160 elem.getAttribute("type") === "hidden" || // type == hidden 161 elem.getAttribute("type") === "submit" || // type == submit 162 elem.value === "" || // empty value 163 elem.getAttribute('name') === null 164 ){ 165 return false;
166 } 167 168 // Filter elements with same names for type == radio 169 if(elem.getAttribute("type") === "radio"){ 170 elements.forEach(function(el, j, els){ 171 if(elem.getAttribute('name') === el.getAttribute('name')){ 172 pass = false; 173 return; 174 } 175 }); 176 } 177 178 return true; 179 }); 180 181 // Visible fields count 182 var visible_fields_count = elements.length; 183 184 // Visible fields 185 var visible_fields = ''; 186 elements.forEach(function(elem, i, elements){ 187 visible_fields += " " + elem.getAttribute("name"); 188 }); 189 visible_fields = visible_fields.trim(); 190 191 ctSetCookie("ct_visible_fields", visible_fields); 192 ctSetCookie("ct_visible_fields_count", visible_fields_count); 193 }); 194 } 195 }, 1000); 196} 197 198function ct_attach_event_handler(elem, event, callback){ 199 if(typeof window.addEventListener === "function") elem.addEventListener(event, callback); 200 else elem.attachEvent(event, callback); 201} 202 203function ct_remove_event_handler(elem, event, callback){ 204 if(typeof window.removeEventListener === "function") elem.removeEventListener(event, callback); 205 else elem.detachEvent(event, callback); 206} 207 208function ct_attach_event_token(){ 209 if (typeof apbctLocalStorage !== "undefined"){ 210 const ct_event_token_string = apbctLocalStorage.get('bot_detector_event_token') 211 const ct_event_token_obj = JSON.parse(ct_event_token_string.toString()) 212 if (typeof ctSetCookie == "function" && typeof ct_event_token_obj.value != "undefined"){ 213 const value = ct_event_token_obj.value; 214 if (typeof value === "string" && value.length === 64){ 215 ctSetCookie("ct_event_token", ct_event_token_obj.value); 216 return true; 217 } 218 } 219 } 220 return false; 221}
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.