mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
@ -107,7 +107,8 @@ export const onRendererLoad = ({
|
||||
|
||||
ipc.on('downloader-feedback', (feedback: string) => {
|
||||
if (progress) {
|
||||
progress.innerHTML = feedback || t('plugins.downloader.templates.button');
|
||||
const targetHtml = feedback || t('plugins.downloader.templates.button');
|
||||
progress.innerHTML = window.trustedTypes?.defaultPolicy ? window.trustedTypes.defaultPolicy.createHTML(targetHtml) : targetHtml;
|
||||
} else {
|
||||
console.warn(
|
||||
LoggerPrefix,
|
||||
|
||||
@ -10,7 +10,7 @@ export const onRendererLoad = ({
|
||||
ipc: { invoke, on },
|
||||
}: RendererContext<LyricsGeniusPluginConfig>) => {
|
||||
const setLyrics = (lyricsContainer: Element, lyrics: string | null) => {
|
||||
lyricsContainer.innerHTML = `
|
||||
const targetHtml = `
|
||||
<div id="contents" class="style-scope ytmusic-section-list-renderer description ytmusic-description-shelf-renderer genius-lyrics">
|
||||
${
|
||||
lyrics?.replaceAll(/\r\n|\r|\n/g, '<br/>') ??
|
||||
@ -20,6 +20,7 @@ export const onRendererLoad = ({
|
||||
<yt-formatted-string class="footer style-scope ytmusic-description-shelf-renderer" style="align-self: baseline">
|
||||
</yt-formatted-string>
|
||||
`;
|
||||
lyricsContainer.innerHTML = window.trustedTypes?.defaultPolicy ? window.trustedTypes.defaultPolicy.createHTML(targetHtml) : targetHtml;
|
||||
|
||||
if (lyrics) {
|
||||
const footer = lyricsContainer.querySelector('.footer');
|
||||
|
||||
@ -22,7 +22,8 @@ const updatePlayBackSpeed = () => {
|
||||
|
||||
const playbackSpeedElement = document.querySelector('#playback-speed-value');
|
||||
if (playbackSpeedElement) {
|
||||
playbackSpeedElement.innerHTML = String(playbackSpeed);
|
||||
const targetHtml = String(playbackSpeed);
|
||||
playbackSpeedElement.innerHTML = window.trustedTypes?.defaultPolicy ? trustedTypes.defaultPolicy.createHTML(targetHtml) : targetHtml;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
export const ElementFromHtml = (html: string): HTMLElement => {
|
||||
const template = document.createElement('template');
|
||||
html = html.trim(); // Never return a text node of whitespace as the result
|
||||
template.innerHTML = html;
|
||||
template.innerHTML = window.trustedTypes?.defaultPolicy ? window.trustedTypes.defaultPolicy.createHTML(html) : html;
|
||||
|
||||
return template.content.firstElementChild as HTMLElement;
|
||||
};
|
||||
|
||||
@ -269,7 +269,8 @@ const defineYTMDTransElements = () => {
|
||||
const that = this as HTMLElement;
|
||||
const key = that.getAttribute('key');
|
||||
if (key) {
|
||||
that.innerHTML = i18t(key);
|
||||
const targetHtml = i18t(key);
|
||||
that.innerHTML = window.trustedTypes?.defaultPolicy ? window.trustedTypes.defaultPolicy.createHTML(targetHtml) : targetHtml;
|
||||
}
|
||||
};
|
||||
customElements.define(
|
||||
|
||||
Reference in New Issue
Block a user