User:Ladsgroup/election.js

/** voting tools ************************************************ * * by w:fa:user:ebraminio and copied from w:fa:مدیاویکی:Gadget-election.js */ /* */ function extpar(par) { return location.href.replace(RegExp(".*?[&?]" + par + "=([^&]*).*"), "$1"); } $(function {    vote = extpar("vote");    if (/(support|oppose|neutral)/.test(vote)) {        subcontent = $('#wpTextbox1').val;        var bodycontent = $('#bodyContent') || $('#mw_contentholder');        bodycontent.css("display", "none");        subcontent.replace(/\n$/, "");        if (subcontent.search(RegExp(wgUserName, "i")) != -1) {            alert("Submitted already");        } else {            var why = 0;            if (extpar("comment") == "yes") why = prompt("reason");            why = why ? why + " " : "";            if (vote == "oppose") {                vote = "Oppose";            } else if (vote == "support") {                vote = "Support";            } else if (vote == "neutral") {                vote = "Neutral";            }            $('#wpTextbox1').val(subcontent + "# " + "");            $('#wpSummary').val("An" + vote + "by the election tool. See more"); }       document.editform.submit; } }); /* */