summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/theme/book.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/mdbook/src/theme/book.js
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/mdbook/src/theme/book.js')
-rw-r--r--vendor/mdbook/src/theme/book.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/vendor/mdbook/src/theme/book.js b/vendor/mdbook/src/theme/book.js
index e303ebb45..67a8a5b08 100644
--- a/vendor/mdbook/src/theme/book.js
+++ b/vendor/mdbook/src/theme/book.js
@@ -68,7 +68,7 @@ function playground_text(playground, hidden = true) {
}
// updates the visibility of play button based on `no_run` class and
- // used crates vs ones available on http://play.rust-lang.org
+ // used crates vs ones available on https://play.rust-lang.org
function update_play_button(pre_block, playground_crates) {
var play_button = pre_block.querySelector(".play-button");
@@ -179,7 +179,7 @@ function playground_text(playground, hidden = true) {
// even if highlighting doesn't apply
code_nodes.forEach(function (block) { block.classList.add('hljs'); });
- Array.from(document.querySelectorAll("code.language-rust")).forEach(function (block) {
+ Array.from(document.querySelectorAll("code.hljs")).forEach(function (block) {
var lines = Array.from(block.querySelectorAll('.boring'));
// If no lines were hidden, return
@@ -551,13 +551,6 @@ function playground_text(playground, hidden = true) {
firstContact = null;
}
}, { passive: true });
-
- // Scroll sidebar to current active section
- var activeSection = document.getElementById("sidebar").querySelector(".active");
- if (activeSection) {
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
- activeSection.scrollIntoView({ block: 'center' });
- }
})();
(function chapterNavigation() {
@@ -676,13 +669,14 @@ function playground_text(playground, hidden = true) {
}, { passive: true });
})();
(function controllBorder() {
- menu.classList.remove('bordered');
- document.addEventListener('scroll', function () {
+ function updateBorder() {
if (menu.offsetTop === 0) {
menu.classList.remove('bordered');
} else {
menu.classList.add('bordered');
}
- }, { passive: true });
+ }
+ updateBorder();
+ document.addEventListener('scroll', updateBorder, { passive: true });
})();
})();