Skip to content

Commit

Permalink
style: automatic eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ferferga authored Nov 25, 2024
1 parent cb1439f commit fdc6c41
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 51 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Item/Identify/IdentifyDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<VCheckbox
v-if="searchResults"
v-model="replaceImage"
class="d-flex mt-2"
class="mt-2 d-flex"
color="primary">
<template #append>
{{ $t('replaceExistingImages') }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Layout/AppBar/SearchField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const searchQuery = computed({
* Handle page redirects depending on the focus state of the component
*/
async function onFocus(focused: boolean): Promise<void> {
if (!searchQuery.value && !focused && window.history.length) {
if (!searchQuery.value && !focused && globalThis.history.length) {
router.back();
} else if (focused && !searchQuery.value) {
await router.push({ path: '/search' });
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Playback/PlayerElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function detachWebAudio(): Promise<void> {
mediaWebAudio.gainNode.gain.setValueAtTime(mediaWebAudio.gainNode.gain.value, mediaWebAudio.context.currentTime);
mediaWebAudio.gainNode.gain.exponentialRampToValueAtTime(0.0001, mediaWebAudio.context.currentTime + 1.5);
await nextTick();
await new Promise(resolve => window.setTimeout(resolve));
await new Promise(resolve => globalThis.setTimeout(resolve));
mediaWebAudio.gainNode.disconnect();
mediaWebAudio.gainNode = undefined;
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Selectors/FontSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const { t } = useI18n();
const { query: permissionQuery, isSupported, state: fontPermission } = usePermission('local-fonts', { controls: true });
const fontAccess = computed(() => fontPermission.value === 'granted');
const isQueryLocalFontsSupported = useSupported(() => isSupported.value && 'queryLocalFonts' in window);
const isQueryLocalFontsSupported = useSupported(() => isSupported.value && 'queryLocalFonts' in globalThis);
const askForPermission = async () => isQueryLocalFontsSupported.value
? Promise.all([permissionQuery, window.queryLocalFonts])
? Promise.all([permissionQuery, globalThis.queryLocalFonts])
: undefined;
/**
Expand All @@ -76,7 +76,7 @@ const fontList = computedAsync(async () => {
const res: string[] = [];
if (fontAccess.value || isQueryLocalFontsSupported.value) {
const set = new Set<string>((await window.queryLocalFonts()).map((font: FontFace) => font.family));
const set = new Set<string>((await globalThis.queryLocalFonts()).map((font: FontFace) => font.family));
/**
* Removes the current selected tpography (in case it's not the default one)
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/lib/JVirtual/JVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const scrollTargets = computed(() => {
return (
vertical === horizontal ? [vertical] : [vertical, horizontal]
).map(parent =>
(parent === document.documentElement ? window : parent)
(parent === document.documentElement ? globalThis : parent)
);
}
});
Expand Down Expand Up @@ -264,7 +264,7 @@ async function setCache(offset: number): Promise<void> {
* If the WebWorker operation was running in the middle of a cache clear,
* old data might be pushed instead, so we avoid it here.
*/
window.requestAnimationFrame(() => {
globalThis.requestAnimationFrame(() => {
if (cache.size !== 0) {
cache.set(offset, values);
workerUpdates.value++;
Expand Down Expand Up @@ -316,7 +316,7 @@ watch(
if (!isUndef(scrollTargets.value)) {
for (const parent of scrollTargets.value) {
const cleanup = useEventListener(parent, 'scroll', () => {
window.requestAnimationFrame(() => scrollEvents.value++);
globalThis.requestAnimationFrame(() => scrollEvents.value++);
}, {
passive: true,
capture: true
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/lib/JVirtual/j-virtual.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JVirtualWorker {
? collectionLength - bufferedLength
: bufferedOffset;
last
= collectionLength < offsetPlusLength ? collectionLength : offsetPlusLength;
= Math.min(collectionLength, offsetPlusLength);
}

const res = [];
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/lib/JVirtual/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function getScrollParents(
element: HTMLElement,
includeHidden = false
): ScrollParents {
const style = window.getComputedStyle(element);
const style = globalThis.getComputedStyle(element);

if (style.position === 'fixed') {
return {
Expand All @@ -76,7 +76,7 @@ export function getScrollParents(
let parent: HTMLElement | null = element;

while (parent && !vertical && !horizontal) {
const parentStyle = window.getComputedStyle(parent);
const parentStyle = globalThis.getComputedStyle(parent);

horizontal
= overflowRegex.test(parentStyle.overflowX)
Expand Down Expand Up @@ -106,7 +106,7 @@ export function getScrollParents(
* Gets the gap and spacing between grid elements, alongside the flow of the grid
*/
export function getGridMeasurement(rootEl: Element): GridMeasurement {
const computedStyle = window.getComputedStyle(rootEl);
const computedStyle = globalThis.getComputedStyle(rootEl);

return {
rowGap: Number(computedStyle.getPropertyValue('row-gap')) || 0,
Expand Down Expand Up @@ -288,7 +288,7 @@ export function getContentSize(
* Gets the necessary information to scroll the grid to a specific item
*/
export function getScrollToInfo(scrollParents: ScrollParents, rootEl: HTMLElement, resizeMeasurement: ResizeMeasurement, scrollTo: number) {
const computedStyle = window.getComputedStyle(rootEl);
const computedStyle = globalThis.getComputedStyle(rootEl);

const gridPaddingTop = Number(computedStyle.getPropertyValue('padding-top')) || 0;
const gridBoarderTop = Number(computedStyle.getPropertyValue('border-top')) || 0;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/wizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sm="12"
md="12"
xl="8">
<h1 class="mb-6 text-h4 text-center">
<h1 class="text-center mb-6 text-h4">
{{ heading }}
</h1>
<!-- TODO: Wait for Vuetify 3 implementation (https://github.com/vuetifyjs/vuetify/issues/13509) -->
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/plugins/remote/sdk/sdk-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import { version } from '@/../package.json';
*/
function ensureDeviceId(): string {
const storageKey = 'deviceId';
const val = window.localStorage.getItem(storageKey);
const val = globalThis.localStorage.getItem(storageKey);

if (!val) {
const id = v4();

window.localStorage.setItem(storageKey, id);
globalThis.localStorage.setItem(storageKey, id);

return id;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/splashscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '@/assets/styles/splashscreen.css';

const store = localStorage.getItem('clientSettings') ?? '{}';
const parsedStore = destr<ClientSettingsState>(store);
const matchedDarkColorScheme = window.matchMedia(
const matchedDarkColorScheme = globalThis.matchMedia(
'(prefers-color-scheme: dark)'
).matches;
const darkColor = '#111827';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class ApiStore {
watch(
() => remote.auth.currentUser,
() => {
window.requestAnimationFrame(() => {
window.setTimeout(() => {
globalThis.requestAnimationFrame(() => {
globalThis.setTimeout(() => {
if (!remote.auth.currentUser) {
this._clear();
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/client-settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ClientSettingsStore extends SyncedStore<ClientSettingsState> {
* Vuetify theme change
*/
watchImmediate(this.currentTheme, () => {
window.requestAnimationFrame(() => {
globalThis.requestAnimationFrame(() => {
vuetify.theme.global.name.value
= this.currentTheme.value;
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const now = useNow();
/**
* Reactive window scroll
*/
export const windowScroll = useScroll(window);
export const windowScroll = useScroll(globalThis);
/**
* Ref to the local media player
*/
Expand Down
27 changes: 12 additions & 15 deletions frontend/src/store/playback-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
}

public set currentVolume(newVolume: number) {
newVolume = newVolume > 100 ? 100 : newVolume;
newVolume = newVolume < 0 ? 0 : newVolume;
newVolume = Math.min(newVolume, 100);
this.isMuted = newVolume === 0;

if (this._state.isRemotePlayer) {
Expand Down Expand Up @@ -1065,10 +1064,10 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
* == MediaSession API: https://developer.mozilla.org/en-US/docs/Web/API/MediaSession ==
*/
watchEffect(() => {
if (window.navigator.mediaSession) {
if (globalThis.navigator.mediaSession) {
const { t } = i18n;

window.navigator.mediaSession.metadata = this.currentItem
globalThis.navigator.mediaSession.metadata = this.currentItem
? new MediaMetadata({
title: this.currentItem.Name ?? t('unknownTitle'),
artist: this.currentItem.AlbumArtist ?? t('unknownArtist'),
Expand All @@ -1086,19 +1085,19 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
}
});
watchEffect(() => {
if (window.navigator.mediaSession) {
if (globalThis.navigator.mediaSession) {
switch (this.status) {
case PlaybackStatus.Playing: {
window.navigator.mediaSession.playbackState = 'playing';
globalThis.navigator.mediaSession.playbackState = 'playing';
break;
}
case PlaybackStatus.Paused:
case PlaybackStatus.Buffering: {
window.navigator.mediaSession.playbackState = 'paused';
globalThis.navigator.mediaSession.playbackState = 'paused';
break;
}
default: {
window.navigator.mediaSession.playbackState = 'none';
globalThis.navigator.mediaSession.playbackState = 'none';
}
}
}
Expand All @@ -1113,10 +1112,8 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
= oldValue === PlaybackStatus.Error
|| oldValue === PlaybackStatus.Stopped;

if (window.navigator.mediaSession && (remove || add)) {
const actionHandlers: {
[key in MediaSessionAction]?: MediaSessionActionHandler;
} = {
if (globalThis.navigator.mediaSession && (remove || add)) {
const actionHandlers: Partial<Record<MediaSessionAction, MediaSessionActionHandler>> = {
play: this.unpause,
pause: this.pause,
previoustrack: () => { this.setPreviousItem(); },
Expand All @@ -1131,7 +1128,7 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {

for (const action in actionHandlers) {
try {
window.navigator.mediaSession.setActionHandler(
globalThis.navigator.mediaSession.setActionHandler(
action as MediaSessionAction,
/* eslint-disable-next-line unicorn/no-null */
add ? actionHandlers[action as keyof typeof actionHandlers] ?? null : null
Expand All @@ -1153,12 +1150,12 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
|| this.status === PlaybackStatus.Stopped;

if (
window.navigator.mediaSession
globalThis.navigator.mediaSession
&& this.currentTime <= this.currentItemRuntime
) {
const duration = this.currentItemRuntime / 1000;

window.navigator.mediaSession.setPositionState(
globalThis.navigator.mediaSession.setPositionState(
remove
? undefined
: {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/super/common-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export abstract class CommonStore<T extends object> {
let storage;

if (persistence === 'localStorage') {
storage = window.localStorage;
storage = globalThis.localStorage;
} else if (persistence === 'sessionStorage') {
storage = window.sessionStorage;
storage = globalThis.sessionStorage;
}

this._internalState = isNil(storage)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/task-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TaskManagerStore extends CommonStore<TaskManagerState> {
if (task) {
if (this._state.finishedTasksTimeout > 0) {
task.progress = 100;
window.setTimeout(clearTask, this._state.finishedTasksTimeout);
globalThis.setTimeout(clearTask, this._state.finishedTasksTimeout);
} else {
clearTask();
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/browser-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function supportsMediaSource(): boolean {
* Browsers that lack a media source implementation will have no reference
* to |window.MediaSource|.
*/
return !!window.MediaSource;
return !!globalThis.MediaSource;
}

/**
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/utils/playback-profiles/helpers/codec-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ function getGlobalMaxVideoBitrate(): number | undefined {

if (
isTizen()
&& 'webapis' in window
&& isObj(window.webapis)
&& window.webapis
&& 'productinfo' in window.webapis
&& isObj(window.webapis.productinfo)
&& window.webapis.productinfo
&& 'isUdPanelSupported' in window.webapis.productinfo
&& isFunc(window.webapis.productinfo.isUdPanelSupported)
&& 'webapis' in globalThis
&& isObj(globalThis.webapis)
&& globalThis.webapis
&& 'productinfo' in globalThis.webapis
&& isObj(globalThis.webapis.productinfo)
&& globalThis.webapis.productinfo
&& 'isUdPanelSupported' in globalThis.webapis.productinfo
&& isFunc(globalThis.webapis.productinfo.isUdPanelSupported)
) {
isTizenFhd = !window.webapis.productinfo.isUdPanelSupported();
isTizenFhd = !globalThis.webapis.productinfo.isUdPanelSupported();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function hasHevcSupport(videoTestElement: HTMLVideoElement): boolean {
export function hasAv1Support(videoTestElement: HTMLVideoElement): boolean {
if (
(isTizen() && isTizen55())
|| (isWebOS5() && window.outerHeight >= 2160)
|| (isWebOS5() && globalThis.outerHeight >= 2160)
) {
return true;
}
Expand Down

0 comments on commit fdc6c41

Please sign in to comment.