Usuario:PUTAJEREZ/myskin.js

De Inciclopedia
Ir a la navegación Ir a la búsqueda

Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.

  • Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
  • Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
  • Internet Explorer/Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
  • Opera: Presiona Ctrl+F5.
//monobook hecho por [http://es.wikipedia.org/wiki/Usuario:Faelomx|FAELOMX]

var wpUserName = "PUTAJEREZ";

/* Modulo barra de herramientas de la caja de edición */
function InsertEditButton(parent, item, i) {
	var image = document.createElement("img");
	image.width = 23;
	image.height = 22;
	image.src = item.img;
	image.border = 0;
	image.alt = item.st;
	image.title = item.st;
	image.style.cursor = "pointer";
	image.onclick = function() {
		hanApretadoUnBoton(i);
		return false;
	}
	
	parent.appendChild(image);
}

function toolbarExtendido()
{
  var toolbar = document.getElementById("toolbar")
  if (toolbar!=null) {
  //Estos botones se añaden a la barra de herramientas que hay dobre la caja de edición
    for (i=0; i<mis_botones.length; i++)
    {
      InsertEditButton(toolbar, mis_botones[i], i)
    }
  }

} // fin toolbarExtendido
addLoadEvent(toolbarExtendido);

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;
}


// Gets the article lemma with the namespace
function get_title()
{
  // get the article link from the label 'ca-edit' out of the document text.
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  // cut everything up to "title=" from the start and everything past "&" from the end
  // Note if the page has & in its title, that is represented here as %26, so it
  // doesn't cause a problem
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.indexOf('&'));
  return editlk;
}

// Gets the article lemma, with the namespace but without sub pages.
function get_tidy_title()
{
  var editlk = get_title()
  editlk = editlk.replace(/\/.*$/, ''); //removing subpages from the link
  return editlk;
}
// Gets the subpage lemma, with the namespace but without sub pages.
function get_subpage_title()
{
  var editlk = get_title()
  editlk = editlk.substring(editlk.indexOf('/') + 1); // strip off 
  return editlk;
}


/*********************************************
**********************************************
*********************************************/
// AQUI PRIMERO DEFINO LAS FUNCIONES

function BTN_DIV(s)
{
	
	return "<div></div>";
}

function CSS_BGC()
{
var p_ = prompt('Código HEX o nombre de color',"#FFAE10")
return "background-color:"+ p_;
}

function CSS_CLL()
{
var p_ = prompt('Código HEX o nombre de color',"#FFAE10")
return "color:"+ p_;
}

function RDIR()
{
var p_ = prompt('Pág. de redir.',"")
return "\#REDIRECT [["+ p_+"]]";
}

function CATGRY()
{
var p_ = prompt(' Categoría .',"")
/*<!--*/ return "[[Categoría:"+ p_+"]]"; //-->
}


function PLANTILLA()
{
var p_ = prompt(' Agrege la plantilla ',"")
return "{{"+p_+"}}";
}

function CSS_FNT()
{
var p_ = prompt('Fuente {font-family}\nDisponga las fuentes asi, si el usuario no tiene alguna\nusa \' y \' para fuentes con espacio, por ejemplo Courier New',"\'Trebuchet MS\', Arial")
return "font-family:"+p_+";";
}

function FIRMARME()
{
return "[[Usuario:Faelomx|Faelomx]] 23:53 22 ago 2006 (CEST) // '''[[El Puerto de Santa María]]!!!'''[[image:Bandera_psm.jpg|20px|¿¿¿El Puerto??? ... ¡Lo mejor!!!]], ''¿colaboramos juntos en artículos...?''.... <FONT SIZE=1 STYLE=\"color=pink\">''[[Usuario_Discusión:Faelomx?action=edit&section=new|Habladurías...]]<\/FONT>''" 
}

function ART_PRINCI()
{
var p_ = prompt('Artículo a mandar',"");
return "[["+p_+"|'''''Artículo principal:"+p_+"''''']]";
}

function PGNM()
{
return "{{PAGENAME}}"
}

function Creando_Tit_Ext()
{
return "==Enlaces externos==\n*[...]"
}

function aComentar()
{
return "<!--"+"-->"
}

function OBRAS()
{
return "{{enboras}}"
}

function alaplant()
{
var p1= prompt("Nombre del valor en la plantilla","")
   function plantIfset()
   {
    var p2 = prompt("Nombre del valor predetermindo","")
    if(!p2){return ''}else{return p2}
   }

return '{{{'+p1+'\|'+plantIfset()+'}}}'
}


//LLAMADA DE BOTONES

otro_boton("http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
	"Redireccionar", RDIR);

otro_boton("http://usuarios.lycos.es/irmonline/CAT.PNG",
	"Categorizar...",CATGRY);

otro_boton("http://usuarios.lycos.es/irmonline/plntya.PNG",
	"Plantillas", PLANTILLA);

otro_boton("http://upload.wikimedia.org/wikipedia/commons/7/7c/UI_BTN_FMX_Div.GIF",
	"Insertar Capa", BTN_DIV);


addButton("http://usuarios.lycos.es/irmonline/stylize.PNG","STYLE PARAM.",'style=\"','\"','...');



otro_boton("http://usuarios.lycos.es/irmonline/bg_color_wiki.PNG",
	"Estilo CSS: Fondo de color", CSS_BGC);

otro_boton("http://usuarios.lycos.es/irmonline/_color_wiki.PNG",
	"Estilo CSS: Color de 1er. plano", CSS_CLL);

otro_boton("http://usuarios.lycos.es/irmonline/FNT.PNG",
	"Estilo CSS: Cambio de fuente", CSS_FNT);

otro_boton("http://es.wikipedia.org/skins-1.5/common/images/button_sig.png",
	"Firma extendida", FIRMARME);

otro_boton("http://upload.wikimedia.org/wikipedia/he/8/8e/Button_shifting.png",
	"Artículo principal", ART_PRINCI);

otro_boton("http://upload.wikimedia.org/wikipedia/he/f/fd/Button_blockquote.png",
	"Ésta página", PGNM);

otro_boton("http://upload.wikimedia.org/wikipedia/he/9/93/Button_sub_link.png",
	"Crear zona: Enlaces externos", Creando_Tit_Ext);

otro_boton("http://upload.wikimedia.org/wikipedia/fr/3/37/Btn_toolbar_commentaire.png",
	"Crear zona: COMENTARIO", aComentar);

otro_boton("http://upload.wikimedia.org/wikipedia/commons/c/c3/Button_travaux.png",
	"En obras", OBRAS);

otro_boton("http://upload.wikimedia.org/wikipedia/commons/a/a1/Button_template_tl.png",
	"Facil editor de valores de plantillas", alaplant);

//abre y cierra
addButton("http://upload.wikimedia.org/wikipedia/commons/8/8e/Button_stub.png",'Centrar','<CENTER>','</CENTER>','...');

//abre y cierra
addButton("http://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png",'Sin decoración de subrayado','<font style="text-decoration:none">','</font>','...');

//abre y cierra
addButton("http://upload.wikimedia.org/wikipedia/commons/5/59/Button_replace.png",'superindice','<SUB>','</SUB>','...');

addButton("http://upload.wikimedia.org/wikipedia/commons/5/58/Button_small.png",'subindice','<SUP>','</SUP>','...');


addButton("http://upload.wikimedia.org/wikipedia/commons/5/5f/Button_rediriger.png",'Flotar a la derecha','<div style="float:right">','</div>','...');