Utente:Virex/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>
== GLOBAL ==
<pre> */
document.write('<script type="text/javascript" src="' +
'http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Ajax_sysop/experimental.js' +
'&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*</pre>
== COLLEGAMENTO A FONDOPAGINA ==
<pre> */
function extralinks2()
{
var titel2 = encodeURI(wgTitle.split("(",1));
/* if (wgNamespaceNumber == 0) {
// crea un collegamento nella barra che riamanda a fondo pagina
var node = document.getElementById("searchBody");
var newnode = node.appendChild(document.createElement("ul"));
newnode.style.textAlign = "left";
} */
mw.util.addPortletLink("p-personal","#footer","▼","","Fondopagina","",document.getElementById('pt-userpage'));
}
$(extralinks2);
/*</pre>
== COLLEGAMENTI CHE SEGUONO IL PUNTATORE ==
<pre> */
///////////////DI [[Utente:Wim b]]//////
{var Inizio_pagina="<div style=\"position:fixed;background-color:transparent;bottom:10px;left:134px;z-index:99;display:block\"><A HREF=\"#top\"><IMG SRC=\"http://upload.wikimedia.org/wikipedia/commons/5/55/Fairytale_up_red.png\" WIDTH=\"25\" HEIGHT=\"25\" ALT=\"Inizio pagina\"></IMG></A></div>";
document.write(Inizio_pagina);
}
/*</pre>
== Batch delete ==
<pre> */
/* Ajax batch delete thingy, version [0.1.1b]
Originally from: http://en.wikipedia.org/wiki/User:Splarka/ajaxbatchdelete.js
Notes:
* It is a bit verbose, after debugging perhaps some output should be removed.
* It waits 1 second after every delete before starting the next.
* Can be aborted by simply deleting the contents of the textarea, or leaving the page.
* Stops when it hits a blank line.
* Nonfatal errors (skip to next line):
** Bad character or malformed line
** Bad token
** Unexpected response
* Pauses in execution can be added with a blank line.
To do:
* Cache the token if two the same?
** Please note the delete token is not guaranteed to be static, but currently it always is.
*/
$(function() {
mw.util.addPortletLink('p-tb','/wiki/Special:BlankPage?blankspecial=ajaxbd','Batch Delete');
});
if(wgCanonicalSpecialPageName && wgCanonicalSpecialPageName.toLowerCase() == 'blankpage' && queryString('blankspecial') == 'ajaxbd') {
document.title = 'Ajax Batch Deletion';
addOnloadHook(abdForm);
}
function abdForm() {
mw.util.addPortletLink('p-tb','/wiki/Special:Log/delete?user=' + encodeURIComponent(wgUserName),'My delete log');
//subvert this Special: page to our own needs.
var con = document.getElementById('content') || document.getElementById('mw_content');
var bcon = document.getElementById('bodyContent') || document.getElementById('mw_contentholder');
var fh = getElementsByClassName(con,'h1','firstHeading')[0];
while(fh.firstChild) fh.removeChild(fh.firstChild)
fh.appendChild(document.createTextNode('Ajax Batch Deletion'));
for(var i=0;i<bcon.childNodes.length;i++) {
bcur = bcon.childNodes[i];
if(bcur.id != 'siteSub' && bcur.id != 'contentSub' && bcur.className != 'visualClear') {
while(bcur.firstChild) bcur.removeChild(bcur.firstChild)
if(bcur.nodeType == 3) bcur.nodeValue = '';
}
}
//generate content
var form = document.createElement('form');
form.appendChild(document.createTextNode('Lista delle pagine da cancellare:'));
form.appendChild(document.createElement('p'));
form.setAttribute('action','javascript:void(0);');
var txt = document.createElement('textarea');
txt.style.height = '20em';
txt.style.width = '50%';
txt.setAttribute('id','abd-textarea');
form.appendChild(txt);
form.appendChild(document.createElement('p'));
var lab1 = document.createElement('label');
lab1.setAttribute('for','abd-reason')
lab1.appendChild(document.createTextNode('Oggetto delle cancellazioni: '));
form.appendChild(lab1);
var inp1 = document.createElement('input');
inp1.style.width = '20em';
inp1.setAttribute('type','text');
inp1.setAttribute('id','abd-reason');
form.appendChild(inp1);
form.appendChild(document.createElement('p'));
var sub1 = document.createElement('input');
sub1.setAttribute('type','button');
sub1.setAttribute('id','abd-startbutton');
sub1.setAttribute('value','start');
sub1.setAttribute('onclick','abdStart()');
form.appendChild(sub1);
bcon.appendChild(form);
var pre = document.createElement('pre');
pre.setAttribute('id','abd-output');
bcon.appendChild(pre);
}
function abdStart() {
document.getElementById('abd-startbutton').setAttribute('disabled','disabled');
var out = document.getElementById('abd-output');
var txt = document.getElementById('abd-textarea');
var deletes = txt.value.split('\n');
var page = deletes[0];
if(page == '') {
out.appendChild(document.createTextNode('* fatto! Non resta altro da fare, o la riga successiva è vuota.\n'));
document.getElementById('abd-startbutton').removeAttribute('disabled');
} else {
var badchars = /(\#|\<|\>|\[|\]|\{|\}|\|)/;
if(badchars.test(page)) {
out.appendChild(document.createTextNode('! trovato un carattere non ammesso, la pagina' + page + ' è stata ignorata\n'));
setTimeout('abdStart()',1000);
} else {
out.appendChild(document.createTextNode('> Tento di cancellare [[' + page + ']]\n'));
abdGetToken(page);
}
}
deletes = deletes.slice(1,deletes.length);
txt.value = deletes.join('\n');
}
function abdGetToken(page) {
var out = document.getElementById('abd-output');
out.appendChild(document.createTextNode(' > Recupero delete token per [[' + page + ']]\n'));
var url = wgScriptPath + '/api.php?action=query&prop=info&indexpageids=1&intoken=delete&format=json&titles=' + encodeURIComponent(page);
var req = sajax_init_object();
req.open('GET', url, true);
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
eval("abdDelete(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "','" + page + "')");
}
}
req.send(null);
}
function abdDelete(obj,txt,page) {
var out = document.getElementById('abd-output');
if(obj['error']) {
out.appendChild(document.createTextNode(' ! Errore nelle API: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n'));
return;
}
if(!obj['query'] || !obj['query']['pageids'] || !obj['query']['pages'][obj['query']['pageids'][0]] || !obj['query']['pages'][obj['query']['pageids'][0]]['deletetoken']) {
out.appendChild(document.createTextNode(' ? Unexpected response: ' + txt + '\n'));
return;
}
var token = obj['query']['pages'][obj['query']['pageids'][0]]['deletetoken'];
out.appendChild(document.createTextNode(' > Token trovato, attendere la cancellazione\n'));
var reason = document.getElementById('abd-reason').value;
var params = 'action=delete&format=json&token=' + encodeURIComponent(token) + '&title=' + encodeURIComponent(page) + '&reason=' + encodeURIComponent(reason);
var url = wgScriptPath + '/api.php';
var req = sajax_init_object();
req.open('POST', url, true);
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Content-length', params.length);
req.setRequestHeader('Connection', 'close');
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
eval("abdDeleteAftermath(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
}
}
req.send(params);
}
function abdDeleteAftermath(obj,txt) {
var out = document.getElementById('abd-output');
if(obj['error']) {
out.appendChild(document.createTextNode(' ! Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n'));
} else if(obj['delete'] && obj['delete']['title']) {
out.appendChild(document.createTextNode(' > La pagina [[' + obj['delete']['title'] + ']] è stata cancellata\n'));
} else {
out.appendChild(document.createTextNode(' ? Unexpected response: ' + txt + '\n'));
return;
}
setTimeout('abdStart()',1000);
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
/*</pre>
== Script per i titoli nei JS ==
<pre> */
function sourceheadings() {
if ((wgNamespaceNumber == 2 || wgNamespaceNumber == 8) && wgTitle.lastIndexOf('.js') != -1 && wgAction == 'view') {
var bc = document.getElementById('bodyContent');
if (bc != null) {
var pres = bc.getElementsByTagName('pre');
if (pres.length == 1) {
var spans = pres[0].getElementsByTagName('span');
var numspans = spans.length;
var j = 0;
for (var i = 0; i < numspans; i++) {
if (spans[i].className == 'coMULTI') {
var res = null;
if (spans[i].firstChild.nodeValue)
// TODO \n+ doesn't seem to work here
res = spans[i].firstChild.nodeValue.match(/\/\*\s*<\/pre>[\r\n\s]+(==+)(.*?)(==+)[\r\n\s]+<pre>\s*\*\//,"gi");
if (res!= null && res.length != 0) {
j++;
var l = res[1].length < res[3].length ? res[1].length : res[3].length;
var h = document.createElement('h' + l);
h.innerHTML =
'<span class="editsection">[<a href="' +
wgScript + '?title=' + wgPageName + '&action=edit&section=' + j +
'">edit</a>]</span><span class="mw-headline">' + res[2] + '</span>';
pres[0].replaceChild(h, spans[i]);
}
}
}
}
}
}
}
$(sourceheadings);
/*</pre>
== PULSANTI AGGIUNTIVI PER LA MIA TOOLBAR PERSONALE ==
<pre> */
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText)
{
mwCustomEditButtons[mwCustomEditButtons.length] =
{"imageFile": imageFile,
"speedTip": speedTip,
"tagOpen": tagOpen,
"tagClose": tagClose,
"sampleText": sampleText};
}
addCustomButton('http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png','Pulsante vuoto',"","",'');
if (wgNamespaceNumber == 0) {
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/6/63/Button_includeonly.png','Tl in',"{{in|","}}\n{{pn}}\n\n#",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/d/d7/Button_more.png','Noetim',"\n\n{{-etim-}}\n{{Noetim|it}} <!-- Se sai l'etimologia, sostituiscila a questa riga -->\n","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/3f/Button_en.png','Traduzioni',"{{-trans1-}}\n:*{{en}}: <!-- inserisci qui la/le traduzione/ni nelle altre lingue -->\n{{-trans2-}}\n","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/7/77/Button_IPA.png',' template IPA',"{{-pron-}}\n{{IPA|/","/}}\n",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/2/2b/Button_ref_inscription.png',' template Noref',"{{-ref-}}\n{{Noref|","}}\n",'it');
addCustomButton('http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png','Pulsante vuoto',"","",'');
}
if (wgNamespaceNumber != 0) {
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/e/e9/Button_done.png','Fatto',":{{Fatto}} ","[[Utente:Ladsgroup|Ladsgroup]] <small>([[User talk:Ladsgroup|disc.]])</small> 11:09, 8 feb 2021 (CET)",' ');
}
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/d/d8/Button_archivo_borrar.png','Cassetto',"{{cassetto|titolo=|testo=","}}",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png','Pulsante vuoto',"","",'');
addLoadEvent(addCustomButton);
document.writeln('<script type="text/javascript" src="/w/index.php?title=Utente:Wimmo/monobook.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');