@@ -4,42 +4,42 @@ function initHotKeys() {
44 var searchInput = document.getElementById('search');
55
66 document.addEventListener('keydown', function (event) {
7− if (event.defaultPrevented) {
8− return;
9− }
7+ if (event.defaultPrevented) {
8+ return;
9+ }
1010
11− var key = event.key || event.keyCode;
11+ var key = event.key || event.keyCode;
1212
13− // ESC to close search window
14− if (key === 'Escape' || key === 'Esc' || key === 27) {
15− document.body.classList.remove('has-active-search-window');
16− }
13+ // ESC to close search window
14+ if (key === 'Escape' || key === 'Esc' || key === 27) {
15+ document.body.classList.remove('has-active-search-window');
16+ }
1717
18− // / to open toggle window
19− if (key === '/' || key === 'Period' || key === 58) {
20− if (bodyEl.classList.contains('has-active-search-window')) {
21− // if it's already open don't do anything!
22− } else {
23− event.preventDefault();
24− document.body.classList.add('has-active-search-window');
25− searchInput.focus();
26− }
18+ // / to open toggle window
19+ if (key === '/' || key === 'Period' || key === 58) {
20+ if (bodyEl.classList.contains('has-active-search-window')) {
21+ // if it's already open don't do anything!
22+ } else {
23+ event.preventDefault();
24+ document.body.classList.add('has-active-search-window');
25+ searchInput.focus();
2726 }
27+ }
2828
29− //when search is active TAB puts search input into focus
30− if (bodyEl.classList.contains('has-active-search-window')) {
31− if (key === 'Tab' || key === 'Tab' || key === 9) {
32− searchInput.focus();
33− }
29+ //when search is active TAB puts search input into focus
30+ if (bodyEl.classList.contains('has-active-search-window')) {
31+ if (key === 'Tab' || key === 'Tab' || key === 9) {
32+ searchInput.focus();
3433 }
34+ }
3535
36− if (bodyEl.classList.contains('has-active-search-window')) {
37− if (key === 'Enter' || key === 'Return' || key === 13) {
38− event.preventDefault();
39− let firstresult = document.querySelectorAll("div#full-results a")[0];
40− firstresult.click();
41− }
36+ if (bodyEl.classList.contains('has-active-search-window')) {
37+ if (key === 'Enter' || key === 'Return' || key === 13) {
38+ event.preventDefault();
39+ let firstresult = document.querySelectorAll("div#full-results a")[0];
40+ firstresult.click();
4241 }
42+ }
4343 });
4444};
4545
@@ -173,7 +173,7 @@ function makeTeaser(body, terms) {
173173}
174174
175175function formatSearchResultTitle(item) {
176− var pathArray = item.ref.split( '/' );
176+ var pathArray = item.ref.split('/');
177177
178178 var firstPartTitle = pathArray[3];
179179 let firstTitleCapitals = firstPartTitle.charAt(0).toUpperCase() + firstPartTitle.slice(1);
@@ -182,7 +182,7 @@ function formatSearchResultTitle(item) {
182182
183183 var fullTitle = firstTitleCapitals + '<span class="gray1 dib pl2">' + ' / ' + lastPartTitle + '</span>';
184184
185− return fullTitle;
185+ return fullTitle;
186186}
187187
188188function formatSearchResultItem(item, terms) {
@@ -193,7 +193,7 @@ function formatSearchResultItem(item, terms) {
193193 li.classList.add("search-results__item");
194194 var hrefA = item.ref;
195195 createA.setAttribute('href', hrefA);
196− createA.setAttribute('class','no-underline db pl1 pv2');
196+ createA.setAttribute('class', 'no-underline db pl1 pv2');
197197 createA.innerHTML = `<span class="capitalize ph3">${teaserTitle}</span>`;
198198 createA.innerHTML += `<span class='dn arrow fr'>↩</span>`;
199199 createA.innerHTML += `<div class="truncate pr2 ph3">${makeTeaser(item.doc.body, terms)}</div>`;
@@ -219,8 +219,8 @@ function initSearch() {
219219 bool: "AND",
220220 expand: true, // turn on partial word search
221221 fields: {
222− title: {boost: 2},
223− body: {boost: 1},
222+ title: { boost: 2 },
223+ body: { boost: 1 },
224224 }
225225 };
226226 var currentTerm = "";
@@ -233,8 +233,8 @@ function initSearch() {
233233 var searchActive = bodyEl.classList.contains('has-active-search-window');
234234
235235 if (toggleSearchWindow !== null) {
236− toggleSearchWindow.onclick = function() {
237− inputReset.style.display="none";
236+ toggleSearchWindow.onclick = function () {
237+ inputReset.style.display = "none";
238238
239239 //activate search
240240 bodyEl.classList.toggle('has-active-search-window');
@@ -245,16 +245,16 @@ function initSearch() {
245245 searchResultsHeader.value = "";
246246 searchResults.style.display = searchInput.value.trim() === "" ? "none" : "block";
247247 }
248− searchOverlay.addEventListener('click', function(e){
249− if (!searchWindow.contains(e.target)){
248+ searchOverlay.addEventListener('click', function (e) {
249+ if (!searchWindow.contains(e.target)) {
250250 bodyEl.classList.toggle('has-active-search-window');
251251 }
252252 })
253253 }
254254
255− searchInput.addEventListener("keyup", debounce(function() {
256− inputReset.style.display="block";
257− glossaryResults.style.display="none";
255+ searchInput.addEventListener("keyup", debounce(function () {
256+ inputReset.style.display = "block";
257+ glossaryResults.style.display = "none";
258258 searchResultsHeader.value = "";
259259 var term = searchInput.value.trim();
260260 /*
@@ -268,24 +268,25 @@ function initSearch() {
268268 searchResults.style.overflowY = term === "" ? "hidden" : "scroll";
269269 searchResultsItems.innerHTML = "";
270270 if (term === "") {
271− inputReset.style.display="none";
271+ inputReset.style.display = "none";
272272 return;
273273 }
274274
275275 for (let entry of glossary) {
276− if (entry.symbol === term) {
277− glossaryResults.style.display="block";
276+ if (entry.name === term.toLowerCase()) {
277+ glossaryResults.style.display = "block";
278278 glossaryResultsItem.innerHTML = `
279− <a href="${entry.link}"><h3 class="black"><code class="pa0 red3 mr2">${entry.symbol}</code>${entry.name}</h3>
279+ <a href="${entry.link}"><h3 class="black">${entry.name}</h3>
280280 <p class="black">${entry.desc}</p>
281− <span class="db tr black fw5 mb3" style="font-family: 'Inter UI', sans-serif;">Read more in Documentation -></span></a>
281+ <span class="db tr black fw5 mb3" style="font-family: 'Inter UI', sans-serif;">Read more in Glossary -></span></a>
282282 `
283− } else if (entry.name === term.toLowerCase()) {
284− glossaryResults.style.display="block";
283+ break;
284+ } else if (entry.symbol === term) {
285+ glossaryResults.style.display = "block";
285286 glossaryResultsItem.innerHTML = `
286− <a href="${entry.link}"><h3 class="black">${entry.name}</h3>
287+ <a href="${entry.link}"><h3 class="black"><code class="pa0 red3 mr1">${entry.symbol}</code>${entry.name}</h3>
287288 <p class="black">${entry.desc}</p>
288− <span class="db tr black fw5 mb3" style="font-family: 'Inter UI', sans-serif;">Read more in Glossary -></span></a>
289+ <span class="db tr black fw5 mb3" style="font-family: 'Inter UI', sans-serif;">Read more in Documentation -></span></a>
289290 `
290291 }
291292 }
@@ -310,10 +311,10 @@ function initSearch() {
310311 }, 150));
311312
312313 // reset input button
313− inputReset.onclick=function(){
314+ inputReset.onclick = function () {
314315 document.getElementById('search-form').reset();
315316 }
316− searchForm.addEventListener("reset", function(event){
317+ searchForm.addEventListener("reset", function (event) {
317318 var e = document.createEvent('KeyboardEvent');
318319 e.initEvent("keyup", false, true);
319320 searchInput.dispatchEvent(e);
@@ -322,7 +323,7 @@ function initSearch() {
322323}
323324
324325if (document.readyState === "complete" ||
325− (document.readyState !== "loading" && !document.documentElement.doScroll)
326+ (document.readyState !== "loading" && !document.documentElement.doScroll)
326327) {
327328 initToggleSearchWindow();
328329} else {
@@ -333,11 +334,11 @@ if (document.readyState === "complete" ||
333334}
334335
335336// Scroll to current document in nav list.
336−let docsNavScroll = function() {
337− let docsDetails = document.querySelectorAll("nav ul details")
337+let docsNavScroll = function () {
338+ let docsDetails = document.querySelectorAll("nav ul details")
338339 for (let details in docsDetails) {
339340 if (docsDetails[details].open) docsDetails[details].scrollIntoView()
340− }
341+ }
341342}
342343
343344if (window.location.href.includes("docs")) {
@@ -355,7 +356,7 @@ if (window.location.href.includes("docs")) {
355356 // on mobile, dropdown selections go to the option
356357
357358 let docsSelect = document.getElementById('docsSelect');
358− let goTo = function() {
359+ let goTo = function () {
359360 let url = docsSelect.options[docsSelect.selectedIndex].value;
360361 if (url.startsWith("http")) {
361362 document.location.assign(url);
@@ -370,44 +371,45 @@ if (window.location.href.includes("docs")) {
370371// same-page navigation on-scroll behaviour
371372
372373if (document.body.classList.contains("page-indiced")) {
373−let h2 = document.getElementsByTagName("h2");
374−let h3 = document.getElementsByTagName("h3");
375−let all = document.querySelectorAll("nav li a");
376−let headers = document.querySelectorAll("details summary");
377−
378−// smooth scrolling on click
379−all.forEach(link => {
380− link.addEventListener("click", event => {
381− event.preventDefault();
382− let target = document.querySelector(event.target.hash);
383− target.scrollIntoView({
384− behavior: "smooth",
385− block: "start"
374+ let h2 = document.getElementsByTagName("h2");
375+ let h3 = document.getElementsByTagName("h3");
376+ let all = document.querySelectorAll("nav li a");
377+ let headers = document.querySelectorAll("details summary");
378+
379+ // smooth scrolling on click
380+ all.forEach(link => {
381+ link.addEventListener("click", event => {
382+ event.preventDefault();
383+ let target = document.querySelector(event.target.hash);
384+ target.scrollIntoView({
385+ behavior: "smooth",
386+ block: "start"
387+ });
386388 });
387389 });
388−});
389390
390−let lastId;
391−let cur = [];
391+ let lastId;
392+ let cur = [];
392393
393−window.addEventListener("scroll", event => {
394− let fromTop = window.scrollY;
394+ window.addEventListener("scroll", event => {
395+ let fromTop = window.scrollY;
395396
396− all.forEach(link => {
397− let section = document.querySelector(link.hash);
398− let sectionChildren = document.querySelector(link.hash).nextElementSibling;
399−
400− if (
401− ((section.offsetTop <= fromTop) ||
402− (sectionChildren.offsetTop <= fromTop)) &&
403− (section.offsetTop + section.offsetHeight + sectionChildren.offsetHeight > fromTop)
404− ) {
405− link.classList.add("current");
406− } else {
407− link.classList.remove("current");
408− }
409− });
410−})};
397+ all.forEach(link => {
398+ let section = document.querySelector(link.hash);
399+ let sectionChildren = document.querySelector(link.hash).nextElementSibling;
400+
401+ if (
402+ ((section.offsetTop <= fromTop) ||
403+ (sectionChildren.offsetTop <= fromTop)) &&
404+ (section.offsetTop + section.offsetHeight + sectionChildren.offsetHeight > fromTop)
405+ ) {
406+ link.classList.add("current");
407+ } else {
408+ link.classList.remove("current");
409+ }
410+ });
411+ })
412+};
411413
412414let oceanvid = document.getElementById("ocean");
413415