mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-22 17:16:19 -07:00
- 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
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
// 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 };
|
|
}());
|