Utente:Kal-El/monobook.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m minuzia
copia incolla da paulatz
Riga 1:
/* <nowikipre> */
 
 
Riga 8:
* See also: [[User:JesseW/monobook.js]]
* For italian translation [[it:Utente:Helios89/monobook.js]]
* Additional programming: [[it:Utente:Paulatz/monobook.js]]
*/
 
/** GLOBALS **/
var curTemplate;
 
/**** Initialise on window load ****/
Riga 31 ⟶ 35:
addPurge();
// &section=0
//addEditSection0();
// cause the personal menu looks bad
changeLinks();
// because edit summaries are good
//addForceSummary();
// if this is VFD, add the show/hide thingies
if(document.title.indexOf("Wikipedia:Pagine da cancellare") != -1 && document.title.indexOf("Editing ") != 0) vfdlinks();
Riga 50 ⟶ 54:
}
 
/**** Extra tab adding ****/
 
// Functions auxFicus and Ficus
function addEditSection0()
function auxFicus(){
{
Argument = document.getElementById('inlinePopupDiv').getElementsByTagName('select')[0].value;
ta['ca-edit-0'] = ['', 'Modifica la sezione 0'];
Template = curTemplate;
if(!document.getElementById) return;
 
var x = document.getElementById('ca-edit');
wpTextbox1 = document.getElementById("wpTextbox1");
if(!x) return;
if (Template == "W"||Template == "w")
var y = document.createElement('LI');
wpTextbox1.value="{{"+Template+"|"+Argument+"|"+"{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}|~~~~}}"+wpTextbox1.value;
y.id = 'ca-edit-0';
else {
if(x.className == 'selected'){
Because = document.getElementById('inlinePopupDiv').getElementsByTagName('input')[0].value;
if(/&action=edit&section=0$/.test(window.___location.href)){
wpTextbox1.value="{{"+Template+"|"+Because+"|"+Argument+"|"+"{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}|~~~~}}"+wpTextbox1.value;
x.className = 'istalk';
y.className = 'selected';}
summ=document.getElementById("wpSummary");
} else {
summ.value=summ.value+"+Aiutare";
x.className = 'selected istalk';
RemoveNode('inlinePopupDiv');
}
}
} else if(x.className == 'selected istalk'){
 
if(/&action=edit&section=0$/.test(window.___location.href)){
function Ficus(Template){
x.className = 'istalk';
arrayArgument = new Array("antropologia", "archeologia", "architettura", "biografie", "biologia", "calcio", "chimica", "cinema", "diritto", "economia", "filosofia", "fisica", "fumetti", "geografia", "giochi", "informatica", "ingegneria", "letteratura", "matematica", "meccanica", "medicina", "musei", "musica", "politica", "religione", "scienza", "sociologia", "sport", "storia", "teatro")
y.className = 'selected istalk';
 
} else {
switch(Template){
y.className = 'istalk';
case }"A":
}case else {"a":
Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Da aiutare\"</b>\n. Per favore scrivi una motivazione e scegli un argomento dalla lista";
y.className = x.className;
x.className = 'istalk'break;
}case "C":
case "c":
var z = document.createElement('A');
Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Da controllare\"</b>\n. Per favore scrivi una motivazione e scegli un argomento dalla lista";
if(x.children){
break;
z.href = x.children[0].href + '&section=0';
case "P":
z.appendChild(document.createTextNode('0'));
case "p":
y.appendChild(z);
Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Segnalazioni NPOV\"</b>\n. Per favore scrivi una motivazione e scegli un argomento dalla lista";
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{ break;
case "W":
z.href = x.childNodes[0].href + '&section=0';
case "w":
z.appendChild(document.createTextNode('0'));
Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Da wikificare\"</b>\n. Per favore scegli un argomento dalla lista.";
y.appendChild(z);
break;
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
default: Greeter = "Qualcosa è andato storto, fai pure quello che vuoi: non ho idea di cosa succederà"
}
 
curTemplate = Template;
 
var div = document.createElement( 'div' );
div.id = 'inlinePopupDiv';
div.style.position = 'absolute';
div.style.zIndex = 1000;
div.style.left = '5px';
div.style.top = '5px';
div.style.backgroundColor = '#FFFFFF';
div.style.borderStyle = 'solid';
div.style.borderWidth = ' medium';
div.style.borderColor = '#000000';
 
var top = document.createElement( 'div' );
top.id = 'inlinePopupTop';
top.style.textAlign = 'right';
top.style.margin = '8px';
top.style.backgroundColor = '#DDDDDD';
 
 
var a = document.createElement( 'a' );
a.appendChild( document.createTextNode( 'Close' ) );
a.href = "javascript:void RemoveNode('inlinePopupDiv')";
a.style.margin = '8px';
 
top.appendChild( a );
 
div.appendChild( top );
 
var greet = document.createElement('p');
greet.innerHTML = Greeter;
div.appendChild(greet);
 
var form = document.createElement('form');
form.name = "popupForm";
var p = document.createElement('p');
 
p.appendChild(document.createTextNode('Motivazione:'));
if((Template!='W')&&(Template!='w')){
var myedit = document.createElement('input');
myedit.name = 'editReason';
myedit.type = 'text';
p.appendChild(myedit);
}
 
p.appendChild(document.createTextNode('Argomento:'));
 
var sel = document.createElement('select');
sel.name = 'popupSelect';
sel.size = 1;
var option;
for (i=0; i<arrayArgument.length; i++){
option = new Option(arrayArgument[i],' ');
option.value = arrayArgument[i];
sel.options[sel.options.length] = option;
}
p.appendChild(sel);
 
var button = document.createElement('input');
button.value = 'OK';
button.type = 'button';
button.setAttribute('onclick', 'auxFicus()');
p.appendChild(button);
 
form.appendChild(p);
div.appendChild(form);
 
document.body.appendChild( div );
div.getElementsByTagName('input')[0].focus();
}
 
 
/**** Extra tab adding ****/
 
function addlilink(tabs, url, name, id){
Riga 146 ⟶ 223:
txt.value += '{{subst:edit summary}} ~~~~';
txt.focus();
}
 
function startThread()
{
var txt = document.editform.wpTextbox1;
var which = prompt("Thread number?");
var now = new Date();
if(which < 10) which = '0' + which;
var timestamp = now.getUTCFullYear() + '';
now.getUTCMonth() < 9 ? timestamp += '0' + (now.getUTCMonth() + 1) : timestamp += (now.getUTCMonth() + 1);
now.getUTCDate() < 10 ? timestamp += '0' + now.getUTCDate() : timestamp += now.getUTCDate();
txt.value += '\n{{User talk:Alphax/' + timestamp + '-' + which + '}}';
document.editform.wpSummary.value = 'new thread';
}
 
Riga 227 ⟶ 291:
addlilink(tabs, 'javascript:showvfd()', 'show closed', 'ca-show');
ta['ca-show'] = ['', 'Show closed VFDs'];
}
 
function changeLinks()
{
if(!document.getElementById) return;
// remove the "my" bits
// add a clock
var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
addlilink(toplinks, '', '', 'utcdate');
showtime();
}
 
function addForceSummary(){
if(!/&action=edit/.test(window.___location.href)) return;
if(/&section=new/.test(window.___location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
}
 
function forceSummary(){
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1')){
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) return false;
document.forms.editform.wpSummary.value = r;
}
return true;
}
 
Riga 312 ⟶ 350:
addlilink(tb, '/wiki/WP:ICT', 'Image Copyright tags', '');
}
 
function showtime()
{
var timerID;
var now = new Date();
var timeValue = now.toUTCString().replace(/GMT/, "UTC");
document.getElementById('utcdate').firstChild.innerHTML = timeValue;
timerID = setTimeout('showtime()', 100);
}
 
 
// Returns <li><a href="url">name</a></li>
Riga 366 ⟶ 394:
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=UserUtente%3A' + target, 'blocklog'));
}
 
