1var checkboxHeight = "25"; 2var radioHeight = "25"; 3 4var Custom = { 5 init: function() { 6 var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active; 7 for(a = 0; a < inputs.length; a++) { 8 if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className.indexOf("styled") > -1) { 9 span[a] = document.createElement("span"); 10 span[a].className = inputs[a].type; 11 12 if(inputs[a].checked == true) { 13 if(inputs[a].type == "checkbox") { 14 position = "0 -" + (checkboxHeight*2) + "px"; 15 span[a].style.backgroundPosition = position; 16 } else { 17 position = "0 -" + (radioHeight*2) + "px"; 18 span[a].style.backgroundPosition = position; 19 } 20 } 21 inputs[a].parentNode.insertBefore(span[a], inputs[a]); 22 inputs[a].onchange = Custom.clear; 23 if(!inputs[a].getAttribute("disabled")) { 24 span[a].onmousedown = Custom.pushed; 25 span[a].onmouseup = Custom.check; 26 } else { 27 span[a].className = span[a].className += " disabled"; 28 } 29 } 30 } 31 inputs = document.getElementsByTagName("select"); 32 for(a = 0; a < inputs.length; a++) { 33 if(inputs[a].className.indexOf("styled") > -1) { 34 option = inputs[a].getElementsByTagName("option"); 35 active = option[0].childNodes[0].nodeValue; 36 textnode = document.createTextNode(active); 37 for(b = 0; b < option.length; b++) { 38 if(option[b].selected == true) { 39 textnode = document.createTextNode(option[b].childNodes[0].nodeValue); 40 } 41 } 42 span[a] = document.createElement("span"); 43 span[a].className = "select";
44 span[a].id = "select" + inputs[a].name; 45 span[a].appendChild(textnode); 46 inputs[a].parentNode.insertBefore(span[a], inputs[a]); 47 if(!inputs[a].getAttribute("disabled")) { 48 inputs[a].onchange = Custom.choose; 49 } else { 50 inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled"; 51 } 52 } 53 } 54 document.onmouseup = Custom.clear; 55 }, 56 pushed: function() { 57 element = this.nextSibling; 58 if(element.checked == true && element.type == "checkbox") { 59 this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px"; 60 } else if(element.checked == true && element.type == "radio") { 61 this.style.backgroundPosition = "0 -" + radioHeight*3 + "px"; 62 } else if(element.checked != true && element.type == "checkbox") { 63 this.style.backgroundPosition = "0 -" + checkboxHeight + "px"; 64 } else { 65 this.style.backgroundPosition = "0 -" + radioHeight + "px"; 66 } 67 }, 68 check: function() { 69 element = this.nextSibling; 70 if(element.checked == true && element.type == "checkbox") { 71 this.style.backgroundPosition = "0 0"; 72 element.checked = false; 73 } else { 74 if(element.type == "checkbox") { 75 this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; 76 } else { 77 this.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; 78 group = this.nextSibling.name; 79 inputs = document.getElementsByTagName("input"); 80 for(a = 0; a < inputs.length; a++) { 81 if(inputs[a].name == group && inputs[a] != this.nextSibling) { 82 inputs[a].previousSibling.style.backgroundPosition = "0 0"; 83 } 84 } 85 } 86 element.checked = true; 87 } 88 }, 89 clear: function() { 90 inputs = document.getElementsByTagName("input"); 91 for(var b = 0; b < inputs.length; b++) { 92 if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className.indexOf("styled") > -1) { 93 inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; 94 } else if(inputs[b].type == "checkbox" && inputs[b].className.indexOf("styled") > -1) { 95 inputs[b].previousSibling.style.backgroundPosition = "0 0"; 96 } else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className.indexOf("styled") > -1) { 97 inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; 98 } else if(inputs[b].type == "radio" && inputs[b].className.indexOf("styled") > -1) { 99 inputs[b].previousSibling.style.backgroundPosition = "0 0"; 100 } 101 } 102 }, 103 choose: function() { 104 option = this.getElementsByTagName("option"); 105 for(d = 0; d < option.length; d++) { 106 if(option[d].selected == true) { 107 document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue; 108 } 109 } 110 } 111} 112 113window.onload = Custom.init;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.