refactor: use map/get

isekai-main
Barış Soner Uşaklı 1 year ago
parent 6d27f77894
commit 98c3d2e96d

@ -225,10 +225,8 @@ define('forum/topic', [
setTimeout(() => btn.find('i').removeClass('fa-check').addClass('fa-copy'), 2000); setTimeout(() => btn.find('i').removeClass('fa-check').addClass('fa-copy'), 2000);
const codeEl = btn.parent().find('code'); const codeEl = btn.parent().find('code');
if (codeEl.attr('data-lines')) { if (codeEl.attr('data-lines')) {
let codeText = ''; return codeEl.find('.hljs-ln-code[data-line-number]')
codeEl.find('.hljs-ln-code[data-line-number]') .map((i, e) => e.textContent).get().join('\n');
.each((index, el) => { codeText += $(el).text() + '\n'; });
return codeText;
} }
return codeEl.text(); return codeEl.text();
}, },

Loading…
Cancel
Save