他のページに転送するUserScript
出典
https://gyazo.com/e12a13a0c4d5f5bfc4a6c2c147740061
code:script.js
function applyRedirectIfNeeded() {
// Clicking a.page-link virtually is faster than updating location.href
// as Scrapbox uses react-router (maybe)
if (scrapbox.Page.lines1.nodes0 === 'goto:') { $('a.page-link')
.get(0)
.click()
}
}
let sectionTitle = $('title').get(0)
var observer = new MutationObserver(() => {
applyRedirectIfNeeded()
})
observer.observe(sectionTitle, { childList: true })
// needs to be called manually here
// because observer is not triggerd for the initial page
applyRedirectIfNeeded()
console.log('redirect module loaded')