Reformatting web pages with a bookmark

Sometimes I have a problem reading websites. The font is bad, or to small, etc. (Yes, I think I'm getting old).

So I wrote this little peice of javascript that I can click on to reformat a webpage.

It creates a javascript prompt asking what element you would like to apply the styles to. Usually choosing 'p' is pretty good.

It sets the font to Open Sans, with a weight of 300 and a size of 18px. Any of these can be changed of course by editing the source.

javascript:(function() {  
  var webFont = document.createElement('script');
  webFont.src = ('https:' == document.location.protocol ? 'https' : 'http') 
  webFont.type = 'text/javascript';
  webFont.async = true;

  WebFontConfig = {
    google: { 
      families: [ 'Open+Sans:300:latin,latin-ext' ] 

  var elem = document.querySelectorAll( prompt('Enter an element') );
  var i = 0;
  while(i < elem.length) {
    elem[i].style.fontWeight = 300; 
    elem[i].style.fontFamily = 'Open Sans'; 
    elem[i].style.fontSize = '18px';
  return true;

To use drag this link (Pretty Web) to your bookmarks bar.