Skip to content

Instantly share code, notes, and snippets.

@Benzi
Created August 24, 2015 19:56
Show Gist options
  • Select an option

  • Save Benzi/42f4c6f6afa0abeb605b to your computer and use it in GitHub Desktop.

Select an option

Save Benzi/42f4c6f6afa0abeb605b to your computer and use it in GitHub Desktop.
You can use this to inject CSS on a page. The example shows how to use a custom badge on plug.dj
// Edit the url to point to your custom badge
// Edit the data-cid to include your user ID
var css = '[data-cid^="3851534-"] .badge-box .bdg {background: url("https://ssl.benzi.io/code/qluster/images/badges/eyes.png")!important;}',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment