User:Fisssion/global.js

// importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:QuickDiff/code.js',        'u:dev:MediaWiki:RevisionDelete.js',        'u:dev:MediaWiki:MultiUpload.js',        'u:dev:MediaWiki:View_Source/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:AjaxRedirect/code.js',        'u:dev:MediaWiki:Discussions Delete All/code.js',        'u:dev:MediaWiki:MassEdit/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',    ] });

$(document).ready(function {	(function copyPageWikitext { "use strict"; if (mw.config.get('wgIsArticle')) { $(".page-header__actions").prepend($(" ").addClass("wds-button wds-is-text page-header__action-button sourceCopy").html("📋")); $(".sourceCopy").click(function {				var pageTitle = location.pathname.split("/wiki/").pop;				$.getJSON(mw.util.wikiScript('api'), {format: 'json', action: 'query', prop: 'revisions', rvprop: 'content', rvlimit: 1, rvslots: '*', titles: pageTitle})				.then(function(content) { var pageName, pageWikitext; for ( pageName in content.query.pages ) { pageWikitext = content.query.pages[pageName].revisions[0].slots.main['*']; }					$("body").append($(" ").attr("id", "copyArea").html(pageWikitext)); var copyArea = document.getElementById("copyArea"); copyArea.select; copyArea.setSelectionRange(0, 99999); navigator.clipboard.writeText(copyArea.value); copyArea.remove; mw.notify("Successfully copied!"); })				.catch(function { mw.notify("API request failed."); });			});		}	});	(function addSandboxButton { "use strict"; $("li#global-navigation-user-signout + li + li + li").after("My Sandbox"); });	(function addChangeBlockButtons { "use strict"; const userGroups = mw.config.get("wgUserGroups").join(""); if (userGroups.match("sysop")) { const blockedUserList = $("tr.mw-changeslist-log-block > td[data-target-page]"); if (blockedUserList) { var data; var user; var appendTo; var users = []; for (var i = 0; i < blockedUserList.length; i++) { data = blockedUserList[i]; user = data.attributes["data-target-page"].value.split(":").pop; appendTo = $("tr.mw-changeslist-log-block[data-mw-logaction=\"block/block\"] > td[data-target-page] > a[href$=\"" + user + "\"] + span.mw-usertoollinks"); if (!users.includes(user)) { appendTo.append($(" ", { html: $("", {		                       html: "change block",		                        href: "/wiki/Special:Block/" + user,		                    }), }));		               appendTo.append($(" ", { html: $("", {		                       html: "unblock",		                        href: "/wiki/Special:Unblock/" + user,		                    }), }));		               users.push(user); }	           }	        }	    }	}); }); //