MediaWiki:Common.js: Difference between revisions

Content added Content deleted
mNo edit summary
m (make catlinks collapse hook adhere to emcascript 5)
Line 2: Line 2:


if (mw.config.get('skin') == 'timeless') {
if (mw.config.get('skin') == 'timeless') {
mw.hook('wikipage.categories').add((content) => {
mw.hook('wikipage.categories').add(function (content){
if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
content
content

Revision as of 20:34, 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(function (content){
		if (content[0].id == 'catlinks' && content[0].childElementCount > 0) {
			content
				.wrap('<details></details>')
				.closest('details')
				.prepend('<summary>Show full category list</summary>');
		}
	});
}