Plex-Meta-Manager/docs/stylesheets/branch.js

32 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-11-06 20:38:00 +00:00
// custom.js
// Function to check if the current URL contains "config" or "metadata"
function checkURLForBranch() {
const currentURL = window.location.href;
if (currentURL.indexOf("nightly") !== -1) {
// If "config" is found in the URL, change the CSS of .md-header to red
2023-11-08 22:00:47 +00:00
document.querySelector(".md-header").style.backgroundColor = "#262dbd";
document.querySelector(".md-tabs").style.backgroundColor = "#262dbd";
2023-11-06 20:38:00 +00:00
// Change the text of <span class="md-ellipsis">
const ellipsisSpan = document.querySelector(".md-ellipsis");
if (ellipsisSpan) {
2023-11-06 20:58:52 +00:00
ellipsisSpan.textContent = "PMM Nightly Wiki";
2023-11-06 20:38:00 +00:00
}
} else if (currentURL.indexOf("develop") !== -1) {
// If "metadata" is found in the URL, change the CSS of .md-header to yellow
document.querySelector(".md-header").style.backgroundColor = "#ffa724";
document.querySelector(".md-tabs").style.backgroundColor = "#ffa724";
// Change the text of <span class="md-ellipsis">
const ellipsisSpan = document.querySelector(".md-ellipsis");
if (ellipsisSpan) {
2023-11-06 20:58:52 +00:00
ellipsisSpan.textContent = "PMM Develop Wiki";
2023-11-06 20:38:00 +00:00
}
}
}
// Call the function on page load
window.addEventListener("load", checkURLForBranch);