Skip to content

Instantly share code, notes, and snippets.

@sikofitt
Created May 12, 2016 16:42
Show Gist options
  • Save sikofitt/f7c5aaaa9cbb44e48f80d11215716258 to your computer and use it in GitHub Desktop.
Save sikofitt/f7c5aaaa9cbb44e48f80d11215716258 to your computer and use it in GitHub Desktop.
Reformat a page with javascript using a bookmark.
javascript:(function() {
var webFont = document.createElement('script');
webFont.src = ('https:' == document.location.protocol ? 'https' : 'http')
+'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
webFont.type = 'text/javascript';
webFont.async = true;
document.querySelector('body').appendChild(webFont);
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';
i++;
}
return true;
}).call();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment