User:Lenni009/global.js

window.AjaxUndoMinor = "0"; window.globalNavButtons = [ {		text: 'No Mans Sky', url: 'https://nomanssky.fandom.com/wiki/', isMain: true, whoIsMain: false, shortName: 'NMS' },	{		text: 'GHub', url: 'https://nomanssky.fandom.com/wiki/Galactic_Hub_Project', isMain: false, whoIsMain: 'NMS', shortName: 'GHub' },	{		text: 'EisHub', url: 'https://nomanssky.fandom.com/wiki/Galactic_Hub_Eissentam', isMain: false, whoIsMain: 'NMS', shortName: 'EisHub' },	{		text: 'No Mans Sky DE', url: 'https://nomanssky.fandom.com/de/wiki/', isMain: true, whoIsMain: false, shortName: 'NMS_DE' },	{		text: 'Letzte Änderungen', url: 'https://nomanssky.fandom.com/de/wiki/Spezial:Letzte_Änderungen', isMain: false, whoIsMain: 'NMS_DE', shortName: 'NMS_DE_RC' },	{		text: 'Patrol Panel', url: 'https://nomanssky.fandom.com/de/wiki/Spezial:PatrolPanel', isMain: false, whoIsMain: 'NMS_DE', shortName: 'NMS_DE_Patrol' },	{		text: 'Community', url: 'https://community.fandom.com/wiki/', isMain: true, whoIsMain: false, shortName: 'C'	}, {		text: 'Global.CSS', url: 'https://community.fandom.com/wiki/Special:MyPage/global.css', isMain: false, whoIsMain: 'C', shortName: 'CSS' },	{		text: 'Global.JS', url: 'https://community.fandom.com/wiki/Special:MyPage/global.js', isMain: false, whoIsMain: 'C', shortName: 'JS' },	{		text: 'MediaWiki', url: 'https://www.mediawiki.org/wiki/', isMain: true, whoIsMain: false, shortName: 'MW' },	{		text: 'Magic Words', url: 'https://www.mediawiki.org/wiki/Help:Magic_words', isMain: false, whoIsMain: 'MW', shortName: 'MW_MagicWords' },	{		text: 'ParserFunctions', url: 'https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions', isMain: false, whoIsMain: 'MW', shortName: 'MW_ParserFunctions' },	{		text: 'Templates', url: 'https://www.mediawiki.org/wiki/Help:Templates', isMain: false, whoIsMain: 'MW', shortName: 'MW_Templates' },	{		text: 'Tables', url: 'https://www.mediawiki.org/wiki/Help:Tables', isMain: false, whoIsMain: 'MW', shortName: 'MW_Tables' },	{		text: 'Formatting', url: 'https://www.mediawiki.org/wiki/Help:Formatting', isMain: false, whoIsMain: 'MW', shortName: 'MW_Formatting' }, ];

// Create the sub-namespace for this addon and set some options:

window.dev = window.dev || {}; window.dev.editSummaries = { select: [ '(click to browse)', '1.Minor Edit', [ 'Minor adjustments', 'Update to ', 'Spelling/Grammar', 'Syntax', 'Wording', 'Corrected link', 'Formatting', 'Test' /* etc. */ ],        '2. Created Page', [ 'Created' ],/* etc. */ '3. Translation', [ 'Übersetzt' ]/* etc. */ ] }; importArticles({	type: 'script',   	articles: [		'u:dev:MediaWiki:MassEdit/code.js',		'u:dev:MediaWiki:UCXSearchBar.js',        'u:dev:MediaWiki:MassNullEdit/code.js',		        'u:dev:MediaWiki:NullEditButton/code.js',	        'u:dev:MediaWiki:GlobalNavButtons.js',        'u:dev:MediaWiki:MobilePreview.js',              'u:dev:MediaWiki:PurgeButton.js',        'u:dev:MediaWiki:EditConflictAlert/code.js',               'u:dev:MediaWiki:AjaxUndo/code.js',          'u:dev:MediaWiki:Standard Edit Summary/code.js',                'u:dev:MediaWiki:CategoryQuickRemove.js',              'u:dev:MediaWiki:QuickDiff/code.js',        'u:dev:MediaWiki:EditIntroButton/code.js',        'u:dev:MediaWiki:RestoreRevButton.js',        'u:dev:MediaWiki:Stella.js', //        'u:dev:MediaWiki:DoruDev.js',        ] });

/* Scrolling functions */ $(function{	$("html").css("scroll-behavior", "smooth");	/* Add button to scroll back to top when sticky header is visible */	$("#WikiaBar").before(" ↑ ");	$(".nms-back-to-top").click(function{ document.getElementsByClassName("community-header-wrapper")[0].scrollIntoView; }); });

// Theme Swapper $(function {   $('.wiki-tools__theme-switch').replaceWith('  ');    $(".wiki-tools__theme-switch.custom").css("cursor", "pointer").click(function { var targetTheme = $("body").hasClass("theme-fandomdesktop-light") ? "dark" : "light";

$.when(           $.get(mw.util.wikiScript("wikia") + "?controller=ThemeApi&method=themeVariables&variant=" + targetTheme + "&cb=" + (new Date.getTime)),            $.get(mw.util.wikiScript("load") + "?modules=ext.fandom.DesignSystem.GlobalNavigation.brand." + targetTheme + ".css%7Cext.fandom.DesignSystem.brand." + targetTheme + ".css&only=styles")       ).done(function(wikiCss, brandCss) {            var combinedCss = wikiCss[0] + brandCss[0];            var $s = $("#theme-swapper")[0] || $(" ").attr("id", "theme-swapper").appendTo("body");            $($s).text(combinedCss);            $("body").removeClass("theme-fandomdesktop-light theme-fandomdesktop-dark").addClass("theme-fandomdesktop-" + targetTheme);        }); }); });

/** * @name           PageInfoLink * @version        v1.0 * @author         Lenni009 * @description    Adds a PageInfo global nav link. Original code modified from NavCodeLinks by Monochromatic Bunny. (function {    if (window.PageInfoLinksLoaded) {        return;    }    window.PageInfoLinksLoaded = true;    $('.wds-global-navigation__user-menu .wds-list, .wiki-tools .wds-dropdown__content .wds-list').append( ['css'].map(function(ext) {           return $('', { append: $('', {                   'href': mw.util.getUrl('Special:PageInfo/' + mw.config.get("wgPageName")),                    text: 'PageInfo'                }) });       })    ); });