New Buttonで開くページを変更する
動機

はページを新規作成するときに必ず
日付タグをつける
これを、
新規作成ボタンから実行できるようにすると便利なのでは?と思った
どうせ使わないボタン
別の機能として使って問題ない
実装
案1
href
をけす
案2
titleの変更で発動
日付を計算して、URLに埋め込む
時刻は入れない
hoverしたときに再計算すれば時刻も入れられるかも

href
にURLを代入する
案3
UserScriptをloadした時点の日付を取得
href
に書き込む
案2の簡略版
書けそうなので書いてみる
script.jsimport {toYYYYMMDD} from '/api/code/takker/Scrapbox_template_utilities/utilities.js';
for (const button of document.getElementsByClassName('new-button')) {
const timestamp = `#${toYYYYMMDD(new Date())}`;
button.href = `/${scrapbox.Project.name}/new?body=${encodeURIComponent('\n\n'+timestamp)}`;
}
console.log('The hrefs of "New Button" have been changed.')
いい感じ

からも使える
欠点

eventLIstenerでページを開くと、新しいタブになってしまう
href
に書き込むと、タブを変えずに開いてくれる
確認済み