Skip to content

Commit

Permalink
Merge branch 'master' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
TrebledJ committed Sep 5, 2024
2 parents 37fffb2 + 6773749 commit f53fa4a
Show file tree
Hide file tree
Showing 76 changed files with 775 additions and 762 deletions.
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ https://www.electronics-tutorials.ws/waveforms/waveforms.html
https://www.st.com/resource/en/reference_manual/rm0090-stm32f405415-stm32f407417-stm32f427437-and-stm32f429439-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
https://www.google.com/doodles/alan-turings-100th-birthday
https://web.archive.org/
http://127.0.0.1:?[0-9]*/.*

# False positive from marp HTML.
http://highlightjs.readthedocs.io/en/latest/style-guide.html
2 changes: 1 addition & 1 deletion assets/js.bundle/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
$(() => {
const numMemes = 4;
const img = Math.floor(Math.random() * numMemes) + 1;
$('.404-meme').html(`<img src="/img/memes/404-${img}.jpg" class="w-75 mt-3">`);
$('.404-meme').html(`<img src="/img/memes/404-${img}.jpg" class="jw-75 mt-3">`);
});
22 changes: 22 additions & 0 deletions assets/js.bundle/common/btn-back-to-top.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const btnBackToTop = $('#btn-back-to-top');

const backtotopObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
btnBackToTop.fadeOut();
} else {
btnBackToTop.fadeIn();
}
});
}, {
rootMargin: '250px',
threshold: 0,
});

backtotopObserver.observe(document.querySelector('#top-of-the-morning-to-you'));

btnBackToTop.on('click', () => {
document.body.scrollIntoView({
behavior: 'smooth',
});
});
26 changes: 26 additions & 0 deletions assets/js.bundle/common/btn-go-to-tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// "Go to Tags" in /posts/.
const gototagsButton = $('#btn-go-to-tags');
const tagsSection = document.querySelector('#tags-sidebar');

if (tagsSection) {
gototagsButton.on('click', () => {
tagsSection.scrollIntoView({
behavior: 'smooth',
});
});

const gototagObserver = new IntersectionObserver((entries, _observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
gototagsButton.fadeOut();
} else {
gototagsButton.fadeIn();
}
});
}, {
rootMargin: '0px',
threshold: 0,
});

gototagObserver.observe(tagsSection);
}
9 changes: 9 additions & 0 deletions assets/js.bundle/common/carousel-dyn-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Carousel auto-label update.
$('.carousel').each(function () {
// Update labels on slide.
const id = $(this).attr('id');
$(this).on('slide.bs.carousel', event => {
$(`#${id}-tab${event.from + 1}-label`).removeClass('active-tab');
$(`#${id}-tab${event.to + 1}-label`).addClass('active-tab');
});
});
6 changes: 6 additions & 0 deletions assets/js.bundle/common/ctrlk-to-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
document.addEventListener('keydown', function (event) {
if ((event.ctrlKey || event.metaKey) && event.key === 'k') {
event.preventDefault();
$('#search-modal').modal('show');
}
});
26 changes: 26 additions & 0 deletions assets/js.bundle/common/load-soundcloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Load SoundCloud embeds (dynamic src).
const visual = $(window).width() < 600;

const options = {
rootMargin: '300px', // Lazy-load when the iframe is 300px away from the viewport.
threshold: 0,
};

// Set up an intersection observer to detect when tracks are nearly visible.
const trackObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const track = entry.target;
let src = track.dataset.src;
if (visual)
src += '&visual=true'; // Compressed view, more suitable for small screens.
track.src = src;
track.classList.remove('lazy');
observer.unobserve(track);
}
});
}, options);

// Observe tracks for lazy loading.
const tracks = document.querySelectorAll('.soundcloud-track.lazy');
tracks.forEach(e => trackObserver.observe(e));
2 changes: 2 additions & 0 deletions assets/js.bundle/common/load-tooltips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const tooltips = document.querySelectorAll('[data-bs-toggle="tooltip"]');
[...tooltips].forEach(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
2 changes: 2 additions & 0 deletions assets/js.bundle/common/misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Mobile ToC: Add a special class for dropdown items.
$('#btn-mobile-toc nav.toc a').addClass('dropdown-item');
10 changes: 10 additions & 0 deletions assets/js.bundle/common/scroll-progress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const docElem = document.documentElement;
const docBody = document.body;
const progressBar = document.querySelector('#scroll-progress-bar');

document.addEventListener('scroll', () => {
const scrollTop = (docBody.scrollTop || docElem.scrollTop);
const height = docElem.scrollHeight - docElem.clientHeight;
const progress = scrollTop / height * 100;
progressBar.style.setProperty('--progress', `${Math.max(progress, 0)}%`);
});
117 changes: 0 additions & 117 deletions assets/js.bundle/head.js

This file was deleted.

Loading

0 comments on commit f53fa4a

Please sign in to comment.