Bullet Journalを導入するUserScript
/scrasobox/Bullet Journal をやってみる
_ [_] タスク
x [x] 完了タスク
> [>] 先送りタスク
< [<] リスケ済みタスク
- [-] キャンセルしたタスク
g [g] よかったこと
settingsページでのimport順さえ気にしておけばFlexokiCSSの関数も使えそう。嬉しい
タスク以外のbulletは使う予定ないから消した
残ったアイコンだけならfont-weight: 400;でいけるっぽい
900よりも400のほうが好みだからよかった
キャンセル用のアイコン足した 2024-04-23
code:script.js
// ここからアイコンとスタイルの定義
// - アイコンの名前はエンコードしなくてOK、日本語でもOK
// - スタイル部分は content だけ必須、バックスラッシュ2個必要なので注意、あとはお好みで
const tagIconStyles = {
"_" : "{ content: '\\f0c8'; color: var(--cy-2) }", /* タスク */
"x" : "{ content: '\\f14a'; color: var(--cy) }", /* 完了タスク */
">" : "{ content: '\\f14d'; color: var(--tx-3) }", /* 先送りしたタスク */
"<" : "{ content: '\\f274'; color: var(--tx-3) }", /* 日付を決めたタスク */
"-" : "{ content: '\\f410'; color: var(--tx-3) }", /* キャンセルしたタスク */
"g" : "{ content: '\\f164'; color: var(--ma) }", /* よかったこと */
};
// ここから下は無視してね ---------------------
(function(m){
let charSelectors = [], afterLinkSelectors = [], iconStyle = ""
const linkSelFmt = ".line:not(.cursor-line) ahref$='/#':not(.icon)"
const charStyle = "{display:inline-block;width:0;text-indent:-9999px}"
const afterLinkStyle = "{display:inline-block;min-width:1.15em;padding-left:1px;font: 400 110%/normal 'Font Awesome 5 Free';text-align:center}"
const a = "::after", f = " span"
const enc = '@$&+=:;", ','@$&+=:;",_'
const encode = tag => Array.from(tag).map(c => {
const i = enc0.indexOf(c)
return -1 < i && enc1i ? enc1i : encodeURIComponent(c) }).join("");
for (var k in m) {
const href = encode(k)
charSelectors.push(linkSelFmt.replace(/#/, href) + f)
afterLinkSelectors.push(linkSelFmt.replace(/#/, href) + a)
iconStyle += linkSelFmt.replace(/#/, href) + a + mk
}
let style = document.createElement('style')
style.appendChild(document.createTextNode(charSelectors.join(",") + charStyle))
style.appendChild(document.createTextNode(afterLinkSelectors.join(",") + afterLinkStyle))
style.appendChild(document.createTextNode(iconStyle))
document.head.appendChild(style)
})(tagIconStyles)
#UserScript