Usuario:TwinkleUser/test.js
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é.
//Atajos Twinkle del usuario Jsimlo de la Wikipedia en inglés. Modificado por Robinsonsmay (Macy)
//para que sea personalizable
//<pre><nowiki>
var shortcutsVersion = "1.1.0";
var shortcutsReleaseDate = "2007-02-03";
/***********************************************************
* Interfaz
***********************************************************/
/**
* Inicia la sección de enlaces
*/
function shortcutsStartSection (name)
{
shortcutsLinks[shortcutsLinks.length] = { 'name': name, 'links': new Array () };
}
/**
* Adds new link into the current section of links. Function for external use.
*/
function shortcutsAddLink (name, article)
{
var links = shortcutsLinks[shortcutsLinks.length - 1]['links'];
links[links.length] = { 'name': name, 'article': article };
}
/***********************************************************
* Implementación
***********************************************************/
/**
* Creador de enlaces
*/
function shortcutsMakeLink (name, url)
{
var ntxt = document.createTextNode (name);
var na = document.createElement ('a');
var nli = document.createElement ('li');
na.setAttribute ('href', '/wiki/' + url);
nli.setAttribute ('class', 'n-shortcut');
na.appendChild (ntxt);
nli.appendChild (na);
return nli;
}
/**
* Portlet maker.
* Creates and returns a portlet populated by list of links.
*/
function shortcutsMakePortlet (name, links)
{
var nportlet = document.createElement ('div');
var nh5 = document.createElement ('h5');
var ntit = document.createTextNode (name);
var nbody = document.createElement ('div');
var nul = document.createElement ('ul');
nportlet.setAttribute ('id', 'p-'+name);
nportlet.setAttribute ('class', 'portlet');
nbody.setAttribute ('class', 'pBody');
nul.setAttribute ('id', 'p-'+name);
for (var i = 0; i < links.length; i++)
nul.appendChild (
shortcutsMakeLink (links[i]['name'], links[i]['article'])
);
nh5.appendChild (ntit);
nportlet.appendChild (nh5);
nbody.appendChild (nul);
nportlet.appendChild (nbody);
return nportlet;
}
/**
* Main function.
* Enumerates all non-empty sections, and adds new portlets beneath the old ones.
*/
function shortcutsMain ()
{
var sidecol = document.getElementById ('column-one');
for (var i = 0; i < shortcutsLinks.length; i++)
if (shortcutsLinks[i]['links'].length > 0)
sidecol.appendChild (
shortcutsMakePortlet (shortcutsLinks[i]['name'], shortcutsLinks[i]['links'])
);
}
/**
* Initializes the onload events.
*/
function shortcutsInitialize ()
{
shortcutsInit ();
shortcutsCust ();
shortcutsMain ();
}
function shortcutsInit ()
{
shortcutsAddLink ( 'Monobook.js', 'Special:Mypage/monobook.js' );
shortcutsAddLink ( 'Monobook.css', 'Special:Mypage/monobook.css' );
shortcutsAddLink ( 'Twinkle', 'WP:TW' );
shortcutsAddLink ( 'Café', 'WP:C' );
shortcutsAddLink ( 'Tablón de bibliotecarios', 'WP:TAB' );
shortcutsAddLink ( 'Votaciones', 'WP:VO' );
shortcutsAddLink ( 'Zona de pruebas', 'WP:ZP' );
shortcutsAddLink ( 'Vandalismo en curso', 'WP:VEC' );
shortcutsAddLink ( 'Consultas', 'WP:CON' );
}
/***********************************************************
* Inicialización
***********************************************************/
var shortcutsLinks = new Array ();
shortcutsStartSection ('atajos twinkle');
addOnloadHook (shortcutsInitialize);
//</nowiki></pre>
function shortcutsCust ()
{
}