Skip to content

Commit

Permalink
deploy: 5bf72d4
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 3, 2023
1 parent 2db99a4 commit c0c5634
Show file tree
Hide file tree
Showing 69 changed files with 1,539 additions and 984 deletions.
2 changes: 1 addition & 1 deletion 404.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions alter-min-max/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions animations/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions array-functions/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions arrays/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions art-and-appearance/index.html

Large diffs are not rendered by default.

661 changes: 407 additions & 254 deletions assets/css/just-the-docs-dark.css

Large diffs are not rendered by default.

533 changes: 279 additions & 254 deletions assets/css/just-the-docs-default.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/css/just-the-docs-head-nav.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
div.opaque { background-color: #fff; }

.nav-list .nav-list-item .nav-list-link { background-image: linear-gradient(-90deg, #ebedf5 0%, rgba(235, 237, 245, 0.8) 80%, rgba(235, 237, 245, 0) 100%); }
533 changes: 279 additions & 254 deletions assets/css/just-the-docs-light.css

Large diffs are not rendered by default.

Binary file removed assets/images/just-the-docs.png
Binary file not shown.
1 change: 0 additions & 1 deletion assets/images/search.svg

This file was deleted.

111 changes: 109 additions & 2 deletions assets/js/just-the-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,46 @@ function initNav() {
}
if (target) {
e.preventDefault();
target.parentNode.classList.toggle('active');
target.ariaPressed = target.parentNode.classList.toggle('active');
}
});

const siteNav = document.getElementById('site-nav');
const mainHeader = document.getElementById('main-header');
const menuButton = document.getElementById('menu-button');

disableHeadStyleSheets();

jtd.addEvent(menuButton, 'click', function(e){
e.preventDefault();

if (menuButton.classList.toggle('nav-open')) {
siteNav.classList.add('nav-open');
mainHeader.classList.add('nav-open');
menuButton.ariaPressed = true;
} else {
siteNav.classList.remove('nav-open');
mainHeader.classList.remove('nav-open');
menuButton.ariaPressed = false;
}
});
}

// The <head> element is assumed to include the following stylesheets:
// 0. a <link> to /assets/css/just-the-docs-default.css
// 1. a <link> to /assets/css/just-the-docs-head-nav.css
// 2. a <style> containing the result of _includes/css/activation.scss.liquid.
// It also includes any styles provided by users in _includes/head_custom.html.
// Stylesheet 2 may be missing (compression can remove empty <style> elements)
// so disableHeadStyleSheet() needs to access it by its id.

function disableHeadStyleSheets() {
document.styleSheets[1].disabled = true;
const activation = document.getElementById('jtd-nav-activation');
if (activation) {
activation.disabled = true;
}
}
// Site search

function initSearch() {
Expand All @@ -58,7 +78,7 @@ function initSearch() {
request.onload = function(){
if (request.status >= 200 && request.status < 400) {
var docs = JSON.parse(request.responseText);

lunr.tokenizer.separator = /[\s\-/]+/

var index = lunr(function(){
Expand All @@ -69,6 +89,7 @@ function initSearch() {
this.metadataWhitelist = ['position']

for (var i in docs) {

this.add({
id: i,
title: docs[i].title,
Expand Down Expand Up @@ -197,6 +218,7 @@ function searchLoaded(index, docs) {
resultTitle.classList.add('search-result-title');
resultLink.appendChild(resultTitle);

// note: the SVG svg-doc is only loaded as a Jekyll include if site.search_enabled is true; see _includes/icons/icons.html
var resultDoc = document.createElement('div');
resultDoc.classList.add('search-result-doc');
resultDoc.innerHTML = '<svg viewBox="0 0 24 24" class="search-result-icon"><use xlink:href="#svg-doc"></use></svg>';
Expand Down Expand Up @@ -433,11 +455,96 @@ jtd.setTheme = function(theme) {
cssFile.setAttribute('href', '/assets/css/just-the-docs-' + theme + '.css');
}

// Note: pathname can have a trailing slash on a local jekyll server
// and not have the slash on GitHub Pages

function navLink() {
var href = document.location.pathname;
if (href.endsWith('/') && href != '/') {
href = href.slice(0, -1);
}
return document.getElementById('site-nav').querySelector('a[href="' + href + '"], a[href="' + href + '/"]');
}

// Scroll site-nav to ensure the link to the current page is visible

function scrollNav() {
const targetLink = navLink();
if (targetLink) {
const rect = targetLink.getBoundingClientRect();
document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height);
}
}

// Find the nav-list-link that refers to the current page
// then make it and all enclosing nav-list-item elements active.

function activateNav() {
var target = navLink();
if (target) {
target.classList.toggle('active', true);
target.removeAttribute('href');
}
while (target) {
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
target = target.parentNode;
}
if (target) {
target.classList.toggle('active', true);
target = target.parentNode;
}
}
}

// Document ready

jtd.onReady(function(){
initNav();
initSearch();
activateNav();
scrollNav();
});

// Copy button on code

jtd.onReady(function(){

if (!window.isSecureContext) {
console.log('Window does not have a secure context, therefore code clipboard copy functionality will not be available. For more details see https://web.dev/async-clipboard/#security-and-permissions');
return;
}

var codeBlocks = document.querySelectorAll('div.highlighter-rouge, div.listingblock > div.content, figure.highlight');

// note: the SVG svg-copied and svg-copy is only loaded as a Jekyll include if site.enable_copy_code_button is true; see _includes/icons/icons.html
var svgCopied = '<svg viewBox="0 0 24 24" class="copy-icon"><use xlink:href="#svg-copied"></use></svg>';
var svgCopy = '<svg viewBox="0 0 24 24" class="copy-icon"><use xlink:href="#svg-copy"></use></svg>';

codeBlocks.forEach(codeBlock => {
var copyButton = document.createElement('button');
var timeout = null;
copyButton.type = 'button';
copyButton.ariaLabel = 'Copy code to clipboard';
copyButton.innerHTML = svgCopy;
codeBlock.append(copyButton);

copyButton.addEventListener('click', function () {
if(timeout === null) {
var code = (codeBlock.querySelector('pre:not(.lineno, .highlight)') || codeBlock.querySelector('code')).innerText;
window.navigator.clipboard.writeText(code);

copyButton.innerHTML = svgCopied;

var timeoutSetting = 4000;

timeout = setTimeout(function () {
copyButton.innerHTML = svgCopy;
timeout = null;
}, timeoutSetting);
}
});
});

});

})(window.jtd = window.jtd || {});
Expand Down
Loading

0 comments on commit c0c5634

Please sign in to comment.