User:01miki10/global.js

window.nullEditDelay = 1500; window.qtUserPageTemplate = ''; window.qtEnableUserPageOverwrite = true; mw.loader.getScript( 'https://dev.fandom.com/load.php?mode=articles&articles=MediaWiki:WhatLinksHere/code.js|MediaWiki:MassNullEdit/code.js|MediaWiki:NullEditButton/code.js|MediaWiki:NoImageLightbox/code.js|MediaWiki:QuickCreateUserPage/code.js|MediaWiki:ThemeSelector.js&only=scripts' ).then( function {	window.ThemeSelector.hideBuiltIn = true;	var d = new Date;	var api = new mw.Api;	if ( d.getHours >= 22 || d.getHours < 10 ) {		api.saveOption( 'theme', 'dark' );		window.ThemeSelector.defaultTheme = 'dark';	} else {		api.saveOption( 'theme', 'wiki' );		window.ThemeSelector.defaultTheme = 'wiki';	} } );

/* Show categories like they used to be */ $( '.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' );

/* Reverse order of global navigation and notifications/profile */ $( '.global-navigation__bottom' ).insertBefore( $( '.global-navigation__top' ) ); $( '.global-navigation__bottom .wds-dropdown__content' ).css( {'top':'46px', 'bottom':'auto'} ); mw.loader.using( 'mediawiki.util', function {	mw.util.addCSS( '.global-navigation__bottom {position:unset;}' );	mw.util.addCSS( '.global-navigation .notifications .wds-dropdown.is-attached-to-bottom::before {top:36px; bottom:auto;}' );	mw.util.addCSS( '.global-navigation .notifications .wds-dropdown.is-attached-to-bottom::after {top:36px; bottom:auto;}' ); } );

/* change interface to content language */ /*mw.loader.using( ['mediawiki.api', 'user.options'], function {	var lang = mw.config.get( 'wgContentLanguage' );	if ( lang !== mw.user.options.get( 'language' ) ) {		var api = new mw.Api;		api.saveOption( 'language', lang ).then( console.log( 'Interface language set to ' + lang ) );	} } );*/

/** * 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 );	} ); }

/* Open images in original format when clicking thumbnail */ if ( mw.config.get( 'wgCanonicalNamespace' ) == 'File' ) { $( '#file a' ).attr( 'href', function( a, b ) {		return b + '&format=original';	} ); }