MediaWiki

ArticleOverviewScript.js: Difference between revisions

From Mark Twain in the German Language Press

mNo edit summary
mNo edit summary
 
(20 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();
$('td.type').each(function(index, element) {
if (tdContent === 'N\n') {
console.log($(element)).textContent;
$(this).addClass('n');
            if ($(element).textContent === 'N') $(element).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');
			}
        });
	}
});