Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jcc10/36c46557a9a964cf1433aefc78471b76 to your computer and use it in GitHub Desktop.
Save jcc10/36c46557a9a964cf1433aefc78471b76 to your computer and use it in GitHub Desktop.
A Greasemonkey script which changes the font family of Kindle Cloud Reader to sans forgetica (Font must be installed locally)
// ==UserScript==
// @name Font Changer for Kindle Cloud Reader
// @namespace https://github.com/jcc10/
// @include https://read.amazon.com/
// @run-at document-start
// @version 2
// ==/UserScript==
const fonts = `"sans forgetica"`;
async function main() {
while(true){
try{
let reader = document.getElementById("KindleReaderIFrame").contentDocument;
for(let frame of reader.getElementsByTagName("iframe")) {
let doc = frame.contentDocument;
if(doc.getElementById("fontChangerElement")){
continue;
}
var s = doc.createElement("style");
s.type = "text/css";
s.textContent = `* { font-family: ${fonts} !important; }`;
s.id = "fontChangerElement";
doc.head.appendChild(s);
}
} catch(e){
null;
}
await wait(1000);
}
}
function wait(duration) {
return new Promise((res) => {
setInterval(res, duration);
});
}
main();
@jcc10
Copy link
Author

jcc10 commented May 23, 2020

I couldn't find any CDNs for sans forgetica, so you have to install it locally.

You can also change the font up at the top.

https://sansforgetica.rmit/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment