Skip to content

Commit

Permalink
Early dev
Browse files Browse the repository at this point in the history
  • Loading branch information
phieri committed Oct 6, 2024
1 parent 0b633f9 commit 27ea60f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
4 changes: 3 additions & 1 deletion _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<head>
<title>SWEREF 99 TM</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<script src="script.js"></script>
<script src="script.js" defer></script>
</head>
<body>
<h1>sweref99.nu</h1>
<button id="pos-btn">📡</button>
<button id="share-btn">Dela</button>
<nav><a href="/om.html">Om appen</a></nav>
</body>
</html>
30 changes: 22 additions & 8 deletions src/script.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
document.addEventListener(
"keydown",
(event) => {
if (event.key === "F1") {
document.location = "https://sweref99.nu/om.html";
}
},
false,
);
"keydown",
(event) => {
if (event.key === "F1") {
document.location = "https://sweref99.nu/om.html";
}
},
false,
);

const shareData = {
title: "Position",
text: "SWEREF 99 TM: N E"
};

const btn = document.querySelector("#share-btn");
btn.addEventListener("click", async () => {
try {
await navigator.share(shareData);
} catch (err) {
alert("Kunde inte dela.");
}
});

0 comments on commit 27ea60f

Please sign in to comment.