mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2026-08-03 13:27:30 +03:00
Refactor theme music script loading logic
This commit is contained in:
+5
-4
@@ -1608,6 +1608,10 @@ if (window.__REAL_PLAYTIME_LOADED__) {
|
||||
|
||||
|
||||
THEMEMUSIC_CODE = r"""(function () {
|
||||
if (window.__THEMEMUSIC_LOADED__) {
|
||||
return;
|
||||
}
|
||||
window.__THEMEMUSIC_LOADED__ = true;
|
||||
const LOCAL_STORAGE_KEY = "ThemeMusicData";
|
||||
|
||||
const themeMusicEvents = new EventTarget();
|
||||
@@ -1681,12 +1685,9 @@ THEMEMUSIC_CODE = r"""(function () {
|
||||
sessionCache.set(query, entry);
|
||||
}
|
||||
|
||||
if (!window.__MY_THEMEMUSIC_SCRIPT_LOADED__) {
|
||||
Object.defineProperty(window, "__MY_THEMEMUSIC_SCRIPT_LOADED__", { value: true });
|
||||
const tag = document.createElement('script');
|
||||
const tag = document.createElement("script");
|
||||
tag.src = "https://www.youtube.com/iframe_api";
|
||||
document.head.appendChild(tag);
|
||||
}
|
||||
|
||||
function waitForYouTubeAPI() {
|
||||
if (window.YT && window.YT.Player) return Promise.resolve();
|
||||
|
||||
Reference in New Issue
Block a user