Riga 403 ⟶ 431:
 
//add "contributions" tab
tabs.appendChild(addlilink('/w/wiki.phtml?title=Speciale:Contributions&target=UserUtente:%3A' + editlk, 'contributions'));
 
}
Riga 473 ⟶ 501:
document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';
//
UserMenu.insertBefore( 'pt-mycontris', 'pt-list', 'copyscape', 'http://copyscape.com/' );
 
UserMenu.insertBefore( 'pt-logout' , 'pt-logs', 'log',
'/w/index.php?title=Special%3ALog&user=' + userName );
UserMenu.insertBefore( 'pt-logoutlogs' , 'pt-irckate' , '#ircn° edit', 'irc://irc.freenode.net/wikipedia-it' );
UserMenu.insertBefore( 'pt-logs' , 'pt-kate', 'edit',
'javascript:void InlineKate( "' + userName + '" )' );
 
// so I always know what time it is in UTC land:
//
UserMenu.append( 'pt-utc', UTCTime(), 'javascript:void UserMenu.setText("pt-utc",UTCTime())' );
 
// article-actions menu, (the "tabs")
Riga 501 ⟶ 524:
NavMenu.append( 'n-' + x++, 'Sondaggi', '/wiki/Wikipedia:Sondaggi' );
NavMenu.append( 'n-' + x++, 'Stub', '/wiki/Categoria:Stub' );
NavMenu.append( 'n-' + x++, 'Utenti problematici', '/wiki/Wikipedia:Utenti problematici' );
NavMenu.append( 'n-' + x++, 'Vetrina', '/wiki/Wikipedia:Articoli in vetrina' );
 
 
Riga 608 ⟶ 629:
}
 
