MediaWiki:Gadget-arquivarPEs.js
Aspeto
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
/*!
*
* ArquivarPEs - Arquivar Páginas a eliminar
*
* Adiciona um link (um "Arquivar" na linha de ferramentas da PE)
* para administradores e eliminadores nas páginas para eliminar
* que faz as ações de fechamento automaticamente.
*
* Essa versão foi construída com webpack e Babel.
* Podes encontrar o código original no GitHub:
*
* https://github.com/chicocvenancio/arquivarPEs
*
* Lá também é o aonde é feito o desenvolvimento,
* por favor não edite a essa página diretamente.
*
* This version was built with webpack and Babel.
* You can find the original source code on GitHub:
*
* https://github.com/chicocvenancio/arquivarPEs
*
* That is also where development happens –
* please do not edit this page directly.
*
*/!function(){var e={670:function(e,t,r){var n=r(111);e.exports=function(e){if(!n(e))throw TypeError(String(e)+" is not an object");return e}},326:function(e){var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},648:function(e,t,r){var n=r(694),o=r(326),i=r(112)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:a?o(t):"Object"==(n=o(t))&&"function"==typeof t.callee?"Arguments":n}},880:function(e,t,r){var n=r(781),o=r(70),i=r(114);e.exports=n?function(e,t,r){return o.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},114:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},781:function(e,t,r){var n=r(293);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(e,t,r){var n=r(854),o=r(111),i=n.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},293:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},854:function(e,t,r){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||Function("return this")()},656:function(e){var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},501:function(e){e.exports={}},664:function(e,t,r){var n=r(781),o=r(293),i=r(317);e.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},788:function(e,t,r){var n=r(465),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(e){return o.call(e)}),e.exports=n.inspectSource},909:function(e,t,r){var n,o,i,a=r(536),u=r(854),c=r(111),s=r(880),f=r(656),l=r(200),p=r(501),d=u.WeakMap;if(a){var g=new d,h=g.get,m=g.has,v=g.set;n=function(e,t){return v.call(g,e,t),t},o=function(e){return h.call(g,e)||{}},i=function(e){return m.call(g,e)}}else{var y=l("state");p[y]=!0,n=function(e,t){return s(e,y,t),t},o=function(e){return f(e,y)?e[y]:{}},i=function(e){return f(e,y)}}e.exports={set:n,get:o,has:i,enforce:function(e){return i(e)?o(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!c(t)||(r=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},111:function(e){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},913:function(e){e.exports=!1},133:function(e,t,r){var n=r(293);e.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},536:function(e,t,r){var n=r(854),o=r(788),i=n.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},70:function(e,t,r){var n=r(781),o=r(664),i=r(670),a=r(593),u=Object.defineProperty;t.f=n?u:function(e,t,r){if(i(e),t=a(t,!0),i(r),o)try{return u(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},288:function(e,t,r){"use strict";var n=r(694),o=r(648);e.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},320:function(e,t,r){var n=r(854),o=r(880),i=r(656),a=r(505),u=r(788),c=r(909),s=c.get,f=c.enforce,l=String(String).split("String");(e.exports=function(e,t,r,u){var c=!!u&&!!u.unsafe,s=!!u&&!!u.enumerable,p=!!u&&!!u.noTargetGet;"function"==typeof r&&("string"!=typeof t||i(r,"name")||o(r,"name",t),f(r).source=l.join("string"==typeof t?t:"")),e!==n?(c?!p&&e[t]&&(s=!0):delete e[t],s?e[t]=r:o(e,t,r)):s?e[t]=r:a(t,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&s(this).source||u(this)}))},505:function(e,t,r){var n=r(854),o=r(880);e.exports=function(e,t){try{o(n,e,t)}catch(r){n[e]=t}return t}},200:function(e,t,r){var n=r(309),o=r(711),i=n("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},465:function(e,t,r){var n=r(854),o=r(505),i="__core-js_shared__",a=n[i]||o(i,{});e.exports=a},309:function(e,t,r){var n=r(913),o=r(465);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},593:function(e,t,r){var n=r(111);e.exports=function(e,t){if(!n(e))return e;var r,o;if(t&&"function"==typeof(r=e.toString)&&!n(o=r.call(e)))return o;if("function"==typeof(r=e.valueOf)&&!n(o=r.call(e)))return o;if(!t&&"function"==typeof(r=e.toString)&&!n(o=r.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},694:function(e,t,r){var n={};n[r(112)("toStringTag")]="z",e.exports="[object z]"===String(n)},711:function(e){var t=0,r=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+r).toString(36)}},307:function(e,t,r){var n=r(133);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},112:function(e,t,r){var n=r(854),o=r(309),i=r(656),a=r(711),u=r(133),c=r(307),s=o("wks"),f=n.Symbol,l=c?f:f&&f.withoutSetter||a;e.exports=function(e){return i(s,e)||(u&&i(f,e)?s[e]=f[e]:s[e]=l("Symbol."+e)),s[e]}},539:function(e,t,r){var n=r(694),o=r(320),i=r(288);n||o(Object.prototype,"toString",i,{unsafe:!0})},666:function(e){var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===g){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===h)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?g:p,c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=g,r.method="throw",r.arg=c.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",g="completed",h={};function m(){}function v(){}function y(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(_([])));x&&x!==r&&n.call(x,i)&&(b=x);var k=y.prototype=m.prototype=Object.create(b);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function A(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function _(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:R}}function R(){return{value:t,done:!0}}return v.prototype=k.constructor=y,y.constructor=v,v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,u,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},E(P.prototype),P.prototype[a]=function(){return this},e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,u,"Generator"),k[i]=function(){return this},k.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=_,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:_(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e,t,n,o,i,a,u,c;r(539),r(666);function s(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,u,"next",e)}function u(e){s(i,n,o,a,u,"throw",e)}a(void 0)}))}}e=jQuery,t=mediaWiki,n=new t.Api,o="~~".concat("~","~~"),i={},a=["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],u=new Date,c="; processo assistido por [[MediaWiki:Gadget-arquivarPEs.js|um script]]",i.getWikiText=function(){var e=f(regeneratorRuntime.mark((function e(t){var r,o,i,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.get({prop:"revisions",rvprop:"content",rvlimit:1,indexpageids:!0,titles:t});case 2:if(r=e.sent,o=r.query,i=o&&o.pageids&&o.pageids[0],a=i&&o.pages&&o.pages[i],!((u=a&&a.revisions)&&u[0]&&u[0]["*"])){e.next=11;break}return e.abrupt("return",u[0]["*"]);case 11:throw new Error("Página ".concat(t," não existe."));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.editPage=function(){var e=f(regeneratorRuntime.mark((function e(r,o,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.post({action:"edit",title:r,text:o,summary:i,token:t.user.tokens.get("csrfToken")});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),i.startArchive=function(){var e=f(regeneratorRuntime.mark((function e(r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=(n=/\{\{Nomeação não concluída\|(\d*)(|\|prog=.*)\}\}/g).exec(r)){e.next=3;break}return e.abrupt("return",i.useDialog("Problema","Predefinição de PE inconclusa não encontrada, por favor verifique a página da PE pela predefinição {{Nomeação não concluída|data (yyyymmdd)}}","nprompt-dialog"));case 3:u.iso=a[1],u.setFullYear(u.iso.substring(0,4),parseInt(u.iso.substring(4,6)-1,10),parseInt(u.iso.substring(6,8),10)),a[2]&&u.setDate(u.getDate()+7),e.t0=i.result,e.next="Inconclusivo/"===e.t0?9:"Arquivo de eliminadas/"===e.t0?16:"Arquivo de mantidas/"===e.t0?20:"Redirecionar/"===e.t0?25:"Prorrogar/"===e.t0?30:32;break;case 9:return i.useDialog("Em progresso","Mudando predefinição em PE","nprompt-dialog"),i.result="Arquivo de mantidas/",i.inconclusive=1,e.next=14,i.editPage(t.config.get("wgPageName"),r.replace(n,"{{Nomeação concluída|"+o+"|Inconclusiva}}"),"Fechando PE"+c);case 14:return i.pages.each(function(){var e=f(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.text,e.next=3,i.removeTemplate(n);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("break",32);case 16:return i.useDialog("Em progresso","Mudando predefinição em PE","nprompt-dialog"),i.editPage(t.config.get("wgPageName"),r.replace(n,"{{Nomeação concluída|"+o+"|Eliminada$2}}"),"Fechando PE"+c),i.pages.each(function(){var e=f(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=r.text,i.deletePage(n),i.deleteTalkPage(n);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("break",32);case 20:return i.useDialog("Em progresso","Mudando predefinição em PE","nprompt-dialog"),e.next=23,i.editPage(t.config.get("wgPageName"),r.replace(n,"{{Nomeação concluída|"+o+"|Mantida}}"),"Fechando PE"+c);case 23:return i.pages.each(function(){var e=f(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.text,e.next=3,i.removeTemplate(n);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("break",32);case 25:return i.useDialog("Em progresso","Mudando predefinição em PE","nprompt-dialog"),e.next=28,i.editPage(t.config.get("wgPageName"),r.replace(n,"{{Nomeação concluída|"+o+"|Redirecionar}}"),"Fechando PE"+c);case 28:return i.pages.each(function(){var e=f(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=r.text,i.editPage(n,"#REDIRECIONAMENTO [["+window.prompt("Redirecionar ".concat(n," para qual página?"))+"]]","Redirecionando página"+c);case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("break",32);case 30:return i.useDialog("Erro!",'Por <a href="https://pt.wikipedia.org/wiki/Wikip%C3%A9dia:Esplanada/propostas/Acabar_com_as_prorroga%C3%A7%C3%B5es_de_vota%C3%A7%C3%A3o_em_Elimina%C3%A7%C3%B5es_por_Consenso_(18dez2016)" title="Wikipédia:Esplanada/propostas/Acabar com as prorrogações de votação em Eliminações por Consenso (18dez2016)">decisão da comunidade</a> não se deve mais prorrogar PEs',"nprompt-dialog"),e.abrupt("break",32);case 32:return e.next=34,i.archivePage();case 34:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.addArchiveLink=function(r){var n=e('<a href="#">Arquivar</a>').on("click",(function(e){e.preventDefault(),i.nicePrompt("Que tipo de arquivamento deseja fazer?",function(){var e=f(regeneratorRuntime.mark((function e(r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.result=r,i.useDialog("Em progresso","Buscando wikitexto da PE","nprompt-dialog"),e.next=4,i.getWikiText(t.config.get("wgPageName"));case 4:n=e.sent,i.startArchive(n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}));e(e(r).children()[1]).before(e(n)).before(" | ").after(" ")},i.archivePage=f(regeneratorRuntime.mark((function e(){var r,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Date,i.fullArchivePage="Wikipédia:Páginas para eliminar/"+("Redirecionar/"!==i.result?i.result:"Arquivo de mantidas/")+a[r.getMonth()]+" "+r.getFullYear(),i.useDialog("Em progresso","Arquivando página","nprompt-dialog"),o="",i.pages.each((function(e,r){u=r.text,o+="\n* [[".concat(t.config.get("wgPageName"),"| ").concat(u,"]] – [[:").concat(u,"]]")+("Redirecionar/"===i.result?" - redirecionado":"")+("Inconclusivo/"===i.result?" - inconclusiva":"")})),e.next=7,n.post({action:"edit",minor:!1,title:i.fullArchivePage,appendtext:o,section:r.getDate(),summary:"arquivando [["+u+"]]"+c,token:t.user.tokens.get("csrfToken")}).done(i.backlinks).fail(i.ajaxErr);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),i.backlinks=function(){"Arquivo de eliminadas/"===i.result?(i.useDialog("Em progresso","Procurando afluentes","nprompt-dialog"),n.get({action:"query",list:"backlinks",bltitle:i.page,blnamespace:"0|8|10|12|14|100|102",bllimit:"80",blredirect:"1"}).done(i.embedded).fail(i.backlinksFail)):i.success()},i.embedded=function(e){var t,r=e.query.backlinks.length;for(t=0;t<e.query.backlinks.length;t+=1)e.query.backlinks[t].redirlink&&(r+=e.query.backlinks[t].redirlink.length);i.numberOfBl=r,n.get({action:"query",list:"embeddedin",eititle:i.page,einamespace:"0|8|10|12|14|100|102",eilimit:"80"}).done(i.success).fail(i.backlinksFail)},i.backlinksFail=function(){i.useDialog("Quase sucesso",'Houve um erro ao verficar afluentes do artigo, por favor faça manualmente.<br /> Sucesso em arquivar! (<a href="'+t.util.getUrl(i.fullArchivePage)+"#"+i.day+"_de_"+t.config.get("wgMonthNames")[u.getMonth()+1]+'">Abrir</a>) <a href="'+t.util.getUrl(i.fullArchivePage)+'?diff=0">(diff)</a><br /> Verifique as suas ações.',"nprompt-dialog")},i.success=function(e){var r,n;if(e){for(n=e.query.embeddedin.length,r=0;r<e.query.embeddedin.length;r+=1)e.query.embeddedin[r].redirlink&&(n+=e.query.embeddedin[r].redirlink.length);i.numberOfBl+=n,i.numberOfBl>=80&&(i.numberOfBl="80 ou mais afluentes")}i.useDialog("Sucesso",'Sucesso em arquivar! (<a href="'+t.util.getUrl(i.fullArchivePage)+"#"+i.day+"_de_"+t.config.get("wgMonthNames")[u.getMonth()]+'">Abrir</a>) <a href="'+t.util.getUrl(i.fullArchivePage,{diff:0})+'">(diff)</a>'+("Arquivo de eliminadas/"===i.result?"<br />"+(0===i.numberOfBl?"Não há afluentes para esse artigo":"Há "+i.numberOfBl+' <a href="'+t.util.getUrl("Especial:Páginas afluentes/"+i.page)+'" >afluentes</a> para esse artigo'):"")+"<br /> Verifique as suas ações.","nprompt-dialog")},i.ajaxErr=function(e,t){i.useDialog("Erro!!",'Houve um erro ao requisitar a edição da página. Código: "'+e+'". '+t.error.info,"nprompt-dialog")},i.talkPageErr=function(e,t){"missingtitle"!==e&&i.ajaxErr(e,t)},i.deleteTalkPage=function(e){var r,o=e.indexOf(":");i.useDialog("Em progresso","Eliminando a página de discussão "+e,"nprompt-dialog"),r=-1===o?"Discussão:"+e:e.substring(0,o)+" Discussão"+e.substring(o),n.post({action:"delete",title:r,reason:"Discussão de página eliminada por [[".concat(t.config.get("wgPageName"),"|PE]] ").concat(c," "),token:t.user.tokens.get("csrfToken")}).fail(i.talkPageErr)},i.deletePage=function(e){return i.useDialog("Em progresso","Eliminando a página "+e,"nprompt-dialog"),n.post({action:"delete",title:e,reason:"Decidido em [[".concat(t.config.get("wgPageName"),"|PE]] ").concat(c),token:t.user.tokens.get("csrfToken")})},i.removeTemplate=function(){var e=f(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.useDialog("Em progresso","Retirando {{apagar4}} da página "+t,"nprompt-dialog"),e.next=3,i.getWikiText(t);case 3:return r=e.sent,e.next=6,i.editPage(t,r.replace(/\{\{\s*apagar4[^\}]+\}\}\n/g,""),"Retirando {{apagar4}}"+c);case 6:return e.next=8,i.addOldPfdTemplate(t);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.addOldPfdTemplate=function(){var e=f(regeneratorRuntime.mark((function e(r){var o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=r.indexOf(":"),i.useDialog("Em progresso","Adicionando {{antigaPE}} na página de discussão","nprompt-dialog"),o=-1===u?"Discussão:"+r:r.substring(0,u)+" Discussão"+r.substring(u),a=i.inconclusive?"{{antigaPE|resultado=inconclusivo|":"{{antigaPE|resultado=manter|",a+=r+"}}\n\n",e.next=7,n.post({action:"edit",title:o,prependtext:a,summary:"Adicionando predefinição de antigaPE"+c,token:t.user.tokens.get("csrfToken")});case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.nicePrompt=function(t,r){e('<div id="nprompt-dialog" class="ui-widget">'+(i.pages.length>1?'<span style="float: right;width: 50%;"> Temos várias páginas nessa PE, a ação de arquivamento <b>se aplicará a todas</b></span>':"")+'<input type="radio" name="nprompt-input-radio" value="Inconclusivo/" />Inconclusiva <br /><input type="radio" name="nprompt-input-radio" value="Redirecionar/" />Redirecionar<br /><input type="radio" name="nprompt-input-radio" value="Arquivo de mantidas/" />Mantida <br /><input type="radio" name="nprompt-input-radio" value="Arquivo de eliminadas/" />Eliminada<br /></div>').dialog({title:t,open:function(){e(".ui-dialog-titlebar-close").hide()},close:function(){e("#nprompt-dialog").dialog("destroy"),e("#nprompt-dialog").remove()},buttons:{OK:function(){r(e("input[name=nprompt-input-radio]:checked").val())},Cancelar:function(){i.useDialog("Ah!","Você cancelou!","nprompt-dialog")}}})},i.useDialog=function(t,r,n){e("#"+n).empty().dialog("option","title",t).append(e("<div>"+r+"</div>")).dialog("option","buttons",{Fechar:function(){e(this).dialog("close")}})},i.pages=e(".PEferramentas").children(":first-child"),e(".PEferramentas").each((function(){i.addArchiveLink(this)}))}()}();