"I am now like 95% sure miki is some kind of witch."
"witch-king of finland"
Darth Culator and Xd1358[src]

Collection of useful JavaScript and CSS scripts. Most of these are not allowed in sitewide CSS/JS due to Fandom's customization policy.

Automatic theme switcher (JS)

This example is configured to set dark theme between 22:00 and 10:00 (user's local time) and light theme at other times. Option 'wiki' can be used instead of 'light' or 'dark' to set theme to wiki default.

mw.loader.using( 'mediawiki.api', function() {
	var d = new Date();
	var api = new mw.Api();
	if ( d.getHours() >= 22 || d.getHours() < 10 ) {
		api.saveOption( 'theme', 'dark' );
	} else {
		api.saveOption( 'theme', 'light' );
	}
} );

Oasis-style categories (JS)

Takes categories out of the hidden container, like in Oasis.

$( '.page-footer__categories' ).removeClass( 'wds-is-collapsed' ).css( 'padding-top', '18px' );
$( '.page-footer__categories .wds-collapsible-panel__header' ).remove();
$( '#articleCategories .special-categories-label' ).css( 'display', 'block' );

Open external links in the same tab (JS)

By default, all links using "external" syntax (including those leading to Wookieepedia) open in new tab. This changes that behavior.

$( 'a.external' ).removeAttr( 'target' );

Toggle references (JS)

Allows toggling the visibility of inline references via a button in "My Tools". Could be useful when you want to actually read articles and avoid distractions.

$( function() {
	var portletlink = $( '<li>' ).append( $( '<a>' ).attr( 'href', '#' ).text( 'Toggle references' ) );
	$( '#WikiaBarWrapper' ).find( '#my-tools-menu' ).prepend( portletlink );
	$( portletlink ).click( function(e) {
		e.preventDefault();
		$( 'sup.reference' ).toggle();
	} );
} );

Per-namespace right rail (JS)

Allows setting the initial visibility of right rail separately for different namespaces. Namespace numbers must be used to specify namespaces.

var railHiddenNs = [1, 2, 3]; // namespaces where right rail is hidden
if ( railHiddenNs.includes( mw.config.get( 'wgNamespaceNumber' ) ) ) {
	$( '.page__right-rail' ).addClass( 'is-rail-hidden' );
} else {
	$( '.page__right-rail' ).removeClass( 'is-rail-hidden' );
}

Restore old font (CSS)

Replace FandomDesktop's Rubik font with Helvetica/Arial used in Oasis. Or use an entirely different font by changing the value of font-family (quote marks need to be used for multi-word font names).

body.skin-fandomdesktop {
	font-family: helvetica,arial,sans-serif;
}

Auto-purge (JS)

Not by me, this was posted by Saftzie on ShoutWiki Hub. Removes the need to click the confirmation when purging pages.

/**
 * For action=purge to index.php
 *   change it to POST api.php
 *   then reload the page
 * Restores pre-1.28 behavior to MW 1.28+
 * Based on meta:User:Glaisher/autoPurge.js, 21 Aug 2016
 */
if (( mw.config.get( 'wgAction' ) === 'purge' ) &&
	( $.inArray( 'user', mw.config.get( 'wgUserGroups' )) + 1 )) {
	$.post( mw.config.get( 'wgScriptPath' ) + '/api.php', {
		format: 'none',
		action: 'purge',
		titles: mw.config.get( 'wgPageName' ).replace( /_/g, ' ' )
	}, function () {
		// remove action=purge, but keep the rest
		location.replace(
			location.pathname +
			location.search
				.replace( /(?:\?|&)action=purge$/i, '' )
				.replace( /(\?|&)action=purge&/i, '$1' ) +
			location.hash
		);
	} );
}