aboutsummaryrefslogtreecommitdiff
path: root/entries/Metroxe/index.html
diff options
context:
space:
mode:
authorbraxtonhall2022-10-23 20:47:32 +0000
committerbraxtonhall2022-10-23 20:47:32 +0000
commitaf0d8d454eaac9cbe5e04b1120645a578b8e60a4 (patch)
tree888373cfef0a98b905881c1e9c1f4e5a8ebbef58 /entries/Metroxe/index.html
parenta0e82fd0f3c03e724a035eb08af1becc0a467697 (diff)
Use GitHub IDs instead of full names (for now)
Diffstat (limited to 'entries/Metroxe/index.html')
-rw-r--r--entries/Metroxe/index.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/entries/Metroxe/index.html b/entries/Metroxe/index.html
new file mode 100644
index 0000000..98ac5b9
--- /dev/null
+++ b/entries/Metroxe/index.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>fib.html</title>
+ <style>
+ #sequence {
+ overflow-wrap: break-word;
+ }
+ </style>
+</head>
+<body>
+<a id="next">Next Term</a>
+<a href=".">Reset</a>
+<hr/>
+<code id="sequence"></code>
+
+<script>
+
+ const s = new URLSearchParams(window.location.search).get("s") ?? "0,1";
+ const i1 = s.lastIndexOf(",");
+ const i2 = s.lastIndexOf(",", i1 - 1);
+ const n1 = s.substring(i1 + 1);
+ const n2 = i2 === -1 ? s.substring(0, i1 - 1) : s.substring(i2 + 1, i1);
+ const v = Number(n1) + Number(n2);
+ const output = `${s},${Number(n1) + Number(n2)}`;
+ document.getElementById("sequence").innerText = output;
+
+ const next = document.getElementById("next");
+ if (v > Number.MAX_SAFE_INTEGER) {
+ next.remove();
+ alert(`Sorry the term is past max safe integer (${Number.MAX_SAFE_INTEGER}), can't calculate.`);
+ } else {
+ next.href = `${window.location.pathname}?s=${output}`
+ }
+
+</script>
+</body>
+</html>