Skip to content

Instantly share code, notes, and snippets.

@pfgithub
Created September 15, 2020 01:00
Show Gist options
  • Save pfgithub/b03f5ea74a3a0c4d16286552608440af to your computer and use it in GitHub Desktop.
Save pfgithub/b03f5ea74a3a0c4d16286552608440af to your computer and use it in GitHub Desktop.
discord font switcher
{
window.buttonarea && window.buttonarea.remove();
const buttonarea = document.createElement("div");
window.buttonarea = buttonarea;
const ttl = document.querySelector("#app-mount > div.app-1q1i1E > div > div.layers-3iHuyZ.layers-3q14ss > div > div > nav > div.scroller-2TZvBN.none-2Eo-qx.scrollerBase-289Jih > div:nth-child(2)");
if(!ttl) alert("Uh oh! discord class hashes or app layout changed!");
ttl.appendChild(buttonarea);
const mkbtn = (txt, ffmly, onev) => {
const btn = document.createElement("button");
btn.textContent = txt;
btn.style.fontFamily = ffmly;
buttonarea.appendChild(btn);
btn.addEventListener("click", () => {
document.body.style.fontFamily = ffmly;
});
};
mkbtn("English", "Whitney");
mkbtn("toki-pona", "Linja Pona");
mkbtn("toki pona", "sitelen-pona");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment