MediaWiki:Common.js: Difference between revisions

Content added Content deleted
(Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: mw.hook('wikipage.categories').add((content) => { if (content[0].id == 'catlinks' && content[0].childElementCount > 0) { content .wrap('<details></details>') .closest('details') .prepend('<summary>Show full category list</summary>'); } });")
 
mNo edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */

mw.hook('wikipage.categories').add((content) => {
if (mw.config.get('skin') == 'timeless') {
if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
mw.hook('wikipage.categories').add((content) => {
content
if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
.wrap('<details></details>')
content
.closest('details')
.prepend('<summary>Show full category list</summary>');
.wrap('<details></details>')
.closest('details')
}
.prepend('<summary>Show full category list</summary>');
});
}
});
}

Revision as of 20:11, 23 February 2022

/* Any JavaScript here will be loaded for all users on every page load. */

if (mw.config.get('skin') == 'timeless') {
	mw.hook('wikipage.categories').add((content) => {
		if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
			content
				.wrap('<details></details>')
				.closest('details')
				.prepend('<summary>Show full category list</summary>');
		}
	});
}