User:Eejit43/scripts/ajax-undo.js: Difference between revisions

Content deleted Content added
Syncing script from GitHub (via script)
Syncing script from GitHub (via script)
Line 2:
// Note: This script was compiled and minified from TypeScript. For a more readable version, see https://github.com/Eejit43/wikipedia-scripts/blob/main/scripts/ajax-undo.ts
 
"use strict";(()=>{var p=`#ajax-undo-loading{display:none;vertical-align:text-bottom;height:1.3em;overflow:hidden;line-height:1.5em}#ajax-undo-loading:after{display:inline-table;animation:ajax-undo-loading .8s steps(10) infinite;content:"\\280b\\\\A\\2819\\\\A\\2839\\\\A\\2838\\\\A\\283c\\\\A\\2834\\\\A\\2826\\\\A\\2827\\\\A\\2807\\\\A\\280f";color:gray;text-align:left;white-space:pre}#ajax-undo-loading:not(.is-diff){margin:-.3em 3px 0}#ajax-undo-loading.is-diff{height:1.55em}#ajax-undo-loading.is-minerva:not(.is-diff){float:right;margin-top:0}#ajax-undo-loading.is-minerva.is-diff{margin:-.2em 3px}@keyframes ajax-undo-loading{to{transform:translateY(-15em)}}#ajax-undo-reason{display:none;margin-left:3px}#ajax-undo-reason.is-minerva{border:revert;background:revert;padding:revert}#ajax-undo-reason.is-minerva:not(.is-diff){float:right;height:26px}
"use strict";(()=>{mw.loader.using(["mediawiki.util"],()=>{let n=mw.config.get("wgDiffOldId");if(mw.config.get("wgAction")!=="history"&&!n)return;let a=mw.config.get("skin")==="minerva",d={awaitingClick:0,awaitingConfirmation:1,awaitingReload:2};mw.util.addCSS(`
}`;mw.loader.using(["mediawiki.util"],()=>{let n=mw.config.get("wgDiffOldId");if(mw.config.get("wgAction")!=="history"&&!n)return;mw.util.addCSS(p);let a=mw.config.get("skin")==="minerva",d={awaitingClick:0,awaitingConfirmation:1,awaitingReload:2};for(let o of document.querySelectorAll(".mw-history-undo, .mw-diff-undo")){let m=o.querySelector("a");if(!m?.href){mw.notify("Could not find undo link!",{type:"error"});continue}let f=new URL(m.href),i=document.createElement("span"),s=d.awaitingClick,t=document.createElement("a");t.textContent="ajax undo",t.href=f.href,a&&!n&&(t.style.marginLeft="1em"),t.addEventListener("click",async c=>{if(c.preventDefault(),s===d.awaitingClick)s=d.awaitingConfirmation,e.style.display="inline",e.focus(),t.textContent="confirm ajax undo";else if(s===d.awaitingConfirmation){s=d.awaitingReload,r.style.display="inline-block",t.style.color="gray",e.disabled=!0,a&&t.append(r);let u=f.searchParams.get("undo"),g=f.searchParams.get("undoafter");if(!u||!g){mw.notify("Could not find undo parameters in URL!",{type:"error"});return}let l=o.closest(n?"td":"li")?.querySelector(".mw-userlink bdi")?.textContent;if(!l){mw.notify("Could not find revision user!",{type:"error"});return}if(!await new mw.Api().postWithEditToken({action:"edit",title:mw.config.get("wgPageName"),undo:u,undoafter:g,summary:`Undid revision ${u} by [[Special:Contributions/${l}|${l}]] ([[User talk:${l}|talk]])${e.value?`: ${e.value}`:""}`}).catch((pw,wy)=>(mw.notify(`Error undoing revision: ${wy?.error.code??"Unknown error"} (${pw})`,{type:"error"}),setTimeout(()=>{window.___location.reload()},2e3),!1)))return;mw.notify("Revision successfully undone, reloading...",{type:"success"}),window.___location.reload()}}),n&&i.append(document.createTextNode("(")),i.append(t);let r=document.createElement("span");r.id="ajax-undo-loading",n&&r.classList.add("is-diff"),a&&r.classList.add("is-minerva"),a||i.append(r);let e=document.createElement("input");e.type="text",e.id="ajax-undo-reason",n&&e.classList.add("is-diff"),a&&e.classList.add("is-minerva"),e.placeholder="Insert reason here...",e.addEventListener("keydown",c=>{c.key==="Enter"&&t.click()}),a&&!n?i.prepend(e):i.append(e),n&&i.append(document.createTextNode(")")),n?(o.after(i),o.after(document.createTextNode(" "))):a?o.parentElement?.before(i):o.parentElement?.after(i)}});})();
#ajax-undo-loading {
display: none;
vertical-align: text-bottom;
height: 1.3em;
overflow: hidden;
line-height: 1.5em;
}
 
#ajax-undo-loading::after {
display: inline-table;
animation: ajax-undo-loading 0.8s steps(10) infinite;
content: "\u280B\\A\u2819\\A\u2839\\A\u2838\\A\u283C\\A\u2834\\A\u2826\\A\u2827\\A\u2807\\A\u280F";
color: gray;
text-align: left;
white-space: pre;
}
 
#ajax-undo-loading.is-diff {
height: 1.55em;
}
 
#ajax-undo-loading:not(.is-diff) {
margin: -0.3em 3px 0;
}
 
#ajax-undo-loading.is-minerva.is-diff {
margin: -0.2em 3px;
}
 
#ajax-undo-loading.is-minerva:not(.is-diff) {
float: right;
margin-top: 0;
}
 
@keyframes ajax-undo-loading {
to {
transform: translateY(-15em);
}
}
 
#ajax-undo-reason {
display: none;
margin-left: 3px;
}
 
#ajax-undo-reason.is-minerva {
border: revert;
background: revert;
padding: revert;
}
 
#ajax-undo-reason.is-minerva:not(.is-diff) {
float: right;
height: 26px;
}`);for(let o of document.querySelectorAll(".mw-history-undo, .mw-diff-undo")){let m=o.querySelector("a");if(!m?.href){mw.notify("Could not find undo link!",{type:"error"});continue}let f=new URL(m.href),i=document.createElement("span"),s=d.awaitingClick,t=document.createElement("a");t.textContent="ajax undo",t.href=f.href,a&&!n&&(t.style.marginLeft="1em"),t.addEventListener("click",async c=>{if(c.preventDefault(),s===d.awaitingClick)s=d.awaitingConfirmation,e.style.display="inline",e.focus(),t.textContent="confirm ajax undo";else if(s===d.awaitingConfirmation){s=d.awaitingReload,r.style.display="inline-block",t.style.color="gray",e.disabled=!0,a&&t.append(r);let u=f.searchParams.get("undo"),g=f.searchParams.get("undoafter");if(!u||!g){mw.notify("Could not find undo parameters in URL!",{type:"error"});return}let l=o.closest(n?"td":"li")?.querySelector(".mw-userlink bdi")?.textContent;if(!l){mw.notify("Could not find revision user!",{type:"error"});return}if(!await new mw.Api().postWithEditToken({action:"edit",title:mw.config.get("wgPageName"),undo:u,undoafter:g,summary:`Undid revision ${u} by [[Special:Contributions/${l}|${l}]] ([[User talk:${l}|talk]])${e.value?`: ${e.value}`:""}`}).catch((p,w)=>(mw.notify(`Error undoing revision: ${w?.error.code??"Unknown error"} (${p})`,{type:"error"}),setTimeout(()=>{window.___location.reload()},2e3),!1)))return;mw.notify("Revision successfully undone, reloading...",{type:"success"}),window.___location.reload()}}),n&&i.append(document.createTextNode("(")),i.append(t);let r=document.createElement("span");r.id="ajax-undo-loading",n&&r.classList.add("is-diff"),a&&r.classList.add("is-minerva"),a||i.append(r);let e=document.createElement("input");e.type="text",e.id="ajax-undo-reason",n&&e.classList.add("is-diff"),a&&e.classList.add("is-minerva"),e.placeholder="Insert reason here...",e.addEventListener("keydown",c=>{c.key==="Enter"&&t.click()}),a&&!n?i.prepend(e):i.append(e),n&&i.append(document.createTextNode(")")),n?(o.after(i),o.after(document.createTextNode(" "))):a?o.parentElement?.before(i):o.parentElement?.after(i)}});})();
 
