This commit is contained in:
MLH
2024-12-12 01:07:57 +01:00
parent d2e0b0e320
commit f69563194d

View File

@@ -50,45 +50,42 @@ modification_rules:
# Page title and requests tab # Page title and requests tab
- before_text: '<link href="main.jellyfin.1ed46a7a22b550acaef3.css?22b44eb501cfeefd535d" rel="stylesheet">' - before_text: '<link href="main.jellyfin.1ed46a7a22b550acaef3.css?22b44eb501cfeefd535d" rel="stylesheet">'
insert_text: |+ insert_text: |+
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// Check if the title is "Jellyfin" before changing it // Check if the title is "Jellyfin" before changing it
if (document.title === "Jellyfin") { if (document.title === "Jellyfin") {
document.title = "SpaceCloud - Cinema"; document.title = "SpaceCloud - Cinema";
} }
// Create a MutationObserver to prevent any changes to the title
// Create a MutationObserver to prevent any changes to the title const observer = new MutationObserver(function (mutations) {
const observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) {
mutations.forEach(function (mutation) { if (mutation.type === 'childList') {
if (mutation.type === 'childList') { // Only change the title if it's set to "Jellyfin"
// Only change the title if it's set to "Jellyfin" if (document.title === "Jellyfin") {
if (document.title === "Jellyfin") { document.title = "SpaceCloud - Cinema";
document.title = "SpaceCloud - Cinema"; }
} }
} });
}); });
}); // Observe the document title for changes
observer.observe(document.querySelector('title'), { childList: true });
// Observe the document title for changes // Set up a fallback in case of attempts to change the title through direct assignment
observer.observe(document.querySelector('title'), { childList: true }); Object.defineProperty(document, 'title', {
set: function (value) {
// Set up a fallback in case of attempts to change the title through direct assignment // Only allow the title to change if the new value is "Jellyfin"
Object.defineProperty(document, 'title', { if (value === "Jellyfin") {
set: function (value) { document.querySelector('title').textContent = "SpaceCloud - Cinema";
// Only allow the title to change if the new value is "Jellyfin" } else {
if (value === "Jellyfin") { document.querySelector('title').textContent = value;
document.querySelector('title').textContent = "SpaceCloud - Cinema"; }
} else { },
document.querySelector('title').textContent = value; get: function () {
} return document.querySelector('title').textContent;
}, }
get: function () { });
return document.querySelector('title').textContent; });
} </script>
}); <script>const createRequestTab = () => {const title = document.createElement("div");title.classList.add("emby-button-foreground");title.innerText = "Anfragen";const button = document.createElement("button");button.type = "button";button.is = "empty-button";button.classList.add("emby-tab-button", "emby-button", "lastFocused");button.setAttribute("data-index", "2");button.setAttribute("id", "requestTab");button.appendChild(title);(function e() {const tabb = document.querySelector(".emby-tabs-slider");tabb ? !document.querySelector("#requestTab") && tabb.appendChild(button) : setTimeout(e, 500)})();}</script>
});
</script>
<script>const createRequestTab = () => {const title = document.createElement("div");title.classList.add("emby-button-foreground");title.innerText = "Anfragen";const button = document.createElement("button");button.type = "button";button.is = "empty-button";button.classList.add("emby-tab-button", "emby-button", "lastFocused");button.setAttribute("data-index", "2");button.setAttribute("id", "requestTab");button.appendChild(title);(function e() {const tabb = document.querySelector(".emby-tabs-slider");tabb ? !document.querySelector("#requestTab") && tabb.appendChild(button) : setTimeout(e, 500)})();}</script>
replace_rules: replace_rules:
# Page title # Page title