Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function logout() {
- trainingComplete = "", $.cookie("trainingComplete", ""), $.ajax({
- type: "POST",
- url: bhw_logout_endpoint,
- data: {},
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success === !0 ? ($.cookie("behavioId", ""), $.cookie("sessionId", ""), $.cookie("trainingComplete", ""), bw.resetBehavioData(), bw.init(), location.href = "./", checkUI()) : bsAlert(e.message, $("#dLogin"))
- }
- })
- }
- function setMetaTag(e, t) {
- for (var n = document.getElementsByTagName("meta"), a = 0; a < n.length; a++) n[a].getAttribute("name") == e && ("undefined" != typeof n[a].remove ? n[a].remove() : "undefined" != typeof n[a].removeNode && n[a].removeNode());
- var o = document.createElement("meta");
- o.setAttribute("name", e), o.setAttribute("content", t), document.getElementsByTagName("head")[0].appendChild(o)
- }
- function transition(e, t) {
- $(e).fadeOut(300, function() {
- sectionId = t, $(t).fadeIn(300), checkUI()
- })
- }
- function loginCallback() {
- transition("#login", "#transaction");
- setTimeout(function() {
- getProgress(checkUI)
- }, 100)
- }
- function transferCallback() {
- setTimeout(function() {
- getSessionScore()
- }, 500);
- getProgress(checkUI)
- }
- function registerValidate(e) {
- var t = $("#username-register").val(),
- n = $("#password-register").val(),
- a = $("#password-confirm").val(),
- o = !1;
- return t.length < 3 ? bsAlert("Username must be at least 3 characters.", $("#username-register")) : n.length < 3 ? bsAlert("Password must be at least 3 characters.", $("#password-register")) : n != a ? bsAlert("Passwords must match.", $("#password-register")) : o = !0, o
- }
- function getSessionScore() {
- var e = "sessionid=" + encodeURIComponent(sessionid);
- $.ajax({
- type: "POST",
- url: bhw_getreportbyid_endpoint,
- data: e,
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- if (e.session) {
- if (0 === e.data.length) return !1;
- "Training" === e.policy ? ($("#btnViewInDashboard").hide(), $("#resultMessage").html(" <h4>The transfer has been successfully completed!</h4><p>Your profile is still being trained.</p><p>You have completed <strong>" + e.reportUpdates + " of " + e.trainingLimit + " transactions</strong> needed to complete training.</p>")) : ($("#btnViewInDashboard").show(), $("#resultMessage").html(" <h4>Profile sufficiently trained!</h4><p>To see the details regarding this session and transaction, you can now access the BehavioWeb Dashboard.</p> <p>The Dashboard is a view that would be seen by security or antifraud staff.</p> <p>Typically a decision to proceed with the transaction or request further authentication from the end user is made in real time based on this score:</p>")), $.cookie("trainingComplete", e.reportUpdates / e.trainingLimit, {
- expires: .5
- }), $("#outputTransactionId").html(e.idReport), $("#outputSessionId").html(e.idSession), $("#outputTransactionPolicy").html(e.policy), $("#outputSessionPolicy").html(e.sessionPolicyClassification), $("#outputTransactionScore").html(e.score.toFixed(2)), $("#outputSessionScore").html(e.sessionScore.toFixed(2)), $("#outputTransactionConfidence").html(e.confidence.toFixed(2)), $("#outputSessionConfidence").html(e.sessionConfidence.toFixed(2)), transition("#transaction", "#results")
- } else bsAlert(e.message, $("#panelResults"))
- },
- error: function(e) {
- $("#panelResults").html(e.message)
- }
- })
- }
- function validateTransferFields() {
- var e = !1;
- return "231187023484" != $("#from-account").val().replace(/ /g, "") ? (bsAlert("Please enter source account number", $("#from-account")), $("#from-account").focus(), e = !1) : "231187021262" != $("#to-account").val().replace(/ /g, "") ? (bsAlert("Please enter target account number", $("#to-account")), $("#to-account").focus(), e = !1) : $("#amount").val().length < 1 ? (bsAlert("Please enter an amount", $("#amount")), $("#amount").focus(), e = !1) : $("#date-of-payment").val().length < 8 ? (bsAlert("Please enter date of payment", $("#date-of-payment")), $("#date-of-payment").focus(), e = !1) : e = !0, e
- }
- function validateLoginFields() {
- var e = !1,
- t = $("#username").val(),
- n = $("#password").val();
- return "" === t.replace(/ /g, "") ? (bsAlert("Username must not be empty", $("#username")), $("#username").focus(), e = !1) : "" === n.replace(/ /g, "") ? (bsAlert("Password must not be empty", $("#password")), $("#password").focus(), e = !1) : e = !0, e
- }
- function bsAlert(e, t, n) {
- void 0 === t && (t = $(this)), t.before("error" == n ? '<div class="alert alert-error alert-dismissable" style="margin-top:5px">' + e + "</div>" : '<div class="alert alert-success alert-dismissable" style="margin-top:5px">' + e + "</div>"), window.setTimeout(function() {
- $(".alert").fadeTo(500, 0).slideUp(500, function() {
- $(this).remove()
- })
- }, 5e3)
- }
- function faqToggle(e) {
- $("#ajaxLoader").remove(), $("#faqList").length ? $("#faqList").slideUp(300, function() {
- $("#faqList").remove()
- }) : ($(".btnFAQ").after('<div id="ajaxLoader" style="width:100%; text-align:center"><img align="center" width="54" height="54" src="../images/ajax-loader.gif"></div>'), $.ajax({
- type: "POST",
- url: bhw_faq_endpoint,
- data: {},
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success && (faqList = '<ul id="faqList" style="display:none">', $.each(e.posts, function(t, n) {
- faqList += "<li><h6>" + e.posts[t].post_title + "</h6>", faqList += "<p>" + e.posts[t].post_content + "</p></li>"
- }), faqList += "</ul>", $("#ajaxLoader").remove(), $(".btnFAQ").after(faqList), $("#faqList").slideDown())
- }
- }))
- }
- function passwordRegisterFocus(e) {
- e = $(e), 0 === $("#suggestPw").length && ($("#suggestPw").remove(), $(".important").remove(), suggestedPassword = generatePassword(4) + generatePassword(2, !1, /\d/), e.before('<div id="suggestPw" class="alert alert-error alert-dismissable" style="margin-top:5px">Suggested demo password: <h2>' + suggestedPassword + "</h2></div>"), e.after('<div class="important"><h5>Important!</h5><p>Take care to write down your password.</p></div>'), $("#suggestPw").fadeIn("slow"), $(".important").fadeIn("slow"))
- }
- function register(e) {
- return registerValidate($(this)) ? void $.ajax({
- type: "POST",
- url: bhw_register_endpoint,
- data: {
- options: JSON.stringify({
- username: $("#username-register").val(),
- password: $("#password-register").val(),
- email: $("#password-register").val()
- })
- },
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success === !0 ? (transition("#register", "#login"), bsAlert(e.message, $("#btnLogin"))) : bsAlert(e.message, $("#username-register"))
- }
- }) : !1
- }
- function checkUI() {
- $.cookie("sessionId") && "" !== $.cookie("sessionId") ? ($("#lnkLogout").show(), $("#lnkLogin a").html("Logged in as: " + $.cookie("behavioId")), drawProgressBar()) : ($("#lnkLogout").hide(), $("#lnkLogin a").html("Login"), drawProgressBar()), "#transaction" === sectionId && $("#from-account").focus(), ("#login" === sectionId || "" === sectionId) && $("#username").focus()
- }
- function drawProgressBar() {
- $.cookie("sessionId") && $.cookie("behavioId") && $.cookie("trainingComplete") && "" !== $.cookie("trainingComplete") ? (trainingComplete = $.cookie("trainingComplete"), trainingComplete > 1 && "#transaction" === sectionId && ($("#progressBar").remove(), $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')), trainingComplete > 1 && "#results" === sectionId ? ($("#progressBar").remove(), trainingComplete = 1, $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')) : trainingComplete > 1 && "#transaction" === sectionId ? ($("#progressBar").remove(), trainingComplete = 1, $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')) : ("#results" === sectionId || "#transaction" === sectionId && trainingComplete < 1) && ($("#progressBar").remove(), $("#header").after('<div id="progressBar"><div id="progressIndicator"></div>' + 100 * trainingComplete + "%</div>"), $("#progressIndicator").css("width", 100 * trainingComplete - 10 + "%"), setTimeout(function() {
- $("#progressIndicator").css("width", 100 * trainingComplete + "%")
- }, 300))) : $("#progressBar").remove()
- }
- function getProgress(e) {
- var t = $.cookie("sessionId");
- if (!t || "" === t) return $.cookie("trainingComplete", ""), !1;
- var n = "sessionid=" + encodeURIComponent(t);
- $.ajax({
- type: "POST",
- url: bhw_getreportbyid_endpoint,
- data: n,
- contentType: "text/plain",
- dataType: "json",
- success: function(t) {
- if (t.session) {
- if (0 === t.data.length) return !1;
- $.cookie("trainingComplete", t.reportUpdates / t.trainingLimit, {
- expires: .5
- }), e(), "Training" === t.policy
- } else bsAlert(t.message, $("#panelResults"))
- },
- error: function(e) {
- $("#panelResults").html(e.message)
- }
- })
- }
- function readyState(e) {
- ("interactive" === document.readyState || "complete" === document.readyState) && e()
- }
- function loginValidate(e) {
- if (validateLoginFields()) {
- var t = $("#username").val(),
- n = $("#password").val();
- target = e.target, $.ajax({
- type: "POST",
- crossDomain: !0,
- url: bhw_login_endpoint,
- data: {
- options: JSON.stringify({
- username: t,
- password: n
- })
- },
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success === !0 ? (sessionid = e.sessionid, userid = t, $.cookie("behavioId", userid, {
- expires: .5
- }), $.cookie("sessionId", sessionid, {
- expires: .5
- }), sendData("Login", sessionid, userid, "Transfer", loginCallback)) : bsAlert(e.message, $(target))
- }
- })
- }
- }
- function logout() {
- trainingComplete = "", $.cookie("trainingComplete", ""), $.ajax({
- type: "POST",
- url: bhw_logout_endpoint,
- data: {},
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success === !0 ? ($.cookie("behavioId", ""), $.cookie("sessionId", ""), $.cookie("trainingComplete", ""), bw.resetBehavioData(), bw.init(), checkUI()) : bsAlert(e.message, $("#dLogin"))
- }
- })
- }
- function transferValidate(e) {
- validateTransferFields() ? (sendData("Transfer", sessionid, userid, "Results", transferCallback), getProgress(checkUI)) : e.preventDefault()
- }
- function showTooltip(e, t) {
- $("#hpTooltip").remove(), $(e.target).append($('<div id="hpTooltip" class="tooltip">' + t + "</div>")), $("#hpTooltip").fadeIn()
- }
- function hideTooltip(e) {
- $("#hpTooltip").remove()
- }
- function sendData(e, t, n, a, o) {
- setMetaTag("bwjourid", t), setMetaTag("bwuuid", n), setMetaTag("bwsessid", t), setMetaTag("bwnotes", e), setMetaTag("bwpageid", a), bw.behavioData != [] && $("#behavioform").trigger("submit"), o();
- setTimeout(function() {
- bw.resetBehavioData(), $("input[type=text]").val(""), $("input[type=password]").val(""), bw.hasSent = !1
- }, 100)
- }
- function keyFilter(e, t) {
- "8" != e.keyCode && (4 == $(t).val().length || "#date-of-payment" === t && 7 == $(t).val().length || "#date-of-payment" !== t && 9 == $(t).val().length || 15 == $(t).val().length) && $(t).val($(t).val() + " ")
- }
- bhw_base = "http://demo.behaviosec.com:8080", bhw_collector_endpoint = bhw_base + "/BehavioWebAPI/GetAjaxAsync", bhw_login_endpoint = bhw_base + "/BehavioWebDemo/Login", bhw_register_endpoint = bhw_base + "/BehavioWebDemo/Register", bhw_logout_endpoint = bhw_base + "/BehavioWebDemo/Logout", bhw_getreportbyid_endpoint = bhw_base + "/BehavioWebAPI/GetReportById", bhw_soap_endpoint = bhw_base + "/BehavioWeb/BehavioWeb?wsdl", bhw_faq_endpoint = "http://behaviosec.com/faq.php?cat=demos-faq-web", bhw_behavio_hidden_name = "behavio_hidden", $(document).ready(function() {
- $(".closeWindowButton").click(function(e) {
- window.close()
- }), $(".btnFAQ").click(function(e) {
- faqToggle(e)
- }), $("#password-register").focus(function(e) {
- passwordRegisterFocus("#password-register")
- }), $("#btnViewInDashboard").click(function() {
- window.open("../dashboard.php?sessionid=" + encodeURIComponent(sessionid))
- }), $("#btnCreateAccount").click(function() {
- transition("#login", "#register")
- }), $("#btnCancelRegister").click(function() {
- transition("#register", "#login")
- }), $("#btnRegister").click(function(e) {
- register()
- }), $("#btnLogout").click(function() {
- logout()
- }), $("#lnkLogout").click(function() {
- logout()
- }), $("input").bind("cut copy paste", function(e) {
- e.preventDefault()
- }), $("textarea").bind("cut copy paste", function(e) {
- e.preventDefault()
- }), checkUI(), $("#dop-field").html((new Date).addDays(2).toISOString().slice(0, 10).replace(/-/g, " ")), $("#date-of-payment").attr("placeholder", (new Date).addDays(2).toISOString().slice(0, 10).replace(/-/g, " "))
- }), Date.prototype.addDays = function(e) {
- var t = (new Date).getTime() + 864e5 * e,
- n = new Date(t);
- return n
- };
- var Monitor = function() {
- this.init()
- };
- if (Monitor.prototype = {
- isOpera: !!window.opera || navigator.userAgent.indexOf(" OPR/") >= 0,
- isFirefox: "undefined" != typeof InstallTrigger,
- isSafari: Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0,
- isChrome: !!window.chrome && !this.isOpera,
- isIE9: /(MSIE 9.0)/g.test(navigator.userAgent),
- isIE10: navigator.userAgent.toString().toLowerCase().indexOf("trident/6") > -1,
- isIE11: !window.ActiveXObject && "ActiveXObject" in window,
- isIE: /(MSIE)/g.test(navigator.userAgent),
- isIOS: /(iPad|iPhone|iPod)/g.test(navigator.userAgent),
- navigating: !0,
- collectorEndpoint: bhw_collector_endpoint,
- metaNames: {
- journeyid: "bwjourid",
- userid: "bwuuid",
- sessionid: "bwsessid",
- notes: "bwnotes"
- },
- sendOnLoad: "",
- monitorElementIds: [],
- ignoreFieldIds: [],
- behavioData: [],
- anonMap: [],
- syncTimeout: 2e3,
- startTime: (new Date).getTime(),
- lastViewport: [-1, -1],
- lastTarget: null,
- capture: !0,
- hasSent: !1,
- behavio_hidden: null,
- haveMouse: !1,
- timings: null,
- behavioweb_config: {
- anonymous: {
- by_name: [],
- by_id: [],
- by_type: ["password"]
- }
- },
- init: function() {
- var e = setInterval(function() {
- "complete" === document.readyState && (bw.resetBehavioData(), bw.startMonitor(), this.initialized = !0, clearInterval(e))
- }, 100)
- },
- createCORSRequest: function(e, t, n) {
- n = !1;
- var a = new XMLHttpRequest;
- return "withCredentials" in a ? (a.open(e, t, n), bw.isIE && !n && (a.timeout = bw.syncTimeout), a.setRequestHeader("Content-Type", "text/plain")) : "undefined" != typeof XDomainRequest ? (a = new XDomainRequest, a.open(e, t, n), n || (a.timeout = bw.syncTimeout)) : a = "undefined" != typeof ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null, null !== a && "undefined" != typeof a.setRequestHeader && a.setRequestHeader("Content-Type", "text/plain"), a
- },
- prepHttpStr: function(e) {
- var t = "";
- return "" !== e.data.journeyid && "undefined" != typeof e.data.journeyid && (t += "journeyid=" + encodeURIComponent(e.data.journeyid)), "" !== e.data.sessionid && "undefined" != typeof e.data.sessionid && (t += "&sessionid=" + encodeURIComponent(e.data.sessionid)), "" !== e.data.userid && "undefined" != typeof e.data.userid && (t += "&userid=" + encodeURIComponent(e.data.userid)), t += "¬es=" + encodeURIComponent(e.data.notes), "undefined" != typeof e.data.behavioData && (t += "&data=" + encodeURIComponent(JSON.stringify(e.data.behavioData))), t
- },
- ajax: function(e) {
- {
- var t, n = bw.collectorEndpoint;
- e.type
- }
- t = e.async, t = bw.isChrome || bw.isOpera ? !0 : bw.isSafari ? !1 : bw.isIE9 || bw.isIE10 || bw.isIE11 ? !1 : bw.navigating ? !1 : !0;
- var a = bw.createCORSRequest("post", n, t);
- bw.httpStr = bw.prepHttpStr(e), bw.isIOS || bw.isIE11 || bw.isIE10 ? a.send(bw.httpStr) : setTimeout(function() {
- a.send(bw.httpStr)
- }, 0)
- },
- getMeta: function(e) {
- var t, n, a = "";
- if ("undefined" != typeof bw.metaNames[e])
- for (e = bw.metaNames[e], n = document.getElementsByTagName("meta"), t = 0; t < n.length; t++)(e === n[t].name || e === n[t].getAttribute("property")) && (a = n[t].content), bw.debug === !0 && "" === a && null !== document.getElementById(e) && (a = document.getElementById(e).value);
- return a
- },
- getBehavioData: function() {
- return "object" == typeof this.behavioData ? this.behavioData : !1
- },
- resetBehavioData: function() {
- for (;
- "object" == typeof this.behavioData.pop(););
- return !0
- },
- submitHandler: function(e) {
- if (bw.hasSent) return !0;
- bw.hasSent = !0, bw.navigating = !1;
- var t = {
- journeyid: bw.getMeta("journeyid"),
- sessionid: bw.getMeta("sessionid"),
- userid: bw.getMeta("userid"),
- notes: bw.getMeta("notes"),
- behavioData: bw.getBehavioData()
- };
- if (bw.isIE) {
- e.preventDefault && e.preventDefault();
- var n = e.target || e.srcElement;
- return e.returnValue = !1, setTimeout(function() {
- n.submit()
- }, 150), bw.ajax({
- type: "post",
- url: bw.collectorEndpoint,
- async: !0,
- data: t
- }), !1
- }
- bw.ajax({
- type: "post",
- url: bw.collectorEndpoint,
- async: !0,
- data: t
- })
- },
- addKeyEvent: function(e, t, n) {
- var a, o;
- for (a = this.behavioData.length - 1; a >= -1; a--) {
- if (-1 === a) {
- null === this.behavioData[0] ? (this.behavioData[0] = [], "a" === t ? this.behavioData[0][0] = "fa" : "n" === t && (this.behavioData[0][0] = "f"), this.behavioData[0][1] = e, this.behavioData[0][2] = [], this.behavioData[0][2][0] = n) : (o = this.behavioData.length, this.behavioData[o] = [], "a" === t ? this.behavioData[o][0] = "fa" : "n" === t && (this.behavioData[o][0] = "f"), this.behavioData[o][1] = e, this.behavioData[o][2] = [], this.behavioData[o][2][0] = n);
- break
- }
- if ("a" === t) {
- if ("fa" !== this.behavioData[a][0]) continue
- } else if ("n" === t && "f" !== this.behavioData[a][0]) continue;
- if (this.behavioData[a][1] === e) {
- this.behavioData[a][2][this.behavioData[a][2].length] = n;
- break
- }
- }
- },
- addEvent: function(e, t) {
- var n, a;
- for (n = this.behavioData.length - 1; n >= -1; n--) {
- if (-1 === n) {
- null === this.behavioData[0] ? (this.behavioData[0] = [], this.behavioData[0][0] = "c", this.behavioData[0][1] = [], this.behavioData[0][1][0] = e, this.behavioData[0][2] = window.location.pathname.split("?")[0]) : (a = this.behavioData.length, this.behavioData[a] = [], this.behavioData[a][0] = "c", this.behavioData[a][1] = [], this.behavioData[a][1][0] = e, this.behavioData[a][2] = window.location.pathname.split("?")[0]);
- break
- }
- if ("c" === this.behavioData[n][0]) {
- this.behavioData[n][1][this.behavioData[n][1].length] = e;
- break
- }
- }
- },
- getTimestamp: function() {
- var e = new Date;
- return e.getTime() - this.startTime
- },
- checkTarget: function(e) {
- var t = document.elementFromPoint(e.clientX, e.clientY),
- n = [];
- null !== t && t !== this.lastTarget && void 0 !== typeof t.parentNode && (n[0] = "t", n[1] = t.nodeName + "#" + t.id + "#" + t.parentNode.nodeName + "#" + t.parentNode.id, n[2] = bw.getTimestamp(), this.lastTarget = t, bw.addEvent(n))
- },
- checkViewport: function() {
- if (this.lastViewport[0] !== document.documentElement.clientWidth || this.lastViewport[1] !== document.documentElement.clientHeight) {
- var e = [];
- e[0] = "v", e[1] = document.documentElement.clientWidth, e[2] = document.documentElement.clientHeight, e[3] = bw.getTimestamp(), this.lastViewport[0] = document.documentElement.clientWidth, this.lastViewport[1] = document.documentElement.clientHeight, bw.addEvent(e)
- }
- },
- mouseMoveHandler: function(e) {
- var t = [];
- t[0] = "mm", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
- },
- mouseDownHandler: function(e) {
- var t = [];
- t[0] = "md", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), t[4] = e.button, bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
- },
- mouseUpHandler: function(e) {
- var t = [];
- t[0] = "mu", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), t[4] = e.button, bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
- },
- keyHandler: function(e) {
- var t, n = [],
- a = e.keyCode,
- o = a,
- i = null,
- s = e.currentTarget ? e.currentTarget : e.srcElement,
- r = "n",
- d = 0;
- if (i = s.type + "#" + s.name, null === a && (a = -500, o = -500), "a" !== r) {
- for (t = 0; t < bw.behavioweb_config.anonymous.by_id.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_id[t] === s.id && (r = "a");
- for (t = 0; t < bw.behavioweb_config.anonymous.by_name.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_name[t] === s.name && (r = "a");
- for (t = 0; t < bw.behavioweb_config.anonymous.by_type.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_type[t] === s.type && (r = "a")
- }
- if ("a" === r) {
- if (9 === a || 13 === a) return;
- if (document.selection) {
- s.focus();
- var c = document.selection.createRange(),
- l = document.selection.createRange().text.length;
- c.moveStart("character", -s.value.length), d = c.text.length - l
- } else(s.selectionStart || 0 === s.selectionStart) && (d = s.selectionStart);
- 8 === a ? "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = -1, n[1] = d) : "keyup" === e.type && (n[0] = -2, n[1] = bw.anonMap[a], bw.anonMap[a] = null) : 46 === a ? "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = -3, n[1] = d) : "keyup" === e.type && (n[0] = -4, n[1] = bw.anonMap[a], bw.anonMap[a] = null) : "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = 0, n[1] = d) : "keyup" === e.type && (n[0] = 1, n[1] = bw.anonMap[a], bw.anonMap[a] = null)
- } else "keyup" === e.type ? (n[0] = 1, n[1] = o) : "keydown" === e.type && (n[0] = 0, n[1] = o);
- n[2] = bw.getTimestamp(), null !== n[1] && bw.addKeyEvent(i, r, n)
- },
- startMonitor: function() {
- var e, t, n, a, o, i = document.getElementsByTagName("form");
- for (e = 0; e < i.length; e++) {
- for (n = i[e], "undefined" != typeof jQuery ? $("form").submit(bw.submitHandler) : n.addEventListener ? n.addEventListener("submit", bw.submitHandler, !1) : n.attachEvent && n.attachEvent("onsubmit", bw.submitHandler), a = n.getElementsByTagName("textarea"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)));
- for (a = n.getElementsByTagName("input"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)));
- for (a = n.getElementsByTagName("select"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)))
- }
- this.haveMouse === !0 && (document.addEventListener ? (document.addEventListener("mousedown", this.mouseDownHandler, !1), document.addEventListener("mouseup", this.mouseUpHandler, !1), document.addEventListener("mousemove", this.mouseMoveHandler, !1)) : document.attachEvent && (document.attachEvent("onmousedown", this.mouseDownHandler), document.attachEvent("onmouseup", this.mouseUpHandler), document.attachEvent("onmousemove", this.mouseMoveHandler)));
- var s = {};
- for (e in s) s[e] = s[e];
- delete s.plugins, delete s.mimeTypes;
- var r = {};
- for (e in r) r[e] = r[e];
- if (this._navigator = s, this._screen = r, this.behavioData[0] = ["m", "n", s], this.behavioData[1] = ["m", "s", r], this.behavioData[2] = ["m", "v", 250], "" !== bw.sendOnLoad && -1 !== window.location.pathname.split("?")[0].indexOf(bw.sendOnLoad)) {
- var d;
- d = {
- journeyid: bw.getMeta("journeyid"),
- sessionid: bw.getMeta("sessionid"),
- userid: bw.getMeta("userid"),
- notes: bw.getMeta("notes")
- }, bw.ajax({
- type: "post",
- url: bw.collectorEndpoint,
- async: !0,
- data: d
- })
- }
- }
- }, document.all && !document.querySelector);
- else var bw = new Monitor;
- "undefined" == typeof console && (console = {
- log: function() {},
- info: function() {},
- error: function() {},
- warn: function() {}
- }), Date.now = Date.now || function() {
- return +new Date
- }, Array.prototype.indexOf || (Array.prototype.indexOf = function(e, t) {
- var n, a;
- for (n = t || 0, a = this.length; a > n; n++)
- if (this[n] === e) return n;
- return -1
- });
- var sessionid, userid, target, sectionId = "#login";
- $(document).ready(function() {
- setTimeout(function() {
- bw.monitorElementIds = ["from-account", "to-account", "username", "password", "amount", "date-of-payment"], $("#btnLogin").click(function(e) {
- loginValidate(e)
- }), $("#btnTransfer").click(function(e) {
- transferValidate(e)
- }), $("#lnkLogout").click(function() {
- $("#results").hide(), $("#register").hide(), $("#transaction").hide(), $("#login").hide(), $("#login").fadeIn(300, function() {
- getProgress(checkUI)
- })
- }), $("#btnNewTransfer").click(function() {
- $.ajax({
- type: "POST",
- url: bhw_logout_endpoint,
- data: {},
- contentType: "text/plain",
- dataType: "json",
- success: function(e) {
- e.success === !0 ? (bw.resetBehavioData(), $.cookie("behavioId", ""), $.cookie("sessionId", ""), transition("#results", "#login")) : (bsAlert(e.message, $("#dLogin")), transition("#results", "#login"))
- }
- })
- }), $("#password").keydown(function(e) {
- return 13 === e.keyCode ? (loginValidate(e), !1) : void 0
- }), $("#date-of-payment").keydown(function(e) {
- return 13 === e.keyCode ? (transferValidate(e), !1) : void 0
- }), $("#from-account").keyup(function(e) {
- keyFilter(e, "#from-account")
- }), $("#to-account").keyup(function(e) {
- keyFilter(e, "#to-account")
- }), $("#date-of-payment").keyup(function(e) {
- keyFilter(e, "#date-of-payment")
- }), $("#behavioform").submit(function(e) {
- e.preventDefault()
- }), $(".navbar-item.disabled a").hover(function(e) {
- showTooltip(e, "This is a mock application, navigation disabled.")
- }, function(e) {
- hideTooltip(e)
- })
- }, 10)
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement