1/* Version: 7.7.3 */ 2 3// Current Menu 4var currentMenu = null; 5var currentMenuStatus = false; 6var is_pending = 0; 7var submit_clicked = 0; 8 9function ubbtAJAX(url, callback, responseType) { 10 var req = init(); 11 req.onreadystatechange = processRequest; 12 if (!responseType) { 13 responseType = "text"; 14 } 15 var type = responseType; 16 17 function init() { 18 if (window.XMLHttpRequest) { 19 http_request = new XMLHttpRequest(); 20 } else if (window.ActiveXObject) { // IE 21 try { 22 http_request = new ActiveXObject("Msxml2.XMLHTTP"); 23 } catch (e) { 24 try { 25 http_request = new ActiveXObject("Microsoft.XMLHTTP"); 26 } catch (e) { 27 } 28 } 29 } 30 return http_request; 31 } 32 33 function processRequest() { 34 if (req.readyState != 4) { 35 return; 36 } 37 if (req.readyState == 4) { 38 if (callback) { 39 if (type == "xml") { 40 callback(req.responseXML); 41 } else { 42 callback(req.responseText); 43 } 44 } 45 req.onreadystatechange = function () { 46 }; 47 req.abort(); 48 } 49 } 50 this.sendData = function(meth, params) { 51 if (meth == "GET") { 52 req.open("GET", url, true); 53 req.send(null); 54 } else { 55 req.open('POST', url, true); 56 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 57 req.setRequestHeader("Content-length", params.length); 58 req.setRequestHeader("Connection", "close"); 59 req.send(params); 60 } 61 } 62} 63 64function markRead(forum, replacer) { 65 var url = script + "?ubb=markread&forum=" + forum; 66 var ajax = new ubbtAJAX(url); 67 ajax.sendData("GET"); 68 image = get_object('icon-' + forum); 69 image.src = baseurl + "/images/" + imagedir + "/" + replacer; 70 obj = get_object('threads-' + forum); 71 obj.innerHTML = ''; 72 obj = get_object('posts-' + forum); 73 obj.innerHTML = ''; 74} 75 76function doPreview() { 77 if (is_pending) return; 78 is_pending = 1; 79 obj = document.replier; 80 body = get_object('texteditor').value; 81 convert = ''; 82 if (obj.convert) { 83 convert = obj.convert.value; 84 } 85 gallery = 0; 86 if (obj.gallery) { 87 gallery = obj.gallery.value; 88 } 89 obj = get_object('preview_text'); 90 obj.innerHTML = loadingpreview; 91 area = get_object('preview_area'); 92 area.style.display = ""; 93 var url = script; 94 var ajax = new ubbtAJAX(url, updatePreview); 95 ajax.sendData("POST", "ubb=previewpost&convert=" + convert + "&gallery=" + gallery + "&Body=" + encodeURIComponent(body)); 96 $(document).ready(function() { 97 $('html, body').animate({ 98 'scrollTop': $('#preview_area').offset().top 99 }, 900); 100 }); 101} 102 103function updatePreview(responseXML) { 104 postBody = responseXML; 105 obj = get_object('preview_text'); 106 obj.innerHTML = postBody; 107 is_pending = 0; 108} 109 110// Get and retrieve an object 111function get_object(obj) { 112 if (document.getElementById) { 113 return document.getElementById(obj); 114 } else if (document.all) { 115 return document.all[obj]; 116 } else if (document.layers) { 117 return document.layers[obj]; 118 } else { 119 return null; 120 } 121} 122 123// Get the position of the current object 124function get_offset(obj) { 125 var left_offset = obj.offsetLeft; 126 var top_offset = obj.offsetTop; 127 while ((obj = obj.offsetParent) != null) { 128 left_offset += obj.offsetLeft; 129 top_offset += obj.offsetTop; 130 } 131 top_offset += 2; 132 return { 133 'left': left_offset, 134 'top': top_offset 135 }; 136} 137 138// Show/Hide a block of content and set a cookie 139function showHideBlock(e) { 140 element = get_object(e); 141 image = get_object('toggle_' + e); 142 currentCookie = ""; 143 currentCookie = getCookie('ubbt_collapsed'); 144 if (element.style.display == "none") { 145 element.style.display = ""; 146 re = new RegExp(e, "ig"); 147 newCookie = currentCookie.replace(re, ""); 148 image.src = baseurl + "/images/" + imagedir + "/toggle_closed.gif"; 149 } else { 150 element.style.display = "none"; 151 image.src = baseurl + "/images/" + imagedir + "/toggle_open.gif"; 152 newCookie = currentCookie + "|" + e + "|"; 153 } 154 setCookie('ubbt_collapsed', newCookie); 155} 156 157// Show/Hide any block of text 158function showHide(obj, delay) { 159 obj = get_object(obj); 160 if (obj.style.display == "none") { 161 obj.style.display = ''; 162 } else { 163 obj.style.display = "none"; 164 } 165 return true; 166} 167 168// Show/Hide a popup menu 169function showHideMenu(obj, e) { 170 obj = get_object(obj); 171 pos = get_offset(obj); 172 leftpx = pos['left']; 173 toppx = pos['top'] + obj.offsetHeight; 174 element = get_object(e); 175 // Close the last active menu 176 if (currentMenu != null && typeof currentMenu == "object" && currentMenu != element) { 177 currentMenu.style.display = "none"; 178 } 179 if (element.style.display == "none") { 180 element.style.visibility = "hidden"; 181 element.style.display = ""; 182 currentMenu = element; 183 currentMenuStatus = true; 184 element.style.position = 'absolute'; 185 element.style.zIndex = 50; 186 // Compensate for menus that are far to the right 187 if ((leftpx + element.offsetWidth >= document.body.clientWidth) && (leftpx + obj.offsetWidth - element.offsetWidth) > 0) { 188 element.style.left = (leftpx + obj.offsetWidth - element.offsetWidth) + 'px'; 189 element.style.top = toppx + 'px'; 190 } else { 191 element.style.left = leftpx + 'px'; 192 element.style.top = toppx + 'px'; 193 } 194 element.style.visibility = "visible"; 195 } else { 196 element.style.display = "none"; 197 currentMenu = null; 198 currentMenuStatus = false;
199 } 200} 201 202// Clears the last active menu 203function clearMenus(e) { 204 if (!e) e = window.event; 205 if (e.target) targ = e.target; 206 else if (e.srcElement) targ = e.srcElement; 207 if (targ.nodeType == 3) targ = targ.parentNode; 208 if (targ.className.indexOf("noclose") != -1 || (targ.parentNode != null && targ.parentNode.className != null && (targ.parentNode.className.indexOf("noclose") != -1 || (targ.parentNode.parentNode != null && targ.parentNode.parentNode.className != null && targ.parentNode.parentNode.className.indexOf("noclose") != -1)))) { 209 return; 210 } 211 if (currentMenuStatus == true) { 212 currentMenuStatus = false; 213 return true; 214 } 215 if (currentMenu != null && typeof currentMenu == "object") { 216 currentMenu.style.display = "none"; 217 } 218} 219 220// Register a popup menu 221function registerPopup(e) { 222 element = get_object(e); 223 if (element == null) return; 224 element.style.display = "none"; 225 if (element.getElementsByTagName) var x = element.getElementsByTagName('TD'); 226 for (var i = 0; i < x.length; i++) { 227 if (x[i].className.indexOf("noclose") == -1) { 228 x[i].onclick = click; 229 x[i].id = e; 230 } 231 if (x[i].className == "popup_menu_header") continue; 232 x[i].onmouseover = over; 233 x[i].onmouseout = out; 234 } 235} 236 237function over() { 238 this.className = this.className.replace(/popup_menu_content/, "popup_menu_highlight"); 239} 240 241function out() { 242 this.className = this.className.replace(/popup_menu_highlight/, "popup_menu_content"); 243} 244 245function click() { 246 obj = get_object(this.id); 247 obj.style.display = "none"; 248} 249 250function getCookie(name) { 251 var start = document.cookie.indexOf(name + "="); 252 var len = start + name.length + 1; 253 if ((!start) && (name != document.cookie.substring(0, name.length))) { 254 return null; 255 } 256 if (start == -1) return null; 257 var end = document.cookie.indexOf(";", len); 258 if (end == -1) end = document.cookie.length; 259 return unescape(document.cookie.substring(len, end)); 260} 261 262function setCookie(id, value) { 263 var today = new Date(); 264 today.setTime(today.getTime()); 265 expires = 1000 * 365 * 60 * 60 * 24; 266 var expires_date = new Date(today.getTime() + (expires)); 267 document.cookie = id + "=" + escape(value) + ";expires=" + expires_date.toGMTString() + ";path=/"; 268} 269 270function toggleIgnore(e) { 271 element = get_object(e); 272 image = get_object('body' + e); 273 if (element.style.display == "none") { 274 element.style.display = ""; 275 } else { 276 element.style.display = "none"; 277 } 278} 279 280function submitPost() { 281 if (submit_clicked == "1") { 282 return alert(submitClicked); 283 } 284 submit_clicked = 1; 285 document.replier.submit(); 286} 287 288function clearSubmit() { 289 submit_clicked = 0; 290} 291 292function toggle_spoiler(self, lang_hide_spoiler, lang_show_spoiler) { 293 var spoiler_box = self.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0]; 294 if (spoiler_box.style.display == 'none') { 295 spoiler_box.style.display = ""; 296 self.value = lang_hide_spoiler; 297 } else { 298 spoiler_box.style.display = "none"; 299 self.value = lang_show_spoiler; 300 } 301} 302 303function goto_page(url, id) { 304 var page = get_object(id).value; 305 var loc = window.location.href; 306 window.location.href = baseurl + "/ubbthreads.php?ubb=" + url + page; 307} 308 309function changePrefs(what, value) { 310 window.location.href = baseurl + "/ubbthreads.php?ubb=changeprefs&what=" + what + "&value=" + value + "&curl=" + document.prefs.curl.value; 311} 312 313// Centers the supplied window in the available realestate provided by the windows' dimensions 314function showChromeless(url, name, w, h, scroll) { 315 // Fudge factors for window decoration space. 316 // In my tests these work well on all platforms & browsers. 317 w += 32; 318 h += 96; 319 wleft = (screen.width - w) / 2; 320 wtop = (screen.height - h) / 2; 321 // IE5 and other old browsers might allow a window that is 322 // partially offscreen or wider than the screen. Fix that. 323 // (Newer browsers fix this for us, but let's be thorough.) 324 if (wleft < 0) { 325 w = screen.width; 326 wleft = 0; 327 } 328 if (wtop < 0) { 329 h = screen.height; 330 wtop = 0; 331 } 332 // Optional scroll 333 sc = (scroll == 1) ? 'yes' : 'no'; 334 335 var win = window.open(url, 336 name, 337 'width=' + w + ', height=' + h + ', ' + 338 'left=' + wleft + ', top=' + wtop + ', ' + 339 'location=no, menubar=no, ' + 340 'status=no, toolbar=no, scrollbars=' + sc + ', resizable=no'); 341 // Just in case width and height are ignored
342 win.resizeTo(w, h); 343 // Just in case left and top are ignored 344 win.moveTo(wleft, wtop); 345 win.focus(); 346} 347var grippy_list = []; 348var additional_onloads = []; 349 350// Section expander, such as Forum Help 351$(document).ready(function() { 352 var to = "fas fa-plus-square fa-fw"; 353 var tc = "fas fa-minus-square fa-fw"; 354 $('div.expheader').each(function() { 355 var state = false, 356 answer = $(this).next('div'), 357 ind = $(this).find('i'); 358 $(this).click(function() { 359 state = !state; 360 newSrc = (state) ? tc : to; 361 ind.attr('class', newSrc); 362 answer.slideToggle('fast'); 363 }); 364 }); 365}); 366 367// Show or Hide right/left columns 368$(document).ready(function() { 369 $('#expcols').click(function() { 370 $('.right_col').toggle("slide"); 371 $('.left_col').toggle("slide"); 372 }); 373}); 374 375// handle links with @href started with '#' only 376$(document).on('click', 'a[href^="#"]', function(e) { 377 var id = $(this).attr('href'); 378 var $id = $(id); 379 if ($id.length === 0) { 380 return; 381 } 382 // prevent standard hash navigation (avoid blinking in IE) 383 e.preventDefault(); 384 // top position relative to the document 385 var pos = $id.offset().top; 386 // animated top scrolling 387 $('body, html').animate({ 388 scrollTop: pos 389 }, 1000, 'swing'); 390}); 391 392// Show the 'Top' button when scrolled down 800px from the top of the document 393window.onscroll = function () { 394 scrollFunction() 395}; 396function scrollFunction() { 397 if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) { 398 document.getElementById("top-button").style.display = "block"; 399 } else { 400 document.getElementById("top-button").style.display = "none"; 401 } 402} 403 404// Scroll to the top of the document on click (without changing the url) 405function topFunction() { 406 if (document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0) { 407 window.scrollBy(0, -150); 408 requestAnimationFrame(topFunction); 409 } 410}
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.