add statistics back

This commit is contained in:
Daniel Bulant 2022-12-09 18:19:16 +01:00
parent c3549bad86
commit f40c4a4d65

View file

@ -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 => {