Skip to content

Instantly share code, notes, and snippets.

@lachezar
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lachezar/e01da654e2eb843bc097 to your computer and use it in GitHub Desktop.
Save lachezar/e01da654e2eb843bc097 to your computer and use it in GitHub Desktop.
Sans Bullshit Sans bookmarklet
javascript:(function(fontUrl,font,style){if(location.protocol==='https:'){fontUrl='https://lucho-yankov.github.io/assets/fonts/SansBullshitSans.ttf'}else{fontUrl='http://dailyffs.com/sansbullshitsans/SansBullshitSans.ttf';}font='@font-face{font-family:SansBullshitSans;src:url('+fontUrl+');font-weight:normal}';style=document.createElement('style');style.innerHTML=font+'*{font-family:SansBullshitSans;font-feature-settings:\'liga\',\'dlig\';font-variant-ligatures:common-ligatures;}';document.head.appendChild(style);}());
// Browsers tend to save the urls with escaped entities (e.g. space character is escaped as %20), so you have to use plain ascii with no spaces in your JavaScript.
// This is why all local variables are defined as parameters of the anonymous function wrapper.
(function(fontUrl,font,style) {
// originally the font's url was inlined base64 string (70000+ characters :)), but later I have uploaded the ttf file on one of my hosts.
if (location.protocol === 'https:') {
// I hope I don't violate any T&A here :/
fontUrl = 'https://lucho-yankov.github.io/assets/fonts/SansBullshitSans.ttf';
} else {
fontUrl = 'http://dailyffs.com/sansbullshitsans/SansBullshitSans.ttf';
}
font = '@font-face { \
font-family: SansBullshitSans;\
src: url(' + fontUrl + ');\
font-weight:normal\
}';
style = document.createElement('style');
style.innerHTML = font + ' * {\
font-family: SansBullshitSans;\
font-feature-settings: "liga", "dlig";\
font-variant-ligatures:common-ligatures;\
}';
document.head.appendChild(style);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment