1$(document).ready(function() { 2 if ($("#dev-warning").length == 1) { 3 console.log('This is the local development version of the website.'); 4 } 5 6 // Enable all poppers and tooltips in the document 7 $('[data-toggle="popover"]').popover(); 8 $('[data-toggle="tooltip"]').tooltip(); 9 10 // Render table of contents if it is non-trivial. 11 if ($('.longread h2, .longread h3').length > 1) { 12 tocbot.init({ 13 tocSelector: '#TOC', 14 contentSelector: '.longread', 15 headingSelector: 'h2, h3', 16 // This is quite arbitrary and can't work bullet-proof. Currently selected heading is devised from 17 // ~mid-screen, so it's screen dependent. 18 headingsOffset: -300, 19 scrollSmooth: false, 20 }); 21 $('.longread-toc').removeClass('invisible'); 22 } else { 23 // Keep it visible for the largest size so that it does not break the 24 // central alignment of the .longread box. 25 $('.longread-toc').addClass('d-none d-xl-block'); 26 } 27 28 // Create the instance that handles js search. 29 var search = new Search(); 30 31 // Create the instance that handles navbars. 32 var navbars = new Navbars(); 33 34 // Custom handler for expanders for expandable preview blocks. 35 $(".preview-blocks-expander .expander").click(function() { 36 let buttonCollapsedClass = "collapsed"; 37 // Animate the chevron icon. 38 $(this).toggleClass(buttonCollapsedClass); 39 // Swap the "More" / "Less" labels. 40 $(this).find("span").toggleClass("d-none"); 41 42 var root = $(this).parents(".expandable-block"); 43 var expandables = root.find(".expandable"); 44 45 // Show / hide the preview blocks. Do a 2-phase transition to make sure the 'display' property does not change 46 // in one of the phases. This is the animated phase (change in 'display' blocks css transition to happen). 47 let blockExpandingClass = "expanding"; 48 let blockExpandedClass = "expanded"; 49 if (expandables.hasClass(blockExpandedClass)) { 50 // Hiding the block may cause scrolling, esp. on mobile. Minimize the chaos by freezing navbar updates. 51 navbars.freezeUpdates(); 52 expandables.removeClass(blockExpandedClass); 53 setTimeout(() => { 54 expandables.removeClass(blockExpandingClass); 55 this.scrollIntoView({block: "nearest"}); 56 }, 550); 57 // Allow enough time for scrollIntoView to propagate before unfreezing navbar. 58 setTimeout(() => { 59 navbars.unfreezeUpdates(); 60 }, 1500); 61 } else { 62 expandables.addClass(blockExpandingClass); 63 setTimeout(() => { 64 expandables.addClass(blockExpandedClass); 65 }); 66 } 67 }); 68});
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.