Użytkownik:D@mi/monobook.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
M |
M (tweak) |
||
Linia 14: | Linia 14: | ||
var groupop = new Array(); var gpn = 0; |
var groupop = new Array(); var gpn = 0; |
||
var op = new Array(); var opn = 0; |
var op = new Array(); var opn = 0; |
||
for(var i |
for(var i=0;i<reasons.length;i++) { |
||
if(reasons[i].substring(0,1)=='*') { |
if(reasons[i].substring(0,1)=='*') { |
||
if(reasons[i].substring(0,2)=='**') { |
if(reasons[i].substring(0,2)=='**') { |
Wersja z 12:25, 25 kwi 2007
//****************************************************************************************************************
function blockreasons() {
if(!document.getElementById('ipbreason-dropdown-js')) return;
var reasondiv = document.getElementById('ipbreason-dropdown-js');
var reasons = document.getElementById('ipbreason-dropdown-js').firstChild.nodeValue.split('\n');
var selsel = document.createElement('select');
selsel.setAttribute('onchange','blockreasonchange();');
selsel.setAttribute('id','blockreasonsel');
var firstop = document.createElement('option');
firstop.appendChild(document.createTextNode('Powody blokad'));
selsel.appendChild(firstop);
var groupop = new Array(); var gpn = 0;
var op = new Array(); var opn = 0;
for(var i=0;i<reasons.length;i++) {
if(reasons[i].substring(0,1)=='*') {
if(reasons[i].substring(0,2)=='**') {
op[opn] = document.createElement('option');
op[opn].setAttribute('value',reasons[i].substring(2));
op[opn].appendChild(document.createTextNode(reasons[i].substring(2)));
groupop[gpn].appendChild(op[opn]);
opn++;
} else {
if(groupop[gpn]) selsel.appendChild(groupop[gpn])
gpn++;
groupop[gpn] = document.createElement('optgroup');
groupop[gpn].setAttribute('label',reasons[i].substring(1));
}
}
}
selsel.appendChild(groupop[gpn]);
var reasonparent = document.getElementById('blockip').wpBlockReason.parentNode;
reasonparent.appendChild(document.createElement('br'));
reasonparent.appendChild(selsel);
}
if(wgPageName=='Specjalna:Blockip') addOnloadHook(blockreasons);
function blockreasonchange() {
var selsel = document.getElementById('blockreasonsel');
var reasonbox = document.getElementById('blockip').wpBlockReason;
if(selsel.selectedIndex == 0) return
reasonbox.value = selsel.options[selsel.selectedIndex].value;
}
//****************************************************************************************************************