Utilizador:Richard Melo da Silva/FastButtons.js

Origem: Wikcionário, o dicionário livre.
Nota: Após salvar, você terá de limpar a cache do seu navegador para ver as alterações:
  • Internet Explorer: Mantenha pressionada a tecla Ctrl e aperte F5; ou mantenha pressionada a tecla Ctrl e clique no botão "Recarregar" (Reload)
  • Firefox e SeaMonkey: Mantenha pressionada a tecla Shift ⇧ e clique no botão "Recarregar" (Reload ou Atualizar) ou mantenha pressionada a tecla Ctrl e aperte F5; ou mantenha pressionada as teclas Ctrl, Shift ⇧ e R (Command ⌘, Shift ⌥ e R em Macintosh)
  • Safari e Konqueror: Clique no botão "Recarregar" (Reload)
  • Opera: É necessário limpar manualmente a cache no menu "Ferramentas"→"Preferências"→"Avançadas"→"Histórico" e clicar no botão "Esvaziar Já"
  • Chrome: É necessário limpar manualmente a cache no botão "Ferramentas"→"Limpar dados de navegação", selecione "Esvaziar o cache" e clicar no botão "Limpar dados de navegação"
//FastButtons, baseado no trabalho original do usuário Racso da Wikipédia em Espanhol,
//traduzido por Macy (Inglês), HyperBroad (Português), e adaptado para Wikcionário por Richard Melo da Silva.

//<pre>
var pagina =''; var mot=''; var txt=''; var botones=''; var usuario=''; var temporal='';
var sep="|"; var biblio=true;
var ufb = ', usando [[Usuário:Richard Melo da Silva/FastButtons|FastButtons]]';
var dire="http://pt.wiktionary.org/w/index.php?title=";
var fin_otro="edit&borrar=otro-";
var fin_aviso="edit&aviso=";
var fin_prod="edit&prod=";
var vec="http://pt.wiktionary.org/wiki/Wikicionário: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 FBpruebas= true;	//spu
var FBblanco = true;	//website
var FBne = true;	//absurdo
var FBabd = true;       //absurdo para dicionário
var FBinfra = true;	//spam
var FBautopromo = true;	//Promotional
var FBotro = true;	//Custom CSD
var FBcommons = true;	//NowCommons
var FBimfu = false;	//No fair use rationale
var FBprod = false;	//PROD pages
var FBwikify = true;    //Wikifcar
var FBunref = true;	//sem fontes
var FBcleanup = true;	//reciclagem
var FBnpov = true;	//inexistente
var FBborrar = false;	//Apagar
var FBvec = false;	//Denunciar
var FBprotect = false;	//Protegida
var FBaviso = false;	//Aviso
var FBwelcome = true;	//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>';}
}
 
if (biblio===true)
if (autoconfirmed===true)
{
	tmp='';
 
	if (FBpruebas){tmp+= '[<a href='+dire+'edit&borrar=blanco>spu</a>] '; }
	if (FBblanco){tmp+= '[<a href='+dire+'edit&borrar=pruebas>website</a>] '; }
	if (FBne){tmp+= '[<a href='+dire+'edit&borrar=NE>absurdo</a>] '; }
        if (FBabd){tmp+= '[<a href='+dire+'edit&borrar=abd>absurdo para dicionário</a>] '; }
	if (FBinfra){tmp+= '[<a href='+dire+'edit&borrar=infra>spam</a>] '; }
	if (FBautopromo){tmp+= '[<a href='+dire+'edit&borrar=autopromo>impróprio/lixo</a>] '; }
	if( wgNamespaceNumber ==  6 )
	if (FBimfu){tmp+= '[<a href='+dire+'edit&borrar=norat>no fair use</a>] '; }
	if( wgNamespaceNumber ==  6 )
	if (FBcommons){tmp+= '[<a href='+dire+'edit&borrar=commons>commons</a>] '; }
	if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
	if (FBprod){tmp+='[<a onclick="mot=prompt(prodreason);location.href=dire + fin_prod +encodeURI(mot) ;">PROD</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( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBwikify){tmp+= '[<a href='+dire+'edit&plant=wikify>wikificar</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBunref){tmp+= '[<a href='+dire+'edit&plant=unref>sem fontes</a>] '; } 
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBcleanup){tmp+= '[<a href='+dire+'edit&plant=cleanup>reciclagem</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBnpov){tmp+= '[<a href='+dire+'edit&plant=npov>inexistente</a>] '; }
 
if (tmp!=''){botones = botones + 'Manutenção: ' +tmp+'<br>';}
 
 
tmp='';
 
if( wgNamespaceNumber ==  3 )
if (FBaviso){tmp+='[<a onclick="mot=prompt(textopruebas);location.href=dire + fin_aviso +encodeURI(mot) ;">warn user</a>] ';}
if( wgNamespaceNumber ==  2 || wgNamespaceNumber == 3 )
{
if (FBvec){tmp+= '[<a onclick=";mot=prompt(\n/Informe o motivo abaixo/);location.href=vec + usuario + sep + mot;">AIV report</a>] ';}
}
if( wgNamespaceNumber ==  3 )
if (FBcedit){tmp+= '[<a href='+dire+'edit&plant=welcome>Dar Boas-vindas</a>] '; }

//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("borrar=blanco")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if (txt.match("{destruir")==null)
	{
		txt= '{{ER|01|~~~~}}<!--\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 01)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=pruebas")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|02|~~~~}}<!--\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 02)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=NE")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|03|~~~~}}<!--\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 03)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=abd")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|04|~~~~}}<!--\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 04)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=infra")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|06|~~~~}}<!--\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 06)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=autopromo"))
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==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=otro")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		mot=location.href.substring(location.href.indexOf('otro-')+5, 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("borrar=norat")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|14|2=~~~~}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Proposta para eliminação rápida (regra 14)'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("borrar=commons")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{ER|12|2=~~~~}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Proposta para eliminação rápida:'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("protected=yes")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página protegida'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("protected=semi")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página protegida contra IPs'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("plant=wikify")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==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=unref")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{sem-fontes|data={{subst:CURRENTMONTHNAME}} de {{subst:CURRENTYEAR}}}}\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=cleanup")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{reciclagem|data={{subst:CURRENTMONTHNAME}} de {{subst:CURRENTYEAR}}}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página marcada para reciclagem'+ufb;
		document.editform.wpSave.click();
	}
}
 
 
else if (location.href.match("plant=npov")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{inexistente}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Verbete suspeito de inexistência'+ufb;
		document.editform.wpSave.click();
	}
}
 

else if (location.href.match("plant=welcome")) 
{
	txt=document.getElementById("wpTextbox1").value
	if (txt.match("{destruir")==null)
	{
		txt='{{subst:bv}} ~~~~\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Boas Vindas'+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=ptwiktionary_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.");
 
  }
});