Get rid of highlightjs-line-numbers.js

This commit is contained in:
andreimarcu 2016-06-15 01:17:25 -07:00
parent d6755486b2
commit 0a361a268c
4 changed files with 38 additions and 5 deletions

View file

@ -0,0 +1,28 @@
#normal-code {
border-left: 1px solid #ccc;
margin-left: 36px;
position: relative;
}
#normal-code code {
counter-reset: linenumbers;
}
#normal-code code div:before {
content: counter(linenumbers);
counter-increment: linenumbers;
left: -36px;
width: 28px;
position: absolute;
text-align: right;
padding-right: 5px;
color: #999;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

View file

@ -2,6 +2,14 @@
hljs.tabReplace = ' ';
hljs.initHighlightingOnLoad();
hljs.initLineNumbersOnLoad();
var codeb = document.getElementById("codeb");
var lines = codeb.innerHTML.split("\n");
codeb.innerHTML = "";
for (var i = 0; i < lines.length; i++) {
var div = document.createElement("div");
div.innerHTML = lines[i] + "\n";
codeb.appendChild(div);
};
// @license-end

View file

@ -1,3 +0,0 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
!function(e){"use strict";function t(){e.addEventListener("load",function(){try{var e=document.querySelectorAll("code.hljs");for(var t in e)e.hasOwnProperty(t)&&n(e[t])}catch(r){console.error("LineNumbers error: ",r)}})}function n(e){if("object"==typeof e){var t=e.parentNode,n=r(t.textContent);if(n>1){for(var o="",l=0;n>l;l++)o+=l+1+"\n";var c=document.createElement("code");c.className="hljs hljs-line-numbers",c.style["float"]="left",c.textContent=o,t.insertBefore(c,e)}}}function r(e){if(0===e.length)return 0;var t=/\r\n|\r|\n/g,n=e.match(t);return n=n?n.length:0,e[e.length-1].match(t)||(n+=1),n}"undefined"==typeof e.hljs?console.error("highlight.js not detected!"):(e.hljs.initLineNumbersOnLoad=t,e.hljs.lineNumbersBlock=n)}(window);
// @license-end

View file

@ -2,6 +2,7 @@
{% block head %}
<link href="{{ sitepath }}static/css/highlight/tomorrow.css" rel="stylesheet" type="text/css">
<link href="{{ sitepath }}static/css/highlight/lines.css" rel="stylesheet" type="text/css">
{% endblock %}
{% block innercontentmore %} class="scrollable"{% endblock %}
@ -44,7 +45,6 @@
{% if extra.lang_hl != "text" %}
<script src="{{ sitepath }}static/js/highlight/highlight.pack.js"></script>
<script src="{{ sitepath }}static/js/highlight/highlightjs-line-numbers.min.js"></script>
<script src="{{ sitepath }}static/js/bin_hljs.js"></script>
{% endif %}