Skip to content

Instantly share code, notes, and snippets.

@josher19
Created October 10, 2012 09:37
Show Gist options
  • Save josher19/3864380 to your computer and use it in GitHub Desktop.
Save josher19/3864380 to your computer and use it in GitHub Desktop.
Get & Test Google Web Fonts and rotate through them by clicking on text. Chrome bookmarklet, requires jQuery.
(function() {
sel=document.getSelection()
// if (sel.focusNode) sel.focusNode.parentElement.style.fontFamily="'Poller One',sans-serif"
// function styling(ev) { sel.focusNode.parentElement.style.fontFamily="'Poller One',sans-serif"; }
// jQuery(document.body).bind('mouseup', styling, false);
function styling(ev) { sel.focusNode.parentElement.style.fontFamily= fontList[++styling.count % fontList.length] }
styling.count = 0; styling.fontList = fontList = ["Poller One", "Marck Script", "Ewert"];
styling.fontListCss = 'http://fonts.googleapis.com/css?family=' + styling.fontList.map(escape).join("|")
jQuery(document.body).append(jQuery("<link href='http://fonts.googleapis.com/css?family=Poller+One|Marck+Script|Ewert' rel='stylesheet' type='text/css' />"))
fontList.push("");
jQuery(document.body).unbind('mouseup').bind('mouseup', styling, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment