Utente:Wimmo/vector.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>
$(function() {
mw.util.addPortletLink('p-tb','/wiki/Speciale:Fonti','Fonti');
});
if(wgPageName == 'Speciale:Fonti') {
document.title = 'Creazione rapida delle fonti';
appendCSS('#content {visibility:hidden;}');
addOnloadHook(fonterapidaForm);
}
function fonterapidaForm() {
var con = (document.getElementById('content')) ? document.getElementById('content') : document.getElementById('mw_content')
var bcon = (document.getElementById('bodyContent')) ? 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('Creazione rapida delle fonti per utenti inesperti'));
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 = '';
}
}
if(queryString('submit')) {
bcon.innerHTML += '<img src="http://upload.wikimedia.org/wikipedia/commons/5/52/Nuvola_apps_edu_miscellaneous.png" style="border:1px dashed red;" /><br>'
if (queryString('ita1') != "np") {
bcon.innerHTML += '<b style="color:#990000;">* {{Fonte|' + queryString('ita1')+ '}}'
}
if (queryString('ita2') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ita2')+ '}}'
}
if (queryString('ita3') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ita3')+ '}}'
}
if (queryString('ita4') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ita4')+ '}}'
}
if (queryString('ing1') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ing1')+ '}}'
}
if (queryString('ing2') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ing2')+ '}}'
}
if (queryString('ing3') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ing3')+ '}}'
}
if (queryString('ing4') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ing4')+ '}}'
}
if (queryString('ing5') != "np") {
bcon.innerHTML += '<b style="color:#990000;"> <br>* {{Fonte|' + queryString('ing5')+ '}}'
}
+ '<br>'
}
//Note: I was writing this as nice dom, but since it is for a gag anyways, it is too much work'
bcon.innerHTML += '<form method="get" action="' + mw.config.get('wgServer') + mw.config.get('wgScript') + '"><input name="title" type="hidden" value="Speciale:Fonti" />'
+ '<fieldset><legend>Creazione rapida delle pagine per utenti inesperti</legend>'
+ '<h3>Italiano:</h3>'
+ '<label for="ita1"> Prima fonte: </label><select id="ita1" name="ita1">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="hoep">Hoeply Gabrielli</option><option value="voc">Vocabolario italiano della lingua parlata</option>'
+ '<option value="sape">Sapere.it</option></select><p></p>'
+ '<label for="ita2"> Seconda fonte: </label><select id="ita2" name="ita2">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="hoep">Hoeply Gabrielli</option><option value="voc">Vocabolario italiano della lingua parlata</option>'
+ '<option value="sape">Sapere.it</option></select><p></p>'
+ '<label for="ita3"> Terza fonte: </label><select id="ita3" name="ita3">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="hoep">Hoeply Gabrielli</option><option value="voc">Vocabolario italiano della lingua parlata</option>'
+ '<option value="sape">Sapere.it</option></select><p></p>'
+ '<h4>Etimologia:</h4>'
+ '<label for="ita4"> Quarta fonte: </label><select id="ita4" name="ita4">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="etim">Dizionario etimologico etimo.it</option></select><p></p>'
+ '<h3>Inglese:</h3>'
+ '<label for="ing1"> Prima fonte: </label><select id="ing1" name="ing1">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="tfd">The Free Dictionary</option><option value="mew">Merriam-Webster</option>'
+ '<option value="wrenit">Wordreference (Inglese-Italiano)</option><option value="oxf">Compact Oxford English Dictionary</option></select><p></p>'
+ '<label for="ing2"> Seconda fonte: </label><select id="ing2" name="ing2">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="tfd">The Free Dictionary</option><option value="mew">Merriam-Webster</option>'
+ '<option value="wrenit">Wordreference (Inglese-Italiano)</option><option value="oxf">Compact Oxford English Dictionary</option></select><p></p>'
+ '<label for="ing3"> Terza fonte: </label><select id="ing3" name="ing3">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="tfd">The Free Dictionary</option><option value="mew">Merriam-Webster</option>'
+ '<option value="wrenit">Wordreference (Inglese-Italiano)</option><option value="oxf">Compact Oxford English Dictionary</option></select><p></p>'
+ '<label for="ing4"> Qurta fonte: </label><select id="ing4" name="ing4">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="tfd">The Free Dictionary</option><option value="mew">Merriam-Webster</option>'
+ '<option value="wrenit">Wordreference (Inglese-Italiano)</option><option value="oxf">Compact Oxford English Dictionary</option></select><p></p>'
+ '<h4>Etimologia:</h4>'
+ '<label for="ing5"> Quinta fonte: </label><select id="ing5" name="ing5">'
+ '<option selected="selected" value="np">Seleziona una fonte</option><option value="etien">Online Etymology Dictionary</option></select><p></p>'
+ '<h3>Francese:</h3>'
+ '<h3>Spagnolo:</h3>'
+ '<h3>Tedesco:</h3>'
+ '<p></p>'
+ '<input type="submit" value="Genera" name="submit" />'
+ '</fieldset></form>'
appendCSS('#content {visibility:visible;}');
;
}
function appendCSS(text) {
var s = document.createElement('style');
s.type = 'text/css';
s.rel = 'stylesheet';
if (s.styleSheet) s.styleSheet.cssText = text //IE
else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null
document.getElementsByTagName('head')[0].appendChild(s);
return s;
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]).replace(/\+/g," ");
} catch (e) {
}
}
return null;
}
//</pre>