From c366941dd0b786bc50f46fe6b10eb24a72a5371a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 30 Dec 2025 04:54:17 +0000 Subject: [PATCH] iftrace: wire homepage script --- ifttt/app.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ ifttt/home.js | 75 ------------------------------------------------ ifttt/index.html | 2 +- 3 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 ifttt/home.js diff --git a/ifttt/app.js b/ifttt/app.js index be007bb..8cf7069 100644 --- a/ifttt/app.js +++ b/ifttt/app.js @@ -1,4 +1,8 @@ (() => { + const howStepEl = document.getElementById("howStep"); + const howDetailEl = document.getElementById("howDetail"); + if (howStepEl && howDetailEl) startHowItWorks(howStepEl, howDetailEl); + const typewordEl = document.getElementById("typeword"); const stepperEl = document.getElementById("stepper"); const revealStepper = createStepperRevealer(stepperEl); @@ -12,6 +16,77 @@ if (quoteTextEl && quoteMetaEl && quoteWrapEl) startQuoteTicker({ quoteWrapEl, quoteTextEl, quoteMetaEl }); })(); +function startHowItWorks(stepEl, detailEl) { + const prefersReducedMotion = + typeof window !== "undefined" && + window.matchMedia && + window.matchMedia("(prefers-reduced-motion: reduce)").matches; + + const steps = [ + { + step: "1) You write the confidential document.", + detail: "Keep the source private. Don’t 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 there’s no trace, it’s not trustworthy.", + detail: "A simple rule that survives vendors, contractors, and audits.", + }, + ]; + + const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + + const typeInto = async (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); + } + }; + + const run = async () => { + 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(); +} + function createStepperRevealer(stepperEl) { let shown = false; return () => { diff --git a/ifttt/home.js b/ifttt/home.js deleted file mode 100644 index 77e3057..0000000 --- a/ifttt/home.js +++ /dev/null @@ -1,75 +0,0 @@ -(() => { - 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. Don’t 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 there’s no trace, it’s 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(); -})(); - diff --git a/ifttt/index.html b/ifttt/index.html index d729d02..c3066bb 100644 --- a/ifttt/index.html +++ b/ifttt/index.html @@ -64,6 +64,6 @@ contact - +