function RemoveNode( id )
{ var node = document.getElementById( id )
node.parentNode.removeChild( node );
}
 
function UTCTime()
{
// Get a date stamp for the time in UTC-land.
//
// for the future: a format arg
//
var s = '',
d = new Date(),
a = 'Gen Feb Mar Apr Mag Giu Lug Ago Set Ott Nov Dic'.split(' ');
return d.getUTCDate() + ' ' +
a[ d.getUTCMonth() ] + ' ' +
d.getUTCFullYear() + ' ' +
( '0' + d.getHours() ).substr( -2 ) + ':' +
( '0' + d.getMinutes() ).substr( -2 ) + ' ' + 'UTC';
}
 
Riga 645 ⟶ 651:
}
addLoadEvent(WikiSign);
 
//Add an "invert" button in Undeletion page (source: http://en.wikipedia.org/wiki/User:Cryptic/toggleundelete.js)
 
function toggle_undelete()
{
var f = document.getElementById("undelete");
if (f)
{
var inputs = f.getElementsByTagName("input");
var i;
for (i = 0; i < inputs.length; ++i)
if (inputs[i].type == "checkbox")
inputs[i].checked = !inputs[i].checked;
}
}
 
function setup_toggle_undelete()
{
if (document.title.indexOf("Vedi e recupera pagine cancellate") == 0)
{
var f = document.getElementById("undelete");
if (f)
{
var h2 = f.getElementsByTagName("h2")[0];
if (h2)
{
var button = document.createElement('input');
button.type = "button";
button.value = "Inverti";
button.setAttribute('onClick', 'toggle_undelete()');
f.insertBefore(button, h2);
}
}
}
}
 
addOnloadHook(setup_toggle_undelete);
 
//Add allpages button
 
function addToPortlet(id, obj)
{
var f = document.getElementById(id);
f = f.getElementsByTagName("div")[0];
f.appendChild(obj);
}
 
function allpages_button_click(){
var inputs = document.getElementById("p-search").getElementsByTagName('input');
var i;
for (i = 0; i < inputs.length; ++i)
if (inputs[i].type == "text")
top.___location.href = 'http://it.wikipedia.org/wiki/Speciale:Allpages/' + inputs[i].value;
}
 
function setup_test(){
var button = document.createElement('input');
button.type = "button";
button.value = "Allpages";
button.setAttribute('onClick', 'allpages_button_click()');
 
addToPortlet("p-search", document.createElement("hr"));
addToPortlet("p-search", button);
 
}
 
