fix linecount block

This commit is contained in:
2026-04-27 00:23:43 +02:00
parent d465b7f386
commit 65dd4388b1
+15 -17
View File
@@ -33,25 +33,23 @@
hljs.highlightElement(code); hljs.highlightElement(code);
if (lineCount < 10000) { const lines = code.innerHTML.split(/\r?\n/);
const lines = code.innerHTML.split(/\r?\n/); const fragment = [];
const fragment = []; for (let i = 0; i < lines.length; i++) {
for (let i = 0; i < lines.length; i++) { const num = i + 1;
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>');
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();
}
});
} }
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) => { document.addEventListener('keydown', (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'a') { if ((e.ctrlKey || e.metaKey) && e.key === 'a') {
if (e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'INPUT') { if (e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'INPUT') {