Added the guided chat to the BeyondFacts Lab (#1177)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-09 09:55:01 +01:00
1 parent e77645f44c
commit 79e0c80031
55 files changed
+3481 -72

No files matched your search

+24
View File
@@ -56,6 +56,30 @@ window.scrollToBottom = function(element) {
element.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' });
}
// Scrolls back to where a sticky header sits in the flow, so that the content below it starts right under the
// header. The anchor is an empty element right before the header: once the page is scrolled past it, the anchor
// lies above the top of its scrolling container, which then moves back by that distance. Otherwise, the content
// below already starts right under the header, and nothing moves.
//
// It sets scrollTop itself: scrollIntoView did not move the page for this anchor without height, and the content
// which renders right after a switch may stop a smooth scroll.
window.scrollToStickyHeader = function(anchor) {
if (!anchor)
return;
// The nearest ancestor which scrolls its content, or else the document:
let container = anchor.parentElement;
while (container && !['auto', 'scroll'].includes(getComputedStyle(container).overflowY))
container = container.parentElement;
const containerTop = container ? container.getBoundingClientRect().top + container.clientTop : 0;
container ??= document.scrollingElement;
const distance = anchor.getBoundingClientRect().top - containerTop;
if (distance < 0)
container.scrollTop += distance;
}
window.setDocumentLanguage = function (ietfTag) {
document.documentElement.lang = ietfTag
}