Last active
March 31, 2023 03:51
-
-
Save eoureo/3de97dc89855bb7405a856f17a883e45 to your computer and use it in GitHub Desktop.
옵시디언의 일지(Daily note)에 리스트 덧붙이는 Bookmarklet ("- 07:30 [T](U)" 형식 - 시각, 웹 페이지 제목과 주소)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(/*Add to Daily note in Obsidian*/function(){ | |
/* Bookmarklet: 웹 페이지 제목과 주소를 `- 07:30 [T](U)`형식으로 Obsidin의 Daily note에 한 줄 덧붙이기 */ | |
/* 설정 시작 ============== */ | |
let valult_name = "V-07"; /* 옵시디안의 볼트 이름 */ | |
let daily_note_folder = "journals"; /* Daily note 저장 폴더 */ | |
/* 설정 끝 ================ */ | |
/* 컴퓨터에 설정된 지역 날짜와 시간을 얻기 */ | |
var timezoneOffset = new Date().getTimezoneOffset() * 60000; | |
var localDate = new Date(Date.now() - timezoneOffset); | |
var query = []; | |
query.push("vault=" + valult_name); | |
query.push(`file=${daily_note_folder}/${(localDate.toISOString().substring(0,10))}`); | |
/* Daily note 파일 이름은 YYYY-MM-DD 형식 */ | |
var content = []; | |
content.push("- "); /* 다음 줄(\n)로 바꾸어 "-"을 넣는다 */ | |
content.push(localDate.toISOString().substring(11,16)); /* 시간 넣기: 07:30 형식 */ | |
content.push(` [${document.title}](${location.href})`); /* 링크 넣기: [T](U) 형식*/ | |
query.push("content=" + encodeURIComponent(content.join("") + "\n")); | |
query.push("append"); /* 새 글로 덮어쓰는 것이 아니라 덧붙인다는 설정 */ | |
query.push("silent"); /* Daily note를 활성창으로 만들 필요 없다는 설정 */ | |
document.location.href = "obsidian://new?" + query.join("&"); | |
})();void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Revision 2
@2023-03-31 12:50:00
먼저 덧붙이고 다음에 새로운 줄이 만들어지도록 바꿈.