Changeset 2113423
- Timestamp:
- 06/27/2019 07:24:40 AM (7 years ago)
- Location:
- cleantalk-spam-protect/trunk
- Files:
-
- 4 edited
-
cleantalk.php (modified) (1 diff)
-
inc/cleantalk-common.php (modified) (1 diff)
-
js/apbct-public.min.js (modified) (1 diff)
-
js/apbct-public.min.js.map (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cleantalk-spam-protect/trunk/cleantalk.php
r2113368 r2113423 4 4 Plugin URI: http://cleantalk.org 5 5 Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. 6 Version: 5.12 16 Version: 5.122 7 7 Author: СleanTalk <welcome@cleantalk.org> 8 8 Author URI: http://cleantalk.org -
cleantalk-spam-protect/trunk/inc/cleantalk-common.php
r2113368 r2113423 262 262 'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false, 263 263 'request_type' => isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'UNKNOWN', 264 'abpct_hyro_acc_collect' => !empty($_COOKIE['abpct_hyro_acc_collect']) ? json_decode(stripslashes($_COOKIE['abpct_hyro_acc_collect']), true): null, 264 265 ); 265 266 } -
cleantalk-spam-protect/trunk/js/apbct-public.min.js
r2113368 r2113423 1 var ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0;function ctSetCookieSec(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function apbct_attach_event_handler(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function apbct_remove_event_handler(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookieSec("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookieSec("ct_fkp_timestamp","0"),ctSetCookieSec("ct_pointer_data","0"),ctSetCookieSec("ct_timezone","0"),setTimeout(function(){ctSetCookieSec("ct_timezone",ct_date.getTimezoneOffset()/60*-1)},1e3);var ctFunctionFirstKey=function(e){ctSetCookieSec("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookieSec("ct_pointer_data",JSON.stringify(ctMouseData))},1200),ctFunctionMouseMove=function(e){!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter&&ctMouseStopData())};function ctMouseStopData(){apbct_remove_event_handler(window,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(window,"keydown",ctFunctionFirstKey)}function apbct_ready(){ctSetCookieSec("apbct_visible_fields",0),ctSetCookieSec("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){var t=[];for(var n in this.elements)isNaN(+n)||(t[n]=this.elements[n]);var o=(t=t.filter(function(o){return"none"!==getComputedStyle(o).display&&"hidden"!==getComputedStyle(o).visibility&&"0"!==getComputedStyle(o).opacity&&"hidden"!==o.getAttribute("type")&&"submit"!==o.getAttribute("type")&&""!==o.value&&("radio"===o.getAttribute("type")&&t.forEach(function(e,t,n){o.getAttribute("name")!==e.getAttribute("name")||!1}),!0)})).length,c="";t.forEach(function(e,t,n){c+=" "+e.getAttribute("name")}),ctSetCookieSec("apbct_visible_fields",c=c.trim()),ctSetCookieSec("apbct_visible_fields_count",o),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)}}},1e3)}function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var c=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(c,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var c=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||c&&c(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}apbct_attach_event_handler(window,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(window,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(window,"DOMContentLoaded",apbct_ready),jQuery(document).ajaxComplete(function(e,t,n){var o;t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&alert(o.comment)});1 function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var i=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var i=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||i&&i(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function c(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function r(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}a("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),a("ct_fkp_timestamp","0"),a("ct_pointer_data","0"),a("ct_timezone","0"),setTimeout(function(){a("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var u=function(e){a("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),r(window,"mousedown",u),r(window,"keydown",u)},l=setInterval(function(){n=!0},150),m=setInterval(function(){a("ct_pointer_data",JSON.stringify(o))},1200),s=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(r(window,"mousemove",s),clearInterval(l),clearInterval(m)))};c(window,"mousemove",s),c(window,"mousedown",u),c(window,"keydown",u);var d,p,v,f,_,g,w=!0,b={orientation:{alpha:{},beta:{},gamma:{}},motion:{x:{},y:{},z:{}}};var y=setInterval(function(){var e=+new Date;b.orientation.alpha[e]=d,b.orientation.beta[e]=p,b.orientation.gamma[e]=v,b.motion.x[e]=f,b.motion.y[e]=_,b.motion.z[e]=g,a("abpct_hyro_acc_collect",JSON.stringify(b))},1e3);setTimeout(function(){clearInterval(y)},1e4),window.DeviceOrientationEvent&&c(window,"deviceorientation",function(e){var t,n,o,i=0,a=0,c=0;if(w)return i=e.alpha,a=e.beta,c=e.gamma,void(w=!1);t=e.alpha-i,n=e.beta-a,o=e.gamma-c,d=parseInt(t,10),p=parseInt(n,10),v=parseInt(o,10)}),window.DeviceMotionEvent&&c(window,"devicemotion",function(e){f=parseInt(e.accelerationIncludingGravity.x,10),_=parseInt(e.accelerationIncludingGravity.y,10),g=parseInt(e.accelerationIncludingGravity.z,10)}),c(window,"DOMContentLoaded",function(){a("apbct_visible_fields",0),a("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){var t=[];for(var n in this.elements)isNaN(+n)||(t[n]=this.elements[n]);var o=(t=t.filter(function(o){return"none"!==getComputedStyle(o).display&&"hidden"!==getComputedStyle(o).visibility&&"0"!==getComputedStyle(o).opacity&&"hidden"!==o.getAttribute("type")&&"submit"!==o.getAttribute("type")&&""!==o.value&&("radio"===o.getAttribute("type")&&t.forEach(function(e,t,n){o.getAttribute("name")!==e.getAttribute("name")||!1}),!0)})).length,i="";t.forEach(function(e,t,n){i+=" "+e.getAttribute("name")}),a("apbct_visible_fields",i=i.trim()),a("apbct_visible_fields_count",o),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)}}},1e3)})}(),jQuery(document).ajaxComplete(function(e,t,n){var o;t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&alert(o.comment)}); 2 2 //# sourceMappingURL=apbct-public.min.js.map -
cleantalk-spam-protect/trunk/js/apbct-public.min.js.map
r2113368 r2113423 1 {"version":3,"sources":["apbct-public.js"],"names":[" ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","value","document","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctKeyStopStopListening","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","JSON","stringify","ctFunctionMouseMove","push","round","clientY","clientX","ctMouseStopData","clearInterval","apbct_ready","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","apbct_js_keys__set_input_value","result","data","params","obj","getElementById","input_name","ct_input_value","replace","js_key","apbct_sendAJAXRequest","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","parse","error","jqXHR","textStatus","errorThrown","console","log","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","al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BN,EAAOQ,SAIrI,SAASC,sBAAsBR,EAAMC,EAAQC,GAG5C,IAAIxD,EAAcuD,EAAOvD,UAAe,KACpC+D,EAAcR,EAAOQ,SAAe,KACpCC,EAAcT,EAAOS,SAAe,KACpCR,EAAcA,GAAsB,KAExCF,EAAKW,YAAcC,SAASD,YAE5BE,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKJ,SAASK,UACdjB,KAAMA,EACNkB,QAAS,SAASnB,GACbU,IAASV,EAASrC,KAAKyD,MAAMpB,IAC9BA,EAAOqB,OAGN1E,GACFA,EAASqD,EAAQC,EAAMC,EAAQC,IAGlCkB,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAI,oBACZD,QAAQC,IAAIzB,GACZwB,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbb,QAASA,IA9HXnE,2BAA2BI,OAAQ,YAAaiB,qBAChDrB,2BAA2BI,OAAQ,YAAaU,oBAChDd,2BAA2BI,OAAQ,UAAWU,oBAwE9Cd,2BAA2BI,OAAQ,mBAAoBwB,aAGvD0C,OAAOzE,UAAUsF,aAAa,SAASjF,EAAOkF,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWnE,KAAKyD,MAAMQ,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["var ct_date = new Date(), \r\n\tctTimeMs = new Date().getTime(),\r\n\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\tctMouseData = [],\r\n\tctMouseDataCounter = 0;\r\n\r\nfunction ctSetCookieSec(c_name, value) {\r\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n}\r\n\r\nfunction apbct_attach_event_handler(elem, event, callback){\r\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\telse elem.attachEvent(event, callback);\r\n}\r\n\r\nfunction apbct_remove_event_handler(elem, event, callback){\r\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\telse elem.detachEvent(event, callback);\r\n}\r\n\r\nctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\nctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\nctSetCookieSec(\"ct_pointer_data\", \"0\");\r\nctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\nsetTimeout(function(){\r\n\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n},1000);\r\n\r\n//Writing first key press timestamp\r\nvar ctFunctionFirstKey = function output(event){\r\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\tctKeyStopStopListening();\r\n};\r\n\r\n//Reading interval\r\nvar ctMouseReadInterval = setInterval(function(){\r\n\tctMouseEventTimerFlag = true;\r\n}, 150);\r\n\t\r\n//Writting interval\r\nvar ctMouseWriteDataInterval = setInterval(function(){\r\n\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n}, 1200);\r\n\r\n//Logging mouse position each 150 ms\r\nvar ctFunctionMouseMove = function output(event){\r\n\tif(ctMouseEventTimerFlag === true){\r\n\t\t\r\n\t\tctMouseData.push([\r\n\t\t\tMath.round(event.clientY),\r\n\t\t\tMath.round(event.clientX),\r\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t]);\r\n\t\t\r\n\t\tctMouseDataCounter++;\r\n\t\tctMouseEventTimerFlag = false;\r\n\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\tctMouseStopData();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n//Stop mouse observing function\r\nfunction ctMouseStopData(){\r\n\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tclearInterval(ctMouseReadInterval);\r\n\tclearInterval(ctMouseWriteDataInterval);\t\t\t\t\r\n}\r\n\r\n//Stop key listening function\r\nfunction ctKeyStopStopListening(){\r\n\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n}\r\n\r\napbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\napbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\napbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n// Ready function\r\nfunction apbct_ready(){\r\n\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\tsetTimeout(function(){\r\n\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\tform.onsubmit = function(event){\r\n\t\t\t\t\r\n\t\t\t\t// Get only fields\r\n\t\t\t\tvar elements = [];\r\n\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Filter fields\r\n\t\t\t\telements = elements.filter(function(elem){\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar pass = true;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\telem.value === \"\" // empty value\r\n\t\t\t\t\t){\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t// Visible fields count\r\n\t\t\t\tvar visible_fields_count = elements.length;\r\n\t\t\t\t\r\n\t\t\t\t// Visible fields\r\n\t\t\t\tvar visible_fields = '';\r\n\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t});\r\n\t\t\t\tvisible_fields = visible_fields.trim();\r\n\t\t\t\t\r\n\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\t\t\t\t\r\n\t\t\t\t// Call previous submit action\r\n\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t}, 500);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t}, 1000);\r\n}\r\napbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\t\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\t\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\t\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}\r\n\r\n//(function(open) {\r\n// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n// this.addEventListener(\"readystatechange\", function() {\r\n// }, false);\r\n// open.call(this, method, url, async, user, pass);\r\n// };\r\n//})(XMLHttpRequest.prototype.open);"]}1 {"version":3,"sources":["apbct-public.js"],"names":["apbct_js_keys__set_input_value","result","data","params","obj","document","getElementById","input_name","ct_input_value","value","replace","js_key","apbct_sendAJAXRequest","callback","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","JSON","parse","error","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","stringify","ctFunctionMouseMove","push","round","clientY","clientX","clearInterval","globalAlpha","globalBeta","globalGamma","globalAccX","globalAccY","globalAccZ","isFirstTimeHyro","output","orientation","alpha","beta","gamma","motion","x","y","z","collect","timestamp","DeviceOrientationEvent","alphaOffset","betaOffset","gammaOffset","parseInt","DeviceMotionEvent","accelerationIncludingGravity","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","alert","comment"],"mappings":"AA2PA,SAASA,+BAA+BC,EAAQC,EAAMC,EAAQC,GAC7D,GAAmD,OAA/CC,SAASC,eAAeH,EAAOI,YAAsB,CACxD,IAAIC,EAAiBH,SAASC,eAAeH,EAAOI,YAAYE,MAChEJ,SAASC,eAAeH,EAAOI,YAAYE,MAAQJ,SAASC,eAAeH,EAAOI,YAAYE,MAAMC,QAAQF,EAAgBP,EAAOU,SAIrI,SAASC,sBAAsBV,EAAMC,EAAQC,GAG5C,IAAIS,EAAcV,EAAOU,UAAe,KACpCC,EAAcX,EAAOW,SAAe,KACpCC,EAAcZ,EAAOY,SAAe,KACpCX,EAAcA,GAAsB,KAExCF,EAAKc,YAAcC,SAASD,YAE5BE,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKJ,SAASK,UACdpB,KAAMA,EACNqB,QAAS,SAAStB,GACba,IAASb,EAASu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,EAAO0E,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWjG,KAAKC,MAAM8F,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction ctSetCookieSec(c_name, value) {\r\n\t\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n\t}\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookieSec(\"ct_pointer_data\", \"0\");\r\n\tctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Hyroscope && Accelerometer data\r\n\r\n var isFirstTimeHyro = true;\r\n\r\n var output = {\r\n 'orientation' : {\r\n 'alpha' : {},\r\n 'beta' : {},\r\n 'gamma' : {}\r\n },\r\n 'motion' : {\r\n 'x' : {},\r\n 'y' : {},\r\n 'z' : {}\r\n }\r\n };\r\n\r\n var globalAlpha, globalBeta, globalGamma, globalAccX, globalAccY, globalAccZ;\r\n\r\n function handleOrientation(event) {\r\n\r\n var alphaOffset = 0;\r\n var betaOffset = 0;\r\n var gammaOffset = 0;\r\n var alpha = 0;\r\n var beta = 0;\r\n var gamma = 0;\r\n if(isFirstTimeHyro){\r\n alphaOffset = event.alpha;\r\n betaOffset = event.beta;\r\n gammaOffset = event.gamma;\r\n isFirstTimeHyro = false;\r\n return;\r\n }\r\n\r\n alpha = event.alpha - alphaOffset;\r\n beta = event.beta - betaOffset;\r\n gamma = event.gamma - gammaOffset;\r\n globalAlpha = parseInt( alpha, 10 );\r\n globalBeta = parseInt( beta, 10 );\r\n globalGamma = parseInt( gamma, 10 );\r\n\r\n }\r\n\r\n function handleMotion(event) {\r\n\r\n globalAccX = parseInt( event.accelerationIncludingGravity.x, 10 );\r\n globalAccY = parseInt( event.accelerationIncludingGravity.y, 10 );\r\n globalAccZ = parseInt( event.accelerationIncludingGravity.z, 10 );\r\n\r\n }\r\n\r\n var collect = setInterval( function(){\r\n var timestamp = ( + new Date() );\r\n output.orientation.alpha[timestamp] = globalAlpha;\r\n output.orientation.beta[timestamp] = globalBeta;\r\n output.orientation.gamma[timestamp] = globalGamma;\r\n output.motion.x[timestamp] = globalAccX;\r\n output.motion.y[timestamp] = globalAccY;\r\n output.motion.z[timestamp] = globalAccZ;\r\n ctSetCookieSec(\"abpct_hyro_acc_collect\", JSON.stringify(output))\r\n }, 1000 );\r\n setTimeout( function(){\r\n clearInterval( collect );\r\n }, 10000 );\r\n\r\n if (window.DeviceOrientationEvent) {\r\n apbct_attach_event_handler(window, \"deviceorientation\", handleOrientation);\r\n }\r\n if (window.DeviceMotionEvent) {\r\n apbct_attach_event_handler(window, \"devicemotion\", handleMotion);\r\n }\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\t\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\t\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\t\tsetTimeout(function(){\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function(event){\r\n\r\n\t\t\t\t\t// Get only fields\r\n\t\t\t\t\tvar elements = [];\r\n\t\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\telements = elements.filter(function(elem){\r\n\r\n\t\t\t\t\t\tvar pass = true;\r\n\r\n\t\t\t\t\t\t// Filter fields\r\n\t\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\t\telem.value === \"\" // empty value\r\n\t\t\t\t\t\t){\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// Visible fields count\r\n\t\t\t\t\tvar visible_fields_count = elements.length;\r\n\r\n\t\t\t\t\t// Visible fields\r\n\t\t\t\t\tvar visible_fields = '';\r\n\t\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t\t});\r\n\t\t\t\t\tvisible_fields = visible_fields.trim();\r\n\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n\t//(function(open) {\r\n\t// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n\t// this.addEventListener(\"readystatechange\", function() {\r\n\t// }, false);\r\n\t// open.call(this, method, url, async, user, pass);\r\n\t// };\r\n\t//})(XMLHttpRequest.prototype.open);\r\n\r\n}());\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}"]}
Note: See TracChangeset
for help on using the changeset viewer.