User:Aleposta/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<pre><nowiki>
//Personalizada por Alhen a partir de la de Orgullomoore que fue personalizada a partir de la de Sanbec que fue personalizada a partir de la de Comae
//El módulo de marcadores lo elimino, pues me daba problemas y no sabía su utilidad
//Agrego botones, los quito, los modifico, estoy aprendiendo
 
// incluir parser wiki
document.write('<script type="text/javascript" src="/w/index.php?title=Usuario:Pilaf/wikicode.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
//incluir parser MediaWiki:Quick-delete [[MediaWiki:Quick-delete.js]]
document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:Quick-delete.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<'+'script src="http://es.wikipedia.org/w/index.php?' 
+  'title=User:Ezarate/monobook.js'
+  '&action=raw&ctype=text/javascript&dontcountme=s"' 
+  'type="text/javascript"><'+'/script>');
 
 
//Quito el livepreview
function Main()
{
 //LivePreviewInstall();
}
 
function pluginRun()
{
//Cargar todos los plugins
for (i=0;i<plugin.length;i++)
{
 plugin[i]();
}
}
 
window.onload=function(){
Main();
pluginRun();
}
 
var wpUserName = 'Alhen';
 
/************ Módulo botonera flotante **************/
function botoneraFlotante()
{
var botones='<style type="text/css">\n .botón { background-color:white;border:1px solid #e1eAee; width:20px; height:18px; float:left; font-size:80%; padding:0px; line-height:1.7 }\n .botónbusca {border:1px solid #e1eAee; text-decoration:none;}\n</style> <div class="botonera" style="position:fixed; bottom:100px; left:120px; z-index:3; font-size:13px; font-weight:900; text-align:center; width:45px; float:right">';
 
//modifica "bottom" y "left" para cambiar la ubicación de los botones
 
if (document.getElementById("editform")!=null) {
//Estos botones no se muestran si no se está editando:
 
//-----------------------------
botones+=creaBotón("Save", "<div style=\"background-color:#4169E1;color:#87CEFA\">S</div>", "javascript:save()","");
botones+=creaBotón("Preview", "<div style=\"background-color:#4169E1;color:#87CEFA\">P</div>", "javascript:preview()","");
//--------------------------------
 
botones+=creaBotón("Welcome", "W", "javascript:welcome()", "");
botones+=creaBotón("Welcome ip", "Wes", "javascript:welcomes()", "");
//------------------------------------------------------------
botones+=creaBotón("Commons template", "<div style=\"background-color:#F0FFF0 \">CT</div>", "javascript:commons()","");
//------------
botones+=creaBotón("Audio", "<div style=\"background-color:#F0FFF0 \">A</div>", "javascript:audio()","");
 
//------------------------
botones+=creaBotón("My sign","<img src=http://es.wikipedia.org/style/images/button_sig.png>", "javascript:Firma()", "padding:0; width:20px; height:18px; ");
botones+=creaBotón("WEI", "<code style=\"background:yellow\">:\)</code>", "javascript:ponWEI()", "background:yellow");
//------------
botones+=creaBotón("Redirección", "—>", "javascript:Redirect()", "");
botones+=creaBotón("Categorize", "CAT:", "javascript:category()","");
//--------------------------------------
botones+=creaBotón("Categorize", "nsd:", "javascript:nsd()","");
botones+=creaBotón("Categorize", "nld", "javascript:nld()","");
//------------
 
//------------ 
botones+=creaBotón("Image sintax", "<div style=\"background-color:#ffc700 \">NS</div>", "javascript:ns()", "");
botones+=creaBotón("Image sintax", "<div style=\"background-color:#ffc700 \">Cv</div>", "javascript:copyvionote()", "");
//-------------------------------
botones+=creaBotón("Image sintax", "<div style=\"background-color:#FFFAF0 \">[I]</div>", "javascript:images()", "");
botones+=creaBotón("Wikipedia par", "<div style=\"background-color:#e1eAee \">[WP]</div>", "javascript:wikipediapar()", "");
//botones+=creaBotón("Usuario", "U", "javascript:Usuario()", "");botones+=creaBotón("Usuario //Discusión", "UD", "javascript:Discusion()", "");
//------------
}
 
/**********   botones cuando nó se está editando **********************************************/
 
else {
botones+=creaBotón("Café", ":D", "http://commons.wikimedia.org/wiki/Commons:Caf%C3%A9", "");
botones+=creaBotón("Commons tools", "<div style=\"background-color:#eee1ea\">T</div>", "http://commons.wikimedia.org/wiki/Commons:Tools", "");
botones+=creaBotón("Announcements", "A", "http://en.wiktionary.org/w/index.php?title=Wiktionary:Announcements", "");
botones+=creaBotón("Featured articles, Landscapes", "<div style=\"background-color:#ffc700 \">L</div>", "http://commons.wikimedia.org/wiki/Commons:Featured_pictures/Places/Natural", "");
}
 
 
botones+='</div>'
<!--var toolbox = document.getElementById("contentTop");-->
var toolbox = document.getElementById("column-one");
toolbox.innerHTML += botones;
}
 
