MediaWiki:Gadget-fastbuttons.js: Difference between revisions
Content added Content deleted
AlvaroMolina (talk | contribs) (Test Gadget) |
(resolve general errors and depreciation) |
||
Line 41: | Line 41: | ||
var FBBVIP = true; //Boas vindas ao IP |
var FBBVIP = true; //Boas vindas ao IP |
||
var userGroups = mw.config.get('wgUserGroups'); |
|||
//Todos os dados estão aqui: |
//Todos os dados estão aqui: |
||
for (i=0; i< |
for (i=0; i<userGroups.length; i++) |
||
{ |
|||
if (userGroups[i] == "sysop") sysop=true; |
|||
⚫ | |||
for (i=0; i<wgUserGroups.length; i++) |
|||
} |
|||
⚫ | |||
var pageName = mw.config.get('wgPageName'); |
|||
pagina=encodeURI(pageName); |
|||
if (pagina.match("&")) |
if (pagina.match("&")) |
||
{ |
{ |
||
Line 73: | Line 75: | ||
if (FBProteger){tmp+= '[<a href='+dire+'edit&protected=semi>Proteger-ip</a>] '; } |
if (FBProteger){tmp+= '[<a href='+dire+'edit&protected=semi>Proteger-ip</a>] '; } |
||
if (tmp!=''){botoes = botoes + 'Botões para administradores: ' +tmp+'<br>';} |
if (tmp!==''){botoes = botoes + 'Botões para administradores: ' +tmp+'<br>';} |
||
} |
} |
||
var ns = mw.config.get('wgNamespaceNumber'); |
|||
if (sysop===false) |
if (sysop===false) |
||
if (autoconfirmed===true) |
if (autoconfirmed===true) |
||
Line 81: | Line 84: | ||
tmp=''; |
tmp=''; |
||
//Eliminação |
//Eliminação |
||
if( |
if( ns == 2 || ns == 3 ) |
||
if (FBSub){tmp+= '[<a href='+dire+'edit&borrar=Sub>Subpágina</a>] '; } |
if (FBSub){tmp+= '[<a href='+dire+'edit&borrar=Sub>Subpágina</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBSite){tmp+= '[<a href='+dire+'edit&borrar=Site>Website</a>] '; } |
if (FBSite){tmp+= '[<a href='+dire+'edit&borrar=Site>Website</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBAbsurdo){tmp+= '[<a href='+dire+'edit&borrar=Absurdo>Título absurdo</a>] '; } |
if (FBAbsurdo){tmp+= '[<a href='+dire+'edit&borrar=Absurdo>Título absurdo</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBRecorrente){tmp+= '[<a href='+dire+'edit&borrar=Recorrente>Aparecimento recorrente</a>] '; } |
if (FBRecorrente){tmp+= '[<a href='+dire+'edit&borrar=Recorrente>Aparecimento recorrente</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBSpam){tmp+= '[<a href='+dire+'edit&borrar=Spam>Spam</a>] '; } |
if (FBSpam){tmp+= '[<a href='+dire+'edit&borrar=Spam>Spam</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBEngano){tmp+= '[<a href='+dire+'edit&borrar=Engano>Engano</a>] '; } |
if (FBEngano){tmp+= '[<a href='+dire+'edit&borrar=Engano>Engano</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBTemp){tmp+= '[<a href='+dire+'edit&borrar=Temp>Temporário</a>] '; } |
if (FBTemp){tmp+= '[<a href='+dire+'edit&borrar=Temp>Temporário</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBRedirect){tmp+= '[<a href='+dire+'edit&borrar=Redirect>Redirect</a>] '; } |
if (FBRedirect){tmp+= '[<a href='+dire+'edit&borrar=Redirect>Redirect</a>] '; } |
||
if( |
if( ns == 2 || ns == 3 || ns == 4 || ns == 5 || ns == 6 || ns == 7 || ns == 8 || ns == 9 || ns == 10 || ns == 11 || ns == 12 || ns == 13 || ns == 14 || ns == 15 || ns == 100 || ns == 101 ) |
||
if (FBErrado){tmp+= '[<a href='+dire+'edit&borrar=Errado>Domínio inexistente</a>] '; } |
if (FBErrado){tmp+= '[<a href='+dire+'edit&borrar=Errado>Domínio inexistente</a>] '; } |
||
if( |
if( ns == 6 ) |
||
if (FBImagens){tmp+= '[<a href='+dire+'edit&borrar=Imagens>Imagem</a>] '; } |
if (FBImagens){tmp+= '[<a href='+dire+'edit&borrar=Imagens>Imagem</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBVDA){tmp+= '[<a href='+dire+'edit&borrar=VDA>VDA</a>] '; } |
if (FBVDA){tmp+= '[<a href='+dire+'edit&borrar=VDA>VDA</a>] '; } |
||
if( |
if( ns == 6 ) |
||
if (FBDuplicado){tmp+= '[<a href='+dire+'edit&borrar=Duplicado>Imagem duplicada</a>] '; } |
if (FBDuplicado){tmp+= '[<a href='+dire+'edit&borrar=Duplicado>Imagem duplicada</a>] '; } |
||
if( |
if( ns == 1 || ns == 3 || ns == 5 || ns == 7 || ns == 9 || ns == 11 ||ns == 13 || ns == 15 || ns == 101 ) |
||
if (FBTalk){tmp+= '[<a href='+dire+'edit&borrar=Talk>Discussão</a>] '; } |
if (FBTalk){tmp+= '[<a href='+dire+'edit&borrar=Talk>Discussão</a>] '; } |
||
if( |
if( ns === 0 || ns == 1 || ns == 2 || ns == 3 || ns == 4 || ns == 5 || ns == 6 || ns == 7 || ns == 8 || ns == 9 || ns == 10 || ns == 11 || ns == 12 || ns == 13 || ns == 14 || ns == 15 || ns == 100 || ns == 101 ) |
||
if (FBImproprio){tmp+= '[<a href='+dire+'edit&borrar=Improprio>Impróprio</a>] '; } |
if (FBImproprio){tmp+= '[<a href='+dire+'edit&borrar=Improprio>Impróprio</a>] '; } |
||
if( |
if( ns === 0 ) |
||
if (FBOutro){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + fin_outro +encodeURI(mot) ;">Outro motivo</a>] ';} |
if (FBOutro){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + fin_outro +encodeURI(mot) ;">Outro motivo</a>] ';} |
||
Line 119: | Line 122: | ||
tmp=''; |
tmp=''; |
||
//Manutenção |
//Manutenção |
||
if( |
if( ns === 0 || ns == 1 ) |
||
if (FBWikificar){tmp+= '[<a href='+dire+'edit&plant=Wikificar>Wikificar</a>] '; } |
if (FBWikificar){tmp+= '[<a href='+dire+'edit&plant=Wikificar>Wikificar</a>] '; } |
||
if( |
if( ns === 0 || ns == 1 ) |
||
if (FBSemRef){tmp+= '[<a href='+dire+'edit&plant=SemRef>Sem fontes</a>] '; } |
if (FBSemRef){tmp+= '[<a href='+dire+'edit&plant=SemRef>Sem fontes</a>] '; } |
||
if( |
if( ns === 0 || ns == 1 ) |
||
if (FBReciclagem){tmp+= '[<a href='+dire+'edit&plant=Reciclagem>Reciclar</a>] '; } |
if (FBReciclagem){tmp+= '[<a href='+dire+'edit&plant=Reciclagem>Reciclar</a>] '; } |
||
if( |
if( ns === 0 || ns == 1 ) |
||
if (FBPOV){tmp+= '[<a href='+dire+'edit&plant=POV>Parcial</a>] '; } |
if (FBPOV){tmp+= '[<a href='+dire+'edit&plant=POV>Parcial</a>] '; } |
||
Line 132: | Line 135: | ||
tmp=''; |
tmp=''; |
||
//Botões exclusivos para página de discussão do usuário |
//Botões exclusivos para página de discussão do usuário |
||
if( |
if( ns == 3 ) |
||
if (FBAviso){tmp+= '[<a onclick="mot=prompt(/Página:/);location.href=dire + fin_aviso +encodeURI(mot) ;">Avisar usuário</a>] ';} |
if (FBAviso){tmp+= '[<a onclick="mot=prompt(/Página:/);location.href=dire + fin_aviso +encodeURI(mot) ;">Avisar usuário</a>] ';} |
||
if( |
if( ns == 3 ) |
||
if (FBBoasVindas){tmp+= '[<a href='+dire+'edit&plant=BoasVindas>Boas-vindas</a>] '; } |
if (FBBoasVindas){tmp+= '[<a href='+dire+'edit&plant=BoasVindas>Boas-vindas</a>] '; } |
||
if( |
if( ns == 3 ) |
||
if (FBBVIP){tmp+= '[<a href='+dire+'edit&plant=BVIP>Boas-vindas IP</a>] '; } |
if (FBBVIP){tmp+= '[<a href='+dire+'edit&plant=BVIP>Boas-vindas IP</a>] '; } |
||
if (tmp!=''){botoes = botoes + 'Especial: ' +tmp+'<br>';} |
if (tmp!==''){botoes = botoes + 'Especial: ' +tmp+'<br>';} |
||
Line 432: | Line 435: | ||
//Contador de edições |
//Contador de edições |
||
addOnloadHook(function() { |
addOnloadHook(function() { |
||
var title = mw.config.get('wgTitle'); |
|||
⚫ | |||
var cNs = mw.config.get('wgCanonicalNamespace'); |
|||
⚫ | |||
return; |
return; |
||
if ( |
if (cNs == "User" || cNs == "User_talk") { |
||
var username = encodeURIComponent( |
var username = encodeURIComponent( title ); |
||
var checkurl = "https://tools.wmflabs.org/xtools-ec/?user="+ username +"&lang=pt&wiki=wikinews" ; |
var checkurl = "https://tools.wmflabs.org/xtools-ec/?user="+ username +"&lang=pt&wiki=wikinews" ; |
||
addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "Veja as contribuições deste usuário"); |
mw.util.addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "Veja as contribuições deste usuário"); |
||
} |
} |
||
Line 445: | Line 450: | ||
//Especial:Índice por prefixo |
//Especial:Índice por prefixo |
||
addOnloadHook(function() { |
addOnloadHook(function() { |
||
var title = mw.config.get('wgTitle'); |
|||
⚫ | |||
var cNs = mw.config.get('wgCanonicalNamespace'); |
|||
var server = mw.config.get('wgServer'); |
|||
⚫ | |||
return; |
return; |
||
if ( |
if (cNs == "User" || cNs == "User_talk") { |
||
var username = encodeURIComponent( |
var username = encodeURIComponent( title ); |
||
var checkurl = |
var checkurl = server + "/w/index.php?title=Especial:Índice_por_prefixo&from=" + username + "&namespace=2" ; |
||
addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "Lista de páginas criadas por este usuário"); |
mw.util.addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "Lista de páginas criadas por este usuário"); |
||
} |
} |
Latest revision as of 02:31, 12 August 2017
/*FastButtons, baseado no trabalho original do [[w:es:Usuario:Racso]] da Wikipédia em espanhol
e das adaptações do [[w:en:User:Macy/FastButtons.js]] da Wikipédia em inglês e do [[Utilizador:Vitorbraziledit~ptwikinews/FastButtons.js]] do Wikinotícias em português.
Última atualização: 01/08/2017 às 01:46 (UTC)
*/
//<pre>
//Variáveis gerais
var pagina =''; var mot=''; var txt=''; var botoes=''; var usuario=''; var temporal='';
var sep="|"; var sysop=false;
var ufb = ', usando [[WN:FB|FastButtons]]';
var dire="http://" + location.hostname + "/w/index.php?title=";
var fin_outro="edit&borrar=outro-";
var fin_aviso="edit§ion=new&aviso=";
var texto="Página:";
var FBpessoal = false; //Configuração pessoal
//Variáveis para eliminação
var FBSub= true; //Subpáginas de usuário
var FBSite = true; //Endereços de websites no título
var FBAbsurdo = true; //Títulos absurdos, conteúdo movido para...
var FBRecorrente = true; //Aparecimento recorrente (se o conteúdo for igual ao eliminado por votação)
var FBSpam = true; //Página cujo título ou único conteúdo é um anúncio
var FBEngano = true; //Próprio criador reconhece que se enganou
var FBTemp = true; //Eliminações temporárias sem perda de histórico para resolver problemas técnicos (somente admin)
var FBRedirect = true; //Eliminar redirect, página sem histórico relevante (mover página atual redirect para cá)
var FBErrado = true; //Namespaces que não existem (Wikinoticias, Ajuda)
var FBImagens = true; //Imagens, somente por quem a carregou
var FBVDA = true; //Violação de Direitos Autorais
var FBDuplicado = true; //Ficheiros (arquivos) duplicados (ex. {{NowCommons1}} ou {{NowCommons|nome do ficheiro}})
var FBTalk = true; //Discussão cujos notícias não existem (para todos os domínios)
var FBImproprio = true; //Lixo e impróprio
var FBOutro = true; //Outro motivo
//Variáveis para manutenção
var FBWikificar = true; //Wkificar
var FBSemRef = true; //Sem fontes
var FBReciclagem = true; //Reciclagem
var FBPOV = true; //Parcial
var FBApagar = false; //Apagar
var FBProteger = false; //Proteger
var FBAviso = true; //Aviso
var FBBoasVindas = true; //Boas vindas
var FBBVIP = true; //Boas vindas ao IP
var userGroups = mw.config.get('wgUserGroups');
//Todos os dados estão aqui:
for (i=0; i<userGroups.length; i++)
{
if (userGroups[i] == "sysop") sysop=true;
if (userGroups[i] == "autoconfirmed") autoconfirmed=true;
}
var pageName = mw.config.get('wgPageName');
pagina=encodeURI(pageName);
if (pagina.match("&"))
{
pagina=pagina.replace("&","%26");
}
dire=dire+pagina+"&action=";
usuario=pagina.split(":")[1];
if (pagina=="Especial:Contribuições")
{usuario=location.href.substring(location.href.indexOf('Contribuições/')+14,location.href.length);}
//</pre>
//<pre>
//Início
if (sysop)
{
tmp='';
if (FBApagar){tmp+= '[<a href='+dire+'delete>Apagar</a>] '; }
if (FBProteger){tmp+= '[<a href='+dire+'edit&protected=yes>Proteger</a>] '; }
if (FBProteger){tmp+= '[<a href='+dire+'edit&protected=semi>Proteger-ip</a>] '; }
if (tmp!==''){botoes = botoes + 'Botões para administradores: ' +tmp+'<br>';}
}
var ns = mw.config.get('wgNamespaceNumber');
if (sysop===false)
if (autoconfirmed===true)
{
tmp='';
//Eliminação
if( ns == 2 || ns == 3 )
if (FBSub){tmp+= '[<a href='+dire+'edit&borrar=Sub>Subpágina</a>] '; }
if( ns === 0 )
if (FBSite){tmp+= '[<a href='+dire+'edit&borrar=Site>Website</a>] '; }
if( ns === 0 )
if (FBAbsurdo){tmp+= '[<a href='+dire+'edit&borrar=Absurdo>Título absurdo</a>] '; }
if( ns === 0 )
if (FBRecorrente){tmp+= '[<a href='+dire+'edit&borrar=Recorrente>Aparecimento recorrente</a>] '; }
if( ns === 0 )
if (FBSpam){tmp+= '[<a href='+dire+'edit&borrar=Spam>Spam</a>] '; }
if( ns === 0 )
if (FBEngano){tmp+= '[<a href='+dire+'edit&borrar=Engano>Engano</a>] '; }
if( ns === 0 )
if (FBTemp){tmp+= '[<a href='+dire+'edit&borrar=Temp>Temporário</a>] '; }
if( ns === 0 )
if (FBRedirect){tmp+= '[<a href='+dire+'edit&borrar=Redirect>Redirect</a>] '; }
if( ns == 2 || ns == 3 || ns == 4 || ns == 5 || ns == 6 || ns == 7 || ns == 8 || ns == 9 || ns == 10 || ns == 11 || ns == 12 || ns == 13 || ns == 14 || ns == 15 || ns == 100 || ns == 101 )
if (FBErrado){tmp+= '[<a href='+dire+'edit&borrar=Errado>Domínio inexistente</a>] '; }
if( ns == 6 )
if (FBImagens){tmp+= '[<a href='+dire+'edit&borrar=Imagens>Imagem</a>] '; }
if( ns === 0 )
if (FBVDA){tmp+= '[<a href='+dire+'edit&borrar=VDA>VDA</a>] '; }
if( ns == 6 )
if (FBDuplicado){tmp+= '[<a href='+dire+'edit&borrar=Duplicado>Imagem duplicada</a>] '; }
if( ns == 1 || ns == 3 || ns == 5 || ns == 7 || ns == 9 || ns == 11 ||ns == 13 || ns == 15 || ns == 101 )
if (FBTalk){tmp+= '[<a href='+dire+'edit&borrar=Talk>Discussão</a>] '; }
if( ns === 0 || ns == 1 || ns == 2 || ns == 3 || ns == 4 || ns == 5 || ns == 6 || ns == 7 || ns == 8 || ns == 9 || ns == 10 || ns == 11 || ns == 12 || ns == 13 || ns == 14 || ns == 15 || ns == 100 || ns == 101 )
if (FBImproprio){tmp+= '[<a href='+dire+'edit&borrar=Improprio>Impróprio</a>] '; }
if( ns === 0 )
if (FBOutro){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + fin_outro +encodeURI(mot) ;">Outro motivo</a>] ';}
if (tmp!='') { botoes= botoes + 'Eliminação: ' + tmp + '<br>';}
}
tmp='';
//Manutenção
if( ns === 0 || ns == 1 )
if (FBWikificar){tmp+= '[<a href='+dire+'edit&plant=Wikificar>Wikificar</a>] '; }
if( ns === 0 || ns == 1 )
if (FBSemRef){tmp+= '[<a href='+dire+'edit&plant=SemRef>Sem fontes</a>] '; }
if( ns === 0 || ns == 1 )
if (FBReciclagem){tmp+= '[<a href='+dire+'edit&plant=Reciclagem>Reciclar</a>] '; }
if( ns === 0 || ns == 1 )
if (FBPOV){tmp+= '[<a href='+dire+'edit&plant=POV>Parcial</a>] '; }
if (tmp!=''){botoes = botoes + 'Manutenção: ' +tmp+'<br>';}
tmp='';
//Botões exclusivos para página de discussão do usuário
if( ns == 3 )
if (FBAviso){tmp+= '[<a onclick="mot=prompt(/Página:/);location.href=dire + fin_aviso +encodeURI(mot) ;">Avisar usuário</a>] ';}
if( ns == 3 )
if (FBBoasVindas){tmp+= '[<a href='+dire+'edit&plant=BoasVindas>Boas-vindas</a>] '; }
if( ns == 3 )
if (FBBVIP){tmp+= '[<a href='+dire+'edit&plant=BVIP>Boas-vindas IP</a>] '; }
if (tmp!==''){botoes = botoes + 'Especial: ' +tmp+'<br>';}
/* Botões funcionando */
addOnloadHook(function ()
{
if (document.getElementById('contentSub').innerHTML!='')
{document.getElementById('contentSub').innerHTML+='<br>';}
document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML+ botoes;
if (location.href.match("borrar=Sub"))
{
txt=document.getElementById("wpTextbox1").value;
if (txt.match("{ER")==null)
{
txt= '{{ER|1|~~~~}}\n' + txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 1)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Site"))
{
txt=document.getElementById("wpTextbox1").value;
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|2|~~~~}}\n' + txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 2)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Absurdo"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|3|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 3)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Recorrente"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|5|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 5)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Spam"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|6|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 6)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Engano"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|7|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 7)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Temp"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|8|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 8)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Redirect"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|9|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 9)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Errado"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|10|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 10)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Imagens"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|12|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 12)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=VDA"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|13|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 13)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Duplicado"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|14|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 14)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Talk"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|18|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 18)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=Improprio"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
txt= '{{ER|20|~~~~}}\n' + txt
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 20)'+ufb;
document.editform.submit();
}
}
else if (location.href.match("borrar=outro"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{ER")==null) && (txt!=""))
{
mot=location.href.substring(location.href.indexOf('outro-')+6, location.href.length)
if (mot!=null)
{
txt='{{ER|1=0|2=~~~~|3='+decodeURI(mot)+'}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página proposta para eliminação rápida'+ufb;
document.editform.submit();
}
}
}
else if (location.href.match("plant=Wikificar"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{Wkf")==null) && (txt!=""))
{
txt='{{subst:wkf}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página marcada para wikificar'+ufb;
document.editform.submit();
}
}
else if (location.href.match("plant=SemRef"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{Sem referências")==null) && (txt!=""))
{
txt='{{Sem referências}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página marcada como sem fontes'+ufb;
document.editform.submit();
}
}
else if (location.href.match("plant=Reciclagem"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{Reciclagem")==null) && (txt!=""))
{
txt='{{Reciclagem}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página marcada para reciclagem'+ufb;
document.editform.submit();
}
}
else if (location.href.match("plant=POV"))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{Parcial")==null) && (txt!=""))
{
txt='{{Parcial}}\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Página marcada como parcial'+ufb;
document.editform.submit();
}
}
else if (location.href.match("aviso="))
{
txt=document.getElementById("wpTextbox1").value
if ((txt.match("{Pare")==null) && (txt!=""))
{
mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length)
if (mot!=null)
{
txt='{{subst:Pare|1='+decodeURI(mot)+'}}~~~~\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Avisando usuário'+ufb;
document.editform.submit();
}
}
}
else if (location.href.match("plant=BoasVindas"))
{
txt=document.getElementById("wpTextbox1").value
if (txt.match("{Bv")==null)
{
txt='{{subst:Bv}} ~~~~\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Dando boas-vindas ao utilizador'+ufb;
document.editform.submit();
}
}
else if (location.href.match("plant=BVIP"))
{
txt=document.getElementById("wpTextbox1").value
if (txt.match("{Bv-ip")==null)
{
txt='{{subst:Bv-ip}} ~~~~\n'+txt;
document.getElementById ("wpTextbox1").value=txt;
document.editform.wpSummary.value = 'Dando boas-vindas ao utilizador anônimo'+ufb;
document.editform.submit();
}
}
});
//</pre>
//Botões especiais
//Contador de edições
addOnloadHook(function() {
var title = mw.config.get('wgTitle');
var cNs = mw.config.get('wgCanonicalNamespace');
if (title.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //sem subpáginas ou histórico
return;
if (cNs == "User" || cNs == "User_talk") {
var username = encodeURIComponent( title );
var checkurl = "https://tools.wmflabs.org/xtools-ec/?user="+ username +"&lang=pt&wiki=wikinews" ;
mw.util.addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "Veja as contribuições deste usuário");
}
});
//Especial:Índice por prefixo
addOnloadHook(function() {
var title = mw.config.get('wgTitle');
var cNs = mw.config.get('wgCanonicalNamespace');
var server = mw.config.get('wgServer');
if (title.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //sem subpáginas ou histórico
return;
if (cNs == "User" || cNs == "User_talk") {
var username = encodeURIComponent( title );
var checkurl = server + "/w/index.php?title=Especial:Índice_por_prefixo&from=" + username + "&namespace=2" ;
mw.util.addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "Lista de páginas criadas por este usuário");
}
});