This commit is contained in:
parent
4aca2a7720
commit
b260c88345
|
@ -1,4 +1,4 @@
|
|||
import Nano, { Component, Fragment, Suspense } from "nano-jsx"
|
||||
import Nano, { Component } from "nano-jsx"
|
||||
import { BlogPage } from "./blog_page";
|
||||
import { Giscus } from "./giscus";
|
||||
import { useState } from "nano-jsx/esm/hooks/useState.js";
|
||||
|
@ -72,13 +72,13 @@ class Main extends Component {
|
|||
}
|
||||
|
||||
return <>
|
||||
<h1>blog & comments</h1>
|
||||
{() => {
|
||||
if (blogPosts) return this.list(blogPosts)
|
||||
else return <h3>Loading...</h3>
|
||||
}}
|
||||
<Giscus searchTerm="main"></Giscus>
|
||||
</>
|
||||
<h1>blog & comments</h1>
|
||||
{() => {
|
||||
if (blogPosts) return this.list(blogPosts)
|
||||
else return <h3>Loading...</h3>
|
||||
}}
|
||||
<Giscus searchTerm="main"></Giscus>
|
||||
</>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ export class BlogPage extends Component {
|
|||
|
||||
render(blogPost: string) {
|
||||
const pageOpen = useState<string | undefined>(undefined, "pageOpen");
|
||||
history.replaceState({}, "", location.pathname+"?md=" + this.metadata.filename);
|
||||
history.replaceState({}, "", location.pathname + "?md=" + this.metadata.filename);
|
||||
|
||||
return <>
|
||||
<h1>blog & comments</h1>
|
||||
<a style="font-size:xx-large;" onClick={() => {
|
||||
pageOpen[1](undefined);
|
||||
history.replaceState({}, "", location.pathname+"?md=");
|
||||
history.replaceState({}, "", location.pathname + "?md=");
|
||||
|
||||
this.updateParent();
|
||||
}}>return back?</a>
|
||||
|
|
|
@ -29,10 +29,15 @@ class Particle {
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
this.id = Math.random();
|
||||
this.angle = 2*Math.PI*this.id;
|
||||
this.color = "hsl(" + 360 * Math.random() + ',' +
|
||||
(25 + 70 * Math.random()) + '%,' +
|
||||
(85 + 10 * Math.random()) + '%)';
|
||||
this.angle = 2 * Math.PI * this.id;
|
||||
this.color =
|
||||
"hsl(" +
|
||||
360 * Math.random() +
|
||||
"," +
|
||||
(25 + 70 * Math.random()) +
|
||||
"%," +
|
||||
(85 + 10 * Math.random()) +
|
||||
"%)";
|
||||
this.style = Math.random() < 0.5 ? "-" : Math.random() > 0.5 ? "+" : "*";
|
||||
}
|
||||
|
||||
|
@ -40,18 +45,18 @@ class Particle {
|
|||
this.y += 2;
|
||||
this.x -= getRandomArbitrary(-1, 1);
|
||||
|
||||
var width2=renderSurfaceContext.measureText("+").width;
|
||||
var width2 = renderSurfaceContext.measureText("+").width;
|
||||
|
||||
renderSurfaceContext.save();
|
||||
renderSurfaceContext.fillStyle = this.color;
|
||||
renderSurfaceContext.font = Math.floor(this.id*60)+"px Arial";
|
||||
renderSurfaceContext.font = Math.floor(this.id * 60) + "px Arial";
|
||||
renderSurfaceContext.translate(this.x, this.y);
|
||||
renderSurfaceContext.rotate(2*Math.PI*this.id);
|
||||
renderSurfaceContext.fillText(this.style, -width2/2,4);
|
||||
renderSurfaceContext.rotate(2 * Math.PI * this.id);
|
||||
renderSurfaceContext.fillText(this.style, -width2 / 2, 4);
|
||||
renderSurfaceContext.restore();
|
||||
|
||||
if (renderSurface.height < this.y) {
|
||||
particles = particles.filter(z=>z.id !== this.id)
|
||||
particles = particles.filter((z) => z.id !== this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ interface LatestStatus {
|
|||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(await req.text(), "text/xml");
|
||||
const latestEntryRaw = doc.querySelector("feed > entry");
|
||||
if (!latestEntryRaw) throw new Error("Missing latest entry!");;
|
||||
if (!latestEntryRaw) throw new Error("Missing latest entry!");
|
||||
|
||||
const latestEntry: LatestStatus = {
|
||||
username: doc.querySelector("feed > author > name")?.textContent!,
|
||||
|
@ -46,7 +46,7 @@ interface LatestStatus {
|
|||
.slice(0, -Math.min(latestEntry.status.length, 53))
|
||||
.trim();
|
||||
const statusElement = document.getElementById("status");
|
||||
if(!statusElement) throw new Error("Missing status element!");
|
||||
if (!statusElement) throw new Error("Missing status element!");
|
||||
const h2 = document.createElement("h2");
|
||||
const a = document.createElement("a");
|
||||
const p = document.createElement("p");
|
||||
|
|
Loading…
Reference in a new issue