User:Eejit43/scripts/null-edit.js

// // Note: This script was compiled and minified from TypeScript. For a more readable version, see https://github.com/Eejit43/wikipedia-scripts/blob/main/scripts/null-edit.ts

"use strict";mw.loader.using(["mediawiki.util"],=>{if(mw.config.get("wgNamespaceNumber")<0||!mw.config.get("wgIsProbablyEditable"))return;mw.util.addPortletLink(mw.config.get("skin")==="minerva"?"p-tb":"p-cactions","#","Null edit","null-edit").addEventListener("click",async t=>{t.preventDefault,mw.notify("Null editing page...",{tag:"null-edit-notification"});try{await new mw.Api.edit(mw.config.get("wgPageName"),e=>({text:e.content,summary:"Null edit- if you see this, something went wrong!",minor:!0}))}catch(e){return console.error(e),mw.notify("An error occurred when null editing this page!",{type:"error",tag:"null-edit-notification"})}mw.notify("Successfully null edited page, reloading...",{type:"success",tag:"null-edit-notification"}),window.location.reload})});

// //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc2NyaXB0cy9udWxsLWVkaXQudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIm13LmxvYWRlci51c2luZyhbJ21lZGlhd2lraS51dGlsJ10sICgpID0+IHtcbiAgICBpZiAobXcuY29uZmlnLmdldCgnd2dOYW1lc3BhY2VOdW1iZXInKSA8IDApIHJldHVybjsgLy8gRG9uJ3QgcnVuIGluIHZpcnR1YWwgbmFtZXNwYWNlc1xuICAgIGlmICghbXcuY29uZmlnLmdldCgnd2dJc1Byb2JhYmx5RWRpdGFibGUnKSkgcmV0dXJuOyAvLyBEb24ndCBydW4gaWYgdXNlciBjYW4ndCBlZGl0IHBhZ2VcblxuICAgIGNvbnN0IGxpbmsgPSBtdy51dGlsLmFkZFBvcnRsZXRMaW5rKG13LmNvbmZpZy5nZXQoJ3NraW4nKSA9PT0gJ21pbmVydmEnID8gJ3AtdGInIDogJ3AtY2FjdGlvbnMnLCAnIycsICdOdWxsIGVkaXQnLCAnbnVsbC1lZGl0JykhO1xuXG4gICAgbGluay5hZGRF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