Last active
June 17, 2018 01:56
-
-
Save wareya/1cddf8627ff496b13d6ac906b8909f2f to your computer and use it in GitHub Desktop.
Google Fonts preview override (gs script)
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 Google Fonts preview override | |
| // @version 1 | |
| // @grant unsafeWindow | |
| // @include https://fonts.google.com/* | |
| // ==/UserScript== | |
| function overwrite(e, text) | |
| { | |
| e.innerText = text; | |
| unsafeWindow.angular.element(e.parentNode).controller('gfFontPreview').onFocusContentEditable(); | |
| } | |
| function overwrite_text() | |
| { | |
| for(let e of document.querySelectorAll("gf-content-editable.font-preview-text")) | |
| { | |
| let replacetext = | |
| //"When I jump down into the depths of the gorge, keep my dog from following."; | |
| "I know my nemesis. And so, judging by my age, I'm no match for him."; | |
| //"The quick brown fox jumps over the lazy dog."; | |
| if(e.innerText != replacetext && document.activeElement != e) | |
| { | |
| overwrite(e, replacetext); | |
| } | |
| } | |
| refresh_loop(); | |
| } | |
| function refresh_loop() | |
| { | |
| lookup_timer = setTimeout(overwrite_text, 125); | |
| } | |
| refresh_loop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment