MediaWiki:Timeless.js

/* All JavaScript here will be loaded for users of the Timeless skin */

mw.hook( 'wikipage.content' ).add( function ( content ) {   /*     * Position tooltiptext out of the table so it is not hidden by overflow     * NOTE:      * * This might break when there is multiple tooltiptext within the same element     * * When the table is scrollable, it seems that tooltip will still be hidden,     *   that is caused by the mask-image property in CSS. Perhaps disable that?     */    const tooltips = content[0].querySelectorAll( '.citizen-table-wrapper .tooltip' );

if ( tooltips ) { tooltips.forEach( function( tooltip ) {           const tooltipText = tooltip.querySelector( ':scope > .tooltiptext' );            // So tooltip won't make weird scrollbar            tooltipText.style.position = 'fixed';            if ( tooltipText ) {                tooltip.addEventListener( 'mouseover', function { const tooltipRect = tooltip.getBoundingClientRect; tooltipText.style.left = tooltipRect.left + tooltipRect.width / 2 + 'px'; tooltipText.style.bottom = window.innerHeight - tooltipRect.top + 20 + 'px'; } );               tooltip.addEventListener( 'mouseout', function { tooltipText.style.left = ''; tooltipText.style.bottom = ''; } );           }        } );    } } );