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
if (currentURL.includes("en/nightly")) {
updateTheme("#262dbd", "#262dbd", "PMM Nightly Wiki");
} else if (currentURL.includes("en/develop")) {
updateTheme("#ffa724", "#ffa724", "PMM Develop Wiki");
}
}
// Call the function on page load
window.addEventListener("load", checkURLForBranch);