mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
fix: inject multiple stylesheet
This commit is contained in:
@ -56,13 +56,16 @@ export const forceLoadRendererPlugin = (id: string) => {
|
||||
if (hasEvaled || plugin?.stylesheets) {
|
||||
loadedPluginMap[id] = plugin;
|
||||
|
||||
if (plugin?.stylesheets)
|
||||
document.head.appendChild(
|
||||
Object.assign(document.createElement('style'), {
|
||||
id: `plugin-${id}`,
|
||||
innerHTML: plugin?.stylesheets ?? '',
|
||||
}),
|
||||
);
|
||||
if (plugin?.stylesheets) {
|
||||
const styleSheetList = plugin.stylesheets.map((style) => {
|
||||
const styleSheet = new CSSStyleSheet();
|
||||
styleSheet.replaceSync(style);
|
||||
|
||||
return styleSheet;
|
||||
});
|
||||
|
||||
document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styleSheetList];
|
||||
}
|
||||
|
||||
if (!hasEvaled) console.log('[YTMusic]', `"${id}" plugin is loaded`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user