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:
+7
-6
@@ -1608,6 +1608,10 @@ if (window.__REAL_PLAYTIME_LOADED__) {
|
|||||||
|
|
||||||
|
|
||||||
THEMEMUSIC_CODE = r"""(function () {
|
THEMEMUSIC_CODE = r"""(function () {
|
||||||
|
if (window.__THEMEMUSIC_LOADED__) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.__THEMEMUSIC_LOADED__ = true;
|
||||||
const LOCAL_STORAGE_KEY = "ThemeMusicData";
|
const LOCAL_STORAGE_KEY = "ThemeMusicData";
|
||||||
|
|
||||||
const themeMusicEvents = new EventTarget();
|
const themeMusicEvents = new EventTarget();
|
||||||
@@ -1681,12 +1685,9 @@ THEMEMUSIC_CODE = r"""(function () {
|
|||||||
sessionCache.set(query, entry);
|
sessionCache.set(query, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window.__MY_THEMEMUSIC_SCRIPT_LOADED__) {
|
const tag = document.createElement("script");
|
||||||
Object.defineProperty(window, "__MY_THEMEMUSIC_SCRIPT_LOADED__", { value: true });
|
tag.src = "https://www.youtube.com/iframe_api";
|
||||||
const tag = document.createElement('script');
|
document.head.appendChild(tag);
|
||||||
tag.src = "https://www.youtube.com/iframe_api";
|
|
||||||
document.head.appendChild(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
function waitForYouTubeAPI() {
|
function waitForYouTubeAPI() {
|
||||||
if (window.YT && window.YT.Player) return Promise.resolve();
|
if (window.YT && window.YT.Player) return Promise.resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user