User:Williek11/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:Rollback/code.js',        'u:dev:MediaWiki:AnchoredRollback/code.js',        'u:dev:MediaWiki:UsefulDropdown/code.js',		'u:dev:MediaWiki:RemoveTracking.js',		'u:dev:MediaWiki:MassProtect/code.js',		'u:dev:MediaWiki:AjaxBatchDelete.js',		'u:dev:MediaWiki:MassRollback.js',    ] });

if (location.search.includes("action=edit")) { window.onbeforeunload = function{ return '' }; }

// navbar adjustments

(function{ const doc = document;

const upperNav = doc.createElement("div"); const ul = doc.createElement("ul"); upperNav.className = "upper-container";

$(".main-container")[0].appendChild(upperNav);

upperNav.appendChild(ul);

function addElement (node, id) { const li = doc.createElement("li"); li.id = id; li.appendChild(node); ul.appendChild(li); }

addElement($(".fandom-community-header__top-container")[0].children[2]); addElement($(".global-navigation__bottom")[0].children[1], "user-profile"); addElement($(".notifications")[0], "notifications");

$(".wiki-tools__theme-switch")[1].addEventListener("click", function {	new mw.Api.get({action:"query", meta:"tokens"}).done(function(e){ var change; if ($("body")[0].classList.contains("theme-fandomdesktop-dark")) { change = 'theme=light'; } else { change = 'theme=dark'; }		new mw.Api.post({	       action: 'options',	        format: 'json',	        change: change,	        token: e.query.tokens.csrftoken	    }).done(function(e){	    	if (e.options === "success") {	    		location.reload;	    	} else {	    		console.error(e);	    	}	    }); }); });

});