MediaWiki:Gadget-validateBlockRollbackers.js/core.js: diferenças entre revisões
Aspeto
Conteúdo apagado Conteúdo adicionado
m Sincronizando com atualização no GitHub |
m Sincronizando com atualização no GitHub |
||
Linha 5: | Linha 5: | ||
* @author [[w:pt:User:!Silent]] |
* @author [[w:pt:User:!Silent]] |
||
* @date 15/apr/2012 |
* @date 15/apr/2012 |
||
* @updated |
* @updated 05/jul/2021 |
||
* @source https://github.com/Nevallem/mw-gadget-validateBlockRollbackers |
* @source https://github.com/Nevallem/mw-gadget-validateBlockRollbackers |
||
*/ |
*/ |
||
Linha 11: | Linha 11: | ||
/* global mw, $ */ |
/* global mw, $ */ |
||
!function(){"use strict";var |
!function(){"use strict";var e,o;function i(){var i=$.Deferred();return o?i.promise():(o=1,$.getJSON(mw.util.wikiScript("api"),{action:"query",list:"allusers",format:"json",auprop:"implicitgroups",aulimit:"1",aufrom:e.val(),auto:e.val()},function(e){i.resolve(!$.isEmptyObject(e.query.allusers)&&-1!==$.inArray("autoconfirmed",e.query.allusers[0].implicitgroups)),o=0}),i.promise())}function r(){e.val()!==mw.config.get("wgUserName")?(i().done(function(e){e&&$("#mw-content-text").html(mw.message("vbr-noPermissionAutoconfirmed").plain())}),function(e,o){$(e).each(function(){-1===$(this).text().search(/((segundo|minuto|hora)s?|1 dia)/)&&$(this).remove()}),$(o).each(function(){-1!==$(this).text().search(/(vandalismo|Propaganda ou \[\[WP:SPAM|spam\]\])/i)&&-1===$(this).text().indexOf("IP com longo histórico")||$(this).remove()})}.apply(void 0,"pt.m.wikipedia.org"!==location.hostname?["#ooui-7 div","#ooui-2 div"]:['select[name="wpExpiry"] option','select[name="wpReason"] option']),e.blur(function(){i().done(function(o){o&&(alert(mw.message("vbr-noPermission"+(e.val()===mw.config.get("wgUserName")?"Himself":"Autoconfirmed")).plain()),e.val("").focus())})}),$("#ooui-8").next().remove(),$("#ooui-php-14").remove(),$("#ooui-php-15").remove(),$("#ooui-php-16").remove(),$("#ooui-php-17").remove(),$('input[name="wpExpiry-other"]').next().next().remove(),$('input[name="wpExpiry-other"]').remove(),$('optgroup[label="Motivos predefinidos"]').remove(),$('#mw-input-wpEditingRestriction label[role="radio"]').eq(1).remove()):$("#mw-content-text").html(mw.message("vbr-noPermissionHimself").plain())}mw.messages.set({"vbr-noPermissionAutoconfirmed":"Como reversor você não tem permissão para bloquear esse usuário, pois ele é um autoconfirmado.","vbr-noPermissionHimself":"Como reversor você não tem permissão para bloquear a si mesmo."}),$(function(){e=$('input[name="wpTarget"]'),r()})}(); |
Revisão das 22h50min de 5 de julho de 2021
/**
* Validate block rollbackers
*
* @desc Prevents that rollbackers in ptwikipedia blocks autoconfirmed users and of exceed the block limit (1 day).
* @author [[w:pt:User:!Silent]]
* @date 15/apr/2012
* @updated 05/jul/2021
* @source https://github.com/Nevallem/mw-gadget-validateBlockRollbackers
*/
/* jshint laxbreak: true */
/* global mw, $ */
!function(){"use strict";var e,o;function i(){var i=$.Deferred();return o?i.promise():(o=1,$.getJSON(mw.util.wikiScript("api"),{action:"query",list:"allusers",format:"json",auprop:"implicitgroups",aulimit:"1",aufrom:e.val(),auto:e.val()},function(e){i.resolve(!$.isEmptyObject(e.query.allusers)&&-1!==$.inArray("autoconfirmed",e.query.allusers[0].implicitgroups)),o=0}),i.promise())}function r(){e.val()!==mw.config.get("wgUserName")?(i().done(function(e){e&&$("#mw-content-text").html(mw.message("vbr-noPermissionAutoconfirmed").plain())}),function(e,o){$(e).each(function(){-1===$(this).text().search(/((segundo|minuto|hora)s?|1 dia)/)&&$(this).remove()}),$(o).each(function(){-1!==$(this).text().search(/(vandalismo|Propaganda ou \[\[WP:SPAM|spam\]\])/i)&&-1===$(this).text().indexOf("IP com longo histórico")||$(this).remove()})}.apply(void 0,"pt.m.wikipedia.org"!==location.hostname?["#ooui-7 div","#ooui-2 div"]:['select[name="wpExpiry"] option','select[name="wpReason"] option']),e.blur(function(){i().done(function(o){o&&(alert(mw.message("vbr-noPermission"+(e.val()===mw.config.get("wgUserName")?"Himself":"Autoconfirmed")).plain()),e.val("").focus())})}),$("#ooui-8").next().remove(),$("#ooui-php-14").remove(),$("#ooui-php-15").remove(),$("#ooui-php-16").remove(),$("#ooui-php-17").remove(),$('input[name="wpExpiry-other"]').next().next().remove(),$('input[name="wpExpiry-other"]').remove(),$('optgroup[label="Motivos predefinidos"]').remove(),$('#mw-input-wpEditingRestriction label[role="radio"]').eq(1).remove()):$("#mw-content-text").html(mw.message("vbr-noPermissionHimself").plain())}mw.messages.set({"vbr-noPermissionAutoconfirmed":"Como reversor você não tem permissão para bloquear esse usuário, pois ele é um autoconfirmado.","vbr-noPermissionHimself":"Como reversor você não tem permissão para bloquear a si mesmo."}),$(function(){e=$('input[name="wpTarget"]'),r()})}();