function creaBotón(title, texto, destino, estilo)
{
  return '<a href="'+destino+'" style="text-decoration:none"><div class="botón" style="'+estilo+'" title="'+title+'">'+texto+'</div></a>';
}
 
 
function save()
{
document.editform.submit();//equivale a darle al botón de grabar la página, me queda más cerca :D
}
 
function preview()
{
document.editform.wpPreview.click();//equivale a darle al botón de previsualizar, gracias Platónides 
}
 
function welcome()
{insertTags('{'+'{subst:welcome}}','','');
document.editform.wpSummary.value='Welcome user';
}
 
function welcomes()
{insertTags('{'+'{subst:welcome/es}}' ,'','');
document.editform.wpSummary.value='Welcome ip user';
}
 
function welcomep()
{insertTags('{'+'{pediawelcome}}'+'-~'+'~~','','~' ,'','');
document.editform.wpSummary.value='Welcome user';
}
 
function pronun()
{insertTags('===Pronunciation==='+'\n'+'*{'+'{audio|'+'en-us-{'+'{subst:'+'PAGENAME}}'+'.ogg|Audio (US)}}','','' ,'','');
}
function audio()
{insertTags('*{'+'{audio|'+'en-us-{'+'{subst:'+'PAGENAME}}'+'.ogg|Audio (US)}}','','' ,'','');
}
 
function commons()
{
Qr='';
if(!Qr){void(Qr=prompt('name for categorization:',''));}
if(Qr)insertTags('== Summary =='+'\n'+'[[Category:Spanish pronunciation|'+Qr+']]'+'\n'+'Pronunciation of the term in US English, recorded by [[User:Alhen|Alhen]], {'+'{subst:CURRENTDAY}}|'+'{'+'{subst:CURRENTMONTHNAME}}|'+'{'+'{subst:CURRENTYEAR}}'+'\n'+'== Licensing =='+'\n'+'{'+'{self2|GFDL|cc-by-sa-2.5,2.0,1.0}}','','');
}
 
function nsd()
{Qr='';
 if(!Qr){void(Qr=prompt('Country code (optional) '));}
 if(Qr){Qr='/'+Qr;}
 insertTags('{{subst:nsd'+Qr+'}}' ,'','');
 document.editform.wpSummary.value='No source provided';
}
 
function nld()
{Qr='';
 if(!Qr){void(Qr=prompt('Country code (optional) '));}
 if(Qr){Qr='/'+Qr;}
 insertTags('{{subst:nld'+Qr+'}}' ,'','');
 document.editform.wpSummary.value='No license provided';
}
 
function ns()
{Qr='';
 Qs='';
 if(!Qr){
    void(Qr=prompt('Country code (optional) '));
    void(Qs=prompt('Image name '));}
 if(Qr){Qr='/'+Qr;}
 insertTags('{{subst:image source'+Qr+'|'+Qs+'}}'+'~~'+'~~','','');
}
 
function copyvionote()
{Qr='';
 Qs='';
 if(!Qr){
    void(Qr=prompt('Country code (optional) '));
    void(Qs=prompt('Image name '));}
 if(Qr){Qr='/'+Qr;}
 insertTags('{{subst:copyvionote'+Qr+'|'+Qs+'}}'+'~~'+'~~','','');
 document.editform.wpSummary.value='Notification';
}
 
function images()
{
Qr='';
Qs='';
if(!Qr){void(Qr=prompt('Complete name of the image Ex: Image:Foo.jpg',''));}
if(!Qs){void(Qs=prompt('Caption',''));}
if(Qr)insertTags('[[' + Qr + '|thumb|300px|right|'+ Qs +']]','','');
}
 
