Forked from harai/Font Changer for Kindle Cloud Reader
Last active
May 23, 2020 22:44
-
-
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)
This file contains hidden or 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 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/