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