Usuário:Rjclaudio/teste2.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.
//FastButtons, baseado no trabalho original do usuário Racso da Wikipédia em Espanhol,
//traduzido por Macy (Inglês) e HyperBroad (Português).
//<pre>
var pagina =''; var mot=''; var txt=''; var botones=''; var usuario=''; var temporal='';
var result=''; var redirect='';
var sep="|"; var biblio=true;
var ufb = ', usando [[Wikipedia:Software/Scripts/FastButtons|FastButtons]]';
var dire="http://pt.wikipedia.org/w/index.php?title=";
var fin_otro="edit&borrar=otro-";
var fin_aviso="edit&aviso=";
var fin_prod="edit&prod=";
var fin_pemantido="edit&pe=pemantido-";
var vec="http://pt.wikipedia.org/wiki/Wikipedia:Página de testes&action=edit&motivoVEC=";
var textopruebas="Aviso:\n1|(article): Level 1\n2|(article): Level 2\n3|(article): Level 3\n4|(article): Level 4\n4im|(article): Level 4im";
var prodreason="Por favor, informe o motivo para a eliminação:";
var FBpersonales = false; //Configuração pessoal
var FBesr1 = true; //ESR geral
var FBbsre = true; //ESR Biografia sem Relevo Enciclopédico
var FBbanda = true; //ESR Banda
var FBspu= true; //spu
var FBtitulo = true; //títuli
var FBspam = true; //spam
var FBcat = true; //Categoria
var FBpredef = true; //Predefinição
var FBredir = true; //Redirect
var FBrdd = true; //RDD
var FBuser = true; //Página de usuário
var FBpedido = true; //Pedido do criador
var FBdisc = true; //Discussão
var FBotro = true; //Custom CSD
var FBmovedic = true; //Mover para dicionário
var FBpefim = true; //Encerra PE
var FBpema = true; //Removendo aviso PE
var FBpefu = true; //Removendo aviso PE
var FBperd = true; //Removendo aviso PE
var FBpeap = true; //Removendo aviso PE
var FBprod = false; //PROD pages
var FBborrar = false; //Apagar
var FBvec = false; //Denunciar
var FBprotect = false; //Protegida
var FBaviso = false; //Aviso
var FBwelcome = false; //Boas vindas
//Todos os dados estão aqui:
for (i=0; i<wgUserGroups.length; i++)
{ if (wgUserGroups[i] == "sysop") biblio=true; }
for (i=0; i<wgUserGroups.length; i++)
{ if (wgUserGroups[i] == "autoconfirmed") autoconfirmed=true; }
pagina=encodeURI(wgPageName);
if (pagina.match("&"))
{
pagina=pagina.replace("&","%26");
}
dire=dire+pagina+"&action=";
usuario=pagina.split(":")[1];
if (pagina=="Special:Contributions")
{usuario=location.href.substring(location.href.indexOf('Contributions/')+14,location.href.length);}
//</pre>
//<pre>
//Start
if (biblio)
{
tmp='';
if (FBborrar){tmp+= '[<a href='+dire+'delete>apagar!</a>] '; }
if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=yes>proteger</a>] '; }
if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=semi>proteger-ip</a>] '; }
if (tmp!=''){botones = botones + 'Botões para sysop: ' +tmp+'<br>';}
}
tmp='';
/*
if (FBesr1){tmp+= '[<a href='+dire+'edit&esr=esr1>esr</a>] '; }
// Usuário
if( wgNamespaceNumber == 2 || wgNamespaceNumber == 3 ) {
if (FBspu){tmp+= '[<a href='+dire+'edit&borrar=spu>spu</a>] '; }
if (FBuser){tmp+= '[<a href='+dire+'edit&borrar=user>user</a>] '; }
}
// Predefinição
if( wgNamespaceNumber == 10 || wgNamespaceNumber == 11 )
if (FBpredef){tmp+= '[<a href='+dire+'edit&borrar=predef>predef</a>] '; }
// Categoria
if( wgNamespaceNumber == 14 || wgNamespaceNumber == 15 )
if (FBcat){tmp+= '[<a href='+dire+'edit&borrar=cat>cat</a>] '; }
// Discussão
if( wgNamespaceNumber == 1 || wgNamespaceNumber == 3 || wgNamespaceNumber == 5 || wgNamespaceNumber == 7 || wgNamespaceNumber == 9 || wgNamespaceNumber == 11 || wgNamespaceNumber == 13 || wgNamespaceNumber == 15 ) {
if (FBrdd){tmp+= '[<a href='+dire+'edit&borrar=rdd>rdd</a>] '; }
if (FBdisc){tmp+= '[<a href='+dire+'edit&borrar=disc>disc</a>] '; }
}
// Artigo
if( wgNamespaceNumber == 0 ) {
if (FBbanda){tmp+= '[<a href='+dire+'edit&esr=banda>banda</a>] '; }
if (FBbsre){tmp+= '[<a href='+dire+'edit&esr=bsre>bsre</a>] '; }
}
// Geral
if (FBtitulo){tmp+= '[<a href='+dire+'edit&borrar=titulo>titulo</a>] '; }
if (FBspam){tmp+= '[<a href='+dire+'edit&borrar=spam>spam</a>] '; }
if (FBredir){tmp+= '[<a href='+dire+'edit&borrar=redir>redir</a>] '; }
if (FBpedido){tmp+= '[<a href='+dire+'edit&borrar=pedido>pedido</a>] '; }
if (FBmovedic){tmp+= '[<a href='+dire+'edit&borrar=movedic>movedic</a>] '; }
if (FBotro){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + fin_otro +encodeURI(mot) ;"> Outros casos </a>] ';}
if (tmp!='') { botones= botones + 'Eliminação: ' + tmp + '<br>';}
*/
tmp='';
if (FBpefim){tmp+= '[<a href='+dire+'edit&pe=pefim>encerrar</a>] '; }
if (FBpema){tmp+= '[<a href='+dire+'edit&pe=pema>ma</a>] '; }
if (FBperd){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + "edit&pe=perd-" +encodeURI(mot) ;">rd</a>] ';}
if (FBpeap){tmp+= '[<a href='+dire+'delete&wpReason=Eliminado%20em%20vota%E7%E3o>AP</a>] '; }
if (tmp!='') { botones= botones + 'PE: ' + tmp + '<br>';}
tmp='';
//if (tmp!=''){botones = botones + 'Especial: ' +tmp+'<br>';}
/* Botones funcionando */
$(function ()
{
if (document.getElementById('contentSub').innerHTML!='')
{document.getElementById('contentSub').innerHTML+='<br>';}
document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML+ botones;
if (location.href.match("pe=pefim"))
{
var tools = document.getElementById("p-tb") ;
var out = '<li id="t-permalink">' ;
var ot = document.editform.wpTextbox1.value ;
var t = get_linkfixr_text ( ot ) ;
if ( t != ot ) {
out += "<a href='javascript:run_linkfixr();'>Correções</a>" ;
} else {
out += "<span style='color:#888888'>Correções</span>" ;
}
tools = tools.getElementsByTagName("ul")[0] ;
tools.innerHTML += out ;
}
else if (location.href.match("pe=pema"))
{
pe_mantida();
/*
var ot = document.editform.wpTextbox1.value ;
document.getElementById ("wpTextbox1").value=t;
var s = document.editform.wpSummary.value ;
if ( s != "" ) s += "; " ;
s += "PE encerrada: manter" ;
document.editform.wpSummary.value = s ;
document.editform.submit();
*/
}
if (location.href.match("pe=perd"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{destruir")==null) && (txt!=""))
{
var result=''; var redirect='';
result =location.href.substring(location.href.indexOf('perd-')+5, location.href.indexOf('-perd_dest-')) ;
redirect =location.href.substring(location.href.indexOf('-perd_dest-')+11, location.href.length) ;
if (redirect!=null)
{
txt='#Redirecionamento [['+decodeURI(redirect)+']]';
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'PE encerrada: redirecionar para ' + redirect + ' (' + result + ')';
document.editform.submit();
}
}
}
else if (location.href.match("plant=welcome"))
{
txt=document.getElementById("wpTextbox1").value
if (txt.match("{destruir")==null)
{
txt='{{subst:w-basic}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Welcoming user'+ufb;
document.editform.submit();
}
}
else if (location.href.match("rapido=si"))
{
document.getElementById ("wpConfirmB").click();
}
else if (location.href.match("motivoVEC="))
{
var txt2;
var strt="Añade la siguiente solicitud debajo de esta línea.-->";
mot=location.href.substring(location.href.indexOf('motivoVEC=')+10, location.href.length);
txt=document.getElementById("wpTextbox1").value;
txt2=txt.split(strt).join(strt+"\n\n{{subst:vandal|"+decodeURI(mot)+"}} --~~~~");
document.getElementById("wpTextbox1").value=txt2;
document.editform.wpSummary.value = 'Reporting [[Special:Contributions/' + uid + '|' + uid + ']]'+ufb;
document.editform.submit();
}
else if (location.href.match("aviso="))
{
txt=document.getElementById("wpCombobox1").value;
mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length);
txt=txt+'\n\n{{subst:uw-vandalism'+decodeURI(mot)+'}} --~~~~';
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Warning user'+ufb;
document.editform.submit();
}
else if (location.href.match("prod="))
{
txt=document.getElementById("wpTextbox1").value;
mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length);
txt=txt+'{{subst:prod|'+decodeURI(mot)+'}}';
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Warning user'+ufb;
document.editform.submit();
}
});
//</pre>
//Special FastButtons start here
//Edit count FastButton
$(function() {
if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //no subpages or history
return;
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
var username = encodeURIComponent( wgTitle );
var checkurl = "http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user="+ username +"&site=&dbname=ptwiki_p" ;
mw.util.addPortletLink("p-cactions", checkurl, "cde", "ca-contrib", "Ver o número de edições deste utilizador.");
}
});
//Special:Prefixindex FastButton
$(function() {
if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //no subpages or history
return;
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
var username = encodeURIComponent( wgTitle );
var checkurl = wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2" ;
mw.util.addPortletLink("p-cactions", checkurl, "todas as páginas", "ca-contrib", "Ver todas as páginas deste utilizador.");
}
});
/*
function get_linkfixr_text ( ot ) {
var t = ot ;
var ct ;
do {
ct = t ;
t = t.replace(/\{\{Infobox (ator|actor)/, '{{Info/Ator') ;
t = t.split('DEFAULTSORT: ').join('DEFAULTSORT:') ;
} while ( ct != t ) ;
return t ;
}
function retira_apagar2 ( ot ) {
var t = get_linkfixr_text ( ot ) ;
if ( t != ot ) {
document.editform.wpTextbox1.value = t ;
var s = document.editform.wpSummary.value ;
if ( s != "" ) s += "; " ;
s += "ajustes usando [[Usuário:Rjclaudio/teste.js]]" ;
document.editform.wpSummary.value = s ;
}
}
*/
function retira_apagar2 ( ot ) {
t = ot;
t = t.replace(/\{\{[Aa]pagar2\|[^\{\}\n]+\}\}/, '') ;
return t ;
}
function pe_mantida () {
var ot = document.editform.wpTextbox1.value ;
var t = retira_apagar2 ( ot ) ;
if ( t != ot ) {
document.editform.wpTextbox1.value = t ;
var s = document.editform.wpSummary.value ;
if ( s != "" ) s += "; " ;
s += "PE encerrada: mantida (function pe_mantida)" ;
document.editform.wpSummary.value = s ;
document.editform.submit();
}
}