https://www.4spillcontainment.com/r-6b8e56163d28348655e370ccc48e566c3fe87d6b/javascript/iselector.js
1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* 11 ISSelectReplacement 12*/ 13if(typeof(ISSelectReplacement) == 'undefined') { 14 var ISSelectReplacement = { 15 init: function() 16 { 17 if(window.addEventListener) 18 window.addEventListener('load', ISSelectReplacement.on_load, false); 19 else 20 window.attachEvent('onload', ISSelectReplacement.on_load); 21 }, 22 23 on_load: function() 24 { 25 var selects = document.getElementsByTagName('SELECT'); 26 if(!selects) return false; 27 28 for(var i = 0; i < selects.length; i++) 29 { 30 var select = selects[i]; 31 if (!select.multiple // Only multiple selects are supported 32 || select.className.indexOf('ISSelectReplacement') == -1 33 || select.className.indexOf('ISSelectAlreadyReplaced') != -1 // Don't replace already replaced selects 34 || select.className.indexOf('ISSelectReplacementDeferred') != -1) { // Don't replace deferred selects just now 35 continue; 36 } 37 38 ISSelectReplacement.replace_select(selects[i]); 39 } 40 }, 41 replace_select: function(element) 42 { 43 var name = element.name; 44 45 element.style.visibility = 'hidden'; 46 47 // Start whipping up our replacement 48 var replacement = document.createElement('DIV'); 49 replacement.className = "ISSelect "+element.className; 50 replacement.className += " ISSelectAlreadyReplaced"; 51 var hideSelectReplacement = false; 52 // If the offsetHeight is 0, this select is hidden 53 if(element.offsetHeight == 0) 54 { 55 var clone = element.cloneNode(true); 56 clone.style.position = 'absolute'; 57 clone.style.left = '-10000px'; 58 clone.style.top = '-10000px'; 59 clone.style.display = 'block'; 60 document.body.appendChild(clone); 61 offset_height = clone.offsetHeight+"px"; 62 offset_width = clone.offsetWidth+"px"; 63 clone.parentNode.removeChild(clone); 64 if(element.style.display && element.style.display == 'none') { 65 var hideSelectReplacement = true; 66 } 67 } 68 else 69 { 70 offset_height = element.offsetHeight+"px"; 71 offset_width = element.offsetWidth+"px"; 72 } 73 var style_offset_width = ISSelectReplacement.get_prop(element, 'width'); 74 if(style_offset_width && style_offset_width != "auto") offset_width = style_offset_width; 75 var style_offset_height = ISSelectReplacement.get_prop(element, 'height'); 76 if(style_offset_height && style_offset_height != "auto") offset_height = style_offset_height; 77 replacement.style.height = offset_height; 78 79 if(parseInt(offset_width) < 200) { 80 offset_width = '200px'; 81 } 82 replacement.style.width = offset_width; 83 if(element.id) 84 { 85 replacement.id = element.id; 86 element.id += "_old"; 87 } 88 if(hideSelectReplacement) { 89 replacement.style.display = 'none'; 90 } 91 replacement.select = element; 92 replacement.options = element.options; 93 replacement.selectedIndex = element.selectedIndex; 94 this.select = element; 95 this.replacement = replacement; 96 97 if(element.onchange) 98 { 99 replacement.onclick = function() 100 { 101 $(this.select).trigger('change'); 102 } 103 } 104 105 if(element.ondblclick) 106 { 107 replacement.ondblclick = function() 108 { 109 $(this.select).trigger('dblclick'); 110 } 111 } 112 113 var innerhtml = '<ul>'; 114 115 // Loop de loop 116 for(var i = 0; i < element.childNodes.length; i++) 117 { 118 if(!element.childNodes[i].tagName || element.nodeType == 3) continue; 119 if(element.childNodes[i].tagName == "OPTGROUP") 120 { 121 innerhtml += ISSelectReplacement.add_group(element, element.childNodes[i], i); 122 } 123 else if(element.childNodes[i].tagName == "OPTION") 124 { 125 innerhtml += ISSelectReplacement.add_option(element, element.childNodes[i], i); 126 } 127 } 128 129 innerhtml += '</ul>'; 130 replacement.innerHTML = innerhtml; 131 132 element.parentNode.insertBefore(replacement, element); 133 element.style.display = 'none'; 134 }, 135 136 get_prop: function(element, prop) 137 { 138 var computedStyle; 139 140 if(element.currentStyle) 141 { 142 return element.currentStyle[prop]; 143 } 144 else if(document.defaultView && document.defaultView.getComputedStyle) 145 { 146 computedStyle = document.defaultView.getComputedStyle(element, ""); 147 148 if (computedStyle) { 149 prop = prop.replace(/([A-Z])/g, "-$1"); 150 prop = prop.toLowerCase(); 151 152 return computedStyle.getPropertyValue(prop); 153 } 154 } 155 }, 156 157 add_group: function(select, group, group_id) 158 { 159 var extraClass = ''; 160 if(group.className) { 161 extraClass = group.className; 162 } 163 group_html = '<li class="ISSelectGroup '+extraClass+'">' + 164 '<div>'+group.label+'</div>'; 165 166 if(group.childNodes) 167 { 168 group_html += '<ul>'; 169 for(var i = 0; i < group.childNodes.length; i++) 170 { 171 if(!group.childNodes[i].tagName || group.childNodes[i].nodeType == 3) continue; 172 group_html += ISSelectReplacement.add_option(select, group.childNodes[i], [group_id, i]); 173 } 174 group_html += '</ul>'; 175 } 176 177 group_html += '</li>'; 178 return group_html; 179 }, 180 181 add_option: function(select, option, id) 182 { 183 var value, element_class, checked = ''; 184 if(option.selected) 185 { 186 element_class = "SelectedRow"; 187 checked = 'checked="checked"' 188 } 189 else { 190 element_class = ''; 191 } 192 193 if(option.className) { 194 element_class += ' '+option.className; 195 } 196 197 var label = option.innerHTML; 198 var whitespace = label.match(/^\s*( )*/); 199 if(whitespace[0]) 200 { 201 label = label.replace(/^\s*( )*/, ''); 202 } 203 var disabled = ''; 204 if(this.select.disabled) { 205 var disabled = ' disabled="disabled"'; 206 } 207 208 var extraKey = ''; 209 var extra = ''; 210 if(option.className && option.className.indexOf('forceKey') != -1) { 211 var start = option.className.indexOf('forceKey'); 212 var end = option.className.indexOf(' ', start+1); 213 if(end == -1) { 214 var end = option.className.length; 215 } 216 var extraKey = option.className.substring(start+8, end); 217 var extra = '[]'; 218 } 219 var idString = "ISSelect"+select.name.replace('[]', '')+'_'+option.value; 220 html = '<li id="'+idString+'" class="'+element_class+'" onselectstart="return false;" style="-moz-user-select: none;" onmouseover="ISSelectReplacement.on_hover(this, \''+id+'\', \'over\');"' + 221 'onmouseout=\"ISSelectReplacement.on_hover(this, \''+id+'\', \'out\');" onclick="ISSelectReplacement.on_click(this, \''+id+'\');">' + whitespace[0]; 222 if($(option).hasClass('freeform')) { 223 html += '<input id="'+idString+'_input" type="textbox" name="ISSelectReplacement_'+select.name+'['+extraKey+']'+extra+'" value="' + option.value + '" onclick="ISSelectReplacement.on_click(this, \''+id+'\');" />'; 224 } 225 else { 226 html += '<input id="'+idString+'_input" type="checkbox" name="ISSelectReplacement_'+select.name+'['+extraKey+']'+extra+'" value="'+option.value+'" '+checked+disabled+'" onclick="ISSelectReplacement.on_click(this, \''+id+'\');" /><label for="'+idString+'_input" onclick="ISSelectReplacement.on_click(this, \''+id+'\');">' + label + '</label>'; 227 } 228 html += '</li>'; 229 return html; 230 }, 231 232 on_hover: function(element, id, action) 233 { 234 var id = id.split(','); 235 236 // Selected an option group child 237 if(id.length == 2) 238 { 239 var replacement = element.parentNode.parentNode.parentNode.parentNode.nextSibling; 240 var option = replacement.childNodes[id[0]].childNodes[id[1]]; 241 } 242 else 243 {
244 var replacement = element.parentNode.parentNode.nextSibling; 245 var option = replacement.childNodes[id[0]]; 246 } 247 248 if(action == 'out') { 249 $(element).removeClass('ISSelectOptionHover'); 250 $(option).trigger('mouseout'); 251 } 252 else { 253 if(!$(element).hasClass('SelectedRow')) { 254 $(element).addClass('ISSelectOptionHover'); 255 } 256 $(option).trigger('mouseover'); 257 } 258 }, 259 260 scrollToItem: function(select_name, value, group) 261 { 262 var item = 'ISSelect'+select_name.replace('[]', '')+'_'+value; 263 if(!document.getElementById(item)) 264 return; 265 266 var obj = document.getElementById(item); 267 var top = obj.offsetTop-4; 268 if(typeof(group) != 'undefined') { 269 top -= 20; 270 } 271 272 while(obj && obj.tagName != 'DIV') 273 { 274 obj = obj.parentNode; 275 if(obj && obj.tagName == 'DIV') { 276 obj.scrollTop = top; 277 break; 278 } 279 } 280 }, 281 282 on_click: function(element, id) 283 { 284 if(element.dblclicktimeout) 285 { 286 return false; 287 } 288 if(element.tagName == "INPUT" || element.tagName == "LABEL") 289 { 290 var checkbox = element; 291 if(checkbox.disabled) { 292 return false; 293 } 294 var element = element.parentNode; 295 } 296 else 297 { 298 var checkbox = element.getElementsByTagName('input')[0]; 299 if(checkbox.disabled) { 300 return false; 301 } 302 checkbox.checked = !checkbox.checked; 303 } 304 305 element.dblclicktimeout = setTimeout(function() { element.dblclicktimeout = ''; }, 250); 306 307 var id = id.split(','); // The index of the element we clicked 308 309 // Selected an option group child 310 if(id.length == 2) 311 { 312 var replacement = element.parentNode.parentNode.parentNode.parentNode.nextSibling; 313 var option = replacement.childNodes[id[0]].childNodes[id[1]]; 314 } 315 else 316 { 317 var replacement = element.parentNode.parentNode.nextSibling; 318 var option = replacement.childNodes[id[0]]; 319 } 320 321 option.selected = checkbox.checked; 322 $(element).parents('div')[0].selectedIndex = replacement.selectedIndex; 323 $(option).parents('select').trigger('change'); 324 $(option).triggerHandler('click'); 325 326 if (checkbox.checked) { 327 $(element).addClass('SelectedRow'); 328 } 329 else { 330 $(element).removeClass('SelectedRow'); 331 } 332 } 333 }; 334 335 ISSelectReplacement.init(); 336} 337 338}
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.