From 70e783628b1bf863da45cc8879b06288a498840b Mon Sep 17 00:00:00 2001
From: David Luevano Alvarado <david@luevano.xyz>
Date: Fri, 5 May 2023 03:16:06 -0600
Subject: update css, make articles more uniform, add toc and add functionality
 to scroll to the top

---
 live/static/scripts/return_top.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 live/static/scripts/return_top.js

(limited to 'live/static/scripts')

diff --git a/live/static/scripts/return_top.js b/live/static/scripts/return_top.js
new file mode 100644
index 0000000..77c468f
--- /dev/null
+++ b/live/static/scripts/return_top.js
@@ -0,0 +1,21 @@
+// Taken from https://www.w3schools.com/howto/howto_js_scroll_to_top.asp
+// and tweaked as needed
+document.addEventListener("DOMContentLoaded", function(event) {
+    let returnTopButton = document.getElementById("returnTopButton");
+    let scrollTopAppearPX = window.screen.availHeight;
+
+    window.onscroll = function() {scrolling(returnTopButton, scrollTopAppearPX)};
+})
+
+function scrolling(returnButton, onScrollAppear) {
+  if (document.body.scrollTop > onScrollAppear || document.documentElement.scrollTop > onScrollAppear) {
+    returnButton.style.display = "inline-block";
+  } else {
+    returnButton.style.display = "none";
+  }
+}
+
+function returnTop() {
+  document.body.scrollTop = 0; // For Safari
+  document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
+}
-- 
cgit v1.2.3-70-g09d2