diff options
Diffstat (limited to 'interface/js/lib/linenumbers.min.js')
-rw-r--r-- | interface/js/lib/linenumbers.min.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/interface/js/lib/linenumbers.min.js b/interface/js/lib/linenumbers.min.js new file mode 100644 index 000000000..1b8312009 --- /dev/null +++ b/interface/js/lib/linenumbers.min.js @@ -0,0 +1,5 @@ +/*! + * CodeJar 3.1.0 helper: lineNumbers (https://github.com/antonmedv/codejar) + * Copyright (c) 2020, Anton Medvedev, MIT + */ +function withLineNumbers(e,t={}){const o=Object.assign({class:"codejar-linenumbers",wrapClass:"codejar-wrap",width:"35px",backgroundColor:"rgba(128, 128, 128, 0.15)",color:""},t);let l;return function(t){e(t),l||(l=init(t,o));const n=(t.textContent||"").replace(/\n+$/,"\n").split("\n").length+1;let s="";for(let e=1;e<n;e++)s+=`${e}\n`;l.innerText=s}}function init(e,t){const o=getComputedStyle(e),l=document.createElement("div");l.className=t.wrapClass,l.style.position="relative";const n=document.createElement("div");return n.className=t.class,l.appendChild(n),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.bottom="0px",n.style.width=t.width,n.style.overflow="hidden",n.style.backgroundColor=t.backgroundColor,n.style.color=t.color||o.color,n.style.setProperty("mix-blend-mode","difference"),n.style.fontFamily=o.fontFamily,n.style.fontSize=o.fontSize,n.style.lineHeight=o.lineHeight,n.style.paddingTop=o.paddingTop,n.style.paddingLeft=o.paddingLeft,n.style.borderTopLeftRadius=o.borderTopLeftRadius,n.style.borderBottomLeftRadius=o.borderBottomLeftRadius,e.style.paddingLeft=`calc(${t.width} + ${n.style.paddingLeft})`,e.style.whiteSpace="pre",e.parentNode.insertBefore(l,e),l.appendChild(e),n}
\ No newline at end of file |