User:Collei/global.js

// stolen from https://meta.miraheze.org/wiki/User:DarkMatterMan4500/global.js and other random places window.restorerSummary = "Reverted the last edit(s) to revision $ID by $USER";

// Global TW mw.loader.load( "//meta.wikimedia.org/w/index.php?title=User:Xiplus/TwinkleGlobal/load.js&action=raw&ctype=text/javascript" );

// mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript"); mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:DannyS712/PermaLinkSection.js&action=raw&ctype=text/javascript" ); // Backlink: User:DannyS712/PermaLinkSection.js mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:DannyS712/Easy-link.js&action=raw&ctype=text/javascript" ); // Backlink: User:DannyS712/Easy-link.js mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:Writ_Keeper/Scripts/markBlocked.js&action=raw&ctype=text/javascript" ); // Backlink: User:Writ Keeper/Scripts/markBlocked.js mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:Enterprisey/diff-permalink.js&action=raw&ctype=text/javascript" ); // Backlink: User:Enterprisey/diff-permalink.js mw.loader.load( "https://en.wikipedia.org/wiki/User:Kbh3rd/whackamole.js?action=raw&ctype=text/javascript" ); // Backlink: User:Kbh3rd/whackamole.js mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/Restorer.js&action=raw&ctype=text/javascript" ); // Backlink:  User:BrandonXLF/Restorer // mw.loader.load('https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Writ_Keeper/Scripts/massRevdel.js'); mw.loader.load( "https://en.wikipedia.org/wiki/User:Path_slopu/scripts/RBK-assist.js?action=raw&ctype=text/javascript" ); mw.loader.load( "https://commons.wikimedia.org/wiki/User:Mdaniels5757/cuStaleness.js?action=raw&ctype=text/javascript" ); mw.loader.load( "https://meta.miraheze.org/wiki/User:DarkMatterMan4500/easyblock-modern.js?action=raw&ctype=text/javascript" ); mw.loader.load( "https://meta.miraheze.org/wiki/User:DarkMatterMan4500/mark-locked.js?action=raw&ctype=text/javascript" ); mw.loader.load( "https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Writ_Keeper/Scripts/massRollback.js" ); // Global preferences mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/GlobalPrefs.js&action=raw&ctype=text/javascript" ); // SubpageMover mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/SubpageMover.js&action=raw&ctype=text/javascript" ); // Autoblocker mw.loader.load( "https://meta.miraheze.org/wiki/User:DarkMatterMan4500/Autoblock.js?action=raw&ctype=text/javascript" );

// ParameterSpacing mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/ParameterSpacing.js&action=raw&ctype=text/javascript" );

// Wiki-Labels mw.loader.load("https://labels.wmflabs.org/gadget/loader.js");

mw.loader.load( "https://de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript" ); var autoFormatReplacements = / +<ref\b/g, "<ref";

// Linkback: MoreMenu mw.loader.load( "https://meta.wikimedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:MoreMenu.import.js" );

// SRGL mw.loader.load( "https://meta.wikimedia.org/wiki/User:Awesome_Aasim/SRGL.js?action=raw&ctype=text/javascript" );

// userinfo.js mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PleaseStand/userinfo.js&action=raw&ctype=text/javascript" );

// https://dev.fandom.com/wiki/MediaWiki:FastDelete/code.js

window.fdButtons = [ {   summary: "Unused", label: "UN", }, {    summary: "Housekeeping", label: "HK", }, {    summary: "Vandalism", label: "V", }, {    summary: "Spam", label: "S", }, ];

/** * Ajax Fast Delete * * @author Splarka * @author Uberfuzzy * @author Grunny * * @version 2.7 */ (function ($, mw, window) { //"use strict";

window.dev = window.dev || {};

const conf = mw.config.get([   "wgNamespaceNumber",    "wgPageName",    "wgArticleId",  ]);

// Loading restrictions if (   window.dev.ajaxFastDelete !== undefined ||    !window.fdButtons ||    conf.wgNamespaceNumber === -1 ||    conf.wgArticleId === 0 ||    (conf.wgNamespaceNumber === 2 && $(".noarticletext").length) ||    (conf.wgNamespaceNumber != 2 && !$("#mm-page-delete-page").length) /* ||    !/sysop|staff|helper|wiki-representative|wiki-specialist|moderator|soap/.test( mw.config.get("wgUserGroups").join )*/ ) {    return; }

// Main script function function init(i18n) { const self = { version: "2.7", init: function { const $profile = $(".UserProfileActionButton"); const $blogs = $(".page-header__subtitle-blog-post"); const $title = $("#firstHeading");

// Map config object to get buttons' HTML const deleteBtns = window.fdButtons.map(function (btn) {         return $("", { class: "wds-button", title: "Delete", text: btn.label, "data-summary": btn.summary, "data-id": "fastdelete", });       });

const buttonsWrapper = $(" ", {         id: "FastDeleteBtns",          html: deleteBtns,        });

mw.loader.load(         "https://meta.miraheze.org/wiki/User:Collei/applyFastdeleteCss.js?action=raw&ctype=text/javascript"        );

// Place buttons $title.append(buttonsWrapper);

// Handle click events const btnElements = $('a[data-id="fastdelete"]'); if (btnElements.length) { btnElements.click(function {            const deleteReason = $(this).attr("data-summary");

// Delete immediately if NoConfirm option is set if (!!window.FastDeleteNoConfirm) { self.deletePage(deleteReason); } else { // Otherwise ask for confirmation first const isConfirmed = confirm(               `Are you sure you want to delete this page? Delete reason will be ${deleteReason}.`              ); if (isConfirmed) { self.deletePage(deleteReason); }           }          });        }

// Fire the hook mw.hook("fastdelete.init").fire(buttonsWrapper); },     deletePage: function (deleteReason) { new mw.Api .post({           action: "delete",            title: conf.wgPageName,            reason: deleteReason,            bot: true,            token: mw.user.tokens.get("csrfToken"),          }) .done(function (res) {           if (res.error) {              return alert( `API error occurred! Error code: "${res.error.code}" - "${res.error.info}"` );           }            console.log(`${conf.wgPageName} deleted successfully`);            location.reload;          }) .fail(function {            return alert("AJAX error occurred!");          }); },   };

// Export the script window.dev.ajaxFastDelete = self;

// Run init function with dependencies mw.loader.using(["mediawiki.util", "mediawiki.api"]).then(self.init); }

// VSCodium is stupid and insists that init is never read _ = init;

delete _; })(jQuery, mediaWiki, window);