User:Omphalographer/common.js

// Hide useless sidebar sections $("#p-wikimedia_projects, #p-electronpdfservice-sidebar-portlet-heading, #p-lang").remove;

// Tool: quick prod $(mw.util.addPortletLink( "p-tb", "#", "{" + "{prod}}", "t-add-prod", "Add a proposed deletion tag to this page", "p", null )).on("click", function(ev) { ev.preventDefault;  var defaultreason = window.localStorage.getItem("prod-reason") || "Proposing deletion";  var reason = prompt("Prod edit summary:", defaultreason);  if (!reason) {    mw.notify("Cancelled", { tag: "prod" });    return;  }  window.localStorage.setItem("prod-reason", reason);  var api = new mw.Api;  mw.notify("Editing...", { tag: "prod" });  api.postWithEditToken({ action: "edit", title: mw.config.get("wgPageName"), prependtext: " {" + "{subst:prod}} \n\n", summary: reason, }).then(function(ok) { mw.notify("Reloading...", { tag: "prod", type: "success" }); window.location.reload; }, function(err) { mw.notify("Error: " + err, { tag: "prod", type: "error" }); }); });

// Tool: quick delete $(mw.util.addPortletLink( "p-tb", "#", "{" + "{delete}}", "t-add-speedy", "Add a deletion tag to this page", "d", null )).on("click", function(ev) { ev.preventDefault;  var reason = prompt("Deletion reason:");  if (!reason) {    mw.notify("Cancelled", { tag: "speedy" });    return;  }  var api = new mw.Api;  mw.notify("Editing...", { tag: "speedy" });  api.postWithEditToken({ action: "edit", title: mw.config.get("wgPageName"), prependtext: " {" + "{delete|" + reason + "}} \n\n", summary: "Requesting deletion: " + reason, }).then(function(ok) { mw.notify("Reloading...", { tag: "speedy", type: "success" }); window.location.reload; }, function(err) { mw.notify("Error: " + err, { tag: "speedy", type: "error" }); }); });