Skip to content

Instantly share code, notes, and snippets.

@TheLouisHong
Last active April 12, 2024 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheLouisHong/2aa48cdcb2131a83c0d7d0ee9f335677 to your computer and use it in GitHub Desktop.
Save TheLouisHong/2aa48cdcb2131a83c0d7d0ee9f335677 to your computer and use it in GitHub Desktop.
TamperMonkey - Oracle Docs Styler
// ==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:wght@100..800&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