hosted/ifttt/home.js
2025-12-30 04:48:49 +00:00

75 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(() => {
const prefersReducedMotion =
typeof window !== "undefined" &&
window.matchMedia &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const stepEl = document.getElementById("howStep");
const detailEl = document.getElementById("howDetail");
if (!stepEl || !detailEl) return;
const steps = [
{
step: "1) You write the confidential document.",
detail: "Keep the source private. Dont publish it to “prove” it exists.",
},
{
step: "2) Your system produces an output.",
detail: "A summary, decision, report, message, or answer.",
},
{
step: "3) IF.Trace binds source → output.",
detail: "Hashes + trace id + proof links (so evidence can be checked later).",
},
{
step: "4) You share proof, not your raw data.",
detail: "Third parties verify without needing your accounts or logins.",
},
{
step: "5) If theres no trace, its not trustworthy.",
detail: "A simple rule that survives vendors, contractors, and audits.",
},
];
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function typeInto(el, text, opts = {}) {
const minDelayMs = opts.minDelayMs ?? 12;
const maxDelayMs = opts.maxDelayMs ?? 26;
el.textContent = "";
for (let idx = 0; idx < text.length; idx += 1) {
el.textContent += text[idx];
const jitter = Math.floor(Math.random() * (maxDelayMs - minDelayMs + 1));
await sleep(minDelayMs + jitter);
}
}
async function run() {
if (prefersReducedMotion) {
const first = steps[0];
stepEl.textContent = first.step;
detailEl.textContent = first.detail;
return;
}
let idx = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
const current = steps[idx % steps.length];
await typeInto(stepEl, current.step);
await sleep(120);
await typeInto(detailEl, current.detail, { minDelayMs: 8, maxDelayMs: 18 });
await sleep(2200);
stepEl.textContent = "";
detailEl.textContent = "";
await sleep(240);
idx += 1;
}
}
void run();
})();