Skip to content

Instantly share code, notes, and snippets.

@fabianneve
Last active October 20, 2017 13:08
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 fabianneve/e769ab3d611230e930068c7a96a28a38 to your computer and use it in GitHub Desktop.
Save fabianneve/e769ab3d611230e930068c7a96a28a38 to your computer and use it in GitHub Desktop.
If SharePoint hides the Script Code of a Gist, use this script
document._write = document.write;
document.write = function(str){
if (str.indexOf('<div id=\"gist-') != 0) {
if(str.indexOf('https://gist.github.com/stylesheets/gist/embed.css') == -1) {
// if you got this far it's not a github document.write call
document._write(str);
}
return;
}
var id = /<div id=\"gist-(\d+)/.exec(str)[1];
var script = document.querySelector('script[src="https://gist.github.com/' + id + '.js"]');
var div = document.createElement('div');
div.innerHTML = str;
script.parentNode.insertBefore(div, script.nextElementSibling);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment