choromoto
スクリプト置き場
code:script.js
// テンプレートを追加
// 日記テンプレート
scrapbox.PageMenu.addMenu({
title: "日記テンプレート",
onClick: function () {
// // 曜日マップ
const d = new Date();
// 年
const year = d.getFullYear();
// 日
const dt = d.getDate();
// 月
const month = d.getMonth() + 1;
// 曜日
// お好きなタイトル
// yyyy-mm-dd
const title = [
year,
('00' + month).slice(-2), // 0埋め
('00' + dt).slice(-2) // 0埋め
].join('-');
// タグ
const tags = [
'#' + year + '年',
'#' + month + '月',
'#' + dt + '日'
];
// プロジェクトURLを取得
const projectName = scrapbox.Project.name;
const projectUrl = https://scrapbox.io/${projectName}/${encodeURIComponent(title)};
const queryString = body=${encodeURIComponent(tags.join(' '))};
const scrapboxUrl = ${projectUrl}?${queryString};
window.open(scrapboxUrl);
}
});
code:style.css
.container {
text-autospace: normal;
}
/* ページ内の行間を調整 */
.page-wrapper .page .line:not(.section-title) {
line-height: 2.2em;
}
/* 行間に合わせてドット位置を調整 */
.line .indent-mark .dot {
top: 13px;
}
.editor, .stream {
font-family: "Gen Interface JP", sans-serif;
}
/* addMenuしたやつのアイコンをFont awesomeに置き換える */
button#日記テンプレート.tool-btn:hover { text-decoration: none }
button#日記テンプレート.tool-btn::before { position: absolute; content: '\f518'; font: 900 21px/46px 'Font Awesome 5 Free' }
button#日記テンプレート.tool-btn img { opacity: 0 }