Made quotes a teeny bit more consistent (sorry).

This commit is contained in:
00Fjongl 2024-07-08 02:16:10 -05:00
parent 2119885555
commit 81c08aa616
4 changed files with 26 additions and 26 deletions

View file

@ -6,8 +6,8 @@ export { insertText, paintSource, tryReadFile };
/* /*
// Try this instead of the .replace method. Might be more performant. // Try this instead of the .replace method. Might be more performant.
// Will edit str by replacing all matches of lis with newText. // Will edit str by replacing all matches of lis with newText.
// Usage: insertText(["<Example1>", "<Example2>"], // Usage: insertText(['<Example1>', '<Example2>'],
// "<Example1> Big Giant Paragraph <Example2> Smol Paragraph", // '<Example1> Big Giant Paragraph <Example2> Smol Paragraph',
// stringOrFunctionToGenerateNewText); // stringOrFunctionToGenerateNewText);
*/ */
const insertText = (lis, str, newText) => { const insertText = (lis, str, newText) => {
@ -20,7 +20,7 @@ const insertText = (lis, str, newText) => {
// Find all matches of a placeholder string and insert new text there. // Find all matches of a placeholder string and insert new text there.
while ((position = str.indexOf(placeholder)) >= 0) while ((position = str.indexOf(placeholder)) >= 0)
str = str.slice(0, position) str = str.slice(0, position)
+ (typeof newText == "function" ? newText() : newText) + (typeof newText == 'function' ? newText() : newText)
+ str.slice(position + placeholder.length); + str.slice(position + placeholder.length);
} }
return str; return str;
@ -33,7 +33,7 @@ const insertText = (lis, str, newText) => {
// changes with each time it is loaded. // changes with each time it is loaded.
const randomListItem = lis => () => lis[Math.random() * lis.length | 0], const randomListItem = lis => () => lis[Math.random() * lis.length | 0],
charset = ["&#173;", "&#8203;", "&shy;", "<wbr>"], charset = ['&#173;', '&#8203;', '&shy;', '<wbr>'],
getRandomChar = randomListItem(charRandom), getRandomChar = randomListItem(charRandom),
insertCharset = str => insertText( insertCharset = str => insertText(
charset, charset,
@ -43,14 +43,14 @@ insertCharset = str => insertText(
getRandomSplash = randomListItem(splashRandom), getRandomSplash = randomListItem(splashRandom),
hutaoInsert = str => insertText( hutaoInsert = str => insertText(
"<!--HUTAOWOA-->", '<!--HUTAOWOA-->',
str, str,
getRandomSplash getRandomSplash
), ),
getCookingText = () => `<span style="display:none" data-fact="${randomListItem(vegetables)()}">${randomListItem(cookingInserts)()}</span>`, getCookingText = () => `<span style="display:none" data-fact="${randomListItem(vegetables)()}">${randomListItem(cookingInserts)()}</span>`,
insertCooking = str => insertText( insertCooking = str => insertText(
"<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->", '<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->',
str, str,
getCookingText getCookingText
), ),
@ -66,7 +66,7 @@ cacheBusting = str => {
paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))), paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))),
// Grabs the text content of a file. // Grabs the text content of a file.
tryReadFile = file => existsSync(file) ? readFileSync(file, "utf8") : text404; tryReadFile = file => existsSync(file) ? readFileSync(file, 'utf8') : text404;
/* /*
// All of this is now old code. // All of this is now old code.

View file

@ -8,10 +8,10 @@ import helmet from 'helmet';
import http from 'http'; import http from 'http';
import createRammerhead from 'rammerhead/src/server/index.js'; import createRammerhead from 'rammerhead/src/server/index.js';
import { createBareServer } from '@tomphttp/bare-server-node'; import { createBareServer } from '@tomphttp/bare-server-node';
import wisp from "wisp-server-node"; import wisp from 'wisp-server-node';
import { epoxyPath } from "@mercuryworkshop/epoxy-transport"; import { epoxyPath } from '@mercuryworkshop/epoxy-transport';
import { baremuxPath } from "@mercuryworkshop/bare-mux/node"; import { baremuxPath } from '@mercuryworkshop/bare-mux/node';
import { uvPath } from "@titaniumnetwork-dev/ultraviolet"; import { uvPath } from '@titaniumnetwork-dev/ultraviolet';
const config = JSON.parse(await readFile(new URL('./config.json', import.meta.url))); const config = JSON.parse(await readFile(new URL('./config.json', import.meta.url)));
const { pages, text404 } = pkg; const { pages, text404 } = pkg;
@ -104,9 +104,9 @@ router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFi
app.use(router); app.use(router);
app.use(express.static(path.join(__dirname, 'views'))); app.use(express.static(path.join(__dirname, 'views')));
app.use("/uv/", express.static(uvPath)); app.use('/uv/', express.static(uvPath));
app.use("/epoxy/", express.static(epoxyPath)); app.use('/epoxy/', express.static(epoxyPath));
app.use("/baremux/", express.static(baremuxPath)); app.use('/baremux/', express.static(baremuxPath));
app.disable('x-powered-by'); app.disable('x-powered-by');

View file

@ -20,19 +20,19 @@ terms = tryReadFile(path.normalize(__dirname + '/views/pages/misc/deobf/tos.html
settings = tryReadFile(path.normalize(__dirname + '/views/pages/misc/deobf/settings.html')), settings = tryReadFile(path.normalize(__dirname + '/views/pages/misc/deobf/settings.html')),
loadTemplates = str => { loadTemplates = str => {
str = insertText("<!--HEADER-->", str, header); str = insertText('<!--HEADER-->', str, header);
str = insertText("<!--FOOTER-->", str, footer); str = insertText('<!--FOOTER-->', str, footer);
// Never used // Never used
// str = insertText("<!--DESC-->", str, description); // str = insertText('<!--DESC-->', str, description);
// Used only on docs.html // Used only on docs.html
str = insertText("<!--DOCS-->", str, documentation); str = insertText('<!--DOCS-->', str, documentation);
// Used only on faq.html // Used only on faq.html
str = insertText("<!--FAQ-->", str, faq); str = insertText('<!--FAQ-->', str, faq);
// Used only on terms.html // Used only on terms.html
str = insertText("<!--TOS-->", str, terms); str = insertText('<!--TOS-->', str, terms);
// Used only on csel.html // Used only on csel.html
str = insertText("<!--SETTINGS-->", str, settings); str = insertText('<!--SETTINGS-->', str, settings);
return str; return str;
}; };

View file

@ -45,15 +45,15 @@ pageIcon = value => {
// Make a small stylesheet to override a setting from the main stylesheet. // Make a small stylesheet to override a setting from the main stylesheet.
pageShowAds = () => { pageShowAds = () => {
let advertising = document.createElement('style'); let advertising = document.createElement("style");
advertising.id = "advertising"; advertising.id = "advertising";
advertising.innerText = `.ad { display:block; }`; advertising.innerText = ".ad { display:block; }";
document.appendChild.bind(document.head || document.body || document.documentElement || document)(advertising); document.appendChild.bind(document.head || document.body || document.documentElement || document)(advertising);
}, },
// Remove the stylesheet made by the function above, if it exists. // Remove the stylesheet made by the function above, if it exists.
pageHideAds = () => { pageHideAds = () => {
(document.getElementById('advertising')||new Text()).remove(); (document.getElementById("advertising")||new Text()).remove();
}; };
@ -65,7 +65,7 @@ readCookie("HBIcon").then(s => (s != undefined) && pageIcon(s));
readCookie("HBHideAds").then(s => (s != "false") ? pageHideAds() : pageShowAds((document.getElementById("hideads") || {}).checked = 0)); readCookie("HBHideAds").then(s => (s != "false") ? pageHideAds() : pageShowAds((document.getElementById("hideads") || {}).checked = 0));
// All code below is used by the Settings UI in the navigation bar. // All code below is used by the Settings UI in the navigation bar.
if (document.getElementById('csel')) { if (document.getElementById("csel")) {
// Allow users to set a custom title with the UI. // Allow users to set a custom title with the UI.
document.getElementById("titleform").addEventListener("submit", e => { document.getElementById("titleform").addEventListener("submit", e => {
@ -107,7 +107,7 @@ if (document.getElementById('csel')) {
// An iframe of the current page is inserted into the new tab. // An iframe of the current page is inserted into the new tab.
document.getElementById("cselab").addEventListener("click", () => { document.getElementById("cselab").addEventListener("click", () => {
let win = window.open(); let win = window.open();
let iframe = win.document.createElement('iframe'); let iframe = win.document.createElement("iframe");
iframe.style = "width: 100%; height: 100%; border: none; overflow: hidden; margin: 0; padding: 0; position: fixed; top: 0; left: 0"; iframe.style = "width: 100%; height: 100%; border: none; overflow: hidden; margin: 0; padding: 0; position: fixed; top: 0; left: 0";
iframe.src = location.href; iframe.src = location.href;
win.document.body.appendChild(iframe); win.document.body.appendChild(iframe);