-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathangular-gist.min.js
1 lines (1 loc) · 1.16 KB
/
angular-gist.min.js
1
angular.module("gist",[]),angular.module("gist").directive("gist",["$timeout",function(t){return{restrict:"E",replace:!0,template:"<div></div>",link:function(e,i,n){t(function(){var t=n.id,e=document.createElement("iframe");e.setAttribute("width","100%"),e.setAttribute("frameborder","0"),e.id="gist-"+t,i[0].appendChild(e);var s='<html><head><base target="_parent"><style>table{font-size:12px;}</style><style> @media (max-width: 600px) { body { margin: 0px } .gist { width: '+i[0].clientWidth+"px; } }</style></head><body onload=\"parent.document.getElementById('"+e.id+'\').style.height=document.body.scrollHeight + \'px\'"><script type="text/javascript">!function(){"use strict";window.retargetLinks=function(){ var gists=document.getElementsByClassName("gist");for(var i=0,links;i<gists.length;i++){links=gists[i].getElementsByTagName("a");for(var j=0;j<links.length;j++){ links[j].setAttribute("target","_blank");}}}}();</script><script type="text/javascript" src="https://gist.github.com/'+t+'.js" onload="retargetLinks()"></script></body></html>',r=e.document;e.contentDocument?r=e.contentDocument:e.contentWindow&&(r=e.contentWindow.document),r.open(),r.writeln(s),r.close()},0)}}}]);