1const tocIframeSelector = "#toc iframe"; 2const $tocIframe = $(tocIframeSelector); 3const $topicSelector = $("a#topicSelector"); 4const $tabsSelector = $("a#tabsSelector"); 5const $tabs = $("#tabs"); 6 7$tabsSelector.click(function() { 8 // Hide TOC when tabSelect is clicked 9 if ($tocIframe.css("display") != "none") 10 hideTOCbyZeroHeight(); 11 // Do the job 12 $tabs.stop(true, true).slideToggle("fast"); 13 $(this).toggleClass("bgarrow_down_white bgarrow_up_white"); 14}); 15 16let firstLoad = true; 17let tocFrameHeight = 0; 18let tocHidden = true; 19function hideTOCbyZeroHeight() { 20 if (!tocHidden) { 21 tocFrameHeight = $tocIframe.outerHeight(); 22 $tocIframe.stop(true, true).animate({ height: 0 }, 500, function() { 23 $(this).parent().css("height", "0"); 24 }); 25 tocHidden = true; 26 } 27 $tocIframe.css("margin-bottom", "0"); 28 $topicSelector.addClass("bgarrow_down_white").removeClass("bgarrow_up_white"); 29} 30function showTOCbyDefaultHeight() { 31 $tocIframe.stop(true, true); 32 $tocIframe.parent().css("height", "auto"); 33 $tocIframe.show("fast"); 34 const animateHeight = tocFrameHeight > 80 ? tocFrameHeight : 400; 35 $tocIframe.animate({ height: animateHeight }, 500); 36 $tocIframe.css("margin-bottom", "3em"); 37 tocHidden = false; 38} 39$topicSelector.click(function() { 40 const $this = $(this); 41 // Hide tabs when topicSelect is clicked 42 $tabs.stop(true, true).hide("fast"); 43 $tabsSelector.addClass("bgarrow_down_white").removeClass("bgarrow_up_white"); 44 // Do the job 45 if ($this.hasClass("bgarrow_down_white")) { 46 if (firstLoad) { 47 if (window.chrome) 48 $tocIframe.css("display", "inline"); 49 // Prevent stacked load handlers 50 $tocIframe.off("load").on("load", function(){ 51 $tocIframe.resize(); 52 }); 53 // Stop queued animations before showing 54 $tocIframe.stop(true, true).show("fast", function() { 55 // Force reload only if not properly resized during onLoad 56 if ($tocIframe.height() < 80) 57 $(this).attr( 'src', function ( i, val ) { return val; }); 58 $tocIframe.css("margin-bottom", "3em"); 59 // Capture height after show completes 60 setTimeout(function() { 61 tocFrameHeight = $tocIframe.outerHeight() || 400; 62 }, 50); 63 }); 64 tocHidden = false; 65 } else 66 showTOCbyDefaultHeight(); 67 firstLoad = false; 68 $this.addClass("bgarrow_up_white").removeClass("bgarrow_down_white"); 69 } else 70 hideTOCbyZeroHeight(); 71}); 72 73$("#desktop_view a").click(function(e) { 74 $("body").addClass("desktop_mode"); 75 removeMaxWidthRules(); 76 $("meta[name='viewport']").attr("content", "width=1280px, initial-scale=1, maximum-scale=1"); 77 e.preventDefault(); 78}); 79function removeMaxWidthRules(){for(const s of document.styleSheets){try{for(let i=s.cssRules.length-1;i>=0;i--)if(s.cssRules[i] instanceof CSSMediaRule&&s.cssRules[i].conditionText.includes("max-width"))s.deleteRule(i);}catch(e){}}} 80 81// Header animation 82$(document).ready(function () { 83 let previousScroll = 0; 84 const startScroll = 800; // from which position from top 85 const minHeight = 400; // minimum height of screen needed 86 const flickTimeout = 200; 87 const origMarginTop = $('main').css("padding-top"); 88 $(window).on('scroll', function () { 89 clearTimeout(); 90 const headerHeight = $('header').outerHeight(); 91 const topHeight = $('#top:visible').outerHeight() ?? 0; 92 let acceptableHeight = 0; 93 const windowHeight = $(window).height(); 94 if (topHeight > 0) 95 acceptableHeight = headerHeight + topHeight; 96 let currentScroll = $(this).scrollTop(); 97 let canFixHeader = currentScroll > acceptableHeight && currentScroll < previousScroll && windowHeight >= minHeight; 98 if (canFixHeader) { 99 if (currentScroll > startScroll && !$('header').hasClass("fixed")) { 100 setTimeout(function() { 101 let newMarginPx = parseInt(origMarginTop) + headerHeight; 102 $('header').addClass('fixed'); 103 $('main').css('padding-top', newMarginPx); 104 }, flickTimeout); 105 } 106 } else { 107 if ($('header').hasClass("fixed") || currentScroll == 0) 108 setTimeout(function() { 109 $('header').removeClass('fixed'); 110 $('main').css('padding-top', origMarginTop); 111 }, flickTimeout); 112 } 113 previousScroll = currentScroll; 114 }); 115}); 116 117// Enable responsive search 118$('#search_toolbar a').on('click', function(e) { 119 if ($('#search_toolbar').hasClass("shown")) return; 120 e.preventDefault(); 121 $('html, body').animate({ scrollTop: 0 }, 200, function() { 122 if ($('#top').css("display") == "none") 123 $('#top').slideToggle(500, function() { 124 if ($(this).is(':visible')) 125 $(this).css('display', 'flex'); 126 });
127 }); 128}); 129 130// Expanders in content 131// a.dropdown-toggle 132$("#topicText").on("click", "a.dropdown-toggle", function(e) { 133 let state = $( this ).attr("data-state"); 134 if (state == "0") state = "1"; else state = "0"; 135 $( this ).attr("data-state", state); 136 const element = stripHtmlTags($( this ).attr("id").replace("_LINK", "")); 137 const elementIcon = stripHtmlTags($( this ).attr("id").replace("_LINK", "_ICON")); 138 $( "#" + element ).slideToggle("fast", function() { 139 adjustFooterPosition(); 140 $(this).find(".mobileTableBig").each(function() { 141 adjustBigTable($(this)); 142 }); 143 }); 144 $( "#" + elementIcon ).attr("src", $( this ).attr("data-src" + state)); 145 $( "#" + elementIcon ).attr("alt", "state" + state); 146}); 147// img.dropdown-toggle-icon 148$("#topicText").on("click", "img.dropdown-toggle-icon", function(e) { 149 let imgSrc = ""; 150 let state = 0; 151 const element = stripHtmlTags($( this ).attr("id").replace("_ICON", "")); 152 const elementLink = stripHtmlTags($( this ).attr("id").replace("_ICON", "_LINK")); 153 let currentState = $( "#" + elementLink ).attr("data-state"); 154 if (currentState == 0) { 155 imgSrc = $( "#" + elementLink ).attr("data-src1"); 156 state = 1; 157 } else { 158 imgSrc = $( "#" + elementLink ).attr("data-src0"); 159 state = 0; 160 } 161 $( this ).attr("alt", "state" + state); 162 $( this ).attr("src", imgSrc); 163 $( "#" + element ).slideToggle("fast", function() { 164 adjustFooterPosition(); 165 $(this).find(".mobileTableBig").each(function() { 166 adjustBigTable($(this)); 167 }); 168 }); 169 $( "#" + elementLink ).attr("data-state", state); 170}); 171 172$(document).on('keyup',function(event) { 173 if (event.keyCode == 27) { // ESC handler 174 $("#languagemenu").hide("fast"); 175 $("#versionSelector").hide("fast"); 176 if ($("#lightbox")) hideLightBox(); 177 } 178}); 179 180// If clicked on lightbox, delete it 181function hideLightBox() { 182 if ($("#lightbox")) 183 $("#lightbox").animate({opacity: 0}, 200, function() {$(this).remove();}); 184 $("#offlineSearch").css("height", "6ex"); 185} 186$("body").on("click", "#lightbox", function(e) { hideLightBox(); }); 187 188// Close lngselectbox and verselectbox if clicked with mouse outside 189let mouse_is_inside_top = false; 190let mouse_is_inside_header = false; 191$('#top').hover(function(){ 192 mouse_is_inside_top=true; 193}, function(){ 194 mouse_is_inside_top=false; 195}); 196$('header').hover(function(){ 197 mouse_is_inside_header=true; 198}, function(){ 199 mouse_is_inside_header=false; 200}); 201$("body").mouseup(function(){ 202 if(!mouse_is_inside_header) $("#languagemenu").hide("fast"); 203 if(!mouse_is_inside_top) $("#versionSelector").hide("fast"); 204}); 205$(document).on('keyup',function(event) { 206 if (event.keyCode == 27) { // ESC handler 207 $("#languagemenu").hide("fast"); 208 $("#versionSelector").hide("fast"); 209 $("#pdfDownloadOptions").hide("fast"); 210 } 211}); 212 213// DivScroll and mobileTable for tables 214window.setMobileTable = function(selector) { 215 const tableEl = selector; 216 $(tableEl).addClass("Table_small_mobile"); 217 const thEls = tableEl.querySelectorAll("thead > tr > th"); 218 const tdLabels = Array.from(thEls).map(el => el.innerText); 219 tableEl.querySelectorAll("tbody > tr").forEach( tr => { 220 Array.from(tr.children).forEach( 221 (td, ndx) => $(td).each(function() { 222 $(this).attr("label", tdLabels[ndx]); 223 if ($(this).children().length >= 2) 224 $(this).wrapInner("<div class='flex-mobile-td'></div>"); 225 }) 226 ); 227 }); 228} 229 230function adjustBigTable(elem) { 231 let $thisMobileTable = elem; 232 if ($thisMobileTable.height() > 400) {
233 let $fakeScrollInner = $('<div>').css({ 234 width: $thisMobileTable[0].scrollWidth + 'px', 235 height: '1px' 236 }); 237 let index = elem.attr("data-index"); 238 let uniqueScrollClass = 'scroll-top-' + index; 239 let $newScrollDiv = $('<div>', { 240 class: 'scroll-top ' + uniqueScrollClass 241 }); 242 if (!$("."+uniqueScrollClass).length) { 243 $thisMobileTable.before($newScrollDiv); 244 $("."+uniqueScrollClass).append($fakeScrollInner); 245 } 246 $("."+uniqueScrollClass).on('scroll', function () { 247 $thisMobileTable.scrollLeft($("."+uniqueScrollClass).scrollLeft()); 248 }); 249 $thisMobileTable.on('scroll', function () { 250 $("."+uniqueScrollClass).scrollLeft($thisMobileTable.scrollLeft()); 251 }); 252 } 253} 254function adjustTablesForMobile() { 255 // Scrolling big tables 256 if ($("#topicText table.Table_big")) 257 $("#topicText table.Table_big").wrap("<div class='mobileTableBig'></div>"); 258 if ($("#topicText table.Table_code")) 259 $("#topicText table.Table_code").wrap("<div class='mobileTableBig'></div>"); 260 // Add scroll to top for each big table 261 $('.mobileTableBig').each(function (index) { 262 $(this).attr("data-index", index); 263 adjustBigTable($(this)); 264 }); 265 // Default tables 266 if ($("#topicText table.Table_small")) { 267 $("#topicText table.Table_small").each(function() { 268 setMobileTable(this); 269 }); 270 $('#topicText table.Table_small').each(function() { 271 if ($(this).height() > 800) { 272 $(this).addClass('longTable'); 273 } 274 }); 275 } 276} 277adjustTablesForMobile(); 278 279// Sorting of tables 280function sortTables() { 281 $('#topicText table.Table_small th, #topicText table.Table_big th').hover(function(e){ 282 if ($(this).parents('table').find("tr").length < 12) 283 return; 284 $(this).css("cursor", "pointer"); 285 }); 286 $('#topicText table.Table_small th, #topicText table.Table_big th').click(function(e){ 287 if ($(this).parents('table').find("tr").length < 12) 288 return; 289 if (!$(this).has('span.sort_arrow').length) 290 $(this).find("span.f_Head_row").append('<span class="sort_arrow"></span>'); 291 let table = $(this).parents('table').eq(0); 292 let rows = table.find('tr:gt(0)').toArray().sort(comparer($(this).index())); 293 this.asc = !this.asc; 294 if (!this.asc){rows = rows.reverse()} 295 rows.forEach(row => table.append(row)); 296 setTableThIcon(this, this.asc); 297 }); 298} 299function comparer(index) { 300 return function(a, b) { 301 let valA = getCellValue(a, index), valB = getCellValue(b, index) 302 return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB) 303 } 304} 305function getCellValue(row, index) { 306 let tdVal = $(row).children('td').eq(index); 307 if (tdVal.attr("sortValue")) 308 return tdVal.attr("sortValue"); 309 else 310 return tdVal.text(); 311} 312function setTableThIcon(element, inverse) { 313 let iconSpan = $(element).find('span.sort_arrow'); 314 if (inverse) 315 $(iconSpan).removeClass().addClass('sort-column-asc').addClass('sort_arrow').html(" ↑ "); // arrow up 316 else 317 $(iconSpan).removeClass().addClass('sort-column-desc').addClass('sort_arrow').html(" ↓ "); // arrow down 318 $(element).siblings().find('span.sort_arrow').each(function (i, obj) { 319 $(obj).removeClass().addClass('sort_arrow').html(""); 320 }); 321} 322sortTables(); 323 324function adjustImagesForMobile() { 325 $('#topicText img').each(function() { 326 if (($(this).attr("width") > 0 && $(this).attr("width") <= 48) || $(this).width() <= 48) 327 $(this).addClass('icon'); 328 }); 329} 330adjustImagesForMobile(); 331 332function adjustFooterPosition() { 333 let currentBodyHeight = $("body").height(); 334 if ($("footer").css("position") == "fixed") 335 currentBodyHeight += $("footer").height(); 336 if (currentBodyHeight < $(window).height()) { 337 $("footer") 338 .css("position", "fixed") 339 .css("width", "100%") 340 .css("bottom", "0px"); 341 } else { 342 $("footer") 343 .css("position", "static") 344 .css("width", "auto") 345 .css("bottom", "initial"); 346 } 347} 348$( window ).resize(function() { adjustFooterPosition(); }); 349$( window ).scroll(function() { adjustFooterPosition(); });
350$( window ).ready(function() { adjustFooterPosition(); }); 351adjustFooterPosition(); 352setTimeout(function(){ adjustFooterPosition(); }, 2500); 353 354// Offline search highlight 355function findGetParameter(t){let e=null;for(const r of location.search.substring(1).split("&")){const[n,o]=r.split("=");if(n===t){e=decodeURIComponent(o.replace(/\+/g," "));break}}return e?stripHtmlTags(e):e} 356let zoomH = findGetParameter("zoom_highlightsub"); 357if (zoomH && zoomH.length >= 3) { 358 $.getScript( "js/jquery.mark.min.js" ).done(function( script, textStatus ) { $("#topicText").mark(zoomH); }); 359} 360 361// Catch and animate specific anchors like "topic.html#anchor" 362$("#topicText").on("click", "a[href*=\\#]", function(e) { 363 let filename = location.pathname.substring(location.pathname.lastIndexOf('/')+1); 364 let queryStringPositon = location.href.indexOf("?"); 365 if (queryStringPositon > -1) { 366 filename = location.href.substring(queryStringPositon+1); 367 filename = filename.substring(0, filename.lastIndexOf(".")) + ".html"; 368 } 369 let dest = $(this).attr('href'); 370 let destTopicName = dest.substring(0, dest.lastIndexOf('#')); 371 let destAnchor = dest.substring(dest.lastIndexOf('#')); 372 if (filename != destTopicName) 373 return; 374 if ($(destAnchor)) { 375 e.preventDefault(); 376 $('html,body').animate({ scrollTop: $(destAnchor).offset().top - 30 }, 'slow'); 377 } 378}); 379 380// RTL floating images 381function adjustRTLFloatImages() { 382 $("html[dir='rtl'] #topicText img").each(function() { 383 if ($(this).css("float") == "left") { 384 $(this).css("float", "right"); 385 if ($(this).css("margin-right") != "0px") { 386 $(this).css("margin-left", $(this).css("margin-right")); 387 $(this).css("margin-right", "0"); 388 } 389 } 390 }); 391} 392adjustRTLFloatImages(); 393 394// External links - icon addition 395function extLinks() { 396 // exclude RTL 397 if ($("html").attr("dir") == "rtl"); 398 else { 399 var extLinkValid = true; 400 $("#topicText a.weblink").each(function() { 401 extLinkValid = true; 402 // except current host 403 if ($(this).attr("href").includes(location.hostname)) 404 extLinkValid = false; 405 // except relative links 406 if ($(this).attr("href").includes("http://") || $(this).attr("href").includes("https://")); 407 else 408 extLinkValid = false; 409 if (extLinkValid) 410 $(this).addClass('extLinkImg'); 411 }); 412 } 413} 414extLinks(); 415 416// Copy Table_Code contents to clipboard and/or Download code as file 417function cleanCode(code) { 418 return code.replace(/\u00A0/g, ' ').trimEnd(); 419} 420function getCodeSnippetLineCount(tdElement) { 421 const $clone = tdElement.clone(); 422 $clone.find("a.codeURL, a.downloadFile, span.codeURL, span.downloadFile").remove(); 423 const rawHtml = $clone.html() || ""; 424 const normalizedHtml = rawHtml 425 .replace(/<br\s*\/?>/gi, "\n") 426 .replace(/<\/p>/gi, "\n") 427 .replace(/<p[^>]*>/gi, ""); 428 const textWithBreaks = $("<div>").html(normalizedHtml).text(); 429 return textWithBreaks 430 .split("\n") 431 .map(function(line) { 432 return cleanCode(line).trim(); 433 }) 434 .filter(function(line) { 435 return line.length > 0; 436 }).length; 437} 438function copyCodeToClipboard(copyIcon, tdElement) { 439 const textToCopy = cleanCode(tdElement.text()); 440 navigator.clipboard.writeText(textToCopy) 441 .then(() => { 442 fadeCopyIcon(copyIcon); 443 }); 444} 445function fadeCopyIcon(copyIcon) { 446 $(copyIcon).addClass("copied"); 447 $(copyIcon).addClass("s-fading"); 448 $(copyIcon).css("display", "inline-block"); 449 $(copyIcon).fadeOut(2000, function() { 450 $(copyIcon).removeClass("copied"); 451 $(copyIcon).removeClass("s-fading"); 452 if ($(copyIcon).is(':hover')) 453 $(copyIcon).fadeIn(200); 454 else 455 $(copyIcon).css("display", "none"); 456 }); 457} 458function downloadFileFromCodeSnippet(downloadIcon, tdElement) { 459 const textToDownload = cleanCode(tdElement.text()); 460 const classList = (tdElement.attr("class") || "").split(/\s+/); 461 const fileTypeClass = classList.find(function(className) { 462 return className.indexOf("FileType_") === 0; 463 }); 464 let ext = "txt"; 465 if (fileTypeClass) { 466 const extractedExt = fileTypeClass.substring("FileType_".length).trim(); 467 if (extractedExt.length > 0) 468 ext = extractedExt; 469 } 470 const sanitizedExt = ext.replace(/[^a-zA-Z0-9_-]/g, "") || "txt"; 471 const fileName = "file." + sanitizedExt; 472 const blob = new Blob([textToDownload], { type: "text/plain;charset=utf-8" }); 473 const objectUrl = URL.createObjectURL(blob); 474 const $downloadLink = $("<a>", { 475 href: objectUrl, 476 download: fileName, 477 css: { display: "none" } 478 }); 479 $("body").append($downloadLink); 480 $downloadLink[0].click(); 481 $downloadLink.remove(); 482 URL.revokeObjectURL(objectUrl); 483} 484const copyCodeStr = document.currentScript.getAttribute("data-str_copy_clipboard").replace(/<[^>]*>/g,'') ?? ''; 485const downloadCodeStr = document.currentScript.getAttribute("data-str_download_file").replace(/<[^>]*>/g,'') ?? ''; 486function copyCode() { 487 const isRtl = $("html").attr("dir") === "rtl"; 488 $("#topicText td.Table_code").each(function() { 489 const lineCount = getCodeSnippetLineCount($(this)); 490 const canDownload = lineCount >= 3; 491 $(this).css("position", "relative"); 492 $(this).find("p").css("padding-right", canDownload ? "44px" : "24px"); 493 $(this).attr("data-can-download", canDownload ? "1" : "0"); 494 if (canDownload) { 495 $(this).prepend('<a class="downloadFile"></a>'); 496 $(this).find("a.downloadFile").attr("title", downloadCodeStr); 497 } 498 $(this).prepend('<a class="codeURL"></a>'); 499 $(this).find("a.codeURL").attr("title", copyCodeStr); 500 }); 501 $("#topicText td.Table_code").hover( 502 function() { 503 $(this).find("a.codeURL").css("display", "inline-block"); 504 $(this).find("a.downloadFile").css("display", "inline-block"); 505 }, function() { 506 if (!$(this).find("a.codeURL").hasClass("s-fading")) 507 $(this).find("a.codeURL").css("display", "none"); 508 $(this).find("a.downloadFile").css("display", "none"); 509 });
510 $("#topicText").off("click", "a.codeURL"); 511 $("#topicText").on("click", "a.codeURL", function(e) { 512 copyCodeToClipboard($(this), $(this).parent()); 513 e.preventDefault(); 514 return false; 515 }); 516 $("#topicText").off("click", "a.downloadFile"); 517 $("#topicText").on("click", "a.downloadFile", function(e) { 518 downloadFileFromCodeSnippet($(this), $(this).parent()); 519 e.preventDefault(); 520 return false; 521 }); 522} 523copyCode(); 524 525// PDF toolbar 526$("a#pdfDownloadIcon").on("click", function(e) { 527 e.preventDefault(); 528 $("#pdfDownloadOptions").slideToggle("500"); 529 let pd_queryStringPositon = location.href.indexOf("?"); 530 if (pd_queryStringPositon > -1) { 531 let pd_topicForceToLoad = location.href.substring(pd_queryStringPositon+1); 532 pd_topicForceToLoad = pd_topicForceToLoad.substring(0, pd_topicForceToLoad.lastIndexOf(".")) + ".html"; 533 if (pd_topicForceToLoad.match("^[a-zA-Z0-9._-]+\.html$")) 534 $("#pdfDownloadOptions a:first").attr("href", $("#pdfDownloadOptions a:first").attr("href").replace(/topic=[a-zA-Z0-9._-]+/, "topic="+pd_topicForceToLoad)); 535 } 536 $("#pdfDownloadOptions a:first").attr("href", $("#pdfDownloadOptions a:first").attr("href").replace(".html", "")); 537 hideTopicControlBox($("#pdfDownloadOptions")); 538}); 539function downloadPDFtoolbar(e) {return true;} 540 541// Share current URL 542$("a#shareButton").on("click", function(e) { 543 e.preventDefault(); 544 $("#shareButtons").slideToggle("500"); 545 hideTopicControlBox($("#shareButtons")); 546}); 547$("a#shareButtonUrlCopy").on("click", function(e) { 548 e.preventDefault(); 549 navigator.clipboard.writeText(get_sh_currentLocation()) 550 .then(() => { 551 fadeCopyIcon($(this).find("span")); 552 }); 553}); 554$("a#shareButtonUrlCopy").hover( 555 function() { 556 $(this).find("span.codeURL").css("display", "inline-block"); 557 }, function() { 558 if (!$(this).find("span.codeURL").hasClass("s-fading")) 559 $(this).find("span.codeURL").css("display", "none"); 560}); 561$("a#shareButtonEmail").on("click", function(e) { 562 e.preventDefault(); 563 let mailtoLink = "mailto:?subject=" + $(this).text() + "&body=" + get_sh_currentLocation(); 564 location.href = mailtoLink; 565}); 566 567function get_sh_currentLocation() { 568 let sh_currentLocation = location.pathname; 569 let sh_queryStringPositon = location.href.indexOf("?"); 570 if (sh_queryStringPositon > -1) { 571 let sh_topicForceToLoad = location.href.substring(sh_queryStringPositon+1); 572 sh_topicForceToLoad = sh_topicForceToLoad.substring(0, sh_topicForceToLoad.lastIndexOf(".")) + ".html"; 573 if (sh_topicForceToLoad.match("^[a-zA-Z0-9._-]+\.html$")) 574 sh_currentLocation = location.pathname.substring(0, location.pathname.lastIndexOf("/")) + "/" + sh_topicForceToLoad; 575 } 576 sh_currentLocation = "https://" + location.hostname + sh_currentLocation; 577 return sh_currentLocation; 578} 579let topicControlBoxTimeout; 580function hideTopicControlBox(elemToHide) { 581 clearTimeout(topicControlBoxTimeout); 582 topicControlBoxTimeout = setTimeout(function() { 583 elemToHide.hide("fast"); 584 }, 10000); 585} 586function shareUrl(e) {return true;} 587function shareUrlCopy(e) {return true;} 588function shareUrlEmail(e) {return true;} 589 590function initIframeResizer() {
591 // Iterate over each iframe inside #topicText 592 $('#topicText iframe').each(function (index) { 593 const $frame = $(this); 594 if (!$frame.hasClass('resizer')) { 595 return; 596 } 597 const frameId = $frame.attr('id') || `iResizer_${index}`; 598 const frameUrl = $frame.data('frame-url'); // Get from data-frame-url attribute 599 if (!frameUrl) { 600 console.warn(`Skipping iframe "${frameId}" â missing data-frame-url attribute.`); 601 return; 602 } 603 const showLoader = (($frame.data('loader') ?? '').toString().toLowerCase() !== 'false'); 604 const loaderId = `iframeLoader_${index}`; 605 // Create loader element when enabled 606 if (showLoader) { 607 const loaderHtml = `<div id="${loaderId}" class="spinner"></div>`; 608 // Prepend loader before the iframe (if not already present) 609 if (!$(`#${loaderId}`).length) { 610 $frame.after(loaderHtml); 611 } 612 } 613 // Set iframe src and handle load event 614 const querySeparator = frameUrl.includes('?') ? '&' : '?'; 615 let srcUrl = frameUrl + querySeparator + "ts=" + Date.now(); 616 if ($("html").hasClass("dark")) { 617 srcUrl += "&mode=dark"; 618 } 619 $frame 620 .attr('src', srcUrl) 621 .off('load') 622 .on('load', function () { 623 if (showLoader) { 624 $(`#${loaderId}`).hide(); 625 } 626 if (typeof $(this).iframeResize === "function") 627 $(this).iframeResize({ 628 license: iLicense, 629 onReady: function(e) { 630 setTimeout(function() { 631 const anchor = window.location.hash.substring(1); 632 if (anchor) { 633 e.iFrameResizer.moveToAnchor(anchor); 634 } 635 }, 100); 636 } 637 }); 638 else 639 console.warn(`Skipping iframe "${frameId}" â function iframeResize N/A.`); 640 }); 641 }); 642} 643const iLicense = document.currentScript.getAttribute("data-iframe_resizer_license").replace(/<[^>]*>/g,'') ?? ''; 644initIframeResizer(); 645 646function stripHtmlTags(str) { 647 if (!str) return ''; 648 str = str.replace(/<[^>]*>/g, ''); 649 str = str.replace(/[<>]/g, ''); 650 str = str.replace(/[^a-zA-Z0-9_-]/g, ''); 651 return str; 652} 653 654// Event resize 655$( window ).resize(function() { 656 adjustFooterPosition(); 657}); 658 659// Handling back/forward button 660window.onpopstate = function(event) { 661 window.location = document.location; 662}; 663 664// Dummy 665function HMTrackTopiclink(e) {return true;}
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.