addOnloadHook(setup_test);
 
 
//ToolbarButton
Riga 764 ⟶ 702:
}
// pulsante DA WIKIFICARE
tmp = document.createElement("a");
tmp.id = 'tb-wik';
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value="{{wik|'+mese+' '+anno+'}}\\n"+wpTextbox1.value;summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{wik}}";})();';
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/7/71/Wikifichino.gif');
imag.setAttribute('alt','[Wik]');
imag.setAttribute('title','{{wikificare}}');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante STUB
tmp = document.createElement("a");
tmp.id = 'tb-wikstb';
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value="{{stub}}\\n"+wpTextbox1.value;summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{stub}}";})();';
var imag = document.createElement("img");
Riga 786 ⟶ 713:
toolbar.appendChild(tmp);
// pulsante DA FICUS-AIUTARE
tmp = document.createElement("a");
tmp.id = 'tb-aiufic';
tmp.href = "javascript:Ficus('A');";
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value="{{da aiutare|motivo="+(prompt("Motivo"))+"|data='+mese+' '+anno+'}}\\n"+wpTextbox1.value;summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{da aiutare}}";})();';
//tmp.href = "javascript:void auxFicus('TestCase')";
imag = document.createElement("img");
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/2/23/Aiutino.gif');
imag.setAttribute('altsrc','[Aiu]http://upload.wikimedia.org/wikipedia/it/c/c4/Pulsante-aiutare.gif');
imag.setAttribute('titlealt','{{da aiutare}}[ficus]');
imag.setAttribute('title','{{A}}iutare');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante BENVENUTOFICUS-CONTROLLARE
tmp = document.createElement("a");
tmp.id = 'tb-benfic';
tmp.href = "javascript:Ficus('C');";
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value="{{benvenuto|nome={{PAGENAME}}|firma=~~~ ~~~~~}}~~~ ~~~~~"+wpTextbox1.value;summ=document.getElementById("wpSummary");summ.value=summ.value+"Benvenuto su it.wiki!";})();';
//tmp.href = "javascript:void auxFicus('TestCase')";
imag = document.createElement("img");
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/7/74/Pulsante_benvenuto.png');
imag.setAttribute('altsrc','[Ben]http://upload.wikimedia.org/wikipedia/it/e/e2/Pulsante-controllare.gif');
imag.setAttribute('titlealt','Benvenuto su it.wiki![ficus]');
imag.setAttribute('title','{{C}}ontrollare');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante FICUS-POV
tmp = document.createElement("a");
tmp.id = 'tb-fic';
tmp.href = "javascript:Ficus('P');";
//tmp.href = "javascript:void auxFicus('TestCase')";
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/a/ab/Pulsante-pov.gif');
imag.setAttribute('alt','[ficus]');
imag.setAttribute('title','{{P}}OV');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante FICUS-WIKIFICARE
tmp = document.createElement("a");
tmp.id = 'tb-fic';
tmp.href = "javascript:Ficus('W');";
//tmp.href = "javascript:void auxFicus('TestCase')";
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/2/24/Pulsante-wikificare.gif');
imag.setAttribute('alt','[ficus]');
imag.setAttribute('title','{{W}}ikificare');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
// pulsante VOTO FAVOREVOLE +1
tmp = document.createElement("a");
tmp.id = 'tb-piu';
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value=wpTextbox1.value+"*{{+1}} ~~~ ~~~~~";summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{+1}}";document.getElementById("wpMinoredit").checked=1;})();';
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/f/f8/Favorevole.png');
imag.setAttribute('alt','[+1]');
imag.setAttribute('title','voto +1');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante VOTO ASTENUTO =0
tmp = document.createElement("a");
tmp.id = 'tb-uguale';
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value=wpTextbox1.value+"*{{0}} ~~~ ~~~~~";summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{0}}";document.getElementById("wpMinoredit").checked=1;})();';
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/a/aa/Astenuto.png');
imag.setAttribute('alt','[=0]');
imag.setAttribute('title','voto =0');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
 
// pulsante VOTO CONTRARIO -1
tmp = document.createElement("a");
tmp.id = 'tb-meno';
tmp.href = 'javascript:(function() {wpTextbox1=document.getElementById("wpTextbox1");wpTextbox1.value=wpTextbox1.value+"*{{-1}} ~~~ ~~~~~";summ=document.getElementById("wpSummary");summ.value=summ.value+"+{{-1}}";document.getElementById("wpMinoredit").checked=1;})();';
var imag = document.createElement("img");
imag.setAttribute('src','http://upload.wikimedia.org/wikipedia/it/4/43/Contrario.png');
imag.setAttribute('alt','[-1]');
imag.setAttribute('title','voto -1');
tmp.appendChild(imag);
toolbar.appendChild(tmp);
Riga 810 ⟶ 796:
addLoadEvent(ToolbarButton);
 
/* </nowikipre> */