User:MTOnline69/global.js

/* * Add line numbers to `.mw-highlight-lines` where length exceeds 100 kB */ mw.hook('wikipage.content').add(function ($content) {	$('.mw-highlight.mw-highlight-lines pre').each(function (_, pre) { if ($('span', pre).length) return; var text = $(pre).text.trim; if (text.length <= 102400) return; $(pre).empty.append(text.split('\n').map(function (line, i) { var n = i + 1; return $(' ', { id: 'L-' + n }).append([				$('', { href: '#L-' + n }).append( $(' ', { class: 'linenos', 'data-line': n }) ),				line + '\n'			]); }));	}); });