fix line break issue

This commit is contained in:
MLH
2024-12-16 01:12:27 +01:00
parent d5bfadce14
commit 548c48d6aa
2 changed files with 9 additions and 6 deletions

View File

@ -15,8 +15,6 @@ copy_rules:
target: './bc8d51405ec040305a87.ico' target: './bc8d51405ec040305a87.ico'
- source: './img/favicon.ico' - source: './img/favicon.ico'
target: './favicon.ico' target: './favicon.ico'
- source: './img/favicon.png'
target: './assets/img/favicon.png'
mode: 'replace' # Überschreibt vorhandene Dateien/Ordner mode: 'replace' # Überschreibt vorhandene Dateien/Ordner
@ -25,11 +23,14 @@ copy_rules:
- sources: - sources:
- './seasonals' - './seasonals'
- './ui' - './ui'
- './pictures'
- source: './img/background.png' - source: './img/background.png'
target: './assets/img/background.png' target: './assets/img/background.png'
- source: './img/logo.png' - source: './img/logo.png'
target: './assets/img/logo.png' target: './assets/img/logo.png'
- source: './img/favicon.png'
target: './assets/img/favicon.png'
mode: 'copy' # Kopiert Dateien/Ordner mode: 'copy' # Kopiert Dateien/Ordner
# Modifikationsregeln # Modifikationsregeln
@ -52,7 +53,7 @@ modification_rules:
insert_text: > 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>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> <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
- old_text: '<title>Jellyfin</title>' - old_text: '<title>Jellyfin</title>'
@ -78,7 +79,7 @@ modification_rules:
- after_text: 'data-backdroptype="movie,series,book">' - after_text: 'data-backdroptype="movie,series,book">'
insert_text: > insert_text: >
<style> .featurediframe {width: 95vw; height: 24em; display: block; border: 0; margin: -1em auto 0;} @media (min-width: 2100px) {.featurediframe {height: 33em;}} @media (max-width: 1599px) {.featurediframe {margin-top: 1.2em;}} @media (max-width: 800px) {.featurediframe {margin-top: 0.8em; height: 25em;}} </style> <iframe class="featurediframe" src="/web/ui/spotlight.html"></iframe> <style> .featurediframe {width: 95vw; height: 24em; display: block; border: 0; margin: -1em auto 0;} @media (min-width: 2100px) {.featurediframe {height: 33em;}} @media (max-width: 1599px) {.featurediframe {margin-top: 1.2em;}} @media (max-width: 800px) {.featurediframe {margin-top: 0.8em; height: 25em;}} </style> <iframe class="featurediframe" src="/web/ui/spotlight.html"></iframe>
<style>:root { --save-gut: max(env(safe-area-inset-left), .3%) } .requestIframe { margin: 0 .4em; padding: 0 var(--save-gut); width: calc(100% - (.4em * 2) - (var(--save-gut) * 2)); height: 90vh; border: none; position: absolute; top: 5.3em } @media (max-width: 1599px) { .requestIframe { height: 83vh; top: 8.2em; } }</style><script>setTimeout(() => { createRequestTab() }, 500)</script> <style>:root { --save-gut: max(env(safe-area-inset-left), .3%) } .requestIframe { margin: 0 .4em; padding: 0 var(--save-gut); width: calc(100% - (.4em * 2) - (var(--save-gut) * 2)); height: 90vh; border: none; position: absolute; top: 5.3em } @media (max-width: 1599px) { .requestIframe { height: 83vh; top: 8.2em; } }</style><script>setTimeout(() => { createRequestTab() }, 500)</script>
# request tab on main page # request tab on main page
- after_text: 'id="favoritesTab" data-index="1"> <div class="sections"></div> </div>' - after_text: 'id="favoritesTab" data-index="1"> <div class="sections"></div> </div>'

View File

@ -174,7 +174,8 @@ def modifyFiles(config, destinationDirectory):
raise ValueError(f"Text '{after_text}' not found in file: {filePath}") raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
elif insert_text not in content: elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text after: {after_text} {Colors.YELLOW}+ ->{Colors.GREEN} {insert_text}{Colors.RESET}") print(f" {Colors.GREEN}Inserting text after: {after_text} {Colors.YELLOW}+ ->{Colors.GREEN} {insert_text}{Colors.RESET}")
content = content.replace(after_text, after_text + insert_text) # content = content.replace(after_text, after_text + insert_text)
content = content.replace(after_text, after_text + insert_text.replace('\n', ''))
else: else:
print(f" {Colors.YELLOW}Text already present after: {after_text}{Colors.RESET}") print(f" {Colors.YELLOW}Text already present after: {after_text}{Colors.RESET}")
errorList['modWarnings'] += 1 errorList['modWarnings'] += 1
@ -187,7 +188,8 @@ def modifyFiles(config, destinationDirectory):
raise ValueError(f"Text '{before_text}' not found in file: {filePath}") raise ValueError(f"Text '{before_text}' not found in file: {filePath}")
elif insert_text not in content: elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text before: {insert_text} {Colors.YELLOW}+ <-{Colors.GREEN} {before_text}{Colors.RESET}") print(f" {Colors.GREEN}Inserting text before: {insert_text} {Colors.YELLOW}+ <-{Colors.GREEN} {before_text}{Colors.RESET}")
content = content.replace(before_text, insert_text + before_text) # content = content.replace(before_text, insert_text + before_text)
content = content.replace(before_text, insert_text.replace('\n', '') + before_text)
else: else:
print(f" {Colors.YELLOW}Text already present before: {before_text}{Colors.RESET}") print(f" {Colors.YELLOW}Text already present before: {before_text}{Colors.RESET}")
errorList['modWarnings'] += 1 errorList['modWarnings'] += 1