From c43d7830e89d970c37ecda6f53b43b06d72a6978 Mon Sep 17 00:00:00 2001
From: YozoraXCII <96386153+YozoraXCII@users.noreply.github.com>
Date: Wed, 26 Jun 2024 11:29:59 +0100
Subject: [PATCH] [22] remove discord widget and add version checking (#2141)
---
VERSION | 2 +-
docs/overrides/main.html | 32 ++++++++++++++++++++-----------
docs/stylesheets/branch.js | 39 +++++++++++++++++++-------------------
3 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/VERSION b/VERSION
index 4eda89ec..fa266374 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.2-build21
+2.0.2-build22
diff --git a/docs/overrides/main.html b/docs/overrides/main.html
index 53ee1b4a..c47b1698 100644
--- a/docs/overrides/main.html
+++ b/docs/overrides/main.html
@@ -1,15 +1,25 @@
{% extends "base.html" %}
-{% block extrahead %}
-
+{% block announce %}
+
{% endblock %}
diff --git a/docs/stylesheets/branch.js b/docs/stylesheets/branch.js
index 46d84a38..4d4e235c 100644
--- a/docs/stylesheets/branch.js
+++ b/docs/stylesheets/branch.js
@@ -1,30 +1,29 @@
function checkURLForBranch() {
const currentURL = window.location.href;
+ const ellipsisSpan = document.querySelector(".md-ellipsis");
+ const mdBanner = document.querySelector(".md-banner"); // Select the banner element
- // Select elements for background and text changes
- const headerAndTabs = document.querySelectorAll(".md-header, .md-tabs");
- const ellipsisSpan = document.querySelector(".md-ellipsis"); // Select ellipsisSpan
+ // Default text
+ let ellipsisText = "Kometa Wiki";
+ let bannerColor = "#252525"; // Default banner color
- if (headerAndTabs.length > 0) {
- let backgroundImage = "https://raw.githubusercontent.com/Kometa-Team/Kometa/nightly/docs/assets/background.jpg";
- let ellipsisText = ""; // Initialize ellipsisText
+ if (currentURL.includes("en/nightly") || currentURL.includes("en/develop") {
+ ellipsisText = currentURL.includes("en/nightly") ? "Kometa Nightly Wiki" : "Kometa Develop Wiki";
+ bannerColor = "#611423"; // Updated banner color
+ }
- if (currentURL.includes("en/nightly")) {
- backgroundImage = "https://raw.githubusercontent.com/Kometa-Team/Kometa/nightly/docs/assets/backgroundnightly.jpg";
- ellipsisText = "Kometa Nightly Wiki"; // Set text for Nightly
- } else if (currentURL.includes("en/develop")) {
- backgroundImage = "https://raw.githubusercontent.com/Kometa-Team/Kometa/nightly/docs/assets/backgrounddevelop.jpg";
- ellipsisText = "Kometa Develop Wiki"; // Set text for Develop
- }
+ // Create ellipsisSpan if it doesn't exist
+ if (!ellipsisSpan) {
+ ellipsisSpan = document.createElement("span");
+ ellipsisSpan.classList.add("md-ellipsis");
+ document.body.appendChild(ellipsisSpan);
+ }
- headerAndTabs.forEach(element => {
- element.style.backgroundImage = `url(${backgroundImage})`;
- });
+ ellipsisSpan.textContent = ellipsisText;
- // Update ellipsisSpan text only if it exists
- if (ellipsisSpan) {
- ellipsisSpan.textContent = ellipsisText;
- }
+ // Update banner color
+ if (mdBanner) {
+ mdBanner.style.backgroundColor = bannerColor;
}
}