forked from tanner/qotnews
lag.
This commit is contained in:
parent
888c341296
commit
f524ecec7b
|
@ -70,7 +70,11 @@
|
|||
<article class="article">
|
||||
<header class="article-header">
|
||||
<h1 class="article-title">
|
||||
{@html title}
|
||||
{#if !title}
|
||||
{story.title}
|
||||
{:else}
|
||||
{@html title}
|
||||
{/if}
|
||||
</h1>
|
||||
{#if story.url}
|
||||
<div>source: <a class="article-source" href={story.url}>{host}</a></div>
|
||||
|
@ -81,6 +85,10 @@
|
|||
</header>
|
||||
|
||||
<section class="article-body">
|
||||
{@html html}
|
||||
{#if !html}
|
||||
{story.content}
|
||||
{:else}
|
||||
{@html html}
|
||||
{/if}
|
||||
</section>
|
||||
</article>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
export let stories;
|
||||
|
||||
const host = (url) => new URL(url).hostname.replace(/^www\./, "");
|
||||
let purify = () => "";
|
||||
let purify;
|
||||
|
||||
onMount(() => {
|
||||
purify = (html) => DOMPurify.sanitize(html);
|
||||
|
@ -48,10 +48,13 @@
|
|||
alt="logo"
|
||||
class="story-icon"
|
||||
style="height: 1rem; width: 1rem;" />
|
||||
<a
|
||||
class="story-title"
|
||||
rel="prefetch"
|
||||
href="/{story.id}">{@html purify(story.title)}</a>
|
||||
<a class="story-title" rel="prefetch" href="/{story.id}">
|
||||
{#if !purify}
|
||||
{story.title}
|
||||
{:else}
|
||||
{@html purify(story.title)}
|
||||
{/if}
|
||||
</a>
|
||||
<a
|
||||
class="story-source"
|
||||
href={story.url || story.link}>{host(story.url || story.link)}</a>
|
||||
|
|
Loading…
Reference in New Issue
Block a user