Utente:Aubrey/monobook.js
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)
- Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
- Opera: premi Ctrl-F5.
// <pre>
function ModifySidebar(action, section, name, link) {
try {
switch (section) {
case "languages":
var target = "p-lang";
break;
case "toolbox":
var target = "p-tb";
break;
case "navigation":
var target = "p-navigation";
break;
default:
var target = "p-" + section;
break;
}
if (action == "add") {
var node = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement('a');
var liNode = document.createElement('li');
aNode.appendChild(document.createTextNode(name));
aNode.setAttribute('href', link);
liNode.appendChild(aNode);
liNode.className='plainlinks';
node.appendChild(liNode);
}
if (action == "remove") {
var list = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var listelements = list.getElementsByTagName('li');
for (var i = 0; i < listelements.length; i++) {
if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
listelements[i].getElementsByTagName('a')[0].href == link) {
list.removeChild(listelements[i]);
}
}
}
} catch(e) {
// lets just ignore what's happened
return;
}
}
function CustomizeModificationsOfSidebar() {
ModifySidebar("remove", "toolbox", "Carica un file", "http://it.wikisource.org/wiki/Speciale:Carica");
}
$(CustomizeModificationsOfSidebar);
// POPUP DI LUPIN [[User:Lupin/popups.js]]
// document.write('<script type="text/javascript" src="'
// + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
// + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// FUNZIONE BASE PER GLI SCRIPT DI IPORK
function inc(file) {
document.write('<script type="text/javascript" src="/w/index.php?title='+ file +'&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
inc("Utente:IPork/controllo versioni.js");
var nomeutente= "Aubrey";
// INDICATORE DI STATO
inc("Utente:IPork/indicatorestato.js");
inc("Utente:Aubrey/statopersonale.js");
// RICERCA AVANZATA
inc("Utente:IPork/ricerca.js");
// TENDINE - BETA ELIMINARE SE DA PROBLEMI
inc("Utente:IPork/tendine.js");
inc("Utente:IPork/tendine_funzioni.js");
// MENU A SINISTRA
inc("Utente:IPork/menusinistra.js");
// MENU A SINISTRA - COLLEGAMENTI PERSONALI
$(function(){addToolboxLink('http://it.wikisource.org/wiki/Speciale:TutteLePagine', 'Tutte le pagine');});
$(function(){addToolboxLink('http://it.wikisource.org/wiki/Speciale:Statistiche', 'Statistiche');});
$(function(){addToolboxLink('http://it.wikisource.org/wiki/Speciale:Importa', 'Importa');});
$(function(){addToolboxLink('http://it.wikisource.org/wiki/Speciale:Esporta', 'Esporta');});
$(function(){addToolboxLink('http://it.wikisource.org/w/index.php?title=Speciale%3ARegistri&type=newusers&user=&page=&year=&month=-1', 'Nuovi utenti');});
var opzPannelliOriginali = 0;
var opzAmministratore = 1;
var opzModificaIntro = 0;
var opzLinksPersonali =0;
//SAL
//inc("Utente:IPork/SAL.js");
// PULSANTI ADDIZIONALI
// AUTORECITATO
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/6/6d/Button_AC.png",
"speedTip": "Autore Citato",
"tagOpen": '{{AutoreCitato||',
"tagClose": '}}',
"sampleText": "Nome autore"};
};
// TESTOCITATO
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/45/Button_TC.png",
"speedTip": "Testo Citato",
"tagOpen": '{{TestoCitato||',
"tagClose": '}}',
"sampleText": "Nome testo"};
};
// §
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e2/Button_%C2%A7.png",
"speedTip": "§",
"tagOpen": '{{§||',
"tagClose": '}}',
"sampleText": "citazione"};
};
// SEZIONE
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/44/Button_comillas_latinas.png",
"speedTip": "Section",
"tagOpen": '<section begin="1" />',
"tagClose": '<section end="1" />',
"sampleText": "Sezione"};
};
// Template TEMPLATE
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/4b/Button_class_text.png",
"speedTip": "tl",
"tagOpen": '{{tl|',
"tagClose": '}}',
"sampleText": "Nome_template"};
};
// CENTRATO
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png",
"speedTip": "Testo Citato",
"tagOpen": '{{Centrato|',
"tagClose": '}}',
"sampleText": "Testo"};
};
// CITAZIONE
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png",
"speedTip": "Cite",
"tagOpen": '{{Citazione|',
"tagClose": '}}',
"sampleText": "Citazione"};
};
// PAGINA BIANCA
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png",
"speedTip": "blank",
"tagOpen": '{{Pagina bianca}}',
"tagClose": '',
"sampleText": ""};
};
//fixOCR
// Script di Filippo_V per aggancio di un pulsante a una funzione js qualsiasi
function pulsantini() {
var toolbar = null;
toolbar = document.getElementById("toolbar");
if (toolbar == null) return;
addToolbarButton('tb-ocr', 'javascript:postOCR()', 'http://upload.wikimedia.org/wikipedia/commons/9/96/Button_ocr_fix.png', '[postOCR]', 'Corregge gli errori comuni di scansione');
addToolbarButton('tb-ocr', 'javascript:apostrofi()','http://upload.wikimedia.org/wikipedia/commons/3/32/Button_apostrophe.PNG', '[apostrofi]', 'Converte gli apostrofi dattilografici in tipografici');;
}
addLoadEvent(pulsantini);
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// <source lang="javascript">
/**********************
*** Automatically generate page footer from values in {{header}}
*** by [[user:GrafZahl]]
**********************/
/*
* Proposed algorithm:
* 1. find the Capitolo tables using a class.
* 2. if there are two Capitolo tables, the page already has a header and footer, and we should not add another.
* if there is only one Capitolo table, we will assume it is at the top and there is no footer
* 3. duplicate the header table and place the duplicate at the bottom.
* 4. profit.
*/
function DisplayFooter() {
if(document.getElementById && wgNamespaceNumber==0) {
nofooter = document.getElementById('nofooter');
hp = document.getElementById('headerprevious');
hn = document.getElementById('headernext');
content = document.getElementById('bodyContent');
catlinks = document.getElementById('catlinks');
footer = document.createElement('table');
//header_template = document.getElementById('headertemplate');
if( (!((content) && (footer))) || (!(hp || hn)) ||
(nofooter))
return;
footer.setAttribute('class', 'headertemplate');
footer.setAttribute('id', 'footertemplate');
footer.setAttribute('style', 'margin-top:1em; clear:both;');
/* Begin footer HTML code */
tr = document.createElement('tr');
td = document.createElement('td');
td.setAttribute('align', 'left');
td.setAttribute('width', '33%');
if (hp) {
fp = hp.cloneNode(true);
fp.setAttribute('id', 'footerprevious');
td.appendChild(fp);
}
tr.appendChild(td);
td = document.createElement('td');
td.setAttribute('align', 'center');
td.setAttribute('width', '34%');
a = document.createElement('a');
a.setAttribute('href', '#top');
text = document.createTextNode('Return to the top of the page.');
a.appendChild(text);
td.appendChild(a);
tr.appendChild(td);
td = document.createElement('td');
td.setAttribute('align', 'right');
td.setAttribute('width', '33%');
if (hn) {
fn = hn.cloneNode(true);
fn.setAttribute('id', 'footernext');
td.appendChild(fn);
}
tr.appendChild(td);
footer.appendChild(tr);
/* End footer HTML code */
if(catlinks) // place footer before category box
content.insertBefore(footer, catlinks);
else
content.appendChild(footer);
}
}
$(DisplayFooter);
// </source>
/*************
*** Regex menu framework
*** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Regex_menu_framework>
*** - adds a sidebar menu of user-defined scripts.
*************/
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript');
/* menu links */
// In the function below, add more lines like "regexTool('link text','function_name()')" to add
// links to the sidebar menu. The function name is the function defined in rfmscripts() below.
function rmflinks() {
regexTool('Custom regex','custom()'); // a default tool which performs regex input in a dynamic form
regexTool('PostOCR','postOCR()');
regexTool('Apostrofi','apostrofi()');
}
/* scripts */
// Below, define the functions linked to from rmflinks() above. These functions can use any JavaScript,
// but there is a set of simplified tools documented at
// http://meta.wikimedia.org/wiki/User:Pathoschild/Script:Regex_menu_framework .
/* sidebar code for use with P/c's Regex code */
function DNBset() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/\{\{header\n \| title \=.+\n \| author \= \n \| translator \= \n \| section \= \n \| previous \= \n \| next \= \n \| notes \= \n\}\}\n/, '{{subst:DNBset\n |article= \n |previous= \n |next= \n |volume = \n |contributor = \n |wikipedia = \n |extra_notes= \n |from= \n |to= \n |section= \n}}');
}
function postOCR() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/'/g, '’')
.replace(/’’’/g, '\'\'\'')
.replace(/’’/g, '\'\'')
.replace(/E’ /g, 'È ')
.replace(/lP/g, 'll’')
.replace(/I’/g, 'l’')
.replace(/1’/g, 'l’')
.replace(/ :/g, ': ')
.replace(/([dlznt])’ /g, "$1’")
.replace(/[(\[] /g, " $1")
.replace(/ \n/g, '\n')
.replace(/\n\n/g, '<2p>')
.replace(/\n\n\n/g, '<3p>')
.replace(/-\n/g, '')
.replace(/\n/g, ' ')
.replace(/<2p>/g, '\n\n')
.replace(/<3p>/g, '\n\n\n')
.replace(/ ,/g, ", ")
.replace(/ ;/g, "; ")
.replace(/ !/g, "! ")
.replace(/ \?/g, "? ")
.replace(/ \./g, ". ")
.replace(/ :/g, ": ")
;
}
function apostrofi() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/'/g, '’')
.replace(/’’’/g, '\'\'\'')
.replace(/’’/g, '\'\'')
;
}
function dashes() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/--/g, '—')
}
function lines() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/ \n/g, '\n');
editbox.value = editbox.value.replace(/\n\n/g, '<p>');
editbox.value = editbox.value.replace(/-\n/g, '');
editbox.value = editbox.value.replace(/\n/g, ' ');
editbox.value = editbox.value.replace(/<p>/g, '\n\n')
}
function rmTextQual() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/\{\{TextQuality\|\d\d\%\}\}/, '');
}
function trans() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/ translator\w+\=/, ' override_translator = ');
}
function und2ital() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/\_/g, '\'\'');
}
function chapcase() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/CHAPTER/g, '{{sc|Chapter}}');
}
function welcome() {
var headerbox = document.getElementsByName('wpHeaderTextbox')[0];
editbox.value = editbox.value + '{{welcome}}-- ~~' + '~~';
editreason.value = editreason.value + 'welcome';
}
function weliptest() {
var headerbox = document.getElementsByName('wpHeaderTextbox')[0];
editbox.value = editbox.value + '{{subst:' + 'welcomeip}}-- ~~' + '~~\n{{test}}';
editreason.value = editreason.value + 'welcome & test';
}
function similar() {
var editbox = document.getElementsByName('wpTextbox1')[0];
editbox.value = editbox.value.replace(/\{\{header/g, '{{similar|}}\n{{header');
editreason.value = editreason.value + '{{similar}}';
}
//</pre>