diff options
| author | Bobby <[email protected]> | 2023-06-06 01:37:12 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-06-06 01:37:12 -0400 |
| commit | 9fe01a82b91696dd1d61350c97bb201fe7d4e35e (patch) | |
| tree | 9845138667dc729ee1ff3d1aabedb9efea557068 /static/js/globals.js | |
| parent | dbff650e5c7e3b81e2f4e68cc66714dbd9f03374 (diff) | |
| download | thatcomputerscientist-9fe01a82b91696dd1d61350c97bb201fe7d4e35e.tar.xz thatcomputerscientist-9fe01a82b91696dd1d61350c97bb201fe7d4e35e.zip | |
Light Mode on Steriods; Move JS to files
Diffstat (limited to 'static/js/globals.js')
| -rw-r--r-- | static/js/globals.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/static/js/globals.js b/static/js/globals.js new file mode 100644 index 00000000..9850afb2 --- /dev/null +++ b/static/js/globals.js @@ -0,0 +1,53 @@ +window.dataLayer = window.dataLayer || []; +function gtag() { + dataLayer.push(arguments); +} +gtag("js", new Date()); + +gtag("config", "G-72XTC500FR"); + +// Smooth scroll to anchor +$(document).ready(function () { + $('a[href^="#"]').on("click", function (e) { + e.preventDefault(); + + const target = $(this.getAttribute("href")); + if (target.length) { + $("html, body").stop().animate( + { + scrollTop: target.offset().top, + }, + 500 + ); + } + }); +}); + +document.addEventListener("DOMContentLoaded", function () { + var equationElements = document.getElementsByTagName("*"); + + for (var i = 0; i < equationElements.length; i++) { + var element = equationElements[i]; + + if ( + element.innerHTML.startsWith("$$") && + element.innerHTML.endsWith("$$") + ) { + element.style.overflowX = "scroll"; + element.style.whiteSpace = "nowrap"; + element.classList.add("equation-container"); + } + } +}); + +function summonOneko() { + document.cookie = + "summonOneko=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"; + location.reload(); +} + +function withdrawOneko() { + document.cookie = + "summonOneko=false; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"; + location.reload(); +} |
