MediaWiki:Common.js

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 16:44, 1 May 2024 by Adkuate (talk | contribs)
Jump to navigation Jump to search

CSS and Javascript changes must comply with the wiki design rules.


Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
/* global mw, $ */
/* jshint esversion: 10 */

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

/* Include in the wiki the following JavaScript pages */
// Sandbox
importScript('MediaWiki:Sandbox.js');
//importStylesheet('MediaWiki:Sandbox.css');

//importStylesheet('MediaWiki:Templates.css');
// importScript('MediaWiki:Countdown.js');
importScript('Widget:Rescue_Password_Generator/script.js');

/* a11y */
$('a.mw-wiki-logo').attr('title', 'Mystery Dungeon Franchise Wiki');

$('#main-mobile > a').removeAttr('title');
$('#talk-mobile > a').removeAttr('title');
$('#ca-tools > a').removeAttr('title');
$('#pt-logout > a').removeAttr('title');

$('#n- > a').removeAttr('href');

if ($(location).attr("href") === 'https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki') {
	$('#n-mainpage-description > a').removeAttr('href');
}
/* end a11y */

// https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization
/* Check if we're editing a page. */
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
	// Add a hook handler.
	mw.hook('wikiEditor.toolbarReady').add(function ($textarea) {
		// Configure a new toolbar entry on the given $textarea jQuery object.
		$textarea.wikiEditor('addToToolbar', {
			section: 'characters',
			pages: {
				gametitles: {
					layout: 'characters',
					label: 'Game Titles',
					characters: [
						'{{Shiren|Shiren the Wanderer 3 - The Sleeping Princess and the Karakuri Mansion}}',
						'{{Pkmn|Pokémon Mystery Dungeon: Red and Blue Rescue Team}}',
						'{{Pkmn|Pokémon Mystery Dungeon: Gates to Infinity}}',
						'{{Pkmn|Pokémon Super Mystery Dungeon}}',
						'{{Pkmn|Pokémon Mystery Dungeon: Rescue Team DX}}'
					]
				}
			}
		});
		
		$textarea.wikiEditor('addToToolbar', {
			section: 'characters',
			pages: {
				consolelogos: {
					layout: 'characters',
					label: 'Console Logos',
					characters: [
						'{{ConsoleLogo|Wii|small}}',
						'{{ConsoleLogo|3DS|small}}',
						'{{ConsoleLogo|DS|small}}',
						'{{ConsoleLogo|GBA|small}}',
						'{{ConsoleLogo|GB|small}}'
					]
				}
			}
		});
	});
}

/*
// Minify imported stylesheets and scripts
importArticles(
	{
		type: 'script',
		articles: [
			'MediaWiki:Sandbox.js',
			'Widget:Rescue_Password_Generator/script.js'
		]
	},
	{
		type: 'style',
		articles: [
			'Mediawiki:Sandbox.css',
			'Mediawiki:Templates.css'
		]
	}
);
*/