Utente:Wim b/aggiornamenti.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.
$(function (){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, '_.Admin', 'Sysop'); //puoi cambiare 'Utilità' in qualcos'altro, ma non cambiare 'Sysop'
var Sysop = document.getElementById('Sysop').getElementsByTagName('ul')[0];
//Una riga per ogni voce del menu
addlilink(Sysop,'/wiki/Speciale:DeletedContributions','_.contributi eliminati', ''); // Esempio di collegamento nel menu
addlilink(Sysop,'/wiki/Speciale:Blocca','_.blocca utente', '');
addlilink(Sysop,'/wiki/Speciale:Importa','_.importa pagina', '');
addlilink(Sysop,'/wiki/Speciale:Ripristina','_.recupera pagina', '');
addlilink(Sysop,'/wiki/Speciale:Linksearch','_.link esterni', '');
addlilink(Sysop,'/wiki/Speciale:Protectedpages','_.pagine bloccate', '');
addlilink(Sysop,'javascript:GetNomeUtente();','_.inter edit', '');
addlilink(Sysop,'javascript:deleteLinkify();','_.speedy del', '');
});
function GetNomeUtente(){
var prmtnome
prmtnome=prompt("Inserisci il nome utente","");
window.location = 'http://tools.wikimedia.de/~luxo/contributions/contributions.php?user='+ prmtnome +'&lang=it';
}
function speedydele(){
// Outline for an automatic delete link generator.
// Not highly tested. Started by Splarka @ test.wikipedia
// Written for & maintained by Mike_lifeguard @ en.wikibooks
//GO IF contribs or log or newpages or [article AND (submit|view|purge)]
function deleteLinkify() {
var reason = prompt('Inserisci la ragione della cancellazione','in base alla [[Wikibooks:Cancellazione_immediata|policy di cancellazione immediata]]');
if(!reason) return;
var links = document.getElementById('bodyContent').getElementsByTagName('a');
var arp = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace(/\$1/,'');
if(links.length == 0) return
for(var i=0;i<links.length;i++) {
if(links[i].href.indexOf(arp)==0 && links[i].href.indexOf('action=delete') == -1 && links[i].href.indexOf('/Special:') == -1 ) {
links[i].href += '?action=delete&submitdelete=true&deletetalkalso=true&wpReason=' + encodeURIComponent(reason);
links[i].innerHTML += ' (delete)';
}
}
}
if(queryString('submitdelete') == 'true') addOnloadHook(function() {
if(document.getElementById('ca-talk').className.indexOf('new')==-1 && queryString('deletetalkalso')=='true' && ( wgNamespaceNumber % 2 == 0 ) ) {//if the talk tab is redlinked and this is the first time 'round AND this is not a talk page then:
document.getElementById('deleteconfirm').action += '&deletetalk=true&wpReason=' + queryString('wpReason');
}
document.getElementById('deleteconfirm').wpConfirmB.click();
})
if(wgAction == 'delete' && queryString('deletetalk') == 'true') addOnloadHook(function() {
var url = document.getElementById('ca-talk').getElementsByTagName('a')[0].href + '?action=delete&submitdelete=true&wpReason=' + queryString('wpReason');
document.location.href = url;
})
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
}
//Add an "cancel text" button in deletion page (thanks Utente:Lusum)
if ((toLoad.indexOf("canctxt")!=-1))
function cancel_text()
{
var f = document.getElementById("deleteconfirm");
if (f)
{
var input = document.getElementById("wpReason");
input.value="";
}
}
function setup_cancel_text()
{
if (document.title.indexOf("Cancella") == 0)
{
var f = document.getElementById("deleteconfirm");
if (f)
{
var h2 = f.getElementsByTagName("input")[2];
if (h2)
{
var button = document.createElement('input');
button.type = "button";
button.value = "Cancella Testo";
button.setAttribute('onClick', 'cancel_text()');
f.appendChild(button, h2);
}
}
}
}
$(setup_cancel_text);
function setup_motivazione() {
if (document.title.indexOf("Cancella") == 0)
{
var p = document.getElementById("deleteconfirm");
if (p)
{
var h2 = p.getElementsByTagName("input")[2];
if (h2)
{
var i;
arrayMotivation = new Array("cancellazione immediata ", "contenuti minimi", "stub da più di 6 mesi", "contenuto [[Aiuto:Cosa Wikibooks non è|non adatto]] a Wikibooks", "pagina unita con [[]]", "pagina spostata a [[]]", "[[Wikibooks:Pagine_da_cancellare/ |Votazione]]", "da http://", "Pulitura cronologia da copyviol", "Pulitura cronologia da volgarità", "Wikibooks non è uno spazio hosting gratuito", "pagina senza libro annesso", "talk anonima scaduta", "trasferita su [[v:|Wikiversity]] ", "trasferita su [[w:|Wikipedia]] ", "trasferita su [[s:|Wikisource]] ", "trasferita su [[wikt:|Wiktionary]] ");
var motivazione = document.createElement('select');
motivazione.name = 'popupSelect';
motivazione.id = 'motivazione';
motivazione.size = 1;
var option;
// Carica nel combo box il contenuto della variabile globale
for (i = 0; i < arrayMotivation.length; i++){
option = new Option(arrayMotivation[i],' ');
option.value = arrayMotivation[i];
motivazione.options[motivazione.length] = option;
}
p.appendChild(motivazione);
var button = document.createElement('input');
button.type = "button";
button.value = "Ok";
button.setAttribute('onClick', 'inserisci_motivazione()');
p.appendChild(button);
}
}
}
}
function inserisci_motivazione() {
motivazione = document.getElementById('motivazione').value;
var f = document.getElementById("deleteconfirm");
if (f)
{
var input = document.getElementById("wpReason");
input.value=motivazione;
}
}
$(setup_motivazione);
/***** tool x le cancellazioni immagine *****/
if ((toLoad.indexOf("cancfiletxt")!=-1))
function cancel_file_text()
{
var f = document.getElementById("mw-filedelete-submit");
if (f)
{
var input = document.getElementById("wpReason");
input.value="";
}
}
function setup_file_text()
{
if (document.title.indexOf("Cancella") == 0)
{
var f = document.getElementById("mw-filedelete-submit").parentNode;
if (f)
{
var button = document.createElement('input');
button.type = "button";
button.value = "Cancella motivazione";
button.setAttribute('onClick', 'cancel_file_text()');
f.appendChild(button, f);
}
}
}
$(setup_file_text);
function setup_file_motivazione() {
if (document.title.indexOf("Cancella") == 0)
{
var p = document.getElementById("mw-filedelete-submit").parentNode;
if (p)
{
var h2 = p.getElementsByTagName("input")[0];
arrayMotivation = new Array("unverified da più di 7 giorni", "criterio [[Template:Cancella_subito#11|11]] (trasferita su [[commons:|Wikimedia Commons]])", "criterio [[Template:Cancella_subito#10|10]] (immagine orfana)", "criterio [[Template:Cancella_subito#10|10]] (immagine inutile)", "criterio [[Template:Cancella_subito#10|10]] (immagine non funzionanate)", "cancellazione ordinaria come risulta da [[Wikibooks:Pagine_da_cancellare/ |qui]]", "copyviol da http://", "recupero cronologia", "vandalismo", "Wikibooks non è uno spazio hosting gratuito");
var motivazione = document.createElement('select');
motivazione.name = 'popupSelect';
motivazione.id = 'motivazione';
motivazione.size = 1;
var option;
// Carica nel combo box il contenuto della variabile globale
for (i = 0; i < arrayMotivation.length; i++){
option = new Option(arrayMotivation[i],' ');
option.value = arrayMotivation[i];
motivazione.options[motivazione.length] = option;
}
p.appendChild(motivazione);
var button = document.createElement('input');
button.type = "button";
button.value = "OK";
button.setAttribute('onClick', 'inserisci_file_motivazione()');
p.appendChild(button);
}
}
}
function inserisci_file_motivazione() {
motivazione = document.getElementById('motivazione').value;
var f = document.getElementById("mw-filedelete-submit");
if (f)
{
var input = document.getElementById("wpReason");
input.value=motivazione;
}
}
$(setup_file_motivazione);
//</source>