Hash :
bd4e8d15
Author :
Date :
2012-07-23T18:54:30
(function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function r(e,t,n){var r=t.replace(/\s+/g,"").split(","),i=+e.getAttribute("data-line-offset")||0,s=getComputedStyle(e),o=parseFloat(s.lineHeight),u=e.firstChild;for(var a=0,f;f=r[a++];){f=f.split("-");var l=+f[0],c=+f[1]||l,h=document.createElement("div");h.className=(n||"")+" line-highlight";h.setAttribute("data-start",l);c>l&&h.setAttribute("data-end",c);h.style.height=(c-l+1)*o+"px";h.style.top=(l-i-1)*o+"px";e.insertBefore(h,u)}}function i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var n=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(!n||document.getElementById(t))return;var i=t.slice(0,t.lastIndexOf(".")),s=document.getElementById(i);if(!s)return;s.hasAttribute("data-line")||s.setAttribute("data-line","");r(s,n,"temporary ");document.querySelector(".temporary.line-highlight").scrollIntoView()}if(!window.Prism||!window.addEventListener||!window.getComputedStyle||!document.querySelectorAll)return;var t=crlf=/\r?\n|\r/g,n=/pre/i,s=0;Prism.hooks.add("after-highlight",function(t){clearTimeout(s);var o=n.test(t.element.nodeName)?t.element:n.test(t.element.parentNode.nodeName)?t.element.parentNode:null,u=o.getAttribute("data-line");if(!o||!u)return;e(".line-highlight",o).forEach(function(e){e.parentNode.removeChild(e)});r(o,u);s=setTimeout(i,1)});addEventListener("hashchange",i)})();