Usor:OrbiliusMagister/monobook.js
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* <nowiki> */
function fixformat(){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value = txt.value
.replace(/\’/g, "'")
.replace(/E' /g, "È ")
.replace(/É /g, "È ")
.replace(/ pò/g, " po'")
.replace(/ e'/g, " è")
.replace(/ é/g, " è")
.replace(/ nè /g, " né ")
.replace(/ ne' /g, " né ")
.replace(/piu'/g, "più")
.replace(/ quà/g, " qua")
.replace(/affinchè/g, "affinché")
.replace(/affinche' /g, "affinché ")
.replace(/sicchè/g, "sicché")
.replace(/benchè/g, "benché")
.replace(/benche' /g, "benché ")
.replace(/perchè/g, "perché")
.replace(/perche' /g, "perché ")
.replace(/poichè/g, "perché")
.replace(/poiche' /g, "poiché ")
.replace(/<\/?(b|strong)>/gi, "'''")
.replace(/<\/?(i|em|var)>/gi, "''")
//.replace(/\{\{([Ss]u[bp])\|([^}]+)\}\}/g, "{{subst:$1|$2}}")
//.replace(/<\/div +>/gi, "</div>");
form.wpSummary.value += "";
form.wpMinoredit.checked = true;
}
function replace(){
var s = prompt("Cerca regexp?");
if(s){
var r = prompt("Sostituisci regexp?");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
function moveprotect(){
document.getElementById('wpReasonProtect').value = "Protect from moves only";
document.getElementById('wpMoveOnly').checked = true;
}
function welcome(){
var form = document.editform;
var txt = form.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{subst:benve|- ~~~~}}';
form.wpSummary.value = 'welcome';
form.wpMinoredit.checked = true;
}
// [[:en:User:Lupin/popups.js]] - please include this line
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
function moveprotect(){
document.getElementById('wpReasonProtect').value = "Protect from moves only";
document.getElementById('wpMoveOnly').checked = true;
}
function cancella(){
var form = document.editform;
var txt = form.wpTextbox1;
if(txt.value.lenght < 200) form.wpSummary.value = 'Cancella subito (Contenuto: "' + txt.value + '")';
txt.value = '{{cancella subito}}\n' + txt.value;
form.wpSummary.value = 'cancella subito';
form.wpMinoredit.checked = true;
}
function aiutare(){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value = '{{da aiutare|motivo=minime informazioni ([[Aiuto:Wikipedia non è un dizionario|WND]])|data=~~~~~}}\n' + txt.value;
form.wpSummary.value = 'aiutare';
form.wpMinoredit.checked = true;
}
function wikificare(){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value = '{{da wikificare}}\n' + txt.value;
form.wpSummary.value = 'wikificare';
form.wpMinoredit.checked = true;
}
function vote_plus(){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value += '*{{più}} 1 ~~~~';
form.wpSummary.value = '+1';
form.wpMinoredit.checked = true;
}
function vote_minus(){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value += '*{{meno}} 1 ~~~~';
form.wpSummary.value = '-1';
form.wpMinoredit.checked = true;
}
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
na.accesskey = key;
var pref = 'alt-';
if(((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 ) pref = 'control-';
if(clientPC.indexOf('opera')!=-1) pref = 'shift-esc-';
if(key && title) na.title = title + ' [' + pref + key + ']';
else if(title) na.title = title;
else if(key) na.title = '[' + pref + key + ']';
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
function addPurge(){
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addTab(x.replace(/=history/, "=purge"), 'agg.', 'ca-purge', 'Aggiorna la cache per questa pagina', 'g');
}
function addEditSection0(){
if(!document.getElementById) return;
var x = document.getElementById('ca-edit');
if(!x) return;
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if(x.className == 'selected'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if(x.className == 'selected istalk'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if(x.children){
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
z.title = 'Modifica la sezione zero di questa pagina';
akeytt();
}
function changeLinks(){
if(!document.getElementById) return;
document.getElementById('pt-mytalk').firstChild.innerHTML = 'Le mie discussioni';
document.getElementById('pt-preferences').firstChild.innerHTML = 'Preferenze';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'Osservati speciali';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contributi';
document.getElementById('pt-logout').firstChild.innerHTML = 'Esci';
if(document.getElementById('ca-talk'))
document.getElementById('ca-talk').firstChild.innerHTML = 'Discussione';
if(document.getElementById('ca-edit'))
document.getElementById('ca-edit').firstChild.innerHTML = 'Modifica';
if(document.getElementById('ca-nstab-wp'))
document.getElementById('ca-nstab-wp').firstChild.innerHTML = 'Articolo';
}
function addForceSummary(){
if(!/&action=edit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
}
function forceSummary(){
var form = document.forms.editform;
if(!form.wpSummary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){
var r = prompt('Salvi senza scrivere nulla nel campo oggetto?\nPer inserire un testo scrivi qui sotto:',form.wpSummary.value);
if(r == null) return false;
form.wpSummary.value = r;
}
return true;
}
function morelinks(){
if(document.title.indexOf("Modifica di Discussioni utente:") == 0){
addTab('javascript:replace()', 'Sostituisci');
addTab('javascript:welcome()', 'Benvenuto');
}else if(document.title.indexOf("Modifica ") == 0){
if(document.title.indexOf("Modifica di Wikipedia:Pagine da cancellare/") == 0){
addTab('javascript:vote_plus()', '+1');
addTab('javascript:vote_minus()', '-1');
} else {
addTab('javascript:replace()', 'Replace');
addTab('javascript:fixformat()', 'formatta');
//addTab('javascript:cancella()', 'Cancella');
addTab('javascript:aiutare()', 'Aiuto');
addTab('javascript:wikificare()', 'Wikifica');
//}else if(document.title.indexOf("Confirm delete - Delete") == 0){
// addTab('javascript:vfddelete()', 'VFD');
//}else if(document.title.indexOf("Confirm protection - Protect") == 0){
// addTab('javascript:moveprotect()', 'MV');
}
}
}
function addToolBoxLinks(){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/wiki/Speciale:Newpages', 'Pagine nuove', 't-newpages');
addlilink(tb, '/wiki/Speciale:Shortpages', 'Pagine brevi', 't-shortpages');
// addlilink(tb, '/wiki/Wikipedia:Ultime_modifiche', 'Ultime modifiche', 'open issues');
}
function strip_namespace(target){
var colon = target.indexOf(':');
if(colon != -1){
var spaces = ['Utente', 'Wikipedia', 'Immagine', 'MediaWiki', 'Template', 'Aiuto', 'Categoria'];
var ns = target.substring(0, colon);
if(ns == '' || ns == 'Talk') return target.substring(colon + 1);
else
for(var i = 0; i < spaces.length; ++i)
if(ns == spaces[i] || ns == spaces[i] + '_talk') return target.substring(colon + 1);
}
return target;
}
// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&ip=username" is present.
function do_blockip_stuff(){
var form = document.getElementById('blockip');
// focus on Reason field
form.wpBlockReason.focus();
var target = getParam('ip');
if(target == '') return;
// add "blocklog" tab
addTab('/wiki/Speciale:Log/block?page=Utente:' + target, 'blocklog', 'ca-blocklog');
}
// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab(){
var c1 = document.getElementById('column-one');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
// use the "edit this page" tab to get already-tidied url
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&action=edit" from the end
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
editlk = editlk.substring(editlk.indexOf(':') + 1);
var slloc = editlk.indexOf('/');
if(slloc > 0) editlk = editlk.substring(0, slloc);
// add "block" tab
addTab('/wiki/Speciale:Blockip?ip=' + editlk, 'block', 'ca-block');
// add "blocklog" tab
addTab('/wiki/Speciale:Log/block?page=Utente:' + editlk, 'blocklog', 'ca-blocklog');
}
function blockip()
{
if(document.title.indexOf('Utente:') == 0 || document.title.indexOf('Discussioni utente:') == 0)
add_block_tab();
else if(document.title.indexOf('Block user') == 0) // could stand to be more robust
do_blockip_stuff();
}
function getParam(name){
if(location.search){
for(var x in location.search.substring(1).split('&')){
var eq = x.indexOf('=');
if(x.substring(0, eq) == name) return x.substring(eq + 1);
}
}
return '';
}
function myLoadFuncs(){
addPurge();
//addEditSection0();
changeLinks();
//addForceSummary();
morelinks();
addToolBoxLinks();
//blockip();
}
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else{
window._old_ABCD_onload = window.onload;
window.onload = function(){
window._old_ABCD_onload();
myLoadFuncs();
}
}
/* </nowiki> */