hexo/source/_volantis/bodyEnd.ejs
2025-02-08 03:18:24 +00:00

24 lines
949 B
Plaintext
Executable File

<script>
volantis.rightmenu.jump = (type) => {
const item = document.querySelector(type === 'prev' ? 'article .prev-next a.prev' : 'article .prev-next a.next');
if (!!item) {
if (typeof pjax !== 'undefined') {
pjax.loadUrl(item.href)
} else {
window.location.href = item.href;
}
}
}
volantis.rightmenu.handle(() => {
const prev = document.querySelector('#prev').parentElement,
next = document.querySelector('#next').parentElement,
articlePrev = document.querySelector('article .prev-next a.prev p.title'),
articleNext = document.querySelector('article .prev-next a.next p.title');
prev.style.display = articlePrev ? 'block' : 'none';
prev.title = articlePrev ? articlePrev.innerText : null;
next.style.display = articleNext ? 'block' : 'none';
next.title = articleNext ? articleNext.innerText : null;
}, 'prevNext', false)
</script>