You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
2 years ago
|
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 });
|
||
|
}
|