User:Kerri Amber/EasyCURangeCalc.js

function EasyCURangeCalc { if (!($("#subuserips")[0].checked)) { return; } var results = $("#checkuserresults ul > li"); if (results != undefined) { for (i = 0; i < results.length; i++) { ip = results[i].getElementsByTagName("a")[0].innerHTML; //Get IP	    checkboxhtml = '   Use in range calculation '; $($(results[i])[0].getElementsByTagName("div")[0]).append(checkboxhtml); //Add the checkbox }   } }

function updateRangeCalc(checkbox) { if (checkbox.checked) { ips_selected.push(checkbox.value); //Add the IP to the list } else { ips_selected.splice(ips_selected.indexOf(checkbox.value), 1); //Remove the IP from the list }   $("#mw-checkuser-iplist")[0].value = ips_selected.join("\n"); updateCIDRresult; //Update the CIDR range } ips_selected = []; if (wgPageName == "Special:CheckUser") { addOnloadHook(EasyCURangeCalc); }