Aller au contenu

MediaWiki:JSScripts/BlocâjoDeluxo

De Vouiquipèdia, l’enciclopèdia abada.

//

/*
 * BlocâjoDeluxo
 *
 * Aponsa de botons prèdèfenis por justifiar un blocâjo
 *
 * Ôtor : fr:Pabix
 * Dèrriére rèvision : 5 novembro 2006
 */

//////////////////////ZONA PÈRSONALISÂBLA//////////////////////
var blocajodeluxoMessajos = new Array();
var blocajodeluxoDura = new Array();
var blocajodeluxoDefendreEnscripcion = new Array();
var blocajodeluxoUnicamentIP = new Array();
var blocajodeluxoBlocarIPsUtilisiees = new Array();

with (blocajodeluxoMessajos) {
        push ("IP fixa - Pas d’enscripcion possibla");
        push ("IP fixa multi utilisators (ègz. scolèra) - Crèacion de compto ôtorisiêe");
        push ("IP variâbla - Niona novèla enscripcion ôtorisiêe, comptos ègzistents utilisâblos");
        push ("Utilisator registrâ - Blocâjo du compto");
        push ("Utilisator registrâ - Blocâjo du compto et de les IPs associyêes");
}
with (blocajodeluxoDefendreEnscripcion) {
        push(true);
        push(false);
        push(true);
        push(false);
        push(false);
}
with (blocajodeluxoBlocarIPsUtilisiees) {
        push(false);
        push(false);
        push(false);
        push(false);
        push(true);
}
with (blocajodeluxoUnicamentIP) {
        push(false);
        push(true);
        push(true);
        push(false);
        push(false);
}
with (blocajodeluxoDura) {
        push("1 hour");
        push("infinite");
        push("1 hour");
        push("1 hour");
        push("1 hour");
}
/////////////////FIN DE LA ZONA PÈRSONALISÂBLA/////////////////

function BlocajoDeluxo() {
        if (document.title.indexOf("Blocar una adrèce IP ou un utilisator - Vuiquipèdia")!=0) return;
        var mainNode = document.getElementsByTagName("form");
        var firstForm = mainNode[0];
        var table = document.createElement("table");
        var tr = document.createElement("tr");
        table.appendChild(tr);
        if (firstForm.getAttribute("id")=="blockip") {
                actionBlock = firstForm.getAttribute("action");
                var inputs = firstForm.getElementsByTagName("input");
                // inputs :
                // 0 -> wpBlockAddress        Lo nom de l’utilisator ou son IP
                // 1 -> wpBlockOther          Durâ
                // 2 -> wpBlockReason         Rêson envocâ(ye)
                // 3 -> wpAnonOnly            Pas blocar los comptos ègzistents
                // 4 -> wpCreateAccount       Empachiér la crèacion de compto
                // 5 -> wpEnableAutoblock     Blocar totes les IPs utilisiêes per cél psudonimo
                // 6 -> (submit) wpBlock      Somission du formulèro
                // 7 -> wpEditToken           (Variâbla d’identificacion)
                var token = inputs[7].getAttribute("value");
                var loPou(v)ro = inputs[0].getAttribute("value");
                for (var i=0;i<blocajodeluxoMessajos.length;i++) {
                        //   if (i%3==0) {
                        tr = document.createElement("tr");
                        table.appendChild(tr);
                        //   }

                        // Crèe lo formulèro
                        var formElement = document.createElement("form");
                        with (formElement) {
                                setAttribute("id", "blockip");
                                setAttribute("method", "post");
                                setAttribute("action", actionBlock);
                        }

                        // Champ envisiblo : identificacion
                        var inputToken = document.createElement("input");
                        with (inputToken) {
                                setAttribute("name", "wpEditToken");
                                setAttribute("value", token);
                                setAttribute("type", "hidden");
                        }

                        // Champ envisiblo : nom de l’utilisator
                        var ident = document.createElement("input");
                        with (ident) {
                                setAttribute("name", "wpBlockAddress");
                                setAttribute("value", loPou(v)ro);
                                setAttribute("type", "hidden");
                        }

                        // Champ envisiblo de rêson
                        var inputReason = document.createElement("input");
                        with (inputReason) {
                                setAttribute("name", "wpBlockReason");
                                setAttribute("value", blocajodeluxoMessajos[i]);
                                setAttribute("type", "hidden");
                        }

                        // Champ envisiblo de durâ
                        var duraC = document.createElement("input");
                        with (duraC) {
                                setAttribute("name", "wpBlockExpiry");
                                setAttribute("value", "other");
                                setAttribute("type", "hidden");
                        }

                        // Champ modifiâblo de durâ
                        var duraC2 = document.createElement("input");
                        with (duraC2) {
                                setAttribute("name", "wpBlockOther");
                                setAttribute("value", blocajodeluxoDura[i]);
                                setAttribute("type", "text");
                        }

                        // Câsa a marcar : blocar les IPs utilisiêes per l’utilisator
                        var blockIPs = document.createElement("input");
                        with (blockIPs) {
                                setAttribute("name", "wpEnableAutoblock");
                                setAttribute("type", "checkbox");
                                setAttribute("title", "blocâjo ôtomatico de les IPs utilisiêes per cél psudonimo");
                                checked = blocajodeluxoBlocarIPsUtilisiees[i];
                        }

                        // Câsa a marcar : blocar solament les IPs
                        var anonymousOnly = document.createElement("input");
                        with (anonymousOnly) {
                                setAttribute("name", "wpAnonOnly");
                                setAttribute("type", "checkbox");
                                setAttribute("title", "Pas blocar los comptos ja/dejâ ègzistents");
                                checked = blocajodeluxoUnicamentIP[i];
                        }

                        // Câsa a marcar : empachiér la crèacion de compto
                        var allowAccCreat = document.createElement("input");
                        with (allowAccCreat) {
                                setAttribute("name", "wpCreateAccount");
                                setAttribute("type", "checkbox");
                                setAttribute("title", "Empachiér la crèacion de compto");
                                checked = blocajodeluxoDefendreEnscripcion[i];
                        }

                        // Câsa a marcar : empachiér la crèacion de compto
                        // Boton de somission avouéc rêson
                        var inputConfirm = document.createElement("input");
                        with (inputConfirm) {
                                setAttribute("name", "wpBlock");
                                setAttribute("value", blocajodeluxoMessajos[i]);
                                setAttribute("type", "submit");
                        }

                        with (formElement) {
                                appendChild(anonymousOnly);
                                appendChild(allowAccCreat);
                                appendChild(blockIPs);
                                appendChild(inputReason);
                                appendChild(duraC);
                                appendChild(duraC2);
                                appendChild(inputConfirm);
                                appendChild(inputToken);
                                appendChild(ident);
                        }
                        var td = document.createElement("td");
                        td.appendChild(formElement);
                        tr.appendChild(td);
                }
                var separation = document.createElement("p");
                separation.appendChild(document.createElement("hr"));
                insertAfter(firstForm.parentNode, separation, firstForm);
                insertAfter(firstForm.parentNode, table, separation);
        }
}
addLoadEvent(BlocajoDeluxo);
//