function wikipediapar()
{
Qr='';
if(!Qr){void(Qr=prompt('Wikipedia par name',''));}
if(Qr){insertTags('{'+'{wikipediapar|'+Qr+'}}' ,'','');}
 else {insertTags('{'+'{wikipediapar}}' ,'','');}
}
 
//    * For Spanish entries
function spanishe()
{insertTags('==Spanish=='+'\n\'\'\''+'{{'+'subst:PAGENAME}}\n#','','');
}
 
//    * For Spanish translations
 
function spanisht()
{Qr=''
if(!Qr){void(Qr=prompt('Spanish translation, complete structure,',''));}
insertTags('==Translations=='+'\n{{'+'top}}'+'\n{{'+'mid}}'+'\n*Spanish:[['+Qr+']]'+'\n{{'+'bottom}}','','');
}
 
//    * Solo Spanish
 
function spanish()
{Qr=''
if(!Qr){void(Qr=prompt('Spanish translation, just *Spanish:   ,',''));}
insertTags('*Spanish: [['+Qr+']]','','');
}
 
 
 
 
 
//función que provee el tamaño de bytes cuando se está editando
function IW()
{ 
  alert (document.getElementById("wpTextbox1").value.length);
} 
 
function category()
{
Qr='';
if(!Qr){void(Qr=prompt('Category:',''));}
if(Qr)insertTags('[[Categoría:'+Qr+']]','','');
}
 
function copyvio()
{
Qr='';
if(!Qr){void(Qr=prompt('Copied from:',''));}
if(Qr)insertTags('{'+'{copyvio|1='+Qr+'|2=~~'+'~~|3={'+'{'+'subst:CURRENTDAY}}|4={'+'{'+'subst:CURRENTMONTHNAME}}}'+'}','','');
document.editform.wpSummary.value='Copyvio encontrado';
}
function Redirect()
{
Qr='';
if(!Qr){void(Qr=prompt('Direct to where?',''));}
if(Qr)insertTags('#'+'Redirect:['+'['+Qr+']]','','');
document.editform.wpSummary.value='Redireccionando a ['+'['+Qr+']]';
}
function fusionar()
{
Qr='';
if(!Qr){void(Qr=prompt('Fuse with:',''));}
if(Qr)insertTags('{'+'{fusionar|'+Qr+''+'}'+'}','','');
document.editform.wpSummary.value='Fusionar con ['+'['+Qr+']]';
}
 
function Usuario()
{
Qr='';
if(!Qr){void(Qr=prompt('User:',''));}
if(Qr)insertTags('[[Usuario:'+Qr+'|'+Qr+']]','','');
}
 
//<nowiki>
//============================================================
// Générateur de tableaux / Tablas a la francesa :D
//============================================================
 
/**
 *
 * English: Generate an array using Mediawiki syntax
 *
 * @author: fr:user:dake
 * @version: 0.1
 */
 
function generateTableau(nbCol, nbRow, border, styleHeader, styleLine)
{
	var code = "\n";
	if (styleHeader==1) {
		code += '{{Cabecera tabla carta alineación|center}}\n';
	} else {
		code += '{| border="' + border + '"\n';
		code += '|+ Título de la tabla\n';
	}
 
	for (var i=0;i<nbCol;i++) code += '! cabecera ' + i + '\n'
 
	for (var j=0;j<nbRow;j++) {
		if ((j+1)%2==0 && styleLine==1) {
			code += '|-bgcolor="#EFEFEF"\n'
		} else {		
			code += '|-----\n'
		}
 
		for (var i=0;i<nbCol;i++) code += '| elemento\n';
	}
 
	code += '|}';
	insertTags('','', code); 
}
 
/**
 *
 * English: Open a popup with parameters to generate an array. 
 * The number of rows/columns can be modified. Some additional
 * parameters are related to templates available on :fr
 *
 * @author: fr:user:dake
 * @version: 0.1
 */
 
function popupTableau()
{
  var popup = window.open('','name','height=400,width=500');
 
  javaCode =  '<script type="text\/javascript">function insertCode(){';
  javaCode += 'var row = parseInt(document.paramForm.inputRow.value); '
  javaCode += 'var col = parseInt(document.paramForm.inputCol.value); '
  javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); '
  javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; '
  javaCode += 'var styleLine = document.paramForm.inputLine.checked; '
  javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); '
  javaCode += '}<\/script>';
 
  popup.document.write('<html><head><title>Parámetros de la tabla</title>');
  popup.document.write('<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><!-- wikibits js --><\/script>');
  popup.document.write('<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>');
  popup.document.write(javaCode); 
  popup.document.write('</head><body>');
  popup.document.write('<p>Introduzca los parámetros de la tabla : </p>');
  popup.document.write('<form name="paramForm">');
  popup.document.write('Número de líneas : <input type="text" name="inputRow" value="3" ><p>');
  popup.document.write('Número de columnas : <input type="text" name="inputCol" value="3" ><p>');
  popup.document.write('Grosor del borde : <input type="text" name="inputBorder" value="1" ><p>');
  popup.document.write('Cabecera gris (estilo «carta gráfica») : <input type="checkbox" name="inputHeader" checked="1" ><p>');
  popup.document.write('Lineas grises alternadas (estilo «carta gráfica») : <input type="checkbox" name="inputLine" checked="1" ><p>');
  popup.document.write('</form">');
  popup.document.write('<p><a href="javascript:insertCode()"> Introducir el código en la ventana de edición</a></p>');
  popup.document.write('<p><a href="javascript:self.close()"> Cerrar</a></p>');
  popup.document.write('</body></html>');
  popup.document.close();
}
//</nowiki>
 
 
function mip()
{insertTags('Si tienes alguna duda puedes dejarme un mensaje en mi [[User Talk:'+'|página de discusión]]. '+' ~'+'~~','','~' ,'','');
}
 
function Discusion()
{
Qr='';
if(!Qr){void(Qr=prompt('Link to who?',''));}if(Qr)insertTags('[[Usuario Discusión:'+Qr+'|'+Qr+']]','','');
}
function wikistress()
{
Qr='';
if(!Qr){void(Qr=prompt('¿Cómo te sientes?',''));}
if(Qr)insertTags('[[image:Wikistress_'+Qr+'.jpg]]','','');
}
 
 
function ponWEI()
{insertTags('<code style="background:#ccDEfD">','</code>',':)');}
 
function contex()
{
insertTags('{'+'{contextualizar|{'+'{subst:CURRENTDAY}}|{'+'{subst:CURRENTMONTHNAME}}'+'}'+'}','','');
document.editform.wpSummary.value='Plantill Contextualizar adicionada';
document.editform.wpMinoredit.checked='true';}
 
function sinrel()
{
insertTags('{'+'{sinrelevancia|{'+'{subst:CURRENTDAY}}|{'+'{subst:CURRENTMONTHNAME}}'+'}'+'}','','');
document.editform.wpSummary.value='Plantilla Sin Relevancia adicionada';
document.editform.wpMinoredit.checked='true';}
 
function sol()
{insertTags('{'+'{SOL|{'+'{subst:CURRENTDAY}}|{'+'{subst:CURRENTMONTHNAME}}'+'}'+'}','','');
document.editform.wpSummary.value='Imagen marcada como Sin origen ni licencia';
document.editform.wpMinoredit.checked='true';
}
 
function sl()
{insertTags('{'+'{SL|{'+'{subst:CURRENTDAY}}|{'+'{subst:CURRENTMONTHNAME}}'+'}'+'}','','');
document.editform.wpSummary.value='Imagen marcada como Sin licencia';
document.editform.wpMinoredit.checked='true';
}
 
function so()
{insertTags('{'+'{SO|{'+'{subst:CURRENTDAY}}|{'+'{subst:CURRENTMONTHNAME}}'+'}'+'}','','');
document.editform.wpSummary.value='Imagen marcada como Sin origen';
document.editform.wpMinoredit.checked='true';
}
 
function prueba()
{insertTags('{'+'{prueba}}'+'~'+'~'+'~'+'~','','');
document.editform.wpSummary.value='aviso de prueba';
document.editform.wpMinoredit.checked='true';
}
 
function gif()
{insertTags('{'+'{gif}}','','');}
function PD()
{insertTags('{'+'{PD}}','','');}
function GFDL()
{insertTags('{'+'{GFDL}}','','');}
function usoleg()
{insertTags('{'+'{uso legítimo}}','','');}
 
function Bienvenida()
{insertTags('{'+'{Bienvenido usuario}}'+' ~'+'~~','','~' ,'','');
document.editform.wpSummary.value='Bienvenida usuario';
}
 
