Usuario:Huhsunquy~eswiki/monobook.js
Apariencia
Nota: Después de guardar, debes refrescar la caché de tu navegador para ver los cambios. Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar. Firefox: mientras presionas Mayús pulsas el botón Actualizar, (o presiona Ctrl-Shift-R). Los usuarios de Google Chrome y Safari pueden simplemente pulsar el botón Recargar. Para más detalles e instrucciones acerca de otros exploradores, véase Ayuda:Cómo limpiar la caché.
//------------------------------------------------
// [[Usuario:Cookie/monobook.js]] v0.3
// Editado por [[Usuario:Pilaf]] el 25/01/2005
//
// ...tratando de combinar la botonera con el
// Live Preview... ¡Éxito! :D
//------------------------------------------------
// incluir conversor Wiki a HTML
document.write('<script type="text/javascript" src="/w/index.php?title=Usuario:Pilaf/wikicode.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
window.onload = Main;
function Main()
{
loadButtons();
LivePreviewInstall();
}
/*********** Botonera ***********/
function goSearch(i)
{
urls = new Array(
"http://en.wikipedia.org/wiki/",
"http://de.wikipedia.org/wiki/",
"http://fr.wikipedia.org/wiki/",
"http://enciclopedia.us.es/index.php/",
"http://es.wiktionary.org/wiki/",
"http://buscon.rae.es/draeI/SrvltGUIBusUsual?TIPO_HTML=2&TIPO_BUS=2&LEMA=",
"http://google.com/search?q=",
"http://www.gnu.org/cgi-bin/htsearch?words=",
"http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&cmd=search&term="
);
var text = document.getElementById("searchInput");
window.open(urls[i] + escape(text.value));
}
function buttonCode(strCode)
{
return ' <input type="button" class="searchButton" '+strCode+' />';
}
function loadButtons()
{
var btSearch = '<br/>';
btSearch += buttonCode('onclick="goSearch(0)" value="w:en" title="Wikipedia en inglés"');
btSearch += buttonCode('onclick="goSearch(1)" value="w:de" title="Wikipedia en alemán"');
btSearch += buttonCode('onclick="goSearch(2)" value="w:fr" title="Wikipedia en francés"');
btSearch += buttonCode('onclick="goSearch(3)" value="EL" title="Enciclopedia Libre"');
btSearch += buttonCode('onclick="goSearch(4)" value="Wikcionario"');
btSearch += buttonCode('onclick="goSearch(5)" value="DRAE" title="Diccionario de la Real Academia Española"');
btSearch += buttonCode('onclick="goSearch(6)" value="Google"');
btSearch += buttonCode('onclick="goSearch(7)" value="FSF" title="Free Software Foundation"');
btSearch += buttonCode('onclick="goSearch(8)" value="PubMed"');
var buttons = '<div>';
/* Botón del mapa de la ayuda */
buttons += '<a class="mybutton" title="Mapa de la ayuda" href="http://es.wikipedia.org/wiki/Wikipedia:Mapa" style="text-decoration:none;" >?</a>';
/* Botón de la zona de pruebas */
buttons += '<a class="mybutton" title="Zona de pruebas"href="http://es.wikipedia.org/wiki/Wikipedia:Zona de pruebas">#</a>';
/* Botón para buscar en Wikipedia a través de Google */
/*
buttons += '<a class="mybutton" title="Buscar en Wikipedia a través de Google" href="http://www.google.com/search?q=&btnG=B%FAsqueda+en+Google.com&domains=http://es.wikipedia.org&sitesearch=http://es.wikipedia.org&ie=iso-8859-1&oe=iso-8859-1">G</a>';
*/
/* Botón WEI */
buttons += '<a class="mybutton" title="wei: selecciona antes el texto a resaltar" href="javascript:ponWEI()" style="background:yellow" ><code style="background:yellow">:\)</code></a>';
/* Botón enlaces */
buttons += '<a class="mybutton" title="enlaces: selecciona antes el texto para enlazar" href="javascript:ponENLAZANDO()" style="background:green" >[[]]</a>';
buttons += '</div>';
var toolbox = document.getElementById("p-nav");
toolbox.innerHTML += '<h5>Mi botonera</h5>'+buttons;
var boxSearch = document.getElementById("searchform");
if (boxSearch)
boxSearch.innerHTML += btSearch;
}
function ponWEI()
{insertTags('<code style="background:yellow">','</code>','');}
/*********** Fin botonera ************/
mis_botones = new Array();
// ¡han apretado un botón!
// esto es insertTags modificado, sólo que llama a una función para
// modificar el texto
function hanApretadoUnBoton (cual)
{
if (!mis_botones[cual]) return;
var fn = mis_botones[cual].fn;
if (!fn) return;
var txtarea = document.editform.wpTextbox1;
// IE
if(document.selection && !is_gecko) {
var theSelection = document.selection.createRange().text;
if(!theSelection) { theSelection="";}
txtarea.focus();
if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
theSelection = theSelection.substring(0, theSelection.length - 1);
document.selection.createRange().text = fn(theSelection) + " ";
} else {
document.selection.createRange().text = fn(theSelection);
}
// Mozilla
} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
var startPos = txtarea.selectionStart;
var endPos = txtarea.selectionEnd;
var scrollTop=txtarea.scrollTop;
var myText = (txtarea.value).substring(startPos, endPos);
if(!myText) { myText="";}
if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
subst = fn(myText.substring(0, (myText.length - 1)))+" ";
} else {
subst = fn(myText);
}
txtarea.value = txtarea.value.substring(0, startPos) + subst +
txtarea.value.substring(endPos, txtarea.value.length);
txtarea.focus();
var cPos=startPos+subst.length;
txtarea.selectionStart=cPos;
txtarea.selectionEnd=cPos;
txtarea.scrollTop=scrollTop;
// All others
} else {
var copy_alertText=alertText;
var re1=new RegExp("\\$1","g");
var re2=new RegExp("\\$2","g");
copy_alertText=copy_alertText.replace(re1,"xyz");
copy_alertText=copy_alertText.replace(re2,fn("xyz"));
var text;
if (sampleText) {
text=prompt(copy_alertText);
} else {
text="";
}
if(!text) { text="xyz";}
text=fn(text);
document.infoform.infobox.value=text;
// in Safari this causes scrolling
if(!is_safari) {
txtarea.focus();
}
noOverwrite=true;
}
// reposition cursor if possible
if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}
// Esta es una versión modificada de addButton.
// Parámetros:
// * la imagen para colocar en el botón,
// * el texto de ayuda (se muestra cuando el puntero del mouse
// pasa sobre el botón,
// * una función a la que se llamará cuando se pulse el botón, con
// un parámetro: el texto seleccionado, y que deberá devolver el
// texto a poner en su lugar.
//
// No funciona con el infobox
function otro_boton (imageFile, speedTip, funcion) {
var btn = { img: imageFile, st: speedTip, fn: funcion };
mis_botones[mis_botones.length] = btn;
}
// reemplazamos esta función...
la_addInfobox_antigua = addInfobox;
addInfobox = function (infoText, text_alert)
{
for (i=0; i<mis_botones.length; i++)
{
var imageFile = mis_botones[i].img;
var speedTip = mis_botones[i].st;
document.write("<a href=\"javascript:" +
"hanApretadoUnBoton('"+i+"')\">");
document.write("<img width=\"23\" height=\"22\" src=\""+imageFile+"\" border=\"0\" alt=\""+speedTip+"\" title=\""+speedTip+"\"/>");
document.write("</a>");
}
la_addInfobox_antigua(infoText, text_alert);
return;
}
function enlace_a_dicc (s)
{
if (s == "") s = "palabra";
// si no tiene '|' duplicamos el término
if (s.indexOf("|") == -1) s = s + "|" + s;
return "[[wikt:" + s + "]]";
}
otro_boton("http://upload.wikimedia.org/wikipedia/es/0/00/Button_dicc.png",
"enlace al wikcionario", enlace_a_dicc);