feat(dictionary): add Hachidori backend support

- Add backend selection, setup gating, Anki integration, and external host support
- Add launcher flags, documentation, packaging, and focused tests
- Open on-demand overlay modals on the first attempt
This commit is contained in:
2026-09-22 00:21:19 -07:00
parent 1508863dbb
commit d9fdc7ef6d
446 changed files with 109060 additions and 244 deletions
+40
View File
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-3.0-or-later
(function () {
"use strict";
const backgrounds = [
{ file: "preview-background.webp" },
{ file: "preview-background-2.webp" },
{ file: "preview-background-3.webp" },
{ file: "preview-background-4.webp", dark: true },
{ file: "preview-background-5.webp" },
{ file: "preview-background-6.webp", dark: true },
];
function initialize(scene) {
let index = crypto.getRandomValues(new Uint32Array(1))[0] % backgrounds.length;
const show = () => {
const background = backgrounds[index];
scene.style.setProperty("--vn-background", `url("assets/${background.file}")`);
scene.classList.toggle("vn-dark-dialogue", background.dark === true);
};
const next = scene.ownerDocument.createElement("button");
next.type = "button";
next.className = "vn-next";
next.dataset.focusKey = "next-background";
next.title = "Next background";
next.setAttribute("aria-label", "Next background");
const icon = scene.ownerDocument.createElement("span");
icon.className = "hd-icon";
icon.dataset.icon = "arrow-right";
icon.setAttribute("aria-hidden", "true");
next.append(icon);
next.addEventListener("click", () => {
index = (index + 1) % backgrounds.length;
show();
});
show();
scene.append(next);
}
globalThis.HDVisualNovel = { initialize };
}());