Last active
April 12, 2024 07:40
-
-
Save TheLouisHong/2aa48cdcb2131a83c0d7d0ee9f335677 to your computer and use it in GitHub Desktop.
TamperMonkey - Oracle Docs Styler
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 Oracle Docs Styler | |
// @version 2024-04-03 | |
// @description Styles Oracle Docs | |
// @author Louis Hong | |
// @icon https://docs.oracle.com/favicon.ico | |
// @match *://docs.oracle.com/* | |
// @match *://google.github.io/*/api-docs/*/javadoc/* | |
// @grant GM_addStyle | |
// @grant GM_getResourceText | |
// @require https://code.jquery.com/jquery-3.7.1.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js | |
// @resource FONT_CSS https://fonts.googleapis.com/css2?family=Anek+Tamil:[email protected]&display=swap | |
// @resource HLJS_CSS https://raw.githubusercontent.com/highlightjs/highlight.js/main/src/styles/github.css | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let customCss = | |
` | |
body, .flex-box { | |
max-width: 1200px; | |
margin-inline: auto; | |
} | |
.block, p, ul, li, h2, div { | |
font-family: "Anek Tamil" !important; | |
font-optical-sizing: auto !important; | |
font-weight: 500 !important; | |
font-style: normal !important; | |
font-variation-settings: "wdth" 100 !important; | |
font-size: 20px !important; | |
} | |
.subTitle { | |
font-size: 20px !important; | |
} | |
h2 { | |
font-size: 32px !important; | |
font-style: unset !important; | |
} | |
h3 { | |
font-size: 28px !important; | |
font-style: unset !important; | |
margin-block-start: 2em !important; | |
margin-block-end: .5em !important; | |
} | |
code, dd, dt, pre { | |
font-size: 16px !important; | |
} | |
pre < code { | |
font-size: 16px !important; | |
} | |
a { | |
color: #0d548f !important; | |
} | |
`; | |
GM_addStyle(customCss); | |
GM_addStyle(GM_getResourceText("HLJS_CSS")); | |
GM_addStyle(GM_getResourceText("FONT_CSS")); | |
function onContentLoaded() { | |
document.querySelectorAll('pre').forEach((el) => { | |
hljs.highlightElement(el); | |
}); | |
document.querySelectorAll('.fixedNav').forEach((el) => { | |
el.classList.remove('fixedNav'); | |
}); | |
} | |
if (document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive") { | |
onContentLoaded(); | |
} else { | |
window.addEventListener("DOMContentLoaded", function() { | |
onContentLoaded(); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment