未読のページにランダムジャンプするUserScript
code:script.js
scrapbox.PageMenu.addMenu({
title: 'Jump to an unread page',
onClick: () => {
const lines = document.getElementsByClassName('lines')?.0; const observer = new MutationObserver(() => {
const unreadTelomeres = lines.getElementsByClassName('telomere-border unread');
if (unreadTelomeres.length > 0) {
console.log(/${scrapbox.Project.name}/${scrapbox.Page.title} is an unread page.);
observer.disconnect();
return;
}
document.getElementsByClassName('random-jump-button')?.0.click(); });
observer.observe(lines, {childList: true});
document.getElementsByClassName('random-jump-button')?.0.click(); },
});
UserScript.icon