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',    ] });

(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, titles: pageTitle}) .then(function(content) {				var pageName, pageWikitext;				for ( pageName in content.query.pages ) {					pageWikitext = content.query.pages[pageName].revisions[0]['*'];				}				$("body").append($(" ").attr("id", "copyArea").html(pageWikitext));				var copyArea = document.getElementById("copyArea");				copyArea.select;				copyArea.setSelectionRange(0, 99999);				document.execCommand("copy");				copyArea.remove;				mw.notify("Successfully copied!");			}) .catch(function {				mw.notify("API request failed.");			}); });	} });

(function addSandboxButton {	$("li#global-navigation-user-signout + li + li + li").after("My Sandbox"); });

/*(function addChangeBlockButton {   "use strict";    if (window.addChangeBlockButtonsLoaded) {return}    window.addChangeBlockButtonsLoaded = true;    const userGroups = mw.config.get("wgUserGroups").join("");

if (userGroups.match("sysop")) { let i = 2; let blockedUsers = []; while (true) { let blockedUser = $(`tr.mw-changeslist-log-block:nth-child(${i}) > td[data-target-page]`)?.attr("data-target-page");

if (!blockedUser) { break; }

blockedUser = blockedUser.split(":").pop; if (!blockedUsers.includes(blockedUser)) { $(`tr.mw-changeslist-log-block[data-mw-logaction="block/block"] > td[data-target-page] > a[href$="${blockedUser}"] + span.mw-usertoollinks`).append($(" ", { html: $("", {                   html: "change block",                    href: `/wiki/Special:Block/${blockedUser}`,                }), }));           $(`tr.mw-changeslist-log-block[data-mw-logaction="block/block"] > td[data-target-page] > a[href$="${blockedUser}"] + span.mw-usertoollinks`).append($(" ", { html: $("", {                   html: "unblock",                    href: `/wiki/Special:Unblock/${blockedUser}`,                }), }));           }

blockedUsers.push(blockedUser); i++; }   } });*/

/*$(document).ready(function {	copyPageWikitext;	addSandboxButton;	addChangeBlockButton; });*/