This script/stylesheet is for PERSONAL use only!
You are free to install this script/stylesheet for yourself, but it is not allowed to be used wiki-wide (e.g., in MediaWiki:ImportJS, MediaWiki:Common.js, MediaWiki:Common.css, MediaWiki:Fandomdesktop.js, MediaWiki:Fandomdesktop.css, or MediaWiki:FandomMobile.css), as it would violate Fandom's Terms of Use.
(See the customization policy)
GlobalNavButtons replaces the default global navigation buttons (such as Explore, Fan Central, and Current/Recent Wikis, etc) with your own custom buttons, including dropdowns.
Configuration
Before adding the import, you need to configure your own buttons. Add your custom buttons above your import script. Each button consists of 5 items in an object, in an array.
- text
- The text that displays on the button.
- url
- The URL of the button (if empty, leave '' empty, but still include it.). If you want to link to a page locally on the wiki, use
mw.util.getUrl(). - isMain
- If the button is the main element in a dropdown. Enter true if it is, else enter false.
- whoIsMain
- If the button is a child of the dropdown, enter the shortName of the main element. Otherwise, enter false.
- shortName
- A short name used in elements to customize buttons and create dropdowns.
- icon
- An 18x18px icon shown in top-level buttons.
- hasBackground
- If the icon should have a background (defaults to true)
Here's an example of one stand-alone button, one dropdown menu with a link, and a link inside of that dropdown menu.
window.globalNavButtons = [
{
text: 'SOAP',
url: 'https://soap.fandom.com/wiki/',
isMain: false,
whoIsMain: false,
shortName: 'SOAP'
},
{
text: 'Community',
url: 'https://community.fandom.com/wiki/',
isMain: true,
whoIsMain: false,
shortName: 'C'
},
{
text: 'Adopt',
url: 'https://community.fandom.com/wiki/Adoption:Requests',
isMain: false,
whoIsMain: 'C',
shortName: 'Adopt'
}
];
Here's an example of a stand-alone button, dropdown menu and a link within that dropdown menu that is locked to particular usergroups.
window.globalNavButtons = [];
if (mw.config.get('wgUserGroups').includes('sysop')) {
window.globalNavButtons.push(
{
text: 'Recent Changes',
url: mw.util.getUrl('Special:RecentChanges'),
isMain: false,
whoIsMain: false,
shortName: 'RC',
},
{
text: 'Staff',
url: '',
isMain: true,
whoIsMain: false,
shortName: 'Staff',
},
{
text: 'Theme Designer',
url: mw.util.getUrl('Special:ThemeDesigner'),
isMain: false,
whoIsMain: 'Staff',
shortName: 'TD'
}
);
}
Installation