1document.addEventListener("DOMContentLoaded", (event) => { 2 function move_offscreen_if_on_left(window_width, tooltip_left, tooltip_width, element) { 3 var tooltip_left_edge = tooltip_left + tooltip_width; 4 if( tooltip_left_edge > window_width ) { 5 var move_tooltip = tooltip_left_edge - window_width; 6 7 element.style.left = '-' + move_tooltip + 'px'; 8 document.head.innerHTML += '<style type="text/css">.move_right::after { left:90%; }</style>'; 9 element.classList.add( 'move_right' ); 10 } 11 } 12 13 function move_offscreen_if_on_right(element) { 14 if (element === null || element.length == 0) { 15 return; 16 } 17 18 var tooltip_left = element.getBoundingClientRect().left; 19 if ( tooltip_left !== undefined ) { 20 var window_width = window.innerWidth; 21 if( Math.sign(tooltip_left) === -1 ) { 22 if( ( window_width/2 ) < Math.abs( tooltip_left ) ) { 23 document.head.innerHTML += '<style type="text/css">.move_left::after { left:10%; }</style>'; 24 element.classList.add( 'move_left' ); 25 } 26 27 var left = Math.abs(tooltip_left); 28 element.style.left = left + 'px'; 29 // In this way it is recalculated 30 element.style.left = left + Math.abs(element.getBoundingClientRect().left) + 'px'; 31 } 32 } 33 } 34 35 function move_offscreen( element ) { 36 if (element === null || element.length == 0) { 37 return; 38 } 39 40 var move_tooltip = ''; 41 var tooltip_left = element.getBoundingClientRect().left; 42 // Workaround to let JS to parse also the transform values for the position 43 element.style.transform = 'translateZ(0)'; 44 // Reset tooltip position to avoid issue on resize 45 if( typeof element.dataset.original_left === 'undefined' ) { 46 element.dataset.original_left = tooltip_left; 47 } else { 48 element.style.left = element.dataset.original_left; 49 } 50 var tooltip_width = element.getBoundingClientRect().width; 51 var window_width = window.innerWidth; 52 53 move_offscreen_if_on_left(window_width, tooltip_left, tooltip_width, element); 54 } 55 56 function fix_all_tooltips() { 57 var selector = document.querySelectorAll('.glossary-tooltip-content'); 58 if (selector.length > 0) { 59 selector.forEach(element => { 60 move_offscreen( element ); 61 }); 62 } 63 } 64 65 if ( window.matchMedia( "(any-hover: hover)") ) { 66 fix_all_tooltips(); 67 window.addEventListener('resize', function() { 68 fix_all_tooltips(); 69 }); 70 selector = document.querySelectorAll('.glossary-tooltip'); 71 if (selector.length > 0) { 72 selector.forEach(element => { 73 element.addEventListener('mouseover', function() { 74 move_offscreen_if_on_right( element.querySelector('.glossary-tooltip-content') ); 75 }, { once: true }); 76 }); 77 } 78 } 79});
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.