MediaWiki

ArticleOverviewScript.js: Difference between revisions

From Mark Twain in the German Language Press

mNo edit summary
mNo edit summary
 
(5 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 ) {
console.log('loading');
$('.type').each(function(index) {
$('.type').each(function(index) {
var tdContent = $(this).text();
var tdContent = $(this).innerText;
if (tdContent === 'N\n') {
console.log(tdContent);
$(this).addClass('n');
if (tdContent === 'N') {
console.log($(this).parentElement.innerText);
console.log($(this).tagName);
$(this).addClass('highlight');
}
}
           
         });
         });
       
/*$('td.type').each(function(index, element) {
console.log($(element).innerText);
console.log($(element).parentElement.innerText);
            if ($(element).innerText === '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');
			}
        });
	}
});