Skip to content

Instantly share code, notes, and snippets.

@Piterden
Created February 29, 2020 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Piterden/646bf18a9f9615f0fae703699814a3c1 to your computer and use it in GitHub Desktop.
Save Piterden/646bf18a9f9615f0fae703699814a3c1 to your computer and use it in GitHub Desktop.
Not null implementation
var onloadCallback = function() {
grecaptcha.render("g-recaptcha", {
sitekey: "6Le2hsIUAAAAAGb1mcRlZ-W1Tdc0atbw002G5UUL",
theme: "light",
callback: "checkReCapture",
"expired-callback": "expiredReCapture"
})
};
function checkReCapture() {
return "" != grecaptcha.getResponse() ? ($("#recaptchaError").text(""),
$('[name="recapture-response"]').attr("checked", "checked"),
!0) : ($("#shadow-popup").css("display", "none"),
$('[name="recapture-response"]').removeAttr("checked"),
$("#recaptchaError").text("Необходимо пройти проверку на то что Вы не являетесь роботом"),
!1)
}
function expiredReCapture() {
$('[name="recapture-response"]').removeAttr("checked")
}
!function() {
$(":input").inputmask();
for (var e = document.getElementsByClassName("js-form"), t = 0; t < e.length; t++)
e[t].onsubmit = function(e) {
showNotice(e);
for (var t = this.elements, a = {
fields: [],
utm: {
campaign: "",
content: "",
medium: "",
sourse: "",
term: "",
keyword: ""
}
}, r = 0; r < t.length; r++) {
var n = t[r].type;
t[r].name;
"checkbox" !== n && "submit" !== n && "button" !== n && "file" !== n && a.fields.push({
name: t[r].name,
value: t[r].value
})
}
var c = document.location
, s = c.origin
, o = c.pathname
, i = c.search;
if (a.site = s,
a.url = o,
0 !== i.length)
for (var u = (i = i.substr(1, i.length)).split("&"), p = 0; p < u.length; p++) {
var h = u[p].split("=")
, l = h[0].split("_")[1];
a.utm[l] = h[1]
}
var d = new XMLHttpRequest;
d.withCredentials = !0,
d.open("POST", "http://84.201.174.225:9696/save", !0),
d.setRequestHeader("Content-type", "application/json; charset=utf-8"),
d.send(JSON.stringify(a)),
d.onreadystatechange = function() {
4 === this.readyState && 200 === this.statusCode && yaCounter42716749.reachGoal(this.querySelector("[data-uid]").getAttribute("data-uid"))
}
}
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment