UserScript:日付カウントダウン
code:script.js
scrapbox.PageMenu.addMenu({
title: '日付カウントダウン',
/* 日付計算SVG の画像を貼る */
})
code:scriptxx.js
/* 下位のメニューには ToDo とか */
//scrapbox.PageMenu('日付カウントダウン').addItem({
// title: () => "GTD:todo",
// onClick: () =>
// location=https://scrapbox.io/${scrapbox.Project.name}/ToDo
//})
/* とりあえず書くページとか */
//scrapbox.PageMenu('日付カウントダウン').addItem({
// title: () => "GTD:inbox",
// onClick: () =>
// location=https://scrapbox.io/${scrapbox.Project.name}/inbox
//})
/* 懸案事項 とかを入れる */
//scrapbox.PageMenu('日付カウントダウン').addItem({
// title: () => "GTD:pending",
// onClick: () =>
// location=https://scrapbox.io/${scrapbox.Project.name}/pending
//})
code:script.js
/* 今日の日付 */
const now = new Date()
const year = now.getYear() + 1900
const month = ('0' + (now.getMonth()+1)).slice(-2)
const day = ('0' + now.getDate()).slice(-2)
const ymd = ${year}/${month}/${day}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📖 ${ymd} 今日,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${ymd}
})
code:script.js
/* 先週末 */
const l = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7 + 5 - now.getDay())
const last_week = ${l.getYear() + 1900}/${('0' + (l.getMonth()+1)).slice(-2)}/${('0' + l.getDate()).slice(-2)}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📗 ${last_week} 先週末,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${last_week}
})
code:script.js
/* 昨日 */
const y = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1)
const yesterday = ${y.getYear() + 1900}/${('0' + (y.getMonth()+1)).slice(-2)}/${('0' + y.getDate()).slice(-2)}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📙 ${yesterday} 昨日,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${yesterday}
})
code:script.js
/* 明日 */
const t = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1)
const tomorrow = ${t.getYear() + 1900}/${('0' + (t.getMonth()+1)).slice(-2)}/${('0' + t.getDate()).slice(-2)}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📕 ${tomorrow} 明日,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${tomorrow}
})
code:script.js
/* 今週末 */
const w = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 5 - now.getDay())
const weekend = ${w.getYear() + 1900}/${('0' + (w.getMonth()+1)).slice(-2)}/${('0' + w.getDate()).slice(-2)}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📘 ${weekend} 今週末,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${weekend}
})
code:script.js
/* 月末 */
const m = new Date(now.getFullYear(), now.getMonth()+1, 0)
const eom = ${m.getYear() + 1900}/${('0' + (m.getMonth()+1)).slice(-2)}/${('0' + m.getDate()).slice(-2)}
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 📚 ${eom} 月末,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${eom}
})
code:script.js
/* 今月 */
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => 🗓 ${year}/${month} 今月,
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${m.getYear() + 1900}/${('0' + (m.getMonth()+1)).slice(-2)}
})
code:script.js
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => "🎆Bullet Journal",
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/バレットジャーナル
})
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => "🎇bujo:index",
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/bujo:index
})
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => "🎇bujo:keys",
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/bujo:keys
})
code:script.js
/* sandbox */
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => "🏖 sandbox",
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/sandbox
})
code:script.js
/* sandbox */
const config="UserScript:日付カウントダウン"
scrapbox.PageMenu('日付カウントダウン').addItem({
title: () => "🖊 編集",
onClick: () =>
location=https://scrapbox.io/${scrapbox.Project.name}/${config}
})
UserScript.icon
https://img.shields.io/badge/JavaScript-UserScript_日付カウントダウン-F7DF1E.svg?logo=javascript&style=for-the-badge