if (mw.config.get('skin') === "timeless") { var veReadyTimer = null; var veReady = false; var isFloating = false; function updateToolbar() { if (!veReady) return; if (window.innerWidth >= 851 && !isFloating) { if (!isFloating) { var headerContainer = document.getElementById("mw-header-container"); var headerHack = document.getElementById("mw-header-hack"); var offset = headerContainer.offsetHeight + headerHack.offsetHeight; ve.init.target.toolbarScrollOffset = offset; isFloating = true; } } else if (isFloating) { ve.init.target.toolbarScrollOffset = 0; isFloating = false; } } function waitForVE() { if (ve && ve.init && ve.init.target) { veReady = true; updateToolbar(); if (veReadyTimer) { clearInterval(veReadyTimer); } } } veReadyTimer = setInterval(waitForVE, 500); window.addEventListener('resize', updateToolbar, { passive: true }); }