// </nowiki>
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3R5bGVzL2FqYXgtdW5kby5jc3MiLCAiLi4vLi4vc2NyaXB0cy9hamF4LXVuZG8udHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIiNhamF4LXVuZG8tbG9hZGluZ3tkaXNwbGF5Om5vbmU7dmVydGljYWwtYWxpZ246dGV4dC1ib3R0b207aGVpZ2h0OjEuM2VtO292ZXJmbG93OmhpZGRlbjtsaW5lLWhlaWdodDoxLjVlbX0jYWpheC11bmRvLWxvYWRpbmc6YWZ0ZXJ7ZGlzcGxheTppbmxpbmUtdGFibGU7YW5pbWF0aW9uOmFqYXgtdW5kby1sb2FkaW5nIC44cyBzdGVwcygxMCkgaW5maW5pdGU7Y29udGVudDpcIlxcMjgwYlxcXFxBXFwyODE5XFxcXEFcXDI4MzlcXFxcQVxcMjgzOFxcXFxBXFwyODNjXFxcXEFcXDI4MzRcXFxcQVxcMjgyNlxcXFxBXFwyODI3XFxcXEFcXDI4MDdcXFxcQVxcMjgwZlwiO2NvbG9yOmdyYXk7dGV4dC1hbGlnbjpsZWZ0O3doaXRlLXNwYWNlOnByZX0jYWpheC11bmRvLWxvYWRpbmc6bm90KC5pcy1kaWZmKXttYXJnaW46LS4zZW0gM3B4IDB9I2FqYXgtdW5kby1s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1bmRvSWQgfHwgIXVuZG9BZnRlcikge1xuICAgICAgICAgICAgICAgICAgICBtdy5ub3RpZnkoJ0NvdWxkIG5vdCBmaW5kIHVuZG8gcGFyYW1ldGVycyBpbiBVUkwhJywgeyB0eXBlOiAnZXJyb3InIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY29uc3QgcmV2aXNpb25Vc2VyID0gdW5kb1NwYW4uY2xvc2VzdChpc0RpZmYgPyAndGQnIDogJ2xpJyk/LnF1ZXJ5U2VsZWN0b3IoJy5tdy11c2VybGluayBiZGknKT8udGV4dENvbnRlbnQ7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXJldmlzaW9uVXNlcikge1xuICAgICAgICAgICAgICAgICAgICBtdy5ub3RpZnkoJ0NvdWxkIG5vdCBmaW5kIHJldmlzaW9uIHVzZXIhJywgeyB0eXBlOiAnZXJyb3InIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY29uc3Qgc3VjY2VzcyA9IGF3YWl0IG5ldyBtdy5BcGkoKVxuICAgICAgICAgICAgICAgICAgICAucG9zdFdpdGhFZGl0VG9rZW4oe1xuICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiAnZWRpdCcsXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogbXcuY29uZmlnLmdldCgnd2dQYWdlTmFtZScpLFxuICAgICAgICAgICAgICAgICAgICAgICAgdW5kbzogdW5kb0lkLFxuICAgICAgICAgICAgICAgICAgICAgICAgdW5kb2FmdGVyOiB1bmRvQWZ0ZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5OiBgVW5kaWQgcmV2aXNpb24gJHt1bmRvSWR9IGJ5IFtbU3BlY2lhbDpDb250cmlidXRpb25zLyR7cmV2aXNpb25Vc2VyfXwke3JldmlzaW9uVXNlcn1dXSAoW1tVc2VyIHRhbGs6JHtyZXZpc2lvblVzZXJ9fHRhbGtdXSkke1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbklucHV0LnZhbHVlID8gYDogJHtyZWFzb25JbnB1dC52YWx1ZX1gIDogJydcbiAgICAgICAgICAgICAgICAgICAgICAgIH1gLFxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yQ29kZSwgZXJyb3JJbmZvKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtdy5ub3RpZnkoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYEVycm9yIHVuZG9pbmcgcmV2aXNpb246ICR7KGVycm9ySW5mbyBhcyBNZWRpYVdpa2lEYXRhRXJyb3IpPy5lcnJvci5jb2RlID8/ICdVbmtub3duIGVycm9yJ30gKCR7ZXJyb3JDb2RlfSlgLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Vycm9yJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5sb2NhdGlvbi5yZWxvYWQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDIwMDApO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIGlmICghc3VjY2VzcykgcmV0dXJuO1xuXG4gICAgICAgICAgICAgICAgbXcubm90aWZ5KCdSZXZpc2lvbiBzdWNjZXNzZnVsbHkgdW5kb25lLCByZWxvYWRpbmcuLi4nLCB7IHR5cGU6ICdzdWNjZXNzJyB9KTtcbiAgICA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gICAgICAgICAgICAgc3RhZ2UgPSBTVEFHRVMuYXdhaXRpbmdDb25maXJtYXRpb247XG5cbiAgICAgICAgICAgICAgICByZWFzb25JbnB1dC5zdHlsZS5kaXNwbGF5ID0gJ2lubGluZSc7XG4gICAgICAgICAgICAgICAgcmVhc29uSW5wdXQuZm9jdXMoKTtcblxuICAgICAgICAgICAgICAgIGFqYXhVbmRvTGluay50ZXh0Q29udGVudCA9ICdjb25maXJtIGFqYXggdW5kbyc7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHN0YWdlID09PSBTVEFHRVMuYXdhaXRpbmdDb25maXJtYXRpb24pIHtcbiAgICAgICAgICAgICAgICBzdGFnZSA9IFNUQUdFUy5hd2FpdGluZ1JlbG9hZDtcbiAgICAgICAgICAgICAgICBsb2FkaW5nU3Bpbm5lci5zdHlsZS5kaXNwbGF5ID0gJ2lubGluZS1ibG9jayc7XG4gICAgICAgICAgICAgICAgYWpheFVuZG9MaW5rLnN0eWxlLmNvbG9yID0gJ2dyYXknO1xuICAgICAgICAgICAgICAgIHJlYXNvbklucHV0LmRpc2FibGVkID0gdHJ1ZTtcblxuICAgICAgICAgICAgICAgIGlmIChpc01pbmVydmEpIGFqYXhVbmRvTGluay5hcHBlbmQobG9hZGluZ1NwaW5uZXIpO1xuXG4gICAgICAgICAgICAgICAgY29uc3QgdW5kb0lkID0gdW5kb1VybC5zZWFyY2hQYXJhbXMuZ2V0KCd1bmRvJyk7XG4gICAgICAgICAgICAgICAgY29uc3QgdW5kb0FmdGVyID0gdW5kb1VybC5zZWFyY2hQYXJhbXMuZ2V0KCd1bmRvYWZ0ZXInKTtcblxuICAgICAgICAgICAgICAgIGlmICghdW5kb0lkIHx8ICF1bmRvQWZ0ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgbXcubm90aWZ5KCdDb3VsZCBub3QgZmluZCB1bmRvIHBhcmFtZXRlcnMgaW4gVVJMIScsIHsgdHlwZTogJ2Vycm9yJyB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbnN0IHJldmlzaW9uVXNlciA9IHVuZG9TcGFuLmNsb3Nlc3QoaXNEaWZmID8gJ3RkJyA6ICdsaScpPy5xdWVyeVNlbGVjdG9yKCcubXctdXNlcmxpbmsgYmRpJyk/LnRleHRDb250ZW50O1xuXG4gICAgICAgICAgICAgICAgaWYgKCFyZXZpc2lvblVzZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgbXcubm90aWZ5KCdDb3VsZCBub3QgZmluZCByZXZpc2lvbiB1c2VyIScsIHsgdHlwZTogJ2Vycm9yJyB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbnN0IHN1Y2Nlc3MgPSBhd2FpdCBuZXcgbXcuQXBpKClcbiAgICAgICAgICAgICAgICAgICAgLnBvc3RXaXRoRWRpdFRva2VuKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogJ2VkaXQnLFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG13LmNvbmZpZy5nZXQoJ3dnUGFnZU5hbWUnKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVuZG86IHVuZG9JZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVuZG9hZnRlcjogdW5kb0FmdGVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeTogYFVuZGlkIHJldmlzaW9uICR7dW5kb0lkfSBieSBbW1NwZWNpYWw6Q29udHJpYnV0aW9ucy8ke3JldmlzaW9uVXNlcn18JHtyZXZpc2lvblVzZXJ9XV0gKFtbVXNlciB0YWxrOiR7cmV2aXNpb25Vc2VyfXx0YWxrXV0pJHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb25JbnB1dC52YWx1ZSA/IGA6ICR7cmVhc29uSW5wdXQudmFsdWV9YCA6ICcnXG4gICAgICAgICAgICAgICAgICAgICAgICB9YCxcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlcnJvckNvZGUsIGVycm9ySW5mbykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbXcubm90aWZ5KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGBFcnJvciB1bmRvaW5nIHJldmlzaW9uOiAkeyhlcnJvckluZm8gYXMgTWVkaWFXaWtpRGF0YUVycm9yKT8uZXJyb3IuY29kZSA/PyAnVW5rbm93biBlcnJvcid9ICgke2Vycm9yQ29kZX0pYCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdlcnJvcicsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cubG9jYXRpb24ucmVsb2FkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAyMDAwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXN1Y2Nlc3MpIHJldHVybjtcblxuICAgICAgICAgICAgICAgIG13Lm5vdGlmeSgnUmV2aXNpb24gc3VjY2Vzc2Z1bGx5IHVuZG9uZSwgcmVsb2FkaW5nLi4uJywgeyB0eXBlOiAnc3VjY2VzcycgfSk7XG4gICAgICAgICAgICAgICAgd2luZG93LmxvY2F0aW9uLnJlbG9hZCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICBpZiAoaXNEaWZmKSBzcGFuLmFwcGVuZChkb2N1bWVudC5jcmVhdGVUZXh0Tm9kZSgn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