Skip to content

Instantly share code, notes, and snippets.

@itzaks
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save itzaks/3ed3df7a875e06308cc7 to your computer and use it in GitHub Desktop.

Select an option

Save itzaks/3ed3df7a875e06308cc7 to your computer and use it in GitHub Desktop.
Simple bookmarklet for injecting readability styles straight into the page.
(function() {
function loadScript(a,b){
var c=document.createElement('script');
c.type='text/javascript';c.src=a;
var d=document.getElementsByTagName('head')[0],done=false;
c.onload=c.onreadystatechange=function(){
if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){
done=true;
b()
}
};
d.appendChild(c)
}
loadScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', function(){
$('body, p, td').css({
fontSize: '21px',
fontFamily: "'Sentinel SSm A', 'Sentinel SSm B', 'Palatino Linotype', 'Book Antiqua', Palatino, serif",
lineHeight: '36.3999977111816px'
});
$('body').css({
maxWidth: '750px', margin: '0 auto'
});
})
})();
/* Bookmarklet vvvvvv
javascript:(function() { function loadScript(a,b){ var c=document.createElement('script'); c.type='text/javascript';c.src=a; var d=document.getElementsByTagName('head')[0],done=false; c.onload=c.onreadystatechange=function(){ if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){ done=true; b() } }; d.appendChild(c) } loadScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', function(){ $('body, p, td').css({ fontSize: '21px', fontFamily: "'Sentinel SSm A', 'Sentinel SSm B', 'Palatino Linotype', 'Book Antiqua', Palatino, serif", lineHeight: '36.3999977111816px' }); $('body').css({ maxWidth: '750px', margin: '0 auto' }); }) })();
just copy paste ^^^^^^*/
@itzaks
Copy link
Author

itzaks commented Sep 15, 2014

Based on this: http://css-tricks.com/bookmarklet-colorize-text-45-75-characters-line-length-testing/
And some styles from readability.

When readability doesn't work, this can be a dirty fix for still applying some styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment