// SCRIPT PER IL REVERT DI ] TRADOTTO E RIADATTATO ]
// Revert tools by Lorian<br />
//Riadattato per gli admin di wiktionary da ]<br />
// VERSIONE PER ADMIN
//<pre><nowiki>
//FUNZIONI RISERVATE AI SYSOP
//Grazie ]
function isSysop(){
if (wgUserGroups)
for(var i = 0; i < wgUserGroups.length; i++)
if (wgUserGroups == "sysop")
return true;
return false;
}
function getElementsByClass(searchClass,node,tag) {
// Function from http://www.dustindiaz.com/getelementsbyclass/
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els.className) ) {
classElements = els;
j++;
}
}
return classElements;
}
// _GET code from NoGray JS Library http://www.nogray.com/new_site/
var _GET = new Array();
var _uri = location.href;
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
var _temp_get_arr_1 = new Array();
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
_temp_get_arr_1 = _temp_get_arr.split("=");
_GET)] = decodeURI(_temp_get_arr_1);
}
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
function getMessage (where, user1) {
var message = prompt ('Scrivi un messaggio nella cronologia', '');
window.location = 'http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=' + _GET + '&action=edit&oldid=' + _GET + '&'+where+'=2&user1='+user1+'&message='+message;
}
$(function (){
if (location.href.match(/diff=/)) {
// Get username of submitter
var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1.getElementsByTagName('a').innerHTML;
var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2.getElementsByTagName('a').innerHTML;
var t='(<a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=' + _GET + '&action=edit&oldid=' + _GET + '&revert=1&user1='+user1+'">Ripristina</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\');">Messaggio</a>) (<a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=' + _GET + '&action=edit&oldid=' + _GET + '&vandalism=1&user1='+user1+'">Vandalismo</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\');">Messaggio</a>) (Avvisi: <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=1">Test</a> / <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=2">Vandalismo</a> / <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=3">Spam</a> / <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=4">WNF</a> / <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=5">WNB</a>/ <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=6">IP Vandalismo</a>/ <a href="http://it.wiktionary.orghttps://it.wiktionary.org/w/index.php?title=User_talk:'+user1+'&action=edit§ion=new&warn=7">Yc</a>)';
var regIP = /(+\.){3}+/;
var isIP = regIP.test(user2);
if (isSysop()) {
t += ' (Admin: <a href="http://it.wikibooks.orghttps://dictious.com/it/Speciale:Blocca/'+user2+'">Blocca</a> / <a href="http://tools.wikimedia.de/~luxo/contributions/contributions.php?user='+user2+'&blocks=true&lang=it">Interedits</a> / <a href="http://it.wikibooks.orghttps://it.wiktionary.org/w/index.php?title=Speciale%3ADeletedContributions&target='+user2+'">Contributi cancellati</a> / <a href="http://it.wikibooks.orghttps://it.wiktionary.org/w/index.php?title=' + _GET + '&action=protect">Proteggi</a> / <a href="http://it.wikibooks.orghttps://it.wiktionary.org/w/index.php?title=' + _GET + '&action=delete">Cancella</a> )';
if (isIP == true ) t += ' (IP: <a href="http://whois.domaintools.com/'+ user2 + '">Whois</a> / <a href="http://hemlock.ts.wikimedia.org/~krimpet/torcheck.php?ip='+user2+'">TOR</a>)';
}
document.getElementById('contentSub').innerHTML =t;
} else if (location.href.match(/revert=1/)) {
document.getElementById('wpSummary').value = 'Ripristinata la versione ' + _GET+' di +'|'+_GET+']]';
document.getElementById('editform').submit();
} else if (location.href.match(/revert=2/)) {
document.getElementById('wpSummary').value = 'Ripristinata la versione ' + _GET+' di +'|'+_GET+']] ('+_GET+')';
document.getElementById('editform').submit();
} else if (location.href.match(/vandalism=1/)) {
document.getElementById('wpSummary').value = 'Ripristinata la versione ' + _GET+' di +'|'+_GET+']] per vandalismo';
document.getElementById('editform').submit();
} else if (location.href.match(/vandalism=2/)) {
document.getElementById('wpSummary').value = 'Ripristinata la versione ' + _GET+' di +'|'+_GET+']] ('+_GET+') per vandalismo';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=1/)) {
document.getElementById('wpSummary').value = 'Avviso test';
document.getElementById('wpTextbox1').value = '{{test}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=2/)) {
document.getElementById('wpSummary').value = 'Avviso vandalismo';
document.getElementById('wpTextbox1').value = '{{vandalismo}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=3/)) {
document.getElementById('wpSummary').value = 'spam';
document.getElementById('wpTextbox1').value = '{{Spam}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=4/)) {
document.getElementById('wpSummary').value = 'WNF';
document.getElementById('wpTextbox1').value = '{{WNF}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=5/)) {
document.getElementById('wpSummary').value = 'WNB';
document.getElementById('wpTextbox1').value = '{{WNB}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=6/)) {
document.getElementById('wpSummary').value = 'IP Vandalismo';
document.getElementById('wpTextbox1').value = '{{IP Vandalismo}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=6/)) {
document.getElementById('wpSummary').value = 'Yc';
document.getElementById('wpTextbox1').value = '{{Yc|~~~~}}';
document.getElementById('editform').submit();
}
});
//SCRIPT VPOPSPEED
document.write('<script type="text/javascript" src="'
+ 'http://it.wikipedia.orghttps://it.wiktionary.org/w/index.php?title=Utente:Henna/VPopSpeed.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://nl.wikipedia.orghttps://it.wiktionary.org/w/index.php?title=Gebruiker:Valhallasw/hennading.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/////////////////////////////////////////////////////////////////////////////////////////////
//ADD AN "INVERT" BUTTON IN UNDELETION PAGE (SOURCE: HTTP://EN.WIKIPEDIA.ORG/WIKI/USER:CRYPTIC/TOGGLEUNDELETE.JS)
if ((toLoad.indexOf("adtog")!=-1))
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.type == "checkbox")
inputs.checked = !inputs.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");
if (h2)
{
var button = document.createElement('input');
button.type = "button";
button.value = "Inverti";
button.setAttribute('onClick', 'toggle_undelete()');
f.insertBefore(button, h2);
}
}
}
}
$(setup_toggle_undelete);
/*
* '''Restauration Deluxe'''
*
* COCHER/DÉCOCHER RAPIDEMENT LES CASES POUR RESTAURER UN ARTICLE
*
* Auteur : GôTô
* Dernière révision : 11 mai 2007
*/
// Code :<source lang="javascript" line="">
if ((toLoad.indexOf("adrus")!=-1))
function UndeleteSelectAll()
{
if(wgCanonicalSpecialPageName != 'Undelete') return;
var title2 = document.getElementsByTagName('h2');
var all = document.createElement('input');
all.setAttribute('type', 'checkbox');
all.setAttribute('onclick', 'SelectAllInputs(this.checked)');
all.setAttribute('title', 'Seleziona/deseleziona tutte');
title2.appendChild(all);
all.click();
}
function SelectAllInputs(bool)
{
var inputs = document.getElementById('undelete').getElementsByTagName('input');
for (var cpt = 0 ; cpt < inputs.length ; cpt++)
{
inputs.checked = bool;
}
}
$(UndeleteSelectAll);
//TAB PER GLI ADMIN-----------------------------------
if ((toLoad.indexOf("adlink")!=-1))
$(function (){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');
addlimenu(tabs, '_.Admin', 'Sysop'); //puoi cambiare 'Utilità' in qualcos'altro, ma non cambiare 'Sysop'
var Sysop = document.getElementById('Sysop').getElementsByTagName('ul');
//Una riga per ogni voce del menu
addlilink(Sysop,'https://dictious.com/it/Speciale:DeletedContributions','_.contributi eliminati', ''); // Esempio di collegamento nel menu
addlilink(Sysop,'https://dictious.com/it/Speciale:Blocca','_.blocca utente', '');
addlilink(Sysop,'https://dictious.com/it/Speciale:Importa','_.importa pagina', '');
addlilink(Sysop,'https://dictious.com/it/Speciale:Ripristina','_.recupera pagina', '');
addlilink(Sysop,'https://dictious.com/it/Speciale:ALinksearch','_.link esterni', '');
addlilink(Sysop,'https://dictious.com/it/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';
}
// 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
function deleteLinkify() {
var reason = prompt('Inserisci la ragione della cancellazione','in base alla ]');
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.href.indexOf(arp)==0 && links.href.indexOf('action=delete') == -1 && links.href.indexOf('/Special:') == -1 ) {
links.href += '?action=delete&submitdelete=true&deletetalkalso=true&wpReason=' + encodeURIComponent(reason);
links.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').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);
} 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");
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");
if (h2)
{
var i;
arrayMotivation = new Array("Cancellazione Immediata ", "Test", "titolo errato (corretto: ])", "promozionale", "Senza senso", "SPAM", "pagina rinominata", " Template inutile", "Template orfano", "Pagina contenente solo frasi offensive e/o volgari", "Pagina totalmente scritta in una lingua straniera", "Tautologica", "Nessun riscontro", "Pagina contenente solo link esterni", "Categoria senza pagine né subcategorie", "Pagina già cancellata e reinserita senza discussione con lo stesso contenuto", " Redirect inutile", "Redirect orfano", "Non adatta a wiktionary", "Cancellazione ordinaria come risulta da ]", "Copyviol da http://", "Tecnica per rimozione Copyviol ", " Recupero cronologia", "Vandalismo", "Wiktionary non è uno spazio hosting gratuito", "Trasferita su ] ", "Trasferita su ] ", "Trasferita su ] ", "Trasferita su ]", "Trasferita su ] ");
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,' ');
option.value = arrayMotivation;
motivazione.options = 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);
/* Special:Contributions Wildcard/CIDR lookup, version
Originally from: http://en.wikipedia.orghttps://dictious.com/it/User:Splarka/contribsrange.js
Notes:
* Uses the API (Requires http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=31312), which is faster than most CIDR contrib tools.
* Currently uses a GET json via <script src=""> to avoid ajax problems.
* Only currently works if submitted (or called by URL parameter, eg Special:Contributions/User).
** Checks namespace and date options in form.
* Uses: Submit any IP CIDR range /16 or from /24 to /32. Submit any string (at least 3 characters) with a suffixed asterisk.
** eg: or or .
** NOTE: Currently seems broken with spaces in the search string. Possibly a fault of the API. %20,+,_ don't work
To do:
* Sortable by address? (not useful until pagination is available).
* More like normal Special:Recentchanges (hist)(diff) blah blah blah (except talk page existence for red/blue link) with BiDi characters?
* Option to refresh on page? (not really needed, but might be more handy than onload action only).
* Respect limit in user prefs? frm.limit.value ?
*/
if(wgCanonicalSpecialPageName == 'Contributions') {
addOnloadHook(prefixContribsInit);
var prefixlimit = 500;
var frm = ''; //global
}
function prefixContribsInit() {
var show = (document.getElementById('contentSub')) ? document.getElementById('contentSub') : document.getElementById('topbar')
show.appendChild(document.createTextNode(' \u2022 Javascript contributi di ricerca potenziati è attivo. Devi inserire una gamma CIDR o aggiungere un asterisco a fare un prefisso di ricerca.'))
frm = document.getElementsByTagName('form');
if(!frm.target) return;
//general optionlets independant of type of search.
var opt_ns = (parseInt(frm.namespace.value) > -1) ? '&ucnamespace=' + frm.namespace.value : '';
var opt_ts = '';
if(queryString('ucstart')) {
opt_ts = '&ucstart=' + queryString('ucstart');
} else {
var m = '' + frm.month.selectedIndex;
var y = frm.year.value;
if(m.length == 1) m = '0' + m
if(y > 2000 && y < 2100) opt_ts = '&ucstart=' + y + '-' + m + '-01T00:00:00Z'
}
var options = opt_ns + opt_ts;
var patternCIDR = /(25|2|??)\.(25|2|??)\.(25|2|??)\.(25|2|??)\/(2|3|16)/i ;
var patternWild = /^.{3,}\*$/i ;
if(frm.target.value.search(patternCIDR) == 0) {
prefixContribsStartbox(frm.parentNode);
var cidr = frm.target.value.match(patternCIDR);
var range = cidr.match(/\d{1,2}$/i);
if(range == 24 || range == 16) {
//prefixable CIDR, lets do-er
if(range == 24) {
cidr = cidr.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\./);
} else {
cidr = cidr.match(/\d{1,3}\.\d{1,3}\./);
}
var url = wgScriptPath + '/api.php?action=query&format=json&rawcontinue=&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuserprefix=' + cidr;
prefixContribsCall(url);
} else {
//complex CIDR, lets figure it out
var oct3 = cidr.match(/\.\d{1,3}\//i).replace(/(\.|\/)/g,'');
cidr = cidr.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\./);
var num = Math.pow(2,32 - range);
var start = oct3 - oct3 % num;
var url = wgScriptPath + '/api.php?action=query&format=json&rawcontinue=&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuser=';
for(var i=start;i<=start + num;i++) {
url += '' + cidr + i;
if(i != start + num) url += '|'
}
prefixContribsCall(url);
}
} else if(frm.target.value.search(patternWild) == 0) {
//very simple wildcard, lets do-er
prefixContribsStartbox(frm.parentNode);
var prefix = frm.target.value.replace(/\*$/,'');
prefix = prefix.substr(0,1).toUpperCase() + prefix.substr(1);
var url = wgScriptPath + '/api.php?action=query&format=json&rawcontinue=&callback=prefixContribs&list=usercontribs' + options + '&uclimit=' + parseInt(prefixlimit) + '&ucuserprefix=' + prefix;
prefixContribsCall(url);
}
}
function prefixContribsStartbox(parent) {
var res = document.createElement('div');
res.setAttribute('id','results-from-CIDR');
res.style.border = '1px solid black';
res.style.padding = '.5em';
var prog = document.createElement('img');
prog.setAttribute('id','prefixcontribs-prog');
prog.setAttribute('src',stylepath + '/common/images/spinner.gif');
res.appendChild(prog);
parent.appendChild(res);
}
function prefixContribsCall(url) {
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src',url);
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head').appendChild(scriptElem);
}
function prefixContribs(obj) {
if(!obj || !obj) return
var prog = document.getElementById('prefixcontribs-prog');
if(prog) prog.parentNode.removeChild(prog)
cidr = obj;
var res = document.getElementById('results-from-CIDR');
res.appendChild(document.createElement('hr'));
if(cidr.length == 0) {
res.appendChild(document.createTextNode('Non ci sono modifiche per il range wildcard/CIDR.'));
res.appendChild(document.createElement('hr'));
return;
}
res.appendChild(document.createTextNode(cidr.length + ' risultati per la ricerca wildcard/CIDR con il range specificato (in ordine cronologico): '));
if(cidr.length == parseInt(prefixlimit)) {
res.appendChild(document.createElement('br'));
res.appendChild(document.createTextNode('Clicka '));
var ns = (parseInt(frm.namespace.value) > -1) ? '&namespace=' + frm.namespace.value : '';
var ts = (obj) ? obj.usercontribs.ucstart : cidr.timestamp;
addlinkchild(res, wgScript + '?title=Special:Contributions&target=' + encodeURIComponent(frm.target.value) + ns + '&ucstart=' + ts, 'qui');
res.appendChild(document.createTextNode(' per guardare i successivi ' + prefixlimit + ' risultati.'));
}
res.appendChild(document.createElement('hr'));
for(var i=0;i<cidr.length;i++) {
res.appendChild(document.createTextNode('\u2022 ' + cidr.timestamp.replace(/T*Z/,' ')));
addlinkchild(res, wgScript + '?title=Special:Contributions/' + cidr.user, cidr.user);
res.appendChild(document.createTextNode(' edited ('));
addlinkchild(res, wgScript + '?title=-&curid=' + cidr.pageid + '&diff=' + cidr.revid , 'diff');
res.appendChild(document.createTextNode(') '));
addlinkchild(res, wgScript + '?title=-&curid=' + cidr.pageid, cidr.title);
if(cidr.comment) res.appendChild(document.createTextNode(' (' + cidr.comment + ')'));
res.appendChild(document.createElement('br'));
}
}
function addlinkchild(obj,href,text,id,classes) {
if(!obj || !href || !text) return false;
var a = document.createElement('a');
a.setAttribute('href',href);
a.appendChild(document.createTextNode(text));
if(id) a.setAttribute('id',id);
if(classes) a.setAttribute('class',classes);
obj.appendChild(a);
}
function queryString(p) {
var re = RegExp('' + p + '=(*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches);
} catch (e) {
}
}
return null;
}
//</nowiki></pre>