MediaWiki

ArticleOverviewScript.js: Difference between revisions

From Mark Twain in the German Language Press

mNo edit summary
mNo edit summary
 
(26 intermediate revisions by the same user not shown)
Line 2: Line 2:
const $target = $content.find( '#articleOverview' );
const $target = $content.find( '#articleOverview' );
if ( $target.length ) {
if ( $target.length ) {
var $table = $target;
$('.type').each(function(index) {
console.log('loading');
var tdContent = $(this).text();
var $typeData = $table.getElementsbyClassName('type');
if (tdContent === 'N\n') {
$typeData.forEach(td => {
$(this).addClass('n');
if (td.textContent.trim() === 'N') td.parentElement.style.color ='red';
}
});
        });
}
}
});
});

Latest revision as of 14:23, 11 August 2025

mw.hook( 'wikipage.content' ).add( ( $content ) => {
	const $target = $content.find( '#articleOverview' );
	if ( $target.length ) {
		$('.type').each(function(index) {
			var tdContent = $(this).text();
			if (tdContent === 'N\n') {
				$(this).addClass('n');
			}
        });
	}
});