MediaWiki:Common.js: Difference between revisions

From Auranogi
No edit summary
No edit summary
Line 12: Line 12:
// Remove generated subcategories if page has a CategoryTree
// Remove generated subcategories if page has a CategoryTree
setTimeout(() => {
setTimeout(function() {
const cat = document.querySelector('.CategoryTreeTag');
const cat = document.querySelector('.CategoryTreeTag');
console.log('Checking to remove gened subcats', cat);
console.log('Checking to remove gened subcats', cat);
if (cat) document.querySelector('#mw-subcategories').remove();
if (cat) document.querySelector('#mw-subcategories').remove();
}, 10);
}, 10);


}());
}());

Revision as of 20:11, 25 August 2023

/* Any JavaScript here will be loaded for all users on every page load. */
function importPage(name, type) {
	return mw.loader.load( '/index.php?title=' + name + '&action=raw&ctype=' + type, type );
}

function importScript(name) { return importPage(name, 'text/javascript'); }

importScript('MediaWiki:DynamicNav.js');

$(function () {
	// document.querySelector('.CategoryTreeSection [href="/view/Category:Dungeon_Variants"').parentElement.parentElement.remove();
	
	// Remove generated subcategories if page has a CategoryTree
	setTimeout(function() {
		const cat = document.querySelector('.CategoryTreeTag');
		console.log('Checking to remove gened subcats', cat);
		if (cat) document.querySelector('#mw-subcategories').remove();	
	}, 10);

}());