Episode
10
January 13, 2023
var currentEpisode = document.querySelector('.post-id').textContent;
var next = +currentEpisode + 1;
var prev = +currentEpisode - 1;
var nextLink, prevLink;
document.querySelectorAll('.post-list-number').forEach(el => {
var link = el.parentNode;
var num = el.textContent;
if (num == prev)
prevLink = link.href;
if (num == next)
nextLink = link.href;
});
var nextEl = document.querySelector('.next-link');
var prevEl = document.querySelector('.prev-link');
if (nextLink) {
nextEl.href = nextLink;
} else {
nextEl.class = 'display-none';
}
if (prevLink) {
prevEl.href = prevLink;
} else {
prevEl.class = 'display-none';
}