MCPcopy Create free account
hub / github.com/awesome-kusion/rust-code-book / updateFunction

Function updateFunction

js/custom.js:33–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 });
32
33 var updateFunction = function () {
34 var id = null;
35 var elements = document.getElementsByClassName("header");
36 Array.prototype.forEach.call(elements, function (el) {
37 if (window.pageYOffset >= el.offsetTop) {
38 id = el;
39 }
40 });
41
42 Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function (el) {
43 el.classList.remove("active");
44 });
45
46 Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function (el) {
47 if (id == null) {
48 return;
49 }
50 if (id.href.localeCompare(el.href) == 0) {
51 el.classList.add("active");
52 }
53 });
54 };
55
56 var pagetoc = document.getElementsByClassName("pagetoc")[0];
57 var elements = document.getElementsByClassName("header");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected