User:Wiktorpyk/minerva.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:Wiktorpyk/minerva.css. |
function scrollFunction() {
if (window.innerWidth > 768) {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
document.querySelector(".minerva-header .branding-box").style.width = "0px";
document.querySelector(".minerva-header .branding-box").style.height = "0px";
document.querySelector(".overlay-header, .minerva-header").style.display = "table";
document.querySelector(".branding-box img").style.opacity = "0";
document.querySelector(".minerva-header .branding-box").style.position = "absolute";
document.querySelector(".header-container").style.width = "auto";
document.querySelector(".header-container").style.height = "auto";
document.querySelector(".header-container").style.margin = "10px 0px 0px 0px";
document.querySelector(".header-container").style.borderRadius = "0px";
document.querySelector(".header-container").style.borderBottomLeftRadius = "20px";
document.querySelector(".header-container").style.borderTopLeftRadius = "20px";
document.querySelector(".overlay-header > div, .minerva-header > div, .overlay-header > .navigation-drawer, .minerva-header > .navigation-drawer").style.display = "table-row";
document.querySelector(".overlay-header > div, .minerva-header > div, .overlay-header > .navigation-drawer, .minerva-header > .navigation-drawer").style.textAlign = "right";
document.querySelector(".header-container").style.paddingTop = "5px";
document.querySelector(".header-container").style.paddingRight = "3px";
document.querySelector(".header-container").style.paddingBottom = "8px";
document.querySelector(".header-container").style.paddingLeft = "7px";
document.querySelector(".minerva-user-navigation").style.display = "table-row";
document.querySelector(".minerva-user-navigation").style.minWidth = "none";
document.querySelector(".minerva-user-navigation").style.minHeight = "none";
document.querySelector(".minerva-user-navigation").style.width = "40px";
document.querySelector(".minerva-user-navigation").style.alignItems = "center";
document.querySelector(".minerva-user-navigation").style.justifyContent = "flex-end";
document.querySelector(".minerva-user-navigation").style.paddingBottom = "10px";
} else {
document.querySelector(".minerva-header .branding-box").style.width = "119px";
document.querySelector(".minerva-header .branding-box").style.height = "auto";
document.querySelector(".overlay-header, .minerva-header").style.display = "flex";
document.querySelector(".branding-box img").style.opacity = "1";
document.querySelector(".minerva-header .branding-box").style.position = "static";
document.querySelector(".header-container").style.width = "350px";
document.querySelector(".header-container").style.height = "65px";
document.querySelector(".header-container").style.margin = "30px 30px 0 0";
document.querySelector(".header-container").style.borderRadius = "20px";
document.querySelector(".header-container").style.borderBottomLeftRadius = "20px";
document.querySelector(".overlay-header > div, .minerva-header > div, .overlay-header > .navigation-drawer, .minerva-header > .navigation-drawer").style.display = "table-cell";
document.querySelector(".overlay-header > div, .minerva-header > div, .overlay-header > .navigation-drawer, .minerva-header > .navigation-drawer").style.textAlign = "center";
document.querySelector(".header-container").style.paddingTop = "5px";
document.querySelector(".header-container").style.paddingRight = "16px";
document.querySelector(".header-container").style.paddingBottom = "5px";
document.querySelector(".header-container").style.paddingLeft = "16px";
document.querySelector(".minerva-user-navigation").style.display = "flex";
document.querySelector(".minerva-user-navigation").style.minWidth = "none";
document.querySelector(".minerva-user-navigation").style.minHeight = "none";
document.querySelector(".minerva-user-navigation").style.width = "auto";
document.querySelector(".minerva-user-navigation").style.alignItems = "center";
document.querySelector(".minerva-user-navigation").style.justifyContent = "flex-end";
document.querySelector(".minerva-user-navigation").style.paddingBottom = "0px";
}
} else {
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
document.querySelector(".branding-box img").style.width = "0px";
document.querySelector(".branding-box img").style.opacity = "0";
document.querySelector(".header-container").style.width = "189px";
document.querySelector(".header-container").style.height = "55px";
document.querySelector(".header-container").style.margin = "0px 0px 0px 0px";
document.querySelector(".header-container").style.borderRadius = "0px";
document.querySelector(".header-container").style.borderBottomLeftRadius = "20px";
document.querySelector(".header-container").style.paddingTop = "0px";
document.querySelector(".header-container").style.paddingBottom = "0px";
document.querySelector(".header-container").style.right = "0";
} else {
document.querySelector(".branding-box img").style.width = "119px";
document.querySelector(".branding-box img").style.opacity = "1";
document.querySelector(".header-container").style.width = "100%";
document.querySelector(".header-container").style.height = "55px";
document.querySelector(".header-container").style.margin = "0px";
document.querySelector(".header-container").style.borderRadius = "0px";
document.querySelector(".header-container").style.borderBottomLeftRadius = "0px";
document.querySelector(".header-container").style.paddingTop = "0px";
document.querySelector(".header-container").style.paddingBottom = "0px";
}
}
}
window.onscroll = function () { scrollFunction () };
/* Preparing for iOS 15 and macOS Monterey */
const link = document.querySelector("meta[name=theme-color]");
function lightthemecolor() {
link.setAttribute('name', 'theme-color');
link.content = '#ebecf0';
document.getElementsByTagName('head')[0].appendChild(link);
}
function darkthemecolor() {
link.setAttribute('name', 'theme-color');
link.content = '#3d3d3d';
document.getElementsByTagName('head')[0].appendChild(link);
}
if (window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches) {
darkthemecolor();
} else {
lightthemecolor();
}
function test() {
var elements = document.getElementsByClassName('infobox');
var requiredElement = elements[0];
requiredElement.classList.add("primaryinfo");
}
test();