Utente:Alex brollo/regextool.js
Aspetto
Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5.
var rmf_globals = {};
if(wgAction=='edit' || wgAction=='submit') {
/****************
*** config tools
****************/
// function
function regexTool(name,functionname, descrizione) {
if (!descrizione) {
descrizione = name;
}
var newline = document.createElement('li');
var newlink = document.createElement('a');
newlink.setAttribute('href','javascript:'+functionname);
newlink.setAttribute('title', descrizione);
newlink.setAttribute('class','sidebar-link');
newlink.appendChild(document.createTextNode(name));
newline.appendChild(newlink);
toollist.appendChild(newline);
}
/*** create menu
****************/
function rfmenu(rfmconfig) {
/* get elements */
// note: these must be global.
editbox = document.getElementById('wpTextbox1');
editreason = document.getElementById('wpSummary');
try {
sidebar = document.getElementById('p-navigation').parentNode;
}
catch(err) {
console.log( 'Regex menu framework rfmenu() aborted due to unknown error. This (rare) issue will be fixed in the eventual rewrite.' );
return;
}
/* add CSS */
/*appendCSS('<style type="text/css">'
+ '#p-regex li { list-style:none !important; }'
+ '#p-regex a { color:gray !important; }')
; */
/* create menu */
var container = document.createElement('div');
container.setAttribute('class','portal persistent');
container.setAttribute('id','p-regex');
sidebar.appendChild(container);
var header = document.createElement('h5');
header.setAttribute('style','font-weight:bold');
header.appendChild(document.createTextNode('Attrezzi del rilettore'));
container.appendChild(header);
var toolbox = document.createElement('div');
toolbox.setAttribute('class','body');
container.appendChild(toolbox);
toollist = document.createElement('ul');
toolbox.appendChild(toollist);
/* load user-defined sidebar links */
if(self['gadget_rmflinks']) { gadget_rmflinks(); }
if(self['rmflinks']) { rmflinks(); }
}
/* load script */
addOnloadHook(rfmenu);
}