You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plex-Meta-Manager/docs/stylesheets/branch.js

32 lines
1.1 KiB

// custom.js
// Function to check if the current URL contains "nightly" or "develop" and adjust styles accordingly
function checkURLForBranch() {
const currentURL = window.location.href;
// Helper function to update style and text
function updateTheme(headerColor, tabsColor, textContent) {
const header = document.querySelector(".md-header");
const tabs = document.querySelector(".md-tabs");
const ellipsisSpan = document.querySelector(".md-ellipsis");
if (header && tabs) { // Check if elements exist
header.style.backgroundColor = headerColor;
tabs.style.backgroundColor = tabsColor;
}
if (ellipsisSpan) { // Check if element exists
ellipsisSpan.textContent = textContent;
}
}
// Change theme based on URL segment
11 months ago
if (currentURL.includes("en/nightly")) {
8 months ago
updateTheme("#262dbd", "#262dbd", "Kometa Nightly Wiki");
11 months ago
} else if (currentURL.includes("en/develop")) {
8 months ago
updateTheme("#ffa724", "#ffa724", "Kometa Develop Wiki");
}
}
// Call the function on page load
window.addEventListener("load", checkURLForBranch);