macgregor/src/index.html
2025-02-13 00:11:07 -05:00

42 lines
1.3 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>MacGregor House</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Imbue:opsz,wght@10..100,100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="app"></div>
<script src="../compiled/Main.js"></script>
<script>
var app = Elm.Main.init({
node: document.getElementById("app"),
flags: [window.innerWidth, window.innerHeight],
});
app.ports.copyToClipboard.subscribe((tuple) => {
let label = tuple[0];
let text = tuple[1];
let textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
document.body.removeChild(textArea);
alert(`Copied ${label} to clipboard`);
});
app.ports.scrollTo.subscribe((id) => {
let element = document.getElementById(id);
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
});
</script>
</body>
</html>