diff options
| author | Fuwn <[email protected]> | 2023-12-02 19:43:45 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-02 19:43:45 -0800 |
| commit | 9126e10dcc365eba50e9b45efb0e8a98d74a1027 (patch) | |
| tree | 7647eaf8e80e01d091fbdcead1ffc84a1db36a6b /src/lib | |
| parent | fix(wrapped): resize fix (diff) | |
| download | due.moe-9126e10dcc365eba50e9b45efb0e8a98d74a1027.tar.xz due.moe-9126e10dcc365eba50e9b45efb0e8a98d74a1027.zip | |
fix(wrapped): make wrapped independent
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Tools/Wrapped.svelte | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte index d5e12326..d0fbab5b 100644 --- a/src/lib/Tools/Wrapped.svelte +++ b/src/lib/Tools/Wrapped.svelte @@ -78,14 +78,6 @@ }; onMount(async () => { - new MutationObserver((_mutations) => updateWidth()).observe( - document.querySelector('#wrapped')!, - { - childList: true, - subtree: true - } - ); - if (user !== undefined) { if ($userIdentity === '') { userIdentity.set(JSON.stringify(await getUserIdentity(user))); @@ -171,6 +163,14 @@ for (const media of mangaList) { chapters += media.mediaListEntry?.progress || 0; } + + new MutationObserver((_mutations) => updateWidth()).observe( + document.querySelector('#wrapped')!, + { + childList: true, + subtree: true + } + ); }; /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -259,13 +259,13 @@ const proxy = (url: string) => `/api/proxy?url=${encodeURIComponent(url)}`; </script> -<div id="wrapped" style={`width: ${width}px`}> - {#if currentUserIdentity.id === -2} - Please log in to view this page. - {:else if currentUserIdentity.id !== -1} - {#await wrapped(user, currentUserIdentity)} - Loading ... - {:then wrapped} +{#if currentUserIdentity.id === -2} + Please log in to view this page. +{:else if currentUserIdentity.id !== -1} + {#await wrapped(user, currentUserIdentity)} + Loading ... + {:then wrapped} + <div id="wrapped" style={`width: ${width}px`}> <div class:light-theme={lightTheme} class="categories-grid" @@ -386,53 +386,52 @@ <div class="category-grid pure-category" id="watermark">due.moe/wrapped</div> {/if} </div> + </div> + + <p /> + + <blockquote> + This is a minimal, live preview. Generated images will be higher quality and themed properly. + </blockquote> + + <p> + <button on:click={() => (width -= 25)}>-25px</button> + <button on:click={updateWidth}>Auto-calculate width</button> + <button on:click={() => (width += 25)}>+25px</button> + </p> + + <p> + <a href={'#'} on:click={() => screenshot(!forceDark)}>Generate image</a> + </p> + + <details> + <summary>Options</summary> + <div id="options"> + <input type="checkbox" bind:checked={watermark} /> Enable watermark<br /> + <input type="checkbox" bind:checked={transparency} /> Enable background transparency<br /> + <input type="checkbox" bind:checked={forceDark} /> + Enable light mode (dark by default)<br /> + <input type="checkbox" bind:checked={includeMusic} /> Include music<br /> + <input type="checkbox" bind:checked={includeRepeats} /> Include rewatches & rereads<br /> + <input type="checkbox" bind:checked={includeSpecials} /> Include specials and OVAs<br /> + <select bind:value={highestRatedCount}> + {#each [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as count} + <option value={count}>{count}</option> + {/each} + </select> + Highest rated media count + </div> + </details> - <br /> - - <blockquote> - This is a minimal, live preview. Generated images will be higher quality and themed - properly. - </blockquote> - - <p> - <button on:click={() => (width -= 25)}>-25px</button> - <button on:click={updateWidth}>Auto-calculate width</button> - <button on:click={() => (width += 25)}>+25px</button> - </p> - - <p> - <a href={'#'} on:click={() => screenshot(!forceDark)}>Generate image</a> - </p> - - <details> - <summary>Options</summary> - <div id="options"> - <input type="checkbox" bind:checked={watermark} /> Enable watermark<br /> - <input type="checkbox" bind:checked={transparency} /> Enable background transparency<br /> - <input type="checkbox" bind:checked={forceDark} /> - Enable light mode (dark by default)<br /> - <input type="checkbox" bind:checked={includeMusic} /> Include music<br /> - <input type="checkbox" bind:checked={includeRepeats} /> Include rewatches & rereads<br /> - <input type="checkbox" bind:checked={includeSpecials} /> Include specials and OVAs<br /> - <select bind:value={highestRatedCount}> - {#each [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as count} - <option value={count}>{count}</option> - {/each} - </select> - Highest rated media count - </div> - </details> - - <br /> + <p /> - <div id="wrapped-final" /> - {:catch} - <Error /> - {/await} - {:else} - Loading ... - {/if} -</div> + <div id="wrapped-final" /> + {:catch} + <Error /> + {/await} +{:else} + Loading ... +{/if} <style> @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700'); |