function BIP()
{insertTags('{'+'{Bienvenida ip}}'+' ~'+'~~','','~' ,'','');
document.editform.wpSummary.value='Bienvenida a ip';
}
function Firma()
{insertTags('~'+'~~','','~');}
function sup()
{insertTags('<sup>','</sup>',';)');}
function esbozo()
{insertTags('{'+'{esbozo de|}}','','');}
function miniesbozo()
{insertTags('{'+'{miniesbozo de|}}','','');}
function code()
{insertTags('<code>','</code>',';)');}
 
/************ Fin módulo botonera flotante **************/
 
/************      Módulo de búsqueda     **************/
 
function moduloBusqueda()
{
var btSearch = "<br /><div>";
btSearch += buttonCode("Wikipedia, a través de Google", "G", "http://www.google.com/search?domains=es.wikipedia.org&num=50&ie=utf-8&oe=utf-8&q=", "&btnG=B%C3%BAsqueda+en+Google&sitesearch=es.wikipedia.org");
btSearch += buttonCode("Wikipedia en inglés", "en", "http://en.wikipedia.org/wiki/", "");
btSearch += buttonCode("Enciclopedia Libre", "EL", "http://enciclopedia.us.es/index.php/", "");
btSearch += buttonCode("Answers.com", "Ans", "http://answers.com/", "");
//btSearch += buttonCode("Wikcionario", "Wkc", "http://es.wiktionary.org/wiki/", "");
btSearch += "<br />";
//btSearch += buttonCode("Websters dictionary en:. The Rosetta Edition.", "Webster", "http://www.websters-online-dictionary.org/definition/english/",".html");
btSearch += buttonCode("Diccionario Real Academia Española", "RAE", "http://buscon.rae.es/draeI/SrvltGUIBusUsual?TIPO_HTML=2&TIPO_BUS=2&LEMA=", "");
//btSearch += buttonCode("Yahoo Spanish to English Translation", "Y!","http://education.yahoo.com/reference/dict_en_es/entry?p=", "");
btSearch += buttonCode("Kate's edit counter", "edits", "http://kohl.wikimedia.org/~kate/cgi-bin/count_edits?user=", "&dbname=eswiki");
 
var boxSearch = document.getElementById("searchform");
if (boxSearch)
  boxSearch.innerHTML += btSearch+"</div>";
}
 
function goSearch(inicio, fin)
{
  var text = document.getElementById("searchInput");
  window.open(inicio + escape(text.value) + fin);
}
 
function buttonCode(titulo, texto, inicio, fin)
{
  return ' <a class="botónbusca" href="javascript:goSearch(\''+inicio+'\', \''+fin+'\')" title="'+titulo+'">'+texto+'</a>';
}
 
/************     Fin módulo de búsqueda    **************/
 
/*********** PopUps ***********/
mw.loader.load('https://es.wikipedia.org/w/index.php?title=Usuario:Alhen/popups.js' 
+ '&action=raw&ctype=text/javascript');
/*********** Fin del módulo PopUps ***********/
 
/***********         Motor de módulos          ***********/
/*  Éste es el que pone en marcha los módulos.
/*  No debes cambiar esta parte NUNCA.
/*  Para configurar tus módulos, vete a la sección del 
/*  final, donde pone "Configuración de módulos".
/*********************************************************/
var plugin=new Array();
 
 
 
function pluginLoad(nombre)
{
 plugin[plugin.length++]=nombre;
}
 
function pluginImport(nombre)   //Cargar plugin(i)
{
 document.write('<'+'script src="/w/wiki.phtml?title='+nombre+'&ctype=text/javascript&action=raw&dontcountme=s" type="text/javascript"><'+'/script>');
}
 
/****************** Configuración de módulos ******************/
/*  Si quieres desactivar temporalmente un módulo, basta con 
/* agregar dos barras "//" al principio de las líneas en las
/* que aparezca.
/**************************************************************/
//Importar plugins externos:
//pluginImport("Usuario:Comae/Prueba3");
 
//Activar plugins
//pluginLoad(moduloBusqueda);
pluginLoad(botoneraFlotante);
//pluginLoad(marcadores);
 
/*function morelinks() {
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  tabs.id = 'mytabs';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  document.getElementById('column-content').appendChild(tabs);
}
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);*/
 
//</nowiki></pre>