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 d5982691e482d3d6c70e4ce58e3bd7b26218449f

akgccfocusreader.user.js Raw
1// ==UserScript==
2// @name AKGCC Story Reader Focus Text
3// @namespace http://veryroundbird.house
4// @version 2026-10-08
5// @description try to take over the world!
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 console.log(node.childNodes.length);
22 if (node.childNodes.length === 0) return;
23 if (node.childNodes.length === 1) {
24 const newstr = node.textContent.split(" ").map((w) => {
25 const length = w.length;
26 const third = Math.max(Math.floor(length / 3), 1);
27 return "<b>"+w.slice(0, third)+"</b>"+w.slice(third);
28 }).join(" ");
29 node.innerHTML = newstr;
30 console.log(node);
31 return;
32 }
33 Array.from(node.childNodes).forEach((n) => {
34 recurseHighlight(n);
35 });
36 };
37
38 setInterval(() => {
39 if (!running && document.querySelectorAll('.interactable-text:not(.dialog-name):not(.highlighted)')) {
40 running = true;
41 document.querySelectorAll('.interactable-text:not(.dialog-name):not(.highlighted)').forEach((elt) => {
42 recurseHighlight(elt);
43 elt.classList.add('highlighted');
44 });
45 running = false;
46 }
47 }, 1000);
48})();