This commit is contained in:
MLH
2024-12-12 01:11:45 +01:00
parent f69563194d
commit 5e727785ff

View File

@@ -49,43 +49,9 @@ modification_rules:
# Page title and requests tab
- before_text: '<link href="main.jellyfin.1ed46a7a22b550acaef3.css?22b44eb501cfeefd535d" rel="stylesheet">'
insert_text: |+
<script>
document.addEventListener("DOMContentLoaded", function () {
// Check if the title is "Jellyfin" before changing it
if (document.title === "Jellyfin") {
document.title = "SpaceCloud - Cinema";
}
// Create a MutationObserver to prevent any changes to the title
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.type === 'childList') {
// Only change the title if it's set to "Jellyfin"
if (document.title === "Jellyfin") {
document.title = "SpaceCloud - Cinema";
}
}
});
});
// Observe the document title for changes
observer.observe(document.querySelector('title'), { childList: true });
// Set up a fallback in case of attempts to change the title through direct assignment
Object.defineProperty(document, 'title', {
set: function (value) {
// Only allow the title to change if the new value is "Jellyfin"
if (value === "Jellyfin") {
document.querySelector('title').textContent = "SpaceCloud - Cinema";
} else {
document.querySelector('title').textContent = value;
}
},
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>
insert_text: >
<script>document.addEventListener("DOMContentLoaded", function () { if (document.title === "Jellyfin") { document.title = "SpaceCloud - Cinema"; } const observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { if (mutation.type === 'childList') { if (document.title === "Jellyfin") { document.title = "SpaceCloud - Cinema"; } } }); }); observer.observe(document.querySelector('title'), { childList: true }); Object.defineProperty(document, 'title', { set: function (value) { if (value === "Jellyfin") { document.querySelector('title').textContent = "SpaceCloud - Cinema"; } else { document.querySelector('title').textContent = value; } }, 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>
replace_rules:
# Page title