Community Central
Community Central

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:UCXSearchBar.js',
    ]
});

importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:CodeQuickLinks/code.js',
    ]
});

importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:ThemeToggler.js',
    ]
});

importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:MobilePreview.js',
    ]
});

importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:QuickBarPageTools.js',
    ]
});

if (mw.config.get('skin') === 'fandomdesktop') {
	var themeSheet1 = document.createElement('link'),
	    themeURL1 = '/wikia.php?controller=ThemeApi&method=themeVariables&variant=',
	    themeSheet2 = document.createElement('link'),
	    themeURL2 = '/load.php?fandomdesktop=1&lang=en&modules=' +
	    	'ext.fandom.DesignSystem.GlobalNavigation.brand.$1.css%7C' +
	    	'ext.fandom.DesignSystem.brand.$1.css' +
	    	'&only=styles&skin=fandomdesktop';
	
	switch (mw.config.get('wgServerName')) {
		// Wikis to switch to dark mode
		case 'dystopian-fiction.fandom.com':
			themeSheet1.rel = "stylesheet";
			themeSheet1.href = themeURL1 + 'dark';
			document.head.appendChild(themeSheet1);

			themeSheet2.rel = "stylesheet";
			themeSheet2.href = themeURL2.replace(/\$1/g, 'dark');
			document.head.appendChild(themeSheet2);

			document.body.classList.remove('theme-fandomdesktop-light');
			document.body.classList.add('theme-fandomdesktop-dark');
			mw.config.set('isDarkTheme', true);
			break;

		// Wikis to switch to light mode
		case '':	
			themeSheet1.rel = "stylesheet";
			themeSheet1.href = themeURL1 + 'light';
			document.head.appendChild(themeSheet1);

			themeSheet2.rel = "stylesheet";
			themeSheet2.href = themeURL2.replace(/\$1/g, 'light');
			document.head.appendChild(themeSheet2);

			document.body.classList.remove('theme-fandomdesktop-dark');
			document.body.classList.add('theme-fandomdesktop-light');
			mw.config.set('isDarkTheme', false);
			break;
	}
}
$('.wiki-tools .wds-button[data-tracking="recent-changes"][href]').each(function() {
    var clone = this.cloneNode(true);
    clone.href = mw.config.get('wgArticlePath').replace('$1', 'Special:NewFiles');
    clone.title = 'Image Activity';
    clone.setAttribute('data-tracking', 'new-files');
    clone.removeAttribute('accesskey');
    clone.innerHTML = '<svg class="wds-icon wds-icon-small">' +
        '<use xlink:href="#wds-icons-image-small"></use></svg>';
    this.insertAdjacentElement('afterend', clone);
});

if (!$('.wiki-tools .wds-button.wiki-tools__add-new-page').length) {
    $('.wiki-tools .wds-button[data-tracking="recent-changes"][href]').each(function() {
        var clone = this.cloneNode(true);
        clone.href = '#';
        clone.title = 'Add new page';
        clone.setAttribute('data-tracking', 'add-new-page');
        clone.removeAttribute('accesskey');
        clone.classList.add('wiki-tools__add-new-page');
        clone.innerHTML = '<svg class="wds-icon wds-icon-small">' +
            '<use xlink:href="#wds-icons-page-small"></use></svg>';
        this.insertAdjacentElement('afterend', clone);
    });
}