Fix JavaScript null error on home and splash layouts (#4939)
This commit is contained in:
parent
a3e2b33c5e
commit
5fd703674b
@ -123,21 +123,25 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
// Add anchors for headings
|
||||
document
|
||||
.querySelector(".page__content")
|
||||
.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
||||
.forEach(function (element) {
|
||||
var id = element.getAttribute("id");
|
||||
if (id) {
|
||||
var anchor = document.createElement("a");
|
||||
anchor.className = "header-link";
|
||||
anchor.href = "#" + id;
|
||||
anchor.innerHTML =
|
||||
'<span class="sr-only">Permalink</span><i class="fas fa-link"></i>';
|
||||
anchor.title = "Permalink";
|
||||
element.appendChild(anchor);
|
||||
}
|
||||
});
|
||||
(function () {
|
||||
var pageContentElement = document.querySelector(".page__content");
|
||||
if (!pageContentElement) return;
|
||||
|
||||
pageContentElement
|
||||
.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
||||
.forEach(function (element) {
|
||||
var id = element.getAttribute("id");
|
||||
if (id) {
|
||||
var anchor = document.createElement("a");
|
||||
anchor.className = "header-link";
|
||||
anchor.href = "#" + id;
|
||||
anchor.innerHTML =
|
||||
'<span class="sr-only">Permalink</span><i class="fas fa-link"></i>';
|
||||
anchor.title = "Permalink";
|
||||
element.appendChild(anchor);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
// Add copy button for <pre> blocks
|
||||
var copyText = function (text) {
|
||||
|
2
assets/js/main.min.js
vendored
2
assets/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user