日時入りmemoのtemplate
↓だけだと、いちいち/icons/Scrapbox.iconを開く必要があって面倒
code:makeNewMemo.js
import {createPage} from '/api/code/takker/Scrapbox_template_utilities/utilities.js';
export default () => createPage((today, time) => [
'new', [
'',
'',
#${today} ${time}]]);
code:script-private.js
javascript:(() => {
const project_name = 'takker-memex';
// ページ作成日時をhash tagとして末尾に追加する
const zero = n => String(n).padStart(2, '0');
const today = (d => ${d.getFullYear()}-${zero(d.getMonth() + 1)}-${zero(d.getDate())} ${zero(d.getHours())}:${zero(d.getMinutes())}:${zero(d.getSeconds())})(new Date());
// 一行目&二行目:空行 三行目:hash tag
const lines = ['', '', #${today}];
const body = encodeURIComponent(lines.join('\n'));
window.open(https://scrapbox.io/${project_name}/new?body=${body});
})()
code:script.js
javascript:(() => {
const project_name = 'takker';
// ページ作成日時をhash tagとして末尾に追加する
const zero = n => String(n).padStart(2, '0');
const today = (d => ${d.getFullYear()}-${zero(d.getMonth() + 1)}-${zero(d.getDate())} ${zero(d.getHours())}:${zero(d.getMinutes())}:${zero(d.getSeconds())})(new Date());
// 一行目&二行目:空行 三行目:hash tag
const lines = ['', '', #${today}];
const body = encodeURIComponent(lines.join('\n'));
window.open(https://scrapbox.io/${project_name}/new?body=${body});
})()
projectの名前をscriptから取得するようにした
時刻も挿入するようにした