Index

joshstock.in / 81b4469

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
8128 Mar 2020 23:26b2d3957Rewrite template engineJosh Stockin1140G

Blob @ joshstock.in / root / resources / static / banner_scroll.js

application/javascript566 bytesdownload raw
1let blog_center = document.getElementsByClassName("blog-center")[0];
2let headers = blog_center.getElementsByTagName("h2");
3for (let i = 0; i < headers.length; i++) {
4 let header = headers[i];
5 let inner = header.innerHTML;
6 let id = inner.replace(/[^a-z0-9]/gi,"-").toLowerCase();
7 header.id = id;
8 header.innerHTML = "<a href=\"#" + id + "\">" + inner + "</a>";
9};
10let blog_banner = document.getElementsByClassName("blog-banner")[0];
11function scroll() {
12 blog_banner.style["background-position"] = "50% " + (50 - (window.scrollY/20)).toString() + "%";
13};
14scroll();
15