main.js 867 B

1234567891011121314151617
  1. (function(w){
  2. // conditionally load hightlight.js /w sunburst css from cdn
  3. var codes = document.getElementsByTagName('code');
  4. if (codes.length > 0) {
  5. console.log("We have code!");
  6. var css = document.createElement("link");
  7. css.setAttribute("rel", "stylesheet");
  8. css.setAttribute("type", "text/css");
  9. css.setAttribute("href", "https://d2xxklvztqk0jd.cloudfront.net/css/sunburst.js");
  10. document.getElementsByTagName("head")[0].appendChild(css);
  11. var js = document.createElement('script'); s.type = 'text/javascript';
  12. js.setAttribute("async", true);
  13. js.onload = function() { hljs.initHighlight(); };
  14. js.setAttribute("src", "https://d2xxklvztqk0jd.cloudfront.net/js/highlight.js");
  15. document.getElementsByTagName('script')[0].parentNode.insertBefore(js, t);
  16. }
  17. })(window);