diff --git a/materialious/src/lib/Thumbnail.svelte b/materialious/src/lib/Thumbnail.svelte index 69f2501f..d52c9f3f 100644 --- a/materialious/src/lib/Thumbnail.svelte +++ b/materialious/src/lib/Thumbnail.svelte @@ -42,6 +42,8 @@ let proxyVideos = get(playerProxyVideosStore); + let placeholderHeight: number = 0; + let watchUrl = new URL(`${location.origin}/watch/${video.videoId}`); if (playlistId !== '') { @@ -101,11 +103,14 @@ return; } + calcThumbnailPlaceholderHeight(); + // Check if sideways should be enabled or disabled. disableSideways(); addEventListener('resize', () => { disableSideways(); + calcThumbnailPlaceholderHeight(); }); // Load author details in background. @@ -244,6 +249,22 @@ imgHeight = document.getElementById('thumbnail-container')?.clientHeight as number; } + + function calcThumbnailPlaceholderHeight() { + if (!sideways) { + if (innerWidth < 1000) { + if (innerWidth < 600) { + placeholderHeight = innerWidth / 2; + } else { + placeholderHeight = innerWidth / 4; + } + } else { + placeholderHeight = innerWidth / 12; + } + } else { + placeholderHeight = 115; + } + } {#if !thumbnailHidden} @@ -262,13 +283,12 @@ on:click={syncChangeVideo} > {#if loading} - {#if !sideways} -
- {/if} + {:else if loaded} {#if showVideoPreview && videoPreview}