今開いているページをデイリーページに追記するUserScript
やりたいことを整理する
やることは、「新しいページに切り出す」に似ている。
違いは、開いているページの本文はまったく使わず、ただタイトルだけを用いること。
参考:アイデアラインからページを切り出すUserScript
code:script.js
cosense.PageMenu.addItem({
title: 'set',
onClick: insertDairy
});
function insertDairy(){
const projectRoot = encodeURI(scrapbox.Project.name)
const startingPageTitle = "+ encodeURI(scrapbox.Page.title) + ""
const d = new Date();
const year = d.getFullYear();
const month = d.getMonth() + 1; // getMonth() は0から11を返すため、+1する
const day = d.getDate();
// ゼロ埋めされていない形式で日付文字列を構築
const rowPrev = ${year}/${month}/${day};
const prev = encodeURIComponent(rowPrev);
window.open(https://scrapbox.io/${projectRoot}/${prev}?body=${startingPageTitle})
}