Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1213)

Side by Side Diff: lib/src/prism/plugins/line-highlight/prism-line-highlight.min.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 !function(){function e(e,t){return Array.prototype.slice.call((t||document).quer ySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replac e(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){for(var r,a=n.replace(/\s+/g,"" ).split(","),l=+e.getAttribute("data-line-offset")||0,o=parseFloat(getComputedSt yle(e).lineHeight),d=0;r=a[d++];){r=r.split("-");var c=+r[0],h=+r[1]||c,s=docume nt.createElement("div");s.textContent=Array(h-c+2).join(" \n"),s.className=(i||" ")+" line-highlight",t(e,"line-numbers")||(s.setAttribute("data-start",c),h>c&&s .setAttribute("data-end",h)),s.style.top=(c-l-1)*o+"px",t(e,"line-numbers")?e.ap pendChild(s):(e.querySelector("code")||e).appendChild(s)}}function i(){var t=loc ation.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentN ode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(i&&!document.g etElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),a=document.getElementById( r);a&&(a.hasAttribute("data-line")||a.setAttribute("data-line",""),n(a,i,"tempor ary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if (window.Prism){var r=(crlf=/\r?\n|\r/g,0);Prism.hooks.add("after-highlight",func tion(t){var a=t.element.parentNode,l=a&&a.getAttribute("data-line");a&&l&&/pre/i .test(a.nodeName)&&(clearTimeout(r),e(".line-highlight",a).forEach(function(e){e .parentNode.removeChild(e)}),n(a,l),r=setTimeout(i,1))}),addEventListener("hashc hange",i)}}(); 1 !function(){function e(e,t){return Array.prototype.slice.call((t||document).quer ySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replac e(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){for(var o,l=n.replace(/\s+/g,"" ).split(","),a=+e.getAttribute("data-line-offset")||0,d=r()?parseInt:parseFloat, c=d(getComputedStyle(e).lineHeight),s=0;o=l[s++];){o=o.split("-");var u=+o[0],m= +o[1]||u,h=document.createElement("div");h.textContent=Array(m-u+2).join(" \n"), h.className=(i||"")+" line-highlight",t(e,"line-numbers")||(h.setAttribute("data -start",u),m>u&&h.setAttribute("data-end",m)),h.style.top=(u-a-1)*c+"px",t(e,"li ne-numbers")?e.appendChild(h):(e.querySelector("code")||e).appendChild(h)}}funct ion i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(func tion(e){e.parentNode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1]; if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),o=documen t.getElementById(r);o&&(o.hasAttribute("data-line")||o.setAttribute("data-line", ""),n(o,i,"temporary "),document.querySelector(".temporary.line-highlight").scro llIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document. querySelector){var r=function(){var e;return function(){if("undefined"==typeof e ){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight ="1.5",t.style.padding=0,t.style.border=0,t.innerHTML="&nbsp;<br />&nbsp;",docum ent.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}retur n e}}(),o=0;Prism.hooks.add("complete",function(t){var r=t.element.parentNode,l= r&&r.getAttribute("data-line");r&&l&&/pre/i.test(r.nodeName)&&(clearTimeout(o),e (".line-highlight",r).forEach(function(e){e.parentNode.removeChild(e)}),n(r,l),o =setTimeout(i,1))}),addEventListener("hashchange",i)}}();
OLDNEW
« no previous file with comments | « lib/src/prism/plugins/line-highlight/prism-line-highlight.js ('k') | lib/src/prism/plugins/line-numbers/prism-line-numbers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698