Last active
January 5, 2023 19:59
-
-
Save JulianWebb/1e824daf605ce21ea7aea9410cc2a573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name HomeStuck Troll Accessiblity | |
// @namespace https://gist.github.com/JulianWebb | |
// @version 0.6 | |
// @author Pongles | |
// @description Modifies the Troll's text so that it can be read easier | |
// @icon https://www.homestuck.com/favicon.ico | |
// @match https://www.homestuck.com/story/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict' | |
console.log('Homestuck Troll Acessiblity running') | |
let lineCount = 0; | |
const formatting = (str) => { | |
str = str.replace(/(\w)([\w\s\'\"\,\;\.\?]+)/gm, (match, p1, p2, offset, stri) => { | |
return p1.toUpperCase() + p2; | |
}); | |
str = str.replace(/(\si\s)/g, " I "); | |
str = str.replace(/\<E/gi, "<3"); | |
return str; | |
} | |
let trolls = { | |
adiosToreador: { | |
color: "rgb(161, 80, 0)", | |
convert: function(str) { | |
return str.toLowerCase(); | |
} | |
}, | |
apocalypseArisen : { | |
color: "rgb(161, 0, 0)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
str = str.replace(/0/g, 'o'); | |
return str; | |
} | |
}, | |
arachnidsGrip : { | |
color: "rgb(0, 86, 130)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
// I believe this one will be the most tedious since she is so chaotic with it | |
let replacements = { | |
"f8ed" : "fated", | |
"ch8nge" : "change", | |
"8l8tant" : "blatant", | |
"sk8" : "skate", | |
"p8ste" : "paste", | |
"pl8y" : "play", | |
"g8mes" : "games", | |
"w8s" : "was", | |
"assh8le" : "asshole", | |
"idi8t" : "idiot", | |
"m8y8e" : "maybe", | |
"l8fe" : "life", | |
"h8gh" : "high", | |
"might8" : "mighty", | |
"an8" : "and", | |
"th8nk" : "think", | |
"gr8at" : "great", | |
"m8y88" : "maybe", | |
"c8uld" : "could", | |
"d8n\'t" : "don't", | |
"kn8w" : "know", | |
"do8ng" : "doing", | |
"b8d" : "bad", | |
"gr8" : "great", | |
"fin8" : "fine", | |
"ubbbbbbbbh" : "uggggggggh", | |
"qu8te" : "quite", | |
"d8dn\'t" : "didn't", | |
"w8rd" : "word", | |
"qu8ck" : "quick", | |
"usu8lly" : "usually", | |
"sne8k" : "sneak", | |
"th8t" : "that", | |
"stink8n" : "stinkin", | |
"littl8" : "little", | |
"th8r8" : "there", | |
"m8d" : "mad", | |
"st8pid" : "stupid", | |
"godd8mn" : "goddamn", | |
"fri8nd" : "friend", | |
"8nd" : "and", | |
"g8d" : "god", | |
"d8re" : "dare", | |
"mist8kes" : "mistakes", | |
"r8gret" : "regret", | |
"reserv8tions" : "reservations", | |
"ch8nging" : "changing", | |
"d8y" : "day", | |
"l8ttle" : "little", | |
"n8thin" : "nothin", | |
"f8ce" : "face", | |
"ag8in" : "again", | |
"t8rrible" : "terrible", | |
"t8ke" : "take", | |
"c8n\'t" : "can't", | |
"fre8king" : "freaking", | |
"aw8y" : "away", | |
"f8ck" : "fuck", | |
"los8r" : "loser", | |
"delusion8l" : "dislusional", | |
"path8tic" : "pathetic", | |
"congratul8" : "congratulate", | |
"g8me" : "game", | |
"tog8ther" : "together", | |
"le8ders" : "leaders", | |
"m8ke" : "make", | |
"wo8ldn\'t" : "wouldn't", | |
"f8r" : "for", | |
"everyth8ng" : "everything", | |
"infuri8ing" : "infuriating", | |
"s8mething" : "something", | |
"he8rt" : "heart", | |
"sup8r" : "super", | |
"op8n" : "open", | |
"p8nt" : "paint", | |
"em8tions" : "emotions", | |
"conversation": "conversation", | |
"consol8tion" : "consolation", | |
"s8ving" : "saving", | |
"decapit8" : "decapitate", | |
"dict8" : "dictate", | |
"cre8tive" : "creative", | |
"br8k" : "break", | |
"ultim8" : "ultimate", | |
"w8" : "wait", | |
"g8" : "gate", | |
"l8" : "late", | |
"tr8": "try", | |
"8n\'t" : "ain't", | |
"st8p" : "stop", | |
"th8" : "the", | |
"h8" : "hate", | |
} | |
Object.keys(replacements).forEach(replace => { | |
if (str.includes(replace)) { | |
let re = new RegExp(replace, 'gi'); | |
str = str.replace(re, replacements[replace]); | |
} | |
}) | |
str = str.replace(/8/g, 'b'); | |
return str; | |
} | |
}, | |
arsenicCatnip: { | |
color: "rgb(65, 102, 0)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
str = str.replace(/3/g, 'e'); | |
str = str.replace(/\:ee/g, ':33') | |
return str.toLowerCase(); | |
} | |
}, | |
caligulasAquarium : { | |
color: "rgb(106, 0, 106)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
str = str.replace(/vv/gi, 'v') | |
str = str.replace(/ww/gi, 'w') | |
return str; | |
} | |
}, | |
carcinoGeneticist: { | |
color: "rgb(98, 98, 98)", | |
convert: function(str) { | |
return str.toLowerCase(); | |
} | |
}, | |
centaursTesticle : { | |
color: "rgb(0, 0, 86)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
let replacements = { | |
"perfe%ion" : "perfection", | |
"predi%ion" : "prediction", | |
"una%eptable" : "unacceptable", | |
"distin%ion" : "distinction", | |
"%%ings" : "doublecrossings" | |
} | |
Object.keys(replacements).forEach(replace => { | |
if (str.includes(replace)) { | |
let re = new RegExp(replace, 'gi'); | |
str = str.replace(re, replacements[replace]); | |
} | |
}) | |
str = str.replace(/\%/g, "x"); | |
str = str.replace(/0/g, "o"); | |
str = str.replace(/1/g, 'l'); | |
return str; | |
} | |
}, | |
cuttlefishCuller : { | |
color: "rgb(119, 0, 60)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
str = str.replace(/\)\(/g, 'h'); | |
str = str.replace(/\-/g, ''); | |
return str; | |
} | |
}, | |
gallowsCalibrator: { | |
color: "rgb(0, 130, 130)", | |
convert: function(str) { | |
str = str.replace(/3/g, 'e'); | |
str = str.replace(/4/g, 'a'); | |
str = str.replace(/1/g, 'i'); | |
return str.toLowerCase(); | |
//Unfortunately, they use numbers as actual numbers sometimes. -_- | |
} | |
}, | |
grimAuxiliatrix : { | |
color: "rgb(0, 129, 65)", | |
convert: function(str) { | |
return str.toLowerCase(); | |
} | |
}, | |
terminallyCapricious: { | |
color: "rgb(43, 0, 87)", | |
convert: function(str) { | |
return str.toLowerCase(); | |
} | |
}, | |
twinAmageddons: { | |
color: "rgb(161, 161, 0)", | |
convert: function(str) { | |
str = str.toLowerCase(); | |
str = str.replace(/ii/g, 'i'); | |
str = str.replace(/2/g, 's'); | |
return str; | |
} | |
} | |
} | |
document.querySelectorAll(".o_chat-log > span").forEach(line => { | |
if (/\[\w+\]/gm.test(line.textContent)) return; //Don't want to affect the [XX] spans | |
if (!(/\s/gm.test(line.textContent))) return; | |
Object.entries(trolls).forEach((entry) => { | |
if (line.style.color == entry[1].color) { | |
let ident = line.textContent.match(/\w+\:/i)[0]; | |
let text = line.textContent.slice(ident.length) | |
line.title = line.textContent; | |
line.textContent = ident + " " + formatting(entry[1].convert(text)); | |
lineCount += 1; | |
} | |
}) | |
// He's not a troll, but damn if he ain't annoying | |
if (line.style.color == "rgb(255, 255, 255)") { line.style.color = "rgb(153, 153, 153)"; } | |
}) | |
console.log(`Converted ${lineCount} lines for ease of reading`); | |
// ¯\_(ツ)_/¯ It's not like a reader is just going to skip the pesterlogs, why do they start closed? | |
setTimeout(function() { | |
document.querySelector('.o_chat-log-btn').click(console.log('Log opened')) | |
}, 100) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment