generated at
ページ転送する拡張script

(雰囲気で書いた雑jsを放置している)

20210502 転送スクリプトができたので、こっちのタイトルも日付を省いた

script.js
export function exportPage(projectName) { // scrapbox以外のページとapiのページはexport対象から外す if(document.domain != 'scrapbox.io') return; if(!scrapbox || scrapbox.Layout !== 'page') return; const currentProjectName = scrapbox.Project.name; const currentPageName = encodeURIComponent(scrapbox.Page.title); let date_ob = new Date(); let date = ("0" + date_ob.getDate()).slice(-2); let month = ("0" + (date_ob.getMonth() + 1)).slice(-2); let year = ("" + date_ob.getFullYear()); // タイトル以外の行を取得する const body = encodeURIComponent(scrapbox.Page.lines.slice(1).map(l => l.text).join('\n')); const newLine = "%0A" const url = `https://scrapbox.io/${projectName}/${currentPageName}?body=${body}${newLine}${newLine}original page: [/blu3mo/${currentPageName}]`; console.log(url) window.open(url); } scrapbox.PageMenu.addMenu({ title: 'export', image: 'https://img.icons8.com/ios-glyphs/90/000000/share-rounded.png' }); const projectList = ["blu3mo-public", "collab", "villagepump"] projectList.forEach( (project) => { scrapbox.PageMenu('export').addItem({ title: `export this page to /${project}`, onClick: () => exportPage(project), }); });