|
|
@ -1,28 +1,30 @@
|
|
|
|
// custom.js
|
|
|
|
// custom.js
|
|
|
|
|
|
|
|
|
|
|
|
// Function to check if the current URL contains "config" or "metadata"
|
|
|
|
// Function to check if the current URL contains "nightly" or "develop" and adjust styles accordingly
|
|
|
|
function checkURLForBranch() {
|
|
|
|
function checkURLForBranch() {
|
|
|
|
const currentURL = window.location.href;
|
|
|
|
const currentURL = window.location.href;
|
|
|
|
|
|
|
|
|
|
|
|
if (currentURL.indexOf("nightly") !== -1) {
|
|
|
|
// Helper function to update style and text
|
|
|
|
// If "config" is found in the URL, change the CSS of .md-header to red
|
|
|
|
function updateTheme(headerColor, tabsColor, textContent) {
|
|
|
|
document.querySelector(".md-header").style.backgroundColor = "#262dbd";
|
|
|
|
const header = document.querySelector(".md-header");
|
|
|
|
document.querySelector(".md-tabs").style.backgroundColor = "#262dbd";
|
|
|
|
const tabs = document.querySelector(".md-tabs");
|
|
|
|
|
|
|
|
|
|
|
|
// Change the text of <span class="md-ellipsis">
|
|
|
|
|
|
|
|
const ellipsisSpan = document.querySelector(".md-ellipsis");
|
|
|
|
const ellipsisSpan = document.querySelector(".md-ellipsis");
|
|
|
|
if (ellipsisSpan) {
|
|
|
|
|
|
|
|
ellipsisSpan.textContent = "PMM Nightly Wiki";
|
|
|
|
if (header && tabs) { // Check if elements exist
|
|
|
|
|
|
|
|
header.style.backgroundColor = headerColor;
|
|
|
|
|
|
|
|
tabs.style.backgroundColor = tabsColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} 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">
|
|
|
|
if (ellipsisSpan) { // Check if element exists
|
|
|
|
const ellipsisSpan = document.querySelector(".md-ellipsis");
|
|
|
|
ellipsisSpan.textContent = textContent;
|
|
|
|
if (ellipsisSpan) {
|
|
|
|
}
|
|
|
|
ellipsisSpan.textContent = "PMM Develop Wiki";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|