generated at
新規作成時に日付タグを挿入するUserScript
新規作成ボタンを押して作成したページに、予め日付タグを挿入しておくUserScript
作成動機と過程はNew Buttonで開くページを変更するを参照

2021-09-29
07:37:16
日付操作ライブラリをdate-fns.min.jsに変更
検索欄に記入されている文字列をタイトルとして使う

setInterval()で時刻を更新する
script.js
import {lightFormat} from "../date-fns.min.js/script.js"; setInterval(() => { for (const button of document.getElementsByClassName("new-button")) { const title = document.getElementsByClassName("form-control")?.[0]?.value; const timestamp = `#${lightFormat(new Date(), "yyyy-MM-dd HH:mm:ss")}`; button.href = `/${scrapbox.Project.name}/${title || "new"}?body=${encodeURIComponent([ "", "", timestamp, ].join("\n"))}`; } }, 1000); console.log('The hrefs of "New Button" have been changed.');

よさそう
#2021-09-29 07:25:13