1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__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 opener = _____WB$wombat$assign$function_____("opener"); 10var smf_formSubmitted = false; 11 12// Define document.getElementById for Internet Explorer 4. 13if (typeof(document.getElementById) == "undefined") 14 document.getElementById = function (id) 15 { 16 // Just return the corresponding index of all. 17 return document.all[id]; 18 } 19// Define XMLHttpRequest for IE 5 and above. (don't bother for IE 4 :/.... works in Opera 7.6 and Safari 1.2!) 20else if (!window.XMLHttpRequest && window.ActiveXObject) 21 window.XMLHttpRequest = function () 22 { 23 return new ActiveXObject(navigator.userAgent.indexOf("MSIE 5") != -1 ? "Microsoft.XMLHTTP" : "MSXML2.XMLHTTP"); 24 }; 25 26// Some older versions of Mozilla don't have this, for some reason. 27if (typeof(document.forms) == "undefined") 28 document.forms = document.getElementsByTagName("form"); 29 30// Load an XML document using XMLHttpRequest. 31function getXMLDocument(url, callback) 32{ 33 if (!window.XMLHttpRequest) 34 return false; 35 36 var myDoc = new XMLHttpRequest(); 37 if (typeof(callback) != "undefined") 38 { 39 myDoc.onreadystatechange = function () 40 { 41 if (myDoc.readyState != 4) 42 return; 43 44 if (myDoc.responseXML != null && myDoc.status == 200) 45 callback(myDoc.responseXML); 46 }; 47 } 48 myDoc.open('GET', url, true); 49 myDoc.send(null); 50 51 return true; 52} 53 54// Send a post form to the server using XMLHttpRequest. 55function sendXMLDocument(url, content, callback) 56{ 57 if (!window.XMLHttpRequest) 58 return false; 59 60 var sendDoc = new window.XMLHttpRequest(); 61 if (typeof(callback) != "undefined") 62 { 63 sendDoc.onreadystatechange = function () 64 { 65 if (sendDoc.readyState != 4) 66 return; 67 68 if (sendDoc.responseXML != null && sendDoc.status == 200) 69 callback(sendDoc.responseXML); 70 else 71 callback(false); 72 }; 73 }
74 sendDoc.open('POST', url, true); 75 if (typeof(sendDoc.setRequestHeader) != "undefined") 76 sendDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 77 sendDoc.send(content); 78 79 return true; 80} 81 82function textToEntities(text) 83{ 84 var entities = ""; 85 for (var i = 0; i < text.length; i++) 86 { 87 if (text.charCodeAt(i) > 127) 88 entities += "&#" + text.charCodeAt(i) + ";"; 89 else 90 entities += text.charAt(i); 91 } 92 93 return entities; 94} 95 96// Open a new window. 97function reqWin(desktopURL, alternateWidth, alternateHeight, noScrollbars) 98{ 99 if ((alternateWidth && self.screen.availWidth * 0.8 < alternateWidth) || (alternateHeight && self.screen.availHeight * 0.8 < alternateHeight)) 100 { 101 noScrollbars = false; 102 alternateWidth = Math.min(alternateWidth, self.screen.availWidth * 0.8); 103 alternateHeight = Math.min(alternateHeight, self.screen.availHeight * 0.8); 104 } 105 else 106 noScrollbars = typeof(noScrollbars) != "undefined" && noScrollbars == true; 107 108 window.open(desktopURL, 'requested_popup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=' + (noScrollbars ? 'no' : 'yes') + ',width=' + (alternateWidth ? alternateWidth : 480) + ',height=' + (alternateHeight ? alternateHeight : 220) + ',resizable=no'); 109 110 // Return false so the click won't follow the link ;). 111 return false; 112} 113 114// Remember the current position. 115function storeCaret(text) 116{ 117 // Only bother if it will be useful. 118 if (typeof(text.createTextRange) != "undefined") 119 text.caretPos = document.selection.createRange().duplicate(); 120} 121 122// Replaces the currently selected text with the passed text. 123function replaceText(text, textarea) 124{ 125 // Attempt to create a text range (IE). 126 if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) 127 { 128 var caretPos = textarea.caretPos; 129 130 caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; 131 caretPos.select(); 132 } 133 // Mozilla text range replace. 134 else if (typeof(textarea.selectionStart) != "undefined") 135 { 136 var begin = textarea.value.substr(0, textarea.selectionStart); 137 var end = textarea.value.substr(textarea.selectionEnd); 138 var scrollPos = textarea.scrollTop; 139 140 textarea.value = begin + text + end; 141 142 if (textarea.setSelectionRange) 143 { 144 textarea.focus(); 145 textarea.setSelectionRange(begin.length + text.length, begin.length + text.length); 146 } 147 textarea.scrollTop = scrollPos; 148 } 149 // Just put it on the end. 150 else 151 { 152 textarea.value += text; 153 textarea.focus(textarea.value.length - 1); 154 } 155} 156 157// Surrounds the selected text with text1 and text2. 158function surroundText(text1, text2, textarea) 159{ 160 // Can a text range be created? 161 if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) 162 { 163 var caretPos = textarea.caretPos, temp_length = caretPos.text.length; 164 165 caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2; 166 167 if (temp_length == 0) 168 { 169 caretPos.moveStart("character", -text2.length); 170 caretPos.moveEnd("character", -text2.length); 171 caretPos.select(); 172 } 173 else 174 textarea.focus(caretPos); 175 } 176 // Mozilla text range wrap. 177 else if (typeof(textarea.selectionStart) != "undefined") 178 { 179 var begin = textarea.value.substr(0, textarea.selectionStart); 180 var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart); 181 var end = textarea.value.substr(textarea.selectionEnd); 182 var newCursorPos = textarea.selectionStart; 183 var scrollPos = textarea.scrollTop; 184 185 textarea.value = begin + text1 + selection + text2 + end; 186 187 if (textarea.setSelectionRange) 188 { 189 if (selection.length == 0) 190 textarea.setSelectionRange(newCursorPos + text1.length, newCursorPos + text1.length); 191 else 192 textarea.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length); 193 textarea.focus(); 194 } 195 textarea.scrollTop = scrollPos; 196 } 197 // Just put them on the end, then. 198 else 199 { 200 textarea.value += text1 + text2; 201 textarea.focus(textarea.value.length - 1); 202 } 203} 204 205// Checks if the passed input's value is nothing. 206function isEmptyText(theField) 207{ 208 // Copy the value so changes can be made.. 209 var theValue = theField.value; 210 211 // Strip whitespace off the left side. 212 while (theValue.length > 0 && (theValue.charAt(0) == ' ' || theValue.charAt(0) == '\t')) 213 theValue = theValue.substring(1, theValue.length); 214 // Strip whitespace off the right side. 215 while (theValue.length > 0 && (theValue.charAt(theValue.length - 1) == ' ' || theValue.charAt(theValue.length - 1) == '\t')) 216 theValue = theValue.substring(0, theValue.length - 1); 217 218 if (theValue == '') 219 return true; 220 else 221 return false;
222} 223 224// Only allow form submission ONCE. 225function submitonce(theform) 226{ 227 smf_formSubmitted = true; 228} 229function submitThisOnce(form) 230{ 231 // Hateful, hateful fix for Safari 1.3 beta. 232 if (navigator.userAgent.indexOf('AppleWebKit') != -1) 233 return !smf_formSubmitted; 234 235 if (typeof(form.form) != "undefined") 236 form = form.form; 237 238 for (var i = 0; i < form.length; i++) 239 if (typeof(form[i]) != "undefined" && form[i].tagName.toLowerCase() == "textarea") 240 form[i].readOnly = true; 241 242 return !smf_formSubmitted; 243} 244 245// Set the "inside" HTML of an element. 246function setInnerHTML(element, toValue) 247{ 248 // IE has this built in... 249 if (typeof(element.innerHTML) != 'undefined') 250 element.innerHTML = toValue; 251 // Otherwise, try createContextualFragment(). 252 else 253 { 254 var range = document.createRange(); 255 range.selectNodeContents(element); 256 range.deleteContents(); 257 element.appendChild(range.createContextualFragment(toValue)); 258 } 259} 260 261// Set the "outer" HTML of an element. 262function setOuterHTML(element, toValue) 263{ 264 if (typeof(element.outerHTML) != 'undefined') 265 element.outerHTML = toValue; 266 else 267 { 268 var range = document.createRange(); 269 range.setStartBefore(element); 270 element.parentNode.replaceChild(range.createContextualFragment(toValue), element); 271 } 272} 273 274// Get the inner HTML of an element. 275function getInnerHTML(element) 276{ 277 if (typeof(element.innerHTML) != 'undefined') 278 return element.innerHTML; 279 else 280 { 281 var returnStr = ''; 282 for (var i = 0; i < element.childNodes.length; i++) 283 returnStr += getOuterHTML(element.childNodes[i]); 284 285 return returnStr; 286 } 287} 288 289function getOuterHTML(node) 290{ 291 if (typeof(node.outerHTML) != 'undefined') 292 return node.outerHTML; 293 294 var str = ''; 295 296 switch (node.nodeType) 297 { 298 // An element. 299 case 1: 300 str += '<' + node.nodeName; 301 302 for (var i = 0; i < node.attributes.length; i++) 303 { 304 if (node.attributes[i].nodeValue != null) 305 str += ' ' + node.attributes[i].nodeName + '="' + node.attributes[i].nodeValue + '"'; 306 } 307 308 if (node.childNodes.length == 0 && in_array(node.nodeName.toLowerCase(), ['hr', 'input', 'img', 'link', 'meta', 'br'])) 309 str += ' />'; 310 else 311 str += '>' + getInnerHTML(node) + '</' + node.nodeName + '>'; 312 break; 313 314 // 2 is an attribute. 315 316 // Just some text.. 317 case 3: 318 str += node.nodeValue; 319 break; 320 321 // A CDATA section. 322 case 4: 323 str += '<![CDATA' + '[' + node.nodeValue + ']' + ']>'; 324 break; 325 326 // Entity reference.. 327 case 5: 328 str += '&' + node.nodeName + ';'; 329 break; 330 331 // 6 is an actual entity, 7 is a PI. 332 333 // Comment. 334 case 8: 335 str += '<!--' + node.nodeValue + '-->'; 336 break; 337 } 338 339 return str; 340} 341 342// Checks for variable in theArray. 343function in_array(variable, theArray) 344{ 345 for (var i = 0; i < theArray.length; i++) 346 { 347 if (theArray[i] == variable) 348 return true; 349 } 350 return false; 351} 352 353// Find a specific radio button in its group and select it. 354function selectRadioByName(radioGroup, name) 355{ 356 if (typeof(radioGroup.length) == "undefined") 357 return radioGroup.checked = true; 358 359 for (var i = 0; i < radioGroup.length; i++) 360 { 361 if (radioGroup[i].value == name) 362 return radioGroup[i].checked = true; 363 } 364 365 return false; 366} 367 368// Invert all checkboxes at once by clicking a single checkbox. 369function invertAll(headerfield, checkform, mask) 370{ 371 for (var i = 0; i < checkform.length; i++) 372 { 373 if (typeof(checkform[i].name) == "undefined" || (typeof(mask) != "undefined" && checkform[i].name.substr(0, mask.length) != mask)) 374 continue; 375 376 if (!checkform[i].disabled) 377 checkform[i].checked = headerfield.checked; 378 } 379} 380 381// Keep the session alive - always! 382var lastKeepAliveCheck = new Date().getTime(); 383function smf_sessionKeepAlive() 384{ 385 var curTime = new Date().getTime(); 386 387 // Prevent a Firefox bug from hammering the server. 388 if (smf_scripturl && curTime - lastKeepAliveCheck > 900000) 389 { 390 var tempImage = new Image(); 391 tempImage.src = smf_scripturl + (smf_scripturl.indexOf("?") == -1 ? "?" : "&") + "action=keepalive;" + curTime; 392 lastKeepAliveCheck = curTime; 393 } 394 395 window.setTimeout("smf_sessionKeepAlive();", 1200000); 396} 397window.setTimeout("smf_sessionKeepAlive();", 1200000); 398 399// Set a theme option through javascript. 400function smf_setThemeOption(option, value, theme, cur_session_id) 401{ 402 // Compatibility. 403 if (cur_session_id == null) 404 cur_session_id = smf_session_id; 405 406 var tempImage = new Image(); 407 tempImage.src = smf_scripturl + (smf_scripturl.indexOf("?") == -1 ? "?" : "&") + "action=jsoption;var=" + option + ";val=" + value + ";sesc=" + cur_session_id + (theme == null ? "" : "&id=" + theme) + ";" + (new Date().getTime()); 408} 409 410function smf_avatarResize() 411{ 412 var possibleAvatars = document.getElementsByTagName ? document.getElementsByTagName("img") : document.all.tags("img"); 413 414 for (var i = 0; i < possibleAvatars.length; i++) 415 { 416 if (possibleAvatars[i].className != "avatar") 417 continue; 418 419 var tempAvatar = new Image(); 420 tempAvatar.src = possibleAvatars[i].src; 421 422 if (smf_avatarMaxWidth != 0 && tempAvatar.width > smf_avatarMaxWidth) 423 { 424 possibleAvatars[i].height = (smf_avatarMaxWidth * tempAvatar.height) / tempAvatar.width; 425 possibleAvatars[i].width = smf_avatarMaxWidth; 426 } 427 else if (smf_avatarMaxHeight != 0 && tempAvatar.height > smf_avatarMaxHeight) 428 { 429 possibleAvatars[i].width = (smf_avatarMaxHeight * tempAvatar.width) / tempAvatar.height; 430 possibleAvatars[i].height = smf_avatarMaxHeight; 431 } 432 else 433 { 434 possibleAvatars[i].width = tempAvatar.width; 435 possibleAvatars[i].height = tempAvatar.height; 436 } 437 } 438 439 if (typeof(window_oldAvatarOnload) != "undefined" && window_oldAvatarOnload) 440 { 441 window_oldAvatarOnload(); 442 window_oldAvatarOnload = null; 443 } 444} 445 446function hashLoginPassword(doForm, cur_session_id) 447{ 448 // Compatibility. 449 if (cur_session_id == null) 450 cur_session_id = smf_session_id; 451 452 if (typeof(hex_sha1) == "undefined") 453 return; 454 // Are they using an email address? 455 if (doForm.user.value.indexOf("@") != -1) 456 return; 457 458 // Unless the browser is Opera, the password will not save properly. 459 if (typeof(window.opera) == "undefined") 460 doForm.passwrd.autocomplete = "off"; 461 462 doForm.hash_passwrd.value = hex_sha1(hex_sha1(doForm.user.value.php_to8bit().php_strtolower() + doForm.passwrd.value.php_to8bit()) + cur_session_id); 463 464 // It looks nicer to fill it with asterisks, but Firefox will try to save that. 465 if (navigator.userAgent.indexOf("Firefox/") != -1) 466 doForm.passwrd.value = ""; 467 else 468 doForm.passwrd.value = doForm.passwrd.value.replace(/./g, "*"); 469} 470 471function hashAdminPassword(doForm, username, cur_session_id) 472{ 473 // Compatibility. 474 if (cur_session_id == null) 475 cur_session_id = smf_session_id; 476 477 if (typeof(hex_sha1) == "undefined") 478 return; 479 480 doForm.admin_hash_pass.value = hex_sha1(hex_sha1(username.toLowerCase() + doForm.admin_pass.value) + cur_session_id); 481 doForm.admin_pass.value = doForm.admin_pass.value.replace(/./g, "*"); 482} 483 484function ajax_indicator(turn_on) 485{ 486 var indicator = document.getElementById("ajax_in_progress"); 487 if (indicator != null) 488 { 489 if (navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE 7") == -1) 490 { 491 indicator.style.top = document.documentElement.scrollTop; 492 } 493 indicator.style.display = turn_on ? "block" : "none"; 494 } 495} 496 497}
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.