mirror of
https://github.com/skidoodle/pastebin
synced 2026-04-28 03:07:40 +02:00
fix linecount block
This commit is contained in:
+15
-17
@@ -33,25 +33,23 @@
|
||||
|
||||
hljs.highlightElement(code);
|
||||
|
||||
if (lineCount < 10000) {
|
||||
const lines = code.innerHTML.split(/\r?\n/);
|
||||
const fragment = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const num = i + 1;
|
||||
fragment.push('<div class="line" id="L' + num + '"><a href="#L' + num + '" class="line-number">' + num + '</a><div class="line-code">' + (lines[i] || ' ') + '</div></div>');
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
code.innerHTML = fragment.join('');
|
||||
code.classList.add('with-line-numbers');
|
||||
|
||||
if (window.location.hash) {
|
||||
const target = document.querySelector(window.location.hash);
|
||||
if (target) target.scrollIntoView();
|
||||
}
|
||||
});
|
||||
const lines = code.innerHTML.split(/\r?\n/);
|
||||
const fragment = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const num = i + 1;
|
||||
fragment.push('<div class="line" id="L' + num + '"><a href="#L' + num + '" class="line-number">' + num + '</a><div class="line-code">' + (lines[i] || ' ') + '</div></div>');
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
code.innerHTML = fragment.join('');
|
||||
code.classList.add('with-line-numbers');
|
||||
|
||||
if (window.location.hash) {
|
||||
const target = document.querySelector(window.location.hash);
|
||||
if (target) target.scrollIntoView();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'a') {
|
||||
if (e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'INPUT') {
|
||||
|
||||
Reference in New Issue
Block a user