document.getElementsByClassName && (function(){ var gists = document.getElementsByClassName('gist'); function embed(id, file, i, tag) { window['embed_gist_'+i] = function(gist) { var tmp = document.createElement('div'); tmp.innerHTML = gist.div; tag.parentNode.replaceChild(tmp.firstChild, tag); }; var url = 'https://gist.github.com/'+id+'.json?callback=embed_gist_'+i; if(file) { url += '&file='+file; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; document.head.appendChild(script); } if(gists.length) { var css = document.createElement('link'); css.rel = 'stylesheet'; css.href= 'https://gist.github.com/stylesheets/gist/embed.css'; document.head.appendChild(css); } for(var i=0; i