JAVA… from time to time one needs to use it’s DOCs site (Java Platform Standard Edition Documentation). Man.. I hate JAVA… and the website design with its documentation is SO UGLY and thus inconvenient to use, I had to finally change that. Searched the internet for a quick solution on how to override CSS in a browser. Well.. Greasemonkey for Firefox has just removed the GM_addStyle (cool).
Quick and simple script for CSS style change and a sample url to visit: the String class description. I needed just a few temporary tweaks while examining the String structure, so it’s not a full site solution.
[code language=”javascript”]
// ==UserScript==
// @name JAVA DOCS STYLES CHANGE
// @version 1
// @include https://docs.oracle.com/javase/7/docs/*
// ==/UserScript==
// Function addGlobalStyle body taken probably
// from here: https://stackoverflow.com/questions/23683439/gm-addstyle-equivalent-in-tampermonkey
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName(‘head’)[0];
if (!head) { return; }
style = document.createElement(‘style’);
style.type = ‘text/css’;
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle ( `
a {font-weight:bold;
font-size:9pt;
color:#b33 !important;
font-family:Frank,Verdana,Tahoma}
td.colLast a {color:#b33 !important; }
td {padding-top:8pt !important; padding-bottom:8pt !important;}
pre,code {font-size:11pt !important;color:green}
` );
[/code]
Leave a Reply