Skip to content

Instantly share code, notes, and snippets.

@lingo
Last active August 29, 2015 14:24
Show Gist options
  • Save lingo/11476ce245cb05aec543 to your computer and use it in GitHub Desktop.
Save lingo/11476ce245cb05aec543 to your computer and use it in GitHub Desktop.
Enable hover styles to display source template (requires patch to SSViewer)
/**
* This works with the patch here:
* https://gist.github.com/lingo/5fd432cfb70758907f85
*/
var style = document.createElement('style');
style.textContent =
'.sstemplate: hover {' +
' border: 2px solid red;' +
' position: relative;' +
'}' +
'.sstemplate: hover: after {' +
' content: attr(data - cachefile);' +
' display: block;' +
' position: absolute;' +
' top: 0;' +
' right: 0;' +
' background: rgba(255, 255, 255, 0.5);' +
' color: red;' +
' padding: 0.5em;' +
'}';
document.head.appendChild(style);
$('[data-cachefile]').addClass('sstemplate');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment