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