PageStream
https://gyazo.com/78abba44cca6cb45e7c1bdf8d4572448
使い方: 以下のimport...を自分のページに書く (例) code:js
import '/api/code/shoya140/PageStream/script.js'
code:script.js
const updatePSCSS = () => {
console.log('hello')
const params = (new URL(document.location)).searchParams
const queryPageTitle = params.get('ps-title')
var style = document.getElementById('__page_stream__')
if (queryPageTitle) {
const css = .page:not([data-title='${queryPageTitle}']) {display: none}
style = document.createElement('style')
style.setAttribute('id', '__page_stream__')
style.appendChild(document.createTextNode(css))
document.head.appendChild(style)
} else {
if (style) {
style.remove()
}
}
}
updatePSCSS()
const target = document.getElementsByClassName('page-wrapper')0 const observer = new MutationObserver((recs) => {
if (!recs0.target.classList.contains('enter')) { updatePSCSS()
}
})
observer.observe(target, { attributes: true, attributeFilter: 'class' }) scrapbox.PageMenu.addItem({
title: 'Open Page Stream',
onClick: (e) => {
window.location.href = https://scrapbox.io/stream/${scrapbox.Project.name}?ps-title=${scrapbox.Page.title}
},
})