1Writer カレンダー
1Writer カレンダー2
2025/2/17
code:js
const html = `<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>デイリーノート選択</title>
<style>
body {
font-family: sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
input, button {
font-size: 18px;
padding: 10px;
margin: 10px;
}
button {
cursor: pointer;
}
</style>
</head>
<body>
<h2>デイリーノートを開く</h2>
<input type="date" id="datePicker">
<button onclick="openDailyNote()">開く</button>
<script>
document.addEventListener("DOMContentLoaded", function() {
const dateInput = document.getElementById('datePicker');
const today = new Date().toISOString().split('T')0; // 今日の日付を取得
dateInput.value = today; // デフォルトを今日に設定
dateInput.focus(); // 自動的にピッカーを開く
// 日付が変更されたら自動で開く
dateInput.addEventListener("change", openDailyNote);
});
function openDailyNote() {
const date = document.getElementById('datePicker').value;
if (!date) {
alert('日付を選択してください');
return;
}
const dir = 'Dropbox/vault/private/notes/';
const fileName = dir + date + ".md";
const filePath = encodeURIComponent(fileName); // URLエンコード
window.location.href = 'onewriter://x-callback-url/open?path=' + filePath;
}
</script>
</body>
</html>`;
webBrowser.loadHTML(html);