Skip to content

Commit

Permalink
Use conf colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mine-cetinkaya-rundel committed Apr 1, 2024
1 parent c596f18 commit 7f835be
Show file tree
Hide file tree
Showing 32 changed files with 1,616 additions and 750 deletions.
7 changes: 6 additions & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ project:

website:
navbar:
background: "#72994E"
left:
- index.qmd

editor: visual
editor: visual

format:
html:
linkcolor: "#57733D"
224 changes: 134 additions & 90 deletions _site/index.html

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions _site/listings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@
"listing": "/index.html",
"items": [
"/workshops/shiny_python_adv.html",
"/workshops/tidymodels_advanced.html",
"/workshops/arrow.html",
"/workshops/causal.html",
"/workshops/quarto_dashboards.html",
"/workshops/causal.html",
"/workshops/posit_tools_python.html",
"/workshops/posit_tools_r.html",
"/workshops/databases.html",
"/workshops/dataviz.html",
"/workshops/dev_ops.html",
"/workshops/dataviz.html",
"/workshops/programming_r.html",
"/workshops/vetiver.html",
"/workshops/intro_ds_python.html",
"/workshops/intro_ds_r.html",
"/workshops/tidymodels_intro.html",
"/workshops/quarto_intro.html",
"/workshops/shiny_python_intro.html",
"/workshops/shiny_r_intro.html",
"/workshops/ml_python.html",
"/workshops/tidymodels_intro.html",
"/workshops/shiny_r_level_up.html",
"/workshops/tables.html",
"/workshops/pkg_dev.html",
"/workshops/quarto_websites.html",
"/workshops/quarto_intro.html",
"/workshops/r_in_production.html",
"/workshops/shiny_r_intro.html",
"/workshops/shiny_python_intro.html",
"/workshops/tidymodels_advanced.html",
"/workshops/databricks.html",
"/workshops/wtf.html"
]
Expand Down
139 changes: 73 additions & 66 deletions _site/search.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _site/site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions _site/site_libs/quarto-html/quarto-syntax-highlighting.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion _site/site_libs/quarto-listing/list.min.js

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions _site/site_libs/quarto-nav/quarto-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,45 @@ const headroomChanged = new CustomEvent("quarto-hrChanged", {
composed: false,
});

const announceDismiss = () => {
const annEl = window.document.getElementById("quarto-announcement");
if (annEl) {
annEl.remove();

const annId = annEl.getAttribute("data-announcement-id");
window.localStorage.setItem(`quarto-announce-${annId}`, "true");
}
};

const announceRegister = () => {
const annEl = window.document.getElementById("quarto-announcement");
if (annEl) {
const annId = annEl.getAttribute("data-announcement-id");
const isDismissed =
window.localStorage.getItem(`quarto-announce-${annId}`) || false;
if (isDismissed) {
announceDismiss();
return;
} else {
annEl.classList.remove("hidden");
}

const actionEl = annEl.querySelector(".quarto-announcement-action");
if (actionEl) {
actionEl.addEventListener("click", function (e) {
e.preventDefault();
// Hide the bar immediately
announceDismiss();
});
}
}
};

window.document.addEventListener("DOMContentLoaded", function () {
let init = false;

announceRegister();

// Manage the back to top button, if one is present.
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
const scrollDownBuffer = 5;
Expand Down Expand Up @@ -237,6 +273,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
const links = window.document.querySelectorAll("a");
for (let i = 0; i < links.length; i++) {
if (links[i].href) {
links[i].dataset.originalHref = links[i].href;
links[i].href = links[i].href.replace(/\/index\.html/, "/");
}
}
Expand Down
65 changes: 52 additions & 13 deletions _site/site_libs/quarto-search/quarto-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,18 @@ function showCopyLink(query, options) {
// 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) {
Expand All @@ -685,17 +697,7 @@ async function readSearchData() {
shownWarning = true;
return;
}
// 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);
const fuse = new window.Fuse([], kFuseIndexOptions);

// fetch the main search.json
const response = await fetch(offsetURL("search.json"));
Expand Down Expand Up @@ -1226,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];
Expand All @@ -1244,4 +1272,15 @@ function fuseSearch(query, fuse, fuseOptions) {
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;
}
Loading

0 comments on commit 7f835be

Please sign in to comment.