Last active 1 month ago

bolds the first third-ish of each word to make it easier to read for some reason. no i don't know why it works

Revision 40df814f09f3e95b7e4cb24675ed5760ef3a7c11

akgccfocusreader.user.js Raw
1// ==UserScript==
2// @name AKGCC Story Reader Tweaks
3// @namespace http://veryroundbird.house
4// @version 2026-10-08
5// @description some slight interface improvements for AKGCC story reader
6// @author Carly Smallbird
7// @match https://akgcc.github.io/story/
8// @icon https://www.google.com/s2/favicons?sz=64&domain=akgcc.github.io
9// @grant none
10// ==/UserScript==
11
12(function() {
13 'use strict';
14 let running = false;
15
16 window.addEventListener('load', (_e) => {
17 document.querySelector('head').innerHTML += `<meta name="viewport" content="width=device-width" />`;
18 });
19
20 const recurseHighlight = (node) => {
21 if (node.childNodes.length === 0) return;
22 if (node.childNodes.length === 1) {
23 const newstr = node.textContent.split(" ").map((w) => {
24 const length = w.length;
25 const third = Math.max(Math.floor(length / 3), 1);
26 return "<b>"+w.slice(0, third)+"</b>"+w.slice(third);
27 }).join(" ");
28 node.innerHTML = newstr;
29 return;
30 }
31 Array.from(node.childNodes).forEach((n) => {
32 recurseHighlight(n);
33 });
34 };
35
36 setInterval(() => {
37 if (!running) {
38 running = true;
39 if (document.querySelectorAll('.interactable-text:not(.dialog-name):not(.highlighted)')) {
40 document.querySelectorAll('.interactable-text:not(.dialog-name):not(.highlighted)').forEach((elt) => {
41 recurseHighlight(elt);
42 elt.classList.add('highlighted');
43 });
44 }
45 if (document.querySelectorAll('.scene:not(.indexed)')) {
46 document.querySelectorAll('.scene:not(.indexed)').forEach((elt, i) => {
47 elt.style.setProperty('--index', i+1);
48 elt.classList.add('indexed');
49 });
50 }
51 }
52 running = false;
53 }, 1000);
54})();