mirror of
https://github.com/wilsonfreitas/awesome-quant.git
synced 2026-07-27 20:07:50 +00:00
site updated
This commit is contained in:
+285
-18
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.2.335">
|
||||
<meta name="generator" content="quarto-1.4.550">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
@@ -17,7 +17,7 @@ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1.6em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@@ -45,7 +45,13 @@ ul.task-list li input[type="checkbox"] {
|
||||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
@@ -54,8 +60,10 @@ ul.task-list li input[type="checkbox"] {
|
||||
"search-more-match-text": "more match in this document",
|
||||
"search-more-matches-text": "more matches in this document",
|
||||
"search-clear-button-title": "Clear",
|
||||
"search-text-placeholder": "",
|
||||
"search-detached-cancel-button-title": "Cancel",
|
||||
"search-submit-button-title": "Submit"
|
||||
"search-submit-button-title": "Submit",
|
||||
"search-label": "Search"
|
||||
}
|
||||
}</script>
|
||||
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7994446359957143" crossorigin="anonymous"></script>
|
||||
@@ -68,33 +76,35 @@ ul.task-list li input[type="checkbox"] {
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<span class="navbar-title">Awesome Quant</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./index.html">
|
||||
<span class="menu-text">Home</span></a>
|
||||
<a class="nav-link" href="./index.html">
|
||||
<span class="menu-text">Home</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="./CODE_OF_CONDUCT.html" aria-current="page">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
<a class="nav-link active" href="./CODE_OF_CONDUCT.html" aria-current="page">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
@@ -141,8 +151,10 @@ ul.task-list li input[type="checkbox"] {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<section id="our-pledge" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="our-pledge">Our Pledge</h2>
|
||||
<p>We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.</p>
|
||||
@@ -242,9 +254,23 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
icon: icon
|
||||
};
|
||||
anchorJS.add('.anchored');
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
||||
target: function(trigger) {
|
||||
return trigger.previousElementSibling;
|
||||
text: function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
});
|
||||
clipboard.on('success', function(e) {
|
||||
@@ -280,10 +306,9 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
@@ -293,8 +318,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
@@ -309,6 +343,238 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
return note.innerHTML;
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
if (id === null || id.startsWith('sec-')) {
|
||||
// Special case sections, only their first couple elements
|
||||
const container = document.createElement("div");
|
||||
if (note.children && note.children.length > 2) {
|
||||
container.appendChild(note.children[0].cloneNode(true));
|
||||
for (let i = 1; i < note.children.length; i++) {
|
||||
const child = note.children[i];
|
||||
if (child.tagName === "P" && child.innerText === "") {
|
||||
continue;
|
||||
} else {
|
||||
container.appendChild(child.cloneNode(true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(container);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
// TODO in 1.5, we should make sure this works without a callout special case
|
||||
if (note.classList.contains("callout")) {
|
||||
return note.outerHTML;
|
||||
} else {
|
||||
return note.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0; i<xrefs.length; i++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
const selectorForAnnotation = ( cell, annotation) => {
|
||||
let cellAttr = 'data-code-cell="' + cell + '"';
|
||||
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
||||
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
||||
return selector;
|
||||
}
|
||||
const selectCodeLines = (annoteEl) => {
|
||||
const doc = window.document;
|
||||
const targetCell = annoteEl.getAttribute("data-target-cell");
|
||||
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
||||
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
||||
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
||||
const lineIds = lines.map((line) => {
|
||||
return targetCell + "-" + line;
|
||||
})
|
||||
let top = null;
|
||||
let height = null;
|
||||
let parent = null;
|
||||
if (lineIds.length > 0) {
|
||||
//compute the position of the single el (top and bottom and make a div)
|
||||
const el = window.document.getElementById(lineIds[0]);
|
||||
top = el.offsetTop;
|
||||
height = el.offsetHeight;
|
||||
parent = el.parentElement.parentElement;
|
||||
if (lineIds.length > 1) {
|
||||
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
||||
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
||||
height = bottom - top;
|
||||
}
|
||||
if (top !== null && height !== null && parent !== null) {
|
||||
// cook up a div (if necessary) and position it
|
||||
let div = window.document.getElementById("code-annotation-line-highlight");
|
||||
if (div === null) {
|
||||
div = window.document.createElement("div");
|
||||
div.setAttribute("id", "code-annotation-line-highlight");
|
||||
div.style.position = 'absolute';
|
||||
parent.appendChild(div);
|
||||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
||||
gutterDiv.style.position = 'absolute';
|
||||
const codeCell = window.document.getElementById(targetCell);
|
||||
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
||||
gutter.appendChild(gutterDiv);
|
||||
}
|
||||
gutterDiv.style.top = top - 2 + "px";
|
||||
gutterDiv.style.height = height + 4 + "px";
|
||||
}
|
||||
selectedAnnoteEl = annoteEl;
|
||||
}
|
||||
};
|
||||
const unselectCodeLines = () => {
|
||||
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
||||
elementsIds.forEach((elId) => {
|
||||
const div = window.document.getElementById(elId);
|
||||
if (div) {
|
||||
div.remove();
|
||||
}
|
||||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
annoteDlNode.addEventListener('click', (event) => {
|
||||
const clickedEl = event.target;
|
||||
if (clickedEl !== selectedAnnoteEl) {
|
||||
unselectCodeLines();
|
||||
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
||||
if (activeEl) {
|
||||
activeEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
selectCodeLines(clickedEl);
|
||||
clickedEl.classList.add('code-annotation-active');
|
||||
} else {
|
||||
// Unselect the line
|
||||
unselectCodeLines();
|
||||
clickedEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
@@ -352,4 +618,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
+285
-18
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.2.335">
|
||||
<meta name="generator" content="quarto-1.4.550">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
@@ -17,7 +17,7 @@ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1.6em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@@ -45,7 +45,13 @@ ul.task-list li input[type="checkbox"] {
|
||||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
@@ -54,8 +60,10 @@ ul.task-list li input[type="checkbox"] {
|
||||
"search-more-match-text": "more match in this document",
|
||||
"search-more-matches-text": "more matches in this document",
|
||||
"search-clear-button-title": "Clear",
|
||||
"search-text-placeholder": "",
|
||||
"search-detached-cancel-button-title": "Cancel",
|
||||
"search-submit-button-title": "Submit"
|
||||
"search-submit-button-title": "Submit",
|
||||
"search-label": "Search"
|
||||
}
|
||||
}</script>
|
||||
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7994446359957143" crossorigin="anonymous"></script>
|
||||
@@ -68,33 +76,35 @@ ul.task-list li input[type="checkbox"] {
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<span class="navbar-title">Awesome Quant</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./index.html">
|
||||
<span class="menu-text">Home</span></a>
|
||||
<a class="nav-link" href="./index.html">
|
||||
<span class="menu-text">Home</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./CODE_OF_CONDUCT.html">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
<a class="nav-link" href="./CODE_OF_CONDUCT.html">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
@@ -123,8 +133,10 @@ ul.task-list li input[type="checkbox"] {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<p>About this site</p>
|
||||
|
||||
|
||||
@@ -157,9 +169,23 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
icon: icon
|
||||
};
|
||||
anchorJS.add('.anchored');
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
||||
target: function(trigger) {
|
||||
return trigger.previousElementSibling;
|
||||
text: function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
});
|
||||
clipboard.on('success', function(e) {
|
||||
@@ -195,10 +221,9 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
@@ -208,8 +233,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
@@ -224,6 +258,238 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
return note.innerHTML;
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
if (id === null || id.startsWith('sec-')) {
|
||||
// Special case sections, only their first couple elements
|
||||
const container = document.createElement("div");
|
||||
if (note.children && note.children.length > 2) {
|
||||
container.appendChild(note.children[0].cloneNode(true));
|
||||
for (let i = 1; i < note.children.length; i++) {
|
||||
const child = note.children[i];
|
||||
if (child.tagName === "P" && child.innerText === "") {
|
||||
continue;
|
||||
} else {
|
||||
container.appendChild(child.cloneNode(true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(container);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
// TODO in 1.5, we should make sure this works without a callout special case
|
||||
if (note.classList.contains("callout")) {
|
||||
return note.outerHTML;
|
||||
} else {
|
||||
return note.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0; i<xrefs.length; i++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
const selectorForAnnotation = ( cell, annotation) => {
|
||||
let cellAttr = 'data-code-cell="' + cell + '"';
|
||||
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
||||
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
||||
return selector;
|
||||
}
|
||||
const selectCodeLines = (annoteEl) => {
|
||||
const doc = window.document;
|
||||
const targetCell = annoteEl.getAttribute("data-target-cell");
|
||||
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
||||
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
||||
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
||||
const lineIds = lines.map((line) => {
|
||||
return targetCell + "-" + line;
|
||||
})
|
||||
let top = null;
|
||||
let height = null;
|
||||
let parent = null;
|
||||
if (lineIds.length > 0) {
|
||||
//compute the position of the single el (top and bottom and make a div)
|
||||
const el = window.document.getElementById(lineIds[0]);
|
||||
top = el.offsetTop;
|
||||
height = el.offsetHeight;
|
||||
parent = el.parentElement.parentElement;
|
||||
if (lineIds.length > 1) {
|
||||
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
||||
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
||||
height = bottom - top;
|
||||
}
|
||||
if (top !== null && height !== null && parent !== null) {
|
||||
// cook up a div (if necessary) and position it
|
||||
let div = window.document.getElementById("code-annotation-line-highlight");
|
||||
if (div === null) {
|
||||
div = window.document.createElement("div");
|
||||
div.setAttribute("id", "code-annotation-line-highlight");
|
||||
div.style.position = 'absolute';
|
||||
parent.appendChild(div);
|
||||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
||||
gutterDiv.style.position = 'absolute';
|
||||
const codeCell = window.document.getElementById(targetCell);
|
||||
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
||||
gutter.appendChild(gutterDiv);
|
||||
}
|
||||
gutterDiv.style.top = top - 2 + "px";
|
||||
gutterDiv.style.height = height + 4 + "px";
|
||||
}
|
||||
selectedAnnoteEl = annoteEl;
|
||||
}
|
||||
};
|
||||
const unselectCodeLines = () => {
|
||||
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
||||
elementsIds.forEach((elId) => {
|
||||
const div = window.document.getElementById(elId);
|
||||
if (div) {
|
||||
div.remove();
|
||||
}
|
||||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
annoteDlNode.addEventListener('click', (event) => {
|
||||
const clickedEl = event.target;
|
||||
if (clickedEl !== selectedAnnoteEl) {
|
||||
unselectCodeLines();
|
||||
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
||||
if (activeEl) {
|
||||
activeEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
selectCodeLines(clickedEl);
|
||||
clickedEl.classList.add('code-annotation-active');
|
||||
} else {
|
||||
// Unselect the line
|
||||
unselectCodeLines();
|
||||
clickedEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
@@ -267,4 +533,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
+293
-24
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.2.335">
|
||||
<meta name="generator" content="quarto-1.4.550">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
@@ -18,7 +18,7 @@ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1.6em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@@ -46,7 +46,13 @@ ul.task-list li input[type="checkbox"] {
|
||||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
@@ -55,8 +61,10 @@ ul.task-list li input[type="checkbox"] {
|
||||
"search-more-match-text": "more match in this document",
|
||||
"search-more-matches-text": "more matches in this document",
|
||||
"search-clear-button-title": "Clear",
|
||||
"search-text-placeholder": "",
|
||||
"search-detached-cancel-button-title": "Cancel",
|
||||
"search-submit-button-title": "Submit"
|
||||
"search-submit-button-title": "Submit",
|
||||
"search-label": "Search"
|
||||
}
|
||||
}</script>
|
||||
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7994446359957143" crossorigin="anonymous"></script>
|
||||
@@ -69,33 +77,35 @@ ul.task-list li input[type="checkbox"] {
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<span class="navbar-title">Awesome Quant</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="./index.html" aria-current="page">
|
||||
<span class="menu-text">Home</span></a>
|
||||
<a class="nav-link active" href="./index.html" aria-current="page">
|
||||
<span class="menu-text">Home</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
<a class="nav-link" href="./projects.html">
|
||||
<span class="menu-text">Projects</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./CODE_OF_CONDUCT.html">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
<a class="nav-link" href="./CODE_OF_CONDUCT.html">
|
||||
<span class="menu-text">Code of Conduct</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="quarto-search" class="" title="Search"></div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
@@ -175,21 +185,25 @@ ul.task-list li input[type="checkbox"] {
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Modified</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p class="date-modified">January 26, 2024</p>
|
||||
<p class="date-modified">Invalid Date</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div class="keywords">
|
||||
<div class="block-title">Keywords</div>
|
||||
<p>r packages, python packages, julia packages, software development, software engineering, financial computing, r, python, julia</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<p>A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance).</p>
|
||||
<div class="quarto-figure quarto-figure-center">
|
||||
<figure class="figure">
|
||||
<p><a href="https://awesome.re"><img src="https://awesome.re/badge.svg" class="img-fluid figure-img"></a></p>
|
||||
</figure>
|
||||
</div>
|
||||
<p><a href="https://awesome.re"><img src="https://awesome.re/badge.svg" class="img-fluid"></a></p>
|
||||
<section id="python" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="python">Python</h2>
|
||||
<section id="numerical-libraries-data-structures" class="level3">
|
||||
@@ -802,9 +816,23 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
icon: icon
|
||||
};
|
||||
anchorJS.add('.anchored');
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
||||
target: function(trigger) {
|
||||
return trigger.previousElementSibling;
|
||||
text: function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
});
|
||||
clipboard.on('success', function(e) {
|
||||
@@ -840,10 +868,9 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
@@ -853,8 +880,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
@@ -869,6 +905,238 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
return note.innerHTML;
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
if (id === null || id.startsWith('sec-')) {
|
||||
// Special case sections, only their first couple elements
|
||||
const container = document.createElement("div");
|
||||
if (note.children && note.children.length > 2) {
|
||||
container.appendChild(note.children[0].cloneNode(true));
|
||||
for (let i = 1; i < note.children.length; i++) {
|
||||
const child = note.children[i];
|
||||
if (child.tagName === "P" && child.innerText === "") {
|
||||
continue;
|
||||
} else {
|
||||
container.appendChild(child.cloneNode(true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(container);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
// TODO in 1.5, we should make sure this works without a callout special case
|
||||
if (note.classList.contains("callout")) {
|
||||
return note.outerHTML;
|
||||
} else {
|
||||
return note.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0; i<xrefs.length; i++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
const selectorForAnnotation = ( cell, annotation) => {
|
||||
let cellAttr = 'data-code-cell="' + cell + '"';
|
||||
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
||||
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
||||
return selector;
|
||||
}
|
||||
const selectCodeLines = (annoteEl) => {
|
||||
const doc = window.document;
|
||||
const targetCell = annoteEl.getAttribute("data-target-cell");
|
||||
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
||||
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
||||
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
||||
const lineIds = lines.map((line) => {
|
||||
return targetCell + "-" + line;
|
||||
})
|
||||
let top = null;
|
||||
let height = null;
|
||||
let parent = null;
|
||||
if (lineIds.length > 0) {
|
||||
//compute the position of the single el (top and bottom and make a div)
|
||||
const el = window.document.getElementById(lineIds[0]);
|
||||
top = el.offsetTop;
|
||||
height = el.offsetHeight;
|
||||
parent = el.parentElement.parentElement;
|
||||
if (lineIds.length > 1) {
|
||||
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
||||
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
||||
height = bottom - top;
|
||||
}
|
||||
if (top !== null && height !== null && parent !== null) {
|
||||
// cook up a div (if necessary) and position it
|
||||
let div = window.document.getElementById("code-annotation-line-highlight");
|
||||
if (div === null) {
|
||||
div = window.document.createElement("div");
|
||||
div.setAttribute("id", "code-annotation-line-highlight");
|
||||
div.style.position = 'absolute';
|
||||
parent.appendChild(div);
|
||||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
||||
gutterDiv.style.position = 'absolute';
|
||||
const codeCell = window.document.getElementById(targetCell);
|
||||
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
||||
gutter.appendChild(gutterDiv);
|
||||
}
|
||||
gutterDiv.style.top = top - 2 + "px";
|
||||
gutterDiv.style.height = height + 4 + "px";
|
||||
}
|
||||
selectedAnnoteEl = annoteEl;
|
||||
}
|
||||
};
|
||||
const unselectCodeLines = () => {
|
||||
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
||||
elementsIds.forEach((elId) => {
|
||||
const div = window.document.getElementById(elId);
|
||||
if (div) {
|
||||
div.remove();
|
||||
}
|
||||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
annoteDlNode.addEventListener('click', (event) => {
|
||||
const clickedEl = event.target;
|
||||
if (clickedEl !== selectedAnnoteEl) {
|
||||
unselectCodeLines();
|
||||
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
||||
if (activeEl) {
|
||||
activeEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
selectCodeLines(clickedEl);
|
||||
clickedEl.classList.add('code-annotation-active');
|
||||
} else {
|
||||
// Unselect the line
|
||||
unselectCodeLines();
|
||||
clickedEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
@@ -912,4 +1180,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
+301
-31
File diff suppressed because one or more lines are too long
+21
-14
File diff suppressed because one or more lines are too long
+390
-16
@@ -1,7 +1,14 @@
|
||||
/*!
|
||||
* Bootstrap Icons v1.11.1 (https://icons.getbootstrap.com/)
|
||||
* Copyright 2019-2023 The Bootstrap Authors
|
||||
* Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-display: block;
|
||||
font-family: "bootstrap-icons";
|
||||
src:
|
||||
url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
url("./bootstrap-icons.woff?2820a3852bdb9a5832199cc61cec4e65") format("woff");
|
||||
}
|
||||
|
||||
.bi::before,
|
||||
@@ -440,7 +447,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-cloud-fog2::before { content: "\f2a2"; }
|
||||
.bi-cloud-hail-fill::before { content: "\f2a3"; }
|
||||
.bi-cloud-hail::before { content: "\f2a4"; }
|
||||
.bi-cloud-haze-1::before { content: "\f2a5"; }
|
||||
.bi-cloud-haze-fill::before { content: "\f2a6"; }
|
||||
.bi-cloud-haze::before { content: "\f2a7"; }
|
||||
.bi-cloud-haze2-fill::before { content: "\f2a8"; }
|
||||
@@ -1436,21 +1442,16 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-dpad::before { content: "\f687"; }
|
||||
.bi-ear-fill::before { content: "\f688"; }
|
||||
.bi-ear::before { content: "\f689"; }
|
||||
.bi-envelope-check-1::before { content: "\f68a"; }
|
||||
.bi-envelope-check-fill::before { content: "\f68b"; }
|
||||
.bi-envelope-check::before { content: "\f68c"; }
|
||||
.bi-envelope-dash-1::before { content: "\f68d"; }
|
||||
.bi-envelope-dash-fill::before { content: "\f68e"; }
|
||||
.bi-envelope-dash::before { content: "\f68f"; }
|
||||
.bi-envelope-exclamation-1::before { content: "\f690"; }
|
||||
.bi-envelope-exclamation-fill::before { content: "\f691"; }
|
||||
.bi-envelope-exclamation::before { content: "\f692"; }
|
||||
.bi-envelope-plus-fill::before { content: "\f693"; }
|
||||
.bi-envelope-plus::before { content: "\f694"; }
|
||||
.bi-envelope-slash-1::before { content: "\f695"; }
|
||||
.bi-envelope-slash-fill::before { content: "\f696"; }
|
||||
.bi-envelope-slash::before { content: "\f697"; }
|
||||
.bi-envelope-x-1::before { content: "\f698"; }
|
||||
.bi-envelope-x-fill::before { content: "\f699"; }
|
||||
.bi-envelope-x::before { content: "\f69a"; }
|
||||
.bi-explicit-fill::before { content: "\f69b"; }
|
||||
@@ -1460,8 +1461,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-list-columns-reverse::before { content: "\f69f"; }
|
||||
.bi-list-columns::before { content: "\f6a0"; }
|
||||
.bi-meta::before { content: "\f6a1"; }
|
||||
.bi-mortorboard-fill::before { content: "\f6a2"; }
|
||||
.bi-mortorboard::before { content: "\f6a3"; }
|
||||
.bi-nintendo-switch::before { content: "\f6a4"; }
|
||||
.bi-pc-display-horizontal::before { content: "\f6a5"; }
|
||||
.bi-pc-display::before { content: "\f6a6"; }
|
||||
@@ -1480,7 +1479,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-send-check::before { content: "\f6b3"; }
|
||||
.bi-send-dash-fill::before { content: "\f6b4"; }
|
||||
.bi-send-dash::before { content: "\f6b5"; }
|
||||
.bi-send-exclamation-1::before { content: "\f6b6"; }
|
||||
.bi-send-exclamation-fill::before { content: "\f6b7"; }
|
||||
.bi-send-exclamation::before { content: "\f6b8"; }
|
||||
.bi-send-fill::before { content: "\f6b9"; }
|
||||
@@ -1492,7 +1490,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-send-x::before { content: "\f6bf"; }
|
||||
.bi-send::before { content: "\f6c0"; }
|
||||
.bi-steam::before { content: "\f6c1"; }
|
||||
.bi-terminal-dash-1::before { content: "\f6c2"; }
|
||||
.bi-terminal-dash::before { content: "\f6c3"; }
|
||||
.bi-terminal-plus::before { content: "\f6c4"; }
|
||||
.bi-terminal-split::before { content: "\f6c5"; }
|
||||
@@ -1522,7 +1519,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-usb-symbol::before { content: "\f6dd"; }
|
||||
.bi-usb::before { content: "\f6de"; }
|
||||
.bi-boombox-fill::before { content: "\f6df"; }
|
||||
.bi-displayport-1::before { content: "\f6e0"; }
|
||||
.bi-displayport::before { content: "\f6e1"; }
|
||||
.bi-gpu-card::before { content: "\f6e2"; }
|
||||
.bi-memory::before { content: "\f6e3"; }
|
||||
@@ -1535,8 +1531,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-pci-card::before { content: "\f6ea"; }
|
||||
.bi-router-fill::before { content: "\f6eb"; }
|
||||
.bi-router::before { content: "\f6ec"; }
|
||||
.bi-ssd-fill::before { content: "\f6ed"; }
|
||||
.bi-ssd::before { content: "\f6ee"; }
|
||||
.bi-thunderbolt-fill::before { content: "\f6ef"; }
|
||||
.bi-thunderbolt::before { content: "\f6f0"; }
|
||||
.bi-usb-drive-fill::before { content: "\f6f1"; }
|
||||
@@ -1643,7 +1637,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-filetype-pdf::before { content: "\f756"; }
|
||||
.bi-filetype-php::before { content: "\f757"; }
|
||||
.bi-filetype-png::before { content: "\f758"; }
|
||||
.bi-filetype-ppt-1::before { content: "\f759"; }
|
||||
.bi-filetype-ppt::before { content: "\f75a"; }
|
||||
.bi-filetype-psd::before { content: "\f75b"; }
|
||||
.bi-filetype-py::before { content: "\f75c"; }
|
||||
@@ -1659,7 +1652,6 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-filetype-txt::before { content: "\f766"; }
|
||||
.bi-filetype-wav::before { content: "\f767"; }
|
||||
.bi-filetype-woff::before { content: "\f768"; }
|
||||
.bi-filetype-xls-1::before { content: "\f769"; }
|
||||
.bi-filetype-xls::before { content: "\f76a"; }
|
||||
.bi-filetype-xml::before { content: "\f76b"; }
|
||||
.bi-filetype-yml::before { content: "\f76c"; }
|
||||
@@ -1702,3 +1694,385 @@ url("./bootstrap-icons.woff?524846017b983fc8ded9325d94ed40f3") format("woff");
|
||||
.bi-filetype-json::before { content: "\f791"; }
|
||||
.bi-filetype-pptx::before { content: "\f792"; }
|
||||
.bi-filetype-xlsx::before { content: "\f793"; }
|
||||
.bi-1-circle-fill::before { content: "\f796"; }
|
||||
.bi-1-circle::before { content: "\f797"; }
|
||||
.bi-1-square-fill::before { content: "\f798"; }
|
||||
.bi-1-square::before { content: "\f799"; }
|
||||
.bi-2-circle-fill::before { content: "\f79c"; }
|
||||
.bi-2-circle::before { content: "\f79d"; }
|
||||
.bi-2-square-fill::before { content: "\f79e"; }
|
||||
.bi-2-square::before { content: "\f79f"; }
|
||||
.bi-3-circle-fill::before { content: "\f7a2"; }
|
||||
.bi-3-circle::before { content: "\f7a3"; }
|
||||
.bi-3-square-fill::before { content: "\f7a4"; }
|
||||
.bi-3-square::before { content: "\f7a5"; }
|
||||
.bi-4-circle-fill::before { content: "\f7a8"; }
|
||||
.bi-4-circle::before { content: "\f7a9"; }
|
||||
.bi-4-square-fill::before { content: "\f7aa"; }
|
||||
.bi-4-square::before { content: "\f7ab"; }
|
||||
.bi-5-circle-fill::before { content: "\f7ae"; }
|
||||
.bi-5-circle::before { content: "\f7af"; }
|
||||
.bi-5-square-fill::before { content: "\f7b0"; }
|
||||
.bi-5-square::before { content: "\f7b1"; }
|
||||
.bi-6-circle-fill::before { content: "\f7b4"; }
|
||||
.bi-6-circle::before { content: "\f7b5"; }
|
||||
.bi-6-square-fill::before { content: "\f7b6"; }
|
||||
.bi-6-square::before { content: "\f7b7"; }
|
||||
.bi-7-circle-fill::before { content: "\f7ba"; }
|
||||
.bi-7-circle::before { content: "\f7bb"; }
|
||||
.bi-7-square-fill::before { content: "\f7bc"; }
|
||||
.bi-7-square::before { content: "\f7bd"; }
|
||||
.bi-8-circle-fill::before { content: "\f7c0"; }
|
||||
.bi-8-circle::before { content: "\f7c1"; }
|
||||
.bi-8-square-fill::before { content: "\f7c2"; }
|
||||
.bi-8-square::before { content: "\f7c3"; }
|
||||
.bi-9-circle-fill::before { content: "\f7c6"; }
|
||||
.bi-9-circle::before { content: "\f7c7"; }
|
||||
.bi-9-square-fill::before { content: "\f7c8"; }
|
||||
.bi-9-square::before { content: "\f7c9"; }
|
||||
.bi-airplane-engines-fill::before { content: "\f7ca"; }
|
||||
.bi-airplane-engines::before { content: "\f7cb"; }
|
||||
.bi-airplane-fill::before { content: "\f7cc"; }
|
||||
.bi-airplane::before { content: "\f7cd"; }
|
||||
.bi-alexa::before { content: "\f7ce"; }
|
||||
.bi-alipay::before { content: "\f7cf"; }
|
||||
.bi-android::before { content: "\f7d0"; }
|
||||
.bi-android2::before { content: "\f7d1"; }
|
||||
.bi-box-fill::before { content: "\f7d2"; }
|
||||
.bi-box-seam-fill::before { content: "\f7d3"; }
|
||||
.bi-browser-chrome::before { content: "\f7d4"; }
|
||||
.bi-browser-edge::before { content: "\f7d5"; }
|
||||
.bi-browser-firefox::before { content: "\f7d6"; }
|
||||
.bi-browser-safari::before { content: "\f7d7"; }
|
||||
.bi-c-circle-fill::before { content: "\f7da"; }
|
||||
.bi-c-circle::before { content: "\f7db"; }
|
||||
.bi-c-square-fill::before { content: "\f7dc"; }
|
||||
.bi-c-square::before { content: "\f7dd"; }
|
||||
.bi-capsule-pill::before { content: "\f7de"; }
|
||||
.bi-capsule::before { content: "\f7df"; }
|
||||
.bi-car-front-fill::before { content: "\f7e0"; }
|
||||
.bi-car-front::before { content: "\f7e1"; }
|
||||
.bi-cassette-fill::before { content: "\f7e2"; }
|
||||
.bi-cassette::before { content: "\f7e3"; }
|
||||
.bi-cc-circle-fill::before { content: "\f7e6"; }
|
||||
.bi-cc-circle::before { content: "\f7e7"; }
|
||||
.bi-cc-square-fill::before { content: "\f7e8"; }
|
||||
.bi-cc-square::before { content: "\f7e9"; }
|
||||
.bi-cup-hot-fill::before { content: "\f7ea"; }
|
||||
.bi-cup-hot::before { content: "\f7eb"; }
|
||||
.bi-currency-rupee::before { content: "\f7ec"; }
|
||||
.bi-dropbox::before { content: "\f7ed"; }
|
||||
.bi-escape::before { content: "\f7ee"; }
|
||||
.bi-fast-forward-btn-fill::before { content: "\f7ef"; }
|
||||
.bi-fast-forward-btn::before { content: "\f7f0"; }
|
||||
.bi-fast-forward-circle-fill::before { content: "\f7f1"; }
|
||||
.bi-fast-forward-circle::before { content: "\f7f2"; }
|
||||
.bi-fast-forward-fill::before { content: "\f7f3"; }
|
||||
.bi-fast-forward::before { content: "\f7f4"; }
|
||||
.bi-filetype-sql::before { content: "\f7f5"; }
|
||||
.bi-fire::before { content: "\f7f6"; }
|
||||
.bi-google-play::before { content: "\f7f7"; }
|
||||
.bi-h-circle-fill::before { content: "\f7fa"; }
|
||||
.bi-h-circle::before { content: "\f7fb"; }
|
||||
.bi-h-square-fill::before { content: "\f7fc"; }
|
||||
.bi-h-square::before { content: "\f7fd"; }
|
||||
.bi-indent::before { content: "\f7fe"; }
|
||||
.bi-lungs-fill::before { content: "\f7ff"; }
|
||||
.bi-lungs::before { content: "\f800"; }
|
||||
.bi-microsoft-teams::before { content: "\f801"; }
|
||||
.bi-p-circle-fill::before { content: "\f804"; }
|
||||
.bi-p-circle::before { content: "\f805"; }
|
||||
.bi-p-square-fill::before { content: "\f806"; }
|
||||
.bi-p-square::before { content: "\f807"; }
|
||||
.bi-pass-fill::before { content: "\f808"; }
|
||||
.bi-pass::before { content: "\f809"; }
|
||||
.bi-prescription::before { content: "\f80a"; }
|
||||
.bi-prescription2::before { content: "\f80b"; }
|
||||
.bi-r-circle-fill::before { content: "\f80e"; }
|
||||
.bi-r-circle::before { content: "\f80f"; }
|
||||
.bi-r-square-fill::before { content: "\f810"; }
|
||||
.bi-r-square::before { content: "\f811"; }
|
||||
.bi-repeat-1::before { content: "\f812"; }
|
||||
.bi-repeat::before { content: "\f813"; }
|
||||
.bi-rewind-btn-fill::before { content: "\f814"; }
|
||||
.bi-rewind-btn::before { content: "\f815"; }
|
||||
.bi-rewind-circle-fill::before { content: "\f816"; }
|
||||
.bi-rewind-circle::before { content: "\f817"; }
|
||||
.bi-rewind-fill::before { content: "\f818"; }
|
||||
.bi-rewind::before { content: "\f819"; }
|
||||
.bi-train-freight-front-fill::before { content: "\f81a"; }
|
||||
.bi-train-freight-front::before { content: "\f81b"; }
|
||||
.bi-train-front-fill::before { content: "\f81c"; }
|
||||
.bi-train-front::before { content: "\f81d"; }
|
||||
.bi-train-lightrail-front-fill::before { content: "\f81e"; }
|
||||
.bi-train-lightrail-front::before { content: "\f81f"; }
|
||||
.bi-truck-front-fill::before { content: "\f820"; }
|
||||
.bi-truck-front::before { content: "\f821"; }
|
||||
.bi-ubuntu::before { content: "\f822"; }
|
||||
.bi-unindent::before { content: "\f823"; }
|
||||
.bi-unity::before { content: "\f824"; }
|
||||
.bi-universal-access-circle::before { content: "\f825"; }
|
||||
.bi-universal-access::before { content: "\f826"; }
|
||||
.bi-virus::before { content: "\f827"; }
|
||||
.bi-virus2::before { content: "\f828"; }
|
||||
.bi-wechat::before { content: "\f829"; }
|
||||
.bi-yelp::before { content: "\f82a"; }
|
||||
.bi-sign-stop-fill::before { content: "\f82b"; }
|
||||
.bi-sign-stop-lights-fill::before { content: "\f82c"; }
|
||||
.bi-sign-stop-lights::before { content: "\f82d"; }
|
||||
.bi-sign-stop::before { content: "\f82e"; }
|
||||
.bi-sign-turn-left-fill::before { content: "\f82f"; }
|
||||
.bi-sign-turn-left::before { content: "\f830"; }
|
||||
.bi-sign-turn-right-fill::before { content: "\f831"; }
|
||||
.bi-sign-turn-right::before { content: "\f832"; }
|
||||
.bi-sign-turn-slight-left-fill::before { content: "\f833"; }
|
||||
.bi-sign-turn-slight-left::before { content: "\f834"; }
|
||||
.bi-sign-turn-slight-right-fill::before { content: "\f835"; }
|
||||
.bi-sign-turn-slight-right::before { content: "\f836"; }
|
||||
.bi-sign-yield-fill::before { content: "\f837"; }
|
||||
.bi-sign-yield::before { content: "\f838"; }
|
||||
.bi-ev-station-fill::before { content: "\f839"; }
|
||||
.bi-ev-station::before { content: "\f83a"; }
|
||||
.bi-fuel-pump-diesel-fill::before { content: "\f83b"; }
|
||||
.bi-fuel-pump-diesel::before { content: "\f83c"; }
|
||||
.bi-fuel-pump-fill::before { content: "\f83d"; }
|
||||
.bi-fuel-pump::before { content: "\f83e"; }
|
||||
.bi-0-circle-fill::before { content: "\f83f"; }
|
||||
.bi-0-circle::before { content: "\f840"; }
|
||||
.bi-0-square-fill::before { content: "\f841"; }
|
||||
.bi-0-square::before { content: "\f842"; }
|
||||
.bi-rocket-fill::before { content: "\f843"; }
|
||||
.bi-rocket-takeoff-fill::before { content: "\f844"; }
|
||||
.bi-rocket-takeoff::before { content: "\f845"; }
|
||||
.bi-rocket::before { content: "\f846"; }
|
||||
.bi-stripe::before { content: "\f847"; }
|
||||
.bi-subscript::before { content: "\f848"; }
|
||||
.bi-superscript::before { content: "\f849"; }
|
||||
.bi-trello::before { content: "\f84a"; }
|
||||
.bi-envelope-at-fill::before { content: "\f84b"; }
|
||||
.bi-envelope-at::before { content: "\f84c"; }
|
||||
.bi-regex::before { content: "\f84d"; }
|
||||
.bi-text-wrap::before { content: "\f84e"; }
|
||||
.bi-sign-dead-end-fill::before { content: "\f84f"; }
|
||||
.bi-sign-dead-end::before { content: "\f850"; }
|
||||
.bi-sign-do-not-enter-fill::before { content: "\f851"; }
|
||||
.bi-sign-do-not-enter::before { content: "\f852"; }
|
||||
.bi-sign-intersection-fill::before { content: "\f853"; }
|
||||
.bi-sign-intersection-side-fill::before { content: "\f854"; }
|
||||
.bi-sign-intersection-side::before { content: "\f855"; }
|
||||
.bi-sign-intersection-t-fill::before { content: "\f856"; }
|
||||
.bi-sign-intersection-t::before { content: "\f857"; }
|
||||
.bi-sign-intersection-y-fill::before { content: "\f858"; }
|
||||
.bi-sign-intersection-y::before { content: "\f859"; }
|
||||
.bi-sign-intersection::before { content: "\f85a"; }
|
||||
.bi-sign-merge-left-fill::before { content: "\f85b"; }
|
||||
.bi-sign-merge-left::before { content: "\f85c"; }
|
||||
.bi-sign-merge-right-fill::before { content: "\f85d"; }
|
||||
.bi-sign-merge-right::before { content: "\f85e"; }
|
||||
.bi-sign-no-left-turn-fill::before { content: "\f85f"; }
|
||||
.bi-sign-no-left-turn::before { content: "\f860"; }
|
||||
.bi-sign-no-parking-fill::before { content: "\f861"; }
|
||||
.bi-sign-no-parking::before { content: "\f862"; }
|
||||
.bi-sign-no-right-turn-fill::before { content: "\f863"; }
|
||||
.bi-sign-no-right-turn::before { content: "\f864"; }
|
||||
.bi-sign-railroad-fill::before { content: "\f865"; }
|
||||
.bi-sign-railroad::before { content: "\f866"; }
|
||||
.bi-building-add::before { content: "\f867"; }
|
||||
.bi-building-check::before { content: "\f868"; }
|
||||
.bi-building-dash::before { content: "\f869"; }
|
||||
.bi-building-down::before { content: "\f86a"; }
|
||||
.bi-building-exclamation::before { content: "\f86b"; }
|
||||
.bi-building-fill-add::before { content: "\f86c"; }
|
||||
.bi-building-fill-check::before { content: "\f86d"; }
|
||||
.bi-building-fill-dash::before { content: "\f86e"; }
|
||||
.bi-building-fill-down::before { content: "\f86f"; }
|
||||
.bi-building-fill-exclamation::before { content: "\f870"; }
|
||||
.bi-building-fill-gear::before { content: "\f871"; }
|
||||
.bi-building-fill-lock::before { content: "\f872"; }
|
||||
.bi-building-fill-slash::before { content: "\f873"; }
|
||||
.bi-building-fill-up::before { content: "\f874"; }
|
||||
.bi-building-fill-x::before { content: "\f875"; }
|
||||
.bi-building-fill::before { content: "\f876"; }
|
||||
.bi-building-gear::before { content: "\f877"; }
|
||||
.bi-building-lock::before { content: "\f878"; }
|
||||
.bi-building-slash::before { content: "\f879"; }
|
||||
.bi-building-up::before { content: "\f87a"; }
|
||||
.bi-building-x::before { content: "\f87b"; }
|
||||
.bi-buildings-fill::before { content: "\f87c"; }
|
||||
.bi-buildings::before { content: "\f87d"; }
|
||||
.bi-bus-front-fill::before { content: "\f87e"; }
|
||||
.bi-bus-front::before { content: "\f87f"; }
|
||||
.bi-ev-front-fill::before { content: "\f880"; }
|
||||
.bi-ev-front::before { content: "\f881"; }
|
||||
.bi-globe-americas::before { content: "\f882"; }
|
||||
.bi-globe-asia-australia::before { content: "\f883"; }
|
||||
.bi-globe-central-south-asia::before { content: "\f884"; }
|
||||
.bi-globe-europe-africa::before { content: "\f885"; }
|
||||
.bi-house-add-fill::before { content: "\f886"; }
|
||||
.bi-house-add::before { content: "\f887"; }
|
||||
.bi-house-check-fill::before { content: "\f888"; }
|
||||
.bi-house-check::before { content: "\f889"; }
|
||||
.bi-house-dash-fill::before { content: "\f88a"; }
|
||||
.bi-house-dash::before { content: "\f88b"; }
|
||||
.bi-house-down-fill::before { content: "\f88c"; }
|
||||
.bi-house-down::before { content: "\f88d"; }
|
||||
.bi-house-exclamation-fill::before { content: "\f88e"; }
|
||||
.bi-house-exclamation::before { content: "\f88f"; }
|
||||
.bi-house-gear-fill::before { content: "\f890"; }
|
||||
.bi-house-gear::before { content: "\f891"; }
|
||||
.bi-house-lock-fill::before { content: "\f892"; }
|
||||
.bi-house-lock::before { content: "\f893"; }
|
||||
.bi-house-slash-fill::before { content: "\f894"; }
|
||||
.bi-house-slash::before { content: "\f895"; }
|
||||
.bi-house-up-fill::before { content: "\f896"; }
|
||||
.bi-house-up::before { content: "\f897"; }
|
||||
.bi-house-x-fill::before { content: "\f898"; }
|
||||
.bi-house-x::before { content: "\f899"; }
|
||||
.bi-person-add::before { content: "\f89a"; }
|
||||
.bi-person-down::before { content: "\f89b"; }
|
||||
.bi-person-exclamation::before { content: "\f89c"; }
|
||||
.bi-person-fill-add::before { content: "\f89d"; }
|
||||
.bi-person-fill-check::before { content: "\f89e"; }
|
||||
.bi-person-fill-dash::before { content: "\f89f"; }
|
||||
.bi-person-fill-down::before { content: "\f8a0"; }
|
||||
.bi-person-fill-exclamation::before { content: "\f8a1"; }
|
||||
.bi-person-fill-gear::before { content: "\f8a2"; }
|
||||
.bi-person-fill-lock::before { content: "\f8a3"; }
|
||||
.bi-person-fill-slash::before { content: "\f8a4"; }
|
||||
.bi-person-fill-up::before { content: "\f8a5"; }
|
||||
.bi-person-fill-x::before { content: "\f8a6"; }
|
||||
.bi-person-gear::before { content: "\f8a7"; }
|
||||
.bi-person-lock::before { content: "\f8a8"; }
|
||||
.bi-person-slash::before { content: "\f8a9"; }
|
||||
.bi-person-up::before { content: "\f8aa"; }
|
||||
.bi-scooter::before { content: "\f8ab"; }
|
||||
.bi-taxi-front-fill::before { content: "\f8ac"; }
|
||||
.bi-taxi-front::before { content: "\f8ad"; }
|
||||
.bi-amd::before { content: "\f8ae"; }
|
||||
.bi-database-add::before { content: "\f8af"; }
|
||||
.bi-database-check::before { content: "\f8b0"; }
|
||||
.bi-database-dash::before { content: "\f8b1"; }
|
||||
.bi-database-down::before { content: "\f8b2"; }
|
||||
.bi-database-exclamation::before { content: "\f8b3"; }
|
||||
.bi-database-fill-add::before { content: "\f8b4"; }
|
||||
.bi-database-fill-check::before { content: "\f8b5"; }
|
||||
.bi-database-fill-dash::before { content: "\f8b6"; }
|
||||
.bi-database-fill-down::before { content: "\f8b7"; }
|
||||
.bi-database-fill-exclamation::before { content: "\f8b8"; }
|
||||
.bi-database-fill-gear::before { content: "\f8b9"; }
|
||||
.bi-database-fill-lock::before { content: "\f8ba"; }
|
||||
.bi-database-fill-slash::before { content: "\f8bb"; }
|
||||
.bi-database-fill-up::before { content: "\f8bc"; }
|
||||
.bi-database-fill-x::before { content: "\f8bd"; }
|
||||
.bi-database-fill::before { content: "\f8be"; }
|
||||
.bi-database-gear::before { content: "\f8bf"; }
|
||||
.bi-database-lock::before { content: "\f8c0"; }
|
||||
.bi-database-slash::before { content: "\f8c1"; }
|
||||
.bi-database-up::before { content: "\f8c2"; }
|
||||
.bi-database-x::before { content: "\f8c3"; }
|
||||
.bi-database::before { content: "\f8c4"; }
|
||||
.bi-houses-fill::before { content: "\f8c5"; }
|
||||
.bi-houses::before { content: "\f8c6"; }
|
||||
.bi-nvidia::before { content: "\f8c7"; }
|
||||
.bi-person-vcard-fill::before { content: "\f8c8"; }
|
||||
.bi-person-vcard::before { content: "\f8c9"; }
|
||||
.bi-sina-weibo::before { content: "\f8ca"; }
|
||||
.bi-tencent-qq::before { content: "\f8cb"; }
|
||||
.bi-wikipedia::before { content: "\f8cc"; }
|
||||
.bi-alphabet-uppercase::before { content: "\f2a5"; }
|
||||
.bi-alphabet::before { content: "\f68a"; }
|
||||
.bi-amazon::before { content: "\f68d"; }
|
||||
.bi-arrows-collapse-vertical::before { content: "\f690"; }
|
||||
.bi-arrows-expand-vertical::before { content: "\f695"; }
|
||||
.bi-arrows-vertical::before { content: "\f698"; }
|
||||
.bi-arrows::before { content: "\f6a2"; }
|
||||
.bi-ban-fill::before { content: "\f6a3"; }
|
||||
.bi-ban::before { content: "\f6b6"; }
|
||||
.bi-bing::before { content: "\f6c2"; }
|
||||
.bi-cake::before { content: "\f6e0"; }
|
||||
.bi-cake2::before { content: "\f6ed"; }
|
||||
.bi-cookie::before { content: "\f6ee"; }
|
||||
.bi-copy::before { content: "\f759"; }
|
||||
.bi-crosshair::before { content: "\f769"; }
|
||||
.bi-crosshair2::before { content: "\f794"; }
|
||||
.bi-emoji-astonished-fill::before { content: "\f795"; }
|
||||
.bi-emoji-astonished::before { content: "\f79a"; }
|
||||
.bi-emoji-grimace-fill::before { content: "\f79b"; }
|
||||
.bi-emoji-grimace::before { content: "\f7a0"; }
|
||||
.bi-emoji-grin-fill::before { content: "\f7a1"; }
|
||||
.bi-emoji-grin::before { content: "\f7a6"; }
|
||||
.bi-emoji-surprise-fill::before { content: "\f7a7"; }
|
||||
.bi-emoji-surprise::before { content: "\f7ac"; }
|
||||
.bi-emoji-tear-fill::before { content: "\f7ad"; }
|
||||
.bi-emoji-tear::before { content: "\f7b2"; }
|
||||
.bi-envelope-arrow-down-fill::before { content: "\f7b3"; }
|
||||
.bi-envelope-arrow-down::before { content: "\f7b8"; }
|
||||
.bi-envelope-arrow-up-fill::before { content: "\f7b9"; }
|
||||
.bi-envelope-arrow-up::before { content: "\f7be"; }
|
||||
.bi-feather::before { content: "\f7bf"; }
|
||||
.bi-feather2::before { content: "\f7c4"; }
|
||||
.bi-floppy-fill::before { content: "\f7c5"; }
|
||||
.bi-floppy::before { content: "\f7d8"; }
|
||||
.bi-floppy2-fill::before { content: "\f7d9"; }
|
||||
.bi-floppy2::before { content: "\f7e4"; }
|
||||
.bi-gitlab::before { content: "\f7e5"; }
|
||||
.bi-highlighter::before { content: "\f7f8"; }
|
||||
.bi-marker-tip::before { content: "\f802"; }
|
||||
.bi-nvme-fill::before { content: "\f803"; }
|
||||
.bi-nvme::before { content: "\f80c"; }
|
||||
.bi-opencollective::before { content: "\f80d"; }
|
||||
.bi-pci-card-network::before { content: "\f8cd"; }
|
||||
.bi-pci-card-sound::before { content: "\f8ce"; }
|
||||
.bi-radar::before { content: "\f8cf"; }
|
||||
.bi-send-arrow-down-fill::before { content: "\f8d0"; }
|
||||
.bi-send-arrow-down::before { content: "\f8d1"; }
|
||||
.bi-send-arrow-up-fill::before { content: "\f8d2"; }
|
||||
.bi-send-arrow-up::before { content: "\f8d3"; }
|
||||
.bi-sim-slash-fill::before { content: "\f8d4"; }
|
||||
.bi-sim-slash::before { content: "\f8d5"; }
|
||||
.bi-sourceforge::before { content: "\f8d6"; }
|
||||
.bi-substack::before { content: "\f8d7"; }
|
||||
.bi-threads-fill::before { content: "\f8d8"; }
|
||||
.bi-threads::before { content: "\f8d9"; }
|
||||
.bi-transparency::before { content: "\f8da"; }
|
||||
.bi-twitter-x::before { content: "\f8db"; }
|
||||
.bi-type-h4::before { content: "\f8dc"; }
|
||||
.bi-type-h5::before { content: "\f8dd"; }
|
||||
.bi-type-h6::before { content: "\f8de"; }
|
||||
.bi-backpack-fill::before { content: "\f8df"; }
|
||||
.bi-backpack::before { content: "\f8e0"; }
|
||||
.bi-backpack2-fill::before { content: "\f8e1"; }
|
||||
.bi-backpack2::before { content: "\f8e2"; }
|
||||
.bi-backpack3-fill::before { content: "\f8e3"; }
|
||||
.bi-backpack3::before { content: "\f8e4"; }
|
||||
.bi-backpack4-fill::before { content: "\f8e5"; }
|
||||
.bi-backpack4::before { content: "\f8e6"; }
|
||||
.bi-brilliance::before { content: "\f8e7"; }
|
||||
.bi-cake-fill::before { content: "\f8e8"; }
|
||||
.bi-cake2-fill::before { content: "\f8e9"; }
|
||||
.bi-duffle-fill::before { content: "\f8ea"; }
|
||||
.bi-duffle::before { content: "\f8eb"; }
|
||||
.bi-exposure::before { content: "\f8ec"; }
|
||||
.bi-gender-neuter::before { content: "\f8ed"; }
|
||||
.bi-highlights::before { content: "\f8ee"; }
|
||||
.bi-luggage-fill::before { content: "\f8ef"; }
|
||||
.bi-luggage::before { content: "\f8f0"; }
|
||||
.bi-mailbox-flag::before { content: "\f8f1"; }
|
||||
.bi-mailbox2-flag::before { content: "\f8f2"; }
|
||||
.bi-noise-reduction::before { content: "\f8f3"; }
|
||||
.bi-passport-fill::before { content: "\f8f4"; }
|
||||
.bi-passport::before { content: "\f8f5"; }
|
||||
.bi-person-arms-up::before { content: "\f8f6"; }
|
||||
.bi-person-raised-hand::before { content: "\f8f7"; }
|
||||
.bi-person-standing-dress::before { content: "\f8f8"; }
|
||||
.bi-person-standing::before { content: "\f8f9"; }
|
||||
.bi-person-walking::before { content: "\f8fa"; }
|
||||
.bi-person-wheelchair::before { content: "\f8fb"; }
|
||||
.bi-shadows::before { content: "\f8fc"; }
|
||||
.bi-suitcase-fill::before { content: "\f8fd"; }
|
||||
.bi-suitcase-lg-fill::before { content: "\f8fe"; }
|
||||
.bi-suitcase-lg::before { content: "\f8ff"; }
|
||||
.bi-suitcase::before { content: "\f900"; }
|
||||
.bi-suitcase2-fill::before { content: "\f901"; }
|
||||
.bi-suitcase2::before { content: "\f902"; }
|
||||
.bi-vignette::before { content: "\f903"; }
|
||||
|
||||
Binary file not shown.
+7
-5
File diff suppressed because one or more lines are too long
+3
-3
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+9
-5
@@ -432,6 +432,8 @@ HTMLWidgets.widget({
|
||||
regex = options.search.regex,
|
||||
ci = options.search.caseInsensitive !== false;
|
||||
}
|
||||
// need to transpose the column index when colReorder is enabled
|
||||
if (table.colReorder) i = table.colReorder.transpose(i);
|
||||
return table.column(i).search(value, regex, !regex, ci);
|
||||
};
|
||||
|
||||
@@ -493,7 +495,9 @@ HTMLWidgets.widget({
|
||||
$input.parent().hide(); $x.show().trigger('show'); filter[0].selectize.focus();
|
||||
},
|
||||
input: function() {
|
||||
if ($input.val() === '') filter[0].selectize.setValue([]);
|
||||
var v1 = JSON.stringify(filter[0].selectize.getValue()), v2 = $input.val();
|
||||
if (v1 === '[]') v1 = '';
|
||||
if (v1 !== v2) filter[0].selectize.setValue(v2 === '' ? [] : JSON.parse(v2));
|
||||
}
|
||||
});
|
||||
var $input2 = $x.children('select');
|
||||
@@ -509,7 +513,7 @@ HTMLWidgets.widget({
|
||||
if (value.length) $input.trigger('input');
|
||||
$input.attr('title', $input.val());
|
||||
if (server) {
|
||||
table.column(i).search(value.length ? JSON.stringify(value) : '').draw();
|
||||
searchColumn(i, value.length ? JSON.stringify(value) : '').draw();
|
||||
return;
|
||||
}
|
||||
// turn off filter if nothing selected
|
||||
@@ -680,7 +684,7 @@ HTMLWidgets.widget({
|
||||
updateSliderText(val[0], val[1]);
|
||||
if (e.type === 'slide') return; // no searching when sliding only
|
||||
if (server) {
|
||||
table.column(i).search($td.data('filter') ? ival : '').draw();
|
||||
searchColumn(i, $td.data('filter') ? ival : '').draw();
|
||||
return;
|
||||
}
|
||||
table.draw();
|
||||
@@ -1370,7 +1374,7 @@ HTMLWidgets.widget({
|
||||
changeInput('cell_clicked', {});
|
||||
|
||||
// do not trigger table selection when clicking on links unless they have classes
|
||||
table.on('click.dt', 'tbody td a', function(e) {
|
||||
table.on('mousedown.dt', 'tbody td a', function(e) {
|
||||
if (this.className === '') e.stopPropagation();
|
||||
});
|
||||
|
||||
@@ -1398,7 +1402,7 @@ HTMLWidgets.widget({
|
||||
console.log('The search keyword for column ' + i + ' is undefined')
|
||||
return;
|
||||
}
|
||||
$(td).find('input').first().val(v);
|
||||
$(td).find('input').first().val(v).trigger('input');
|
||||
searchColumn(i, v);
|
||||
});
|
||||
table.draw();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3
-3
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
@@ -55,62 +55,85 @@ div.sourceCode pre.sourceCode {
|
||||
|
||||
code span.ot {
|
||||
color: #003B4F;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.at {
|
||||
color: #657422;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.ss {
|
||||
color: #20794D;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.an {
|
||||
color: #5E5E5E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.fu {
|
||||
color: #4758AB;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.st {
|
||||
color: #20794D;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.cf {
|
||||
color: #003B4F;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.op {
|
||||
color: #5E5E5E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.er {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.bn {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.al {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.va {
|
||||
color: #111111;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.bu {
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.ex {
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.pp {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.in {
|
||||
color: #5E5E5E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.vs {
|
||||
color: #20794D;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.wa {
|
||||
@@ -125,22 +148,27 @@ code span.do {
|
||||
|
||||
code span.im {
|
||||
color: #00769E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.ch {
|
||||
color: #20794D;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.dt {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.fl {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.co {
|
||||
color: #5E5E5E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.cv {
|
||||
@@ -150,18 +178,22 @@ code span.cv {
|
||||
|
||||
code span.cn {
|
||||
color: #8f5902;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.sc {
|
||||
color: #5E5E5E;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.dv {
|
||||
color: #AD0000;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
code span.kw {
|
||||
color: #003B4F;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
.prevent-inlining {
|
||||
|
||||
@@ -5,7 +5,49 @@ const sectionChanged = new CustomEvent("quarto-sectionChanged", {
|
||||
composed: false,
|
||||
});
|
||||
|
||||
const layoutMarginEls = () => {
|
||||
// Find any conflicting margin elements and add margins to the
|
||||
// top to prevent overlap
|
||||
const marginChildren = window.document.querySelectorAll(
|
||||
".column-margin.column-container > *, .margin-caption, .aside"
|
||||
);
|
||||
|
||||
let lastBottom = 0;
|
||||
for (const marginChild of marginChildren) {
|
||||
if (marginChild.offsetParent !== null) {
|
||||
// clear the top margin so we recompute it
|
||||
marginChild.style.marginTop = null;
|
||||
const top = marginChild.getBoundingClientRect().top + window.scrollY;
|
||||
if (top < lastBottom) {
|
||||
const marginChildStyle = window.getComputedStyle(marginChild);
|
||||
const marginBottom = parseFloat(marginChildStyle["marginBottom"]);
|
||||
const margin = lastBottom - top + marginBottom;
|
||||
marginChild.style.marginTop = `${margin}px`;
|
||||
}
|
||||
const styles = window.getComputedStyle(marginChild);
|
||||
const marginTop = parseFloat(styles["marginTop"]);
|
||||
lastBottom = top + marginChild.getBoundingClientRect().height + marginTop;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
// Recompute the position of margin elements anytime the body size changes
|
||||
if (window.ResizeObserver) {
|
||||
const resizeObserver = new window.ResizeObserver(
|
||||
throttle(() => {
|
||||
layoutMarginEls();
|
||||
if (
|
||||
window.document.body.getBoundingClientRect().width < 990 &&
|
||||
isReaderMode()
|
||||
) {
|
||||
quartoToggleReader();
|
||||
}
|
||||
}, 50)
|
||||
);
|
||||
resizeObserver.observe(window.document.body);
|
||||
}
|
||||
|
||||
const tocEl = window.document.querySelector('nav.toc-active[role="doc-toc"]');
|
||||
const sidebarEl = window.document.getElementById("quarto-sidebar");
|
||||
const leftTocEl = window.document.getElementById("quarto-sidebar-toc-left");
|
||||
@@ -259,6 +301,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
|
||||
const manageSidebarVisiblity = (el, placeholderDescriptor) => {
|
||||
let isVisible = true;
|
||||
let elRect;
|
||||
|
||||
return (hiddenRegions) => {
|
||||
if (el === null) {
|
||||
@@ -269,11 +312,6 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
const lastChildEl = el.lastElementChild;
|
||||
|
||||
if (lastChildEl) {
|
||||
// Find the top and bottom o the element that is being managed
|
||||
const elTop = el.offsetTop;
|
||||
const elBottom =
|
||||
elTop + lastChildEl.offsetTop + lastChildEl.offsetHeight;
|
||||
|
||||
// Converts the sidebar to a menu
|
||||
const convertToMenu = () => {
|
||||
for (const child of el.children) {
|
||||
@@ -281,100 +319,112 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
child.style.overflow = "hidden";
|
||||
}
|
||||
|
||||
const toggleContainer = window.document.createElement("div");
|
||||
toggleContainer.style.width = "100%";
|
||||
toggleContainer.classList.add("zindex-over-content");
|
||||
toggleContainer.classList.add("quarto-sidebar-toggle");
|
||||
toggleContainer.classList.add("headroom-target"); // Marks this to be managed by headeroom
|
||||
toggleContainer.id = placeholderDescriptor.id;
|
||||
toggleContainer.style.position = "fixed";
|
||||
nexttick(() => {
|
||||
const toggleContainer = window.document.createElement("div");
|
||||
toggleContainer.style.width = "100%";
|
||||
toggleContainer.classList.add("zindex-over-content");
|
||||
toggleContainer.classList.add("quarto-sidebar-toggle");
|
||||
toggleContainer.classList.add("headroom-target"); // Marks this to be managed by headeroom
|
||||
toggleContainer.id = placeholderDescriptor.id;
|
||||
toggleContainer.style.position = "fixed";
|
||||
|
||||
const toggleIcon = window.document.createElement("i");
|
||||
toggleIcon.classList.add("quarto-sidebar-toggle-icon");
|
||||
toggleIcon.classList.add("bi");
|
||||
toggleIcon.classList.add("bi-caret-down-fill");
|
||||
const toggleIcon = window.document.createElement("i");
|
||||
toggleIcon.classList.add("quarto-sidebar-toggle-icon");
|
||||
toggleIcon.classList.add("bi");
|
||||
toggleIcon.classList.add("bi-caret-down-fill");
|
||||
|
||||
const toggleTitle = window.document.createElement("div");
|
||||
const titleEl = window.document.body.querySelector(
|
||||
placeholderDescriptor.titleSelector
|
||||
);
|
||||
if (titleEl) {
|
||||
toggleTitle.append(titleEl.innerText, toggleIcon);
|
||||
}
|
||||
toggleTitle.classList.add("zindex-over-content");
|
||||
toggleTitle.classList.add("quarto-sidebar-toggle-title");
|
||||
toggleContainer.append(toggleTitle);
|
||||
|
||||
const toggleContents = window.document.createElement("div");
|
||||
toggleContents.classList = el.classList;
|
||||
toggleContents.classList.add("zindex-over-content");
|
||||
toggleContents.classList.add("quarto-sidebar-toggle-contents");
|
||||
for (const child of el.children) {
|
||||
if (child.id === "toc-title") {
|
||||
continue;
|
||||
const toggleTitle = window.document.createElement("div");
|
||||
const titleEl = window.document.body.querySelector(
|
||||
placeholderDescriptor.titleSelector
|
||||
);
|
||||
if (titleEl) {
|
||||
toggleTitle.append(
|
||||
titleEl.textContent || titleEl.innerText,
|
||||
toggleIcon
|
||||
);
|
||||
}
|
||||
toggleTitle.classList.add("zindex-over-content");
|
||||
toggleTitle.classList.add("quarto-sidebar-toggle-title");
|
||||
toggleContainer.append(toggleTitle);
|
||||
|
||||
const clone = child.cloneNode(true);
|
||||
clone.style.opacity = 1;
|
||||
clone.style.display = null;
|
||||
toggleContents.append(clone);
|
||||
}
|
||||
toggleContents.style.height = "0px";
|
||||
toggleContainer.append(toggleContents);
|
||||
el.parentElement.prepend(toggleContainer);
|
||||
const toggleContents = window.document.createElement("div");
|
||||
toggleContents.classList = el.classList;
|
||||
toggleContents.classList.add("zindex-over-content");
|
||||
toggleContents.classList.add("quarto-sidebar-toggle-contents");
|
||||
for (const child of el.children) {
|
||||
if (child.id === "toc-title") {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process clicks
|
||||
let tocShowing = false;
|
||||
// Allow the caller to control whether this is dismissed
|
||||
// when it is clicked (e.g. sidebar navigation supports
|
||||
// opening and closing the nav tree, so don't dismiss on click)
|
||||
const clickEl = placeholderDescriptor.dismissOnClick
|
||||
? toggleContainer
|
||||
: toggleTitle;
|
||||
|
||||
const closeToggle = () => {
|
||||
if (tocShowing) {
|
||||
toggleContainer.classList.remove("expanded");
|
||||
toggleContents.style.height = "0px";
|
||||
tocShowing = false;
|
||||
const clone = child.cloneNode(true);
|
||||
clone.style.opacity = 1;
|
||||
clone.style.display = null;
|
||||
toggleContents.append(clone);
|
||||
}
|
||||
};
|
||||
toggleContents.style.height = "0px";
|
||||
const positionToggle = () => {
|
||||
// position the element (top left of parent, same width as parent)
|
||||
if (!elRect) {
|
||||
elRect = el.getBoundingClientRect();
|
||||
}
|
||||
toggleContainer.style.left = `${elRect.left}px`;
|
||||
toggleContainer.style.top = `${elRect.top}px`;
|
||||
toggleContainer.style.width = `${elRect.width}px`;
|
||||
};
|
||||
positionToggle();
|
||||
|
||||
const positionToggle = () => {
|
||||
// position the element (top left of parent, same width as parent)
|
||||
const elRect = el.getBoundingClientRect();
|
||||
toggleContainer.style.left = `${elRect.left}px`;
|
||||
toggleContainer.style.top = `${elRect.top}px`;
|
||||
toggleContainer.style.width = `${elRect.width}px`;
|
||||
};
|
||||
toggleContainer.append(toggleContents);
|
||||
el.parentElement.prepend(toggleContainer);
|
||||
|
||||
// Get rid of any expanded toggle if the user scrolls
|
||||
window.document.addEventListener(
|
||||
"scroll",
|
||||
throttle(() => {
|
||||
closeToggle();
|
||||
}, 50)
|
||||
);
|
||||
// Process clicks
|
||||
let tocShowing = false;
|
||||
// Allow the caller to control whether this is dismissed
|
||||
// when it is clicked (e.g. sidebar navigation supports
|
||||
// opening and closing the nav tree, so don't dismiss on click)
|
||||
const clickEl = placeholderDescriptor.dismissOnClick
|
||||
? toggleContainer
|
||||
: toggleTitle;
|
||||
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
positionToggle();
|
||||
}, 50)
|
||||
);
|
||||
positionToggle();
|
||||
const closeToggle = () => {
|
||||
if (tocShowing) {
|
||||
toggleContainer.classList.remove("expanded");
|
||||
toggleContents.style.height = "0px";
|
||||
tocShowing = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Process the click
|
||||
clickEl.onclick = () => {
|
||||
if (!tocShowing) {
|
||||
toggleContainer.classList.add("expanded");
|
||||
toggleContents.style.height = null;
|
||||
tocShowing = true;
|
||||
} else {
|
||||
closeToggle();
|
||||
}
|
||||
};
|
||||
// Get rid of any expanded toggle if the user scrolls
|
||||
window.document.addEventListener(
|
||||
"scroll",
|
||||
throttle(() => {
|
||||
closeToggle();
|
||||
}, 50)
|
||||
);
|
||||
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
positionToggle();
|
||||
}, 50)
|
||||
);
|
||||
|
||||
window.addEventListener("quarto-hrChanged", () => {
|
||||
elRect = undefined;
|
||||
});
|
||||
|
||||
// Process the click
|
||||
clickEl.onclick = () => {
|
||||
if (!tocShowing) {
|
||||
toggleContainer.classList.add("expanded");
|
||||
toggleContents.style.height = null;
|
||||
tocShowing = true;
|
||||
} else {
|
||||
closeToggle();
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
// Converts a sidebar from a menu back to a sidebar
|
||||
@@ -398,6 +448,11 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
convertToMenu();
|
||||
isVisible = false;
|
||||
} else {
|
||||
// Find the top and bottom o the element that is being managed
|
||||
const elTop = el.offsetTop;
|
||||
const elBottom =
|
||||
elTop + lastChildEl.offsetTop + lastChildEl.offsetHeight;
|
||||
|
||||
if (!isVisible) {
|
||||
// If the element is current not visible reveal if there are
|
||||
// no conflicts with overlay regions
|
||||
@@ -418,26 +473,51 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
};
|
||||
};
|
||||
|
||||
// Find any conflicting margin elements and add margins to the
|
||||
// top to prevent overlap
|
||||
const marginChildren = window.document.querySelectorAll(
|
||||
".column-margin.column-container > * "
|
||||
);
|
||||
const tabEls = document.querySelectorAll('a[data-bs-toggle="tab"]');
|
||||
for (const tabEl of tabEls) {
|
||||
const id = tabEl.getAttribute("data-bs-target");
|
||||
if (id) {
|
||||
const columnEl = document.querySelector(
|
||||
`${id} .column-margin, .tabset-margin-content`
|
||||
);
|
||||
if (columnEl)
|
||||
tabEl.addEventListener("shown.bs.tab", function (event) {
|
||||
const el = event.srcElement;
|
||||
if (el) {
|
||||
const visibleCls = `${el.id}-margin-content`;
|
||||
// walk up until we find a parent tabset
|
||||
let panelTabsetEl = el.parentElement;
|
||||
while (panelTabsetEl) {
|
||||
if (panelTabsetEl.classList.contains("panel-tabset")) {
|
||||
break;
|
||||
}
|
||||
panelTabsetEl = panelTabsetEl.parentElement;
|
||||
}
|
||||
|
||||
nexttick(() => {
|
||||
let lastBottom = 0;
|
||||
for (const marginChild of marginChildren) {
|
||||
const top = marginChild.getBoundingClientRect().top + window.scrollY;
|
||||
if (top < lastBottom) {
|
||||
const margin = lastBottom - top;
|
||||
marginChild.style.marginTop = `${margin}px`;
|
||||
}
|
||||
const styles = window.getComputedStyle(marginChild);
|
||||
const marginTop = parseFloat(styles["marginTop"]);
|
||||
if (panelTabsetEl) {
|
||||
const prevSib = panelTabsetEl.previousElementSibling;
|
||||
if (
|
||||
prevSib &&
|
||||
prevSib.classList.contains("tabset-margin-container")
|
||||
) {
|
||||
const childNodes = prevSib.querySelectorAll(
|
||||
".tabset-margin-content"
|
||||
);
|
||||
for (const childEl of childNodes) {
|
||||
if (childEl.classList.contains(visibleCls)) {
|
||||
childEl.classList.remove("collapse");
|
||||
} else {
|
||||
childEl.classList.add("collapse");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastBottom = top + marginChild.getBoundingClientRect().height + marginTop;
|
||||
layoutMarginEls();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Manage the visibility of the toc and the sidebar
|
||||
const marginScrollVisibility = manageSidebarVisiblity(marginSidebarEl, {
|
||||
@@ -506,8 +586,9 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
const kOverlapPaddingSize = 10;
|
||||
function toRegions(els) {
|
||||
return els.map((el) => {
|
||||
const boundRect = el.getBoundingClientRect();
|
||||
const top =
|
||||
el.getBoundingClientRect().top +
|
||||
boundRect.top +
|
||||
document.documentElement.scrollTop -
|
||||
kOverlapPaddingSize;
|
||||
return {
|
||||
@@ -517,11 +598,51 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
});
|
||||
}
|
||||
|
||||
let hasObserved = false;
|
||||
const visibleItemObserver = (els) => {
|
||||
let visibleElements = [...els];
|
||||
const intersectionObserver = new IntersectionObserver(
|
||||
(entries, _observer) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
if (visibleElements.indexOf(entry.target) === -1) {
|
||||
visibleElements.push(entry.target);
|
||||
}
|
||||
} else {
|
||||
visibleElements = visibleElements.filter((visibleEntry) => {
|
||||
return visibleEntry !== entry;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!hasObserved) {
|
||||
hideOverlappedSidebars();
|
||||
}
|
||||
hasObserved = true;
|
||||
},
|
||||
{}
|
||||
);
|
||||
els.forEach((el) => {
|
||||
intersectionObserver.observe(el);
|
||||
});
|
||||
|
||||
return {
|
||||
getVisibleEntries: () => {
|
||||
return visibleElements;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const rightElementObserver = visibleItemObserver(rightSideConflictEls);
|
||||
const leftElementObserver = visibleItemObserver(leftSideConflictEls);
|
||||
|
||||
const hideOverlappedSidebars = () => {
|
||||
marginScrollVisibility(toRegions(rightSideConflictEls));
|
||||
sidebarScrollVisiblity(toRegions(leftSideConflictEls));
|
||||
marginScrollVisibility(toRegions(rightElementObserver.getVisibleEntries()));
|
||||
sidebarScrollVisiblity(toRegions(leftElementObserver.getVisibleEntries()));
|
||||
if (tocLeftScrollVisibility) {
|
||||
tocLeftScrollVisibility(toRegions(leftSideConflictEls));
|
||||
tocLeftScrollVisibility(
|
||||
toRegions(leftElementObserver.getVisibleEntries())
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -543,7 +664,6 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
manageTransition("TOC", slow);
|
||||
manageTransition("quarto-sidebar", slow);
|
||||
};
|
||||
|
||||
const readerMode = !isReaderMode();
|
||||
setReaderModeValue(readerMode);
|
||||
|
||||
@@ -590,6 +710,9 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
};
|
||||
let localReaderMode = null;
|
||||
|
||||
const tocOpenDepthStr = tocEl?.getAttribute("data-toc-expanded");
|
||||
const tocOpenDepth = tocOpenDepthStr ? Number(tocOpenDepthStr) : 1;
|
||||
|
||||
// Walk the TOC and collapse/expand nodes
|
||||
// Nodes are expanded if:
|
||||
// - they are top level
|
||||
@@ -615,7 +738,13 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
|
||||
// Process the collapse state if this is an UL
|
||||
if (el.tagName === "UL") {
|
||||
if (depth === 1 || hasActiveChild || prevSiblingIsActiveLink(el)) {
|
||||
if (tocOpenDepth === -1 && depth > 1) {
|
||||
el.classList.add("collapse");
|
||||
} else if (
|
||||
depth <= tocOpenDepth ||
|
||||
hasActiveChild ||
|
||||
prevSiblingIsActiveLink(el)
|
||||
) {
|
||||
el.classList.remove("collapse");
|
||||
} else {
|
||||
el.classList.add("collapse");
|
||||
|
||||
@@ -8,6 +8,47 @@ const headroomChanged = new CustomEvent("quarto-hrChanged", {
|
||||
window.document.addEventListener("DOMContentLoaded", function () {
|
||||
let init = false;
|
||||
|
||||
// Manage the back to top button, if one is present.
|
||||
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
const scrollDownBuffer = 5;
|
||||
const scrollUpBuffer = 35;
|
||||
const btn = document.getElementById("quarto-back-to-top");
|
||||
const hideBackToTop = () => {
|
||||
btn.style.display = "none";
|
||||
};
|
||||
const showBackToTop = () => {
|
||||
btn.style.display = "inline-block";
|
||||
};
|
||||
if (btn) {
|
||||
window.document.addEventListener(
|
||||
"scroll",
|
||||
function () {
|
||||
const currentScrollTop =
|
||||
window.pageYOffset || document.documentElement.scrollTop;
|
||||
|
||||
// Shows and hides the button 'intelligently' as the user scrolls
|
||||
if (currentScrollTop - scrollDownBuffer > lastScrollTop) {
|
||||
hideBackToTop();
|
||||
lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
|
||||
} else if (currentScrollTop < lastScrollTop - scrollUpBuffer) {
|
||||
showBackToTop();
|
||||
lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
|
||||
}
|
||||
|
||||
// Show the button at the bottom, hides it at the top
|
||||
if (currentScrollTop <= 0) {
|
||||
hideBackToTop();
|
||||
} else if (
|
||||
window.innerHeight + currentScrollTop >=
|
||||
document.body.offsetHeight
|
||||
) {
|
||||
showBackToTop();
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
function throttle(func, wait) {
|
||||
var timeout;
|
||||
return function () {
|
||||
@@ -44,6 +85,17 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
}
|
||||
}
|
||||
|
||||
function dashboardOffset() {
|
||||
const dashboardNavEl = window.document.getElementById(
|
||||
"quarto-dashboard-header"
|
||||
);
|
||||
if (dashboardNavEl !== null) {
|
||||
return dashboardNavEl.clientHeight;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateDocumentOffsetWithoutAnimation() {
|
||||
updateDocumentOffset(false);
|
||||
}
|
||||
@@ -51,7 +103,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
function updateDocumentOffset(animated) {
|
||||
// set body offset
|
||||
const topOffset = headerOffset();
|
||||
const bodyOffset = topOffset + footerOffset();
|
||||
const bodyOffset = topOffset + footerOffset() + dashboardOffset();
|
||||
const bodyEl = window.document.body;
|
||||
bodyEl.setAttribute("data-bs-offset", topOffset);
|
||||
bodyEl.style.paddingTop = topOffset + "px";
|
||||
@@ -149,12 +201,24 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
};
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"hashchange",
|
||||
function (e) {
|
||||
if (
|
||||
getComputedStyle(document.documentElement).scrollBehavior !== "smooth"
|
||||
) {
|
||||
window.scrollTo(0, window.pageYOffset - headerOffset());
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
// Observe size changed for the header
|
||||
const headerEl = window.document.querySelector("header.fixed-top");
|
||||
if (headerEl && window.ResizeObserver) {
|
||||
const observer = new window.ResizeObserver(
|
||||
updateDocumentOffsetWithoutAnimation
|
||||
);
|
||||
const observer = new window.ResizeObserver(() => {
|
||||
setTimeout(updateDocumentOffsetWithoutAnimation, 0);
|
||||
});
|
||||
observer.observe(headerEl, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
@@ -172,13 +236,15 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
if (window.location.protocol !== "file:") {
|
||||
const links = window.document.querySelectorAll("a");
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
links[i].href = links[i].href.replace(/\/index\.html/, "/");
|
||||
if (links[i].href) {
|
||||
links[i].href = links[i].href.replace(/\/index\.html/, "/");
|
||||
}
|
||||
}
|
||||
|
||||
// Fixup any sharing links that require urls
|
||||
// Append url to any sharing urls
|
||||
const sharingLinks = window.document.querySelectorAll(
|
||||
"a.sidebar-tools-main-item"
|
||||
"a.sidebar-tools-main-item, a.quarto-navigation-tool, a.quarto-navbar-tools, a.quarto-navbar-tools-item"
|
||||
);
|
||||
for (let i = 0; i < sharingLinks.length; i++) {
|
||||
const sharingLink = sharingLinks[i];
|
||||
|
||||
File diff suppressed because one or more lines are too long
+3
-3
File diff suppressed because one or more lines are too long
@@ -43,9 +43,9 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
const mainEl = window.document.querySelector("main");
|
||||
|
||||
// highlight matches on the page
|
||||
if (query !== null && mainEl) {
|
||||
if (query && mainEl) {
|
||||
// perform any highlighting
|
||||
highlight(query, mainEl);
|
||||
highlight(escapeRegExp(query), mainEl);
|
||||
|
||||
// fix up the URL to remove the q query param
|
||||
const replacementUrl = new URL(window.location);
|
||||
@@ -57,7 +57,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
// (e.g. if the user edits the query or clears it)
|
||||
let highlighting = true;
|
||||
const resetHighlighting = (searchTerm) => {
|
||||
if (mainEl && highlighting && query !== null && searchTerm !== query) {
|
||||
if (mainEl && highlighting && query && searchTerm !== query) {
|
||||
clearHighlight(query, mainEl);
|
||||
highlighting = false;
|
||||
}
|
||||
@@ -80,27 +80,25 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
// the media query since we generate different HTML for sidebar overlays than we do
|
||||
// for sidebar input UI)
|
||||
const detachedMediaQuery =
|
||||
quartoSearchOptions.type === "overlay"
|
||||
? "all"
|
||||
: quartoSearchOptions.location === "navbar"
|
||||
? "(max-width: 991px)"
|
||||
: "none";
|
||||
quartoSearchOptions.type === "overlay" ? "all" : "(max-width: 991px)";
|
||||
|
||||
// If configured, include the analytics client to send insights
|
||||
const plugins = configurePlugins(quartoSearchOptions);
|
||||
|
||||
let lastState = null;
|
||||
const { setIsOpen } = autocomplete({
|
||||
const { setIsOpen, setQuery, setCollections } = autocomplete({
|
||||
container: searchEl,
|
||||
detachedMediaQuery: detachedMediaQuery,
|
||||
defaultActiveItemId: 0,
|
||||
panelContainer: "#quarto-search-results",
|
||||
panelPlacement: quartoSearchOptions["panel-placement"],
|
||||
debug: false,
|
||||
openOnFocus: true,
|
||||
plugins,
|
||||
classNames: {
|
||||
form: "d-flex",
|
||||
},
|
||||
placeholder: language["search-text-placeholder"],
|
||||
translations: {
|
||||
clearButtonTitle: language["search-clear-button-title"],
|
||||
detachedCancelButtonText: language["search-detached-cancel-button-title"],
|
||||
@@ -113,6 +111,8 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
return item.href;
|
||||
},
|
||||
onStateChange({ state }) {
|
||||
// If this is a file URL, note that
|
||||
|
||||
// Perhaps reset highlighting
|
||||
resetHighlighting(state.query);
|
||||
|
||||
@@ -280,6 +280,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
}
|
||||
},
|
||||
getItems({ query }) {
|
||||
if (query === null || query === "") {
|
||||
return [];
|
||||
}
|
||||
|
||||
const limit = quartoSearchOptions.limit;
|
||||
if (quartoSearchOptions.algolia) {
|
||||
return algoliaSearch(query, limit, quartoSearchOptions.algolia);
|
||||
@@ -299,9 +303,15 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
},
|
||||
templates: {
|
||||
noResults({ createElement }) {
|
||||
const hasQuery = lastState.query;
|
||||
|
||||
return createElement(
|
||||
"div",
|
||||
{ class: "quarto-search-no-results" },
|
||||
{
|
||||
class: `quarto-search-no-results${
|
||||
hasQuery ? "" : " no-query"
|
||||
}`,
|
||||
},
|
||||
language["search-no-results-text"]
|
||||
);
|
||||
},
|
||||
@@ -352,7 +362,8 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
state,
|
||||
setActiveItemId,
|
||||
setContext,
|
||||
refresh
|
||||
refresh,
|
||||
quartoSearchOptions
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -361,6 +372,38 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
},
|
||||
});
|
||||
|
||||
window.quartoOpenSearch = () => {
|
||||
setIsOpen(false);
|
||||
setIsOpen(true);
|
||||
focusSearchInput();
|
||||
};
|
||||
|
||||
document.addEventListener("keyup", (event) => {
|
||||
const { key } = event;
|
||||
const kbds = quartoSearchOptions["keyboard-shortcut"];
|
||||
const focusedEl = document.activeElement;
|
||||
|
||||
const isFormElFocused = [
|
||||
"input",
|
||||
"select",
|
||||
"textarea",
|
||||
"button",
|
||||
"option",
|
||||
].find((tag) => {
|
||||
return focusedEl.tagName.toLowerCase() === tag;
|
||||
});
|
||||
|
||||
if (
|
||||
kbds &&
|
||||
kbds.includes(key) &&
|
||||
!isFormElFocused &&
|
||||
!document.activeElement.isContentEditable
|
||||
) {
|
||||
event.preventDefault();
|
||||
window.quartoOpenSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the labeleledby attribute since it is pointing
|
||||
// to a non-existent label
|
||||
if (quartoSearchOptions.type === "overlay") {
|
||||
@@ -372,11 +415,30 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||
}
|
||||
}
|
||||
|
||||
function throttle(func, wait) {
|
||||
let waiting = false;
|
||||
return function () {
|
||||
if (!waiting) {
|
||||
func.apply(this, arguments);
|
||||
waiting = true;
|
||||
setTimeout(function () {
|
||||
waiting = false;
|
||||
}, wait);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If the main document scrolls dismiss the search results
|
||||
// (otherwise, since they're floating in the document they can scroll with the document)
|
||||
window.document.body.onscroll = () => {
|
||||
setIsOpen(false);
|
||||
};
|
||||
window.document.body.onscroll = throttle(() => {
|
||||
// Only do this if we're not detached
|
||||
// Bug #7117
|
||||
// This will happen when the keyboard is shown on ios (resulting in a scroll)
|
||||
// which then closed the search UI
|
||||
if (!window.matchMedia(detachedMediaQuery).matches) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
}, 50);
|
||||
|
||||
if (showSearchResults) {
|
||||
setIsOpen(true);
|
||||
@@ -416,15 +478,27 @@ function configurePlugins(quartoSearchOptions) {
|
||||
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({
|
||||
insightsClient: window.aa,
|
||||
onItemsChange({ insights, insightsEvents }) {
|
||||
const events = insightsEvents.map((event) => {
|
||||
const maxEvents = event.objectIDs.slice(0, 20);
|
||||
return {
|
||||
...event,
|
||||
objectIDs: maxEvents,
|
||||
};
|
||||
const events = insightsEvents.flatMap((event) => {
|
||||
// This API limits the number of items per event to 20
|
||||
const chunkSize = 20;
|
||||
const itemChunks = [];
|
||||
const eventItems = event.items;
|
||||
for (let i = 0; i < eventItems.length; i += chunkSize) {
|
||||
itemChunks.push(eventItems.slice(i, i + chunkSize));
|
||||
}
|
||||
// Split the items into multiple events that can be sent
|
||||
const events = itemChunks.map((items) => {
|
||||
return {
|
||||
...event,
|
||||
items,
|
||||
};
|
||||
});
|
||||
return events;
|
||||
});
|
||||
|
||||
insights.viewedObjectIDs(...events);
|
||||
for (const event of events) {
|
||||
insights.viewedObjectIDs(event);
|
||||
}
|
||||
},
|
||||
});
|
||||
return algoliaInsightsPlugin;
|
||||
@@ -600,20 +674,30 @@ function showCopyLink(query, options) {
|
||||
/* Search Index Handling */
|
||||
// create the index
|
||||
var fuseIndex = undefined;
|
||||
var shownWarning = false;
|
||||
|
||||
// fuse index options
|
||||
const kFuseIndexOptions = {
|
||||
keys: [
|
||||
{ name: "title", weight: 20 },
|
||||
{ name: "section", weight: 20 },
|
||||
{ name: "text", weight: 10 },
|
||||
],
|
||||
ignoreLocation: true,
|
||||
threshold: 0.1,
|
||||
};
|
||||
|
||||
async function readSearchData() {
|
||||
// Initialize the search index on demand
|
||||
if (fuseIndex === undefined) {
|
||||
// create fuse index
|
||||
const options = {
|
||||
keys: [
|
||||
{ name: "title", weight: 20 },
|
||||
{ name: "section", weight: 20 },
|
||||
{ name: "text", weight: 10 },
|
||||
],
|
||||
ignoreLocation: true,
|
||||
threshold: 0.1,
|
||||
};
|
||||
const fuse = new window.Fuse([], options);
|
||||
if (window.location.protocol === "file:" && !shownWarning) {
|
||||
window.alert(
|
||||
"Search requires JavaScript features disabled when running in file://... URLs. In order to use search, please run this document in a web server."
|
||||
);
|
||||
shownWarning = true;
|
||||
return;
|
||||
}
|
||||
const fuse = new window.Fuse([], kFuseIndexOptions);
|
||||
|
||||
// fetch the main search.json
|
||||
const response = await fetch(offsetURL("search.json"));
|
||||
@@ -633,6 +717,7 @@ async function readSearchData() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return fuseIndex;
|
||||
}
|
||||
|
||||
@@ -661,7 +746,8 @@ function renderItem(
|
||||
state,
|
||||
setActiveItemId,
|
||||
setContext,
|
||||
refresh
|
||||
refresh,
|
||||
quartoSearchOptions
|
||||
) {
|
||||
switch (item.type) {
|
||||
case kItemTypeDoc:
|
||||
@@ -671,7 +757,9 @@ function renderItem(
|
||||
item.title,
|
||||
item.section,
|
||||
item.text,
|
||||
item.href
|
||||
item.href,
|
||||
item.crumbs,
|
||||
quartoSearchOptions
|
||||
);
|
||||
case kItemTypeMore:
|
||||
return createMoreCard(
|
||||
@@ -696,15 +784,46 @@ function renderItem(
|
||||
}
|
||||
}
|
||||
|
||||
function createDocumentCard(createElement, icon, title, section, text, href) {
|
||||
function createDocumentCard(
|
||||
createElement,
|
||||
icon,
|
||||
title,
|
||||
section,
|
||||
text,
|
||||
href,
|
||||
crumbs,
|
||||
quartoSearchOptions
|
||||
) {
|
||||
const iconEl = createElement("i", {
|
||||
class: `bi bi-${icon} search-result-icon`,
|
||||
});
|
||||
const titleEl = createElement("p", { class: "search-result-title" }, title);
|
||||
const titleContents = [iconEl, titleEl];
|
||||
const showParent = quartoSearchOptions["show-item-context"];
|
||||
if (crumbs && showParent) {
|
||||
let crumbsOut = undefined;
|
||||
const crumbClz = ["search-result-crumbs"];
|
||||
if (showParent === "root") {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs[0] : undefined;
|
||||
} else if (showParent === "parent") {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs[crumbs.length - 2] : undefined;
|
||||
} else {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs.join(" > ") : undefined;
|
||||
crumbClz.push("search-result-crumbs-wrap");
|
||||
}
|
||||
|
||||
const crumbEl = createElement(
|
||||
"p",
|
||||
{ class: crumbClz.join(" ") },
|
||||
crumbsOut
|
||||
);
|
||||
titleContents.push(crumbEl);
|
||||
}
|
||||
|
||||
const titleContainerEl = createElement(
|
||||
"div",
|
||||
{ class: "search-result-title-container" },
|
||||
[iconEl, titleEl]
|
||||
titleContents
|
||||
);
|
||||
|
||||
const textEls = [];
|
||||
@@ -976,6 +1095,10 @@ function clearHighlight(searchterm, el) {
|
||||
}
|
||||
}
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||||
}
|
||||
|
||||
// highlight matches
|
||||
function highlight(term, el) {
|
||||
const termRegex = new RegExp(term, "ig");
|
||||
@@ -1082,17 +1205,19 @@ function algoliaSearch(query, limit, algoliaOptions) {
|
||||
const remappedHits = response.hits.map((hit) => {
|
||||
return hit.map((item) => {
|
||||
const newItem = { ...item };
|
||||
["href", "section", "title", "text"].forEach((keyName) => {
|
||||
const mappedName = indexFields[keyName];
|
||||
if (
|
||||
mappedName &&
|
||||
item[mappedName] !== undefined &&
|
||||
mappedName !== keyName
|
||||
) {
|
||||
newItem[keyName] = item[mappedName];
|
||||
delete newItem[mappedName];
|
||||
["href", "section", "title", "text", "crumbs"].forEach(
|
||||
(keyName) => {
|
||||
const mappedName = indexFields[keyName];
|
||||
if (
|
||||
mappedName &&
|
||||
item[mappedName] !== undefined &&
|
||||
mappedName !== keyName
|
||||
) {
|
||||
newItem[keyName] = item[mappedName];
|
||||
delete newItem[mappedName];
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
newItem.text = highlightMatch(query, newItem.text);
|
||||
return newItem;
|
||||
});
|
||||
@@ -1103,8 +1228,34 @@ function algoliaSearch(query, limit, algoliaOptions) {
|
||||
});
|
||||
}
|
||||
|
||||
function fuseSearch(query, fuse, fuseOptions) {
|
||||
return fuse.search(query, fuseOptions).map((result) => {
|
||||
let subSearchTerm = undefined;
|
||||
let subSearchFuse = undefined;
|
||||
const kFuseMaxWait = 125;
|
||||
|
||||
async function fuseSearch(query, fuse, fuseOptions) {
|
||||
let index = fuse;
|
||||
// Fuse.js using the Bitap algorithm for text matching which runs in
|
||||
// O(nm) time (no matter the structure of the text). In our case this
|
||||
// means that long search terms mixed with large index gets very slow
|
||||
//
|
||||
// This injects a subIndex that will be used once the terms get long enough
|
||||
// Usually making this subindex is cheap since there will typically be
|
||||
// a subset of results matching the existing query
|
||||
if (subSearchFuse !== undefined && query.startsWith(subSearchTerm)) {
|
||||
// Use the existing subSearchFuse
|
||||
index = subSearchFuse;
|
||||
} else if (subSearchFuse !== undefined) {
|
||||
// The term changed, discard the existing fuse
|
||||
subSearchFuse = undefined;
|
||||
subSearchTerm = undefined;
|
||||
}
|
||||
|
||||
// Search using the active fuse
|
||||
const then = performance.now();
|
||||
const resultsRaw = await index.search(query, fuseOptions);
|
||||
const now = performance.now();
|
||||
|
||||
const results = resultsRaw.map((result) => {
|
||||
const addParam = (url, name, value) => {
|
||||
const anchorParts = url.split("#");
|
||||
const baseUrl = anchorParts[0];
|
||||
@@ -1118,6 +1269,18 @@ function fuseSearch(query, fuse, fuseOptions) {
|
||||
section: result.item.section,
|
||||
href: addParam(result.item.href, kQueryArg, query),
|
||||
text: highlightMatch(query, result.item.text),
|
||||
crumbs: result.item.crumbs,
|
||||
};
|
||||
});
|
||||
|
||||
// If we don't have a subfuse and the query is long enough, go ahead
|
||||
// and create a subfuse to use for subsequent queries
|
||||
if (now - then > kFuseMaxWait && subSearchFuse === undefined) {
|
||||
subSearchTerm = query;
|
||||
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
|
||||
resultsRaw.forEach((rr) => {
|
||||
subSearchFuse.add(rr.item);
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user