« MediaWiki:Common.js » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 7 : | Ligne 7 : | ||
function sync() { | function sync() { | ||
panel.style.minHeight = '0'; | panel.style.minHeight = '0'; | ||
panel.style.height = content.getBoundingClientRect().height + 'px'; | |||
// Convert 1em to pixels using the panel's own font size | |||
var em = parseFloat( getComputedStyle( panel ).fontSize ); | |||
panel.style.height = ( content.getBoundingClientRect().height - em ) + 'px'; | |||
} | } | ||
sync(); | sync(); | ||
Version du 30 juillet 2026 à 03:02
$( function () {
var panel = document.getElementById( 'mw-panel' );
var content = document.getElementById( 'content' );
if ( !panel || !content ) { return; }
// Set an exact height; min-height would only act as a floor
function sync() {
panel.style.minHeight = '0';
// Convert 1em to pixels using the panel's own font size
var em = parseFloat( getComputedStyle( panel ).fontSize );
panel.style.height = ( content.getBoundingClientRect().height - em ) + 'px';
}
sync();
// Recompute when the content box changes size
if ( window.ResizeObserver ) {
new ResizeObserver( sync ).observe( content );
} else {
window.addEventListener( 'resize', sync );
}
} );