mirror of
https://github.com/danbulant/Mangades
synced 2026-09-20 06:43:54 +00:00
add statistics back
This commit is contained in:
parent
c3549bad86
commit
f40c4a4d65
1 changed files with 14 additions and 12 deletions
|
|
@ -1,18 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { afterNavigate } from "$app/navigation";
|
||||||
import { logs } from "$lib/util/logs";
|
import { logs } from "$lib/util/logs";
|
||||||
|
|
||||||
// let skipFirst = true;
|
let skipFirst = true;
|
||||||
// let last = window.location.pathname;
|
let last = window.location.pathname;
|
||||||
// $afterPageLoad(page => {
|
afterNavigate(page => {
|
||||||
// if(skipFirst) return skipFirst = false;
|
if(!["link", "popstate"].includes(page.type)) return; // ignore post hydration and automatic goto
|
||||||
// if(window.goatcounter) window.goatcounter.count({
|
if(skipFirst) return skipFirst = false;
|
||||||
// path: window.location.pathname,
|
if(window.goatcounter) window.goatcounter.count({
|
||||||
// title: page.title,
|
path: window.location.pathname,
|
||||||
// referrer: last
|
title: page.title,
|
||||||
// });
|
referrer: last
|
||||||
// else console.warn("Page change; GoatCounter not loaded (yet?)", window.location.pathname);
|
});
|
||||||
// last = window.location.pathname;
|
else console.warn("Page change; GoatCounter not loaded (yet?)", window.location.pathname);
|
||||||
// });
|
last = window.location.pathname;
|
||||||
|
});
|
||||||
|
|
||||||
let defaultDarkmode = typeof window !== "undefined" && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
let defaultDarkmode = typeof window !== "undefined" && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
typeof window !== "undefined" && window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
typeof window !== "undefined" && window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue