From 1f5c657afc12b4ac171dc52acfb74112bdb6ade9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 23 Nov 2023 20:46:37 -0800 Subject: feat(wrapped): options tab --- src/lib/Tools/Wrapped.svelte | 81 +++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 32 deletions(-) (limited to 'src/lib/Tools') diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte index 3602c0e9..070643e8 100644 --- a/src/lib/Tools/Wrapped.svelte +++ b/src/lib/Tools/Wrapped.svelte @@ -42,30 +42,37 @@ const updateWidth = () => { const wrappedContainer = document.querySelector('#wrapped') as HTMLElement; - let maxWidth = 0; - if (!wrappedContainer) return; + wrappedContainer.style.width = `100%`; - wrappedContainer.querySelectorAll('.category').forEach((item) => { - let category = item as HTMLElement; + const reset = () => { + let maxWidth = 0; - if (category.offsetWidth > maxWidth) { - maxWidth = category.offsetWidth; - } - }); + if (!wrappedContainer) return; + + wrappedContainer.querySelectorAll('.category').forEach((item) => { + let category = item as HTMLElement; + + if (category.offsetWidth > maxWidth) { + maxWidth = category.offsetWidth; + } + }); - wrappedContainer.style.width = `calc(${maxWidth * 2}px + 1%)`; - width = wrappedContainer.offsetWidth; + wrappedContainer.style.width = `calc(${maxWidth * 2}px + 1%)`; + width = wrappedContainer.offsetWidth; + }; + + for (let i = 0; i < 5; i++) reset(); }; onMount(async () => { - new MutationObserver((_mutations) => { - updateWidth(); - updateWidth(); - }).observe(document.querySelector('#wrapped')!, { - childList: true, - subtree: true - }); + new MutationObserver((_mutations) => updateWidth()).observe( + document.querySelector('#wrapped')!, + { + childList: true, + subtree: true + } + ); if (user !== undefined) { if ($userIdentity === '') { @@ -370,23 +377,33 @@

- Don't be alarmed! The background will appear as its inverse in the preview, but will be - corrected in the final image. Media covers may not appear on mobile Apple devices. + + Don't be alarmed! The background will appear as its inverse in the preview, but will be + corrected in the final image. Media covers may not appear on mobile Apple devices. +

-
- Enable watermark
- Enable background transparency
- Include music
- Include rewatches & rereads
- Include specials and OVAs
- Manual Width Override ({width} px): -
- Fit long titles
- {#if abbreviateTitles} - Maximum title length
- {/if} -
+
+ Options +
+ Enable watermark
+ Enable background transparency
+ Include music
+ Include rewatches & rereads
+ Include specials and OVAs
+
+ Manual width override + + Reset +
+
+ Fit long titles
+ {#if abbreviateTitles} + Maximum title length
+ {/if} +
+

-- cgit v1.2.3