Skip to content

Commit

Permalink
Deploy docs from 55e993b
Browse files Browse the repository at this point in the history
Daniel Haim: Improve accessibility of the docs (#9338)

Merge pull request 9338
  • Loading branch information
jekyllbot committed Jan 12, 2024
1 parent 1411bea commit 0ba0f0f
Show file tree
Hide file tree
Showing 210 changed files with 28,869 additions and 16,789 deletions.
58 changes: 29 additions & 29 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE HTML>
<html lang="en-US">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand Down Expand Up @@ -79,37 +79,37 @@ <h1>


<script>
var anchorForId = function (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
anchor.title = "Permalink";
return anchor;
};
/* Creates an anchor element with the given ID and link for the permalink*/
const anchorForId = (id) => {
const anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = `#${id}`;
anchor.innerHTML = `<span class="sr-only">Permalink</span><i class="fa fa-link" aria-hidden="true"></i>`;
anchor.title = "Permalink";
return anchor;
};

var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];

if (typeof header.id !== "undefined" && header.id !== "") {
header.appendChild(anchorForId(header.id));
}
/* Finds all headers of the specified level within the given element, and adds a permalink to each header*/
const linkifyAnchors = (level, containingElement) => {
const headers = Array.from(containingElement.getElementsByTagName(`h${level}`));
headers.forEach((header) => {
if (header.id) {
header.appendChild(anchorForId(header.id));
}
};
});
};

document.onreadystatechange = function () {
if (this.readyState === "complete") {
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
if (!contentBlock) {
return;
}
for (var level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
/* Executes the function when the document is ready */
document.onreadystatechange = () => {
if (document.readyState === "complete") {
const contentBlock = document.getElementsByClassName("docs")[0]
?? document.getElementsByClassName("news")[0];
if (!contentBlock) { return; }
for (let level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
};
}
};
</script>

<!-- Google Analytics (https://www.google.com/analytics) -->
Expand Down

0 comments on commit 0ba0f0f

Please sign in to comment.