Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%*
- const logHeader = "###### Log"
- const file = tp.file.find_tfile(tp.date.now("YYYY-MM-DD"))
- var loggedItem = "";
- const choices = ['Note: ', 'Food: ', 'Weather: ', 'Pain: ']
- if (file) {
- let choice = await tp.system.suggester(choices, choices, false, "Type of comment", 30);
- if (choice) {
- loggedItem = await tp.system.prompt("Log to daily note:","",false)
- if (loggedItem !== null && loggedItem !== '') {
- const time = tp.date.now("dd DD.MM.yyyy - HH:mm")
- const content = (await app.vault.read(file)).split("\n")
- const index = content.indexOf(logHeader)
- let addContent = "- [<] " + time + " - **" + choice + "** *" + loggedItem + "*"
- content.splice(index + 1, 0 , addContent)
- await app.vault.modify(file, content.join("\n"))
- }
- }
- } else {
- new Notice("No daily note found.")
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement