mirror of
https://github.com/narrrl/pl8list-rewind.git
synced 2026-11-03 16:41:26 +01:00
removed grain
This commit is contained in:
1 parent
041ce73a3e
commit
cef3ffd240
2 files changed
-31
No files matched your search
@@ -57,8 +57,6 @@ const sheets = {
|
|||||||
if ("serviceWorker" in navigator && import.meta.env.PROD) {
|
if ("serviceWorker" in navigator && import.meta.env.PROD) {
|
||||||
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch((err) => console.warn("no service worker:", err));
|
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch((err) => console.warn("no service worker:", err));
|
||||||
}
|
}
|
||||||
paintGrain();
|
|
||||||
|
|
||||||
const cards: Card[] = [];
|
const cards: Card[] = [];
|
||||||
let active = -1;
|
let active = -1;
|
||||||
let loading = false;
|
let loading = false;
|
||||||
@@ -1174,24 +1172,6 @@ function signedIn(user: User, pl8list?: Pl8Status): void {
|
|||||||
if (!cards.length) openLinkOrFeed();
|
if (!cards.length) openLinkOrFeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The tile of film grain the stylesheet lays over everything: faint specks, each
|
|
||||||
/// a little lighter or darker than what is under it.
|
|
||||||
function paintGrain(): void {
|
|
||||||
const size = 128;
|
|
||||||
const c = document.createElement("canvas");
|
|
||||||
c.width = c.height = size;
|
|
||||||
const ctx = c.getContext("2d");
|
|
||||||
if (!ctx) return;
|
|
||||||
const img = ctx.createImageData(size, size);
|
|
||||||
for (let i = 0; i < img.data.length; i += 4) {
|
|
||||||
const v = Math.random() < 0.5 ? 0 : 255;
|
|
||||||
img.data[i] = img.data[i + 1] = img.data[i + 2] = v;
|
|
||||||
img.data[i + 3] = Math.random() * 26;
|
|
||||||
}
|
|
||||||
ctx.putImageData(img, 0, 0);
|
|
||||||
document.documentElement.style.setProperty("--grain", `url(${c.toDataURL()})`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `/?t=handle/slug` opens on that track; the feed carries on after it.
|
/// `/?t=handle/slug` opens on that track; the feed carries on after it.
|
||||||
async function openLinkOrFeed(): Promise<void> {
|
async function openLinkOrFeed(): Promise<void> {
|
||||||
const link = new URLSearchParams(location.search).get("t")?.split("/");
|
const link = new URLSearchParams(location.search).get("t")?.split("/");
|
||||||
|
|||||||
@@ -35,17 +35,6 @@ html, body {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
}
|
}
|
||||||
/* Film grain over everything, from a tile main.ts paints: a printed flyer. Static
|
|
||||||
and without a blend mode, so it costs nothing per frame. */
|
|
||||||
body::after {
|
|
||||||
content: "";
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 100;
|
|
||||||
pointer-events: none;
|
|
||||||
background: var(--grain, none);
|
|
||||||
}
|
|
||||||
|
|
||||||
a { color: inherit; }
|
a { color: inherit; }
|
||||||
|
|
||||||
button, input {
|
button, input {
|
||||||
|
|||||||
Reference in new issue
Block a user