Files
JIANT/web/manual/sw.js
T
Claude ee17c8f48b Interactive manual: a tutorial mode, on by default, in six languages
The manual now opens as a guided walk through the whole of JIANT on the
drawn FM-1: 13 chapters, 86 steps (welcome, the panel, a first sound,
the six navigation rules, GEN, engines and EDIT, the sequencer, EUCLID
and MUTATE, mix / FX / punch-in, modulation, saving and the song, the
MENU and connections, where to go next). Each step lights the controls
to touch (the next one pulsing) and shows the firmware's own screen;
touching them in order completes the step. Chapters, 14 common
questions that jump to the right step, progress kept per browser, and
Free explore for the manual as before (?tour=off).

- tour.js: the steps; tour.<lang>.js: the words in es en pt fr ja zh,
  plus the page's own words for pt fr ja zh (the reference data stays
  es / en; other languages read it in English)
- manual.js: six languages, the tutorial's card, marks and touches
- make_site.py / sw.js: the tutorial's files and screens published
- test_manual.mjs: every step in every language, targets and keycaps
  real controls, questions land, the tour in Chromium

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVqsRnSaTrKHw7sg8JxeN6
2026-11-06 12:05:52 +00:00

20 lines
1.4 KiB
JavaScript

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
// The manual offline: its page, scripts and screens cached (network first for the page and scripts, so a new version
// shows at once; cache first for the screens). Only the manual's own folder; the emulator needs the network.
const CACHE = "jiant-manual-v62";
const CORE = ["./", "index.html", "manual.js", "data.js", "nav.js", "tour.js", "tour.es.js", "tour.en.js", "tour.pt.js", "tour.fr.js", "tour.ja.js", "tour.zh.js"];
self.addEventListener("install", (e) => { e.waitUntil(caches.open(CACHE).then((c) => c.addAll(CORE)).then(() => self.skipWaiting())); });
self.addEventListener("activate", (e) => {
e.waitUntil(caches.keys().then((ks) => Promise.all(ks.filter((k) => k !== CACHE).map((k) => caches.delete(k)))).then(() => self.clients.claim()));
});
self.addEventListener("fetch", (e) => {
const u = new URL(e.request.url);
if (e.request.method !== "GET" || u.origin !== location.origin || !u.pathname.startsWith(new URL("./", location).pathname)) return;
const put = (r) => { if (r.ok) { const c = r.clone(); caches.open(CACHE).then((x) => x.put(e.request, c)); } return r; };
if (u.pathname.includes("/shots/"))
e.respondWith(caches.match(e.request).then((m) => m || fetch(e.request).then(put)));
else
e.respondWith(fetch(e.request).then(put).catch(() => caches.match(e.request)));
});