User script to extract the original text without destroying it
2022-01-19 When you duplicate another project's description in your own project
turn out like this - Wellhead 2022-01-17 Title tweaked. - Whether the link in the project should be a link to the original project... - We're not going to be able to connect with anything on this side of the project. - should not do - If there is a page with the same name in our project, it should be connected. - Not connected = not in this project" is also informative - Notice the blanks. - If you think you need it at the cost of making it, make it, and if not so much, leave it alone. 2022-02-01
ToMyProj script.js
scrapbox.PopupMenu.addButton({
title: 'ToMyProj',
onClick: text => {
const dst = 'nishio'
const src = scrapbox.Project.name
const new_text = text.replace(/\[([^\]\/]+).icon\]/gm, `[/${src}/$1.icon]`)
const lines = new_text.split(/[\r\n]/g)
const title = scrapbox.Page.title
lines.unshift(`from [/${src}/${title}]`)
const title_url = encodeURIComponent(title)
const body = lines.join('\n')
navigator.clipboard.writeText(body).then(()=>{
if (window.confirm("copied. create page?")) {
const body_enc = encodeURIComponent(body)
window.open(`https://scrapbox.io/${dst}/Re:${title_url}?body=${body_enc}`)
}
})
},
})
This page is auto-translated from /nishio/ToMyProj using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.