Last active
August 29, 2015 14:16
-
-
Save lachezar/e01da654e2eb843bc097 to your computer and use it in GitHub Desktop.
Sans Bullshit Sans bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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);}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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