Last active
August 29, 2015 14:27
-
-
Save anna-hope/17363540ef45390c99b1 to your computer and use it in GitHub Desktop.
make Illinois law database website readable
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 Readable ILGA | |
// @namespace http://ostensible.me | |
// @version 0.1 | |
// @description make ILGA.gov readable | |
// @author Anton Osten | |
// @match http://*.ilga.gov/* | |
// @grant none | |
// ==/UserScript== | |
// change the font to charter, increase its size, and increase lineheight | |
var code_elements = document.getElementsByTagName('code'); | |
for (var i = code_elements.length - 1; i >= 0; i--) | |
{ | |
var item = code_elements[i]; | |
var first_child = item.firstElementChild; | |
if (first_child !== null && first_child !== undefined) | |
{ | |
var child_html = first_child.innerHTML; | |
item.innerHTML = child_html; | |
item.style.fontFamily = "Charter"; | |
item.style.lineHeight = 2; | |
// if it's a section, make it bold | |
if (child_html.indexOf('Sec.') > -1) | |
{ | |
item.style.fontSize = 24; | |
item.style.fontWeight = "bold"; | |
// make the next piece of text after the section bold, too | |
var j = i + 1; | |
// sometimes the next section is empty | |
var next_item = code_elements[j]; | |
while (next_item.innerHTML.trim() == "") | |
{ | |
j++; | |
next_item = code_elements[j]; | |
} | |
next_item.style.fontWeight = "bold"; | |
next_item.style.fontSize = 25; | |
} | |
else | |
{ | |
item.style.fontSize = 18; | |
} | |
} | |
}; | |
// kill the side menus | |
var sidemenus = document.getElementsByClassName('sidemenu'); | |
for (var i = sidemenus.length - 1; i >= 0; i--) | |
{ | |
var this_sidemenu = sidemenus[i]; | |
this_sidemenu.remove(); | |
} | |
// increase table width | |
var table_elements = document.getElementsByTagName('table'); | |
for (var i = table_elements.length - 1; i >= 0; i--) | |
{ | |
var item = table_elements[i]; | |
if (item.style.width != "100%") | |
{ | |
item.style.width = "90%"; | |
item.style.marginLeft = "5vw"; | |
item.style.marginRight = "5vw"; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment