mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-17 05:20:01 -04:00
Made quotes a teeny bit more consistent (sorry).
This commit is contained in:
parent
2119885555
commit
81c08aa616
4 changed files with 26 additions and 26 deletions
|
@ -6,8 +6,8 @@ export { insertText, paintSource, tryReadFile };
|
|||
/*
|
||||
// Try this instead of the .replace method. Might be more performant.
|
||||
// Will edit str by replacing all matches of lis with newText.
|
||||
// Usage: insertText(["<Example1>", "<Example2>"],
|
||||
// "<Example1> Big Giant Paragraph <Example2> Smol Paragraph",
|
||||
// Usage: insertText(['<Example1>', '<Example2>'],
|
||||
// '<Example1> Big Giant Paragraph <Example2> Smol Paragraph',
|
||||
// stringOrFunctionToGenerateNewText);
|
||||
*/
|
||||
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.
|
||||
while ((position = str.indexOf(placeholder)) >= 0)
|
||||
str = str.slice(0, position)
|
||||
+ (typeof newText == "function" ? newText() : newText)
|
||||
+ (typeof newText == 'function' ? newText() : newText)
|
||||
+ str.slice(position + placeholder.length);
|
||||
}
|
||||
return str;
|
||||
|
@ -33,7 +33,7 @@ const insertText = (lis, str, newText) => {
|
|||
// changes with each time it is loaded.
|
||||
const randomListItem = lis => () => lis[Math.random() * lis.length | 0],
|
||||
|
||||
charset = ["­", "​", "­", "<wbr>"],
|
||||
charset = ['­', '​', '­', '<wbr>'],
|
||||
getRandomChar = randomListItem(charRandom),
|
||||
insertCharset = str => insertText(
|
||||
charset,
|
||||
|
@ -43,14 +43,14 @@ insertCharset = str => insertText(
|
|||
|
||||
getRandomSplash = randomListItem(splashRandom),
|
||||
hutaoInsert = str => insertText(
|
||||
"<!--HUTAOWOA-->",
|
||||
'<!--HUTAOWOA-->',
|
||||
str,
|
||||
getRandomSplash
|
||||
),
|
||||
|
||||
getCookingText = () => `<span style="display:none" data-fact="${randomListItem(vegetables)()}">${randomListItem(cookingInserts)()}</span>`,
|
||||
insertCooking = str => insertText(
|
||||
"<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->",
|
||||
'<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->',
|
||||
str,
|
||||
getCookingText
|
||||
),
|
||||
|
@ -66,7 +66,7 @@ cacheBusting = str => {
|
|||
paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))),
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue