From f5b18598d66f540a99b20c4fea373bdfee662cb9 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Wed, 13 Sep 2023 14:11:59 -0700
Subject: feat(updates): hidden direct link

---
 src/routes/updates/+page.svelte | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

(limited to 'src/routes/updates/+page.svelte')

diff --git a/src/routes/updates/+page.svelte b/src/routes/updates/+page.svelte
index 55be994f..ead0ce13 100644
--- a/src/routes/updates/+page.svelte
+++ b/src/routes/updates/+page.svelte
@@ -1,13 +1,15 @@
 <script lang="ts">
+	import { browser } from '$app/environment';
 	import { onMount } from 'svelte';
 
-	type Feed = { items: { title: string; link: string }[] } | null | undefined;
+	type Feed = { items: { title: string; link: string; content: string }[] } | null | undefined;
 
 	let feed: Feed = undefined;
 	let novelFeed: Feed = undefined;
 	let startTime: number;
 	let mangaEndTime: number;
 	let novelEndTime: number;
+	let directLink = browser ? new URLSearchParams(window.location.search).has('d') : false;
 
 	onMount(async () => {
 		startTime = performance.now();
@@ -49,13 +51,19 @@
 				{:else if feed !== undefined}
 					{#each feed.items as item}
 						<li>
-							<a
-								href={`https://anilist.co/search/manga?search=${reformatChapters(
-									reformat(item.title)
-								)}&sort=SEARCH_MATCH`}
-							>
-								{reformat(item.title)}
-							</a>
+							{#if directLink}
+								<i>{reformat(item.title)}</i>
+
+								{@html item.content}
+							{:else}
+								<a
+									href={`https://anilist.co/search/manga?search=${reformatChapters(
+										reformat(item.title)
+									)}&sort=SEARCH_MATCH`}
+								>
+									{reformat(item.title)}
+								</a>
+							{/if}
 						</li>
 					{/each}
 				{:else}
-- 
cgit v1.2.3

