summaryrefslogtreecommitdiffstats
path: root/public/trail.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/trail.js')
-rw-r--r--public/trail.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/public/trail.js b/public/trail.js
new file mode 100644
index 0000000..6cafc7d
--- /dev/null
+++ b/public/trail.js
@@ -0,0 +1,56 @@
+let mouseText = `char *
+auth_mkvalue(char *value)
+{
+ char *big, *p;
+
+ big = malloc(strlen(value) * 4 + 1);
+ if (big == NULL)
+ return (NULL);
+
+ for (p = big; *value; ++value) {
+ switch (*value) {
+ case '\r':
+ *p++ = '\\';
+`;
+
+const textUrl = "https://raw.githubusercontent.com/openbsd/src/refs/heads/master/lib/libc/gen/authenticate.c";
+
+fetch(textUrl).then(body => {
+ body.text().then(text => {
+ mouseText = text.substring(text.indexOf("#include")).replaceAll(/\s+/g, " ");
+ });
+});
+
+const grid = document.getElementById("chars");
+const minDistance = 4;
+const disappearTime = 2000;
+let curChar = 0;
+let lastX = 0;
+let lastY = 0;
+
+window.addEventListener("mousemove", (event) => {
+ const x = event.pageX;
+ const y = event.pageY;
+ const diffX = Math.abs(lastX-x);
+ const diffY = Math.abs(lastY-y);
+ const distance = Math.sqrt(diffX*2+diffY*2);
+ if (distance < minDistance) {
+ return;
+ }
+ lastY = y;
+ lastX = x;
+ placeText(x+"px",y+"px", "e");
+});
+
+function placeText(x, y) {
+ const char = mouseText[curChar++ % mouseText.length];
+ const el = document.createElement("div");
+ el.className = "chr";
+ el.style.left = x;
+ el.style.top = y;
+ el.innerText = char;
+ window.setTimeout(() => {
+ el.remove();
+ }, 2000);
+ grid.appendChild(el);
+}