Format everything

This commit is contained in:
Kevin Kandlbinder 2024-01-11 09:39:50 +00:00
parent 31122313e2
commit 75992f07f9
6 changed files with 62 additions and 54 deletions

16
src/app.d.ts vendored
View file

@ -11,14 +11,14 @@ declare global {
interface Window {
plausible?: (string, { props: any }) => void;
remark_config: {
host: string,
site_id: string,
components: ("embed"|"last-comments"|"counter")[],
show_rss_subsription: boolean,
theme: "light"|"dark",
page_title: string,
url: string
}
host: string;
site_id: string;
components: ('embed' | 'last-comments' | 'counter')[];
show_rss_subsription: boolean;
theme: 'light' | 'dark';
page_title: string;
url: string;
};
}
}

View file

@ -1,35 +1,33 @@
<script lang="ts">
import { browser } from "$app/environment";
import Parameters from "$lib/parameters";
import { onMount } from "svelte";
import { browser } from '$app/environment';
import Parameters from '$lib/parameters';
import { onMount } from 'svelte';
export let pageTitle: string;
export let url: string;
export let pageTitle: string;
export let url: string;
onMount(() => {
if(!browser) return;
onMount(() => {
if (!browser) return;
window.remark_config = {
host: Parameters.regard24.host,
site_id: Parameters.regard24.site,
components: ["embed"],
show_rss_subsription: false,
theme: "light",
page_title: pageTitle,
url,
window.remark_config = {
host: Parameters.regard24.host,
site_id: Parameters.regard24.site,
components: ['embed'],
show_rss_subsription: false,
theme: 'light',
page_title: pageTitle,
url
};
}
const script = document.createElement('script');
script.innerHTML = `!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);`
script.async = true;
document.head.appendChild(script);
const script = document.createElement('script');
script.innerHTML = `!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);`;
script.async = true;
document.head.appendChild(script);
return () => {
document.head.removeChild(script);
}
})
return () => {
document.head.removeChild(script);
};
});
</script>
<div id="remark42" />

View file

@ -1,11 +1,10 @@
import { env } from '$env/dynamic/public';
const Parameters = {
regard24: {
host: env.PUBLIC_REGARD24_HOST || "https://comments.pupraider.net",
site: env.PUBLIC_REGARD24_SITE || "devraider",
}
regard24: {
host: env.PUBLIC_REGARD24_HOST || 'https://comments.pupraider.net',
site: env.PUBLIC_REGARD24_SITE || 'devraider'
}
};
export default Parameters;

View file

@ -19,19 +19,20 @@
return () => {
clearInterval(interval);
}
})
};
});
const recalculateFrameHeights = () => {
if(commentFrame) {
commentFrame.style.height = (commentFrame.contentWindow?.document.documentElement.scrollHeight||100)+"px";
if (commentFrame) {
commentFrame.style.height =
(commentFrame.contentWindow?.document.documentElement.scrollHeight || 100) + 'px';
}
}
};
let commentFrame: HTMLIFrameElement;
$: {
if(commentFrame) {
if (commentFrame) {
recalculateFrameHeights();
}
}
@ -132,7 +133,14 @@
</div>
<div class="comments">
<iframe bind:this={commentFrame} width="100%" src={`/read/${publishTime.year}/${data.post.slug}/comments`} title="Comment Section" frameborder="0" scrolling="no" />
<iframe
bind:this={commentFrame}
width="100%"
src={`/read/${publishTime.year}/${data.post.slug}/comments`}
title="Comment Section"
frameborder="0"
scrolling="no"
/>
</div>
</div>

View file

@ -1,15 +1,18 @@
<script lang="ts">
import Remark24 from "$lib/components/Remark24/Remark24.svelte";
import "../../../../../../../app.scss";
import { makeCanonicalUrl } from "$lib/seoUtils";
import { DateTime } from "luxon";
import Remark24 from '$lib/components/Remark24/Remark24.svelte';
import '../../../../../../../app.scss';
import { makeCanonicalUrl } from '$lib/seoUtils';
import { DateTime } from 'luxon';
import type { PageData } from './$types';
export let data: PageData;
$: publishTime = DateTime.fromISO(data.post.published_at || data.post.created_at || '2001-11-03');
$: publishTime = DateTime.fromISO(data.post.published_at || data.post.created_at || '2001-11-03');
</script>
<h2>Comments</h2>
<Remark24 pageTitle={data.post.title} url={makeCanonicalUrl(`/read/${publishTime.year}/${data.post.slug}`)} />
<Remark24
pageTitle={data.post.title}
url={makeCanonicalUrl(`/read/${publishTime.year}/${data.post.slug}`)}
/>

View file

@ -432,7 +432,7 @@
max-width: 100%;
height: auto;
margin: 0 auto;
display: block;
display: block;
}
> figcaption {