Usuario:Chixpy/IMBS1/functions.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.
//<pre><nowiki>
//Funciones de la Barra de herramientas del Monobook-Suite
//autor: Axxgreazz

/*******************Funciones utilizadas en Wikipedia español******************/

// Modificado por Chixpy para Inciclopedia


/******************Funciones de edición*******************/

// Pone el texto seleccionado en negrita
function negrita () { insertTags("'''", "'''", 'Texto en negrita'); }

// Pone el texto seleccionado en cursiva
function cursiva () { insertTags("''", "''", 'Texto en cursiva'); }

// Hace un enlace interno con el texto seleccionado
function enlace_interno () { insertTags('[' + '[', ']' + ']', 'Título del enlace'); }   

// Hace un enlace externo con el texto seleccionado
function enlace_externo () { insertTags('[', ']', 'http://www.ejemplo.com Título del enlace');}      

// Convierte el texto seleccionado en un Título de 1er orden
function titular () { insertTags('==', '==', 'Texto de titular'); }

// Convierte el texto seleccionado en una imagen
function imagen () { insertTags('[' + '[Imagen:', ']' + ']', 'Ejemplo.jpg'); }       

// Convierte el texto seleccionado en un archivo de media (sonido)
function media (){ insertTags('[' + '[Media:', ']' + ']', 'Ejemplo.ogg'); }

// Convierte el texto seleccionado en una fórmula
function matematica (){insertTags('<' + 'math>', '<' + '/math>', 'Fórmula_Matemática(LaTeX)');}

// Quita el formato Wiki
function formatowiki() {insertTags('<' + 'nowiki>', '<' + '/nowiki>', 'Sin wikiformato'); }    

// Tacha el texto seleccionado
function tachar (){insertTags('<' + 's>', '<' + '/s>', 'Texto tachado'); }       

// Convierte en enlace a plantilla
function llaves () {insertTags('{' + '{', '}' + '}', 'Plantilla'); }       

// Añade la firma
function firma (texto) {
    if(!texto){texto='--~~'+'~~'}
    insertTags('', texto, '');
}

// Añade una línea horizontal
// Además hace un salto de linea necesario para que no salgan 4 guiones
function linea () {insertTags('\n' + '----' + '\n', '', ''); }

//Crea un enlace a un usuario
function usuario(){insertTags('[' + '[Usuario:', ']' + ']', 'Nombre Usuario'); }

//Mensaje por defecto para la bienvenida del usuario
function bienvenido_usuario(texto)
{ 
   if(!texto){texto='--~~'+'~~'}
   insertTags('{' + '{bienvenido}}' + wpMessage + ' ' + texto, '', '');
   sumario('Bienvenida al usuario');
}



/******************Botones de asistentes*******************/

// Añade una categoría al final de artículo
function category()
{
   Qr='';
   if(!Qr){void(Qr=prompt('Categoría:',''));}
   if(Qr)
   {
     document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + '\n' + '[' + '[Categoría:'+Qr+']' + ']';
     sumario('Categoría  [' + '[Categoría:' + Qr + '|' + Qr +']]');
   }
}

// Muestra un mensaje con el tamaño del artículo
function tamaño_articulo()
{  
   alert ("Tamaño: " + document.getElementById("wpTextbox1").value.length + " caracteres.");
} 

function redireccionar()
{
   Qr = '';
   if(!Qr){void(Qr = prompt('¿Redireccionar hacia?',''));}
   if(Qr)
     { document.getElementById("wpTextbox1").value = '#' + 'REDIRECT [' + '[' + Qr + ']]';
       document.editform.wpSummary.value = 'IMBS1: Redireccionando a [' + '[' + Qr + ']]'; 
     }
}


/******************Funciones de inserción de plantillas*******************/
// SE INSERTAN AUTOMÁTICAMENTE AL INICIO DEL TEXTO

// Añade cualquier plantilla al principio del texto
function PonPlantilla (plantilla) {
   document.getElementById("wpTextbox1").value = '{' + '{'+ plantilla +'}' + '}' + '\n' + document.getElementById("wpTextbox1").value;
   sumario('{' + '{'+ plantilla +'}' + '}');
}

// Añade la platilla Avisoborrado (Pregunta los minutos)
function avisoborrar()
{  
   Qr='';
   void(Qr=prompt('Minutos para la destrucción:','30'));
   if(Qr) {PonPlantilla ('Avisoborrado|' + Qr);}
}

function PlantillaArreglar()
{  
   Qr='';
   void(Qr=prompt('Cosas que arreglar:','Enmendando el formato'));
   if(Qr) {PonPlantilla ('Arreglar|' + Qr);}
}

function PlantillaFusionar()
{
   Qr='';
   if(!Qr){void(Qr = prompt('Fusionar con:',''));}
   if(Qr) {PonPlantilla ('Fusionar|' + Qr);}
}



/******************Funciones de inserción de emoticonos*******************/
function PonEmoticono (emoticono) {
    insertTags('{' + '{' + emoticono + '}' + '}', '', '');
}

/******************Otras funciones*******************/
function guardar(){ document.editform.submit();}

function previsualizar() { document.editform.wpPreview.click(); }

function firma_simple()
{ 
   var Qr='';
   Qr='~'+'~~'+'~';
   return Qr;
}




/******************Funciones aún no utilizadas*******************/

function sup()
{
   insertTags('<sup>','</sup>',';)');
}

function code()
{
   insertTags('<code>','</code>',';)');
}

/******************Funciones internas (no son para botones)*******************/
function sumario (texto)
{
    if (document.editform.wpSummary.value) { texto= ', ' + texto;}
    else {document.editform.wpSummary.value = 'IMBS1: ';}
    document.editform.wpSummary.value=document.editform.wpSummary.value + texto;
}
//</nowiki></pre>