mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
fix: apply fix from eslint
This commit is contained in:
@ -7,7 +7,6 @@ import { createStatus } from '../ui/status';
|
||||
|
||||
import IconOff from '../icons/off.svg?raw';
|
||||
|
||||
|
||||
export type GuestPopupProps = {
|
||||
onItemClick: (id: string) => void;
|
||||
};
|
||||
@ -33,7 +32,7 @@ export const createGuestPopup = (props: GuestPopupProps) => {
|
||||
},
|
||||
],
|
||||
anchorAt: 'bottom-right',
|
||||
popupAt: 'top-right'
|
||||
popupAt: 'top-right',
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@ -22,7 +22,7 @@ export const createHostPopup = (props: HostPopupProps) => {
|
||||
element: status.element,
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
id: 'music-together-copy-id',
|
||||
@ -35,7 +35,9 @@ export const createHostPopup = (props: HostPopupProps) => {
|
||||
id: 'music-together-permission',
|
||||
type: 'item',
|
||||
icon: ElementFromHtml(IconTune),
|
||||
text: t('plugins.music-together.menu.set-permission', { permission: t('plugins.music-together.menu.permission.host-only') }),
|
||||
text: t('plugins.music-together.menu.set-permission', {
|
||||
permission: t('plugins.music-together.menu.permission.host-only'),
|
||||
}),
|
||||
onClick: () => props.onItemClick('music-together-permission'),
|
||||
},
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ export const createSettingPopup = (props: SettingPopupProps) => {
|
||||
},
|
||||
],
|
||||
anchorAt: 'bottom-right',
|
||||
popupAt: 'top-right'
|
||||
popupAt: 'top-right',
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@ -7,17 +7,27 @@ import type { Permission, Profile } from '../types';
|
||||
|
||||
export const createStatus = () => {
|
||||
const element = ElementFromHtml(statusHTML);
|
||||
const icon = document.querySelector<HTMLImageElement>('ytmusic-settings-button > tp-yt-paper-icon-button > tp-yt-iron-icon#icon img');
|
||||
const icon = document.querySelector<HTMLImageElement>(
|
||||
'ytmusic-settings-button > tp-yt-paper-icon-button > tp-yt-iron-icon#icon img',
|
||||
);
|
||||
|
||||
const profile = element.querySelector<HTMLImageElement>('.music-together-profile')!;
|
||||
const statusLabel = element.querySelector<HTMLSpanElement>('#music-together-status-label')!;
|
||||
const permissionLabel = element.querySelector<HTMLMarqueeElement>('#music-together-permission-label')!;
|
||||
const profile = element.querySelector<HTMLImageElement>(
|
||||
'.music-together-profile',
|
||||
)!;
|
||||
const statusLabel = element.querySelector<HTMLSpanElement>(
|
||||
'#music-together-status-label',
|
||||
)!;
|
||||
const permissionLabel = element.querySelector<HTMLMarqueeElement>(
|
||||
'#music-together-permission-label',
|
||||
)!;
|
||||
|
||||
profile.src = icon?.src ?? '';
|
||||
|
||||
const setStatus = (status: 'disconnected' | 'host' | 'guest') => {
|
||||
if (status === 'disconnected') {
|
||||
statusLabel.textContent = t('plugins.music-together.menu.status.disconnected');
|
||||
statusLabel.textContent = t(
|
||||
'plugins.music-together.menu.status.disconnected',
|
||||
);
|
||||
statusLabel.style.color = 'rgba(255, 255, 255, 0.5)';
|
||||
}
|
||||
|
||||
@ -34,17 +44,23 @@ export const createStatus = () => {
|
||||
|
||||
const setPermission = (permission: Permission) => {
|
||||
if (permission === 'host-only') {
|
||||
permissionLabel.textContent = t('plugins.music-together.menu.permission.host-only');
|
||||
permissionLabel.textContent = t(
|
||||
'plugins.music-together.menu.permission.host-only',
|
||||
);
|
||||
permissionLabel.style.color = 'rgba(255, 255, 255, 0.5)';
|
||||
}
|
||||
|
||||
if (permission === 'playlist') {
|
||||
permissionLabel.textContent = t('plugins.music-together.menu.permission.playlist');
|
||||
permissionLabel.textContent = t(
|
||||
'plugins.music-together.menu.permission.playlist',
|
||||
);
|
||||
permissionLabel.style.color = 'rgba(255, 255, 255, 0.75)';
|
||||
}
|
||||
|
||||
if (permission === 'all') {
|
||||
permissionLabel.textContent = t('plugins.music-together.menu.permission.all');
|
||||
permissionLabel.textContent = t(
|
||||
'plugins.music-together.menu.permission.all',
|
||||
);
|
||||
permissionLabel.style.color = 'rgba(255, 255, 255, 1)';
|
||||
}
|
||||
};
|
||||
@ -54,7 +70,9 @@ export const createStatus = () => {
|
||||
};
|
||||
|
||||
const setUsers = (users: Profile[]) => {
|
||||
const container = element.querySelector<HTMLDivElement>('.music-together-user-container')!;
|
||||
const container = element.querySelector<HTMLDivElement>(
|
||||
'.music-together-user-container',
|
||||
)!;
|
||||
const empty = element.querySelector<HTMLElement>('.music-together-empty')!;
|
||||
for (const child of Array.from(container.children)) {
|
||||
if (child !== empty) child.remove();
|
||||
|
||||
Reference in New Issue
Block a user