aboutsummaryrefslogtreecommitdiffstats
path: root/assets/js/loads.js
blob: c8a03a73c7a249e5b2d605231ef75d4ecd7bc77c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function load_css(url) {
  let link = document.createElement("link");
  link.rel = "stylesheet";
  link.type = "text/css";
  link.href = url;
  let head = document.getElementsByTagName("head")[0];
  head.appendChild(link);
}

addEventListener("load", function () {
  if (document.querySelector(".highlight .chroma")) {
    load_css("/css/syntax.css");
  }

  if (document.querySelector(".ai")) {
    load_css(
      "https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css",
    );
  }
  if (document.querySelectorAll(".fa,.fab,.fas,.far"))
    load_css(
      "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
    );
});