forked from varianter/handbook-se
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_document.tsx
56 lines (53 loc) · 1.4 KB
/
_document.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import Document, { Html, Head, Main, NextScript } from 'next/document';
export default class Doc extends Document {
render() {
return (
<Html lang="no">
<Head />
<body>
<Main />
<NextScript />
<script
dangerouslySetInnerHTML={{
__html: `
var _paq = _paq || [];
_paq.push(["disableCookies"]);
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u = "https://variant.innocraft.cloud/";
_paq.push(["setTrackerUrl", u + "piwik.php"]);
_paq.push(["setSiteId", "6"]);
var d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.type = "text/javascript";
g.async = true;
g.defer = true;
g.src = u + "piwik.js";
s.parentNode.insertBefore(g, s);
})();
// Remove old and outdated service workers.
// This should be removed at some point (when enough time has passed)
if (
typeof window !== "undefined" &&
typeof navigator !== "undefined" &&
"serviceWorker" in navigator
) {
window.addEventListener("load", async function () {
const registrations = await navigator.serviceWorker.getRegistrations();
if (!registrations || !registrations.length) return;
for (let registration of registrations) {
await registration.unregister();
}
window.location.reload();
});
}
`,
}}
/>
</body>
</Html>
);
}
}