1// JavaScript source code 2// Show an element 3var show = function (elem) { 4 5 // Get the natural height of the element 6 var getHeight = function () { 7 elem.style.display = 'block'; // Make it visible 8 var height = elem.scrollHeight + 'px'; // Get it's height 9 elem.style.display = ''; // Hide it again 10 return height; 11 }; 12 13 var height = getHeight(); // Get the natural height 14 elem.classList.add('is-visible'); // Make the element visible 15 elem.style.height = height; // Update the max-height 16 17 // Once the transition is complete, remove the inline max-height so the content can scale responsively 18 window.setTimeout(function () { 19 elem.style.height = ''; 20 }, 350); 21 22}; 23 24// Hide an element 25var hide = function (elem) { 26 27 // Give the element a height to change from 28 elem.style.height = elem.scrollHeight + 'px'; 29 30 // Set the height back to 0 31 window.setTimeout(function () { 32 elem.style.height = '0'; 33 }, 1); 34 35 // When the transition is complete, hide it 36 window.setTimeout(function () { 37 elem.classList.remove('is-visible'); 38 }, 350); 39 //elem.style.height = elem.scrollHeight + 'px'; 40}; 41 42// Toggle element visibility 43var toggle = function (elem, timing) { 44 45 // If the element is visible, hide it 46 if (elem.classList.contains('is-visible')) { 47 hide(elem); 48 return; 49 } 50 51 // Otherwise, show it 52 show(elem); 53 // Otherwise, hide it 54 //hide(elem); 55 56}; 57 58// Listen for click events 59 document.addEventListener('click', function (event) { 60 61 // Make sure clicked element is our toggle 62 if (!event.target.classList.contains('toggle')) return; 63 64 // Prevent default link behavior 65 event.preventDefault(); 66 67 // Get the content 68 var content = document.querySelector(event.target.hash); 69 if (!content) return; 70 71 // Toggle the content 72 toggle(content); 73 74}, false); 75 76
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.