-
-
Save dimitriye98/2600188a418a729e371d to your computer and use it in GitHub Desktop.
marginalize.js: Intended to be a bookmarklet that gives unstyled pages margins and a somewhat more readable font.
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
#!/bin/sh | |
# If you have OS X and have UglifyJS installed, this uglifies Marginalize and | |
# puts the `javascript:` URL into the clipbord. Hoorah! | |
uglifyjs -c -m -o marginalize.min.js marginalize.js | |
printf 'javascript:' | cat - marginalize.min.js | pbcopy |
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
// Do you hate those pages that have no (or poor) styling attached to them and | |
// therefore use use up the entire width of your monitor, and choose an awful | |
// sans-serif font for reading on the screen? No? Is that just me? Well. | |
// This little piece of JavaScript **Marginalizes** the content, giving it a | |
// tight, readable margin, and better font for reading on an LCD screen. | |
// | |
// Written by eddieantonio. | |
// | |
(function() { | |
var style = document.getElementById('marginalizer'); | |
if (style === null) { | |
var css; | |
// Here's the style sheet! | |
css = 'body.marginalized {' + | |
'margin: auto;' + | |
'max-width: 50%;' + | |
'font-family: "Helvetica Neue", Helvetica, sans-serif;' + | |
'}'; | |
// Create a new style element. | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.id = 'marginalizer' | |
// And place dat CSS in there. | |
style.appendChild(document.createTextNode(css)); | |
// Now add that child block to the head! AW YEAH. | |
document.getElementsByTagName('head')[0].appendChild(style); | |
} | |
document.body.classList.toggle('marginalized') | |
}()); |
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
!function(){var e=document.getElementById("marginalizer");if(null===e){var a;a='body.marginalized {margin: auto;max-width: 540px;font-family: "Helvetica Neue", Helvetica, sans-serif;}',e=document.createElement("style"),e.type="text/css",e.id="marginalizer",e.appendChild(document.createTextNode(a)),document.getElementsByTagName("head")[0].appendChild(e)}document.body.classList.toggle("marginalized")}(); |
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
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8' /> | |
<title>Page</title> | |
</head> | |
<body> | |
<h1> Hello, I'm a title! </h1> | |
<p>It's like a bowtie-wearing fuddy-duddy from 1997 made this attrocity. | |
<p><i>Marginalize</i> it, and it gets better! | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment